/* =============================================================
   RADIO CHÂTAIGNE — player.css
   Styles du lecteur audio, mode replay SoundCloud,
   bannière flottante et formulaire de chat.
   Chargé après style.css dans <head>.
   ============================================================= */


/* ── VARIABLES GLOBALES ──────────────────────────────────────
   Toutes les valeurs visuelles centralisées ici.
   Modifier ces variables suffit pour un reskin complet.
   ------------------------------------------------------------ */
:root {
  --rcp-bg:           #fff;
  --rcp-fg:           #111;
  --rcp-muted:        #6b7280;
  --rcp-accent:       #111;
  --rcp-radius:       18px;
  --rcp-shadow:       0 10px 24px rgba(0,0,0,.06);
  --rcp-ring:         0 0 0 3px rgba(0,0,0,.08);
  /* Largeur max synchronisée avec #mainContainer via ui.js */
  --rcp-main-width:   980px;
}


/* ── CONTENEUR PRINCIPAL ─────────────────────────────────────
   Bande horizontale abritant tous les éléments du player.
   ------------------------------------------------------------ */
.rcp-player {
  background:    var(--rcp-bg);
  color:         var(--rcp-fg);
  width:         100%;
  max-width:     var(--rcp-main-width);
  padding:       6px 10px;
  border-radius: var(--rcp-radius);
  box-shadow:    var(--rcp-shadow);
  margin-inline: auto;
  display:       flex;
  align-items:   center;
  gap:           10px;
  flex-wrap:     nowrap;
}

/* Titre masqué (non utilisé visuellement, conservé pour a11y) */
.rcp-title { display: none; }


/* ── INDICATEUR DIRECT ───────────────────────────────────────
   Pastille rouge + texte "Direct" / "Hors antenne"
   ------------------------------------------------------------ */
.rcp-live {
  display:     inline-flex;
  align-items: center;
  gap:         6px;
  font-size:   12px;
  color:       var(--rcp-muted);
  white-space: nowrap;
}

.rcp-live-dot {
  width:         8px;
  height:        8px;
  border-radius: 999px;
  background:    #ef4444;
  box-shadow:    0 0 0 3px rgba(239,68,68,.15);
}

/* Hors antenne : pastille grise sans halo */
.rcp-live-dot.off {
  background: #9ca3af;
  box-shadow: none;
}


/* ── TITRE EN COURS ──────────────────────────────────────────
   Zone "En ce moment : [titre]".
   L'effet marquee est activé dynamiquement par player.js
   si le texte déborde du conteneur.
   ------------------------------------------------------------ */
.rcp-now {
  display:     flex;
  align-items: baseline;
  gap:         6px;
  margin:      0;
  overflow:    hidden;
  flex:        1 1 auto;
  min-width:   0;
}

.rcp-now-label {
  color:          var(--rcp-muted);
  font-size:      11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-weight:    700;
  white-space:    nowrap;
  flex-shrink:    0;
}

.rcp-now-title {
  position:    relative;
  overflow:    hidden;
  white-space: nowrap;
  font-size:   13px;
  font-weight: 700;
  display:     block;
  min-width:   0;
}

/* Défilement du titre quand il dépasse la largeur disponible */
.rcp-now-title.rcp-marquee .rcp-marquee-inner {
  display:     inline-block;
  white-space: nowrap;
  will-change: transform;
  animation:   rcp-marquee var(--rcp-marquee-duration, 12s) linear infinite;
}

.rcp-now-title.rcp-marquee .rcp-track {
  display:       inline-block;
  padding-right: 32px; /* espace entre les deux copies du texte */
}

@keyframes rcp-marquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Éléments désactivés dans la version actuelle */
.rcp-status,
.rcp-footer,
.rcp-now-sub { display: none; }


/* ── BOUTONS DE CONTRÔLE ─────────────────────────────────────
   Groupe play / mute / open-in-new-tab, aligné à droite.
   ------------------------------------------------------------ */
