/* Reset et styles de base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4a90e2;
    --primary-dark: #357abd;
    --success-color: #27ae60;
    --error-color: #e74c3c;
    --warning-color: #f39c12;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --text-color: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #e1e8ed;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Écrans */
.screen {
    display: none;
    width: 100%;
    animation: fadeIn 0.4s ease-in-out;
}

.screen.active {
    display: block;
}

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

/* Écran d'accueil */
.welcome-content {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 40px 30px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.welcome-content h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.stats-preview {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 30px 0;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: var(--bg-color);
    border-radius: var(--border-radius);
    min-width: 120px;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* Ancien mode-selector - désactivé car remplacé par les boutons btn-mode
.mode-selector {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    text-align: left;
}

.mode-selector label {
    display: flex;
    align-items: center;
    padding: 15px;
    background: var(--bg-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.mode-selector label:hover {
    background: #e8ecf1;
    border-color: var(--primary-color);
}

.mode-selector input[type="radio"] {
    margin-right: 12px;
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.mode-selector span {
    font-size: 1rem;
    color: var(--text-color);
}
*/

/* Boutons */
.btn {
    padding: 15px 35px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    font-family: inherit;
    display: inline-block;
    text-align: center;
    box-shadow: var(--shadow);
}

.btn-primary {
    background: var(--primary-color);
    color: white !important;
    margin-top: 20px;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
    color: white !important;
}

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

.btn-secondary:hover {
    background: var(--bg-color);
    color: var(--primary-color) !important;
}

.btn-danger {
    background: var(--error-color);
    color: white !important;
    border: 2px solid var(--error-color);
}

.btn-danger:hover {
    background: #d32f2f;
    border-color: #d32f2f;
}

.btn-danger-outline {
    background: white;
    color: var(--error-color) !important;
    border: 2px solid var(--error-color);
    padding: 12px 25px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.btn-danger-outline:hover {
    background: var(--error-color);
    color: white !important;
}

/* Écran de quiz */
.quiz-header {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-color);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #667eea);
    border-radius: 10px;
    transition: width 0.4s ease;
}

.quiz-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.question-counter, .score {
    display: flex;
    align-items: center;
    gap: 5px;
}

.score span {
    font-weight: 700;
    color: var(--primary-color);
}

.quiz-content {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--shadow-lg);
}

.question-text {
    font-size: 1.4rem;
    color: var(--text-color);
    margin-bottom: 30px;
    line-height: 1.5;
    font-weight: 600;
}

.multiple-choice-badge {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 12px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.option {
    display: flex;
    align-items: center;
    padding: 18px 20px;
    background: var(--bg-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    position: relative;
    color: var(--text-color);
}

.option:hover {
    background: #5a67d8;
    transform: translateX(5px);
    color: white !important;
    border-color: #4a5abf;
}

.option:hover .option-letter {
    background: white;
    color: #5a67d8 !important;
}

.option:hover .option-text {
    color: white !important;
}

.option.selected {
    background: #4a90e2;
    border-color: #357abd;
    color: white !important;
}

.option.selected .option-letter {
    background: white;
    color: #4a90e2 !important;
}

.option.selected .option-text {
    color: white !important;
}

.option.correct {
    background: #27ae60;
    border-color: #1e8449;
    pointer-events: none;
    color: white !important;
}

.option.incorrect {
    background: #e74c3c;
    border-color: #c0392b;
    pointer-events: none;
    color: white !important;
}

.option.correct .option-letter,
.option.incorrect .option-letter {
    background: white;
}

.option.correct .option-text,
.option.incorrect .option-text {
    color: white !important;
}

.option.correct::after {
    content: '✓';
    position: absolute;
    right: 20px;
    font-size: 1.5rem;
    color: white;
    font-weight: bold;
}

.option.incorrect::after {
    content: '✗';
    position: absolute;
    right: 20px;
    font-size: 1.5rem;
    color: white;
    font-weight: bold;
}

.option-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 50%;
    font-weight: 700;
    color: var(--primary-color);
    margin-right: 15px;
    flex-shrink: 0;
}

.option.correct .option-letter {
    background: var(--success-color);
    color: white;
}

.option.incorrect .option-letter {
    background: var(--error-color);
    color: white;
}

.option-text {
    flex: 1;
    font-size: 1.05rem;
    color: var(--text-color);
}

.quiz-actions {
    display: flex;
    gap: 15px;
    justify-content: space-between;
    margin-top: 30px;
}

.quiz-actions .btn {
    flex: 1;
}

.justification-container {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-left: 4px solid var(--primary-color);
    border-radius: var(--border-radius);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

.justification-container h3 {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-weight: 600;
}

.justification-container p {
    font-size: 1rem;
    color: #2c3e50;
    line-height: 1.7;
}

/* Écran de résultats */
.results-content {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 40px 30px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.results-content h1 {
    font-size: 2rem;
    color: var(--text-color);
    margin-bottom: 30px;
}

.final-score {
    margin: 30px 0;
}

.score-circle {
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    gap: 5px;
    margin-bottom: 15px;
}

.score-number {
    font-size: 4rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.score-total {
    font-size: 2rem;
    color: var(--text-secondary);
}

.score-percentage {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.score-message {
    font-size: 1.3rem;
    padding: 20px;
    border-radius: var(--border-radius);
    margin: 30px 0;
    font-weight: 600;
}

.score-message.excellent {
    background: #d4edda;
    color: #155724;
}

.score-message.good {
    background: #d1ecf1;
    color: #0c5460;
}

.score-message.average {
    background: #fff3cd;
    color: #856404;
}

.score-message.needs-work {
    background: #f8d7da;
    color: #721c24;
}

.results-details {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 30px 0;
    text-align: left;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--bg-color);
    border-radius: var(--border-radius);
}

.detail-label {
    font-size: 1rem;
    color: var(--text-color);
    font-weight: 500;
}

.detail-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.results-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 30px;
}

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

/* Responsive Design - Mobile */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .welcome-content, .quiz-content, .results-content {
        padding: 25px 20px;
    }

    .welcome-content h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .stats-preview {
        gap: 15px;
    }

    .stat-item {
        min-width: 100px;
        padding: 15px;
    }

    .stat-number {
        font-size: 2rem;
    }

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

    .option {
        padding: 15px;
    }

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

    .btn {
        padding: 12px 25px;
        font-size: 1rem;
    }

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

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

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

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

    .score-message {
        font-size: 1.1rem;
    }
}

/* iPhone 15 Pro Max et similaires */
@media (max-width: 430px) {
    .container {
        padding: 10px;
    }

    .welcome-content h1 {
        font-size: 1.8rem;
    }

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

    .option {
        padding: 12px 15px;
    }

    .option-letter {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }

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

    .justification-container {
        padding: 15px;
    }

    .justification-container p {
        font-size: 0.95rem;
    }
}

/* Dark mode support (optionnel) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a1a;
        --card-bg: #2d2d2d;
        --text-color: #e4e4e4;
        --text-secondary: #a0a0a0;
        --border-color: #404040;
    }
}

/* Animations supplémentaires */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.btn-primary:hover {
    animation: pulse 0.5s ease;
}

/* Scrollbar personnalisée */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Nouveaux styles pour les statistiques et modes */
.mode-selector {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin: 30px 0;
}

.mode-selector h3 {
    color: var(--text-color);
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.mode-selector > div {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
}

.btn-mode {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px 30px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    min-width: 200px;
    box-shadow: var(--shadow);
}

.btn-mode:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.mode-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #3498db;
    margin-bottom: 5px;
}

.mode-text {
    font-size: 0.95rem;
    color: #7f8c8d;
}

.stats-summary {
    background: #2c3e50;
    border-radius: var(--border-radius);
    padding: 25px;
    margin: 25px 0;
    box-shadow: var(--shadow);
}

.stats-summary h3 {
    margin-bottom: 20px;
    color: #ecf0f1;
    font-size: 1.2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.stat-card {
    background: #2c3e50;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: #ecf0f1;
    margin-bottom: 8px;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #3498db;
    margin-bottom: 5px;
}

.stat-value.positive {
    color: #4CAF50;
}

.stat-value.negative {
    color: #f44336;
}

.stat-detail {
    font-size: 0.8rem;
    color: #ecf0f1;
}

.no-stats {
    text-align: center;
    color: #7f8c8d;
    padding: 20px;
    font-size: 1rem;
}

.no-stats-box {
    background: white;
    border-radius: var(--border-radius);
    padding: 30px;
    margin: 25px 0;
    box-shadow: var(--shadow);
    text-align: center;
}

.no-stats-box h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

/* Graphique de progression */
.progress-chart {
    background: #2c3e50;
    border-radius: var(--border-radius);
    padding: 25px;
    margin-top: 20px;
    box-shadow: var(--shadow);
}

.progress-chart h4 {
    margin-bottom: 20px;
    color: #ecf0f1;
    font-size: 1.1rem;
}

.chart-container {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 200px;
    padding: 20px;
    background: #34495e;
    border-radius: 8px;
    gap: 4px;
}

.chart-bar {
    flex: 1;
    max-width: 60px;
    background-color: #3498db;
    border-radius: 4px 4px 0 0;
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 5px;
}

.chart-bar:hover {
    opacity: 0.8;
    transform: translateY(-5px);
}

.chart-label {
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    position: absolute;
    top: 5px;
    writing-mode: horizontal-tb;
}

.chart-caption {
    text-align: center;
    color: #ecf0f1;
    font-size: 0.85rem;
    margin-top: 10px;
}

.history-container {
    background: #2c3e50;
    border-radius: var(--border-radius);
    padding: 25px;
    margin: 25px 0;
    box-shadow: var(--shadow);
}

.history-container h3 {
    margin-bottom: 20px;
    color: #ecf0f1;
    font-size: 1.2rem;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    display: grid;
    grid-template-columns: 120px 120px 80px 1fr auto;
    gap: 15px;
    padding: 15px;
    background: #34495e;
    border-radius: 8px;
    align-items: center;
    font-size: 0.9rem;
}

.history-date {
    color: #bdc3c7;
}

.history-mode {
    font-weight: 600;
    color: #ecf0f1;
}

.history-score {
    font-weight: 700;
    font-size: 1.1rem;
}

.history-score.good {
    color: #4CAF50;
}

.history-score.medium {
    color: #ff9800;
}

.history-score.bad {
    color: #f44336;
}

.history-time {
    color: #7f8c8d;
}

.history-delete {
    background: transparent;
    border: 1px solid #e74c3c;
    color: #e74c3c;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.history-delete:hover {
    background: #e74c3c;
    color: white;
}

.timer {
    font-weight: 600;
    color: var(--primary-color);
}

.reset-stats-container {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
}

/* Page Statistiques */
.stats-page-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

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

.stats-header h1 {
    margin: 0;
    color: var(--text-color);
}

.detailed-stats {
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .mode-selector {
        flex-direction: column;
        align-items: center;
    }
    
    .btn-mode {
        min-width: 150px;
        padding: 15px 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .history-item {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .history-date, .history-mode {
        grid-column: 1;
    }
    
    .history-score, .history-time {
        grid-column: 2;
        text-align: right;
    }
}
