:root {
    --primary: #4361ee;
    --primary-dark: #3a0ca3;
    --secondary: #4cc9f0;
    --success: #2ec4b6;
    --danger: #e63946;
    --warning: #ffb703;
    --dark: #1d2333;
    --light-bg: #f4f6fb;
    --radius: 16px;
}

* { box-sizing: border-box; }

body {
    background: var(--light-bg);
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    color: var(--dark);
}

/* ===== Sidebar ===== */
.sidebar {
    background: linear-gradient(180deg, var(--primary-dark), var(--primary));
    min-height: 100vh;
    color: #fff;
    padding: 24px 16px;
}
.sidebar .brand {
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 6px;
    transition: 0.2s;
    font-size: 0.95rem;
}
.sidebar a:hover, .sidebar a.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

/* ===== Content wrapper (area di samping sidebar) ===== */
.content-wrapper {
    margin-left: 260px;
    width: 100%;
}

/* ===== Tombol hamburger (hanya tampil di mobile) ===== */
.btn-hamburger {
    background: transparent;
    border: none;
    font-size: 1.3rem;
    line-height: 1;
    color: var(--dark);
    padding: 6px 10px;
    border-radius: 10px;
}
.btn-hamburger:hover, .btn-hamburger:focus {
    background: rgba(67,97,238,0.1);
    color: var(--primary);
}

/* Overlay gelap di belakang sidebar saat menu mobile terbuka */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1040;
}

/* ===== Mode Mobile: sidebar jadi menu hamburger (tampil/sembunyi) ===== */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        max-width: 80vw;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 4px 0 25px rgba(0,0,0,0.25);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .content-wrapper {
        margin-left: 0;
    }
    .sidebar-overlay.show {
        display: block;
    }
}

/* Di layar besar, hamburger & overlay tidak pernah dibutuhkan */
@media (min-width: 992px) {
    .btn-hamburger { display: none !important; }
    .sidebar-overlay { display: none !important; }
}

