/* =========================================================================
   E-PRESENSI - Kiosk CSS (desain "Absensi Smart School")
   ========================================================================= */

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: #1d4ed8;
    background-image: linear-gradient(160deg, #1e3a8a 0%, #1d4ed8 55%, #3b82f6 100%);
    color: #f8fafc;
    overflow: hidden;
}

/* Background : foto publik + overlay hitam semi transparan */
.kiosk__bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image: url('../assets/img/publik.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.kiosk__bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);   /* overlay hitam (atur opacity di sini) */
}
.kiosk__bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.10) 100%);
}

/* Badge DEMO — tampil saat lisensi tidak aktif */
.kiosk__demo {
    position: fixed;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(253, 224, 71, 0.55);
    color: #fde047;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
    pointer-events: none;
    white-space: nowrap;
}
.kiosk__demo i { font-size: 16px; }

/* Chip DEMO di dekat jam */
.kiosk__demo-chip {
    position: absolute;
    top: -10px;
    right: -14px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 10px;
    background: #fde047;
    color: #713f12;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    animation: demoBlink 2s ease-in-out infinite;
}
.kiosk__demo-chip i { font-size: 14px; }

@keyframes demoBlink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.55; }
}

/* Stempel DEMO di dalam popup hasil scan */
.kiosk__demo-stamp {
    display: none;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    padding: 7px 16px;
    border-radius: 999px;
    background: rgba(253, 224, 71, 0.92);
    color: #713f12;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.06em;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}
.kiosk__demo-stamp i { font-size: 15px; }

/* Minimalist Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #d1d5db; }

/* Subtle Animations */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-list-item {
    animation: slideDown 0.3s ease-out forwards;
}

@keyframes popIn {
    0% { opacity: 0; transform: scale(0.75); }
    55% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes fadeOutScale {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.9); }
}

@keyframes itemRise {
    0% { opacity: 0; transform: translateY(12px); }
    100% { opacity: 1; transform: translateY(0); }
}

.scan-popup {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 50;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.scan-popup.active {
    display: flex;
}
.scan-popup.active .kiosk-popup {
    animation: popIn 0.45s cubic-bezier(0.2, 0.85, 0.3, 1.15) backwards;
}
.scan-popup.closing .kiosk-popup {
    animation: fadeOutScale 0.2s ease-in forwards;
}

/* Popup hasil scan: glassmorphism (bening + blur) */
.kiosk-popup {
    background: rgba(255, 255, 255, 0.12);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    backdrop-filter: blur(18px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow: 0 35px 70px -15px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* Emoji status (tanpa lingkaran / foto profil) */
.popup--emoji {
    display: block;
    font-size: 96px;
    line-height: 1;
    margin: 0 auto 24px;
    animation: emojiPop 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.4) both,
               emojiBob 1.8s ease-in-out 0.55s infinite;
}
.popup--emoji.is-hide { display: none; }

/* Emoji "sudah absen" — lebih besar + wiggle lucu */
.popup--emoji--dupe {
    font-size: 116px;
    animation: emojiPop 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.4) both,
               emojiWiggle 2.2s ease-in-out 0.55s infinite;
}
@keyframes emojiWiggle {
    0%, 100% { transform: rotate(0deg) scale(1); }
    15% { transform: rotate(12deg) scale(1.08); }
    30% { transform: rotate(-10deg) scale(1.05); }
    45% { transform: rotate(8deg) scale(1.03); }
    60% { transform: rotate(-6deg) scale(1.01); }
    75% { transform: rotate(3deg) scale(1); }
}
@keyframes emojiPop {
    0% { transform: scale(0) rotate(-24deg); opacity: 0; }
    55% { transform: scale(1.3) rotate(8deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); }
}
@keyframes emojiBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-9px); }
}

