:root {
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --primary-light: #e0f2fe;
    --primary-dark: #075985;
    --accent: #10b981;
    --accent-hover: #059669;
    --accent-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-page);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.shell {
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* Header */
.header {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 0;
    position: sticky;
    top: 0;
    z-index: 50;
}
.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
    letter-spacing: -0.02em;
}
.brand-mark {
    font-size: 1.4rem;
    line-height: 1;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.15s;
}
.nav-link:hover {
    color: var(--primary);
}

/* Hero Section */
.hero-card {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    border-radius: var(--radius);
    padding: 2.25rem 2rem;
    margin: 2rem 0 1.5rem;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}
.hero-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}
.hero-card h1 {
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 0.5rem;
}
.hero-card p {
    font-size: 1rem;
    opacity: 0.92;
    max-width: 680px;
}

/* Status Bar */
.user-bar {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.user-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}
.user-name {
    font-weight: 700;
    font-size: 0.95rem;
}
.user-class {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Two Hub Cards (Materi & Latihan) */
.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.hub-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s, box-shadow 0.15s;
}
.hub-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.hub-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}
.hub-icon.blue {
    background: var(--primary-light);
    color: var(--primary);
}
.hub-icon.green {
    background: var(--accent-light);
    color: var(--accent);
}
.hub-card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.hub-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
    flex-grow: 1;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-primary {
    background: var(--primary);
    color: #ffffff;
}
.btn-primary:hover {
    background: var(--primary-hover);
}
.btn-accent {
    background: var(--accent);
    color: #ffffff;
}
.btn-accent:hover {
    background: var(--accent-hover);
}
.btn-outline {
    background: #ffffff;
    border-color: var(--border);
    color: var(--text-main);
}
.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.btn-danger {
    background: var(--danger-light);
    color: var(--danger);
    border-color: #fecaca;
}
.btn-danger:hover {
    background: var(--danger);
    color: #ffffff;
}
.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-info { background: #e0f2fe; color: #0369a1; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger { background: #fee2e2; color: #b91c1c; }

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.alert-success { background: #dcfce7; border: 1px solid #bbf7d0; color: #166534; }
.alert-error { background: #fee2e2; border: 1px solid #fecaca; color: #991b1b; }
.alert-info { background: #e0f2fe; border: 1px solid #bae6fd; color: #075985; }

/* Question Layout (1 Soal per Halaman) */
.quiz-container {
    margin-bottom: 2.5rem;
}
.quiz-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.quiz-soal-indicator {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-dark);
}
.progress-bar-wrap {
    background: #e2e8f0;
    border-radius: 9999px;
    height: 8px;
    width: 100%;
    margin-bottom: 1.5rem;
    overflow: hidden;
}
.progress-bar-fill {
    background: var(--primary);
    height: 100%;
    border-radius: 9999px;
    transition: width 0.3s ease;
}

/* Grid Navigator 1 - 30 */
.soal-grid-box {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
}
.soal-grid-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
}
.soal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
    gap: 0.4rem;
}
.grid-num {
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text-main);
    transition: all 0.15s;
    cursor: pointer;
}
.grid-num:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.grid-num.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}
.grid-num.answered {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}
.grid-num.answered.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

/* Question Card */
.question-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}
.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 0.85rem;
}
.question-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    background: var(--primary-light);
    color: var(--primary-dark);
}
.question-prompt {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    color: var(--text-main);
    white-space: pre-line;
}

/* Options (Multiple Choice & True/False) */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.option-label {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    background: #ffffff;
    transition: all 0.15s;
    user-select: none;
}
.option-label:hover {
    border-color: var(--primary);
    background: #f0f9ff;
}
.option-label input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}
.option-label.selected {
    border-color: var(--primary);
    background: #f0f9ff;
    box-shadow: 0 0 0 1px var(--primary);
}
.option-label.bool-benar.selected {
    border-color: var(--accent);
    background: #f0fdf4;
    box-shadow: 0 0 0 1px var(--accent);
}
.option-label.bool-salah.selected {
    border-color: var(--danger);
    background: #fef2f2;
    box-shadow: 0 0 0 1px var(--danger);
}
.option-code {
    font-weight: 700;
    font-size: 1rem;
    min-width: 24px;
    color: var(--primary-dark);
}
.option-text {
    font-size: 1rem;
    flex-grow: 1;
}

