/* ==========================================================================
   1. CONTENEUR PRINCIPAL & CONSTANTES
   ========================================================================== */
:root {
    --fs-primary: #111111;
    --fs-bg-light: #f5f5f5;
    --fs-border: #dcdcdc;
    --fs-accent: #0073aa; /* Couleur WordPress par défaut, s'adaptera à Divi */
    --fs-color-playing: red;
    --fs-radius: 8px;
    --fs-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

#fs-music-player-container {
    max-width: 600px;
    margin: 2rem auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   2. BARRE DE CONTRÔLE
   ========================================================================== */
.fs-controls-bar {
    display: flex;
    flex-direction: column; /* Empile les deux lignes */
    gap: 12px;
    margin-bottom: 1.5rem;
    background: #eef3f0;
    padding: 1rem;
    border-radius: var(--fs-radius);
}

.fs-main-controls, .fs-sub-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.fs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    background: #f9f9f9;
    border: 1px solid var(--fs-border);
    border-radius: var(--fs-radius);
    cursor: pointer;
    transition: var(--fs-transition);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.fs-btn:hover {
    background: #ffffff;
    border-color: #b5b5b5;
    transform: translateY(-1px);
}

.fs-btn:active {
    transform: translateY(1px);
    box-shadow: none;
}

.fs-btn .fs-icon {
    font-size: 1.1rem;
    color: var(--fs-primary);
}

/* États actifs pour Shuffle et Loop */
.fs-btn#fs-shuffle.shuffle-active,
.fs-btn#fs-loop.loop-active {
    background: var(--fs-accent);
    border-color: var(--fs-accent);
}
.fs-btn#fs-shuffle.shuffle-active .fs-icon,
.fs-btn#fs-loop.loop-active .fs-icon {
    color: #ffffff;
}

/* ==========================================================================
   3. ZONE PLAYLIST (Nice to have)
   ========================================================================== */
.fs-playlist-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 1.5rem;
    padding: 10px;
    background: #f9f9f9;
    border-radius: var(--fs-radius);
}

.fs-action-link {
    background: none;
    border: none;
    color: #666;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--fs-transition);
    text-decoration: underline;
    margin: 0 5px;
    padding: 5px;
}

.fs-action-link:hover {
    color: var(--fs-accent);
}

/* ==========================================================================
   4. LISTE DES TITRES, PROGRESSION & ACCORDÉONS
   ========================================================================== */
#fs-track-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.fs-loading {
    text-align: center;
    color: #888;
    font-style: italic;
    padding: 1rem;
}

.fs-track-item {
    border-bottom: 1px solid var(--fs-border);
    transition: var(--fs-transition);
}

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

/* Ligne principale */
.fs-track-main {
    display: flex;
    align-items: center;
    padding: 12px 6px;
    gap: 12px;
}

/* Style de la ligne quand elle est cochée/active */
.fs-track-item.is-active {
    background-color: rgba(0, 115, 170, 0.02);
}

/* Style de la ligne en cours de lecture */
.fs-track-item.is-playing .fs-track-title {
    color: var(--fs-color-playing);
    font-weight: 600;
}

/* Conteneur Titre + Barre de progression */
.fs-title-progress-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    min-width: 0;
}

.fs-track-title {
    font-size: 0.95rem;
    color: var(--fs-primary);
    user-select: none;
    cursor: pointer; /* Indique clairement que le titre est interactif */
}

/* Barre de progression */
.fs-progress-bg {
    width: 100%;
    height: 6px; /* Légèrement épaissie pour une meilleure visibilité UX */
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    display: none; /* Cachée par défaut */
    cursor: pointer;
    margin-top: 2px;
}

/* Forçage de l'affichage en cours de lecture (évite les conflits Divi) */
.fs-track-item.is-playing .fs-progress-bg {
    display: block !important;
}

.fs-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--fs-color-playing);
    transition: width 0.1s linear;
    pointer-events: none; /* Le clic est capté par fs-progress-bg */
}

/* Custom Checkbox */
.fs-checkbox-container {
    display: block;
    position: relative;
    width: 22px;
    height: 22px;
    cursor: pointer;
}

.fs-track-checkbox {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.fs-checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 22px;
    width: 22px;
    background-color: #fff;
    border: 2px solid var(--fs-border);
    border-radius: 4px;
    transition: var(--fs-transition);
}

.fs-checkbox-container:hover .fs-track-checkbox ~ .fs-checkmark {
    border-color: #b5b5b5;
}

.fs-track-checkbox:checked ~ .fs-checkmark {
    background-color: var(--fs-accent);
    border-color: var(--fs-accent);
}

.fs-checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.fs-track-checkbox:checked ~ .fs-checkmark:after {
    display: block;
}

.fs-checkbox-container .fs-checkmark:after {
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Bouton + info */
.fs-info-toggle {
    background: none;
    border: none;
    color: #888;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 4px;
    transition: var(--fs-transition);
}

.fs-info-toggle:hover {
    background: var(--fs-bg-light);
    color: var(--fs-primary);
}

/* Accordéon animé */
.fs-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0, 1, 0, 1);
    background: var(--fs-bg-light);
}

.fs-accordion-content.open {
    max-height: 1000px;
    transition: max-height 0.3s cubic-bezier(1, 0, 1, 0);
}

.fs-accordion-inner {
    padding: 12px 16px;
    font-size: 0.88rem;
    line-height: 1.5;
    color: #555;
}


/* ==========================================================================
   5. RESPONSIVE DESIGN (Ajustements Mobile uniquement)
   ========================================================================== */
@media (max-width: 480px) {
    
    #fs-music-player-container {
        padding: 1rem;
        margin: 1rem auto;
    }
    
    .fs-controls-bar {
        gap: 8px;
        padding: 0.75rem;
    }
    
    .fs-btn { 
        width: 42px !important; 
        height: 42px !important; 
    }
    
    .fs-track-title {
        font-size: 0.9rem;
        line-height: 1.2 !important;
    }
    
    .fs-track-main {
        gap: 24px !important; /* On passe de 12px à 24px pour doubler l'espace */
    }
}