/* Premium CSS Variables - Light Theme */
:root {
    --primary: #5624d0;
    --primary-light: #cec0fc;
    --primary-gradient: linear-gradient(135deg, #5624d0 0%, #7e3ff2 100%);
    --accent: #a435f0;
    --accent-gradient: linear-gradient(135deg, #a435f0 0%, #c34cff 100%);
    --background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(255, 255, 255, 0.5);
    --card-border-strong: rgba(255, 255, 255, 0.8);
    --card-shadow: rgba(0, 0, 0, 0.1);
    --text-primary: #1c1d1f;
    --text-secondary: #6a6f73;
    --success: #0ca678;
    --warning: #f59f00;
    --danger: #fa5252;
    --glow: rgba(86, 36, 208, 0.15);
    --backdrop-overlay-1: rgba(174, 136, 255, 0.15);
    --backdrop-overlay-2: rgba(206, 192, 252, 0.2);
    --timer-bg: rgba(255, 255, 255, 0.8);
    --quiz-container-bg: rgba(255, 255, 255, 0.6);
    --progress-bg: rgba(255, 255, 255, 0.5);
    --nav-dot-bg: rgba(255, 255, 255, 0.7);
    --option-bg: rgba(255, 255, 255, 0.6);
    --option-hover-bg: rgba(255, 255, 255, 0.8);
    --stat-item-bg: rgba(255, 255, 255, 0.6);
    --prev-btn-bg: rgba(255, 255, 255, 0.7);
    --prev-btn-hover-bg: rgba(255, 255, 255, 0.9);
    --modal-bg: rgba(255, 255, 255, 0.8);
    --modal-btn-secondary-bg: rgba(255, 255, 255, 0.7);
    --modal-btn-secondary-hover-bg: rgba(255, 255, 255, 0.9);
    --warning-bg: rgba(255, 249, 219, 0.7);
    --border-top: rgba(255, 255, 255, 0.5);
}

/* Dark Theme Variables */
[data-theme="dark"] {
    --primary: #7c3aed;
    --primary-light: #a78bfa;
    --primary-gradient: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%);
    --accent: #c084fc;
    --accent-gradient: linear-gradient(135deg, #c084fc 0%, #d946ef 100%);
    --background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 100%);
    --card-bg: rgba(30, 30, 50, 0.7);
    --card-border: rgba(60, 60, 80, 0.5);
    --card-border-strong: rgba(80, 80, 100, 0.8);
    --card-shadow: rgba(0, 0, 0, 0.4);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --success: #10b981;
    --warning: #fbbf24;
    --danger: #ef4444;
    --glow: rgba(124, 58, 237, 0.25);
    --backdrop-overlay-1: rgba(124, 58, 237, 0.15);
    --backdrop-overlay-2: rgba(167, 139, 250, 0.1);
    --timer-bg: rgba(30, 30, 50, 0.8);
    --quiz-container-bg: rgba(30, 30, 50, 0.6);
    --progress-bg: rgba(40, 40, 60, 0.5);
    --nav-dot-bg: rgba(40, 40, 60, 0.7);
    --option-bg: rgba(40, 40, 60, 0.6);
    --option-hover-bg: rgba(50, 50, 70, 0.8);
    --stat-item-bg: rgba(40, 40, 60, 0.6);
    --prev-btn-bg: rgba(40, 40, 60, 0.7);
    --prev-btn-hover-bg: rgba(50, 50, 70, 0.9);
    --modal-bg: rgba(30, 30, 50, 0.9);
    --modal-btn-secondary-bg: rgba(40, 40, 60, 0.7);
    --modal-btn-secondary-hover-bg: rgba(50, 50, 70, 0.9);
    --warning-bg: rgba(59, 45, 15, 0.7);
    --border-top: rgba(60, 60, 80, 0.5);
}


/* Global Styles */
body {
    font-family: 'Segoe UI', 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    position: relative;
    transition: background 0.3s ease, color 0.3s ease;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100vh;
    background: 
        radial-gradient(circle at 20% 30%, var(--backdrop-overlay-1) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, var(--backdrop-overlay-2) 0%, transparent 40%);
    pointer-events: none;
    z-index: -1;
    transition: background 0.3s ease;
}

/* Timer */
.timer {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--timer-bg);
    backdrop-filter: blur(12px);
    padding: 12px 18px;
    border-radius: 12px;
    font-weight: 600;
    color: var(--primary);
    box-shadow: 0 4px 20px var(--card-shadow);
    z-index: 100;
    border: 1px solid var(--card-border-strong);
    transition: all 0.3s ease;
}

