*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* --- VARIABLES ET THÈME CLAIR (CONTRASTE ACCENTUÉ) --- */
:root {
    --primary-color: #1d4ed8;
    /* Bleu plus soutenu (anciennement #2563eb) */
    --primary-hover: #1e3a8a;
    /* Bleu très foncé au survol */
    --bg-color: #f1f5f9;
    /* Fond de page légèrement plus gris/sombre pour faire ressortir les cartes */
    --card-bg: #ffffff;
    /* Cartes d'un blanc pur éclatant */
    --text-color: #0f172a;
    /* Texte principal presque noir (anciennement #1e293b) */
    --text-light: #475569;
    /* Texte secondaire assombri pour une meilleure lecture (anciennement #64748b) */
    --border-color: #cbd5e1;
    /* Bordures plus visibles pour délimiter nettement les zones (anciennement #e2e8f0) */
}

/* --- VARIABLES ET THÈME SOMBRE (CONTRASTE ACCENTUÉ) --- */
body.dark-mode {
    --bg-color: #020617;
    /* Fond de page noir d'encre ultra-profond (anciennement #0f172a) */
    --card-bg: #0f172a;
    /* Cartes d'un bleu nuit bien distinct du fond (anciennement #1e293b) */
    --text-color: #f8fafc;
    /* Texte principal d'un blanc pur éclatant */
    --text-light: #94a3b8;
    /* Texte secondaire gris clair très lisible */
    --border-color: #334155;
    /* Bordures sombres mieux définies */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    /* Force le body à faire au moins 100% de la hauteur de l'écran */
    min-height: 100vh;
}


.container {
    width: 100%;
    max-width: 800px;
    /* Centre le conteneur horizontalement */
    margin: 0 auto;
    /* Pousse le footer vers le bas */
    padding: 0 15px 30px 15px;
    flex: 1;
}

h1 {
    text-align: center;
    color: var(--primary-color);
}

/* --- CONFIGURATION SUPERIEURE (TEXTE ET OPTIONS) --- */
.top-options-container {
    display: flex;
    justify-content: space-between;
    /* Pousse le titre à gauche et la cartouche à droite */
    align-items: center;
    /* Aligne verticalement le texte et les boutons */
    margin-bottom: 16px;
    width: 100%;
}

/* Style du nouveau sous-titre */
.season-subtitle {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-light);
    /* Utilise la couleur contrastée dynamique */
    letter-spacing: 0.3px;
}

/* Force le sous-titre à passer en blanc éclatant en mode sombre */
body.dark-mode .season-subtitle {
    color: var(--text-color);
}

