/* ═══════════════════════════════════════════════════════
   Radio Musique Libre — Player Widget
   Layout  : paysage desktop / colonne unique mobile
   Thème   : fond blanc, accents palette chakra (rouge → violet)
   Ambiance: gradient animé original conservé
═══════════════════════════════════════════════════════ */

/* ── Variables ── */
#rml-player-wrap,
#rml-player-wrap *,
#rml-player-wrap *::before,
#rml-player-wrap *::after {
  box-sizing: border-box;
}

/* Reset défensif — neutralise les styles natifs/thème WordPress sur <button> et <svg> */
#rml-player-wrap button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  -webkit-appearance: none;
  appearance: none;
}
#rml-player-wrap svg { display: block; }
/* Palette chakra sur :root — héritée par tous les shortcodes modulaires */
:root {
  --rml-c1:     #ff0000;
  --rml-c2:     #ff8c00;
  --rml-c3:     #ffd400;
  --rml-c4:     #00c853;
  --rml-c5:     #00b8d4;
  --rml-c6:     #3d5afe;
  --rml-c7:     #9c27b0;
  --rml-grad:   linear-gradient(90deg, #ff0000, #ff8c00, #ffd400, #00c853, #00b8d4, #3d5afe, #9c27b0);
  --rml-grad135:linear-gradient(135deg, #ff0000, #ff8c00, #ffd400, #00c853, #00b8d4, #3d5afe, #9c27b0);
  --rml-grad-volume: linear-gradient(90deg, #ff0000, #ff8c00, #ffd400, #00c853, #00b8d4, #3d5afe, #9c27b0);
}

#rml-player-wrap {
  width: 100%;
  --rml-c1:     #ff0000;
  --rml-c2:     #ff8c00;
  --rml-c3:     #ffd400;
  --rml-c4:     #00c853;
  --rml-c5:     #00b8d4;
  --rml-c6:     #3d5afe;
  --rml-c7:     #9c27b0;
  --rml-grad:   linear-gradient(90deg, #ff0000, #ff8c00, #ffd400, #00c853, #00b8d4, #3d5afe, #9c27b0);
  --rml-grad135:linear-gradient(135deg, #ff0000, #ff8c00, #ffd400, #00c853, #00b8d4, #3d5afe, #9c27b0);
  --rml-grad-volume: linear-gradient(90deg, #ff0000, #ff8c00, #ffd400, #00c853, #00b8d4, #3d5afe, #9c27b0);
  --rml-bg:     #ffffff;
  --rml-card:   #fafafa;
  --rml-border: rgba(0,0,0,.09);
  --rml-text:   #0d0d14;
  --rml-muted:  rgba(13,13,20,.42);
  --rml-glass:  rgba(255,0,0,.05);

  display: flex;
  justify-content: center;
  font-family: 'DM Sans', sans-serif;
}

/* ── Carte principale ── */
#rml-player-wrap .player {
  width: 100%;
  max-width: 800px;
  min-width: 0;
  background: var(--rml-bg);
  border-radius: 24px;
  border: 1px solid var(--rml-border);
  box-shadow:
    0 0 0 1px rgba(255,0,0,.06),
    0 24px 60px rgba(0,0,0,.08),
    0 0 80px rgba(255,0,0,.07);
  position: relative;
  overflow: hidden;
}
#rml-player-wrap .player.rml-lecteur {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 20px;
  gap: 18px;
}
/* ── Gradient conico animé en fond de carte (hommage à l'original) ── */
#rml-player-wrap .player::before {
  content: '';
  position: absolute;
  inset: -50%;
  background: conic-gradient(
    from 0deg,
    rgba(255,0,0,.07),
    rgba(170,0,255,.05),
    rgba(0,136,255,.06),
    rgba(0,255,255,.05),
    rgba(255,0,0,.07)
  );
  animation: rml-spinGrad 14s linear infinite;
  pointer-events: none;
  z-index: 0;
}
@keyframes rml-spinGrad { to { transform: rotate(360deg); } }

/* ── HEADER ── */
#rml-player-wrap .banner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px 12px;
  border-bottom: 1px solid var(--rml-border);
}

#rml-player-wrap .radio-name {
  font-family: 'Syne', sans-serif;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .22em;
  text-transform: uppercase;
  background: var(--rml-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#rml-player-wrap .live-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,0,0,.07);
  border: 1px solid rgba(255,0,0,.28);
  border-radius: 20px;
  padding: 3px 11px;
  font-size: .63rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #d62828;
}

#rml-player-wrap .live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #ff0000;
  animation: rml-livePulse 1.5s ease-in-out infinite;
}
@keyframes rml-livePulse {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:.3; transform:scale(.5); }
}

