/* Practice Exam Styling */
:root {
    --mlpurple: #3333B2;
    --mllavender: #ADADE0;
    --mlblue: #0066CC;
    --text-dark: #2C3E50;
    --bg-light: #F8F9FA;
    --success: #2CA02C;
    --warning: #FF7F0E;
    --danger: #D62728;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-light) 0%, #E8E9F3 100%);
    color: var(--text-dark);
    line-height: 1.6;
    padding: 20px;
}

.exam-container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(51, 51, 178, 0.15);
    overflow: hidden;
}

/* Header */
.exam-header {
    background: linear-gradient(135deg, var(--mlpurple) 0%, var(--mllavender) 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.exam-header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.exam-header p {
    opacity: 0.95;
    font-size: 1.1rem;
}

/* Timer and Progress */
.exam-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: var(--bg-light);
    border-bottom: 2px solid var(--mllavender);
    flex-wrap: wrap;
    gap: 15px;
}
/* Fallback for older browsers */
.exam-controls > * + * {
    margin-left: 15px;
}

.timer {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--mlpurple);
    display: flex;
    align-items: center;
    gap: 10px;
}
/* Fallback for older browsers */
.timer > * + * {
    margin-left: 10px;
}

.timer.warning {
    color: var(--warning);
    animation: pulse 1s infinite;
}

.timer.danger {
    color: var(--danger);
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.progress-info {
    display: flex;
    align-items: center;
    gap: 15px;
}
/* Fallback for older browsers */
.progress-info > * + * {
    margin-left: 15px;
}

.progress-bar {
    width: 200px;
    height: 8px;
    background: #E0E0E0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--mlpurple), var(--mllavender));
    transition: width 0.3s ease;
}

.controls-buttons {
    display: flex;
    gap: 10px;
}
/* Fallback for older browsers */
.controls-buttons > * + * {
    margin-left: 10px;
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-primary {
    background: var(--mlpurple);
    color: white;
}

.btn-primary:hover {
    background: #2828A0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(51, 51, 178, 0.3);
}

.btn-secondary {
    background: var(--mllavender);
    color: var(--mlpurple);
}

.btn-secondary:hover {
    background: #9D9DD0;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #248024;
}

/* Question Area */
.question-area {
    padding: 30px;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--bg-light);
}

.question-number {
    font-size: 1.2rem;
    color: var(--mlpurple);
    font-weight: bold;
}

.difficulty-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.difficulty-easy {
    background: #E8F5E9;
    color: var(--success);
}

.difficulty-medium {
    background: #FFF3E0;
    color: var(--warning);
}

.difficulty-hard {
    background: #FFEBEE;
    color: var(--danger);
}

.question-text {
    font-size: 1.2rem;
    margin-bottom: 25px;
    line-height: 1.8;
    color: var(--text-dark);
}

.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
/* Fallback for older browsers */
.options > * + * {
    margin-top: 12px;
}

.option {
    padding: 15px 20px;
    border: 2px solid #E0E0E0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}
/* Fallback for older browsers */
.option > * + * {
    margin-left: 12px;
}

.option:hover {
    border-color: var(--mllavender);
    background: #F8F9FA;
}

.option.selected {
    border-color: var(--mlpurple);
    background: #F0F0F8;
}

.option.correct {
    border-color: var(--success);
    background: #E8F5E9;
}

.option.incorrect {
    border-color: var(--danger);
    background: #FFEBEE;
}

.option-label {
    font-weight: bold;
    color: var(--mlpurple);
    min-width: 30px;
}

.option-text {
    flex: 1;
}

.flag-btn {
    padding: 8px 15px;
    background: transparent;
    border: 2px solid var(--warning);
    color: var(--warning);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.flag-btn.flagged {
    background: var(--warning);
    color: white;
}

/* Navigation */
.question-navigation {
    padding: 20px 30px;
    border-top: 2px solid var(--bg-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-buttons {
    display: flex;
    gap: 10px;
}
/* Fallback for older browsers */
.nav-buttons > * + * {
    margin-left: 10px;
}

/* Question Grid */
.question-grid {
    padding: 30px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 10px;
    background: var(--bg-light);
}

.question-grid-item {
    padding: 12px;
    text-align: center;
    border: 2px solid #CCC;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    background: white;
}

.question-grid-item:hover {
    border-color: var(--mlpurple);
    transform: scale(1.05);
}

.question-grid-item.answered {
    background: var(--mllavender);
    color: white;
    border-color: var(--mlpurple);
}

.question-grid-item.flagged {
    background: var(--warning);
    color: white;
    border-color: var(--warning);
}

.question-grid-item.current {
    background: var(--mlpurple);
    color: white;
    border-color: var(--mlpurple);
    box-shadow: 0 0 0 3px rgba(51, 51, 178, 0.3);
}

/* Results */
.results-container {
    padding: 40px;
}

.score-display {
    text-align: center;
    padding: 40px;
    background: linear-gradient(135deg, var(--mlpurple) 0%, var(--mllavender) 100%);
    color: white;
    border-radius: 12px;
    margin-bottom: 30px;
}

.score-display h2 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.score-percentage {
    font-size: 4rem;
    font-weight: bold;
    margin: 20px 0;
}

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

.breakdown-item {
    padding: 20px;
    background: var(--bg-light);
    border-radius: 8px;
    text-align: center;
}

.breakdown-item h3 {
    color: var(--mlpurple);
    margin-bottom: 10px;
}

.breakdown-item .value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-dark);
}

.topic-breakdown {
    margin-top: 30px;
}

.topic-breakdown h3 {
    color: var(--mlpurple);
    margin-bottom: 15px;
}

.topic-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--bg-light);
    border-radius: 8px;
    margin-bottom: 10px;
}

.topic-bar {
    flex: 1;
    height: 20px;
    background: #E0E0E0;
    border-radius: 10px;
    margin: 0 15px;
    overflow: hidden;
}

.topic-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--mlpurple), var(--mllavender));
    transition: width 0.5s ease;
}

