/* SI-TEKNO Design System & Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --bg-dark: #0b0f19;
    --bg-card: #111827;
    --bg-card-hover: #1f2937;
    --bg-surface: #1e293b;
    --border-color: #1f2937;
    --border-light: #374151;

    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-glow: rgba(37, 99, 235, 0.25);

    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #0ea5e9;

    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;

    --sidebar-width: 260px;
    --topbar-height: 70px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-surface);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* Layout Elements */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 50;
    transition: transform 0.3s ease;
}

.sidebar-header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
}

/* Tombol ✕ tutup sidebar — hanya tampil di mobile */
.sidebar-close-btn {
    display: none;
    margin-left: auto;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #94a3b8;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.sidebar-close-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.35);
    color: #f87171;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), #60a5fa);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.brand-text h2 {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(90deg, #fff, #93c5fd);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-text span {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.menu-category {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-dim);
    letter-spacing: 0.8px;
    padding: 12px 10px 4px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.menu-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-main);
    transform: translateX(3px);
}

.menu-item.active {
    background: var(--primary);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.menu-item .icon {
    font-size: 18px;
    width: 22px;
    text-align: center;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--bg-dark);
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.topbar {
    height: var(--topbar-height);
    background: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 101;
    /* Di atas overlay (45) dan sidebar (100) agar tombol hamburger tidak tertutup */
}

.content-body {
    padding: 32px;
    flex: 1;
}

/* Cards & Widgets */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    margin-bottom: 24px;
}

.grid-cols-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
}

.grid-cols-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.grid-cols-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, border-color 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-light);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-info h4 {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-info h2 {
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    margin-top: 4px;
}

/* =========================================================
   BUTTONS (Tombol Aksi Interaktif)
   Ciri Khas: Bold, berbayang, memiliki efek hover interaktif,
   border tegas, pointer cursor, dan elevasi saat disentuh.
   ========================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
    user-select: none;
    line-height: 1.3;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    border-color: #3b82f6;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
    color: #ffffff;
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    border-color: #34d399;
}

.btn-success:hover {
    background: linear-gradient(135deg, #34d399, #10b981);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
    color: #ffffff;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
    border-color: #f87171;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #f87171, #ef4444);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
    color: #ffffff;
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #111827;
    font-weight: 800;
    border-color: #fbbf24;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.btn-outline {
    background: #1e293b;
    border: 1px solid #374151;
    color: #e2e8f0;
}

.btn-outline:hover {
    background: #334155;
    border-color: #64748b;
    color: #ffffff;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    font-weight: 600;
}

/* Dedicated Action Button in Tables & Toolbars */
.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    background: #1e293b;
    border: 1px solid #374151;
    color: #cbd5e1;
    transition: all 0.15s ease;
}

.btn-action:hover {
    background: #334155;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* =========================================================
   BADGES & LABELS (Murni Keterangan/Status/Metadata)
   Ciri Khas: Ukuran ringkas, non-interaktif (no pointer),
   teks muted/halus, background transparan/pastel lembut,
   border halus dengan bentuk kotak rounded 5px (bukan pill tombol).
   ========================================================= */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    user-select: none;
    pointer-events: none;
    /* Menandakan murni label, bukan tombol */
    letter-spacing: 0.2px;
}

.badge-success {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-info {
    background: rgba(14, 165, 233, 0.12);
    color: #38bdf8;
    border: 1px solid rgba(14, 165, 233, 0.25);
}

.badge-purple {
    background: rgba(168, 85, 247, 0.12);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.25);
}

.badge-neutral {
    background: rgba(148, 163, 184, 0.1);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.data-table th {
    background: var(--bg-dark);
    padding: 14px 16px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Forms */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-dark);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

textarea.form-control {
    resize: vertical;
    min-height: 90px;
}

/* Alert Box */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--success);
    color: #34d399;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--danger);
    color: #fca5a5;
}

.alert-info {
    background: rgba(14, 165, 233, 0.15);
    border: 1px solid var(--info);
    color: #7dd3fc;
}

/* CBT Elements */
.cbt-container {
    max-width: 1100px;
    margin: 0 auto;
}