.rcp-controls {
  display:     flex;
  align-items: center;
  gap:         8px;
  margin-left: auto;
  flex:        0 0 auto;
}

.rcp-btn {
  -webkit-tap-highlight-color: transparent;
  cursor:        pointer;
  border:        none;
  background:    #fff;
  color:         var(--rcp-fg);
  border-radius: 999px;
  box-shadow:    var(--rcp-shadow);
  width:         32px;
  height:        32px;
  display:       grid;
  place-items:   center;
  transition:    transform .08s ease, box-shadow .2s ease;
}

.rcp-btn:active        { transform: scale(.98); }
.rcp-btn:focus-visible { outline: none; box-shadow: var(--rcp-shadow), var(--rcp-ring); }

.rcp-btn-icon {
  width:  14px;
  height: 14px;
}


/* ── RESPONSIVE MOBILE ───────────────────────────────────────
   Boutons et titre légèrement réduits sous 768px.
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  .rcp-player    { gap: 8px; }
  .rcp-btn       { width: 28px; height: 28px; }
  .rcp-btn-icon  { width: 12px; height: 12px; }
  .rcp-now-title { font-size: 12.5px; }
}


/* ── PLAYER DOCKÉ (desktop) ──────────────────────────────────
   Quand l'utilisateur clique sur un lien de menu, ui.js
   applique .is-docked et fixe le player en bas de l'écran.
   overflow:visible est essentiel pour que le panneau historique
   puisse flotter au-dessus sans être clippé.
   ------------------------------------------------------------ */
.player_container.is-docked {
  position:  fixed;
  left:      50%;
  transform: translateX(-50%);
  bottom:    auto;
  z-index:   1000;
  overflow:  visible;
}

/* ── PANNEAU HISTORIQUE EN MODE DOCKÉ ───────────────────────
   Sort du flux normal et flotte au-dessus du player.
   Le player ne bouge pas — seul le panneau se repositionne.
   ------------------------------------------------------------ */
.player_container.is-docked .rcp-history-panel {
  position:      absolute;
  bottom:        calc(100% + 6px);
  left:          0;
  right:         0;
  margin:        0;
  border-radius: 10px;
  box-shadow:    0 -8px 32px rgba(0,0,0,.35);
}

/* Bande titre mobile : sort aussi du flux en docké */
.player_container.is-docked .rcp-nowplaying-band {
  position:      absolute;
  bottom:        calc(100% + 6px);
  left:          0;
  right:         0;
  margin:        0;
  border-radius: 8px;
}

/* Mobile docké : historique passe au-dessus de la bande (~52px) */
@media (max-width: 768px) {
  .player_container.is-docked .rcp-history-panel.open {
    bottom: calc(100% + 52px + 10px);
  }
}

/* Desktop docké : bande invisible, historique colle direct au-dessus */
@media (min-width: 769px) {
  .player_container.is-docked .rcp-history-panel.open {
    bottom: calc(100% + 6px);
  }
  .player_container.is-docked .rcp-nowplaying-band {
    display: none;
  }
}






/* ── MODE REPLAY SOUNDCLOUD ──────────────────────────────────
   player.js ajoute .rcp-replay-mode sur .rcp-player au lancement
   d'un replay. Les éléments "direct" sont masqués et remplacés
   par le badge "En replay".
   ------------------------------------------------------------ */
.rcp-player.rcp-replay-mode .rcp-live { display: none; }

.rcp-player.rcp-replay-mode .rcp-replay-badge {
  display:        inline-flex !important;
  align-items:    center;
  gap:            5px;
  font-size:      11px;
  font-weight:    700;
  color:          #6b7280;
  white-space:    nowrap;
  letter-spacing: .04em;
  text-transform: uppercase;
  flex-shrink:    0;
}

/* Masqué par défaut, affiché uniquement en mode replay */
.rcp-replay-badge { display: none; }

.rcp-replay-badge-dot {
  width:         8px;
  height:        8px;
  border-radius: 50%;
  background:    #6b7280;
}