/* Review Mode */
.explanation {
    margin-top: 20px;
    padding: 20px;
    background: var(--bg-light);
    border-left: 4px solid var(--mlpurple);
    border-radius: 6px;
}

.explanation h4 {
    color: var(--mlpurple);
    margin-bottom: 10px;
}

/* Welcome Screen */
.welcome-screen {
    padding: 40px;
    text-align: center;
}

.welcome-screen h2 {
    color: var(--mlpurple);
    font-size: 2rem;
    margin-bottom: 20px;
}

.welcome-screen .instructions {
    text-align: left;
    max-width: 600px;
    margin: 30px auto;
    padding: 25px;
    background: var(--bg-light);
    border-radius: 8px;
}

.welcome-screen .instructions h3 {
    color: var(--mlpurple);
    margin-bottom: 15px;
}

.welcome-screen .instructions ul {
    margin-left: 20px;
    line-height: 2;
}

.welcome-screen .instructions li {
    margin-bottom: 10px;
}

.start-exam-btn {
    margin-top: 30px;
    padding: 15px 40px;
    font-size: 1.2rem;
}

/* Responsive */
@media (max-width: 768px) {
    .exam-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .timer {
        justify-content: center;
    }

    .progress-info {
        flex-direction: column;
        width: 100%;
    }

    .progress-bar {
        width: 100%;
    }

    .controls-buttons {
        width: 100%;
        justify-content: center;
    }

    .question-navigation {
        flex-direction: column;
        gap: 15px;
    }
    .question-navigation > * + * {
        margin-top: 15px;
    }

    .nav-buttons {
        width: 100%;
        justify-content: space-between;
    }

    .question-grid {
        grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    }

    .score-breakdown {
        grid-template-columns: 1fr;
    }
}

/* Accessibility: Focus indicators */
button:focus-visible,
.option:focus-visible,
.nav-btn:focus-visible,
.question-btn:focus-visible,
.start-exam-btn:focus-visible {
    outline: 2px solid #3333B2;
    outline-offset: 2px;
}

.option:focus {
    outline: 2px solid #3333B2;
    outline-offset: 2px;
}

/* Hidden utility class */
.hidden {
    display: none !important;
}
