:root {
    --primary: #2454ff;
    --primary-dark: #1a3fc4;
    --bg-soft: #f4f6fb;
}

body {
    background: var(--bg-soft);
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2454ff 0%, #12c2e9 100%);
}

.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,.2);
    max-width: 400px;
    width: 100%;
    padding: 2.5rem 2rem;
}

.login-card .logo-circle {
    width: 72px; height: 72px;
    border-radius: 18px;
    background: #ffffff;
    color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1.2rem auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    overflow: hidden;
    padding: 6px;
}

.login-card .logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.app-brand-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 6px;
    background: #ffffff;
    padding: 2px;
    display: inline-block;
    vertical-align: middle;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.password-toggle {
    cursor: pointer;
    user-select: none;
}

.sidebar {
    min-height: 100vh;
    background: #10182f;
    color: #cfd8f0;
    width: 250px;
    transition: all 0.3s ease;
}

.sidebar a {
    color: #b4c2e6;
    text-decoration: none;
    display: block;
    padding: .65rem 1.1rem;
    border-radius: 8px;
    margin: 2px 10px;
    font-size: 0.93rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar a:hover {
    background: rgba(36, 84, 255, 0.2);
    color: #ffffff;
}

.sidebar a.active {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

.sidebar-category-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #64748b;
    padding: 0.6rem 1.2rem 0.2rem 1.2rem;
    margin-top: 0.4rem;
    user-select: none;
}

.sidebar-toggle {
    cursor: pointer;
}

.sidebar-toggle.parent-active {
    color: #ffffff;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-toggle .dropdown-arrow {
    font-size: 0.75rem;
    transition: transform 0.25s ease;
}

.sidebar-toggle[aria-expanded="true"] .dropdown-arrow {
    transform: rotate(180deg);
}

.sidebar-submenu {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    margin: 2px 10px 6px 10px;
    padding: 4px 0;
    border-left: 3px solid var(--primary);
}

.sidebar-submenu a {
    margin: 2px 6px;
    padding: 0.45rem 0.85rem;
    font-size: 0.86rem;
    color: #9cb1e0;
}

.sidebar-submenu a:hover {
    background: rgba(36, 84, 255, 0.3);
    color: #fff;
}

.sidebar-submenu a.active {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1) !important;
}

.sidebar .brand {
    padding: 1.1rem 1rem 0.9rem 1rem;
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.1);
    margin-bottom: .5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 6px;
}

.sidebar .brand .brand-logo-wrap {
    width: 42px;
    height: 42px;
    background: #ffffff;
    border-radius: 10px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    transition: transform 0.2s ease;
}

.sidebar .brand .brand-logo-wrap:hover {
    transform: scale(1.05);
}

.sidebar .brand .brand-logo-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sidebar .brand .brand-title {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #ffffff;
    line-height: 1.2;
}

.sidebar .brand .brand-subtitle {
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.main-content {
    flex: 1;
    padding: 1.8rem;
}

.card-stat {
    border: none;
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(0,0,0,.06);
}

.token-display {
    font-size: 2.5rem;
    letter-spacing: .5rem;
    font-weight: 700;
    color: var(--primary);
}

.exam-timer {
    font-size: 1.4rem;
    font-weight: 700;
    color: #d9363e;
}

.option-btn {
    text-align: left;
    border-radius: 10px;
    padding: .8rem 1rem;
}

.soal-nav-btn {
    width: 42px; height: 42px;
    border-radius: 8px;
}

.warning-banner {
    background: #fff3cd;
    border: 1px solid #ffe08a;
    color: #7a5b00;
    border-radius: 10px;
    padding: .8rem 1rem;
}

/* ==========================================
   STYLING RESPONSIF (HANDPHONE & TABLET)
   ========================================== */
@media (max-width: 768px) {
    .login-card {
        padding: 1.5rem 1.25rem;
        border-radius: 14px;
        margin: 0.5rem auto;
    }
    .token-display {
        font-size: 2rem;
        letter-spacing: .35rem;
    }
    .main-content {
        padding: 1rem 0.75rem;
    }
    .sidebar {
        width: 100%;
        min-height: auto;
    }
}

@media (max-width: 576px) {
    .login-wrapper {
        padding: 1rem 0.5rem;
    }
    .login-card {
        padding: 1.25rem 1rem;
    }
}

/* ==========================================
   STYLING KHUSUS CETAK / PRINT KE PDF
   ========================================== */
@media print {
    .sidebar, 
    nav.sidebar, 
    nav.navbar, 
    .btn, 
    form, 
    .d-print-none,
    .badge.bg-success {
        display: none !important;
    }
    body {
        background: #ffffff !important;
        color: #000000 !important;
        font-size: 10pt;
    }
    .main-content {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }
    .card {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    .table {
        font-size: 9.5pt;
        border-color: #333 !important;
    }
    .table-light {
        background-color: #f0f0f0 !important;
    }
}

/* ==========================================
   DUKUNGAN TULISAN ARAB, AL-QUR'AN & HURUF KANJI/CJK
   ========================================== */
@import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400&family=Noto+Sans+JP:wght@400;600;700&display=swap');

.font-arabic, .text-arabic {
    font-family: 'Amiri', 'Traditional Arabic', 'Scheherazade New', 'Noto Naskh Arabic', 'Simplified Arabic', 'Segoe UI', serif;
    font-size: 1.28rem;
    line-height: 2.3;
    unicode-bidi: isolate;
}

.font-kanji, .text-cjk {
    font-family: 'Noto Sans JP', 'Meiryo', 'Yu Gothic', 'Hiragino Kaku Gothic ProN', 'Microsoft YaHei', 'PingFang SC', 'Malgun Gothic', sans-serif;
    font-size: 1.05rem;
    line-height: 1.8;
}

[dir="auto"] {
    unicode-bidi: plaintext;
}

/* ==========================================
   FITUR NOTIFIKASI & SOUND ALERT PUSAT CHAT
   ========================================== */
.chat-bell-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    color: #475569;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.chat-bell-btn:hover {
    background-color: #f8fafc;
    color: #0284c7;
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

.chat-bell-shake {
    animation: chatBellShake 0.8s ease-in-out infinite alternate;
}

@keyframes chatBellShake {
    0% { transform: rotate(0deg); }
    20% { transform: rotate(15deg); }
    40% { transform: rotate(-15deg); }
    60% { transform: rotate(10deg); }
    80% { transform: rotate(-10deg); }
    100% { transform: rotate(0deg); }
}

.chat-unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.22em 0.5em;
    min-width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    border: 2px solid #ffffff;
    animation: pulseBadge 1.8s infinite;
}

@keyframes pulseBadge {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Highlight bernapas untuk pesan baru masuk */
.chat-bubble-highlight {
    animation: chatBubbleGlow 2.5s ease-out forwards;
}

@keyframes chatBubbleGlow {
    0% {
        box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.5), 0 4px 12px rgba(13, 110, 253, 0.25);
        transform: scale(1.01);
    }
    50% {
        box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.3), 0 2px 8px rgba(13, 110, 253, 0.15);
    }
    100% {
        box-shadow: none;
        transform: scale(1);
    }
}