.options-cartridge {
    display: inline-flex;
    /* Force l'alignement sur une seule ligne horizontale */
    flex-direction: row;
    /* Aligne le bouton 1, le trait, puis le bouton 2 côte à côte */
    align-items: center;
    /* Centre les icônes verticalement */
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 3px 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

/* Style des boutons internes à la cartouche (allongés horizontalement) */
.btn-cartridge {
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;

    /* Augmentation du padding horizontal (16px à gauche/droite) pour étirer le bouton */
    padding: 8px 16px;

    /* On utilise un border-radius de type pilule plutôt que 50% pour épouser la forme allongée */
    border-radius: 20px;

    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.btn-cartridge:hover {
    background-color: var(--bg-color);
}

.cartridge-diviser {
    width: 1px;
    height: 18px;
    background-color: var(--border-color);
    margin: 0 8px;
}

body.dark-mode .options-cartridge {
    border: 1px solid #475569;
}

body.dark-mode .cartridge-diviser {
    background-color: #475569;
}

body.dark-mode .btn-cartridge:hover {
    border: 1px solid #1e293b;
}

.btn-theme {
    border: 1px solid var(--border-color);
    background-color: var(--card-bg);
    color: var(--text-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-theme:hover {
    background-color: var(--border-color);
}



/* Ajustements visuels spécifiques au Mode Sombre */
body.dark-mode .accordion-trigger {
    background: #1e293b;
    /* Fond d'accordéon plus clair que la carte en mode sombre */
    color: var(--text-color);
}

body.dark-mode .accordion-content {
    background: #090d16;
    /* Fond de la liste des voix extrêmement sombre en mode sombre */
}


body.dark-mode .voice-item {
    border-bottom: 1px solid #1e293b;
}

body.dark-mode .song-header {
    background: var(--card-bg);
}

/* Transition fluide lors du changement de thème */
body,
.song-card,
.song-header,
.accordion-trigger,
.accordion-content,
.audio-player-container,
button,
a {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}


/* --- STYLE DE LA BANNIÈRE (MIS À JOUR AVEC HOVER ZOOM) --- */
.main-banner {
    width: 100%;
    height: 210px;
    position: relative;
    margin-bottom: 16px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    /* Important : empêche l'image zoomée de déborder de la bannière */
}

/* Encapsulation de l'image de fond pour pouvoir l'animer sans bouger le reste */
.main-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('images/backgrd_header.jpg');
    background-size: cover;
    background-position: center;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    /* Transition fluide */
    z-index: 1;
}

/* Effet de zoom sur l'image d'arrière-plan au survol de la bannière */
.main-banner:hover::before {
    transform: scale(1.08);
    /* Zoom de 8% */
}

/* Le filtre overlay se place au-dessus de l'image de fond */
.banner-overlay {
    position: relative;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, rgba(22, 28, 44, 0.299) 0%, rgba(138, 180, 248, 0.145) 100%);
    display: flex;
    align-items: center;
    z-index: 2;
    /* Reste au-dessus de l'image */
}

.banner-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Style et animation du Logo */
.banner-logo {
    height: 90px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    transition: transform 0.4s ease, filter 0.4s ease;
    /* Transition pour le survol */
}

/* Effet sur le logo au survol de la bannière */
.main-banner:hover .banner-logo {
    transform: scale(1.05) rotate(-2deg);
    /* Léger zoom et rotation du logo */
    filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.4));
    /* Ombre plus marquée */
}

/* Texte à côté du logo */
.banner-text {
    color: #ffffff;
}

.banner-text h2 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.banner-text p {
    margin: 5px 0 0 0;
    font-size: 1rem;
    color: #cbd5e1;
}


/* --- AJUSTEMENT GLOBAL --- */
body {
    padding: 0 0 40px 0;
    /* On retire le padding haut car la bannière prend tout le bord supérieur */
}

/* Lecteur Audio Principal */
.audio-player-container {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-bottom: 25px;
    position: static;
    /*top: 10px;
    z-index: 100;*/
    border: 1px solid var(--border-color);
}

.current-track-info {
    margin-bottom: 15px;
}

.current-track-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0;
}

.current-track-artist {
    font-size: 0.95rem;
    color: var(--text-light);
    margin: 5px 0 0 0;
}

audio {
    width: 100%;
    border-radius: 8px;
}

/* Liste de lecture */
.playlist {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-bottom: 16px;
    /* Ajoute l'espacement de sécurité avant le footer */
}


.song-card {
    background: var(--card-bg);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.song-header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}

.song-meta h3 {
    margin: 0 0 5px 0;
    font-size: 1.1rem;
}

.song-meta p {
    margin: 0;
    color: var(--text-light);
    font-size: 0.9rem;
}

.song-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* --- STYLE DU SYSTÈME DE FAVORIS --- */
.song-meta-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-favorite {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, color 0.2s ease;
    z-index: 10;
    /* S'assure que le bouton reste cliquable au-dessus de la ligne */
}

.btn-favorite:hover {
    transform: scale(1.15);
    background-color: rgba(245, 158, 11, 0.1);
    /* Léger fond orange transparent */
}

/* État actif : Étoile jaune dorée */
.btn-favorite.is-favorite {
    color: #f59e0b;
    /* Jaune ambré */
}

/* Ajustement pour que le clic sur l'étoile ne déclenche pas la musique */
.btn-favorite .material-icons {
    pointer-events: none;
}

/* --- ALIGNEMENT RECHERCHE ET FILTRE --- */
.search-filter-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    width: 100%;
}

/* On ajuste la recherche pour qu'elle prenne la place restante */
.search-container {
    flex: 1;
    margin-bottom: 0;
}

/* Style du bouton/label Favoris */
.fav-filter-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    user-select: none;
    transition: all 0.2s ease;
}

