@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ========== CSS Variables ========== */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --bg-dark: #070b14;
    --bg-card: #0f172a;
    --bg-input: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #1e293b;

    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 20px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);

    --glass: rgba(15, 23, 42, 0.7);
    --glass-border: rgba(255, 255, 255, 0.05);

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== Base Styles ========== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary);
}

/* ========== Layout ========== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ========== Typography ========== */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.5em;
    color: #fff;
    letter-spacing: -0.02em;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

@media (min-width: 768px) {
    h1 {
        font-size: 3.5rem;
    }
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: var(--secondary);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border-color: #fff;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: white;
}

.icon {
    width: 1.25rem;
    height: 1.25rem;
    vertical-align: middle;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

/* ========== Alerts ========== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 2rem;
    font-size: 0.875rem;
    border: 1px solid transparent;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

/* ========== Badges ========== */
.badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-info {
    background-color: var(--info);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.badge-success {
    background-color: var(--success);
}

.badge-warning {
    background-color: var(--warning);
}

.badge-danger {
    background-color: var(--danger);
}

/* ========== Form Elements ========== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: white;
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    background: var(--bg-card);
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
}

/* ========== Header & Nav ========== */
.main-header {
    background: var(--glass);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    background: linear-gradient(135deg, #fff 0%, var(--primary-light) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
}

/* ========== User Dropdown ========== */
.user-dropdown {
    position: relative;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: var(--transition);
}

.dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    color: white;
    border: 2px solid var(--glass-border);
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-name-desktop {
    display: none;
    font-size: 0.875rem;
}

@media (min-width: 768px) {
    .user-name-desktop {
        display: block;
    }
}

.dropdown-arrow {
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--text-secondary);
    border-bottom: 2px solid var(--text-secondary);
    transform: rotate(45deg);
    margin-top: -4px;
    transition: var(--transition);
}

.user-dropdown.active .dropdown-arrow {
    transform: rotate(-135deg);
    margin-top: 4px;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 240px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
    z-index: 1100;
    overflow: hidden;
}

.user-dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
}

.dropdown-header strong {
    font-size: 0.9375rem;
    color: #fff;
}

.dropdown-header span {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.dropdown-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 0.5rem 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-decoration: none;
    transition: var(--transition);
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.logout-item:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.item-icon {
    font-size: 1rem;
}

/* ========== Hero Section ========== */
.hero {
    padding: 6rem 0 4rem;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.15), transparent 40%),
        radial-gradient(circle at bottom left, rgba(79, 70, 229, 0.1), transparent 40%);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(to top, var(--bg-dark), transparent);
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.hero h1 {
    background: linear-gradient(to bottom, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* ========== Search Bar ========== */
.search-container {
    max-width: 600px;
    margin: -2rem auto 3rem;
    position: relative;
    z-index: 10;
    padding: 0 1rem;
}

.search-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 99px;
    padding: 0.5rem;
    display: flex;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

.search-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
    transform: translateY(-2px);
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    outline: none;
}

.search-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 99px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.search-btn:hover {
    background: var(--primary-dark);
}

/* ========== Main Content ========== */
.main-content {
    padding: 2rem 0 10rem;
    min-height: 50vh;
}

.page-header {
    text-align: center;
    margin-bottom: 3rem;
}

.page-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #fff, var(--text-secondary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ========== Footer ========== */
.main-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 3rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ========== Auth Pages ========== */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.auth-container {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-secondary);
}

.auth-form {
    margin-bottom: 1.5rem;
}

.divider {
    display: flex;
    align-items: center;
    width: 100%;
    margin: 1.5rem 0;
    gap: 1rem;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.divider span {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    white-space: nowrap;
}

.google-btn-container {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 1rem;
}

.google-btn-container>div {
    margin: 0 auto;
}

/* ========== Instructions Modal ========== */
.instructions-modal {
    position: fixed;
    inset: 0;
    background: var(--bg-dark);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* Start from top on mobile */
    z-index: 2000;
    padding: 1.5rem;
    overflow-y: auto;
    /* Enable scroll on the overlay */
}

.instructions-modal-content {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    padding: 2.5rem 1.5rem;
    /* Adjusted padding */
    box-shadow: var(--shadow-lg);
    margin: auto;
    /* Centers when content is small */
    position: relative;
}

@media (max-width: 640px) {
    .instructions-modal {
        padding: 1rem;
    }

    .instructions-modal-content {
        padding: 1.5rem 1rem;
        border-radius: var(--radius);
        margin: 1rem auto;
        /* Ensure gap at top/bottom */
    }

    .instruction-body h2 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
}

.instructions-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.5rem;
}

.lang-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.lang-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Language Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-input);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.instruction-body {
    display: none;
}

