/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Container */
.container {
    max-width: 800px;
    width: 100%;
    padding: 20px;
    margin: 0 auto;
}

/* Page Management */
.page {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.page.active {
    display: block;
}

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

/* Typography */
h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-align: center;
    color: #2c3e50;
}

h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: #34495e;
}

.welcome-text {
    text-align: center;
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 2rem;
}

/* Info Box */
.info-box {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.info-box ul {
    list-style: none;
    padding-left: 0;
}

.info-box li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.info-box li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #27ae60;
    font-weight: bold;
}

/* Buttons */
.btn {
    padding: 12px 30px;
    font-size: 1.1rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

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

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
    margin-left: 10px;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #7f8c8d;
}

/* Quiz Page Styles */
.quiz-header {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.progress-container {
    margin-top: 1rem;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background-color: #ecf0f1;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background-color: #3498db;
    transition: width 0.3s ease;
    width: var(--progress, 0%);
}

.progress-text {
    display: block;
    text-align: center;
    margin-top: 0.5rem;
    color: #666;
    font-size: 0.9rem;
}

/* Question Container */
.question-container {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.question {
    font-size: 1.3rem;
    margin-bottom: 2rem;
    color: #2c3e50;
}

/* Answer Grid */
.answers-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.answer-btn {
    padding: 1rem;
    background: #ecf0f1;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    text-align: left;
}

.answer-btn:hover {
    background: #d5dbdb;
    border-color: #95a5a6;
}

.answer-btn.selected {
    background: #3498db;
    color: white;
    border-color: #2980b9;
}

/* Quiz Navigation */
.quiz-navigation {
    text-align: center;
}

/* Results Page */
.result-box {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.result-message {
    font-size: 1.5rem;
    margin: 1rem 0;
    font-weight: bold;
}

.result-message.pass {
    color: #27ae60;
}

.result-message.fail {
    color: #e74c3c;
}

.score-details {
    color: #666;
    margin-top: 1rem;
}

.result-actions {
    text-align: center;
    margin-bottom: 2rem;
}

/* Review Section */
.review-section {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.review-item {
    border-bottom: 1px solid #ecf0f1;
    padding: 1.5rem 0;
}

.review-item:last-child {
    border-bottom: none;
}

.review-question {
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.review-answer {
    padding: 0.5rem 0;
}

.review-answer.correct {
    color: #27ae60;
}

.review-answer.incorrect {
    color: #e74c3c;
}

.review-answer.user-answer::before {
    content: "Your answer: ";
    font-weight: normal;
}

.review-answer.correct-answer::before {
    content: "Correct answer: ";
    font-weight: normal;
}

/* Level Selection */
.level-selection {
    margin: 2rem 0;
}

.level-selection h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

.level-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.level-card {
    background: white;
    border: 2px solid #ecf0f1;
    border-radius: 10px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.level-card:hover {
    border-color: #3498db;
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(52, 152, 219, 0.3);
}

.level-card.selected {
    border-color: #3498db;
    background-color: #ebf5fb;
}

.level-card.selected::after {
    content: "✓";
    position: absolute;
    top: 10px;
    right: 10px;
    background: #3498db;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.level-card h3 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 1.4rem;
}

.level-card p {
    color: #7f8c8d;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.level-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.level-card li {
    padding: 0.3rem 0;
    color: #34495e;
    font-size: 0.9rem;
    position: relative;
    padding-left: 1.2rem;
}

.level-card li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #3498db;
}

/* Utility Classes */
.hidden {
    display: none;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .container {
        padding: 15px;
    }
    
    .info-box {
        padding: 1.5rem;
    }
    
    .answers-grid {
        grid-template-columns: 1fr;
    }
    
    .btn {
        font-size: 1rem;
        padding: 10px 20px;
    }
    
    .question {
        font-size: 1.1rem;
    }
    
    .result-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-secondary {
        margin-left: 0;
    }
    
    .level-cards {
        grid-template-columns: 1fr;
    }
    
    .level-card h3 {
        font-size: 1.2rem;
    }
    
    .level-card p {
        font-size: 0.9rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.btn:focus,
.answer-btn:focus {
    outline: 3px solid #3498db;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .btn-primary {
        background-color: #000;
        color: #fff;
        border: 2px solid #fff;
    }
    
    .answer-btn.selected {
        background-color: #000;
        color: #fff;
        border: 2px solid #fff;
    }
}