.fav-filter-label:hover {
    background-color: #f1f5f9;
}

body.dark-mode .fav-filter-label:hover {
    background-color: #334155;
}

/* Masquer la case à cocher native par défaut */
.fav-filter-label input[type="checkbox"] {
    display: none;
}

/* Couleur de l'icône dans le filtre */
.fav-filter-icon {
    font-size: 20px;
    color: var(--text-light);
    transition: color 0.2s ease;
}

/* --- ÉTAT QUAND LE FILTRE EST COCHÉ --- */
.fav-filter-label:has(input:checked) {
    border-color: #f59e0b;
    background-color: rgba(245, 158, 11, 0.08);
    color: #f59e0b;
}

.fav-filter-label:has(input:checked) .fav-filter-icon {
    color: #f59e0b;
}



/* Indique que toute la ligne réagit au clic */
.clickable-track-row {
    cursor: pointer;
}

/* --- ALIGNEMENT DU LECTEUR ET DE LA VITESSE --- */
.player-flex-layout {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 15px;
}

/* Boutons de vitesse réajustés */
.speed-control-container {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #e2e8f0;
    padding: 4px 8px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

body.dark-mode .speed-control-container {
    background: #020617;
}

.speed-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
    margin-right: 2px;
}

/* Style des boutons de vitesse */
.btn-speed {
    background: transparent;
    border: none;
    padding: 4px 10px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 15px;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.2s ease;
}

.btn-speed:hover {
    color: var(--text-color);
}

/* Bouton actuellement sélectionné */
.btn-speed.active {
    background-color: var(--primary-color);
    color: white !important;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}


/* --- STYLE DE LA BARRE DE RECHERCHE --- */
.search-container {
    position: relative;
    margin-bottom: 20px;
    width: 100%;
}

.search-container input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    /* Espace à gauche pour laisser place à la loupe */
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--card-bg);
    color: var(--text-color);
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Effet au clic (focus) sur le champ */
.search-container input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Icône de loupe calée à gauche dans le champ input */
.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    pointer-events: none;
    /* L'icône ne bloque pas le clic sur l'input */
}

/* Boutons et Icônes SVG */
.btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn:hover {
    background-color: #f1f5f9;
}

.btn-play {
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    font-size: 20px;
    /* Assure la bonne taille de la flèche */
}


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

.btn-download {
    color: var(--text-light);
}

.btn-download:hover {
    color: var(--text-color);
}

/* Style pour le bouton PDF standard */
.btn-pdf {
    color: #dc2626;
    /* Rouge PDF */
    text-decoration: none;
    /* Enleve le soulignement du lien */
}

.btn-pdf:hover {
    color: #991b1b;
    background-color: #fef2f2;
}

/* Alignement de l'icône texte */
.material-icons {
    font-family: 'Material Icons';
    font-size: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    line-height: 1;

    /* Support for all WebKit browsers. */
    -webkit-font-smoothing: antialiased;
    /* Support for Safari and Chrome. */
    text-rendering: optimizeLegibility;

    /* Support for Firefox. */
    -moz-osx-font-smoothing: grayscale;

    /* Support for IE. */
    font-feature-settings: 'liga';
}

.icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Accordéon / Voix séparées */
/* --- ADAPTATIONS DES FONDS POUR CONSERVER LE CONTRASTE EXCLUSIF --- */
.accordion-trigger {
    width: 100%;
    padding: 10px 20px;
    background: #e2e8f0;
    /* Fond d'accordéon plus marqué en mode clair */
    border: none;
    border-top: 1px solid var(--border-color);
    text-align: left;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accordion-trigger::after {
    content: '▼';
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.accordion-trigger.active::after {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: #f8fafc;
    /* Fond de la liste des voix très clair en mode clair */
}

.voice-list {
    padding: 10px 20px;
    list-style: none;
    margin: 0;
}

.voice-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
}

.voice-item:last-child {
    border-bottom: none;
}

.voice-name {
    font-weight: 500;
    font-size: 0.95rem;
    width: 200px;
}

/* --- STYLE DU PIED DE PAGE (ICÔNES HIERARCHIQUES) --- */
.main-footer {
    width: 100%;
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 12px 0;
    /* Securité flexbox pour coller le bloc en bas */
    margin-top: auto;
    margin-bottom: 0;
    margin-left: 0;
    margin-right: 0;

    font-size: 0.85rem;
    color: var(--text-light);
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Alignement flex pour coupler chaque icône à son texte */
.footer-item,
.footer-phone-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.footer-phone-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.footer-phone-link:hover {
    text-decoration: underline;
    color: var(--primary-hover);
}

/* Style spécifique pour les petites icônes du footer */
.footer-icon {
    font-size: 18px !important;
    width: auto !important;
    height: auto !important;
    color: var(--text-light);
}

.footer-phone-link:hover .footer-icon {
    color: var(--primary-hover);
}


/* --- REPÈRE DE LECTURE EN COURS --- */
.song-card.currently-playing {
    border-left: 5px solid var(--primary-color);
    /* Ligne de repère bleue à gauche */
    background-color: #f0f7ff;
    /* Fond légèrement bleuté pour le mode clair */
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

/* Adaptation du repère pour le Mode Sombre */
body.dark-mode .song-card.currently-playing {
    background-color: #1e293b;
    /* Conserve le fond de la carte */
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* Optionnel : Mettre le titre en gras et en couleur pour le repérer encore mieux */
.song-card.currently-playing .song-meta h3 {
    color: var(--primary-color);
    font-weight: 700;
}

/* --- STYLE DES LIGNES DE VOIX ET DE L'ENTÊTE --- */
.song-header,
.voice-item {
    border-left: 5px solid transparent;
    /* Prépare la zone pour la bordure sans décaler le texte */
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* Effets de survol (hover) sur les lignes révisés pour le nouveau contraste */
.song-header:hover,
.voice-item:hover {
    background-color: #e2e8f0;
}

/* Adaptation du survol pour le Mode Sombre */
body.dark-mode .song-header:hover,
body.dark-mode .voice-item:hover {
    background-color: #1e293b;
}

/* --- REPÈRE DE LECTURE EXCLUSIF À LA VOIX EN COURS --- */
.song-header.currently-playing-voice,
.voice-item.currently-playing-voice {
    border-left: 5px solid var(--primary-color);
    /* Barre bleue sur la ligne exacte */
    background-color: #e0f2fe !important;
    /* Fond bleu clair pour repérer la ligne */
}

/* Style du texte pour la voix en cours */
.song-header.currently-playing-voice h3,
.voice-item.currently-playing-voice .voice-name {
    color: var(--primary-color);
    font-weight: 700;
}

/* Adaptation du repère pour le Mode Sombre */
body.dark-mode .song-header.currently-playing-voice,
body.dark-mode .voice-item.currently-playing-voice {
    background-color: #1e3a8a !important;
    /* Bleu nuit pour la ligne en mode sombre */
}

/* --- ALIGNEMENT RECHERCHE ET FILTRE --- */
.search-filter-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    width: 100%;
}

/* On ajuste la recherche pour qu'elle prenne la place restante */
.search-container {
    flex: 1;
    margin-bottom: 0;
}

/* --- BOUTON DE NETTOYAGE DE LA RECHERCHE --- */
.search-container input {
    /* Mise à jour du padding droit pour éviter que le texte ne chevauche la croix */
    padding: 12px 42px 12px 42px;
}

.btn-clear-search {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    display: none;
    /* Masqué par défaut, géré par le JavaScript */
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 50%;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.btn-clear-search:hover {
    background-color: var(--border-color);
    color: var(--text-color);
}

.btn-clear-search .material-icons {
    font-size: 18px;
    width: auto;
    height: auto;
}

/* Style du bouton/label Favoris */
.fav-filter-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    user-select: none;
    transition: all 0.2s ease;
}

.fav-filter-label:hover {
    background-color: #f1f5f9;
}

body.dark-mode .fav-filter-label:hover {
    background-color: #334155;
}

/* Masquer la case à cocher native par défaut */
.fav-filter-label input[type="checkbox"] {
    display: none;
}

/* Couleur de l'icône dans le filtre */
.fav-filter-icon {
    font-size: 20px;
    color: var(--text-light);
    transition: color 0.2s ease;
}

/* --- ÉTAT QUAND LE FILTRE EST COCHÉ --- */
.fav-filter-label:has(input:checked) {
    border-color: #f59e0b;
    background-color: rgba(245, 158, 11, 0.08);
    color: #f59e0b;
}

.fav-filter-label:has(input:checked) .fav-filter-icon {
    color: #f59e0b;
}

/* --- STYLE DU BOUTON DE PARTAGE --- */
.btn-share {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-share .material-icons {
    font-size: 16px;
    width: auto;
    height: auto;
}

/* --- COMPORTEMENT DYNAMIQUE DE LA FENÊTRE MODALE --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    /* Fond semi-transparent */
    backdrop-filter: blur(4px);
    /* Léger flou de l'arrière-plan */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 15px;
}

.modal-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

/* La carte se comporte comme un conteneur flexible */
.modal-card {
    background-color: var(--card-bg);
    color: var(--text-color);
    max-width: 500px;
    width: 100%;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    padding: 25px;
    display: flex;
    flex-direction: column;

    /* Contraint la hauteur totale de la modale à 85% de l'écran du smartphone */
    max-height: 85vh;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    flex-shrink: 0;
    /* Empêche l'entête de s'écraser */
}

/* La zone de contenu intermédiaire défile de manière fluide */
.modal-scrollable-body {
    flex: 1;
    overflow-y: auto;
    /* Active le scroll vertical si le texte est trop long */
    padding-right: 8px;
    /* Évite que la barre de défilement ne colle au texte */
    margin-bottom: 20px;
}

/* Personnalisation esthétique de la barre de défilement de la modale */
.modal-scrollable-body::-webkit-scrollbar {
    width: 6px;
}

.modal-scrollable-body::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
}

.btn-close-modal {
    width: 100%;
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    /* Force le bouton à rester fixe et entier au bas */
    transition: background-color 0.2s ease;
}

.btn-close-modal:hover {
    background-color: var(--primary-hover);
}


/* --- INDICATEUR DE TEMPS PERSONNALISÉ --- */
.track-time-badge {
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    /* Empêche le texte de sauter lors du changement de secondes */
    color: #0f172a;
    background-color: rgba(178, 179, 181, 0.1);
    padding: 3px 8px;
    border-radius: 12px;
    margin-right: 10px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

body.dark-mode .track-time-badge {
    color: #ffffff;
    /* Bleu ciel plus lisible en mode sombre */
    background-color: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* --- BARRE DE NAVIGATION PAR CATÉGORIES --- */
.categories-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
}

.btn-category {
    background-color: var(--card-bg);
    color: var(--text-light);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-category:hover {
    color: var(--text-color);
    background-color: var(--border-color);
}

/* Catégorie active */
.btn-category.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff !important;
    box-shadow: 0 4px 6px -1px rgba(29, 78, 216, 0.2);
}

body.dark-mode .btn-category:hover {
    background-color: #334155;
}

/* --- AMÉLIORATION DU CONTRASTE EN MODE SOMBRE --- */

/* 1. Force le titre de la chanson en blanc éclatant au lieu du bleu principal lorsqu'il est sélectionné */
body.dark-mode .song-card.currently-playing .song-meta h3,
body.dark-mode .song-header.currently-playing-voice h3,
body.dark-mode .voice-item.currently-playing-voice .voice-name {
    color: #ffffff !important;
    /* Blanc pur pour un contraste maximal */
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
    /* Léger halo lumineux bleu ciel pour le faire ressortir */
}

/* 2. Rend le bouton Play beaucoup plus lumineux en mode sombre */
body.dark-mode .btn-play {
    color: #38bdf8;
    /* Bleu ciel très vif et lumineux (anciennement bleu roi foncé) */
    border-color: #38bdf8;
    background-color: rgba(56, 189, 248, 0.05);
    /* Léger fond pour donner du corps au bouton */
}

/* 3. Effet au survol du bouton Play en mode sombre */
body.dark-mode .btn-play:hover {
    background-color: #38bdf8;
    color: #020617;
    /* Écrit en noir d'encre sur le fond lumineux au survol */
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

/* 4. Style du bouton Play de la ligne en cours de lecture en mode sombre */
body.dark-mode .currently-playing-voice .btn-play {
    color: #ffffff;
    border-color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
}

/* --- BOUTON DE LECTURE EN BOUCLE --- */
.btn-loop {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.btn-loop:hover {
    color: var(--text-color);
    background-color: rgba(0, 0, 0, 0.05);
}

body.dark-mode .btn-loop:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* État activé : Vert éclatant */
.btn-loop.active {
    color: #16a34a !important;
    /* Vert */
    animation: spinOnce 0.4s ease-out;
}

.btn-loop .material-icons {
    font-size: 18px;
    width: auto;
    height: auto;
}

@keyframes spinOnce {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(180deg);
    }
}


/* Adaptation mobile pour éviter les chevauchements */
@media (max-width: 480px) {
    .player-flex-layout {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .speed-control-container {
        align-self: flex-end;
        /* Aligne la vitesse à droite sur mobile */
    }

    .modal-card {
        padding: 20px;
    }

    .modal-header h2 {
        font-size: 1.2rem;
    }
}


/* Adaptation mobile */
@media (max-width: 500px) {
    .search-filter-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
}

/* La transition globale gère déjà le changement de couleur fluide en Mode Sombre */
/* --- ADAPTATION MOBILE (RESPONSIVE) --- */
@media (max-width: 600px) {

    /* Evite que le conteneur principal ne pousse les bords */
    .container {
        width: 100%;
        max-width: 100vw;
        /* réduit légèrement pour laisser de l'air */
        padding: 0 12px;
    }

    /* Froce la recherche et le bouton favorid à passer l'un sous l'autre sur petit écran */
    .search-filter-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        width: 100%;
    }

    .search-container {
        width: 100%;
    }

    /* Force le bouton favoris à prendre toute la largeur pour éviter qu'il ne dépasse à droite */
    .fav-filter-label {
        width: 100%;
        justify-content: center;
    }

    /* Empeche les cartes de musique de déborder*/
    .song-card {
        width: 100%;
        max-width: 100%;
    }

    /* 1. Centrage complet du Header (Bannière) */
    .main-banner {
        /*height: auto;*/
        height: 75%;
        padding: 0;
    }

    .banner-overlay {
        height: 100%;
        background: linear-gradient(180deg, rgba(15, 23, 42, 0.472) 0%, rgba(30, 41, 59, 0.432) 100%);
        justify-content: center;
        /* Centre le conteneur sur l'axe horizontal */
    }

    .banner-container {
        flex-direction: column;
        /* Centre tous les textes */
        text-align: center;
        /* Alignement vertical/horizontal des enfants */
        justify-content: center;
        /* Force les éléments comme le logo à se centrer */
        align-items: center;
        gap: 10px;
        padding-bottom: 6px;
    }

    .banner-logo {
        height: 75px;
        /* Garantie du centrage horizontal de l'image */
        margin: 0 auto;
    }

    .banner-text h2 {
        font-size: 1.5rem;
    }

    .banner-text p {
        font-size: 0.9rem;
        padding: 0 10px;
    }

    .top-options-container {
        /* Aligne le titre au-dessus de la cartouche sur mobile */
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    /* 2. Centrage complet du Footer (Pied de page) */
    .footer-content {
        flex-direction: column;
        justify-content: center;
        /* Aligne les blocs au centre horizontalement */
        align-items: center;
        /* Aligne les textes au centre */
        text-align: center;
        /* Centre les paragraphes */
        gap: 10px;
        /* Espace équilibré entre chaque élément */
    }

    .btn-share {
        margin: 5px 0;
        /* Ajoute un espace harmonieux au-dessus et en dessous du bouton partager */
    }

    .main-footer {
        width: 100%;
        max-width: 100vw;
        overflow: hidden;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
        width: 100%;
    }

    /* --- SÉCURITÉ ALIGNEMENT MOBILE (TOUT À LA FIN DU STYLE.CSS) --- */
    /* On s'assure que la cartouche RESTE impérativement à l'horizontale, côte à côte */
    .options-cartridge {
        display: inline-flex !important;
        flex-direction: row !important;
        align-self: center;
        /* Centre la cartouche sur mobile */
    }
}