.instruction-body.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.instruction-body h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.precautions-list {
    list-style: none;
    margin-bottom: 2rem;
}

.precautions-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.precautions-list li strong {
    color: #fff;
}

.final-note {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.instructions-footer {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.auth-footer {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ========== Quiz Cards ========== */
.quiz-grid {
    display: grid;
    gap: 2rem;
    margin-bottom: 4rem;
}

@media (min-width: 640px) {
    .quiz-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .quiz-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.quiz-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.quiz-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.6), 0 18px 36px -18px rgba(0, 0, 0, 0.6);
}

.quiz-card-header {
    padding: 1.75rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), transparent);
    border-bottom: 1px solid var(--glass-border);
    position: relative;
}

.quiz-card-header h3 {
    font-size: 1.25rem;
    margin: 0;
    color: #fff;
    line-height: 1.4;
}

.quiz-status-badge {
    position: absolute;
    top: 0.3rem;
    right: 1rem;
}

.quiz-card-body {
    padding: 1.75rem;
    flex: 1;
}

.quiz-card-body p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 2rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8em;
}

.quiz-meta {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.quiz-meta li {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.meta-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.meta-value {
    font-size: 0.875rem;
    font-weight: 700;
    color: #f8fafc;
}

.quiz-card-footer {
    padding: 1.5rem 1.75rem;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid var(--glass-border);
}

.btn-quiz-start {
    padding: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-size: 0.8125rem;
    border-radius: var(--radius);
}

/* ========== Quiz Details Page ========== */
.quiz-details-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    overflow: hidden;
    margin-bottom: 2rem;
}

.details-header {
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), transparent);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.details-header h1 {
    font-size: 1.5rem;
    margin: 0;
    font-weight: 700;
}

.schedule-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border-radius: 99px;
    font-size: 0.875rem;
    font-weight: 600;
}

.details-grid {
    display: grid;
    gap: 2rem;
    padding: 1.5rem 2rem;
}

@media (min-width: 992px) {
    .details-grid {
        grid-template-columns: 1fr 320px;
    }
}

.details-info h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--primary-light);
}

.description {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    font-size: 0.9375rem;
}

.rules-section {
    background: rgba(255, 255, 255, 0.02);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--glass-border);
}

.rules-list {
    list-style: none;
    margin-top: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.rules-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.5;
}

.rules-list li strong {
    color: var(--text-primary);
    min-width: 100px;
    display: inline-block;
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .rules-list li {
        flex-direction: column;
        gap: 0.25rem;
    }

    .rules-list li strong {
        min-width: auto;
    }
}

.status-card {
    background: var(--bg-input);
    padding: 1.5rem;
    border-radius: var(--radius);
    position: sticky;
    top: 6rem;
    border: 1px solid var(--glass-border);
}

