/* --- portal.css --- */
/* =========================================================================
   Student Portal - Practice Page Styles
   ========================================================================= */
.option-item {
    padding: 0.5rem 0.8rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.35rem;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.option-item:hover {
    border-color: var(--primary-color);
    background: #F8FAFC;
}

.option-item.correct {
    border-color: #10B981 !important;
    background: #D1FAE5 !important;
}

.option-item.incorrect {
    border-color: #EF4444 !important;
    background: #FEE2E2 !important;
}

.question-text img {
    max-width: 100%;
    height: auto;
}

.practice-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.practice-stats .correct {
    color: #10B981;
}

.practice-stats .incorrect {
    color: #EF4444;
}

/* =========================================================================
   Student Portal - Exam Interface Styles
   ========================================================================= */
.exam-layout .option-item {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.exam-layout .option-item p {
    display: inline;
    margin: 0;
}

.nav-bubble {
    cursor: pointer;
    transition: 0.2s;
}

.nav-bubble:hover {
    transform: scale(1.1);
}

.nav-bubble.answered {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Disable clicking options directly on desktop, force OMR use */
@media (min-width: 769px) {
    .options-list .option-item {
        pointer-events: none;
    }

    .options-list .option-item.selected {
        background-color: transparent !important;
        border-color: var(--border-color) !important;
        font-weight: normal !important;
    }
}

/* Enable clicking options on mobile/tablets */
@media (max-width: 768px) {
    .options-list .option-item {
        pointer-events: auto;
    }

    .option-item.selected {
        background: #E0E7FF;
        border-color: var(--primary-color);
    }
}

.exam-body {
    background: white;
    margin: 0;
    padding: 1rem;
    height: 100vh;
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@media (max-width: 768px) {
    .exam-body {
        height: auto;
        overflow: visible;
        display: block;
        padding-top: 50px;
    }

    .exam-body header {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 200;
        padding: 0.5rem !important;
        margin-bottom: 0 !important;
        font-size: 1rem !important;
        background: white;
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
        border-top: none !important;
    }

    #omr-container,
    .navigation-panel h3 {
        display: none !important;
    }

    .question-panel {
        max-height: none !important;
        padding: 0.5rem !important;
    }

    .navigation-panel {
        max-height: none !important;
        position: sticky;
        bottom: 0;
        background: var(--bg-color);
        z-index: 100;
        padding: 0.25rem;
        box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.05);
    }

    .navigation-panel>div:nth-of-type(1) {
        padding: 0 !important;
        margin-bottom: 0.25rem !important;
        font-size: 0.65rem !important;
    }

    .navigation-panel>div:nth-of-type(1) strong {
        font-size: 0.8rem !important;
    }

    .navigation-panel>div:nth-of-type(3) {
        margin-top: 0 !important;
    }

    .navigation-panel button {
        padding: 0.4rem !important;
        font-size: 0.8rem !important;
    }

    .options-list {
        gap: 0.25rem !important;
    }

    .options-list .option-item {
        padding: 0.4rem 0.5rem !important;
        font-size: 0.9rem !important;
    }

    .question-text {
        margin-bottom: 0.5rem !important;
        font-size: 1rem !important;
    }

    hr {
        margin: 0.5rem 0 !important;
    }
}

/* =========================================================================
   Student Portal - Result Interface Styles
   ========================================================================= */
.result-item {
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    background: var(--surface-color);
}

.correct-opt {
    background-color: #D1FAE5;
    /* Emerald 100 */
    border-color: #10B981;
    /* Emerald 500 */
}

.wrong-opt {
    background-color: #FEE2E2;
    /* Red 100 */
    border-color: #EF4444;
    /* Red 500 */
}

.missed-opt {
    background-color: #F3F4F6;
    /* Gray 100 */
}

.option-btn {
    color: var(--text-main);
}

.option-btn:hover:not(:disabled) {
    background-color: var(--bg-color) !important;
    border-color: var(--primary-color) !important;
}


/* --- style.css --- */
/* Professional Premium CSS for Online Exam Portal */
:root {
    --primary-color: #1e3a8a;
    /* Deep Navy Blue */
    --primary-hover: #1e40af;
    --secondary-color: #10B981;
    /* Emerald Green */
    --secondary-hover: #059669;
    --bg-color: #f8fafc;
    /* Sleek Slate 50 */
    --surface-color: #FFFFFF;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

    --success-color: #10B981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
}

[data-theme="dark"] {
    --bg-color: #0b0f19;
    --surface-color: #161f30;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #2e3c54;
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .login-body {
    background: linear-gradient(135deg, #0f172a 0%, #020617 100%) !important;
}

/* Switch Styles for Theme Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .3s;
    border-radius: 20px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked+.switch-slider {
    background-color: var(--primary-color);
}

input:checked+.switch-slider:before {
    transform: translateX(18px);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.4;
    font-size: 14px;
}

/* --- Login Page --- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #e0e7ff 0%, #f3f4f6 100%);
}

.login-container {
    background: var(--surface-color);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    animation: fadeUp 0.5s ease-out;
}

.login-title {
    font-size: 1.875rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.input-group input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    transition: var(--transition);
}

.input-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
}

.forgot-link,
.register-link {
    color: var(--primary-color);
    font-size: 0.875rem;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.forgot-link:hover,
.register-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.glass-panel {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-lg);
}

.register-prompt {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted);
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Layouts --- */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background-color: var(--surface-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
    color: var(--primary-color);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.nav-item {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.nav-item:hover,
.nav-item.active {
    background-color: #EEF2FF;
    color: var(--primary-color);
    border-right: 3px solid var(--primary-color);
}

.main-content {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.page-header {
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

/* --- Exam Interface (Matching Wireframe) --- */
.exam-layout {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 1.5rem;
}

.exam-header {
    background: var(--surface-color);
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.question-panel {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    border: 2px solid var(--text-main);
    /* Match wireframe bold borders */
    padding: 1rem;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.question-text {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-item {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.option-item:hover {
    background-color: #F9FAFB;
    border-color: var(--primary-color);
}

.option-item.selected {
    background-color: #EEF2FF;
    border-color: var(--primary-color);
    font-weight: 600;
}

.scroll-bar-indicator {
    position: absolute;
    right: 1rem;
    top: 2rem;
    bottom: 2rem;
    width: 10px;
    background: #E5E7EB;
    border-radius: 10px;
    border: 2px solid var(--text-main);
}

.scroll-thumb {
    width: 100%;
    height: 50px;
    background: var(--text-main);
    border-radius: 10px;
}

.navigation-panel {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    border: 2px solid var(--text-main);
    /* Match wireframe bold borders */
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
    text-align: center;
}

.grid-header {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.nav-bubble {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin: 0 auto;
}

.nav-bubble.answered {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.nav-bubble.current {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3);
}

.nav-row-number {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Rich Text Editor Overrides */
.ql-toolbar {
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
    background: #f9fafb;
}

.ql-container {
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-size: 1rem;
    height: 200px;
}

/* --- Search Inputs & Badges --- */
.search-input {
    width: 100%;
    max-width: 400px;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border: 1px solid var(--border-color);
    border-radius: 2rem;
    font-size: 0.875rem;
    outline: none;
    transition: var(--transition);
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="%236B7280"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/></svg>') no-repeat 0.75rem center;
    background-size: 1.25rem;
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-primary {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

/* Data Table Hover */
tbody tr {
    transition: var(--transition);
}

tbody tr:hover {
    background-color: #f8fafc;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        height: auto;
    }

    .main-content {
        padding: 1rem;
    }

    .exam-layout {
        display: flex;
        flex-direction: column;
    }

    .question-panel {
        order: 1;
        /* Questions first */
        height: auto;
        max-height: 50vh;
        /* Allow scrolling questions */
    }

    .navigation-panel {
        order: 2;
        /* OMR sheet below */
        height: auto;
        max-height: 40vh;
        margin-top: 1rem;
    }

    body {
        /* Remove overflow hidden on mobile for body, let sections handle it */
        overflow-y: auto !important;
        height: auto !important;
    }
}

/* Compact Tables */
th,
td {
    padding: 0.75rem !important;
}

/* --- Toast Notifications --- */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 9999;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.toast {
    min-width: 250px;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    background: var(--surface-color);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 1rem;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid var(--border-color);
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left-color: var(--secondary-color);
}

.toast.error {
    border-left-color: #EF4444;
}

.toast.info {
    border-left-color: var(--primary-color);
}


.option-item p {
    display: inline;
    margin: 0;
}



/* Dark Mode Overrides */
[data-theme="dark"] .option-item:hover {
    background: #1e293b;
}

[data-theme="dark"] .option-item.correct {
    border-color: #10B981 !important;
    background: rgba(16, 185, 129, 0.2) !important;
}

[data-theme="dark"] .option-item.incorrect {
    border-color: #EF4444 !important;
    background: rgba(239, 68, 68, 0.2) !important;
}

[data-theme="dark"] .exam-body,
[data-theme="dark"] .exam-body header {
    background: var(--bg-color) !important;
}

[data-theme="dark"] .option-item.selected {
    background: rgba(99, 102, 241, 0.2) !important;
    border-color: var(--primary-color) !important;
}

[data-theme="dark"] .correct-opt {
    background-color: rgba(16, 185, 129, 0.15) !important;
    border-color: #10B981 !important;
}

[data-theme="dark"] .wrong-opt {
    background-color: rgba(239, 68, 68, 0.15) !important;
    border-color: #EF4444 !important;
}

[data-theme="dark"] .missed-opt {
    background-color: rgba(148, 163, 184, 0.1) !important;
}

[data-theme="dark"] .nav-item:hover,
[data-theme="dark"] .nav-item.active {
    background-color: rgba(99, 102, 241, 0.1);
}

[data-theme="dark"] tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .badge-primary {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

[data-theme="dark"] .badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

[data-theme="dark"] .badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

[data-theme="dark"] .badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}
/* Math spacing fix */
.ql-formula { margin: 0 !important; }
.math-rendered { display: inline-block; margin: 0 !important; }
.katex-display { margin: 0 !important; }
.ql-editor p { margin-bottom: 0.2em; }

/* Anti-Leak Protection */
@media print {
    body.anti-leak-protection,
    html.anti-leak-protection {
        display: none !important;
    }
}
body.anti-leak-protection {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}
#anti-ss-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: black;
    color: white;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    z-index: 999999;
}
body.anti-leak-protection::before {
    content: "CONFIDENTIAL";
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999998;
    pointer-events: none;
    opacity: 0.05;
    font-size: 5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotate(-45deg);
    user-select: none;
    white-space: pre-wrap;
    text-align: center;
}

.result-header-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
}
.result-score-section {
    text-align: center;
    border-right: 1px solid var(--border-color);
    padding-right: 2rem;
}
.result-details-section {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding-left: 1rem;
}
@media (max-width: 768px) {
    .result-header-grid {
        grid-template-columns: 1fr;
    }
    .result-score-section {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-right: 0;
        padding-bottom: 2rem;
    }
    .result-details-section {
        padding-left: 0;
        text-align: center;
    }
}
