/**
 * PROMOMEDIA Radio CMS — Player Bar
 * Styles scopés sous #pmr-player-bar pour ne pas polluer le thème.
 * La variable --pmr-accent est injectée inline depuis les réglages admin.
 */

:root {
    --pmr-accent:   #e2001a;
    --pmr-bg:       #111;
    --pmr-text:     #fff;
    --pmr-muted:    rgba(255,255,255,.55);
    --pmr-border:   rgba(255,255,255,.1);
    --pmr-radius:   4px;
    --pmr-h:        64px;
}

/* ── Barre principale ──────────────────────────────────────────── */
#pmr-player-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    height: var(--pmr-h);
    background: var(--pmr-bg);
    border-top: 1px solid var(--pmr-border);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    font-family: inherit;
    box-shadow: 0 -2px 20px rgba(0,0,0,.4);
}

/* ── Pochette ──────────────────────────────────────────────────── */
.pmr-player-cover-wrap {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: var(--pmr-radius);
    overflow: hidden;
    background: rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

#pmr-player-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity .2s;
}

.pmr-cover-fallback {
    width: 24px;
    height: 24px;
    color: var(--pmr-muted);
}

.pmr-cover-fallback svg {
    width: 100%;
    height: 100%;
}

/* ── Infos ─────────────────────────────────────────────────────── */
.pmr-player-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

#pmr-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .08em;
    color: var(--pmr-accent);
    text-transform: uppercase;
    line-height: 1;
}

#pmr-live-badge::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--pmr-accent);
    animation: pmr-pulse 1.5s ease-in-out infinite;
}

.pmr-player-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--pmr-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.pmr-player-artist {
    font-size: 11px;
    color: var(--pmr-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* ── Seekbar podcast ───────────────────────────────────────────── */
.pmr-seekbar {
    cursor: pointer;
    padding: 4px 0;
}

.pmr-seekbar-track {
    height: 3px;
    background: rgba(255,255,255,.15);
    border-radius: 2px;
    overflow: hidden;
}

.pmr-seekbar-fill {
    height: 100%;
    background: var(--pmr-accent);
    width: 0%;
    transition: width .5s linear;
}

.pmr-podcast-time {
    font-size: 10px;
    color: var(--pmr-muted);
}

/* ── Contrôles ─────────────────────────────────────────────────── */
.pmr-player-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.pmr-play-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--pmr-accent);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s, opacity .15s;
    padding: 0;
}

.pmr-play-btn:hover  { transform: scale(1.08); }
.pmr-play-btn:active { transform: scale(.95); opacity: .8; }

.pmr-play-btn svg {
    width: 20px;
    height: 20px;
    color: #fff;
    fill: #fff;
}

.pmr-ctrl-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--pmr-muted);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .15s;
}

.pmr-ctrl-btn:hover { color: var(--pmr-text); }
.pmr-ctrl-btn svg   { width: 18px; height: 18px; fill: currentColor; }

.pmr-go-live-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--pmr-accent);
    background: transparent;
    color: var(--pmr-accent);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: var(--pmr-radius);
    cursor: pointer;
    transition: background .15s, color .15s;
    white-space: nowrap;
}

.pmr-go-live-btn:hover {
    background: var(--pmr-accent);
    color: #fff;
}

.pmr-go-live-btn svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
    flex-shrink: 0;
}

/* ── Sélecteur de stations ─────────────────────────────────────── */
.pmr-station-selector-wrap {
    position: relative;
    flex-shrink: 0;
}

.pmr-station-toggle-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    width: auto;
    height: auto;
    background: transparent;
    border: 1px solid var(--pmr-accent);
    border-radius: var(--pmr-radius);
    color: var(--pmr-accent);
    fill: currentColor;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.pmr-station-toggle-btn:hover {
    background: var(--pmr-accent);
    color: #fff;
}
.pmr-station-toggle-btn svg:first-child { width: 12px; height: 12px; fill: currentColor; flex-shrink: 0; }
.pmr-station-toggle-arrow { width: 12px; height: 12px; fill: currentColor; flex-shrink: 0; transition: transform .2s; }
.pmr-station-toggle-btn[aria-expanded="true"] .pmr-station-toggle-arrow { transform: rotate(180deg); }

.pmr-station-picker {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    max-width: 280px;
    max-height: 320px;
    overflow-y: auto;
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,.6);
    z-index: 200;
    padding: 6px;
    scrollbar-width: thin;
}

.pmr-picker-search-wrap {
    padding: 6px 6px 2px;
    position: sticky;
    top: 0;
    background: #1a1a1a;
    z-index: 1;
}

.pmr-picker-search {
    width: 100%;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 4px;
    color: #fff;
    font-size: 12px;
    padding: 6px 10px;
    outline: none;
}

.pmr-picker-search::placeholder { color: rgba(255,255,255,.35); }
.pmr-picker-search:focus { border-color: var(--pmr-accent); }

.pmr-picker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: rgba(255,255,255,.8);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    transition: background .15s, color .15s;
}

.pmr-picker-item:hover { background: rgba(255,255,255,.08); color: #fff; }

.pmr-picker-cover {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.pmr-picker-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.pmr-picker-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Volume ────────────────────────────────────────────────────── */
.pmr-player-volume-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.pmr-vol-icon {
    width: 16px;
    height: 16px;
    color: var(--pmr-muted);
    fill: currentColor;
    flex-shrink: 0;
}

.pmr-volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    height: 3px;
    border-radius: 2px;
    background: rgba(255,255,255,.2);
    outline: none;
    cursor: pointer;
}

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

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

/* ── Utilitaires ───────────────────────────────────────────────── */
.pmr-hidden { display: none !important; }

/* ── Ajouter la hauteur du player au body pour ne pas masquer le contenu ── */
body { padding-bottom: calc(var(--pmr-h) + 4px); }

/* ── Animation pulse ───────────────────────────────────────────── */
@keyframes pmr-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .3; }
}

.pmr-station-toggle-label { font-size: inherit; font-weight: inherit; }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .pmr-player-volume-wrap        { display: none; }
    .pmr-go-live-btn span          { display: none; }
    .pmr-station-toggle-label      { display: none; }
    .pmr-volume-slider             { width: 60px; }
}