.status-alert {
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Mobile Adjustments for Quiz Details */
@media (max-width: 768px) {
    .details-header {
        padding: 1.25rem 1.5rem;
    }

    .details-header h1 {
        font-size: 1.25rem;
    }

    .details-grid {
        padding: 1.25rem;
        gap: 1.5rem;
        display: flex;
        flex-direction: column-reverse;
    }

    .status-card {
        padding: 1.25rem;
        position: static;
    }

    .details-info h3 {
        font-size: 1.125rem;
    }
}

.status-alert.warning {
    background: rgba(245, 158, 11, 0.1);
    color: #fcd34d;
}

.status-alert.danger {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
}

.status-alert.success {
    background: rgba(16, 185, 129, 0.1);
    color: #6ee7b7;
}

.countdown {
    margin-top: 0.75rem;
    font-weight: 700;
    font-family: monospace;
    font-size: 1.25rem;
}

.time-window {
    margin-top: 1.5rem;
    text-align: center;
    color: var(--text-muted);
}

/* ========== Empty State ========== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-card);
    border-radius: var(--radius);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* ========== Quiz Page ========== */
.quiz-page {
    background: var(--bg-dark);
}

.quiz-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.quiz-header-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 768px) {
    .quiz-header-content {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.quiz-header h1 {
    font-size: 1.25rem;
    margin: 0;
}

.quiz-meta-inline {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.meta-item .icon {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

.meta-item span {
    color: var(--text-primary);
}

.timer-item.warning {
    color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

.timer-item.warning span {
    color: var(--warning);
}

.timer-item.critical {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.15);
    animation: urgent-pulse 1s infinite;
}

.timer-item.critical span {
    color: var(--danger);
}

@keyframes urgent-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.quiz-main {
    padding: 2rem 0;
}

/* ========== Quiz Progress Bar & Steps ========== */
.question-progress-container {
    margin-bottom: 2rem;
}

.progress-bar-bg {
    height: 6px;
    background: var(--bg-input);
    border-radius: 99px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-light), var(--primary));
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.question-steps {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.step-indicator {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.step-indicator:hover {
    border-color: var(--primary-light);
    color: var(--text-primary);
}

.step-indicator.current {
    background: var(--bg-dark);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.step-indicator.answered {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

/* ========== Quiz Controls ========== */
/* ========== Quiz Footer Fixed ========== */
.quiz-footer-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--glass-border);
    padding: 1rem 0;
    z-index: 900;
    box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.3);
}

.footer-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-btns {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.quiz-main {
    padding: 2rem 0 6rem;
    /* Extra bottom padding for fixed footer */
}

.question-indicators-grid {
    display: flex;
    gap: 0.5rem;
}

.questions-container {
    max-width: 800px;
    margin: 0 auto 2rem;
}

.question-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.question-number {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.question-text {
    font-size: 1.125rem;
    margin-bottom: 1.5rem;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.125rem 1.5rem;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.option-item:hover {
    border-color: var(--primary-light);
    background: var(--bg-dark);
}

.option-item.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}

.option-item input[type="radio"] {
    margin: 0;
}

.option-marker {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    flex-shrink: 0;
    transition: var(--transition);
}

.option-item.selected .option-marker {
    border-color: var(--primary);
    background: var(--primary);
}

.option-text {
    flex: 1;
}

/* ========== Quiz Navigation ========== */
.quiz-navigation {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

.question-indicators {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.indicator {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.indicator:hover {
    border-color: var(--primary);
}

.indicator.answered {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* ========== Warning Modal ========== */
.warning-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    overflow-y: auto;
}

.warning-modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    border: 2px solid var(--warning);
    margin: auto;
}

.warning-icon {
    width: 60px;
    height: 60px;
    background: var(--warning);
    color: #1a1a1a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    margin: 0 auto 1rem;
}

.warning-modal h2 {
    color: var(--warning);
    margin-bottom: 1rem;
}

.warning-counter {
    color: var(--text-muted);
    margin: 1rem 0;
}

/* ========== Auto-submit Notice ========== */
.auto-submit-notice {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.notice-content {
    text-align: center;
    color: var(--warning);
    font-size: 1.25rem;
}

/* ========== Results Page ========== */
.results-header {
    text-align: center;
    margin-bottom: 2rem;
}

.results-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

@media (max-width: 768px) {
    .results-header h1 {
        font-size: 1.25rem;
    }
}

.subtitle {
    color: var(--text-secondary);
}

.results-summary {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    display: grid;
    gap: 2rem;
    text-align: center;
}

@media (min-width: 768px) {
    .results-summary {
        grid-template-columns: auto 1fr;
        text-align: left;
    }
}

.score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.results-summary.passed .score-circle {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
}

.results-summary.failed .score-circle {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: white;
}

.score-label {
    font-size: 1.125rem;
    font-weight: 600;
}

.results-summary.passed .score-label {
    color: var(--success);
}

.results-summary.failed .score-label {
    color: var(--danger);
}

.results-stats {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.75rem;
}

.stat-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.stat-row .stat-label {
    color: var(--text-muted);
    min-width: 120px;
}

.stat-row.warning {
    color: var(--warning);
}

.status-auto_submitted {
    color: var(--warning);
}

/* ========== Integrity Notice ========== */
.integrity-notice {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.integrity-notice h3 {
    color: var(--warning);
    margin-bottom: 0.5rem;
}

.integrity-notice ul {
    list-style: none;
    color: var(--text-secondary);
}

/* ========== Answers Review ========== */
.answers-review {
    margin-bottom: 2rem;
}

.answers-review h2 {
    margin-bottom: 1.5rem;
}

.answer-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    overflow: hidden;
}

.answer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--bg-input);
}

.question-num {
    font-weight: 600;
    font-size: 0.875rem;
}

.answer-status {
    font-size: 0.75rem;
    font-weight: 600;
}

.answer-card.correct .answer-status {
    color: var(--success);
}

.answer-card.incorrect .answer-status {
    color: var(--danger);
}

.answer-body {
    padding: 1.25rem;
}

.answer-body .question-text {
    margin-bottom: 1rem;
    font-size: 1rem;
}

.answer-details p {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.correct-answer {
    color: var(--success);
}

.results-actions {
    text-align: center;
}

/* ========== Tables ========== */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background: var(--bg-input);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.table td {
    font-size: 0.875rem;
}

.table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.row-suspicious {
    background: rgba(239, 68, 68, 0.1) !important;
}

.row-warning {
    background: rgba(245, 158, 11, 0.1) !important;
}

.row-incorrect {
    background: rgba(239, 68, 68, 0.05);
}

/* ========== Ended Quiz Results & Leaderboard ========== */
.ended-quiz-results {
    animation: fadeIn 0.5s ease;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 992px) {
    .results-grid {
        grid-template-columns: 1fr 1.5fr;
    }
}

.glass-card {
    background: var(--glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    height: 100%;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: #fff;
}

.section-title .icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius);
    border: 1px solid var(--glass-border);
    transition: var(--transition);
}

.leaderboard-item:hover {
    transform: translateX(5px);
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary-light);
}

.rank-badge {
    width: 40px;
    height: 40px;
    background: var(--bg-input);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.rank-1 .rank-badge {
    background: linear-gradient(135deg, #ffd700, #b8860b);
    color: #000;
}

.rank-2 .rank-badge {
    background: linear-gradient(135deg, #c0c0c0, #708090);
    color: #000;
}

.rank-3 .rank-badge {
    background: linear-gradient(135deg, #cd7f32, #8b4513);
    color: #000;
}

.user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    color: #fff;
    font-size: 1rem;
}

.attempt-meta {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.rank-score {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary-light);
}

.attempts-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.attempt-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .attempt-card {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.attempt-card.passed {
    border-left: 4px solid var(--success);
}

.attempt-card.failed {
    border-left: 4px solid var(--danger);
}

.attempt-main {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.attempt-stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}

.attempt-stats .percentage {
    font-size: 1.75rem;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

.status-pill {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 99px;
    margin-top: 0.5rem;
}

.status-pill.completed {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.status-pill.auto_submitted {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.status-pill.blocked {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.attempt-details {
    display: flex;
    flex-direction: column;
}

.attempt-details .date {
    font-weight: 600;
    color: var(--text-primary);
}

.attempt-details .time {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.attempt-actions {
    display: flex;
    gap: 0.75rem;
}

@media (max-width: 639px) {
    .attempt-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .attempt-actions .btn {
        width: 100%;
        padding: 0.5rem 0.25rem;
        font-size: 0.7rem;
    }
}

.btn-success {
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: white;
}

.btn-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.empty-msg {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-style: italic;
}