/* ===== RESET & BASE ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* Mengunci tinggi layar agar tidak bisa di-scroll sama sekali */
html, body { 
    width: 100%; 
    height: 100vh; 
    overflow: hidden; 
    position: fixed; /* Mencegah bounce effect di iOS */
}

body { font-family: 'Segoe UI', Arial, sans-serif; background: #f0f2f5; color: #333; }

/* ===== PUBLIC PAGES (index, hasil) ===== */
body.public-page {
    background: linear-gradient(135deg, #4a1fa8 0%, #6b3fd4 40%, #5b8dee 100%);
    height: 100vh;
    display: flex;
    align-items: center; /* Menjaga konten tetap di tengah secara vertikal */
    justify-content: center;
    text-align: center;
    color: white;
    position: relative;
    padding: 20px;
}

/* Dekorasi Background */
body.public-page::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.08);
    top: -100px; right: -100px;
    pointer-events: none;
}
body.public-page::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.06);
    bottom: -80px; left: -80px;
    pointer-events: none;
}

/* Wrapper Konten Utama */
.public-wrap, .hasil-wrap { 
    position: relative; 
    z-index: 1; 
    width: 100%; 
    max-width: 600px; 
    /* Transisi smooth jika ada perubahan state */
    transition: transform 0.3s ease-in-out;
}

.school-logo {
    width: clamp(100px, 20vh, 160px); /* Ukuran adaptif berdasarkan tinggi layar */
    height: auto;
    object-fit: contain;
    margin-bottom: 15px;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.25));
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.public-wrap .label-sub { font-size: 14px; letter-spacing: 2px; text-transform: uppercase; opacity: 0.85; margin-bottom: 6px; }
.public-wrap h1 { font-size: clamp(24px, 6vw, 38px); font-weight: 800; letter-spacing: 1px; margin-bottom: 6px; }
.public-wrap .open-date { font-size: 13px; opacity: 0.8; margin-bottom: 20px; }
.public-wrap .open-date span { font-weight: 700; text-transform: uppercase; }

/* Countdown */
.countdown { display: flex; justify-content: center; gap: 10px; margin-bottom: 25px; }
.countdown-box { background: rgba(255,255,255,0.15); backdrop-filter: blur(6px); border-radius: 10px; padding: 12px 15px; min-width: 65px; }
.countdown-box .num { font-size: 28px; font-weight: 800; display: block; }
.countdown-box .lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; opacity: 0.8; }

/* Form public */
.public-form { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.public-form input {
    width: 100%; max-width: 420px;
    padding: 14px 18px;
    border-radius: 10px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 15px;
    outline: none;
    backdrop-filter: blur(4px);
}
.public-form input::placeholder { color: rgba(255,255,255,0.6); }
.public-form input:focus { background: rgba(255,255,255,0.3); }

.btn-cek {
    width: 100%; max-width: 420px;
    padding: 14px;
    background: #2979ff;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-cek:hover { background: #1565c0; }

.belum-buka-notice {
    width: 100%; max-width: 420px; margin: 0 auto;
    padding: 14px 18px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 10px;
    font-size: 14px; color: rgba(255,255,255,0.9);
    backdrop-filter: blur(4px); text-align: center; line-height: 1.5;
}

/* Hasil page */
.hasil-wrap { max-width: 700px; }
.hasil-wrap h1 { font-size: 30px; font-weight: 800; margin-bottom: 20px; }
.hasil-cards { display: flex; gap: 16px; margin-bottom: 24px; }
.hasil-card-icon {
    background: white; border-radius: 16px; padding: 25px 20px;
    flex: 0 0 180px; display: flex; flex-direction: column;
    align-items: center; justify-content: center; color: #333;
}
.hasil-card-icon .icon-emoji { font-size: 50px; margin-bottom: 10px; }
.hasil-card-icon .status-text { font-size: 20px; font-weight: 800; }
.status-text.lulus { color: #2e7d32; }
.status-text.tidak { color: #c62828; }

.hasil-card-info {
    background: white; border-radius: 16px; padding: 25px;
    flex: 1; color: #333; text-align: left;
}
.btn-back {
    display: inline-block; padding: 10px 24px;
    background: rgba(255,255,255,0.2); color: white;
    border: 1px solid rgba(255,255,255,0.4); border-radius: 10px;
    text-decoration: none; font-size: 14px; backdrop-filter: blur(4px);
}

/* ===== ADMIN LAYOUT (Tetap bisa scroll karena data banyak) ===== */
.admin-layout { 
    display: flex; min-height: 100vh; 
    overflow: hidden; /* Lock main admin container */
}
.main-content { 
    margin-left: 160px; flex: 1; padding: 28px 32px; 
    width: calc(100% - 160px); 
    height: 100vh; 
    overflow-y: auto; /* Admin content tetap bisa di-scroll */
}

/* Sidebar (Fixed) */
.sidebar {
    width: 160px; background: #1a1f2e; color: white;
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
}

/* ===== RESPONSIVE MODE (CORE FIX) ===== */

@media (max-width: 900px) {
    .topbar { display: flex; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; width: 100%; padding-top: 74px; }
}

@media (max-width: 480px) {
    /* Mencegah Scroll & Menjaga Tampilan Stabil 80-85% */
    body.public-page {
        overflow: hidden;
        padding: 10px;
    }

    .public-wrap, .hasil-wrap {
        /* Teknik Scaling: Mengecilkan konten agar muat 1 layar penuh */
        transform: scale(0.82); 
        transform-origin: center center;
    }

    .school-logo { width: 120px; }
    .countdown-box { min-width: 55px; padding: 8px; }
    .countdown-box .num { font-size: 22px; }
    
    .hasil-cards { flex-direction: column; gap: 10px; }
    .hasil-card-icon { padding: 15px; width: 100%; }
    .hasil-card-info { padding: 15px; }

    /* Jika konten hasil terlalu panjang, biarkan bagian info saja yang scroll internal */
    .hasil-card-info {
        max-height: 35vh;
        overflow-y: auto;
    }
}

/* Fix untuk layar sangat pendek (Landscape / HP lama) */
@media (max-height: 600px) {
    .public-wrap, .hasil-wrap {
        transform: scale(0.7);
    }
    .school-logo { width: 80px; margin-bottom: 5px; }
}

footer {
    position: fixed;
    bottom: 1px;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 11px;
    color: rgba(255,255,255,0.6);
    z-index: 10;
}

/* Pada mobile, pastikan tidak tertutup scaling */
@media (max-width: 480px) {
    footer {
        font-size: 10px;
        bottom: 5px;
    }
}