@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* =====================
   VARIABLES
===================== */
:root {
    --primary:        #4f46e5;
    --primary-d:      #4338ca;
    --primary-light:  #eef2ff;
    --success:        #059669;
    --success-light:  #d1fae5;
    --danger:         #dc2626;
    --danger-light:   #fee2e2;
    --warning:        #d97706;
    --warning-light:  #fef3c7;
    --info:           #0284c7;
    --info-light:     #e0f2fe;

    --bg:       #f8fafc;
    --white:    #ffffff;
    --shadow:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:0 4px 16px rgba(0,0,0,.1);

    --gray-50:  #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    --sidebar-bg:     #1e1b4b;
    --sidebar-hover:  rgba(255,255,255,.07);
    --sidebar-active: rgba(99,102,241,.25);
    --sidebar-text:   rgba(255,255,255,.65);
    --sidebar-width:  240px;

    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 14px;
}

/* =====================
   RESET & BASE
===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--gray-900);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-d); }

/* =====================
   LAYOUT (Admin)
===================== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand h2 {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
}
.sidebar-brand span {
    font-size: 11px;
    color: var(--sidebar-text);
    font-weight: 400;
}

.sidebar-nav { flex: 1; padding: 12px 0; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 0;
    transition: background .15s, color .15s;
}
.sidebar-nav a:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav a.active { background: var(--sidebar-active); color: #fff; }
.sidebar-nav .nav-icon { font-size: 16px; width: 20px; text-align: center; }
.sidebar-nav .nav-section {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.3);
    padding: 16px 20px 6px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-footer a {
    display: flex; align-items: center; gap: 8px;
    color: var(--sidebar-text); font-size: 13px;
    transition: color .15s;
}
.sidebar-footer a:hover { color: #fff; }

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar h1 { font-size: 17px; font-weight: 600; color: var(--gray-900); }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.page-body { padding: 28px; flex: 1; }

/* =====================
   CARDS
===================== */
.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}
.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =====================
   FORMS
===================== */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
}
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--gray-900);
    background: var(--white);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.form-control[readonly] { background: var(--gray-50); color: var(--gray-500); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { appearance: none; cursor: pointer; }
.form-hint { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.form-row { display: grid; gap: 16px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

/* =====================
   BUTTONS
===================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s, transform .1s;
    text-decoration: none;
    line-height: 1;
}
.btn:active { transform: scale(.98); }
.btn-primary  { background: var(--primary);  color: #fff; }
.btn-primary:hover  { background: var(--primary-d); color: #fff; }
.btn-success  { background: var(--success);  color: #fff; }
.btn-success:hover  { background: #047857; color: #fff; }
.btn-danger   { background: var(--danger);   color: #fff; }
.btn-danger:hover   { background: #b91c1c; color: #fff; }
.btn-warning  { background: var(--warning);  color: #fff; }
.btn-ghost    { background: transparent; color: var(--gray-600); border: 1px solid var(--gray-300); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-lg { padding: 12px 28px; font-size: 15px; font-weight: 600; }
.btn-block { width: 100%; justify-content: center; }

/* =====================
   TABLES
===================== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--gray-200); }
table { width: 100%; border-collapse: collapse; }
thead th {
    padding: 11px 14px;
    background: var(--gray-50);
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
    text-align: left;
}
tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13.5px;
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--gray-50); }

/* =====================
   BADGES
===================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1;
}
.badge-success  { background: var(--success-light);  color: var(--success); }
.badge-danger   { background: var(--danger-light);   color: var(--danger); }
.badge-warning  { background: var(--warning-light);  color: var(--warning); }
.badge-info     { background: var(--info-light);     color: var(--info); }
.badge-gray     { background: var(--gray-100);       color: var(--gray-600); }
.badge-primary  { background: var(--primary-light);  color: var(--primary); }

/* =====================
   ALERTS
===================== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #a7f3d0; }
.alert-danger  { background: var(--danger-light);  color: var(--danger);  border: 1px solid #fca5a5; }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid #fcd34d; }
.alert-info    { background: var(--info-light);    color: var(--info);    border: 1px solid #7dd3fc; }

/* =====================
   MISC UTILITIES
===================== */
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex  { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.text-muted  { color: var(--gray-500); font-size: 13px; }
.text-sm     { font-size: 12.5px; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.fw-600      { font-weight: 600; }
.fw-700      { font-weight: 700; }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-primary { color: var(--primary); }
.text-warning { color: var(--warning); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.divider { border: none; border-top: 1px solid var(--gray-200); margin: 20px 0; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--gray-500); }
.empty-state .icon { font-size: 40px; margin-bottom: 12px; }

/* =====================
   STAT CARDS
===================== */
.stat-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: var(--shadow);
}
.stat-label { font-size: 12px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--gray-900); margin: 6px 0 4px; }
.stat-sub   { font-size: 12.5px; color: var(--gray-500); }
.stat-icon  { font-size: 28px; }

/* =====================
   STUDENT PAGE
===================== */
.student-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4f46e5 100%);
    padding: 24px;
}
.student-card {
    background: var(--white);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.student-card .logo {
    text-align: center;
    margin-bottom: 28px;
}
.student-card .logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px; height: 64px;
    background: var(--primary-light);
    border-radius: 16px;
    font-size: 32px;
    margin-bottom: 12px;
}
.student-card h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-900);
    text-align: center;
}
.student-card .subtitle {
    font-size: 13.5px;
    color: var(--gray-500);
    text-align: center;
    margin-top: 4px;
}