.cbt-timer-badge {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    padding: 8px 18px;
    border-radius: 9999px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.question-nav-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.q-nav-btn {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    background: var(--bg-surface);
    color: var(--text-main);
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.q-nav-btn.answered {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}

.q-nav-btn.active {
    outline: 3px solid var(--primary);
}

.q-nav-btn.flagged {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.option-box {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.option-box:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.08);
}

.option-box.selected {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.2);
    box-shadow: 0 0 0 2px var(--primary);
}

.option-box .key-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-dark);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
}

.option-box.selected .key-circle {
    background: var(--primary);
    border-color: var(--primary);
}

/* =========================================================
   SIDEBAR OVERLAY (Mobile backdrop)
   ========================================================= */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 45;
    backdrop-filter: blur(2px);
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
}

/* Hamburger — tampil di semua ukuran layar untuk hide/show menubar */
.topbar-hamburger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.topbar-hamburger:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--primary);
    color: #fff;
}

/* Desktop: Menubar hidden / collapsed state */
@media (min-width: 901px) {
    body.sidebar-collapsed .sidebar {
        transform: translateX(-100%);
    }

    body.sidebar-collapsed .main-content {
        margin-left: 0;
    }
}

/* =========================================================
   RESPONSIVE — Tablet & Mobile (≤ 900px)
   ========================================================= */
@media (max-width: 900px) {

    /* Sidebar slide off-canvas */
    .sidebar {
        transform: translateX(-100%);
        z-index: 100;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    }

    /* Hamburger button tampil */
    .topbar-hamburger {
        display: inline-flex;
    }

    /* Tombol ✕ tutup sidebar tampil di mobile */
    .sidebar-close-btn {
        display: inline-flex;
    }

    /* Main content full-width */
    .main-content {
        margin-left: 0;
    }

    /* Topbar */
    .topbar {
        padding: 0 14px;
        gap: 8px;
    }

    /* Content body */
    .content-body {
        padding: 16px;
    }

    /* Grid kolom — collapse ke auto-fit lebih kecil */
    .grid-cols-4 {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 12px;
    }

    .grid-cols-3 {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 14px;
    }

    .grid-cols-2 {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Stat card lebih ringkas */
    .stat-card {
        padding: 14px 16px;
        gap: 12px;
    }

    .stat-info h2 {
        font-size: 20px;
    }

    /* Card */
    .card {
        padding: 16px;
    }

    /* Tabel: allow horizontal scroll */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }

    .data-table th,
    .data-table td {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* =========================================================
   RESPONSIVE — Mobile kecil (≤ 600px)
   ========================================================= */
@media (max-width: 600px) {

    /* Topbar user info — sembunyikan nama teks, tampilkan avatar saja */
    .topbar-user-info {
        display: none;
    }

    .topbar-role-badge {
        display: none;
    }

    /* Topbar lebih compact */
    .topbar {
        padding: 0 12px;
        height: 60px;
    }

    /* Content body lebih rapat */
    .content-body {
        padding: 12px;
    }

    /* Grid stat: 2 kolom di layar kecil */
    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .grid-cols-3 {
        grid-template-columns: 1fr;
    }

    .grid-cols-2 {
        grid-template-columns: 1fr;
    }

    /* Stat card compact */
    .stat-card {
        padding: 12px;
        flex-direction: row;
        align-items: center;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .stat-info h2 {
        font-size: 18px;
    }

    .stat-info h4 {
        font-size: 12px;
    }

    /* Buttons lebih mudah di-tap */
    .btn {
        padding: 10px 14px;
        font-size: 13px;
        min-height: 40px;
    }

    .btn-sm {
        padding: 8px 12px;
        font-size: 12px;
        min-height: 36px;
    }

    /* Card */
    .card {
        padding: 14px;
        border-radius: var(--radius-sm);
    }

    /* CBT option box — lebih besar untuk touch */
    .option-box {
        padding: 14px 14px;
        gap: 12px;
    }

    /* CBT question nav grid — 5 kolom di mobile kecil */
    .question-nav-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 6px;
    }
}

/* =========================================================
   RESPONSIVE — HP sangat kecil (≤ 380px)
   ========================================================= */
@media (max-width: 380px) {
    .grid-cols-4 {
        grid-template-columns: 1fr 1fr;
    }

    .content-body {
        padding: 10px;
    }

    .card {
        padding: 12px;
    }

    .stat-info h2 {
        font-size: 16px;
    }
}