/* =====================================================
   DESIGN TOKENS — bluWarehouse
   Palet biru–cyan (identitas "blu by BCA") diperdalam jadi
   sistem warna teknis: panel gelap untuk status live/KV,
   permukaan terang untuk kerja harian.
===================================================== */

:root {
    --ink: #0B111C;
    --ink-soft: #16233A;
    --canvas: #F3F6FB;
    --surface: #FFFFFF;

    --brand-600: #0B63CE;
    --brand-700: #0A4FA3;
    --brand-900: #0E3468;

    --cyan-400: #22D3EE;
    --cyan-500: #06AED4;

    --line: #DEE6F1;

    --font-ui: "Plus Jakarta Sans", Inter, ui-sans-serif, system-ui,
        -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo,
        Consolas, monospace;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: var(--canvas);
    color: var(--ink);
    font-family: var(--font-ui);
    letter-spacing: -0.01em;
}

body {
    min-height: 100dvh;
}

button,
input {
    font: inherit;
}

button {
    user-select: none;
}

.hidden {
    display: none !important;
}

.font-mono {
    font-family: var(--font-mono);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

/* =====================================================
   BRAND SURFACES
===================================================== */

.blu-gradient {
    background: linear-gradient(150deg, var(--brand-900) 0%, var(--brand-600) 62%, var(--cyan-500) 130%);
}

.blu-glow {
    box-shadow: 0 14px 30px -10px rgba(11, 99, 206, 0.4);
}

.blu-card {
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: 0 1px 2px rgba(11, 17, 28, 0.04);
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: white;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
    vertical-align: middle;
}

.spinner-blue {
    width: 28px;
    height: 28px;
    border: 3px solid #DCEEFF;
    border-top-color: var(--brand-600);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.login-bg {
    background:
        radial-gradient(circle at 50% 0%, rgba(6, 174, 212, .12), transparent 55%),
        radial-gradient(circle at 100% 100%, rgba(11, 99, 206, .10), transparent 50%),
        var(--canvas);
}

.input-focus:focus {
    outline: none;
    border-color: var(--brand-600);
    box-shadow: 0 0 0 4px rgba(11, 99, 206, .14);
}

/* =====================================================
   KV / INVENTORY PANEL — elemen berani halaman ini:
   panel gelap "control panel" untuk status data live
   dari Cloudflare KV, kontras dengan kartu terang di sekitarnya.
===================================================== */

.kv-panel {
    position: relative;
    overflow: hidden;
    background: linear-gradient(155deg, var(--ink) 0%, var(--ink-soft) 100%);
    border-radius: 26px;
    box-shadow: 0 18px 40px -18px rgba(11, 17, 28, .55);
}

.kv-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(420px 160px at 100% -10%, rgba(6, 174, 212, .22), transparent 65%);
    pointer-events: none;
}

.kv-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #64748B;
    flex-shrink: 0;
}

.kv-dot.is-live {
    background: var(--cyan-400);
    box-shadow: 0 0 0 0 rgba(34, 211, 238, .55);
    animation: kvPulse 1.8s ease-out infinite;
}

.kv-dot.is-error {
    background: #FB7185;
}

@keyframes kvPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 211, 238, .5);
    }

    70% {
        box-shadow: 0 0 0 9px rgba(34, 211, 238, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(34, 211, 238, 0);
    }
}

.kv-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    flex-shrink: 0;
    transition: transform .25s ease;
}

.kv-icon.is-bursting {
    animation: kvBurst .7s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes kvBurst {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 211, 238, .55);
        transform: scale(1);
    }

    35% {
        transform: scale(1.14);
    }

    100% {
        box-shadow: 0 0 0 22px rgba(34, 211, 238, 0);
        transform: scale(1);
    }
}

.kv-refresh-btn {
    width: 40px;
    height: 40px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .14);
    color: #E4ECFB;
    font-size: 17px;
    transition: transform .15s ease, background .15s ease;
    flex-shrink: 0;
}

.kv-refresh-btn:active {
    transform: scale(.9);
}

.kv-refresh-btn:disabled {
    opacity: .45;
}

.kv-refresh-btn .kv-refresh-icon {
    display: inline-block;
    transition: transform .3s ease;
}

.kv-refresh-btn.is-loading .kv-refresh-icon {
    animation: kvSpin .8s linear infinite;
}

@keyframes kvSpin {
    to {
        transform: rotate(360deg);
    }
}

