/* === ROOT VARIABLES === */
:root {
    --primary-green: #2ECC71;
    --dark-green: #27AE60;
    --light-green: #A9DFBF;
    --text-color: #333;
    --card-bg: #FFFFFF;
    --border-radius: 12px;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    --padding-card: 20px;
}

/* === GLOBAL & BODY STYLES === */
*, *::before, *::after {
    box-sizing: border-box;
}

/* KODE BARU UNTUK BODY */
body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #e0f2f1, #b2dfdb);
    color: var(--text-color);
    margin: 0;
    line-height: 1.6;

    /* -- TAMBAHAN UNTUK STICKY FOOTER -- */
    min-height: 100vh;      /* 1. Paksa body agar tingginya minimal setinggi layar */
    display: flex;          /* 2. Aktifkan mode Flexbox */
    flex-direction: column; /* 3. Atur agar item di dalamnya (header, main, footer) tersusun vertikal */
}


/* === HEADER === */
.main-header {
    background: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border-bottom: 3px solid var(--primary-green);
    gap: 15px;
    flex-direction: column; /* Mobile-first: tumpuk vertikal */
    text-align: center;
}

.logo-container .logo {
    height: 50px;
}

.title-container h1 {
    margin: 0;
    font-size: 1.4em;
    color: var(--dark-green);
    font-weight: 700;
}

.title-container h2 {
    margin: 0;
    font-size: 1.0em;
    color: var(--primary-green);
    font-weight: 500;
}

/* === MAIN CONTENT LAYOUT === */
/* KODE BARU UNTUK MAIN-CONTENT */
.main-content {
    padding: 15px;
    flex-grow: 1; /* 4. Ini adalah "sihirnya": suruh elemen main untuk meregang dan mengisi sisa ruang kosong */
}


.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

/* === CARD STYLING === */
.card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: var(--padding-card);
    overflow: hidden;
}

.card-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    align-items: flex-start;
}