/* Quiz Container */
.quiz-container {
    max-width: 800px;
    margin: 60px auto 30px;
    background: var(--quiz-container-bg);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 
        0 15px 35px var(--card-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    border: 1px solid var(--card-border-strong);
    transition: all 0.3s ease;
}

[data-theme="dark"] .quiz-container {
    box-shadow: 
        0 15px 35px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(124, 58, 237, 0.1),
        0 0 0 1px rgba(124, 58, 237, 0.1);
}

/* Quiz Header */
.quiz-header {
    text-align: center;
    margin-bottom: 30px;
}

.quiz-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 10px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: color 0.3s ease;
}

.quiz-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 25px;
    transition: color 0.3s ease;
}

/* Progress Bar */
.progress-container {
    width: 100%;
    height: 12px;
    background: var(--progress-bg);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    transition: all 0.3s ease;
}

.progress-bar {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 10px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
}

/* Question Navigator Dots */
.question-navigator {
    margin: 20px 0;
}

.nav-dots {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.nav-dot {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--nav-dot-bg);
    border: 1px solid var(--card-border-strong);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px var(--card-shadow);
    color: var(--text-primary);
}

.nav-dot:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--glow);
    border-color: var(--primary-light);
}

.nav-dot.current {
    background: var(--primary-gradient);
    color: white;
    border-color: var(--primary);
    transform: scale(1.1);
    box-shadow: 0 4px 15px var(--glow);
}

.nav-dot.answered {
    background: var(--primary-light);
    border-color: var(--primary);
    box-shadow: 0 2px 8px var(--glow);
    color: var(--primary);
}

[data-theme="dark"] .nav-dot.answered {
    color: var(--text-primary);
}

/* Question Container */
.question-container {
    display: none;
    margin-bottom: 30px;
}

.question-container.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

.question-number {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.3s ease;
}

.question-text {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 25px;
    line-height: 1.5;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

/* Options */
.option {
    display: block;
    padding: 15px 20px;
    margin-bottom: 12px;
    background: var(--option-bg);
    border: 1px solid var(--card-border-strong);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    backdrop-filter: blur(5px);
    color: var(--text-primary);
}

.option:hover {
    background: var(--option-hover-bg);
    transform: translateX(5px);
    border-color: var(--primary-light);
    box-shadow: 0 4px 12px var(--card-shadow);
}

.option.selected {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
    box-shadow: 0 4px 15px var(--glow);
}

[data-theme="dark"] .option.selected {
    color: var(--text-primary);
}

.option input[type="radio"] {
    margin-right: 12px;
    transform: scale(1.2);
}

/* Quiz Summary */
.quiz-summary {
    display: none;
    text-align: center;
}

.quiz-summary.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

.quiz-summary h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.quiz-summary p {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-item {
    background: var(--stat-item-bg);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--card-border-strong);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px var(--card-shadow);
    transition: all 0.3s ease;
}

.stat-number {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 5px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Navigation */
.navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-top);
    transition: border-color 0.3s ease;
}

.nav-btn {
    padding: 12px 25px;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-btn:not(:disabled):hover {
    transform: translateY(-2px);
}

.nav-btn i {
    margin-right: 8px;
}

#prevBtn {
    background: var(--prev-btn-bg);
    color: var(--text-primary);
    border: 1px solid var(--card-border-strong);
}

#prevBtn:hover:not(:disabled) {
    background: var(--prev-btn-hover-bg);
    box-shadow: 0 4px 15px var(--card-shadow);
}

