/* Player Sticky V2 */
:root {
    --player-height: 80px;
    --player-bg: rgba(18, 18, 18, 0.95);
    --player-border: rgba(255, 255, 255, 0.1);
    --player-text: #ffffff;
    --player-subtext: #aaaaaa;
    --player-accent: #e50914; /* Rouge Diezstar */
}

.sticky-player {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--player-height);
    background-color: var(--player-bg);
    border-top: 1px solid var(--player-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    display: flex;
    justify-content: center;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.sticky-player.visible {
    transform: translateY(0);
}

.player-container {
    width: 100%;
    max-width: 1400px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

/* Track Info (Left) */
.player-track-info {
    display: flex;
    align-items: center;
    width: 300px;
    min-width: 200px;
}

.player-thumbnail {
    width: 56px;
    height: 56px;
    border-radius: 4px;
    overflow: hidden;
    margin-right: 15px;
    background-color: #333;
    position: relative;
    flex-shrink: 0;
}

.player-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.player-meta {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.player-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--player-text);
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-artist {
    font-size: 12px;
    color: var(--player-subtext);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Controls (Center) */
.player-controls-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 600px;
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 8px;
}

.control-btn {
    background: none;
    border: none;
    color: var(--player-subtext);
    cursor: pointer;
    transition: color 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

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

.control-btn:active {
    transform: scale(0.95);
}

.control-btn.lg {
    width: 40px;
    height: 40px;
    background-color: var(--player-text);
    color: #000;
    border-radius: 50%;
}

.control-btn.lg:hover {
    transform: scale(1.05);
}

/* Progress Bar */
.player-progress-container {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
}

.time-display {
    font-size: 11px;
    color: var(--player-subtext);
    width: 35px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.progress-bar-wrapper {
    flex: 1;
    height: 4px;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.progress-bar-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.progress-bar-fill {
    position: absolute;
    height: 100%;
    background-color: var(--player-text);
    border-radius: 2px;
    width: 0%;
    pointer-events: none;
}

.seek-slider {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    margin: 0;
    z-index: 2;
}

.progress-bar-wrapper:hover .progress-bar-fill {
    background-color: var(--player-accent);
}

/* Options (Right) */
.player-options {
    width: 300px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 15px;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.volume-slider-wrapper {
    width: 80px;
    display: flex;
    align-items: center;
}

.volume-slider {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--player-text);
    border-radius: 50%;
    cursor: pointer;
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    :root {
        --player-height: 60px; /* Hauteur fixe ≤60px */
    }

    .sticky-player {
        /* Respecter les safe areas iOS/Android */
        padding-bottom: env(safe-area-inset-bottom, 0);
        height: calc(var(--player-height) + env(safe-area-inset-bottom, 0));
        /* Pas de reflow, position fixe */
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
    }

    .player-container {
        flex-wrap: nowrap; /* Layout horizontal compact */
        padding: 8px 10px;
        gap: 8px;
        height: 100%;
        align-items: center;
        /* Pas de saut de ligne */
        overflow: hidden;
    }

    /* Track Info - Compact, pas de débordement */
    .player-track-info {
        width: auto;
        min-width: 0;
        flex: 1 1 auto;
        overflow: hidden;
        display: flex;
        align-items: center;
    }

    .player-thumbnail {
        width: 44px;
        height: 44px;
        margin-right: 8px;
        flex-shrink: 0;
    }

    .player-meta {
        min-width: 0;
        flex: 1;
        overflow: hidden;
    }

    .player-title {
        font-size: 12px;
        margin-bottom: 2px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .player-artist {
        font-size: 10px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Controls - Centré, compact */
    .player-controls-wrapper {
        flex: 0 0 auto;
        max-width: none;
        width: auto;
        min-width: 0;
    }

    .player-controls {
        gap: 8px;
        margin-bottom: 2px;
    }

    .control-btn.lg {
        width: 32px;
        height: 32px;
    }

    .control-btn.sm {
        width: 24px;
        height: 24px;
    }

    /* Progress bar - Plus fine, masquer les temps sur mobile */
    .player-progress-container {
        gap: 4px;
    }

    .time-display {
        display: none; /* Masquer les temps sur mobile pour compacité */
    }

    .progress-bar-wrapper {
        height: 2px;
    }

    /* Options - Masquer complètement sur mobile */
    .player-options {
        display: none;
    }
    
    .volume-control {
        display: none;
    }

    /* Masquer prev/next sur mobile pour plus de compacité */
    .player-controls .control-btn.sm:first-child,
    .player-controls .control-btn.sm:last-child {
        display: none;
    }
}