/* Ordering Interface */
.ordering-container {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.ordering-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: #ffffff;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.15s;
}
.ordering-rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.ordering-text {
    flex-grow: 1;
    font-weight: 500;
}
.ordering-controls {
    display: flex;
    gap: 0.35rem;
}
.btn-order {
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
    border: 1px solid var(--border);
    background: #f8fafc;
    border-radius: 6px;
    cursor: pointer;
}
.btn-order:hover:not(:disabled) {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

/* Short Answer Input */
.short-input-wrap {
    margin-top: 0.5rem;
}
.short-input {
    width: 100%;
    max-width: 480px;
    padding: 0.85rem 1.25rem;
    font-size: 1.1rem;
    font-weight: 600;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.15s;
}
.short-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Bottom Navigation Controls */
.quiz-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-sm);
}
.save-status {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Read-Only Result Card */
.score-summary-card {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #ffffff;
    border-radius: var(--radius);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    box-shadow: var(--shadow-md);
}
.score-value {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}
.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
}
.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    background: #ffffff;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.form-help {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}
.modal-backdrop.open {
    display: flex;
}
.modal-box {
    background: #ffffff;
    border-radius: var(--radius);
    max-width: 500px;
    width: 100%;
    padding: 1.75rem;
    box-shadow: var(--shadow-lg);
}
.modal-box.modal-lg {
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}

/* Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.data-table th, .data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.data-table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Footer */
.footer {
    margin-top: auto;
    background: #ffffff;
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

@media (max-width: 640px) {
    .hero-card {
        padding: 1.5rem 1.25rem;
    }
    .hero-card h1 {
        font-size: 1.45rem;
    }
    .question-card {
        padding: 1.25rem;
    }
    .quiz-nav-bar {
        padding: 0.85rem;
        flex-direction: column;
        gap: 0.75rem;
    }
    .quiz-nav-bar > * {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    .attendance-card {
        flex-direction: column;
        text-align: center;
        padding: 1.25rem;
    }
    .attendance-title {
        justify-content: center;
    }
    .attendance-status-wrap {
        justify-content: center;
    }
}

/* Attendance / Presensi Card & Green Button */
.attendance-card {
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
    border: 1.5px solid #bbf7d0;
    border-radius: var(--radius);
    padding: 1.5rem 1.75rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    box-shadow: 0 4px 12px -2px rgba(16, 185, 129, 0.08);
}
.attendance-info {
    flex: 1;
}
.attendance-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #14532d;
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.attendance-desc {
    color: #166534;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}
.attendance-status-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.attendance-btn-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.btn-absen-green {
    position: relative;
    width: 105px;
    height: 105px;
    border-radius: 50%;
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    outline: none;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}
.btn-absen-green img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    display: block;
    filter: drop-shadow(0 6px 12px rgba(16, 185, 129, 0.35));
    transition: filter 0.2s ease;
}
.btn-absen-green:hover {
    transform: scale(1.08);
}
.btn-absen-green:hover img {
    filter: drop-shadow(0 10px 20px rgba(16, 185, 129, 0.5));
}
.btn-absen-green:active {
    transform: scale(0.95);
}
.btn-absen-green.pulse::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
    animation: pulse-green 2s infinite cubic-bezier(0.66, 0, 0, 1);
    pointer-events: none;
}
@keyframes pulse-green {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
    }
    70% {
        box-shadow: 0 0 0 18px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}
.btn-absen-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #15803d;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
}
.btn-absen-green.done img {
    filter: drop-shadow(0 4px 10px rgba(16, 185, 129, 0.25));
}

/* Modal Popup Absen */
.modal-absen-content {
    text-align: center;
    padding: 0.5rem 0;
}
.modal-absen-icon {
    width: 72px;
    height: 72px;
    background: #ecfdf5;
    border: 3px solid #10b981;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    color: #10b981;
    margin: 0 auto 1.25rem;
    animation: scale-up 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes scale-up {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
.modal-absen-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.35rem;
}
.modal-absen-subtitle {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 1.5rem;
}
.modal-absen-details {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    text-align: left;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}
.modal-absen-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    border-bottom: 1px dashed #e2e8f0;
}
.modal-absen-row:last-child {
    border-bottom: none;
}
.modal-absen-row-label {
    color: #64748b;
    font-weight: 500;
}
.modal-absen-row-value {
    color: #0f172a;
    font-weight: 700;
}
