/* Basic reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS Variables */
:root {
    --primary-color: #2196F3;
    --primary-dark: #1976D2;
    --secondary-color: #4CAF50;
    --error-color: #f44336;
    --warning-color: #FF9800;
    --background-color: #f5f5f5;
    --card-background: #ffffff;
    --text-color: #333333;
    --text-light: #666666;
    --border-color: #e0e0e0;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
}

/* Force light colors in light mode to avoid issues */
html {
    color-scheme: light;
}

body {
    color-scheme: light;
}

/* Base styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    min-height: 100vh;
    background-color: var(--card-background);
    box-shadow: var(--shadow);
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 2rem 1.5rem;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

header p {
    opacity: 0.9;
    font-size: 1rem;
}

/* Screens */
.screen {
    display: none;
    padding: 2rem 1.5rem;
    min-height: calc(100vh - 140px);
}

.screen.active {
    display: block;
}

/* Welcome screen */
.welcome-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1rem;
    max-width: 500px;
    margin: 0 auto;
}

.stats-preview {
    margin-bottom: 2rem;
}

.stats-preview h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.stats-preview p {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.progress-info {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 2rem;
}

/* Buttons */
.btn {
    display: block;
    width: 100%;
    max-width: 300px;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0.5rem auto;
    touch-action: manipulation;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background-color: var(--primary-color);
    color: white;
}

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

/* Quiz */
.quiz-header {
    margin-bottom: 2rem;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background-color: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 0%;
    transition: width 0.3s ease;
}

.quiz-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: var(--text-light);
}

.question-container {
    margin: 2rem 0;
}

#question-text {
    font-size: 1.3rem;
    line-height: 1.5;
    margin-bottom: 2rem;
    color: var(--text-color);
    /* Garantir contraste adequado */
    font-weight: 500;
}

.answers-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.answer-option {
    background-color: var(--card-background);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    text-align: left;
    position: relative;
}

.answer-option:hover {
    border-color: var(--primary-color);
    background-color: rgba(33, 150, 243, 0.05);
}

.answer-option.selected {
    border-color: var(--primary-color);
    background-color: rgba(33, 150, 243, 0.1);
}

.answer-option.correct {
    border-color: var(--secondary-color);
    background-color: rgba(76, 175, 80, 0.1);
    color: var(--secondary-color);
}

.answer-option.incorrect {
    border-color: var(--error-color);
    background-color: rgba(244, 67, 54, 0.1);
    color: var(--error-color);
}

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

.quiz-controls {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

/* Resultados */
.results-content {
    text-align: center;
    padding: 2rem 0;
}

.final-score {
    margin: 2rem 0;
}

#final-score-text {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
    display: block;
}

#percentage {
    font-size: 1.5rem;
    color: var(--text-light);
    margin-top: 0.5rem;
    display: block;
}

.performance-message {
    margin: 2rem 0;
}

#performance-text {
    font-size: 1.2rem;
    font-weight: 600;
}

.results-actions {
    margin-top: 3rem;
}

/* Estatísticas */
.stats-content {
    padding: 1rem 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.stat-card {
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.stat-card span {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Responsividade */
@media (max-width: 768px) {
    .container {
        box-shadow: none;
    }
    
    header {
        padding: 1.5rem 1rem;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .screen {
        padding: 1.5rem 1rem;
    }
    
    .btn {
        width: 100%;
        margin: 0.5rem 0;
        max-width: none;
    }
    
    .welcome-container {
        padding: 1rem;
    }
    
    .stats-preview h2 {
        font-size: 1.5rem;
    }
    
    #question-text {
        font-size: 1.1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    #final-score-text {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.3rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 1rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.screen.active {
    animation: fadeIn 0.3s ease;
}

/* Melhorar a experiência táctil */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        transform: none;
    }
    
    .answer-option:hover {
        border-color: var(--border-color);
        background-color: var(--card-background);
    }
}

/* Estilos para novos elementos */
.progress-info {
    font-size: 0.9rem;
    color: var(--text-light);
    background-color: rgba(33, 150, 243, 0.1);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    border-left: 4px solid var(--primary-color);
}

.btn-tertiary {
    background-color: var(--warning-color);
    color: white;
    font-size: 0.9rem;
    min-width: 150px;
}

.btn-tertiary:hover {
    background-color: #f57c00;
    transform: translateY(-1px);
}

.btn-danger {
    background-color: var(--error-color);
    color: white;
    font-size: 0.9rem;
    min-width: 120px;
}

.btn-danger:hover {
    background-color: #d32f2f;
    transform: translateY(-1px);
}

.stats-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

/* Dark mode (opcional) */
@media (prefers-color-scheme: dark) {
    :root {
        --background-color: #121212;
        --card-background: #1e1e1e;
        --text-color: #ffffff;
        --text-light: #cccccc;
        --border-color: #333333;
    }
    
    /* Garantir que o texto das perguntas seja visível no modo escuro */
    #question-text {
        color: #ffffff !important;
    }
    
    .answer-option {
        background-color: #2a2a2a;
        color: #ffffff;
        border-color: #444444;
    }
    
    .answer-option:hover {
        background-color: rgba(33, 150, 243, 0.2);
        border-color: var(--primary-color);
    }

    .progress-info {
        background-color: rgba(33, 150, 243, 0.2);
        color: #cccccc;
    }
}