/* ===== Cards & Widgets ===== */
.card-stat {
    border: none;
    border-radius: var(--radius);
    padding: 22px;
    color: #fff;
    box-shadow: 0 10px 25px rgba(67,97,238,0.15);
    position: relative;
    overflow: hidden;
}
.card-stat.blue   { background: linear-gradient(135deg,#4361ee,#3a0ca3); }
.card-stat.green  { background: linear-gradient(135deg,#2ec4b6,#0a9396); }
.card-stat.orange { background: linear-gradient(135deg,#ffb703,#fb8500); }
.card-stat.red    { background: linear-gradient(135deg,#e63946,#9d0208); }
.card-stat h2 { font-weight: 700; margin: 6px 0 0; }
.card-stat i { font-size: 2.2rem; opacity: 0.85; }

.card-modern {
    border: none;
    border-radius: var(--radius);
    box-shadow: 0 6px 20px rgba(0,0,0,0.06);
    background: #fff;
}

.btn-primary-modern {
    background: linear-gradient(135deg,#4361ee,#3a0ca3);
    color: #fff; border: none; border-radius: 12px;
    padding: 10px 22px; font-weight: 600;
}
.btn-primary-modern:hover { opacity: 0.9; color:#fff; }

.table-modern thead { background: #eef1fb; }
.table-modern th, .table-modern td { vertical-align: middle; }

/* ===== Login & Kiosk Page ===== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4361ee, #3a0ca3 60%, #4cc9f0);
    padding: 20px;
}
.auth-card {
    background: #fff;
    border-radius: 24px;
    padding: 40px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
}

.kiosk-wrapper {
    min-height: 100vh;
    background: radial-gradient(circle at top, #4cc9f0, #3a0ca3);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.kiosk-card {
    background: #fff;
    border-radius: 28px;
    padding: 36px;
    max-width: 560px;
    width: 100%;
    box-shadow: 0 30px 60px rgba(0,0,0,0.3);
    text-align: center;
}

.siswa-pill {
    border: 2px solid #eef1fb;
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: 0.2s;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}
.siswa-pill { text-decoration: none; }
.siswa-pill:hover { border-color: var(--primary); background:#f5f7ff; transform: translateY(-2px); }
.avatar-inisial { min-width: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; letter-spacing: 0.5px; -webkit-user-select: none; user-select: none; flex-shrink: 0; }

/* ===== Radio Card (dipakai di form Lapor Tidak Masuk Kelas) ===== */
.radio-card {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 2px solid #eef1fb;
    border-radius: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: 0.2s;
    background: #fff;
    margin-bottom: 0;
    width: 100%;
}
.radio-card input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    flex-shrink: 0;
}
.radio-card:hover { border-color: var(--primary); background: #f5f7ff; }
.radio-card:has(input:checked) { border-color: var(--primary); background: #f5f7ff; }
.radio-card span { font-weight: 500; }

#videoWrap {
    position: relative;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    border-radius: 20px;
    overflow: hidden;
    background: #000;
}
#video, #overlay {
    width: 100%;
    border-radius: 20px;
}
#overlay { position: absolute; top: 0; left: 0; }

/* ===== Garis Panduan Wajah (Face Guide) =====
   Overlay garis berbentuk kepala (dengan telinga), ditampilkan di atas
   video kamera saat PENDAFTARAN WAJAH maupun saat ABSENSI, supaya
   siswa/pengajar bisa memposisikan wajah tepat di dalam area yang
   ditentukan untuk hasil verifikasi yang lebih akurat.

   Warnanya BERUBAH OTOMATIS mengikuti posisi wajah (lihat
   pantauPanduanWajah() di faceapi-loader.js):
   - abu-abu (netral)              : belum ada wajah yang terdeteksi
   - .face-guide-merah  (MERAH)    : wajah terdeteksi tapi masih di luar area
   - .face-guide-hijau  (HIJAU)    : wajah sudah pas di dalam area

   Overlay ini murni panduan visual (pointer-events: none), tidak
   memengaruhi proses deteksi wajah oleh face-api.js itu sendiri. */
.face-guide {
    /* Garis panduan wajah dinonaktifkan (disembunyikan) sesuai permintaan,
       tapi elemen & class-nya tetap ada di HTML/JS supaya pantauPanduanWajah()
       di faceapi-loader.js tidak perlu diubah/error. */
    display: none;
}
.face-guide svg {
    width: 58%;
    height: 90%;
    filter: drop-shadow(0 0 6px rgba(148, 163, 184, 0.5));
    transition: filter 0.25s ease;
}
.face-guide path {
    fill: none;
    stroke: #94a3b8;
    stroke-width: 3;
    stroke-dasharray: 10 8;
    transition: stroke 0.25s ease;
    animation: face-guide-menunggu 2.2s ease-in-out infinite;
}
@keyframes face-guide-menunggu {
    0%, 100% { stroke-opacity: 0.5; }
    50% { stroke-opacity: 0.9; }
}
.face-guide-merah svg {
    filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.7));
}
.face-guide-merah path {
    stroke: #ef4444;
    stroke-opacity: 1;
    animation: none;
}
.face-guide-hijau svg {
    filter: drop-shadow(0 0 8px rgba(34, 197, 94, 0.75));
}
.face-guide-hijau path {
    stroke: #22c55e;
    stroke-opacity: 1;
    animation: none;

}

.status-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.9rem;
}

/* ===== Animasi Ucapan Terima Kasih ===== */
.thanks-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg,#2ec4b6,#0a9396);
    text-align: center;
    color: #fff;
    padding: 20px;
}
.teacher-avatar {
    width: 160px; height: 160px;
    border-radius: 50%;
    background: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 4rem;
    margin: 0 auto 20px;
    animation: bounceIn 0.8s ease;
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
}
.speech-bubble {
    background: #fff;
    color: var(--dark);
    border-radius: 24px;
    padding: 24px 30px;
    margin-top: 20px;
    font-size: 1.4rem;
    font-weight: 600;
    animation: fadeUp 0.6s ease 0.3s both;
    position: relative;
}
@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.08); }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes fadeUp {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}
.checkmark-circle {
    width: 90px; height: 90px; border-radius: 50%;
    background: #fff; color: #2ec4b6;
    display:flex; align-items:center; justify-content:center;
    font-size: 3rem; margin: 0 auto 16px;
    animation: bounceIn 0.6s ease;
}