/* ============================================
   CBT Calon Pegawai - Blue White Friendly
   Rounded, Spacious, Interactive
   ============================================ */

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

:root {
    --primary: #4f6ef7;
    --primary-hover: #3b5de7;
    --primary-light: #eef2ff;
    --primary-bg: #4f6ef7;
    --sidebar-width: 260px;
    --border: #e8ecf2;
    --bg: #f0f4fa;
    --card: #ffffff;
    --text: #1a1d26;
    --text-sub: #5f6980;
    --text-muted: #9ca3b4;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

* { font-family: 'Inter', -apple-system, sans-serif; box-sizing: border-box; }
body { background: var(--bg); color: var(--text); margin: 0; -webkit-font-smoothing: antialiased; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }

/* === Sidebar === */
.sidebar {
    background: var(--card);
    width: var(--sidebar-width);
    min-height: 100vh;
    position: fixed;
    left: 0; top: 0;
    z-index: 50;
    transition: transform 0.3s ease;
    overflow-y: auto;
    border-right: 1px solid var(--border);
    padding: 0 8px;
}
.sidebar-logo {
    padding: 22px 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-section-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 20px 14px 8px;
}
.sidebar-menu a, .sidebar-menu button {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 14px;
    color: var(--text-sub);
    text-decoration: none;
    transition: all 0.2s ease;
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 500;
    text-align: left;
    border-radius: var(--radius);
    margin: 2px 0;
}
.sidebar-menu a:hover, .sidebar-menu button:hover {
    color: var(--primary);
    background: var(--primary-light);
    transform: translateX(3px);
}
.sidebar-menu a.active, .sidebar-menu button.active {
    color: #fff;
    background: var(--primary-bg);
    border-radius: var(--radius);
    transform: none;
}
.sidebar-menu a.active svg, .sidebar-menu button.active svg { stroke: #fff; }

/* === Main Content === */
.topbar { display: none; }
.main-content {
    margin-left: var(--sidebar-width);
    padding: 32px 36px;
    min-height: 100vh;
    background: var(--bg);
    transition: margin-left 0.3s;
}

/* Page header */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
    flex-wrap: wrap;
}
.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}
.page-header p {
    font-size: 13px;
    color: var(--text-sub);
    margin: 4px 0 0;
}

/* === Cards === */
.glass-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all 0.2s ease;
}
.glass-card:hover {
    border-color: #dce1ea;
}

/* Stat Card */
.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}
.stat-card::before { display: none; }
.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
}