/* Floating pill scroll pesan baru di chat */
.chat-scroll-pill {
    position: absolute;
    bottom: 75px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: #0f172a;
    color: #ffffff;
    padding: 6px 16px;
    border-radius: 9999px;
    font-size: 0.82rem;
    font-weight: 600;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.chat-scroll-pill:hover {
    background: #1e293b;
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

/* Sound Wave animation for Sound Testing */
.sound-wave-active i {
    animation: soundWavePulse 0.4s ease-in-out infinite alternate;
}

@keyframes soundWavePulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.3); color: #f59e0b !important; }
}

/* ==========================================================================
   STYLING SOAL: TABEL, EQUATION (MATEMATIKA), SIMBOL & KIMIA
   ========================================================================== */

/* 1. Styling Tabel Soal Responsif */
.table-soal {
    width: auto !important;
    max-width: 100% !important;
    margin: 12px auto !important;
    border-collapse: collapse !important;
    font-size: 0.95rem;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px;
    overflow: hidden;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.table-soal th {
    background-color: #f1f5f9 !important;
    color: #1e293b !important;
    font-weight: 700;
    padding: 8px 16px !important;
    border: 1px solid #cbd5e1 !important;
    text-align: center;
    vertical-align: middle;
}

.table-soal td {
    padding: 7px 14px !important;
    border: 1px solid #e2e8f0 !important;
    vertical-align: middle;
    color: #334155;
}

.table-soal tr:nth-child(even) td {
    background-color: #f8fafc;
}

.table-soal tr:hover td {
    background-color: #f1f5f9;
}

.soal-pertanyaan-teks .table-responsive,
.card-body .table-responsive {
    margin: 10px 0;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* 2. Styling Superscript & Subscript (Bentuk Kuadrat, Pangkat, Rumus Kimia) */
sup {
    font-size: 0.76em !important;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
    top: -0.55em;
    font-weight: inherit;
}

sub {
    font-size: 0.76em !important;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
    bottom: -0.3em;
    font-weight: inherit;
}

/* 3. KaTeX Math Equation Tweaks */
.katex-display {
    margin: 0.6em 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 4px 0 !important;
    max-width: 100%;
}

.katex {
    font-size: 1.08em;
    text-rendering: auto;
}

.option-btn .katex {
    font-size: 1.05em;
    vertical-align: middle;
}

.option-btn.btn-primary .katex,
.option-btn.btn-primary .katex * {
    color: #ffffff !important;
}

.soal-pertanyaan-teks .katex {
    font-size: 1.1em;
}

/* 4. Native CSS Math Fallback (Pecahan, Bentuk Akar) */
.cbt-frac {
    display: inline-flex;
    flex-direction: column;
    vertical-align: middle;
    text-align: center;
    font-size: 0.9em;
    padding: 0 3px;
    line-height: 1.1;
}

.cbt-frac .cbt-num {
    border-bottom: 1.5px solid currentColor;
    padding: 0 2px 1px 2px;
}

.cbt-frac .cbt-den {
    padding: 1px 2px 0 2px;
}

.cbt-rad {
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
}

.cbt-rad-body {
    border-top: 1.5px solid currentColor;
    padding: 0 3px;
    margin-left: 1px;
}

/* 5. Formula Kimia & Simbol */
.cbt-chem {
    font-family: 'Segoe UI', Roboto, -apple-system, sans-serif;
    letter-spacing: 0.2px;
}

.cbt-chem-arrow {
    display: inline-block;
    padding: 0 4px;
    font-weight: bold;
}


