/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    padding: 20px;
}

.quiz-app {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    padding: 30px;
}

h1, h2, h3 {
    color: #2c3e50;
    margin-bottom: 20px;
}

h1 {
    text-align: center;
    font-size: 2.2rem;
    color: #3498db;
}

/* Quiz Intro */
.quiz-rules {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    margin: 25px 0;
}

.quiz-rules ul {
    list-style: none;
    margin: 20px 0;
}

.quiz-rules li {
    margin-bottom: 10px;
    padding-left: 30px;
    position: relative;
}

.quiz-rules i {
    position: absolute;
    left: 0;
    top: 3px;
    color: #27ae60;
}

.topic-selection {
    margin: 25px 0;
}

.topic-selection label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

.topic-selection select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

/* Quiz Container */
#quiz-container {
    margin: 20px 0;
}

.quiz-question {
    margin-bottom: 25px;
}

.quiz-question h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
}

.quiz-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.quiz-option {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
}

.quiz-option:hover {
    background: #e9ecef;
}

.quiz-option input {
    margin-right: 10px;
    cursor: pointer;
}

/* Quiz Controls */
#quiz-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

#question-counter {
    font-weight: bold;
    color: #7f8c8d;
}

/* Results */
#result-container {
    margin-top: 20px;
}

.result-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.result-item h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.result-answer {
    padding: 8px 12px;
    border-radius: 4px;
    margin: 5px 0;
}

.user-answer {
    background: #e8f4fd;
    border-left: 4px solid #3498db;
}

.correct-answer {
    background: #e8f8f0;
    border-left: 4px solid #2ecc71;
}

.correct-icon {
    color: #2ecc71;
    margin-left: 10px;
}

.incorrect-icon {
    color: #e74c3c;
    margin-left: 10px;
}

.score-display {
    text-align: center;
    margin: 30px 0;
    font-size: 1.2rem;
}

.score-value {
    font-weight: bold;
    color: #3498db;
}

.score-percentage {
    font-weight: bold;
    color: #2ecc71;
}

/* Buttons */
.btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    background: #2980b9;
}

.btn i {
    font-size: 14px;
}

#start-quiz {
    width: 100%;
    padding: 12px;
    font-size: 18px;
}

#submit-quiz {
    background: #27ae60;
}

#submit-quiz:hover {
    background: #219653;
}

#submit-results {
    background: #9b59b6;
    margin-top: 20px;
}

#submit-results:hover {
    background: #8e44ad;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* Messages */
#submission-message {
    padding: 15px;
    margin-top: 20px;
    border-radius: 5px;
    text-align: center;
}

.success-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Responsive */
@media (max-width: 600px) {
    .quiz-app {
        padding: 15px;
    }
    
    #quiz-controls {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    #question-counter {
        order: 1;
        width: 100%;
        text-align: center;
    }
}