/* ==================== Quiz Main ==================== */
.quiz-main {
    min-height: calc(100vh - 80px);
    padding: 2rem 0;
    background: var(--bg-secondary);
}

/* ==================== Screen Management ==================== */
.screen {
    display: none !important;
}

.screen.active {
    display: block !important;
}

/* ==================== Loading Screen ==================== */
#loading-screen.active {
    display: flex !important;
    min-height: 60vh;
    align-items: center;
    justify-content: center;
}

.loading-content {
    text-align: center;
}

.loader {
    width: 80px;
    height: 80px;
    border: 6px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 2rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-content h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.loading-content p {
    color: var(--text-secondary);
}

/* ==================== Quiz Screen Layout ==================== */
#quiz-screen {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    align-items: start;
}

#quiz-screen .quiz-content {
    grid-column: 1;
    grid-row: 1;
}

#quiz-screen .quiz-sidebar {
    grid-column: 2;
    grid-row: 1;
}

/* ==================== Quiz Sidebar ==================== */
.quiz-sidebar {
    position: sticky;
    top: 100px;
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.quiz-progress {
    text-align: center;
    margin-bottom: 2rem;
}

.quiz-progress h3 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.progress-circle {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto;
}

.progress-circle svg {
    transform: rotate(-90deg);
}

.progress-bg {
    fill: none;
    stroke: var(--bg-tertiary);
    stroke-width: 8;
}

.progress-bar {
    fill: none;
    stroke: url(#gradient);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 0.5s ease;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.divider {
    font-size: 1.5rem;
    color: var(--text-light);
}

/* ==================== Quiz Stats ==================== */
.quiz-stats {
    display: grid;
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.stat-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.25rem;
    font-weight: 700;
}

.stat-box:first-child .stat-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.stat-box:last-child .stat-icon {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ==================== Difficulty Legend ==================== */
.difficulty-legend {
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.difficulty-legend h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.legend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

/* ==================== Quiz Content ==================== */
.quiz-content {
    background: white;
    border-radius: var(--radius-lg);
    padding: 3rem;
    box-shadow: var(--shadow-md);
    min-height: 500px;
    width: 100%;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.badge-easy {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.badge-medium {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.badge-hard {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

.question-type {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.question-container {
    margin-bottom: 3rem;
}

.question-text {
    font-size: 1.75rem;
    line-height: 1.6;
    color: var(--text-primary);
}

/* ==================== Answers ==================== */
.answers-container {
    display: grid;
    gap: 1rem;
    margin-bottom: 3rem;
}

.answer-option {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.answer-letter {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 50%;
    font-weight: 700;
    color: var(--primary-color);
    flex-shrink: 0;
}

.answer-text {
    flex: 1;
    font-size: 1.125rem;
}

.answer-option:hover:not(.correct):not(.incorrect):not(.disabled) {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.answer-option.selected:not(.correct):not(.incorrect) {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.answer-option.correct {
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
}

.answer-option.correct .answer-letter {
    background: var(--success-color);
    color: white;
}

.answer-option.incorrect {
    border-color: var(--error-color);
    background: rgba(239, 68, 68, 0.1);
}

.answer-option.incorrect .answer-letter {
    background: var(--error-color);
    color: white;
}

.answer-option.disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* ==================== Quiz Actions ==================== */
.quiz-actions {
    display: flex;
    justify-content: flex-end;
}

/* ==================== Responsive ==================== */
@media (max-width: 1024px) {
    #quiz-screen {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    #quiz-screen .quiz-content {
        grid-column: 1;
        grid-row: 1;
    }

    #quiz-screen .quiz-sidebar {
        grid-column: 1;
        grid-row: 2;
        position: static;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
        padding: 1.5rem;
    }

    .quiz-progress,
    .quiz-stats,
    .difficulty-legend {
        margin-bottom: 0;
    }

    .difficulty-legend {
        padding-top: 0;
        border-top: none;
    }
    
    .progress-circle {
        width: 120px;
        height: 120px;
    }
    
    .progress-text {
        font-size: 1.5rem;
    }
}

@media (max-width: 768px) {
    .quiz-sidebar {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .quiz-content {
        padding: 2rem 1.5rem;
    }

    .question-text {
        font-size: 1.5rem;
    }

    .answer-text {
        font-size: 1rem;
    }

    .question-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}
