/* =========================================================
   Design Tokens — Absensi QR SMA Digital
   Palette: Navy akademik + Teal aksen + latar netral hangat
   ========================================================= */
:root {
    --navy-900: #101B33;
    --navy-800: #17264A;
    --navy-700: #1F2F57;
    --teal-500: #0EA5A2;
    --teal-600: #0B8784;
    --amber-500: #F59E0B;
    --red-500: #DC2626;
    --bg-page: #F3F5F9;
    --bg-card: #FFFFFF;
    --text-main: #1B2333;
    --text-muted: #6B7280;
    --border-soft: #E6E9F0;
    --shadow-card: 0 8px 24px -12px rgba(16, 27, 51, 0.18);
    --shadow-card-hover: 0 14px 32px -14px rgba(16, 27, 51, 0.24);
    --radius-lg: 18px;
    --radius-md: 12px;
    --font-display: 'Poppins', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* { box-sizing: border-box; }

body {
    background: var(--bg-page);
    font-family: var(--font-body);
    color: var(--text-main);
    min-height: 100vh;
}

.text-muted-light { color: rgba(255,255,255,0.65); }

/* ---------------- TOP BAR ---------------- */
.topbar {
    background: linear-gradient(120deg, var(--navy-900) 0%, var(--navy-700) 100%);
    color: #fff;
    box-shadow: var(--shadow-card);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: rgba(14, 165, 162, 0.18);
    border: 1px solid rgba(14, 165, 162, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    color: var(--teal-500);
    flex-shrink: 0;
}

.brand-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.2px;
}

.brand-subtitle {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.6);
}

.clock-box {
    font-family: var(--font-display);
    font-variant-numeric: tabular-nums;
    font-size: 1.1rem;
    line-height: 1.2;
}

/* ---------------- PANEL CARD ---------------- */
.panel-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow .25s ease;
}

.panel-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border-soft);
    font-family: var(--font-display);
}

.panel-card-body {
    padding: 1.25rem;
    flex: 1;
}

.badge-soft {
    background: rgba(14, 165, 162, 0.12);
    color: var(--teal-600);
    font-weight: 600;
    font-size: 0.78rem;
    padding: .45em .8em;
    border-radius: 999px;
}

.badge-soft-success {
    background: rgba(22, 163, 74, 0.12);
    color: #15803D;
    font-weight: 600;
    font-size: 0.78rem;
    padding: .45em .8em;
    border-radius: 999px;
}

/* ---------------- SCANNER ---------------- */
.scanner-frame {
    position: relative;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    aspect-ratio: 1 / 1;
    background: var(--navy-900);
    border-radius: var(--radius-md);
    overflow: hidden;
}

#qr-reader {
    width: 100% !important;
    height: 100% !important;
}

/* html5-qrcode injects its own <video>/<canvas> — force them to fill the frame */
#qr-reader video, #qr-reader canvas {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: var(--radius-md);
}

#qr-reader img { display: none !important; } /* sembunyikan ikon default library */

.scanner-corners {
    position: absolute;
    inset: 12%;
    pointer-events: none;
}
.corner {
    position: absolute;
    width: 34px;
    height: 34px;
    border: 3px solid var(--teal-500);
    opacity: 0.9;
}
.corner.tl { top: 0; left: 0; border-right: none; border-bottom: none; border-radius: 8px 0 0 0; }
.corner.tr { top: 0; right: 0; border-left: none; border-bottom: none; border-radius: 0 8px 0 0; }
.corner.bl { bottom: 0; left: 0; border-right: none; border-top: none; border-radius: 0 0 0 8px; }
.corner.br { bottom: 0; right: 0; border-left: none; border-top: none; border-radius: 0 0 8px 0; }

.scanner-hint {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: .9rem;
    margin-bottom: 0;
}

.divider {
    border: none;
    border-top: 1px dashed var(--border-soft);
    margin: 1.5rem 0;
}

/* ---------------- FORM ---------------- */
.manual-form { max-width: 480px; margin: 0 auto; }

.btn-brand {
    background: var(--teal-500);
    border: none;
    color: #fff;
    font-weight: 600;
}
.btn-brand:hover, .btn-brand:focus {
    background: var(--teal-600);
    color: #fff;
}

.form-control:focus {
    border-color: var(--teal-500);
    box-shadow: 0 0 0 0.2rem rgba(14, 165, 162, 0.18);
}

/* ---------------- FEED LIST ---------------- */
.feed-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 560px;
    overflow-y: auto;
}

.feed-item {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .85rem 1.25rem;
    border-bottom: 1px solid var(--border-soft);
    animation: slideIn .35s ease;
}
.feed-item:last-child { border-bottom: none; }

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.feed-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--navy-800);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-family: var(--font-display);
    flex-shrink: 0;
    font-size: 0.85rem;
}

.feed-name { font-weight: 600; font-size: 0.92rem; }
.feed-meta { font-size: 0.78rem; color: var(--text-muted); }

.feed-time {
    margin-left: auto;
    text-align: right;
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-pill {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    padding: .15em .55em;
    border-radius: 6px;
    margin-top: 2px;
}
.status-pill.hadir { background: rgba(22,163,74,.12); color: #15803D; }
.status-pill.terlambat { background: rgba(245,158,11,.14); color: #B45309; }

/* ---------------- TOAST ---------------- */
.toast { min-width: 300px; border-radius: var(--radius-md); overflow: hidden; }
.toast.text-bg-success .toast-body,
.toast.text-bg-danger .toast-body,
.toast.text-bg-warning .toast-body { color: #fff; }

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 991.98px) {
    .scanner-frame { max-width: 100%; }
    .panel-card-body { padding: 1rem; }
}

@media (max-width: 575.98px) {
    .brand-title { font-size: 1rem; }
    .brand-subtitle { font-size: 0.7rem; }
    .scanner-frame { aspect-ratio: 4 / 5; }
    .panel-card-header { padding: .9rem 1rem; flex-wrap: wrap; }
    .feed-list { max-height: 380px; }
}
