/* Styles pour le lecteur sticky global */
#memoria-global-player {
    position: fixed;
    bottom: env(safe-area-inset-bottom, 0);
    left: 0;
    width: 100%;
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.2, 0, 0, 1);
    
    --memoria-player-bg: rgba(30, 30, 30, 0.7);
    --memoria-player-text: #ffffff;
    --memoria-player-icon: #ffffff;
    --memoria-player-icon-hover-bg: rgba(255, 255, 255, 0.1);
    --memoria-player-progress: #ffffff;
    --memoria-player-blur: 15px;
}

/* Ajustements pour la tab bar native mobile */
@media screen and (max-width: 768px) {
    #memoria-global-player {
        /* Espace pour la tab bar mobile Safari iOS - remontée de 11px */
        bottom: 74px; /* 63px + 11px = 74px */
    }
    
    /* Pour les appareils avec safe areas (iPhone X+) */
    @supports (bottom: env(safe-area-inset-bottom)) {
        #memoria-global-player {
            /* Tab bar height + safe area inset + 11px */
            bottom: calc(74px + env(safe-area-inset-bottom, 0));
        }
    }
    
    /* Ajustement spécifique pour iOS Safari en mode portrait */
    @media screen and (max-width: 768px) and (orientation: portrait) {
        #memoria-global-player {
            bottom: 81px; /* 70px + 11px = 81px */
        }
        
        @supports (bottom: env(safe-area-inset-bottom)) {
            #memoria-global-player {
                bottom: calc(81px + env(safe-area-inset-bottom, 0));
            }
        }
    }
}

/* Ajustements pour les écrans plus grands (desktop/tablet) */
@media screen and (min-width: 769px) {
    #memoria-global-player {
        bottom: 0;
        z-index: 10000; /* Z-index normal sur desktop */
        /* Pas de tab bar native sur desktop */
    }
}

#memoria-global-player.is-active {
    transform: translateY(0);
}

.memoria-player-inner-wrap {
    max-width: 600px;
    margin: 0 auto 1rem auto;
    padding: 0.8rem;
    background: var(--memoria-player-bg);
    backdrop-filter: blur(var(--memoria-player-blur)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--memoria-player-blur)) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--memoria-radius, 1.2em);
    box-shadow: 0 0 30px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
}

/* Insta Story Bars */
.memoria-story-progress-bars {
    display: flex;
    gap: 4px;
    padding: 0 0 12px 0;
}
.memoria-story-bar {
    flex-grow: 1;
    height: 3px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 1.5px;
    overflow: hidden;
}
.memoria-story-bar-progress {
    width: 0;
    height: 100%;
    background-color: var(--memoria-player-progress);
    border-radius: 1.5px;
    transition: width 0.1s linear;
}

.memoria-player-main-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    color: var(--memoria-player-text);
    width: 100%;
}

.memoria-track-title {
    color: #ffffff;
    text-align: center;
    padding: 8px 15px;
    margin: 0;
    font-size: 1em;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.memoria-player-center-controls {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-shrink: 0;
}

.memoria-player-left-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    flex-shrink: 0;
}

.memoria-player-right-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.memoria-player-btn {
    background: transparent;
    border: none;
    color: var(--memoria-player-icon);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}
.memoria-player-btn:hover {
    background-color: var(--memoria-player-icon-hover-bg);
}
.memoria-player-btn.play-pause-btn {
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
    background-color: #fff;
    color: #000;
}
.memoria-player-btn.play-pause-btn:hover {
    background-color: #eee;
}

/* Playlist */
.memoria-player-playlist-toggle {
    background: transparent;
    border: none;
    color: var(--memoria-player-icon);
    cursor: pointer;
}

.memoria-player-playlist {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-in-out;
}
.memoria-player-playlist.is-open {
    max-height: 250px;
    overflow-y: auto;
    margin-top: 1rem;
}
#memoria-playlist-items {
    list-style: none;
    padding: 0;
    margin: 0;
}
#memoria-playlist-items li {
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--memoria-player-text);
}
#memoria-playlist-items li:hover {
    background-color: rgba(255,255,255,0.1);
}
#memoria-playlist-items li.is-active {
    background-color: rgba(255,255,255,0.2);
}
#memoria-playlist-items .memoria-playlist-cover {
    width: 40px;
    height: 40px;
}
#memoria-playlist-items .memoria-playlist-title {
    font-size: 0.9rem;
}

/* Ajustements supplémentaires pour différents navigateurs mobiles */

/* Chrome/Android */
@media screen and (max-width: 768px) {
    @supports (-webkit-appearance: none) {
        #memoria-global-player {
            /* Chrome mobile avec bottom bar + 11px */
            bottom: 71px; /* 60px + 11px = 71px */
        }
    }
}

/* Firefox mobile */
@media screen and (max-width: 768px) {
    @-moz-document url-prefix() {
        #memoria-global-player {
            bottom: 66px; /* 55px + 11px = 66px */
        }
    }
}

/* Ajustement pour les très petits écrans */
@media screen and (max-width: 480px) {
    .memoria-player-inner-wrap {
        margin: 0 auto 0.5rem auto;
        padding: 0.6rem;
    }
    
    .memoria-track-title {
        font-size: 0.9rem;
        padding: 6px 12px;
    }
    
    .memoria-player-btn {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    
    .memoria-player-btn.play-pause-btn {
        width: 40px;
        height: 40px;
    }
}