/* Le label "En ce moment" devient gris en mode replay */
.rcp-player.rcp-replay-mode .rcp-now-label { color: #6b7280; }


/* ── BOUTON "REVENIR AU DIRECT" (dans le player) ─────────────
   Visible uniquement en mode replay à la place du bouton open.
   ------------------------------------------------------------ */
#rcp-back-live {
  display:        none; /* rendu visible par .rcp-replay-mode */
  align-items:    center;
  gap:            6px;
  background:     #fff;
  color:          #111;
  border:         2px solid #ef4444;
  border-radius:  999px;
  padding:        0 14px;
  height:         34px;
  font-size:      12px;
  font-weight:    800;
  letter-spacing: .01em;
  cursor:         pointer;
  white-space:    nowrap;
  flex-shrink:    0;
  transition:     background .15s, color .15s, transform .1s;
  box-shadow:     0 2px 10px rgba(239,68,68,.25);
}

#rcp-back-live:hover  { background: #ef4444; color: #fff; transform: scale(1.03); }
#rcp-back-live:active { transform: scale(.97); }

/* Pastille pulsante à l'intérieur du bouton */
#rcp-back-live .rcp-live-dot-btn {
  width:         7px;
  height:        7px;
  background:    #fff;
  border-radius: 50%;
  animation:     rcp-pulse-btn 1.4s ease-in-out infinite;
  flex-shrink:   0;
}

@keyframes rcp-pulse-btn {
  0%, 100% { opacity: 1;  transform: scale(1);  }
  50%      { opacity: .5; transform: scale(.7); }
}

.rcp-player.rcp-replay-mode #rcp-back-live { display: flex; }
.rcp-player.rcp-replay-mode #rcp-open      { display: none; }


/* ── BANNIÈRE FLOTTANTE "REVENIR AU DIRECT" ──────────────────
   Toast fixé en bas de l'écran pendant un replay SC.
   Rendu visible par player.js via la classe .visible.
   ------------------------------------------------------------ */
#rcp-live-float {
  display:        none; /* remplacé par flex quand .visible */
  position:       fixed;
  bottom:         20px;
  left:           50%;
  transform:      translateX(-50%) translateY(4px);
  z-index:        999;
  background:     #111;
  border:         1.5px solid rgba(255,255,255,.2);
  border-radius:  999px;
  color:          #fff;
  font-family:    f2, monospace;
  font-size:      0.73em;
  letter-spacing: .04em;
  padding:        8px 20px 8px 14px;
  cursor:         pointer;
  white-space:    nowrap;
  align-items:    center;
  gap:            10px;
  box-shadow:     0 8px 32px rgba(0,0,0,.5);
  transition:     background .15s, border-color .15s, transform .2s;
  opacity:        0;
}

#rcp-live-float.visible {
  display:   flex;
  animation: rcp-float-in .3s ease forwards;
}

@keyframes rcp-float-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

#rcp-live-float:hover {
  background:    #222;
  border-color:  rgba(255,255,255,.5);
}

#rcp-live-float strong       { color: #ef4444; font-weight: 700; }

#rcp-live-float .rcp-float-dot {
  width:         8px;
  height:        8px;
  background:    #ef4444;
  border-radius: 50%;
  animation:     rcp-pulse-btn 1.4s ease-in-out infinite;
  flex-shrink:   0;
}

@media (max-width: 768px) {
  #rcp-live-float {
    bottom:   70px;
    font-size: 0.68em;
    padding:  7px 16px 7px 12px;
  }
}


/* ── BANDE TITRE EN ÉVIDENCE (mobile uniquement) ────────────
   Masquée sur desktop, visible uniquement sous 768px.
   Fond noir, typographie monospace dans le style Châtaigne.
   ------------------------------------------------------------ */

@media (max-width: 768px) {

  .rcp-now-label{
    display: none;
  }


}

@keyframes rcp-band-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}


/* ── PANNEAU HISTORIQUE ──────────────────────────────────────
   S'ouvre sous la bande titre via la classe .open.
   Hauteur max fixe avec scroll interne.
   ------------------------------------------------------------ */