/* === Buttons === */
.btn-primary {
    background: var(--primary);
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    background: var(--card);
    color: var(--text);
    padding: 10px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
.btn-secondary:hover { background: #f5f7fb; border-color: #d0d5e0; transform: translateY(-1px); }

.btn-danger {
    background: #fef2f2;
    color: #dc2626;
    padding: 10px 20px;
    border-radius: var(--radius);
    border: 1px solid #fecaca;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
.btn-danger:hover { background: #fee2e2; transform: translateY(-1px); }

.btn-success {
    background: #f0fdf4;
    color: #16a34a;
    padding: 10px 20px;
    border-radius: var(--radius);
    border: 1px solid #bbf7d0;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
.btn-success:hover { background: #dcfce7; transform: translateY(-1px); }

.btn-sm { padding: 7px 14px; font-size: 12px; border-radius: 10px; }

/* === Form === */
.form-input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    transition: all 0.2s ease;
    background: var(--bg);
    outline: none;
    color: var(--text);
}
.form-input:focus {
    border-color: var(--primary);
    background: var(--card);
    box-shadow: 0 0 0 3px rgba(79,110,247,0.08);
}
.form-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-sub);
    margin-bottom: 6px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* === Table === */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.data-table thead th {
    background: #f8f9fc;
    color: var(--text-muted);
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}
.data-table thead th:first-child { border-radius: var(--radius) 0 0 0; }
.data-table thead th:last-child { border-radius: 0 var(--radius) 0 0; }
.data-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #f3f5f8;
    font-size: 13px;
    color: var(--text);
    transition: background 0.15s;
}
.data-table tbody tr { transition: all 0.15s; }
.data-table tbody tr:hover { background: #f8f9fc; }
.data-table tbody tr:hover td { border-bottom-color: #edf0f5; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* === Tabs (Pill Style) === */
.tab-nav {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: #edf0f5;
    border-radius: var(--radius);
    padding: 4px;
    width: fit-content;
}
.tab-btn {
    padding: 9px 18px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}
.tab-btn:hover { color: var(--text-sub); background: rgba(255,255,255,0.5); }
.tab-btn.active {
    color: var(--text);
    background: var(--card);
    font-weight: 600;
}
.tab-content { display: none; animation: fadeIn 0.2s ease; }
.tab-content.active { display: block; }

/* === Badge === */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.badge-success { background: #ecfdf5; color: #059669; }
.badge-danger { background: #fef2f2; color: #dc2626; }
.badge-info { background: #eef2ff; color: #4f6ef7; }
.badge-warning { background: #fffbeb; color: #d97706; }

/* === Modal === */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15,23,42,0.25);
    backdrop-filter: blur(2px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0; visibility: hidden;
    transition: all 0.2s ease;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-box {
    background: var(--card);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 540px;
    max-height: 85vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    transform: translateY(12px) scale(0.98);
    transition: all 0.25s ease;
}
.modal-overlay.active .modal-box { transform: translateY(0) scale(1); }
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 15px;
}
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* === Login === */
.login-bg {
    min-height: 100vh;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.login-bg::before, .login-bg::after { display: none; }
.login-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 44px 36px;
    width: 100%;
    max-width: 400px;
}
.login-input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
}
.login-input::placeholder { color: var(--text-muted); }
.login-input:focus { border-color: var(--primary); background: var(--card); box-shadow: 0 0 0 3px rgba(79,110,247,0.08); }

/* === Biodata === */
.biodata-container { min-height: 100vh; background: var(--bg); padding-bottom: 80px; }
.biodata-header { padding: 32px 20px 54px; text-align: center; color: white; background: var(--primary); border-radius: 0 0 28px 28px; }
.biodata-card { background: var(--card); border-radius: var(--radius-xl) var(--radius-xl) 0 0; margin: -28px 12px 0; padding: 32px 20px; min-height: 60vh; border: 1px solid var(--border); border-bottom: none; }
.step-indicator { display: flex; justify-content: center; gap: 8px; margin-bottom: 32px; }
.step-dot { width: 10px; height: 10px; border-radius: 50%; background: #e2e8f0; transition: all 0.3s ease; }
.step-dot.active { background: var(--primary); width: 32px; border-radius: 5px; }
.step-dot.done { background: #10b981; }

/* === Repeater (Dynamic Add/Remove) === */
.section-divider {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    padding: 16px 0 10px;
    margin-top: 8px;
    border-top: 1px dashed var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-divider:first-child { border-top: none; margin-top: 0; padding-top: 0; }

.repeater-card {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    position: relative;
    animation: slideUp 0.25s ease;
    transition: border-color 0.2s ease;
}
.repeater-card:hover { border-color: #d0d5e0; }
.repeater-card + .repeater-card { margin-top: 10px; }
.repeater-card .repeater-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.repeater-remove-btn {
    width: 26px; height: 26px;
    border-radius: 8px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #dc2626;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.repeater-remove-btn:hover { background: #fee2e2; transform: scale(1.1); }

.repeater-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 11px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 10px;
}
.repeater-add-btn:hover { border-color: var(--primary); background: var(--primary-light); }

.repeater-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .repeater-grid { grid-template-columns: 1fr; } }

.form-sub-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: block;
}
.form-input-sm {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 12px;
    transition: all 0.2s ease;
    background: white;
    outline: none;
    color: var(--text);
}
.form-input-sm:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,110,247,0.08);
}

/* === QR === */
.qr-display { background: var(--primary); border-radius: var(--radius-xl); padding: 44px; text-align: center; color: white; }
.qr-box { background: white; border-radius: var(--radius-lg); padding: 24px; display: inline-block; }

/* === Exam === */
.exam-container { min-height: 100vh; background: var(--bg); }
.exam-header { background: var(--primary); color: white; padding: 14px 24px; position: fixed; top: 0; left: 0; right: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; }
.exam-timer { background: rgba(255,255,255,0.18); padding: 8px 18px; border-radius: var(--radius); font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }
.exam-timer.warning { background: rgba(239,68,68,0.3); color: #fca5a5; animation: pulse 1s infinite; }
.soal-nav-btn {
    width: 40px; height: 40px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
}
.soal-nav-btn:hover { border-color: var(--primary); color: var(--primary); transform: scale(1.08); }
.soal-nav-btn.answered { background: var(--primary); color: white; border-color: var(--primary); }
.soal-nav-btn.current { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* === Animations === */
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.25s ease; }
.slide-up { animation: slideUp 0.3s ease; }
.animate-spin { animation: spin 0.7s linear infinite; }

button:disabled { cursor: not-allowed; opacity: 0.5 !important; }
.spinner { width: 32px; height: 32px; border: 2.5px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; margin: 36px auto; }
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); font-size: 13px; }

/* Truncate helper */
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* === Responsive === */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 20px 16px; }
    .modal-box { max-width: 100%; border-radius: var(--radius-xl) var(--radius-xl) 0 0; margin-top: auto; }
    .login-card { padding: 32px 24px; }
    .page-header { flex-direction: column; gap: 12px; }
    .page-header h1 { font-size: 18px; }
}