.card-header h3 {
    margin: 0;
    color: var(--dark-green);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* === DASHBOARD GRID LAYOUT === */
#dashboard-panitia {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.controls-grid, .data-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

/* === BUTTONS & FORMS === */
.btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    white-space: nowrap;
}
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.btn-primary { background-color: var(--primary-green); color: white; }
.btn-primary:hover { background-color: var(--dark-green); }
.btn-danger { background-color: #E74C3C; color: white; }
.btn-danger:hover { background-color: #C0392B; }
.btn-warning { background-color: #F39C12; color: white; }
.btn-warning:hover { background-color: #E67E22; }
.btn-secondary { background-color: #3498DB; color: white; }
.btn-secondary:hover { background-color: #2980B9; }

.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 500; }
.form-control { width: 100%; padding: 10px; border-radius: 8px; border: 1px solid #ccc; font-size: 1rem; }
.form-inline { display: flex; flex-direction: column; gap: 10px; }

/* === TABLE STYLING === */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
    white-space: nowrap;
}
th {
    background-color: #f7f9fc;
    color: var(--dark-green);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
tbody tr:hover { background-color: #f7f9fc; }
td .btn { padding: 5px 10px; font-size: 0.8rem; }

/* === MODAL STYLES (INI BAGIAN YANG DIPERBARUI) === */
.modal {
    display: none; /* Sembunyi secara default */
    position: fixed; /* Tetap di layar, bahkan saat scroll */
    z-index: 1000; /* Tampil di atas semua elemen lain */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* Aktifkan scroll jika kontennya panjang */
    background-color: rgba(0, 0, 0, 0.5); /* Latar belakang gelap transparan */
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto; /* Jarak atas dan otomatis tengah secara horizontal */
    padding: 25px;
    border-radius: var(--border-radius);
    width: 90%; /* Lebar di mobile */
    max-width: 550px; /* Lebar maksimal di desktop */
    position: relative;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    animation: slideIn 0.4s ease-out;
}

.modal-content h3 {
    margin-top: 0;
    color: var(--dark-green);
}

.close-button {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 32px;
    font-weight: bold;
    line-height: 1;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* Animasi untuk modal */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* === STATUS BADGE === */
.status-badge { padding: 4px 10px; border-radius: 20px; color: white; font-size: 0.8em; font-weight: 500;}
.status-hadir { background-color: var(--primary-green); }
.status-belum { background-color: #E74C3C; }

/*
=========================================
    RESPONSIVE MEDIA QUERIES
=========================================
*/

/* === TABLET (lebar 768px ke atas) === */
@media (min-width: 768px) {
    .main-content {
        padding: 30px;
    }
    .main-header {
        flex-direction: row;
        text-align: left;
    }
    .card-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    .card-header h3 {
        font-size: 1.4rem;
    }
    .controls-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    .form-inline {
        flex-direction: row;
        align-items: center;
    }
    .data-grid {
        grid-template-columns: 1fr;
    }
    .modal-content {
        margin: 5% auto; /* Kurangi jarak atas di layar besar */
    }
    /* Pilihan jawaban sekarang akan tetap satu kolom di semua layar */
/*
.pilihan-jawaban {
    grid-template-columns: 1fr; 
}
*/

}

/* === DESKTOP (lebar 1024px ke atas) === */
@media (min-width: 1024px) {
    .data-grid {
        grid-template-columns: 1fr 1fr;
    }
}
/* ============================================== */
/* ATURAN BARU UNTUK KONTROL UTAMA HORIZONTAL     */
/* ============================================== */

.main-controls-container {
    display: flex;
    flex-direction: row; /* Paksa tombol untuk berjajar horizontal */
    gap: 10px;           /* Beri jarak antar tombol */
}

/* Membuat setiap form (dan tombol di dalamnya) memiliki lebar yang sama */
.main-controls-container form {
    flex: 1; 
}

/* Memastikan tombol mengisi seluruh lebar form-nya */
.main-controls-container .btn {
    width: 100%;
    /* Atur agar teks tidak turun jika terlalu sempit */
    padding-left: 8px;
    padding-right: 8px;
    font-size: 0.85rem; /* Sedikit kecilkan font jika perlu */
}

/* ============================================== */
/* ATURAN BARU UNTUK FOOTER RATA TENGAH           */
/* ============================================== */

.main-footer-bottom {
    display: flex;
    align-items: center;      /* Rata tengah secara vertikal */
    justify-content: center;  /* Rata tengah secara horizontal */
    padding: 20px;            /* Sedikit tambah padding agar lebih lega */
    color: white;
    background-color: var(--dark-green);
    font-size: 0.9em;
}

.main-footer-bottom p {
    margin: 0; /* Hapus margin default dari paragraf agar tidak mengganggu perataan */
}
/* ============================================== */
/* GAYA UNTUK TIMER BAR KESELURUHAN               */
/* ============================================== */

.timer-bar-container {
    margin-top: 40px;
    width: 100%;
    height: 40px;
    background-color: #e9ecef;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    border: 2px solid #ccc;
}

.timer-bar {
    width: 100%; /* Dimulai dari 100% */
    height: 100%;
    background: linear-gradient(to right, #28a745, #218838); /* Gradasi Hijau */
    border-radius: 20px;
    transition: width 1s linear, background-color 1s ease-in-out; /* Animasi halus */
    position: absolute;
    top: 0;
    left: 0;
}

/* Kelas untuk mengubah warna timer */
.timer-bar.warning {
    background: linear-gradient(to right, #ffc107, #e0a800); /* Gradasi Kuning */
}

.timer-bar.danger {
    background: linear-gradient(to right, #dc3545, #c82333); /* Gradasi Merah */
}

.timer-bar-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    white-space: nowrap;
}
/* ============================================== */
/* GAYA UNTUK STATUS & TIMER DI HALAMAN PANITIA   */
/* ============================================== */

.status-timer-admin {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.status-display {
    font-size: 1.1rem;
}

.status-badge-live {
    padding: 5px 12px;
    border-radius: 20px;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.status-badge-live.status-menunggu {
    background-color: #6c757d; /* Abu-abu */
}

.status-badge-live.status-berlangsung {
    background-color: #28a745; /* Hijau */
}

.status-badge-live.status-selesai {
    background-color: #dc3545; /* Merah */
}

#admin-timer-container {
    height: 30px; /* Buat timer admin sedikit lebih kecil */
}
/* =================================================== */
/* ATURAN FINAL UNTUK MEMAKSA JAWABAN MENJADI VERTIKAL */
/* Kode ini menggunakan ID dan !important untuk prioritas tertinggi */
/* =================================================== */

#pilihan-jawaban {
    display: grid !important;
    grid-template-columns: 1fr !important; /* <- Paksa menjadi 1 kolom */
    gap: 15px !important;
}
/* =================================================== */
/* ATURAN UNTUK MEMBUAT TEKS PILIHAN JAWABAN RATA KIRI */
/* =================================================== */

.pilihan-jawaban .btn {
    justify-content: flex-start !important; /* Paksa konten di dalam tombol untuk mulai dari kiri */
    text-align: left !important;            /* Pastikan teksnya sendiri juga rata kiri */
}
/* =================================================== */
/* GAYA BARU UNTUK TAMPILAN SEMUA SOAL                 */
/* =================================================== */

.timer-wrapper-fixed {
    position: sticky;
    top: 0;
    z-index: 900;
    padding: 10px 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    margin: -15px -15px 15px -15px; /* Sesuaikan dengan padding .main-content */
    padding: 15px;
}

.soal-card {
    margin-bottom: 20px;
    padding: 20px;
    border: 1px solid #e0e0e0;
}

.soal-header {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 15px;
}

.nomor-soal-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    background-color: var(--dark-green);
    color: white;
    border-radius: 50%;
    font-weight: 600;
}

.soal-pertanyaan {
    margin: 0;
    font-size: 1.1rem;
    padding-top: 3px;
}

.soal-pilihan {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-left: 45px; /* Sejajarkan dengan pertanyaan */
}

.pilihan-label {
    display: block;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pilihan-label:hover {
    background-color: #f7f9fc;
    border-color: var(--primary-green);
}

.pilihan-label input[type="radio"] {
    margin-right: 10px;
    accent-color: var(--dark-green); /* Warna radio button saat dicentang */
}

/* Style untuk label ketika radio button di dalamnya terpilih */
.pilihan-label input[type="radio"]:checked + .pilihan-teks {
    font-weight: 600;
    color: var(--dark-green);
}

.submit-wrapper {
    text-align: center;
    margin-top: 40px;
}

.btn-kirim-jawaban {
    padding: 15px 40px;
    font-size: 1.2rem;
}
/* =================================================== */
/* GAYA UNTUK TIMER DI HALAMAN PENDAFTARAN             */
/* =================================================== */

.timer-pendaftaran {
    text-align: center;
    background-color: #e8f5e9; /* Latar hijau muda */
    color: var(--dark-green);
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 25px;
    font-size: 1.1rem;
    border: 1px solid var(--primary-green);
    animation: pulse 2s infinite;
}

.timer-pendaftaran strong {
    font-weight: 700;
}

/* Animasi sederhana agar timer sedikit berdenyut */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(46, 204, 113, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0);
    }
}
/* =================================================== */
/* GAYA BARU UNTUK GAMBAR SOAL                         */
/* =================================================== */

.soal-gambar-container {
    padding-left: 45px; /* Sesuaikan dengan padding pilihan jawaban */
    margin-bottom: 15px;
}

.soal-gambar {
    max-width: 100%;
    max-height: 400px; /* Batasi tinggi maksimum gambar */
    height: auto;
    border-radius: 8px;
    border: 1px solid #ddd;
}

