/**
 * في الخمسينة - Premium Design System
 * Version 3.0 - Exceptional UI/UX Overhaul
 */

/* Import Fonts */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@200;300;400;500;600;700;800&display=swap');

/* ==================== CSS Variables & Design Tokens ==================== */
/* ==================== CSS Variables & Design Tokens ==================== */
:root {
    /* Primary Brand Colors */
    --primary-hue: 250;
    --primary-color: hsl(var(--primary-hue), 80%, 70%);
    /* Light purple for dark mode */
    --primary-dark: hsl(var(--primary-hue), 80%, 60%);
    --primary-light: hsl(var(--primary-hue), 90%, 80%);

    /* Accents */
    --accent-color: #00f2fe;
    --success-color: #00dbde;
    --warning-color: #f6d365;
    --danger-color: #ff5858;

    /* Dark Theme (Forced) */
    --bg-color: #0f172a;
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --surface-color: #1e293b;
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);

    /* Typography (Forced Light) */
    --text-main: #f8fafc;
    --text-secondary: #cbd5e1;
    --font-family: 'Cairo', sans-serif;

    /* Layout */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --header-height: 70px;
    --sidebar-width: 280px;
}

/* Force body styling */
body {
    background: #0f172a !important;
    background-image: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
    color: #f1f5f9 !important;
}

/* Force ALL cards to have dark background */
[data-theme="dark"] .card,
[data-theme="dark"] .card-body,
[data-theme="dark"] .card-header,
[data-theme="dark"] .card-footer {
    background-color: #1e293b !important;
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #f1f5f9 !important;
}

/* Force ALL text to be light */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6,
[data-theme="dark"] .h1,
[data-theme="dark"] .h2,
[data-theme="dark"] .h3,
[data-theme="dark"] .h4,
[data-theme="dark"] .h5,
[data-theme="dark"] .h6 {
    color: #ffffff !important;
}

[data-theme="dark"] p,
[data-theme="dark"] span:not(.badge),
[data-theme="dark"] div:not(.badge),
[data-theme="dark"] label,
[data-theme="dark"] li {
    color: #e2e8f0 !important;
}

/* Force table text visibility */
[data-theme="dark"] table,
[data-theme="dark"] .table,
[data-theme="dark"] .table th,
[data-theme="dark"] .table td,
[data-theme="dark"] .table td *,
[data-theme="dark"] tbody,
[data-theme="dark"] thead {
    color: #ffffff !important;
    background-color: transparent !important;
}

