/* 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: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* Header */
header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 20px 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    color: white;
    font-size: 2rem;
    text-align: center;
    margin-bottom: 5px;
}

.home-link {
    color: white;
    text-decoration: none;
}

.home-link:hover {
    opacity: 0.9;
}

.tagline {
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    font-size: 1.1rem;
}

/* Main Content */
main {
    flex: 1;
    padding: 40px 20px;
}

/* Quiz Grid */
.quiz-section {
    margin-bottom: 50px;
}

.quiz-section h2 {
    color: white;
    font-size: 2rem;
    margin-bottom: 30px;
    text-align: center;
}

.quiz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.quiz-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.quiz-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.quiz-icon {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 15px;
}

.quiz-card h3 {
    color: #667eea;
    font-size: 1.5rem;
    margin-bottom: 10px;
    text-align: center;
}

.quiz-description {
    color: #666;
    margin-bottom: 20px;
    text-align: center;
    flex-grow: 1;
}

.quiz-meta {
    text-align: center;
    margin-bottom: 20px;
}

.question-count {
    background: #f0f0f0;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #666;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
}

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

/* Leaderboard */
.leaderboard-section h2 {
    color: white;
    font-size: 2rem;
    margin-bottom: 30px;
    text-align: center;
}

.leaderboard {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow-x: auto;
}

.leaderboard table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard th,
.leaderboard td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.leaderboard th {
    background: #f8f9fa;
    color: #667eea;
    font-weight: 600;
}

.leaderboard tr:last-child td {
    border-bottom: none;
}

.score-badge {
    background: #667eea;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.no-scores {
    background: white;
    padding: 40px;
    text-align: center;
    border-radius: 15px;
    color: #666;
}

/* Quiz Container */
.quiz-container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.quiz-header h2 {
    color: #667eea;
    margin-bottom: 20px;
    text-align: center;
}

