/* EduTest CBT - High Contrast Royal Blue & Indigo CBT Theme */
:root {
    --cbt-navy: #1243d6;
    --cbt-navy-dark: #172554;
    --cbt-indigo: #3927b4;
    --cbt-blue: #1a56db;
    --cbt-blue-hover: #1444b8;
    --cbt-gold: #facc15;
    --cbt-sky: #eef4ff;
    --cbt-gray-bg: #f1f5f9;
    --cbt-border: #cbd5e1;
    --cbt-text: #0f172a;
    --cbt-text-secondary: #334155;
}

html,
body {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    background-color: var(--cbt-gray-bg);
    color: var(--cbt-text);
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
}

/* Override Bootstrap low-contrast muted/faded text so all text is crisp and readable */
.text-muted,
.text-secondary {
    color: #334155 !important;
}

.cbt-royal-navbar .text-white-50,
.cbt-login-card-header .text-white-50,
.cbt-sidebar .text-white-50,
.cbt-exam-header .text-white-50 {
    color: #e0e7ff !important;
    font-weight: 500;
}

/* Ensure code tags on dark headers are bright and readable */
.cbt-exam-header code {
    color: #fef08a !important;
    background: rgba(15, 23, 42, 0.35);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

/* Ensure badges have strong contrast */
.badge.bg-info {
    background-color: #dbeafe !important;
    color: #1e3a8a !important;
    border: 1px solid #93c5fd;
    font-weight: 700;
}

.badge.bg-info-subtle {
    background-color: #e0f2fe !important;
    color: #0c4a6e !important;
    border: 1px solid #7dd3fc !important;
    font-weight: 600;
}

.badge.bg-secondary-subtle {
    background-color: #e2e8f0 !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
    font-weight: 600;
}

.badge.bg-success-subtle {
    background-color: #dcfce7 !important;
    color: #14532d !important;
    border: 1px solid #86efac !important;
    font-weight: 700;
}

.badge.bg-warning-subtle {
    background-color: #fef3c7 !important;
    color: #78350f !important;
    border: 1px solid #fcd34d !important;
    font-weight: 700;
}

.badge.bg-danger-subtle {
    background-color: #fee2e2 !important;
    color: #7f1d1d !important;
    border: 1px solid #fca5a5 !important;
    font-weight: 700;
}

/* Top Navbar (Login & Student Portal) */
.cbt-royal-navbar {
    background: linear-gradient(90deg, #1040c8 0%, #1d4ed8 100%);
    color: #ffffff;
    padding: 0.9rem 0;
    box-shadow: 0 2px 10px rgba(18, 67, 214, 0.22);
}

.cbt-brand-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: var(--cbt-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.65rem;
    flex-shrink: 0;
}

.cbt-brand-title {
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.cbt-brand-subtitle {
    font-size: 0.85rem;
    font-weight: 500;
}

.btn-nav-outline {
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.55);
    color: #ffffff !important;
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 600;
    padding: 0.45rem 0.95rem;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-nav-outline:hover {
    background: #ffffff;
    border-color: #ffffff;
    color: #1040c8 !important;
}

/* Centered Login Card (Matching Screenshot with High Contrast) */
.cbt-login-card {
    width: 100%;
    max-width: 420px;
    border: 1px solid #dbe3f0;
    border-radius: 18px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.1);
}

.cbt-login-card-header {
    background: linear-gradient(135deg, #0f43d6 0%, #3b27b8 100%);
    color: #ffffff;
    text-align: center;
    padding: 2rem 1.5rem 1.75rem;
}

.cbt-login-card-header h5 {
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.cbt-login-avatar {
    width: 56px;
    height: 56px;
    margin: 0 auto 0.85rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: var(--cbt-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.65rem;
}

.cbt-form-label {
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #0f172a;
    margin-bottom: 0.45rem;
}

.cbt-input-group {
    border: 1.5px solid #94a3b8;
    border-radius: 10px;
    background: #ffffff;
    display: flex;
    align-items: center;
    padding: 0.2rem 0.75rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cbt-input-group:focus-within {
    border-color: var(--cbt-navy);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(18, 67, 214, 0.18);
}

.cbt-input-group .input-icon {
    color: #475569;
    font-size: 1.05rem;
    margin-right: 0.6rem;
}

.cbt-input-group input {
    border: none;
    background: transparent;
    box-shadow: none !important;
    font-size: 0.92rem;
    font-weight: 500;
    padding: 0.55rem 0.25rem;
    width: 100%;
    color: #0f172a;
}

.cbt-input-group input::placeholder {
    color: #64748b;
    opacity: 1;
}

.cbt-input-group input:focus {
    outline: none;
}

.btn-royal-submit {
    background: linear-gradient(90deg, #1049de 0%, #1d58e8 100%);
    border: none;
    color: #ffffff !important;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(16, 73, 222, 0.3);
    transition: transform 0.1s ease, background 0.15s ease;
}

.btn-royal-submit:hover {
    background: linear-gradient(90deg, #0b37b3 0%, #1342ba 100%);
    color: #ffffff !important;
}

/* Sidebar Admin - Floating (Melayang) di Desktop & Mobile */
.cbt-admin-wrapper {
    display: block;
    min-height: 100vh;
    width: 100%;
    position: relative;
}

.cbt-main-content {
    margin-left: 300px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.cbt-sidebar {
    position: fixed;
    top: 12px;
    left: 12px;
    bottom: 12px;
    width: 276px;
    height: auto;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    padding: 1rem;
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(10px);
    color: #0f172a !important;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid #cbd5e1;
    border-radius: 18px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    z-index: 1050;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.28s ease;
}

.cbt-sidebar-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-right: 2px;
}

.cbt-sidebar-body::-webkit-scrollbar {
    width: 5px;
}

.cbt-sidebar-body::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 10px;
}

body.sidebar-collapsed .cbt-sidebar {
    transform: translateX(calc(-100% - 24px));
    box-shadow: none;
}

.cbt-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(3px);
    z-index: 1045;
}

.cbt-sidebar .cbt-brand-icon {
    background: linear-gradient(135deg, #1040c8 0%, #3b27b8 100%);
    border: none;
    color: var(--cbt-gold);
    width: 44px;
    height: 44px;
    font-size: 1.45rem;
}

.cbt-sidebar .nav-link {
    color: #0f172a !important;
    padding: 0.6rem 0.9rem;
    border-radius: 0.55rem;
    margin-bottom: 0.2rem;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    white-space: normal;
    line-height: 1.3;
}

.cbt-sidebar .nav-link i {
    color: #1243d6;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.cbt-sidebar .nav-link:hover {
    background-color: #eef4ff;
    color: #1040c8 !important;
}

.cbt-sidebar .nav-link.active {
    background: linear-gradient(90deg, #1040c8 0%, #1d58e8 100%);
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 3px 10px rgba(16, 64, 200, 0.22);
}

.cbt-sidebar .nav-link.active i {
    color: #ffffff;
}

.cbt-topbar {
    background: #ffffff;
    border-bottom: 1px solid var(--cbt-border);
    padding: 0.75rem 1.25rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.btn-sidebar-toggle {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #0f172a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease;
}

.btn-sidebar-toggle:hover {
    background: #eef4ff;
    color: #1040c8;
    border-color: #93c5fd;
}

.card-stat {
    border: 1px solid #e2e8f0;
    border-radius: 0.85rem;
    background: #ffffff;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
    border-left: 5px solid var(--cbt-navy);
}

.card-stat.sky {
    border-left-color: #2563eb;
}

.card-stat.success {
    border-left-color: #16a34a;
}

.card-stat.warning {
    border-left-color: #d97706;
}

.btn-navy {
    background: linear-gradient(90deg, #1243d6 0%, #1d58e8 100%);
    border-color: #1243d6;
    color: #ffffff !important;
    font-weight: 600;
}

.btn-navy:hover {
    background: linear-gradient(90deg, #0e35b0 0%, #1646c4 100%);
    border-color: #0e35b0;
    color: #ffffff !important;
}

/* Table Header & Content Contrast */
.table {
    color: #0f172a;
}

/* Enlarge small filter selects/inputs in Admin Content area for better visibility */
.cbt-main-content form[method="GET"] .form-select-sm,
.cbt-main-content form[method="GET"] .form-control-sm {
    font-size: 0.95rem;
    padding: 0.45rem 0.85rem;
    min-height: 41px;
    border-radius: 0.5rem;
}

.cbt-main-content form[method="GET"] .btn-sm {
    font-size: 0.94rem;
    padding: 0.45rem 0.95rem;
    min-height: 41px;
    border-radius: 0.5rem;
    font-weight: 600;
}

.table thead.table-light th {
    background-color: #e2e8f0 !important;
    color: #0f172a !important;
    font-weight: 700;
    border-bottom: 2px solid #cbd5e1;
}

/* CBT Student Exam Room Header */
.cbt-exam-header {
    background: linear-gradient(90deg, #1040c8 0%, #2b28a8 100%);
    color: #ffffff;
    padding: 0.75rem 1.25rem;
    box-shadow: 0 2px 12px rgba(16, 64, 200, 0.2);
}

.cbt-timer-badge {
    background: #091538;
    border: 1.5px solid #93c5fd;
    color: #ffffff;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    padding: 0.35rem 0.95rem;
    border-radius: 0.55rem;
    letter-spacing: 1px;
}

.cbt-timer-badge.warning {
    background: #b91c1c;
    border-color: #fecaca;
    color: #ffffff;
}

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

.q-nav-btn {
    height: 44px;
    font-weight: 700;
    border-radius: 0.5rem;
    border: 2px solid #94a3b8;
    background: #ffffff;
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
}

.q-nav-btn.active {
    border-color: var(--cbt-navy);
    background-color: #dbeafe;
    color: #1e3a8a;
    box-shadow: 0 0 0 3px rgba(18, 67, 214, 0.28);
}

.q-nav-btn.answered {
    background-color: #15803d;
    border-color: #14532d;
    color: #ffffff;
}

.q-nav-btn.doubtful {
    background-color: #d97706;
    border-color: #92400e;
    color: #ffffff;
}

.stimulus-box {
    background-color: #f8fafc;
    color: #0f172a;
    border: 1px solid #94a3b8;
    border-left: 5px solid var(--cbt-navy);
    border-radius: 0.55rem;
    padding: 1.15rem;
    max-height: 420px;
    overflow-y: auto;
}

.option-card {
    border: 2px solid #cbd5e1;
    border-radius: 0.65rem;
    padding: 0.9rem 1.05rem;
    margin-bottom: 0.65rem;
    cursor: pointer;
    background: #ffffff;
    color: #0f172a;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}

.option-card:hover {
    border-color: #3b82f6;
    background-color: #f8fafc;
}

.option-card.selected {
    border-color: var(--cbt-navy);
    background-color: #dbeafe;
    color: #0f172a;
    font-weight: 600;
}

.disclaimer-banner {
    background-color: #dbeafe;
    border: 1px solid #93c5fd;
    color: #1e3a8a;
    font-size: 0.88rem;
}

.cbt-exam-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.65rem;
}

@media (max-width: 991.98px) {
    .cbt-main-content {
        margin-left: 0 !important;
    }

    body.sidebar-mobile-open {
        overflow: hidden;
    }

    .cbt-sidebar {
        position: fixed;
        top: 10px;
        left: 10px;
        bottom: 10px;
        height: auto;
        max-height: calc(100vh - 20px);
        max-height: calc(100dvh - 20px);
        width: min(290px, calc(100vw - 24px));
        border-radius: 18px;
        transform: translateX(calc(-100% - 24px));
        box-shadow: none;
    }

    body.sidebar-mobile-open .cbt-sidebar {
        transform: translateX(0);
        box-shadow: 0 20px 45px rgba(15, 23, 42, 0.28);
    }

    body.sidebar-mobile-open .cbt-sidebar-backdrop {
        display: block;
    }
}

@media (max-width: 767.98px) {
    .cbt-exam-header {
        padding: 0.65rem 0.5rem;
    }

    .cbt-exam-header-actions {
        width: 100%;
        padding-top: 0.35rem;
        border-top: 1px solid rgba(255, 255, 255, 0.18);
    }

    .cbt-timer-badge {
        font-size: 1rem;
        padding: 0.25rem 0.65rem;
    }

    #saveStatusBadge {
        font-size: 0.75rem;
        padding: 0.35rem 0.6rem !important;
    }

    .stimulus-box {
        padding: 0.85rem;
        max-height: 320px;
        font-size: 0.95rem;
    }

    .option-card {
        padding: 0.75rem 0.85rem;
        gap: 0.65rem;
    }

    .cbt-exam-footer {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.6rem;
    }

    .cbt-exam-footer .cbt-nav-doubt {
        grid-column: 1 / -1;
        order: -1;
        width: 100%;
    }

    .cbt-exam-footer .cbt-nav-prev,
    .cbt-exam-footer .cbt-nav-next {
        width: 100%;
    }
}
