/* ============================================================
   LabChemist Admin — design system
   Premium evolution: ink-navy chrome, blue primary, Fira pair,
   instrument-grade density, authored motion.
   ============================================================ */

:root {
    --color-primary: #1E40AF;
    --color-primary-deep: #162E87;
    --color-secondary: #3B82F6;
    --color-accent: #D97706;
    --color-bg: #F4F6FB;
    --color-surface: #FFFFFF;
    --color-line: #E5EAF3;
    --color-ink: #0B1220;
    --color-ink-2: #111C37;
    --color-fg: #0F172A;
    --color-muted: #64748B;
    --color-ring: #2563EB;

    --radius: 1rem;
    --radius-sm: .7rem;
    --radius-lg: 1.25rem;

    --shadow-card: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 32px -20px rgba(30, 64, 175, .25);
    --shadow-card-hover: 0 2px 4px rgba(15, 23, 42, .05), 0 24px 48px -24px rgba(30, 64, 175, .34);
    --shadow-float: 0 4px 8px rgba(15, 23, 42, .05), 0 36px 72px -36px rgba(30, 64, 175, .45);

    --ease-out: cubic-bezier(.22, 1, .36, 1);
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: "Fira Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--color-fg);
    background:
        radial-gradient(1100px 480px at 100% -10%, rgba(59, 130, 246, .07), transparent 60%),
        radial-gradient(900px 420px at -10% 0%, rgba(30, 64, 175, .06), transparent 55%),
        var(--color-bg);
    background-attachment: fixed;
    line-height: 1.5;
}

::selection {
    background: rgba(59, 130, 246, .22);
}

.font-data {
    font-family: "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-feature-settings: "tnum" 1, "zero" 1;
}

/* ---------- Layout chrome ---------- */
#sidebar {
    background:
        radial-gradient(560px 420px at 120% -10%, rgba(59, 130, 246, .20), transparent 60%),
        linear-gradient(180deg, #0a0f1e 0%, #101b33 58%, #14284f 120%);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .18) transparent;
    box-shadow: 8px 0 32px -24px rgba(2, 6, 23, .55);
}

.sidebar-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .62rem .9rem;
    border-radius: .7rem;
    color: rgba(203, 213, 225, .78);
    font-weight: 500;
    font-size: .895rem;
    min-height: 44px;
    overflow: hidden;
    transition: background .22s var(--ease-out), color .22s var(--ease-out), transform .22s var(--ease-out);
}

.sidebar-link::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(59, 130, 246, .16), transparent 70%);
    opacity: 0;
    transition: opacity .22s var(--ease-out);
}

.sidebar-link svg {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    color: rgba(147, 197, 253, .7);
    transition: color .22s var(--ease-out), transform .22s var(--ease-out);
}

.sidebar-link span { position: relative; z-index: 1; }

.sidebar-link:hover {
    background: rgba(255, 255, 255, .06);
    color: #f8fafc;
    transform: translateX(2px);
}

.sidebar-link:hover::before { opacity: 1; }
.sidebar-link:hover svg { color: #93c5fd; transform: scale(1.06); }

.sidebar-link.active {
    background: linear-gradient(90deg, rgba(37, 99, 235, .30), rgba(37, 99, 235, .08));
    color: #ffffff;
    box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .08), inset 0 0 0 1px rgba(59, 130, 246, .22);
}