.progress-info {
    text-align: center;
    color: #666;
    margin-bottom: 10px;
    font-weight: 600;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 30px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

/* Question Navigator */
.question-navigator {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.nav-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 2px solid #ddd;
    text-decoration: none;
    color: #666;
    font-weight: 600;
    transition: all 0.3s ease;
}

.nav-dot:hover {
    border-color: #667eea;
    color: #667eea;
}

.nav-dot.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.nav-dot.answered {
    background: #d4edda;
    border-color: #28a745;
    color: #28a745;
}

.nav-dot.answered.active {
    background: #28a745;
    color: white;
}

/* Question Box */
.question-box {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.question-box h3 {
    color: #667eea;
    margin-bottom: 15px;
}

.question-text {
    font-size: 1.2rem;
    color: #333;
    line-height: 1.8;
}

/* Options */
.options {
    margin-bottom: 30px;
}

.option {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    margin-bottom: 15px;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.option:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.option.selected {
    border-color: #667eea;
    background: #e8f0fe;
}

.option input[type="radio"] {
    margin-right: 15px;
    cursor: pointer;
}

.option-label {
    font-weight: 700;
    color: #667eea;
    margin-right: 10px;
    min-width: 30px;
}

.option-text {
    flex-grow: 1;
    color: #333;
}

/* Quiz Actions */
.quiz-actions {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 20px;
}

.quiz-info {
    text-align: center;
    color: #666;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

/* Results Container */
.results-container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.results-header {
    text-align: center;
    margin-bottom: 40px;
}

.results-header h2 {
    color: #667eea;
    margin-bottom: 30px;
}

.score-circle {
    width: 200px;
    height: 200px;
    margin: 0 auto 20px;
    border-radius: 50%;
    border: 8px solid;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.score-emoji {
    font-size: 3rem;
    margin-bottom: 10px;
}

.score-number {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
}

.score-percentage {
    font-size: 1.2rem;
    color: #666;
}

.results-header h3 {
    font-size: 2rem;
    margin-top: 20px;
}

/* Save Score Section */
.save-score-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 40px;
    text-align: center;
}

.save-score-section h3 {
    color: #667eea;
    margin-bottom: 20px;
}

.save-score-form {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.save-score-form input[type="text"] {
    padding: 12px 20px;
    border: 2px solid #ddd;
    border-radius: 25px;
    font-size: 1rem;
    min-width: 250px;
    transition: border-color 0.3s ease;
}

.save-score-form input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

/* Review Section */
.review-section h3 {
    color: #667eea;
    margin-bottom: 25px;
    font-size: 1.5rem;
}

.answers-review {
    margin-bottom: 30px;
}

.review-item {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-left: 5px solid;
}

.review-item.correct {
    border-left-color: #28a745;
}

.review-item.incorrect {
    border-left-color: #dc3545;
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.review-number {
    font-weight: 700;
    color: #667eea;
}

.review-status {
    font-weight: 600;
    padding: 5px 15px;
    border-radius: 20px;
}

.review-item.correct .review-status {
    background: #d4edda;
    color: #28a745;
}

.review-item.incorrect .review-status {
    background: #f8d7da;
    color: #dc3545;
}

.review-question {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: #333;
    font-weight: 500;
}

.review-options {
    margin-top: 15px;
}

.review-option {
    padding: 12px 15px;
    margin-bottom: 10px;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.review-option.correct-answer {
    background: #d4edda;
    border: 2px solid #28a745;
}

.review-option.wrong-answer {
    background: #f8d7da;
    border: 2px solid #dc3545;
}

.badge {
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: auto;
}

.badge-correct {
    background: #28a745;
    color: white;
}

.badge-wrong {
    background: #dc3545;
    color: white;
}

.results-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* Footer */
footer {
    background: rgba(0, 0, 0, 0.2);
    color: white;
    text-align: center;
    padding: 20px 0;
    margin-top: auto;
}

/* Responsive Design */

/* Tablet (768px and below) */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }

    .tagline {
        font-size: 1rem;
    }

    .quiz-section h2,
    .leaderboard-section h2 {
        font-size: 1.5rem;
    }

    .quiz-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .quiz-container,
    .results-container {
        padding: 20px;
    }

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

    .quiz-actions {
        flex-direction: column;
    }

    .quiz-actions .btn {
        width: 100%;
    }

    .score-circle {
        width: 150px;
        height: 150px;
    }

    .score-emoji {
        font-size: 2.5rem;
    }

    .score-number {
        font-size: 1.5rem;
    }

    .leaderboard table {
        font-size: 0.9rem;
    }

    .leaderboard th,
    .leaderboard td {
        padding: 10px;
    }

    .results-actions {
        flex-direction: column;
    }

    .results-actions .btn {
        width: 100%;
    }

    .save-score-form {
        flex-direction: column;
        align-items: stretch;
    }

    .save-score-form input[type="text"] {
        min-width: 100%;
    }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
    main {
        padding: 20px 10px;
    }

    .container {
        padding: 0 15px;
    }

    header h1 {
        font-size: 1.3rem;
    }

    .tagline {
        font-size: 0.9rem;
    }

    .quiz-card {
        padding: 20px;
    }

    .quiz-icon {
        font-size: 2.5rem;
    }

    .quiz-card h3 {
        font-size: 1.3rem;
    }

    .nav-dot {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }

    .question-navigator {
        gap: 8px;
        padding: 15px;
    }

    .question-box {
        padding: 15px;
    }

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

    .option {
        padding: 12px 15px;
    }

    .option-text {
        font-size: 0.95rem;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.95rem;
    }

    .results-container {
        padding: 15px;
    }

    .score-circle {
        width: 130px;
        height: 130px;
    }

    .score-emoji {
        font-size: 2rem;
    }

    .score-number {
        font-size: 1.3rem;
    }

    .score-percentage {
        font-size: 1rem;
    }

    .results-header h3 {
        font-size: 1.5rem;
    }

    .review-item {
        padding: 15px;
    }

    .review-question {
        font-size: 1rem;
    }

    .leaderboard {
        padding: 10px;
    }

    .leaderboard th,
    .leaderboard td {
        padding: 8px;
        font-size: 0.85rem;
    }
}

/* Very small mobile devices (360px and below) */
@media (max-width: 360px) {
    .nav-dot {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }

    .question-navigator {
        gap: 5px;
    }
}