/* ══════════════════════════════════════════════════════
   CORPS — grille deux colonnes
══════════════════════════════════════════════════════ */
#rml-player-wrap .player-body {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
  min-width: 0;
}

#rml-player-wrap .col-left {
  padding: 24px 28px 24px 24px;
  border-right: 1px solid var(--rml-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  justify-content: center;
  min-width: 0;
}

#rml-player-wrap .col-right {
  padding: 24px 24px 24px 28px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── POCHETTE avec anneau conic-gradient ── */
#rml-player-wrap .artwork-ring {
  position: relative;
  width: 160px; height: 160px;
  flex-shrink: 0;
}

/* Anneau principal */
#rml-player-wrap .artwork-ring::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(
    var(--rml-c1), var(--rml-c2), var(--rml-c3), var(--rml-c4), var(--rml-c5), var(--rml-c6), var(--rml-c7), var(--rml-c1)
  );
  animation: rml-ringRotate 4s linear infinite;
  opacity: 0;
  transition: opacity .5s;
}
/* Halo flou derrière l'anneau */
#rml-player-wrap .artwork-ring::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(
    var(--rml-c1), var(--rml-c2), var(--rml-c3), var(--rml-c4), var(--rml-c5), var(--rml-c6), var(--rml-c7), var(--rml-c1)
  );
  animation: rml-ringRotate 4s linear infinite;
  filter: blur(10px);
  opacity: 0;
  transition: opacity .5s;
  z-index: -1;
}
#rml-player-wrap .artwork-ring.playing::before { opacity: 1; }
#rml-player-wrap .artwork-ring.playing::after  { opacity: .45; }
@keyframes rml-ringRotate { to { transform: rotate(360deg); } }

#rml-player-wrap .artwork-img {
  width: 160px; height: 160px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #ffffff;
  position: relative;
  z-index: 1;
  transition: opacity .5s;
  background: linear-gradient(135deg, #f0e6ff, #e0f7ff);
  display: block;
}
#rml-player-wrap .artwork-img.loading { opacity: .35; }

/* ── TITRE EN COURS ── */
#rml-player-wrap .track-info {
  width: 100%;
  text-align: center;
}

#rml-player-wrap .now-label {
  font-size: .58rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--rml-muted);
  margin-bottom: 5px;
}

#rml-player-wrap .artist-name {
  font-size: .78rem;
  font-weight: 700;
  background: var(--rml-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#rml-player-wrap .track-name-wrapper {
  width: 100%;
}
#rml-player-wrap .track-name {
  font-family: 'Syne', 'Segoe UI', Arial, sans-serif;
  font-size: .95rem;
  font-weight: 800;
  color: var(--rml-text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  transition: opacity .4s;
}
#rml-player-wrap .track-name.updating { opacity: .15; }

/* ── CONTRÔLES — barres + bouton play ── */
#rml-player-wrap .controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
}

/* Barres visualiseur */
#rml-player-wrap .bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 32px;
}
#rml-player-wrap .bar {
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(to top, var(--rml-c1), var(--rml-c3), var(--rml-c5), var(--rml-c7));
  opacity: .72;
  transform-origin: bottom;
  animation: rml-barDance var(--d) ease-in-out infinite alternate;
}
@keyframes rml-barDance {
  from { transform: scaleY(var(--lo)); }
  to   { transform: scaleY(var(--hi)); }
}
#rml-player-wrap .bars.stopped .bar {
  transform: scaleY(.06);
  animation-play-state: paused;
}