/* =====================================================
   TOAST
===================================================== */

#toastContainer {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 18px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    width: 100%;
    max-width: 430px;
    margin: 0 auto;
    background: rgba(11, 17, 28, .96);
    color: white;
    border-radius: 18px;
    padding: 13px 15px;
    display: flex;
    align-items: center;
    gap: 11px;
    box-shadow: 0 15px 35px rgba(11, 17, 28, .3);
    transform: translateY(25px) scale(.96);
    opacity: 0;
    animation: toastIn .28s cubic-bezier(.34, 1.56, .64, 1) forwards;
}

.toast.leaving {
    animation: toastOut .25s ease forwards;
}

.toast-icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(255, 255, 255, .12);
}

.toast-content {
    min-width: 0;
    flex: 1;
}

.toast-title {
    font-size: 12px;
    font-weight: 800;
}

.toast-message {
    font-size: 11px;
    color: rgba(255, 255, 255, .7);
    margin-top: 2px;
    line-height: 1.4;
}

@keyframes toastIn {
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes toastOut {
    to {
        transform: translateY(20px) scale(.96);
        opacity: 0;
    }
}

/* Varian sukses — dipakai untuk momen selesai seperti
   pembaruan data KV manual. Ada trim gradien + centang
   yang "digambar", bukan alert bawaan browser. */

.toast--success {
    background: linear-gradient(135deg, var(--ink) 0%, var(--ink-soft) 100%);
    border: 1px solid rgba(34, 211, 238, .35);
    box-shadow: 0 15px 35px rgba(6, 174, 212, .28);
}

.toast--success .toast-icon {
    background: rgba(34, 211, 238, .16);
}

.toast-check {
    width: 20px;
    height: 20px;
    overflow: visible;
}

.toast-check circle {
    fill: none;
    stroke: var(--cyan-400);
    stroke-width: 1.6;
    stroke-dasharray: 63;
    stroke-dashoffset: 63;
    animation: toastCheckRing .5s ease forwards;
}

.toast-check path {
    fill: none;
    stroke: var(--cyan-400);
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 16;
    stroke-dashoffset: 16;
    animation: toastCheckMark .3s ease .35s forwards;
}

@keyframes toastCheckRing {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes toastCheckMark {
    to {
        stroke-dashoffset: 0;
    }
}

/* =====================================================
   QUICK ACTION
===================================================== */

.quick-action {
    transition: transform .18s ease, box-shadow .18s ease;
}

.quick-action:active {
    transform: scale(.96);
}

/* =====================================================
   STAT CARD
===================================================== */

.stat-card {
    position: relative;
    border-left: 3px solid var(--brand-600);
}

.stat-card .stat-card-value {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* =====================================================
   DRAFT
===================================================== */

.draft-card {
    transition: transform .18s ease, box-shadow .18s ease;
}

.draft-card:active {
    transform: scale(.985);
}

.draft-number {
    width: 32px;
    height: 32px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    font-family: var(--font-mono);
    background: #EEF3FA;
    color: #4B5972;
    flex-shrink: 0;
}

.draft-card-out .draft-number {
    background: #FFF1F2;
    color: #E11D48;
}

.draft-card-in .draft-number {
    background: #ECFDF5;
    color: #059669;
}

/* =====================================================
   SEARCH HIGHLIGHT
===================================================== */

.search-highlight {
    background: #FEF08A;
    color: #713F12;
    border-radius: 4px;
    padding: 0 2px;
    font-weight: 800;
}

/* =====================================================
   LOGOUT
===================================================== */

.logout-overlay {
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
}

.logout-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.logout-box {
    transform: scale(.85) translateY(10px);
    opacity: 0;
    transition: transform .35s cubic-bezier(.34, 1.56, .64, 1), opacity .25s ease;
}

.logout-overlay.active .logout-box {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.logout-icon {
    animation: logoutPulse 1.2s ease-in-out infinite;
}

.logout-icon.leaving {
    animation: logoutLeaving .65s cubic-bezier(.55, .06, .68, .19) forwards;
}

@keyframes logoutPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }
}

@keyframes logoutLeaving {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateY(-35px) scale(.65);
        opacity: 0;
    }
}

.logout-dots::after {
    content: "";
    animation: logoutDots 1.2s infinite;
}

@keyframes logoutDots {
    0% {
        content: "";
    }

    33% {
        content: ".";
    }

    66% {
        content: "..";
    }

    100% {
        content: "...";
    }
}
