:root {
    /* Mengadopsi warna dari referensi CSS baru */
    --primary: #059669;
    --primary-hover: #064e3b;
    --success: #10b981;
    --success-hover: #059669;

    --bg-glass: rgba(255, 255, 255, 0.85);
    --border-glass: rgba(255, 255, 255, 0.5);
    --text-main: #374151;
    --text-muted: #6b7280;
    --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

body {
    background-image: url('../../../uploads/images/bg_sekolah.webp');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    position: relative;
    overflow-x: hidden;
}

.bg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(6, 78, 59, 0.9) 0%, rgba(5, 150, 105, 0.75) 100%);
    backdrop-filter: blur(5px);
    z-index: 0;
}

.app-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 900px;
    perspective: 1000px;
    /* Kedalaman untuk animasi masuk */
}

/* Glassmorphism Panel Utama */
.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    overflow: hidden;
    min-height: 500px;
    animation: fadeZoomIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* --- Kiri: Input & Info --- */
.panel-left {
    padding: 40px;
    background: rgba(255, 255, 255, 0.4);
    border-right: 1px solid rgba(255, 255, 255, 0.6);
    display: flex;
    flex-direction: column;
}

.brand-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 40px;
    animation: slideRightFade 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
}

.logo {
    width: 65px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: rotate(-10deg) scale(1.1);
}

.brand-text h1 {
    color: var(--text-main);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.brand-text p {
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
}

.input-section {
    animation: slideRightFade 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both;
}

.input-section label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group {
    position: relative;
    margin-bottom: 25px;
}

.input-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 20px;
    transition: color 0.3s ease;
}

.input-nis {
    width: 100%;
    padding: 16px 16px 16px 50px;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 4px;
    color: var(--text-main);
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    outline: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.input-nis::-webkit-outer-spin-button,
.input-nis::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.input-nis[type=number] {
    -moz-appearance: textfield;
}

.input-nis:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.15);
    transform: translateY(-2px);
}

.input-nis:focus+.input-icon,
.input-group:focus-within .input-icon {
    color: var(--primary);
}

.loading-state {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary);
    font-weight: 600;
    font-size: 14px;
    background: rgba(5, 150, 105, 0.1);
    padding: 15px;
    border-radius: 12px;
    animation: springUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px dashed var(--primary);
}

.student-info {
    background: white;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 15px 25px -5px rgba(16, 185, 129, 0.15);
    border: 1px solid #d1fae5;
    /* Animasi Bouncy ketika data muncul */
    animation: springUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.info-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #d1fae5;
    color: #064e3b;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 12px;
}

.student-info h3 {
    color: var(--text-main);
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 8px;
    line-height: 1.3;
}

.badge-class {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
}

/* --- Kanan: Kamera & Tombol --- */
.panel-right {
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: rgba(248, 250, 252, 0.4);
}

/* Empty State */
.empty-state {
    text-align: center;
    color: var(--text-muted);
    animation: fadeIn 0.6s ease;
}

.empty-icon {
    font-size: 50px;
    color: #cbd5e1;
    margin-bottom: 15px;
    transition: transform 0.4s ease;
}

.empty-state:hover .empty-icon {
    transform: scale(1.1) rotate(5deg);
    color: #94a3b8;
}

.empty-state h3 {
    color: var(--text-main);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    line-height: 1.6;
    max-width: 300px;
    margin: 0 auto;
}

/* Action Area */
.action-area {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.camera-card {
    background: black;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.4);
    animation: scaleInBounce 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.camera-header {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 10;
}

.live-indicator {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.blink {
    color: #ef4444;
    animation: blinker 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.camera-container {
    width: 100%;
    aspect-ratio: 4/3;
    position: relative;
}

video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.scanner-box {
    position: absolute;
    top: 10%;
    left: 15%;
    right: 15%;
    bottom: 10%;
    border: 2px dashed rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    pointer-events: none;
}

.scanner-box::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--success);
    box-shadow: 0 0 15px 3px rgba(16, 185, 129, 0.6);
    animation: scan 2.5s ease-in-out infinite alternate;
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Staggered animation pada tombol-tombol presensi */
.action-buttons .btn-wrapper:nth-child(1) {
    animation: springUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
}

.action-buttons .btn-wrapper:nth-child(2) {
    animation: springUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
}

.action-buttons .btn-wrapper:nth-child(3) {
    animation: springUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both;
}

.action-buttons .btn-wrapper:nth-child(4) {
    animation: springUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s both;
}

.btn-wrapper {
    text-align: center;
}

.btn {
    width: 100%;
    padding: 16px 12px;
    font-size: 15px;
    font-weight: 700;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

/* Ripple effect semu untuk tombol */
.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120%;
    padding-top: 120%;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    transition: transform 0.5s ease, opacity 0.5s ease;
}

.btn:active::after {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    transition: 0s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #047857);
    box-shadow: 0 10px 15px -3px rgba(5, 150, 105, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 15px 20px -3px rgba(5, 150, 105, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), var(--primary));
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3);
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 15px 20px -3px rgba(16, 185, 129, 0.4);
}

/* Mentokin feedback click */
.btn:active:not(:disabled) {
    transform: scale(0.95) !important;
}

.btn:disabled {
    background: #cbd5e1;
    box-shadow: none;
    cursor: not-allowed;
    color: #f1f5f9;
    transform: none !important;
}

.status-text {
    font-size: 12px;
    color: var(--primary);
    margin-top: 8px;
    font-weight: 700;
    animation: fadeIn 0.3s ease;
}

/* Animations */
@keyframes fadeZoomIn {
    0% {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes slideRightFade {
    0% {
        opacity: 0;
        transform: translateX(-20px);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes springUp {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes scaleInBounce {
    0% {
        opacity: 0;
        transform: scale(0.85);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes blinker {
    50% {
        opacity: 0.3;
    }
}

@keyframes scan {
    0% {
        top: 0;
        opacity: 1;
    }

    100% {
        top: 100%;
        opacity: 0.5;
    }
}

/* Responsif */
@media (max-width: 768px) {
    .glass-panel {
        grid-template-columns: 1fr;
    }

    .panel-left {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.6);
        padding: 30px;
    }

    .panel-right {
        padding: 30px;
    }
}