.nav-btn.next {
    background: var(--primary-gradient);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.nav-btn.next:hover:not(:disabled) {
    background: var(--accent-gradient);
    box-shadow: 0 4px 20px var(--glow);
}

[data-theme="dark"] .nav-btn.next:hover:not(:disabled) {
    box-shadow: 0 4px 20px rgba(192, 132, 252, 0.4);
}

.nav-btn.submit {
    background: var(--success);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.nav-btn.submit:hover:not(:disabled) {
    background: #0dbd83;
    box-shadow: 0 4px 20px rgba(12, 166, 120, 0.4);
}

#questionInfo {
    font-weight: 600;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

/* Submit Button */
.submit-btn {
    padding: 15px 30px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(12, 166, 120, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.submit-btn:hover:not(:disabled) {
    background: #0dbd83;
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(12, 166, 120, 0.5);
}

.submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

[data-theme="dark"] .submit-btn:disabled {
    background: #555;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

[data-theme="dark"] .modal-overlay {
    background: rgba(0, 0, 0, 0.7);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--modal-bg);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    border: 1px solid var(--card-border-strong);
    transform: translateY(20px);
    transition: all 0.3s ease;
}

[data-theme="dark"] .modal {
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(124, 58, 237, 0.1),
        0 0 0 1px rgba(124, 58, 237, 0.1);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.modal-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 15px;
    font-size: 1.2rem;
    backdrop-filter: blur(5px);
    border: 1px solid var(--card-border);
    transition: all 0.3s ease;
}

.modal-icon.warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    transition: color 0.3s ease;
}

.modal-body {
    margin-bottom: 25px;
    font-size: 1.1rem;
    line-height: 1.5;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-size: 1rem;
    backdrop-filter: blur(5px);
}

.modal-btn-secondary {
    background: var(--modal-btn-secondary-bg);
    color: var(--text-primary);
    border: 1px solid var(--card-border-strong);
}

.modal-btn-secondary:hover {
    background: var(--modal-btn-secondary-hover-bg);
    box-shadow: 0 4px 12px var(--card-shadow);
}

.modal-btn-primary {
    background: var(--primary-gradient);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.modal-btn-primary:hover {
    background: var(--accent-gradient);
    box-shadow: 0 4px 15px var(--glow);
}

[data-theme="dark"] .modal-btn-primary:hover {
    box-shadow: 0 4px 15px rgba(192, 132, 252, 0.3);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .quiz-container {
        padding: 20px;
        margin: 50px auto 20px;
    }
    
    .quiz-header h1 {
        font-size: 2rem;
    }
    
    .question-text {
        font-size: 1.1rem;
    }
    
    .option {
        padding: 12px 15px;
        font-size: 1rem;
    }
    
    .navigation {
        flex-direction: column;
        gap: 15px;
    }
    
    .summary-stats {
        grid-template-columns: 1fr 1fr;
    }
    
    .nav-dots {
        gap: 5px;
    }
    
    .nav-dot {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
    
    .timer {
        top: 10px;
        right: 10px;
        font-size: 0.9rem;
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .quiz-header h1 {
        font-size: 1.8rem;
    }
    
    .summary-stats {
        grid-template-columns: 1fr;
    }
    
    .stat-item {
        padding: 15px;
    }
    
    .stat-number {
        font-size: 1.8rem;
    }
    
    .modal {
        padding: 20px;
    }
    
    .modal-title {
        font-size: 1.3rem;
    }
    
    .modal-body {
        font-size: 1rem;
    }
}

/* Modal z-index fix - add this to the end of quize-styles.css */
.modal-overlay {
    z-index: 99999 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
}

.modal {
    z-index: 100000 !important;
    position: relative !important;
}

/* Ensure other elements don't interfere */
.theme-toggle-container {
    z-index: 10 !important;
}

header {
    z-index: 50 !important;
    position: relative !important;
}

.timer {
    z-index: 100 !important;
}

/* Debugging styles - remove after fixing */
.modal-overlay.active {
    background: rgba(15, 15, 35, 0.4) !important;
    backdrop-filter: blur(15px) !important;
}

.modal-overlay.active .modal {
    background: var(--card-bg) !important;
    border: 1px solid var(--card-border) !important;
    border-radius: 20px !important;
    min-height: 200px !important;
    display: block !important;
    backdrop-filter: blur(15px) !important;
    box-shadow: 
        0 20px 50px var(--card-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.7) !important;
    position: relative !important;
    overflow: hidden !important;
}

.modal-overlay.active .modal::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid transparent;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, rgba(240, 240, 240, 0.6) 100%);
    z-index: -1;
}