.rcp-history-panel {
  width:          100%;
  max-width:      var(--rcp-main-width);
  margin-inline:  auto;
  margin-top:     4px;
  background:     #111;
  border-radius:  10px;
  overflow:       hidden;
  max-height:     0;
  opacity:        0;
  transition:     max-height .35s ease, opacity .25s ease;
  pointer-events: none;
}

.rcp-history-panel.open {
  max-height:     340px;
  opacity:        1;
  pointer-events: auto;
}

.rcp-history-header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         9px 16px;
  border-bottom:   1px dotted rgba(255,255,255,.15);
}

.rcp-history-title {
  font-family:    f2, monospace;
  font-size:      0.7em;
  letter-spacing: .1em;
  text-transform: uppercase;
  color:          rgba(255,255,255,.5);
}

.rcp-history-close {
  background:  none;
  border:      none;
  color:       rgba(255,255,255,.4);
  cursor:      pointer;
  font-size:   0.9em;
  line-height: 1;
  padding:     2px 6px;
  transition:  color .15s;
}
.rcp-history-close:hover { color: #fff; }

.rcp-history-list {
  list-style:      none;
  margin:          0;
  padding:         6px 0;
  max-height:      275px;
  overflow-y:      auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}

.rcp-history-list li {
  display:       flex;
  align-items:   baseline;
  gap:           12px;
  padding:       6px 16px;
  border-bottom: 1px dotted rgba(255,255,255,.06);
  font-family:   f2, monospace;
  font-size:     0.75em;
  color:         #fff;
}

.rcp-history-list li:last-child { border-bottom: none; }

.rcp-history-empty {
  color:           rgba(255,255,255,.3) !important;
  justify-content: center;
  border:          none !important;
  padding:         18px !important;
  font-size:       0.72em !important;
}

.rcp-history-time {
  color:       rgba(255,255,255,.38);
  font-size:   0.9em;
  white-space: nowrap;
  flex-shrink: 0;
}

.rcp-history-track {
  overflow:      hidden;
  text-overflow: ellipsis;
  white-space:   nowrap;
  flex:          1 1 auto;
}

.rcp-history-info {
  display:    flex;
  flex-direction: column;
  overflow:   hidden;
  flex:       1 1 auto;
  min-width:  0;
  gap:        1px;
}

.rcp-history-genre {
  font-size:      0.82em;
  color:          rgba(255,255,255,.3);
  white-space:    nowrap;
  overflow:       hidden;
  text-overflow:  ellipsis;
  letter-spacing: .03em;
}

/* Bouton historique actif (panneau ouvert) */
#rcp-history-btn.active {
  background: #111;
  color:      #fff;
  box-shadow: none;
}

@media (max-width: 768px) {
  .rcp-history-panel.open { max-height: 250px; }
  .rcp-history-list       { max-height: 200px; }
}


/* ── FORMULAIRE DE CHAT ──────────────────────────────────────
   Champs pseudo / message et bouton d'envoi.
   ------------------------------------------------------------ */
.chat_form input {
  display:     block;
  width:       90%;
  margin:      3px auto;
  background:  rgba(0,0,0,.55);
  border:      1px dotted rgba(255,255,255,.7);
  color:       #fff;
  font-family: f2, monospace;
  font-size:   0.8em;
  padding:     5px 8px;
  box-sizing:  border-box;
  outline:     none;
}

.chat_form input:focus {
  background:   rgba(0,0,0,.75);
  border-color: white;
}

.chat_form input::placeholder { color: rgba(255,255,255,.5); }

.chat_send_btn {
  display:        block;
  width:          90%;
  margin:         4px auto 0;
  background:     rgba(0,0,0,.45);
  border:         1px dotted white;
  color:          #fff;
  font-family:    f2, monospace;
  font-size:      0.72em;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding:        5px 4px;
  cursor:         pointer;
  transition:     background .12s, color .12s;
}

.chat_send_btn:hover {
  background: white;
  color:      #000;
}