/* =====================
   RESULT PAGE
===================== */
.result-wrap {
    min-height: 100vh;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4f46e5 100%);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}
.result-card {
    background: var(--white);
    border-radius: 20px;
    padding: 36px;
    width: 100%;
    max-width: 560px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    margin: auto;
}
.result-header {
    text-align: center;
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--gray-100);
}
.result-header h1 { font-size: 20px; font-weight: 700; color: var(--gray-900); }
.result-header .peserta { font-size: 13.5px; color: var(--gray-500); margin-top: 4px; }

.score-circle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}
.score-big {
    font-size: 52px;
    font-weight: 800;
    line-height: 1;
}
.score-label { font-size: 13px; color: var(--gray-500); margin-top: 4px; }

.qr-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background: var(--gray-50);
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin: 20px 0;
}
.qr-box canvas, .qr-box img { display: block; }
.qr-instruction {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--warning-light);
    border: 1px solid #fcd34d;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13px;
    color: var(--warning);
    font-weight: 500;
    text-align: center;
    justify-content: center;
}

.detail-list { margin-top: 8px; }
.detail-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13.5px;
}
.detail-item:last-child { border-bottom: none; }
.detail-item .name { display: flex; align-items: center; gap: 8px; }
.detail-item .icon-benar { color: var(--success); font-size: 16px; }
.detail-item .icon-salah { color: var(--danger); font-size: 16px; }
.detail-item .poin { font-weight: 600; }
.detail-item .poin.benar { color: var(--success); }
.detail-item .poin.salah { color: var(--danger); }

/* =====================
   MODAL
===================== */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 200;
    padding: 16px;
}
.modal-overlay.hidden { display: none; }
.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-title { font-size: 17px; font-weight: 600; margin-bottom: 20px; }

/* =====================
   RESPONSIVE
===================== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main-content { margin-left: 0; }
    .grid-2, .grid-3, .form-row.cols-2, .form-row.cols-3 { grid-template-columns: 1fr; }
}

/* =====================
   PROGRESS BAR
===================== */
.progress-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width .4s ease;
}
.progress-fill.success { background: var(--success); }
.progress-fill.danger  { background: var(--danger); }

/* File upload zone */
.file-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 28px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.file-zone:hover, .file-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.file-zone .zone-icon { font-size: 36px; margin-bottom: 8px; }
.file-zone .zone-text { font-size: 13.5px; color: var(--gray-600); }
.file-zone .zone-hint { font-size: 12px; color: var(--gray-400); margin-top: 4px; }
.file-zone input[type="file"] { display: none; }
.file-zone .file-selected { font-size: 13px; color: var(--success); font-weight: 500; margin-top: 8px; }
