/* Styles généraux */
:root {
    --primary-color: #4e54c8;
    --secondary-color: #8f94fb;
    --accent-color: #ff8c00;
    --success-color: #4CAF50;
    --warning-color: #ff9800;
    --danger-color: #f44336;
    --light-color: #f9f9f9;
    --dark-color: #333;
    --shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: var(--dark-color);
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

h1, h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

/* En-tête */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--secondary-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    font-size: 2rem;
    color: var(--accent-color);
}

.logo h1 {
    margin: 0;
    font-size: 2rem;
}

.level-selector select {
    padding: 8px 15px;
    border: 2px solid var(--secondary-color);
    border-radius: var(--border-radius);
    background-color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.level-selector select:hover {
    border-color: var(--primary-color);
}

/* Style du menu de navigation */
.main-nav {
    flex-grow: 1;
    display: flex;
    justify-content: flex-end;
}

.nav-container {
    display: flex;
    gap: 15px;
    align-items: center;
}

.nav-container a {
    display: block;
    color: var(--dark-color);
    text-decoration: none;
    font-weight: 600;
    padding: 8px 15px;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    background-color: white;
    box-shadow: var(--shadow);
}

.nav-container a:hover {
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.nav-container a.active {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    color: white;
}

/* Cartes */
.card {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.card h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
    font-size: 1.5rem;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.card h2 i {
    color: var(--accent-color);
}

/* Section de lecture */
.text-selection {
    margin-bottom: 20px;
}

.text-selection label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.text-selection select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.text-selection select:focus {
    border-color: var(--secondary-color);
    outline: none;
}

.text-display {
    position: relative;
    background-color: #f9f9f9;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    font-size: 1.3rem;
    min-height: 100px;
    display: flex;
    align-items: center;
    border-left: 5px solid var(--accent-color);
}

.word-highlight {
    position: absolute;
    height: 8px;
    background-color: var(--accent-color);
    bottom: 10px;
    left: 20px;
    border-radius: 4px;
    transition: width 0.2s, left 0.2s;
}

/* Boutons de contrôle */
.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    color: white;
    min-width: 120px;
}

button i {
    font-size: 1.2rem;
}

.btn-listen {
    background-color: var(--primary-color);
}

.btn-start {
    background-color: var(--success-color);
}

.btn-stop {
    background-color: var(--danger-color);
}

.btn-reset {
    background-color: var(--warning-color);
}

button:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
}

/* Section des résultats */
.speech-result {
    margin-bottom: 20px;
}

#userSpeech {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    min-height: 60px;
    border-left: 5px solid var(--secondary-color);
}

.score-display {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.score-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.8rem;
    font-weight: bold;
    position: relative;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.score-max {
    font-size: 1rem;
    position: absolute;
    bottom: 15px;
    right: 15px;
}

#feedback {
    flex: 1;
    font-size: 1.2rem;
    font-weight: 600;
}

.word-analysis {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.word-item {
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 1rem;
}

.word-correct {
    background-color: rgba(76, 175, 80, 0.2);
    border: 1px solid var(--success-color);
}

.word-incorrect {
    background-color: rgba(244, 67, 54, 0.2);
    border: 1px solid var(--danger-color);
}

.word-missing {
    background-color: rgba(255, 152, 0, 0.2);
    border: 1px solid var(--warning-color);
}

/* Section des statistiques */
.progress-container {
    margin-bottom: 20px;
}

.progress-bar {
    width: 100%;
    height: 15px;
    background-color: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    transition: width 0.5s ease;
}

#progressText {
    text-align: right;
    font-size: 0.9rem;
    color: #777;
}

.stats {
    display: flex;
    justify-content: space-between;
    text-align: center;
}

.stat-item {
    flex: 1;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.9rem;
    color: #777;
}

/* Pied de page */
footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
    color: #777;
}

/* Modal de félicitations */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: var(--border-radius);
    text-align: center;
    max-width: 400px;
    animation: popIn 0.5s;
}

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.modal h2 {
    color: var(--accent-color);
    margin-bottom: 15px;
}

.modal button {
    margin-top: 20px;
    background-color: var(--primary-color);
}

#confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 99;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .main-nav {
        width: 100%;
        justify-content: center;
    }
    
    .nav-container {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .nav-container a {
        flex: 1;
        text-align: center;
        min-width: 120px;
    }
    
    .controls {
        flex-direction: column;
    }
    
    button {
        width: 100%;
    }
    
    .score-display {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .stats {
        flex-direction: column;
        gap: 10px;
    }
}

/* Pour les très petits écrans */
@media (max-width: 480px) {
    .nav-container {
        flex-direction: column;
    }
    
    .nav-container a {
        width: 100%;
        text-align: center;
    }
}