.sidebar-link.active::before { opacity: 1; }
.sidebar-link.active svg { color: #bfdbfe; }

.sidebar-link.active::after {
    content: "";
    position: absolute;
    left: .5rem;
    top: 50%;
    width: 3px;
    height: 16px;
    border-radius: 999px;
    background: linear-gradient(180deg, #60a5fa, #3b82f6);
    transform: translateY(-50%) scaleY(1);
    transition: transform .25s var(--ease-out);
}

.topbar {
    background: rgba(255, 255, 255, .82);
    backdrop-filter: blur(12px) saturate(1.4);
    -webkit-backdrop-filter: blur(12px) saturate(1.4);
    border-bottom: 1px solid rgba(226, 232, 240, .9);
}

/* ---------- Cards ---------- */
.kpi-card {
    background: var(--color-surface);
    border: 1px solid var(--color-line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    transition: transform .28s var(--ease-out), box-shadow .28s var(--ease-out), border-color .28s var(--ease-out);
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card-hover);
    border-color: #c7d7f3;
}

.kpi-icon {
    width: 46px;
    height: 46px;
    border-radius: .85rem;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .04);
}

.panel-card {
    background: var(--color-surface);
    border: 1px solid var(--color-line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}

.panel-card .panel-head {
    border-bottom: 1px solid #eef2f8;
}

.panel-card > .panel-head { border-radius: var(--radius) var(--radius) 0 0; }

/* ---------- Table ---------- */
.data-table thead th {
    background: #f1f5fb;
    color: #64748b;
    font-size: .665rem;
    letter-spacing: .09em;
    text-transform: uppercase;
    font-weight: 600;
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background .18s var(--ease-out);
}

.data-table tbody tr:hover {
    background: #f6f9ff;
}

.data-table tbody td {
    border-bottom: 1px solid #f0f3f9;
    font-size: .875rem;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover td { color: #0f172a; }

/* ---------- Scrollbars ---------- */
.thin-scroll::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}
.thin-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}
.thin-scroll::-webkit-scrollbar-thumb:hover { background: #b6c2d4; }
.thin-scroll::-webkit-scrollbar-track {
    background: transparent;
}

/* ---------- Badges & chips ---------- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    border-radius: 999px;
    padding: .24rem .68rem;
    font-size: .715rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.chip-green { background: #dcfce7; color: #15803d; }
.chip-red { background: #fee2e2; color: #b91c1c; }
.chip-amber { background: #fef3c7; color: #b45309; }
.chip-blue { background: #dbeafe; color: #1d4ed8; }
.chip-slate { background: #e2e8f0; color: #475569; }

.dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    display: inline-block;
    flex-shrink: 0;
}

/* ---------- Tabs ---------- */
.tab-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .72rem .95rem;
    font-size: .82rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: color .2s var(--ease-out);
    margin-bottom: -1px;
}

.tab-btn::after {
    content: "";
    position: absolute;
    left: .5rem;
    right: .5rem;
    bottom: 0;
    height: 2px;
    border-radius: 999px 999px 0 0;
    background: linear-gradient(90deg, #1e40af, #3b82f6);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .28s var(--ease-out);
}

.tab-btn:hover { color: #1e40af; }
.tab-btn.active { color: #1e40af; }
.tab-btn.active::after { transform: scaleX(1); }

.chip-chip-btn {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: .34rem .85rem;
    font-size: .755rem;
    font-weight: 600;
    color: #475569;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all .2s var(--ease-out);
}
.chip-chip-btn:hover { background: #e2e8f0; }
.chip-chip-btn.active {
    background: #1e40af;
    border-color: #1e40af;
    color: #fff;
    box-shadow: 0 6px 14px -8px rgba(30, 64, 175, .6);
}

/* ---------- Progress ---------- */
.progress {
    background: #eef2f8;
    border-radius: 999px;
    height: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--color-secondary), #60a5fa);
    transition: width .9s var(--ease-out);
}

.progress-bar-accent {
    background: linear-gradient(90deg, var(--color-accent), #fbbf24);
}

.progress-bar-green {
    background: linear-gradient(90deg, #16a34a, #4ade80);
}

.progress-bar-red {
    background: linear-gradient(90deg, #dc2626, #f87171);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 44px;
    padding: .5rem 1.1rem;
    border-radius: .7rem;
    font-weight: 600;
    font-size: .875rem;
    cursor: pointer;
    border: 1px solid transparent;
    user-select: none;
    transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out), background .2s ease, border-color .2s ease, color .2s ease;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
    background: linear-gradient(180deg, #2447b8, #1e40af);
    color: #fff;
    box-shadow: 0 8px 20px -10px rgba(30, 64, 175, .6), inset 0 1px 0 rgba(255, 255, 255, .14);
}
.btn-primary:hover {
    background: linear-gradient(180deg, #2a51c8, #1c3aa5);
    box-shadow: 0 10px 24px -10px rgba(30, 64, 175, .7), inset 0 1px 0 rgba(255, 255, 255, .16);
    transform: translateY(-1px);
}
.btn-primary:active { background: #162e85; transform: translateY(0); }

.btn-outline {
    background: #fff;
    border-color: #e2e8f0;
    color: #334155;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.btn-outline:hover { border-color: #bfdbfe; background: #f8fafc; }

.btn-ghost {
    background: transparent;
    color: #64748b;
}
.btn-ghost:hover { background: #f1f5f9; color: #0f172a; }

.btn-danger {
    background: linear-gradient(180deg, #e04141, #dc2626);
    color: #fff;
    box-shadow: 0 8px 20px -10px rgba(220, 38, 38, .6), inset 0 1px 0 rgba(255, 255, 255, .14);
}
.btn-danger:hover {
    background: linear-gradient(180deg, #ea4a4a, #c92222);
    transform: translateY(-1px);
}
.btn-danger:active { transform: translateY(0); }

.icon-btn {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: .7rem;
    color: #475569;
    background: transparent;
    cursor: pointer;
    transition: background .2s ease, color .2s ease, transform .2s var(--ease-out);
}
.icon-btn:hover { background: #eef2f7; color: #0f172a; transform: translateY(-1px); }
.icon-btn:active { transform: translateY(0); }

/* ---------- Motion ---------- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-up {
    animation: fadeUp .5s var(--ease-out) both;
}

@keyframes pulseRing {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .45); }
    70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.pulse-dot { animation: pulseRing 2.2s ease-out infinite; }

/* Reveal-on-view (script-free default: visible) */
.js .reveal {
    opacity: 0;
    transform: translateY(16px);
}

.js .reveal.in {
    opacity: 1;
    transform: translateY(0);
    transition: opacity .6s var(--ease-out) var(--d, 0s), transform .6s var(--ease-out) var(--d, 0s);
}

/* Number count-up — real value in markup, JS animates */
.js .count-value { transition: none; }

/* Modal motion */
#askdelete:not(.hidden),
#addsekolah:not(.hidden) {
    animation: overlayIn .28s ease both;
}

@keyframes overlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#askdelete:not(.hidden) #msg,
#addsekolah:not(.hidden) #msg-add {
    animation: modalIn .34s var(--ease-out) both;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(14px) scale(.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Login ---------- */
.login-shell {
    background:
        radial-gradient(1000px 500px at 85% -10%, rgba(59, 130, 246, .20), transparent 60%),
        radial-gradient(800px 500px at -10% 110%, rgba(30, 64, 175, .26), transparent 60%),
        linear-gradient(160deg, #0b1020 0%, #162e6e 100%);
    position: relative;
    overflow: hidden;
}

.aurora {
    position: absolute;
    border-radius: 9999px;
    filter: blur(70px);
    opacity: .55;
    will-change: transform;
    animation: auroraDrift 18s ease-in-out infinite alternate;
}

.aurora-1 {
    width: 420px;
    height: 420px;
    background: rgba(59, 130, 246, .35);
    top: -140px;
    right: -120px;
}

.aurora-2 {
    width: 460px;
    height: 460px;
    background: rgba(99, 102, 241, .30);
    bottom: -180px;
    left: -140px;
    animation-delay: -6s;
}

.aurora-3 {
    width: 260px;
    height: 260px;
    background: rgba(217, 119, 6, .22);
    top: 40%;
    left: 12%;
    animation-delay: -11s;
}

@keyframes auroraDrift {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to { transform: translate3d(30px, -24px, 0) scale(1.08); }
}

.login-card {
    background: rgba(255, 255, 255, .965);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, .6);
    box-shadow: 0 24px 64px -24px rgba(2, 6, 23, .65), inset 0 1px 0 rgba(255, 255, 255, .8);
}

/* ---------- Accessibility ---------- */
:focus-visible {
    outline: 2px solid var(--color-ring);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