[data-theme="dark"] .table th {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .table td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

/* Links in tables */
[data-theme="dark"] .table a,
[data-theme="dark"] .table-responsive a {
    color: #93c5fd !important;
}

/* Force sidebar styling */
[data-theme="dark"] .admin-sidebar {
    background-color: #1e293b !important;
    background: #1e293b !important;
}

/* Force forms */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background-color: #0f172a !important;
    background: #0f172a !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .form-control::placeholder,
[data-theme="dark"] input::placeholder {
    color: #64748b !important;
}

/* Text utilities */
[data-theme="dark"] .text-muted {
    color: #94a3b8 !important;
}

[data-theme="dark"] .text-dark {
    color: #f1f5f9 !important;
}

[data-theme="dark"] small {
    color: #94a3b8 !important;
}

/* Code blocks */
[data-theme="dark"] code {
    background-color: #334155 !important;
    color: #f472b6 !important;
}

/* ==================== Global Resets & Typography ==================== */
html,
body {
    height: 100%;
    scroll-behavior: smooth;
}

body {
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: var(--font-family);
    line-height: 1.6;
    transition: background 0.5s ease;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.3;
}

/* ==================== Glassmorphism Utilities ==================== */
.glass {
    background: var(--surface-color);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: var(--radius-md);
}

[data-theme="dark"] .glass {
    background: #1e293b !important;
    /* Force solid background in dark mode */
}

.glass-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

/* ==================== Components: Buttons ==================== */
.btn {
    font-family: var(--font-family);
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: 0.6rem 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(var(--primary-hue), 70%, 60%, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(var(--primary-hue), 70%, 60%, 0.5);
}

.btn-success {
    background: linear-gradient(135deg, #42e695 0%, #3bb2b8 100%);
}

.btn-danger {
    background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
}

/* ==================== Components: Cards & Containers ==================== */
.card {
    background: var(--surface-color);
    backdrop-filter: blur(16px);
    border: var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: var(--glass-shadow);
    transition: all 0.3s ease;
    overflow: hidden;
}

[data-theme="dark"] .card {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.1);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.card-header {
    background: rgba(var(--primary-hue), 50%, 50%, 0.1);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.25rem 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

[data-theme="dark"] .card-header {
    background: rgba(0, 0, 0, 0.2);
    border-bottom-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* ==================== Navbar ==================== */
.navbar {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    padding: 0.7rem 0;
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    min-height: var(--header-height);
}

/* Add padding to body to prevent content from being hidden behind fixed navbar */
body {
    padding-top: var(--header-height);
}

[data-theme="dark"] .navbar {
    background: #0f172a !important;
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

/* Ensure navbar contrast in dark mode */
[data-theme="dark"] .navbar-light .navbar-brand,
[data-theme="dark"] .navbar-light span,
[data-theme="dark"] .navbar-light i,
[data-theme="dark"] .navbar-light small,
[data-theme="dark"] .navbar-light .text-dark,
[data-theme="dark"] .navbar-light .text-secondary {
    color: #ffffff !important;
}

[data-theme="dark"] .navbar-light .text-primary {
    color: #818cf8 !important;
    /* Lighter primary for dark mode */
}

[data-theme="dark"] .navbar-light .bg-light {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--primary-color) !important;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .navbar-brand {
    color: #fff !important;
}

/* ==================== Forms & Inputs ==================== */
.form-control,
.form-select {
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    padding: 0.8rem 1rem;
    font-size: 1rem;
    color: var(--text-main);
    transition: all 0.3s ease;
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
}

.form-control:focus,
.form-select:focus {
    background: var(--surface-color);
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 4px rgba(var(--primary-hue), 70%, 60%, 0.1);
    transform: translateY(-1px);
}

[data-theme="dark"] .form-control:focus {
    background: #0f172a;
    border-color: var(--primary-color);
    color: #fff;
}

.form-control::placeholder {
    color: #a0aec0;
    font-weight: 300;
}

/* ==================== Premium Checkboxes & Radio Buttons ==================== */
.form-check {
    padding-right: 2rem;
    padding-left: 0;
    margin-bottom: 0.5rem;
}

.form-check-input {
    width: 1.4rem;
    height: 1.4rem;
    margin-right: -2rem;
    margin-left: 0;
    background-color: rgba(255, 255, 255, 0.9);
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    /* Force standard appearance - fixes Samsung Internet toggle issue */
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    /* Prevent any browser default styling */
    background-image: none;
    flex-shrink: 0;
}

.form-check-input:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.form-check-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
    outline: none;
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
    background-size: 0.9rem;
    background-position: center;
    background-repeat: no-repeat;
    animation: checkbox-pop 0.3s ease;
}

@keyframes checkbox-pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
    }
}

.form-check-input[type="radio"] {
    border-radius: 50% !important;
    /* Force circular shape on all browsers */
    -webkit-border-radius: 50% !important;
}

.form-check-input[type="radio"]:checked {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2.5' fill='%23fff'/%3e%3c/svg%3e");
    background-size: 0.8rem;
}

.form-check-label {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
    padding-right: 0.5rem;
}

.form-check-input:checked+.form-check-label {
    color: var(--primary-color);
    font-weight: 500;
}

/* Dark mode checkboxes - with strong specificity for modals */
[data-theme="dark"] .form-check-input,
[data-theme="dark"] .modal .form-check-input,
[data-theme="dark"] .modal-content .form-check-input {
    background-color: #334155 !important;
    border-color: #64748b !important;
    -webkit-appearance: none;
    appearance: none;
}

[data-theme="dark"] .form-check-input:hover,
[data-theme="dark"] .modal .form-check-input:hover {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2) !important;
}

[data-theme="dark"] .form-check-input:checked,
[data-theme="dark"] .modal .form-check-input:checked,
[data-theme="dark"] .modal-content .form-check-input:checked {
    background-color: #6366f1 !important;
    border-color: #6366f1 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e") !important;
    background-size: 0.9rem !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

[data-theme="dark"] .form-check-label,
[data-theme="dark"] .modal .form-check-label {
    color: #e2e8f0 !important;
}

/* Dark mode modal content */
[data-theme="dark"] .modal-content {
    background-color: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .modal-header {
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .modal-footer {
    border-top-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .modal-title {
    color: #ffffff !important;
}

/* Custom switch toggle */
.form-switch .form-check-input {
    width: 3rem;
    height: 1.5rem;
    border-radius: 1rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%28255,255,255,0.9%29'/%3e%3c/svg%3e");
    background-position: right center;
    background-size: 1rem;
    transition: background-position 0.25s ease;
}

.form-switch .form-check-input:checked {
    background-position: left center;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}

/* ==================== Start Page Specifics ==================== */
.start-exam-card {
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    background: var(--surface-color);
}

[data-theme="dark"] .start-exam-card {
    background: #1e293b !important;
}

.exam-icon i {
    font-size: 5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.detail-item {
    background: rgba(var(--primary-hue), 50%, 50%, 0.05);
    border: 1px solid rgba(var(--primary-hue), 50%, 50%, 0.1);
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-weight: 500;
    color: var(--text-main);
}

/* ==================== Exam Taking Page ==================== */
.question-card {
    border: none;
    background: var(--surface-color);
    margin-bottom: 2rem;
    position: relative;
    overflow: visible;
}

.question-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.3s;
}

.question-card:hover::before {
    opacity: 1;
}

.option-item {
    border: 2px solid rgba(0, 0, 0, 0.05);
    /* Light border default */
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-bottom: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .option-item {
    border-color: rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.1);
}

.option-item:hover {
    background: rgba(var(--primary-hue), 70%, 60%, 0.05);
    border-color: var(--primary-color);
}

.option-item.selected {
    background: linear-gradient(to right, rgba(var(--primary-hue), 70%, 60%, 0.1), transparent);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(var(--primary-hue), 70%, 60%, 0.15);
}

.form-check-input {
    width: 1.25em;
    height: 1.25em;
    cursor: pointer;
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Timer Badge */
.timer-badge {
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
    padding: 0.5rem 1.25rem;
    border-radius: 50px;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 1.2rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.timer-badge.warning {
    background: linear-gradient(135deg, #fce38a 0%, #f38181 100%);
    color: #fff;
    animation: pulse 1.5s infinite;
}

.timer-badge.danger {
    background: linear-gradient(135deg, #ff512f 0%, #dd2476 100%);
    animation: shake 0.5s infinite;
}

/* Progress Bar */
.progress {
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    height: 10px;
    margin: 1.5rem 0;
    overflow: hidden;
}

[data-theme="dark"] .progress {
    background-color: rgba(255, 255, 255, 0.1);
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 20px;
    box-shadow: 0 0 10px rgba(var(--primary-hue), 70%, 60%, 0.5);
}

/* ==================== Tables (Admin & Results) ==================== */
.table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.table th {
    background: rgba(0, 0, 0, 0.02);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 1rem;
    border-bottom: 2px solid rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .table th {
    background: rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.table td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .table td {
    border-bottom-color: rgba(255, 255, 255, 0.05);
    color: #f1f5f9;
}

[data-theme="dark"] .table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* ==================== Admin Dashboard Styles ==================== */
.admin-sidebar {
    background: #fff;
    backdrop-filter: blur(20px);
    border-left: 1px solid #e2e8f0;
    width: var(--sidebar-width);
    position: fixed;
    height: 100vh;
    right: 0;
    top: 0;
    z-index: 1000;
    padding: 2rem 1rem;
    overflow-y: auto;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .admin-sidebar {
    background: #1e293b !important;
    /* Solid dark background */
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-sidebar .nav-link {
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: 0.8rem 1.2rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-sidebar .nav-link:hover {
    background: rgba(var(--primary-hue), 70%, 60%, 0.1);
    color: var(--primary-color);
    transform: translateX(-5px);
}

[data-theme="dark"] .admin-sidebar .nav-link {
    color: #94a3b8;
}

[data-theme="dark"] .admin-sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.admin-sidebar .nav-link.active {
    background: var(--primary-color);
    color: white !important;
    box-shadow: 0 4px 6px -1px rgba(var(--primary-hue), 70%, 60%, 0.4);
}

/* Admin Main Content Offset */
@media (min-width: 992px) {
    .admin-main {
        margin-right: var(--sidebar-width);
        padding: 2rem;
    }
}

/* Stat Cards */
.stat-card {
    border: none;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 150px;
    height: 150px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    z-index: -1;
}

.bg-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

.bg-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%) !important;
}

.bg-info {
    background: linear-gradient(135deg, #00b4db 0%, #0083b0 100%) !important;
}

.bg-warning {
    background: linear-gradient(135deg, #fc4a1a 0%, #f7b733 100%) !important;
}

/* ==================== Result Page Visuals ==================== */
.result-header-section {
    background: radial-gradient(circle at center, rgba(var(--primary-hue), 70%, 60%, 0.15) 0%, transparent 70%);
    padding: 4rem 0;
}

.score-circle {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 800;
    margin: 0 auto;
    background: var(--surface-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 8px solid;
    position: relative;
}

.score-circle.bg-success {
    border-color: #00b894;
    color: #00b894;
    background: var(--surface-color) !important;
}

.score-circle.bg-warning {
    border-color: #fdcb6e;
    color: #fdcb6e;
    background: var(--surface-color) !important;
}

.score-circle.bg-danger {
    border-color: #d63031;
    color: #d63031;
    background: var(--surface-color) !important;
}

/* ==================== Animations ==================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 20px, 0);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.fade-in-up {
    animation: fadeInUp 0.5s ease-out both;
}

/* Stagger animations for list items */
.question-card:nth-child(1) {
    animation-delay: 0.1s;
}

.question-card:nth-child(2) {
    animation-delay: 0.2s;
}

.question-card:nth-child(3) {
    animation-delay: 0.3s;
}

/* ==================== Responsiveness ==================== */
@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(100%);
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    }

    .admin-sidebar.show {
        transform: translateX(0);
    }

    .admin-main {
        margin-right: 0 !important;
    }
}

/* ==================== Utility Classes ==================== */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.shadow-soft {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.rounded-xl {
    border-radius: var(--radius-xl) !important;
}

/* ==================== COMPREHENSIVE DARK MODE FIXES ==================== */

/* Force all text to be light in dark mode */
[data-theme="dark"] body {
    color: #f1f5f9;
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
    color: #ffffff !important;
}

[data-theme="dark"] p,
[data-theme="dark"] span,
[data-theme="dark"] div,
[data-theme="dark"] label {
    color: #e2e8f0;
}

[data-theme="dark"] .text-muted,
[data-theme="dark"] .text-secondary,
[data-theme="dark"] small {
    color: #94a3b8 !important;
}

/* Dark mode cards */
[data-theme="dark"] .card {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .card-body,
[data-theme="dark"] .card-header,
[data-theme="dark"] .card-footer {
    background: transparent !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .card-title,
[data-theme="dark"] .card-header h5,
[data-theme="dark"] .card-header h6 {
    color: #ffffff !important;
}

/* Dark mode forms */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: #0f172a !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .form-control::placeholder {
    color: #64748b !important;
}

[data-theme="dark"] .form-label {
    color: #e2e8f0 !important;
}

[data-theme="dark"] .form-text {
    color: #94a3b8 !important;
}

[data-theme="dark"] .input-group-text {
    background-color: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #94a3b8 !important;
}

/* Dark mode tables */
[data-theme="dark"] .table {
    color: #f1f5f9 !important;
}

[data-theme="dark"] .table th {
    color: #e2e8f0 !important;
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .table td {
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
}

/* Force ALL content inside table cells to be white */
[data-theme="dark"] .table td *,
[data-theme="dark"] .table td a,
[data-theme="dark"] .table td span,
[data-theme="dark"] .table td div,
[data-theme="dark"] .table td strong,
[data-theme="dark"] .table td p {
    color: #ffffff !important;
}

[data-theme="dark"] .table td small,
[data-theme="dark"] .table td .text-muted {
    color: #94a3b8 !important;
}

[data-theme="dark"] .table tbody tr {
    background-color: transparent !important;
}

[data-theme="dark"] .table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

/* Dark mode alerts */
[data-theme="dark"] .alert {
    border: none !important;
}

[data-theme="dark"] .alert-info {
    background-color: rgba(59, 130, 246, 0.2) !important;
    color: #93c5fd !important;
}

[data-theme="dark"] .alert-success {
    background-color: rgba(34, 197, 94, 0.2) !important;
    color: #86efac !important;
}

[data-theme="dark"] .alert-warning {
    background-color: rgba(234, 179, 8, 0.2) !important;
    color: #fde047 !important;
}

[data-theme="dark"] .alert-danger {
    background-color: rgba(239, 68, 68, 0.2) !important;
    color: #fca5a5 !important;
}

/* Dark mode badges */
[data-theme="dark"] .badge.bg-light {
    background-color: #334155 !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .badge.bg-secondary {
    background-color: #475569 !important;
}

/* Dark mode modals */
[data-theme="dark"] .modal-content {
    background-color: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .modal-title {
    color: #ffffff !important;
}

[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Dark mode navbar */
[data-theme="dark"] .navbar {
    background-color: #0f172a !important;
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .navbar-brand {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

/* Dark mode sidebar */
[data-theme="dark"] .admin-sidebar {
    background-color: #1e293b !important;
    border-left-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .admin-sidebar .nav-link {
    color: #94a3b8 !important;
}

[data-theme="dark"] .admin-sidebar .nav-link:hover {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .admin-sidebar .nav-link.active {
    color: #ffffff !important;
    background: var(--primary-color) !important;
}

/* Dark mode admin topbar */
[data-theme="dark"] .admin-topbar {
    background-color: transparent !important;
}

[data-theme="dark"] .admin-topbar h4 {
    color: #ffffff !important;
}

/* Dark mode stat cards */
[data-theme="dark"] .stat-card {
    color: #ffffff !important;
}

[data-theme="dark"] .stat-card h2,
[data-theme="dark"] .stat-card h3,
[data-theme="dark"] .stat-card small {
    color: #ffffff !important;
}

/* Dark mode list groups */
[data-theme="dark"] .list-group-item {
    background-color: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #f1f5f9 !important;
}

/* Dark mode progress bars */
[data-theme="dark"] .progress {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

/* Dark mode dropdowns */
[data-theme="dark"] .dropdown-menu {
    background-color: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .dropdown-item {
    color: #e2e8f0 !important;
}

[data-theme="dark"] .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
}

/* Dark mode footer */
[data-theme="dark"] .footer {
    background-color: transparent !important;
}

[data-theme="dark"] .footer p {
    color: #64748b !important;
}

/* Dark mode specific page elements */
[data-theme="dark"] .start-exam-card {
    background-color: #1e293b !important;
}

[data-theme="dark"] .detail-item {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .exam-meta span {
    color: #cbd5e1 !important;
}

/* Dark mode result page */
[data-theme="dark"] .result-header-section {
    background: radial-gradient(circle at center, rgba(99, 102, 241, 0.15) 0%, transparent 70%) !important;
}

[data-theme="dark"] .score-circle {
    background-color: #1e293b !important;
}

/* Dark mode question cards */
[data-theme="dark"] .question-card {
    background-color: #1e293b !important;
}

[data-theme="dark"] .option-item {
    background-color: rgba(255, 255, 255, 0.03) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .option-item:hover {
    background-color: rgba(99, 102, 241, 0.1) !important;
    border-color: var(--primary-color) !important;
}

/* Dark mode links */
[data-theme="dark"] a:not(.btn):not(.nav-link) {
    color: #93c5fd;
}

[data-theme="dark"] a:not(.btn):not(.nav-link):hover {
    color: #bfdbfe;
}

/* Dark mode code/pre elements */
[data-theme="dark"] code {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #f472b6 !important;
}

[data-theme="dark"] pre {
    background-color: #0f172a !important;
    color: #e2e8f0 !important;
}

/* Ensure buttons have proper contrast */
[data-theme="dark"] .btn-outline-secondary {
    color: #94a3b8 !important;
    border-color: #475569 !important;
}

[data-theme="dark"] .btn-outline-secondary:hover {
    background-color: #475569 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .btn-outline-primary {
    color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

/* Dark mode glass effect enhancement */
[data-theme="dark"] .glass {
    background-color: #1e293b !important;
    backdrop-filter: none !important;
}

/* Force white text on colored backgrounds */
.bg-primary,
.bg-success,
.bg-info,
.bg-warning,
.bg-danger {
    color: #ffffff !important;
}

.bg-primary *,
.bg-success *,
.bg-info *,
.bg-warning *,
.bg-danger * {
    color: #ffffff !important;
}

/* ==================== Mobile Responsive Styles ==================== */

/* Tablets (768px and below) */
@media (max-width: 768px) {

    /* Typography */
    h1,
    .h1 {
        font-size: 1.75rem;
    }

    h2,
    .h2 {
        font-size: 1.5rem;
    }

    h3,
    .h3 {
        font-size: 1.25rem;
    }

    .display-1 {
        font-size: 3rem;
    }

    .display-2 {
        font-size: 2.5rem;
    }

    .display-3 {
        font-size: 2rem;
    }

    .display-4 {
        font-size: 1.75rem;
    }

    /* Navbar */
    .navbar-brand {
        font-size: 1.1rem;
    }

    /* Cards */
    .card {
        border-radius: 12px;
    }

    .card-body {
        padding: 1rem;
    }

    /* Start page */
    .start-exam-card {
        padding: 1.5rem !important;
        margin: 0 0.5rem;
    }

    .exam-icon .display-3 {
        font-size: 2.5rem;
    }

    /* Exam page - Hide header on tablets since info is in navbar */
    .exam-header {
        display: none;
    }

    .question-card {
        border-radius: 12px;
        margin-bottom: 1rem;
    }

    .question-card .card-header {
        padding: 0.75rem 1rem;
    }

    .question-card .card-body {
        padding: 1rem;
    }

    .option-item {
        padding: 0.75rem 1rem;
        margin-bottom: 0.5rem;
    }

    /* Fix radio button alignment on tablets */
    .option-item .form-check-input {
        flex-shrink: 0;
    }

    .option-item label,
    .option-item .form-check-label {
        flex: 1;
    }

    /* Result page */
    .result-main-card {
        padding: 1.5rem !important;
    }

    .score-ring {
        width: 150px;
        height: 150px;
    }

    .score-number {
        font-size: 2rem;
    }

    .grade-emoji {
        font-size: 3.5rem;
    }

    .stat-card-new {
        padding: 1rem;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    /* Share section */
    .share-box {
        padding: 1rem;
    }

    .share-btn {
        width: 40px;
        height: 40px;
    }

    /* Admin sidebar */
    .admin-sidebar {
        width: 280px;
        transform: translateX(100%);
        /* Move right (out of screen) */
        transition: transform 0.3s ease-in-out;
        z-index: 1050;
        /* Ensure high z-index */
    }

    .admin-sidebar.show {
        transform: translateX(0);
        /* Bring back to screen */
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    }

    /* Overlay for sidebar */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        backdrop-filter: blur(2px);
    }

    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }

    .admin-main {
        margin-right: 0 !important;
        width: 100%;
    }

    .admin-content {
        padding: 1rem;
    }

    /* Tables */
    .table-responsive {
        font-size: 0.875rem;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px;
        box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05);
    }

    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
        white-space: nowrap;
        vertical-align: middle;
    }

    /* Buttons */
    .btn-group-sm .btn {
        padding: 0.25rem 0.5rem;
    }

    /* Modals */
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-body {
        padding: 1rem;
    }

    /* Timer badge */
    .timer-badge {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    /* Footer */
    .footer {
        padding: 1.5rem 0;
    }
}

/* Phones (576px and below) */
@media (max-width: 576px) {

    /* Body padding */
    body {
        font-size: 0.95rem;
    }

    /* Container padding */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Typography */
    h1,
    .h1 {
        font-size: 1.5rem;
    }

    h2,
    .h2 {
        font-size: 1.35rem;
    }

    h3,
    .h3 {
        font-size: 1.15rem;
    }

    .display-4 {
        font-size: 1.5rem;
    }

    /* Navbar */
    .navbar {
        padding: 0.5rem 1rem;
    }

    .navbar-brand {
        font-size: 1rem;
    }

    /* Cards - Full width on mobile */
    .card {
        border-radius: 10px;
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }

    /* Start page */
    .start-exam-card {
        padding: 1.25rem !important;
        border-radius: 12px;
    }

    .detail-item {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    /* Form controls */
    .form-control,
    .form-select {
        padding: 0.7rem 0.9rem;
        font-size: 1rem;
    }

    .form-control-lg {
        height: 55px;
        font-size: 1rem;
    }

    /* Buttons */
    .btn {
        padding: 0.5rem 1rem;
    }

    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }

    .action-btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    /* Question cards */
    .question-card {
        margin-left: 0;
        margin-right: 0;
        border-radius: 16px;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    }

    .question-text {
        font-size: 1.15rem;
        line-height: 1.7;
        margin-bottom: 1.5rem;
        font-weight: 600;
    }

    .option-item {
        padding: 1rem;
        min-height: 64px;
        margin-bottom: 0.75rem;
        border-radius: 12px;
    }

    .option-item label,
    .option-item .form-check-label {
        font-size: 1.05rem;
        line-height: 1.5;
        cursor: pointer;
    }

    /* Ensure radio is vertically centered */
    .option-item .form-check-input {
        min-width: 1.4rem;
        min-height: 1.4rem;
    }

    /* Result page */
    .result-hero {
        padding: 1.5rem 0;
    }

    .score-ring {
        width: 130px;
        height: 130px;
    }

    .score-number {
        font-size: 1.75rem;
    }

    .score-center>div:last-child {
        font-size: 0.85rem;
    }

    .grade-emoji {
        font-size: 3rem;
    }

    .grade-text {
        font-size: 1.5rem !important;
    }

    .stat-card-new {
        padding: 0.75rem;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .stat-number {
        font-size: 1.25rem;
    }

    /* Question result cards */
    .question-result-new .card-body {
        padding: 1rem;
    }

    .question-number-badge {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    .answer-box {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    /* Share section */
    .share-box {
        text-align: center;
    }

    .share-box .flex-grow-1 {
        width: 100%;
        margin-bottom: 1rem;
    }

    #shareUrl {
        font-size: 0.75rem;
    }

    /* Admin topbar */
    .admin-topbar {
        padding: 0.75rem 1rem;
    }

    .admin-topbar h4 {
        font-size: 1rem;
    }

    /* Admin sidebar */
    .admin-sidebar {
        width: 100%;
        transform: translateX(100%);
    }

    /* Table adjustments */
    .table-responsive table {
        min-width: 600px;
    }

    /* Progress bar */
    .progress {
        height: 8px;
    }

    /* Badges */
    .badge {
        font-size: 0.75rem;
        padding: 0.35rem 0.5rem;
    }

    /* Alerts */
    .alert {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    /* Instructions list */
    .alert ul {
        padding-right: 1.25rem;
        margin-bottom: 0;
    }

    .alert ul li {
        margin-bottom: 0.25rem;
    }

    /* Checkboxes */
    .form-check {
        padding-right: 1.75rem;
    }

    .form-check-input {
        width: 1.25rem;
        height: 1.25rem;
        margin-right: -1.75rem;
    }

    /* Modals */
    .modal-content {
        border-radius: 12px;
    }

    .modal-header,
    .modal-footer {
        padding: 0.75rem 1rem;
    }

    /* Row spacing adjustments */
    .row.g-3>* {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .row.g-4>* {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* Very small phones (360px and below) */
@media (max-width: 360px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .navbar-brand {
        font-size: 0.9rem;
    }

    .start-exam-card {
        padding: 1rem !important;
    }

    .score-ring {
        width: 110px;
        height: 110px;
    }

    .score-number {
        font-size: 1.5rem;
    }

    .grade-emoji {
        font-size: 2.5rem;
    }
}

/* Landscape orientation adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .result-hero {
        min-height: auto;
        padding: 1rem 0;
    }

    .score-ring {
        width: 100px;
        height: 100px;
    }

    .grade-emoji {
        font-size: 2rem;
    }
}

/* Touch-friendly adjustments */
@media (hover: none) and (pointer: coarse) {

    /* Larger touch targets */
    .btn {
        min-height: 44px;
    }

    .form-check-input {
        min-width: 44px;
        min-height: 44px;
    }

    .option-item {
        min-height: 48px;
    }

    /* Remove hover effects on touch devices */
    .btn:hover {
        transform: none;
    }

    .card:hover {
        transform: none;
    }

    .glass-hover:hover {
        transform: none;
    }
}