/* Visualiseur audio — spectre pleine largeur (option B) */
#rml-player-wrap .rml-viz {
  width: 100%;
  margin: 2px 0 6px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--rml-card);
  border: 1px solid var(--rml-border);
}
#rml-player-wrap .rml-viz.rml-viz--unavailable {
  display: none; /* repli gracieux : pas de flux CORS-compatible, on n'affiche rien */
}
#rml-player-wrap .rml-viz canvas {
  display: block;
  width: 100%;
  height: 64px;
}
@media (prefers-reduced-motion: reduce) {
  #rml-player-wrap .rml-viz { display: none; }
}

/* Bouton play/pause — grand, triangle bien visible */
#rml-player-wrap .play-btn-wrap {
  position: relative;
  width: 64px; height: 64px;
  flex-shrink: 0;
}

/* Anneau tournant — actif uniquement pendant la lecture */
#rml-player-wrap .play-btn-wrap::before {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: conic-gradient(
    var(--rml-c1), var(--rml-c2), var(--rml-c3), var(--rml-c4), var(--rml-c5), var(--rml-c6), var(--rml-c7), var(--rml-c1)
  );
  animation: rml-ringRotate 3s linear infinite;
  opacity: 0;
  transition: opacity .4s;
  z-index: 0;
}
#rml-player-wrap .play-btn-wrap::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: conic-gradient(
    var(--rml-c1), var(--rml-c2), var(--rml-c3), var(--rml-c4), var(--rml-c5), var(--rml-c6), var(--rml-c7), var(--rml-c1)
  );
  animation: rml-ringRotate 3s linear infinite;
  filter: blur(9px);
  opacity: 0;
  transition: opacity .4s;
  z-index: -1;
}
#rml-player-wrap .play-btn-wrap.playing::before { opacity: 1; }
#rml-player-wrap .play-btn-wrap.playing::after  { opacity: .55; }

#rml-player-wrap .play-btn {
  position: relative;
  z-index: 1;
  width: 64px; height: 64px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  border: 3px solid #ffffff;
  outline: none;
  cursor: pointer;
  background: var(--rml-grad135);
  background-image: linear-gradient(135deg, #ff0000, #ff8c00, #ffd400, #00c853, #00b8d4, #3d5afe, #9c27b0);
  box-shadow:
    0 0 0 0   rgba(255,0,0,.4),
    0 8px 24px rgba(255,0,0,.28);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform .15s, box-shadow .3s;
  animation: rml-btnPulse 2.5s ease-in-out infinite;
  -webkit-appearance: none;
  appearance: none;
}
#rml-player-wrap .play-btn:hover  { transform: scale(1.07); }
#rml-player-wrap .play-btn:active { transform: scale(.95); }
#rml-player-wrap .play-btn:focus  { outline: none; }
@keyframes rml-btnPulse {
  0%,100% { box-shadow: 0 0 0 0   rgba(255,0,0,.4),  0 8px 24px rgba(255,0,0,.28); }
  50%      { box-shadow: 0 0 0 12px rgba(255,0,0,.0), 0 8px 24px rgba(255,0,0,.28); }
}
#rml-player-wrap .play-btn.paused {
  animation: none;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
}

/* Icône play/pause — rotation inverse de l'anneau extérieur */
#rml-player-wrap .play-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  fill: #ffffff !important;
  pointer-events: none;
  position: relative;
  z-index: 2;
}
#rml-player-wrap .play-icon path { fill: #ffffff !important; }

