/* --- Import Font & Variabel CSS --- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
    --primary-color: #3498db;
    --primary-hover: #2980b9;
    --success-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f1c40f;
    --light-color: #ffffff;
    --dark-color: #34495e;
    --grey-color: #ecf0f1;
    --border-color: #bdc3c7;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* --- Reset & Global Styling --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--grey-color);
    color: var(--dark-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Layout Utama (Header, Main, Footer) --- */
.main-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
}

.footer {
    background-color: var(--dark-color);
    color: var(--light-color);
    text-align: center;
    padding: 20px 0;
    width: 100%;
}

/* --- Komponen Umum --- */
.container {
    background: var(--light-color);
    padding: 2em 2.5em;
    border-radius: 15px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 1000px;
}

h2 {
    text-align: center;
    color: var(--dark-color);
    margin-bottom: 1.2em;
    font-weight: 600;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

button, .action-btn, .tambah-btn {
    padding: 12px 20px;
    background-color: var(--primary-color);
    color: var(--light-color);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

button:hover, .action-btn:hover, .tambah-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}

.submit-btn { background-color: var(--success-color); }
.submit-btn:hover { background-color: #27ae60; }
.edit-btn { background-color: var(--warning-color); color: var(--dark-color); }
.edit-btn:hover { background-color: #d4ac0d; }
.hapus-btn { background-color: var(--danger-color); }
.hapus-btn:hover { background-color: #c0392b; }

input, select, textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 1em;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    font-family: 'Poppins', sans-serif;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5em;
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--grey-color);
    vertical-align: middle;
}

.kolom-pertanyaan {
    white-space: normal;
    word-break: break-word;
    min-width: 300px;
}

.aksi-kolom {
    width: 1%;
    white-space: nowrap;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #555;
}

tbody tr:hover {
    background-color: #f1f8ff;
}

/* --- Navigasi & Header --- */
.header {
    background-color: var(--light-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 0 5%;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.brand {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
}

.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    gap: 20px;
}

.nav-links a {
    color: var(--dark-color);
    font-weight: 500;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.3s, color 0.3s;
}

.nav-links > li:not(.dropdown) a:hover {
    background-color: var(--grey-color);
    color: var(--primary-color);
}

.hamburger { display: none; cursor: pointer; }
.hamburger span { display: block; width: 25px; height: 3px; margin: 5px 0; background-color: var(--dark-color); border-radius: 3px; }

/* --- Dropdown --- */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    cursor: pointer;
}

.dropdown-toggle.user-button {
    background-color: var(--primary-color);
    color: var(--light-color);
    padding: 8px 15px;
    border-radius: 20px;
    transition: background-color 0.3s ease;
}

.dropdown-toggle.user-button:hover {
    background-color: var(--primary-hover);
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: var(--light-color);
    min-width: 200px;
    box-shadow: var(--shadow);
    z-index: 1001;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 8px;
    border: 1px solid var(--grey-color);
}

.dropdown-content.active {
    display: block;
}

.dropdown-content a {
    padding: 12px 16px;
    display: block;
    text-align: left;
    width: 100%;
}

.dropdown-content a:hover {
    background-color: var(--grey-color);
}

/* --- Styling Header di dalam Container --- */
.page-header {
    text-align: center;
    margin-bottom: 2em;
    padding-bottom: 1.5em;
    border-bottom: 1px solid var(--grey-color);
}
.page-header h1 { font-size: 1.8em; font-weight: 700; color: var(--dark-color); margin: 0; line-height: 1.2; }
.page-header p { font-size: 1.1em; color: #555; margin: 0.5em 0 1.5em 0; }
.page-header h2 { font-size: 1.3em; font-weight: 600; color: var(--dark-color); margin-bottom: 0; }

/* --- Form Pencarian & Pagination --- */
.search-form { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 1.5em; align-items: center; }
.search-form input, .search-form select { flex-grow: 1; margin-bottom: 0; }
.search-form button, .search-form a.tambah-btn { flex-shrink: 0; padding: 12px 20px; height: 47px; }
.pagination { margin-top: 2em; text-align: center; }
.pagination a { color: var(--primary-color); padding: 8px 16px; text-decoration: none; border: 1px solid var(--border-color); margin: 0 4px; border-radius: 5px; transition: background-color 0.3s, color 0.3s; }
.pagination a.active { background-color: var(--primary-color); color: white; border-color: var(--primary-color); }
.pagination a:hover:not(.active) { background-color: var(--grey-color); }

/* --- Halaman Spesifik --- */
.soal { margin-bottom: 2em; border-bottom: 1px solid var(--grey-color); padding-bottom: 1.5em; }
.soal p { font-weight: 600; font-size: 1.1em; }
.soal label { display: flex; align-items: center; margin: 0.8em 0 0.8em 1em; cursor: pointer; }
.soal input[type="radio"] { width: auto; margin: 0 10px 0 0; }
.soal-gambar { margin: 1em 0; text-align: center; }
.soal-gambar img { max-width: 100%; max-height: 400px; height: auto; border-radius: 8px; }
.nilai-akhir { font-size: 3em; font-weight: 700; text-align: center; color: var(--primary-color); margin: 0.5em 0; }
.error { color: #721c24; background-color: #f8d7da; border: 1px solid #f5c6cb; padding: 10px; border-radius: 8px; text-align: center; }
.success { color: #155724; background-color: #d4edda; border: 1px solid #c3e6cb; padding: 10px; border-radius: 8px; text-align: center; }
.warning-visible { display: block; padding: 1em; background-color: var(--warning-color); color: var(--dark-color); text-align: center; border-radius: 8px; margin-bottom: 1em; font-weight: bold; }
.warning-hidden { display: none; }
.about-section { margin-bottom: 2.5em; }
.about-section h3 { color: var(--primary-color); margin-bottom: 0.5em; border-bottom: 2px solid var(--grey-color); padding-bottom: 0.5em; }
.feature-list, .tech-list { list-style: none; padding-left: 0; }
.feature-list li { margin-bottom: 0.8em; font-size: 1.05em; }
.tech-list li { margin-bottom: 0.5em; }
.team-container { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; margin-top: 1.5em; }
.team-member { text-align: center; width: 150px; }
.team-member img { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; border: 4px solid var(--grey-color); box-shadow: 0 2px 8px rgba(0,0,0,0.1); margin-bottom: 10px; }
.team-member h4 { margin-bottom: 5px; font-weight: 600; color: var(--dark-color); }
.team-member p { font-size: 0.9em; color: #777; }
.student-list-header { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border-color); }
.student-list-header label { font-weight: 500; }
.student-list-container { border: 1px solid #ccc; border-radius: 8px; padding: 15px; height: 300px; overflow-y: auto; margin-bottom: 1em; }
.student-list-item, #student-list .student-list-item { display: flex; align-items: center; margin-bottom: 8px; }
.student-list-item input[type="checkbox"], #student-list .student-list-item input[type="checkbox"] { width: auto; margin: 0 10px 0 0; }
.student-list-item label, #student-list .student-list-item label { margin-bottom: 0; }
.grading-box { background-color: #f8f9fa; border: 1px solid var(--border-color); border-radius: 8px; padding: 1.5em; margin-bottom: 1.5em; }
.answer-box { background-color: var(--light-color); padding: 1em; border-radius: 5px; margin-top: 1em; min-height: 50px; }
.grading-inputs { margin-top: 1em; display: flex; gap: 20px; flex-wrap: wrap; }
.grading-inputs > div { flex: 1; min-width: 200px; }
.floating-help-btn { position: fixed; bottom: 25px; right: 25px; width: 50px; height: 50px; border-radius: 50%; background-color: var(--primary-color); color: white; font-size: 24px; font-weight: bold; border: none; box-shadow: 0 4px 10px rgba(0,0,0,0.2); cursor: pointer; z-index: 1050; transition: transform 0.2s ease; }
.floating-help-btn:hover { transform: scale(1.1); background-color: var(--primary-hover); }
.help-modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1100; }
.help-modal.active { display: flex; justify-content: center; align-items: center; }
.modal-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); }
.modal-content { position: relative; background-color: white; padding: 30px; border-radius: 10px; width: 90%; max-width: 600px; z-index: 1101; }
.modal-close { position: absolute; top: 10px; right: 15px; font-size: 28px; background: none; border: none; cursor: pointer; color: #888; }
#modal-body h4 { color: var(--primary-color); margin-bottom: 10px; }
#modal-body ul { padding-left: 20px; }
.navigator-btn { position: fixed; top: 80px; left: 20px; z-index: 1040; padding: 8px 15px; }
.question-navigator { position: fixed; top: 0; right: -320px; width: 300px; height: 100%; background-color: var(--light-color); box-shadow: -5px 0 15px rgba(0,0,0,0.1); z-index: 1200; transition: right 0.4s ease-in-out; display: flex; flex-direction: column; }
.question-navigator.active { right: 0; }
.navigator-header { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; border-bottom: 1px solid var(--grey-color); }
.navigator-header h4 { margin: 0; font-size: 1.1em; }
.navigator-grid { padding: 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(45px, 1fr)); gap: 10px; overflow-y: auto; flex-grow: 1; }
.navigator-item { display: flex; justify-content: center; align-items: center; height: 45px; text-decoration: none; border-radius: 5px; font-weight: 500; transition: transform 0.2s; }
.navigator-item:hover { transform: scale(1.1); }
.navigator-item.unanswered { background-color: var(--grey-color); color: var(--dark-color); border: 1px solid var(--border-color); }
.navigator-item.answered { background-color: var(--success-color); color: var(--light-color); border: 1px solid #27ae60; }
.navigator-footer { padding: 15px 20px; border-top: 1px solid var(--grey-color); display: flex; gap: 20px; font-size: 0.9em; }
.navigator-footer > div { display: flex; align-items: center; gap: 8px; }
.navigator-footer .box { width: 15px; height: 15px; border-radius: 3px; border: 1px solid var(--border-color); }
.floating-alert { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); padding: 15px 25px; background-color: var(--warning-color); color: var(--dark-color); border-radius: 10px; box-shadow: 0 5px 15px rgba(0,0,0,0.2); z-index: 2000; font-weight: 500; animation: slide-down 0.5s ease forwards; }
.floating-alert.fade-out { animation: fade-out 0.5s ease forwards; }
@keyframes slide-down { from { top: -100px; opacity: 0; } to { top: 20px; opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; transform: translate(-50%, -20px); } }
.status-aktif, .status-nonaktif { padding: 5px 10px; border-radius: 15px; font-size: 0.8em; font-weight: bold; color: white; }
.status-aktif { background-color: var(--success-color); }
.status-nonaktif { background-color: #95a5a6; }
.dropdown-button-menu { background: none; border: none; cursor: pointer; font-family: 'Poppins', sans-serif; font-size: 1em; font-weight: 500; color: var(--dark-color); }

/* --- Media Query untuk Responsif --- */
@media (max-width: 768px) {
    .container {
        padding: 1.5em;
        max-width: 100%;
    }
    .nav-links {
        display: none;
        flex-direction: column;
        background-color: white;
        position: absolute;
        top: 70px;
        left: 0;
        width: 100%;
        padding: 10px 0;
        box-shadow: 0 8px 16px rgba(0,0,0,0.1);
        text-align: center;
        gap: 0;
    }
    .nav-links.active {
        display: flex;
    }
    .nav-links li {
        width: 100%;
    }
    .nav-links a {
        padding: 12px 20px;
        width: 100%;
        display: block;
    }
    .user-dropdown {
        padding: 10px 0;
        width: 100%;
    }
    .dropdown-content {
        position: static;
        box-shadow: none;
        border: none;
        min-width: unset;
        background-color: #f9f9f9;
    }
    .hamburger {
        display: flex;
        flex-direction: column;
    }
    .team-member {
        width: 45%;
    }
    .team-member img {
        width: 100px;
        height: 100px;
    }
    table thead {
        display: none;
    }
    table tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 10px;
    }
    table td {
        display: flex;
        justify-content: space-between;
        text-align: right;
        padding: 10px;
        border-bottom: 1px solid var(--grey-color);
    }
    table td:last-child {
        border-bottom: none;
    }
    table td::before {
        content: attr(data-label);
        font-weight: bold;
        text-align: left;
        padding-right: 15px;
    }
}

/* ======================================================== */
/* --- Styling BARU untuk Tata Letak Tombol Navigasi Soal --- */
/* ======================================================== */
.soal-navigation-footer {
    display: flex;
    justify-content: space-between; /* Mendorong item ke sisi berlawanan */
    align-items: center; /* Membuat item sejajar secara vertikal */
    margin-top: 2.5em;
    padding-top: 1.5em;
    border-top: 1px solid #e9ecef; /* Garis pemisah yang lebih halus */
}

.ragu-ragu-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-size: 0.95em;
    color: #555;
    cursor: pointer;
    user-select: none; /* Agar teks tidak terseleksi saat diklik */
}

.navigation-group {
    display: flex;
    gap: 0.8em; /* Memberi jarak antar tombol navigasi */
}


/* ======================================================== */
/* --- Styling BARU untuk Peringatan Melayang (Violation) --- */
/* ======================================================== */
.violation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(30, 30, 30, 0.9); /* Latar belakang gelap transparan */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(5px); /* Efek blur di belakang */
    transition: opacity 0.3s ease;
}

.violation-overlay.hidden {
    display: none;
}

.warning-box {
    background-color: #fff;
    color: #333;
    padding: 2em 3em;
    border-radius: 15px;
    text-align: center;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transform: scale(0.95);
    animation: pop-in 0.3s ease-out forwards;
}

.warning-icon {
    width: 60px;
    height: auto;
    margin-bottom: 1em;
}

.warning-box h2 {
    color: #d9534f; /* Merah */
    margin-top: 0;
    margin-bottom: 0.5em;
    font-size: 1.8em;
}

.warning-box p {
    margin: 0.5em 0;
    line-height: 1.6;
}

.violation-count {
    font-size: 1.2em;
    font-weight: bold;
    color: #d9534f;
    margin-top: 1em !important;
    background-color: #f2f2f2;
    padding: 0.5em;
    border-radius: 8px;
}

.warning-box small {
    display: block;
    margin-top: 1.5em;
    color: #888;
}

/* Animasi untuk memunculkan box */
@keyframes pop-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ======================================================== */
/* --- 1. Styling BARU untuk Merapikan Opsi Jawaban --- */
/* ======================================================== */
.opsi-label {
    display: flex;
    align-items: flex-start; /* Membuat radio button dan teks sejajar di atas */
    gap: 1em; /* Jarak antara radio button dan teks */
    padding: 1em;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 1em;
    cursor: pointer;
    transition: background-color 0.2s;
}

.opsi-label:hover {
    background-color: #f7f7f7;
}

.opsi-label input[type="radio"] {
    margin-top: 5px; /* Sedikit menurunkan posisi radio button agar pas */
    flex-shrink: 0; /* Mencegah radio button mengecil */
}

.opsi-huruf {
    font-weight: bold;
}

/* ======================================================== */
/* --- 2. Styling untuk Tata Letak Tombol Navigasi Soal --- */
/* ======================================================== */
.soal-navigation-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2.5em;
    padding-top: 1.5em;
    border-top: 1px solid #e9ecef;
}

.ragu-ragu-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-size: 0.95em;
    color: #555;
    cursor: pointer;
    user-select: none;
}

.navigation-group {
    display: flex;
    gap: 0.8em;
}


/* ======================================================== */
/* --- 3. Styling untuk Peringatan Melayang (Violation) --- */
/* ======================================================== */
.violation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(30, 30, 30, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
    transition: opacity 0.3s ease;
}

.violation-overlay.hidden {
    display: none;
}

.warning-box {
    background-color: #fff;
    color: #333;
    padding: 2em 3em;
    border-radius: 15px;
    text-align: center;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transform: scale(0.95);
    animation: pop-in 0.3s ease-out forwards;
}

.warning-icon {
    width: 60px;
    height: auto;
    margin-bottom: 1em;
}

.warning-box h2 {
    color: #d9534f;
    margin-top: 0;
    margin-bottom: 0.5em;
    font-size: 1.8em;
}

.warning-box p {
    margin: 0.5em 0;
    line-height: 1.6;
}

.violation-count {
    font-size: 1.2em;
    font-weight: bold;
    color: #d9534f;
    margin-top: 1em !important;
    background-color: #f2f2f2;
    padding: 0.5em;
    border-radius: 8px;
}

.warning-box small {
    display: block;
    margin-top: 1.5em;
    color: #888;
}

@keyframes pop-in {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}