/* Popup hasil scan: glassmorphism (bening + blur) */
.kiosk-popup .popup--error-icon.is-error { background: rgba(254, 226, 226, 0.9); color: #dc2626; }
.kiosk-popup .popup--error-icon.is-duplicate { background: rgba(254, 243, 199, 0.9); color: #d97706; }
.kiosk-popup .popup--loading-icon { background: rgba(239, 246, 255, 0.9); color: #2563eb; }

/* Elemen di dalam popup muncul berurutan (stagger) */
.scan-popup.active .kiosk-popup .text-center > *:not(.popup--emoji) {
    opacity: 0;
    animation: itemRise 0.35s ease-out forwards;
}
.scan-popup.active .kiosk-popup .text-center > *:not(.popup--emoji):nth-child(1) { animation-delay: 0.10s; }
.scan-popup.active .kiosk-popup .text-center > *:not(.popup--emoji):nth-child(2) { animation-delay: 0.18s; }
.scan-popup.active .kiosk-popup .text-center > *:not(.popup--emoji):nth-child(3) { animation-delay: 0.26s; }
.scan-popup.active .kiosk-popup .text-center > *:not(.popup--emoji):nth-child(4) { animation-delay: 0.34s; }

/* Ikon sukses memantul */
.scan-popup.active .ph-check-circle {
    animation: iconBounce 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.4) 0.1s both;
}
.scan-popup.active .ph-smiley {
    animation: iconBounce 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.4) 0.1s both;
}
@keyframes iconBounce {
    0% { transform: scale(0); }
    55% { transform: scale(1.25); }
    100% { transform: scale(1); }
}

/* Custom Tap Animation (RFID Ripple) */
@keyframes ripple {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.45); }
    70% { box-shadow: 0 0 0 25px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

/* ---------- Branding & kehadiran terakhir ---------- */
.idle__brand {
    letter-spacing: -0.02em;
    text-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}
.idle__tagline {
    text-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
}

.idle__last {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.idle__last.is-hide {
    display: none;
}
.idle__last-name {
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.idle__last-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.18em;
    padding: 6px 22px;
    border-radius: 9999px;
    text-transform: uppercase;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    animation: itemRise 0.3s ease-out;
}
.idle__last-chip.is-masuk {
    background: #dcfce7;
    color: #15803d;
}
.idle__last-chip.is-pulang {
    background: #ede9fe;
    color: #6d28d9;
}
.tap-ripple {
    animation: ripple 2s infinite cubic-bezier(0.65, 0, 0.34, 1);
}

/* Utility for minimalist card */
.card-minimal {
    background-color: #ffffff;
    border: 1px solid #f3f4f6;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
}

/* ---------- Variasi status scan ---------- */
#popup-avatar-wrap { display: block; }
#popup-avatar-wrap.popup--no-avatar { display: none; }
#popup-avatar-wrap.popup--no-avatar + .scan-popup__body { width: 100%; }

#popup-icon { font-variation-settings: 'FILL' 1; }

.scan-popup.is-error #popup-avatar-wrap { display: none; }

.scan-popup .popup--error-icon,
.scan-popup .popup--loading-icon {
    width: 140px;
    height: 140px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 36px;
    font-size: 64px;
}
.popup--error-icon.is-error { background: #fee2e2; color: #dc2626; }
.popup--error-icon.is-duplicate { background: #fef3c7; color: #d97706; }
.popup--loading-icon { background: #f3f4f6; color: #6b7280; }

/* ---------- Indikator koneksi kiosk ---------- */
.kiosk__conn-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #f87171;
    flex-shrink: 0;
    transition: background 0.3s ease;
}
.kiosk__conn-dot.is-online {
    background: #22c55e;
}

/* ---------- Indikator antrean sinkronisasi ---------- */
.kiosk__sync {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    color: #b45309;
    background: #fef3c7;
    padding: 2px 10px;
    border-radius: 9999px;
    white-space: nowrap;
    animation: slideDown 0.2s ease-out;
}

/* ---------- Toast varian ---------- */
#toast.is-danger { background: #dc2626; }
#toast.is-info { background: #111827; }
#toast.is-success { background: #16a34a; }

/* ---------- Panel daftar hadir hari ini ---------- */
.kiosk__attended {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.12);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    backdrop-filter: blur(18px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 24px;
    box-shadow: 0 35px 70px -15px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    overflow: hidden;
    flex-shrink: 0;
    margin-top: clamp(28px, 5vh, 64px);
}
.kiosk__attended__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}
.kiosk__attended__head i { font-size: 18px; }
.kiosk__attended__count {
    margin-left: auto;
    min-width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    color: #1d4ed8;
    background: #ffffff;
    border-radius: 9999px;
}
.kiosk__attended__body {
    max-height: min(470px, calc(100vh - 400px));
    min-height: 180px;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
}
.kiosk__attended__empty {
    margin: auto;
    padding: 28px 16px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}
.kiosk__attended__empty.is-hide { display: none; }
.kiosk__attended__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.kiosk__attended__row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    animation: itemRise 0.3s ease-out;
}
.kiosk__attended__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}
.kiosk__attended__name {
    font-size: 15px;
    font-weight: 800;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kiosk__attended__sub {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kiosk__attended__time {
    font-size: 15px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: #2563eb;
    flex-shrink: 0;
}