/* Rotation du disque central — sens inverse de l'anneau extérieur */
#rml-player-wrap .play-btn-wrap.playing .play-btn {
  animation: rml-btnPulse 2.5s ease-in-out infinite, rml-discRotateCCW 5s linear infinite;
}
@keyframes rml-discRotateCCW {
  from { transform: rotate(0deg); }
  to   { transform: rotate(-360deg); }
}
/* Contre-rotation de l'icône pour qu'elle reste droite pendant que le disque tourne */
#rml-player-wrap .play-btn-wrap.playing .play-icon {
  animation: rml-discRotateCW 5s linear infinite;
}
@keyframes rml-discRotateCW {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Volume ── */
#rml-player-wrap .volume-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}
#rml-player-wrap .vol-icon { font-size: .9rem; }
#rml-player-wrap input[type=range] {
  flex: 1;
  min-width: 0;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 3px;
  /* Dégradé fixe reprenant les couleurs du logo : jaune → orange → rose → violet → indigo */
  background: linear-gradient(90deg, #ff0000, #ff8c00, #ffd400, #00c853, #00b8d4, #3d5afe, #9c27b0);
  outline: none;
  cursor: pointer;
}
#rml-player-wrap input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  /* Couleur mise à jour dynamiquement en JS selon la position (--rml-thumb-color) */
  background-color: var(--rml-thumb-color, #ffd400);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  margin-top: 0;
}
#rml-player-wrap input[type=range]::-moz-range-thumb {
  width: 16px; height: 16px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background-color: var(--rml-thumb-color, #ffd400);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
#rml-player-wrap input[type=range]::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #ff0000, #ff8c00, #ffd400, #00c853, #00b8d4, #3d5afe, #9c27b0);
  border: none;
}

/* ══════════════════════════════════════════════════════
   COLONNE DROITE — Historique
══════════════════════════════════════════════════════ */
/* ── Styles de base pour les shortcodes modulaires (hors #rml-player-wrap) ── */
.rml-widget {
  --rml-text:   #0d0d14;
  --rml-muted:  rgba(13,13,20,.42);
  font-family: 'DM Sans', sans-serif;

}

#rml-player-wrap .history-label,
.rml-widget .history-label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  background: var(--rml-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 14px;
  margin-left: 20px;   /* ← permet de décaler le texte titres diffusés et à venir sur la droite */
}

#rml-player-wrap .history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
#rml-player-wrap .history-item,
.rml-widget .history-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  opacity: 0;
  min-width: 0;
  animation: rml-fadeUp .4s ease forwards;
}
@keyframes rml-fadeUp {
  from { opacity:0; transform:translateY(6px); }
  to   { opacity:1; transform:translateY(0); }
}
#rml-player-wrap .history-time,
.rml-widget .history-time {
  font-size: .85rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  background: var(--rml-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex-shrink: 0;
  width: 58px;
  padding-right: 6px;
}
#rml-player-wrap .history-track,
.rml-widget .history-track {
  font-size: .95rem;
  color: var(--rml-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  min-width: 0;
  flex: 1;
}

/* ══════════════════════════════════════════════════════
   PIED — Qualité réseau (pleine largeur)
══════════════════════════════════════════════════════ */
#rml-player-wrap .rml-health {
  position: relative;
  z-index: 1;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 24px 14px;
  border-top: 1px solid var(--rml-border);
}

#rml-player-wrap .rml-health-label {
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--rml-muted);
  flex-shrink: 0;
}

#rml-player-wrap .rml-health-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}

#rml-player-wrap .rml-health-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(0,0,0,.1);
  transition: background .3s, box-shadow .3s;
}
#rml-player-wrap .rml-health-dot--ok {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34,197,94,.55);
}
#rml-player-wrap .rml-health-dot--warn {
  background: #f59e0b;
  box-shadow: 0 0 6px rgba(245,158,11,.55);
}
#rml-player-wrap .rml-health-dot--fail {
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239,68,68,.55);
}

#rml-player-wrap .rml-health-ping {
  font-size: .65rem;
  font-variant-numeric: tabular-nums;
  color: var(--rml-muted);
  min-width: 52px;
  text-align: right;
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE — mobile : colonne unique
══════════════════════════════════════════════════════ */
@media (max-width: 580px) {
  #rml-player-wrap .player {
    border-radius: 18px;
  }
  #rml-player-wrap .player-body {
    grid-template-columns: minmax(0, 1fr);
  }
  #rml-player-wrap .col-left {
    border-right: none;
    border-bottom: 1px solid var(--rml-border);
    padding: 20px 18px;
  }
  #rml-player-wrap .col-right {
    padding: 20px 18px;
  }
  #rml-player-wrap .artwork-ring,
  #rml-player-wrap .artwork-img {
    width: 130px; height: 130px;
  }
  #rml-player-wrap .controls {
    gap: 14px;
  }
  #rml-player-wrap .banner {
    padding: 14px 18px 10px;
  }
  #rml-player-wrap .rml-health {
    padding: 10px 18px 13px;
    flex-wrap: wrap;
  }
}
