* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main Content */
.main-content {
    display: grid;
    gap: 30px;
    grid-template-columns: 1fr 300px;
}

/* Quiz Controls */
.quiz-controls {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    display: flex;
    gap: 20px;
    align-items: end;
    flex-wrap: wrap;
}

.category-selector,
.difficulty-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 150px;
}

.category-selector label,
.difficulty-selector label {
    font-weight: 500;
    color: #555;
    font-size: 0.9rem;
}

.category-selector select,
.difficulty-selector select {
    padding: 10px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    transition: border-color 0.3s ease;
}

.category-selector select:focus,
.difficulty-selector select:focus {
    outline: none;
    border-color: #667eea;
}

.generate-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.generate-btn:active {
    transform: translateY(0);
}

/* Quiz Container */
.quiz-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
    min-height: 400px;
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: #666;
    font-size: 1.1rem;
}

/* Quiz Card */
.quiz-card {
    padding: 30px;
}

.quiz-header {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

.category-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    background: #e3f2fd;
    color: #1976d2;
}

.question-section {
    margin-bottom: 30px;
}

.question-section h2 {
    font-size: 1.4rem;
    color: #333;
    line-height: 1.5;
}

/* Options */
.options-section {
    margin-bottom: 30px;
}

.options-grid {
    display: grid;
    gap: 12px;
}

.option-item {
    padding: 15px 20px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
}

.option-item:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.option-item.selected {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.option-item.correct {
    border-color: #4caf50;
    background: #4caf50;
    color: white;
}

.option-item.incorrect {
    border-color: #f44336;
    background: #f44336;
    color: white;
}

.option-letter {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    background: #f0f0f0;
    color: #666;
}

.option-item.selected .option-letter,
.option-item.correct .option-letter,
.option-item.incorrect .option-letter {
    background: rgba(255,255,255,0.2);
    color: white;
}

/* Quiz Actions */
.quiz-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.submit-btn,
.explanation-btn,
.next-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.submit-btn {
    background: #4caf50;
    color: white;
}

.submit-btn:hover:not(:disabled) {
    background: #45a049;
    transform: translateY(-2px);
}

.submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.explanation-btn {
    background: #ff9800;
    color: white;
}

.explanation-btn:hover {
    background: #f57c00;
    transform: translateY(-2px);
}

.next-btn {
    background: #2196f3;
    color: white;
}

.next-btn:hover {
    background: #1976d2;
    transform: translateY(-2px);
}

/* Explanation Card */
.explanation-card {
    padding: 30px;
}

.explanation-card h3 {
    color: #333;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.explanation-card h3 i {
    color: #ff9800;
}

#explanationText {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    line-height: 1.6;
    color: #555;
}

.explanation-actions {
    text-align: center;
}

/* Quiz Complete Card */
.quiz-complete-card {
    padding: 40px;
    text-align: center;
}

.complete-header {
    margin-bottom: 30px;
}

.complete-header h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: #333;
}

.complete-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.complete-icon.excellent {
    color: #ffd700;
}

.complete-icon.good {
    color: #4caf50;
}

.complete-icon.average {
    color: #ff9800;
}

.complete-icon.poor {
    color: #f44336;
}

.complete-stats {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #e9ecef;
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-row.highlight {
    font-weight: 700;
    font-size: 1.2rem;
    color: #667eea;
}

.stat-label {
    color: #666;
}

.stat-value {
    font-weight: 600;
    color: #333;
}

.complete-message {
    background: white;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
    font-size: 1.1rem;
    line-height: 1.6;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.complete-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.restart-btn,
.new-category-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.restart-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.restart-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.new-category-btn {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #e9ecef;
}

.new-category-btn:hover {
    background: #e9ecef;
    transform: translateY(-3px);
}

/* Background variations based on accuracy */
body.excellent-bg {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
}

body.good-bg {
    background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
}

body.average-bg {
    background: linear-gradient(135deg, #ff9800 0%, #ffb74d 100%);
}

body.poor-bg {
    background: linear-gradient(135deg, #f44336 0%, #ef5350 100%);
}

/* Stats Section */
.stats-section {
    grid-column: 2;
    grid-row: 1 / span 2;
}

.stats-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    position: sticky;
    top: 20px;
}

.stats-card h3 {
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

.stats-grid {
    display: grid;
    gap: 15px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
}

.reset-stats-btn {
    width: 100%;
    padding: 10px;
    margin-top: 15px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    color: #666;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.reset-stats-btn:hover {
    background: #e9ecef;
    color: #333;
    transform: translateY(-2px);
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 40px;
    color: white;
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .stats-section {
        grid-column: 1;
        grid-row: auto;
    }
    
    .quiz-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .category-selector,
    .difficulty-selector {
        min-width: auto;
    }
    
    .quiz-actions {
        flex-direction: column;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .container {
        padding: 15px;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.quiz-card,
.explanation-card {
    animation: fadeIn 0.5s ease;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #5a6fd8;
} 