/* =====================================================
   SML Podcasts — Player CSS
   Science Music Live | Dark Mode | v1.0.1
   Charte : Crushed (titres) + Inter Variable (corps)
   Accent Musique : #ff7043 | Accent Science : #a855f7
===================================================== */

/* Fonts chargées localement par le thème SML (Inter Variable + Crushed) */

/* ── Variables ── */
:root {
  --sml-bg-primary:    #111827;
  --sml-bg-secondary:  #1f2937;
  --sml-bg-elevated:   #273548;
  --sml-bg-surface:    #0d1117;
  --sml-accent:        #ff7043;
  --sml-accent-hover:  #ff8a65;
  --sml-accent-muted:  rgba(255,112,67,0.15);
  --sml-text-primary:  #f9fafb;
  --sml-text-secondary:#9ca3af;
  --sml-text-muted:    #6b7280;
  --sml-border:        #374151;
  --sml-radius-sm:     4px;
  --sml-radius-md:     8px;
  --sml-radius-lg:     16px;
  --sml-shadow-md:     0 4px 16px rgba(0,0,0,0.5);
  --sml-shadow-accent: 0 0 20px rgba(255,112,67,0.25);
  --sml-transition:    0.25s ease;
  --sml-font-display:  'Crushed', cursive;
  --sml-font-body:     'Nunito', sans-serif;
  /* Accent actif (basculé par .sml-theme-science) */
  --sml-active-accent:        #ff7043;
  --sml-active-accent-hover:  #ff8a65;
  --sml-active-accent-muted:  rgba(255,112,67,0.15);
  --sml-active-shadow:        0 0 20px rgba(255,112,67,0.25);
}

/* Thème Science — accent violet */
.sml-theme-science {
  --sml-active-accent:        #a855f7;
  --sml-active-accent-hover:  #b97af9;
  --sml-active-accent-muted:  rgba(168,85,247,0.15);
  --sml-active-shadow:        0 0 20px rgba(168,85,247,0.25);
}

/* ══════════════════════════════════════════
   VISUALISEUR D'ONDES
══════════════════════════════════════════ */
.sml-visualizer-wrap {
  margin: 0 20px 0;
  height: 56px;
  border-radius: var(--sml-radius-sm);
  overflow: hidden;
  background: var(--sml-bg-surface);
  position: relative;
}

.sml-visualizer {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: var(--sml-radius-sm);
}

/* Légère lueur sous le visualiseur quand lecture active */
.sml-playing .sml-visualizer-wrap {
  box-shadow: 0 2px 16px var(--sml-active-accent-muted);
  transition: box-shadow var(--sml-transition-slow);
}

/* ══════════════════════════════════════════
   PLAYER PRINCIPAL
══════════════════════════════════════════ */
.sml-player {
  background: var(--sml-bg-secondary);
  border: 1px solid var(--sml-border);
  border-radius: var(--sml-radius-lg);
  padding: 0;
  overflow: hidden;
  font-family: var(--sml-font-body);
  color: var(--sml-text-primary);
  box-shadow: var(--sml-shadow-md);
  max-width: 720px;
  margin: 2rem auto;
  position: relative;
}

/* Bande d'accent en haut */
.sml-player::before {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--sml-active-accent) 0%, var(--sml-active-accent-hover) 100%);
}

/* ── Header : cover + infos ── */
.sml-player__header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 20px 0;
}

.sml-player__cover {
  width: 88px;
  height: 88px;
  border-radius: var(--sml-radius-md);
  background: var(--sml-bg-elevated) center/cover no-repeat;
  flex-shrink: 0;
  border: 1px solid var(--sml-border);
}

.sml-player__cover--default {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sml-active-accent);
}
.sml-player__cover--default svg {
  width: 40px; height: 40px;
}

.sml-player__info { flex: 1; min-width: 0; }

.sml-player__ep-label {
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--sml-font-body);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sml-active-accent);
  display: block;
  margin-bottom: 4px;
}

.sml-player__title {
  font-family: var(--sml-font-display);
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1.2;
  color: var(--sml-text-primary);
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sml-player__guest {
  font-size: 0.82rem;
  font-weight: 300;
  color: var(--sml-text-secondary);
  margin: 0 0 4px;
}
.sml-player__guest strong { font-weight: 600; color: var(--sml-text-primary); }

.sml-player__duration {
  font-size: 0.78rem;
  font-family: monospace;
  color: var(--sml-text-muted);
  background: var(--sml-bg-surface);
  padding: 2px 8px;
  border-radius: 99px;
  display: inline-block;
}

/* ── Contrôles audio ── */
.sml-player__controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px 8px;
  flex-wrap: wrap;
}

/* Bouton play/pause central */
.sml-ctrl--play {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--sml-active-accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  transition: background var(--sml-transition), box-shadow var(--sml-transition), transform var(--sml-transition);
}
.sml-ctrl--play:hover {
  background: var(--sml-active-accent-hover);
  box-shadow: var(--sml-active-shadow);
  transform: scale(1.06);
}
.sml-ctrl--play svg { width: 22px; height: 22px; }

/* Boutons skip */
.sml-ctrl--skip {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--sml-bg-elevated);
  border: 1px solid var(--sml-border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sml-text-secondary);
  transition: background var(--sml-transition), color var(--sml-transition);
}
.sml-ctrl--skip:hover {
  background: var(--sml-active-accent-muted);
  color: var(--sml-active-accent);
  border-color: var(--sml-active-accent);
}
.sml-ctrl--skip svg { width: 20px; height: 20px; }

/* Vitesse */
.sml-player__speed-wrap { margin-left: auto; }
.sml-speed {
  background: var(--sml-bg-elevated);
  border: 1px solid var(--sml-border);
  border-radius: var(--sml-radius-sm);
  color: var(--sml-text-secondary);
  font-family: var(--sml-font-body);
  font-size: 0.78rem;
  padding: 4px 8px;
  cursor: pointer;
  transition: border-color var(--sml-transition);
}
.sml-speed:hover, .sml-speed:focus {
  border-color: var(--sml-active-accent);
  outline: none;
}

/* Volume */
.sml-player__vol-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--sml-text-muted);
}
.sml-volume {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 3px;
  border-radius: 99px;
  background: var(--sml-border);
  outline: none;
  cursor: pointer;
}
.sml-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--sml-active-accent);
  cursor: pointer;
  transition: transform var(--sml-transition);
}
.sml-volume::-webkit-slider-thumb:hover { transform: scale(1.3); }

/* ── Barre de progression ── */
.sml-player__progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 16px;
}

.sml-time-current,
.sml-time-total {
  font-size: 0.75rem;
  font-family: monospace;
  color: var(--sml-text-muted);
  flex-shrink: 0;
  width: 42px;
}
.sml-time-total { text-align: right; }

.sml-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--sml-border);
  border-radius: 99px;
  position: relative;
  cursor: pointer;
  transition: height var(--sml-transition);
}
.sml-progress-bar:hover { height: 6px; }

.sml-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sml-active-accent) 0%, var(--sml-active-accent-hover) 100%);
  border-radius: 99px;
  width: 0%;
  pointer-events: none;
  transition: width 0.1s linear;
}

.sml-progress-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%) scale(0);
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--sml-active-accent);
  pointer-events: none;
  transition: transform var(--sml-transition), left 0.1s linear;
}
.sml-progress-bar:hover .sml-progress-thumb { transform: translate(-50%, -50%) scale(1); }

/* Marqueurs de chapitres sur la barre */
.sml-chapter-marker {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 10px;
  background: rgba(255,255,255,0.4);
  border-radius: 99px;
  pointer-events: none;
}

/* ══════════════════════════════════════════
   CHAPITRES
══════════════════════════════════════════ */
.sml-chapters {
  border-top: 1px solid var(--sml-border);
  padding: 0 20px;
}

.sml-chapters__toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  color: var(--sml-text-secondary);
  font-family: var(--sml-font-body);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 12px 0;
  cursor: pointer;
  text-align: left;
  transition: color var(--sml-transition);
}
.sml-chapters__toggle:hover { color: var(--sml-active-accent); }
.sml-chapters__toggle svg { color: var(--sml-active-accent); }

.sml-chapters__count {
  background: var(--sml-active-accent-muted);
  color: var(--sml-active-accent);
  border-radius: 99px;
  padding: 1px 8px;
  font-size: 0.72rem;
}

.sml-chapters__list {
  list-style: none;
  margin: 0;
  padding: 0 0 12px;
  max-height: 240px;
  overflow-y: auto;
}
.sml-chapters__list::-webkit-scrollbar { width: 4px; }
.sml-chapters__list::-webkit-scrollbar-track { background: transparent; }
.sml-chapters__list::-webkit-scrollbar-thumb { background: var(--sml-border); border-radius: 99px; }

.sml-chapter-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--sml-radius-sm);
  cursor: pointer;
  transition: background var(--sml-transition);
}
.sml-chapter-item:hover { background: var(--sml-active-accent-muted); }
.sml-chapter-item.active { background: var(--sml-active-accent-muted); }

.sml-chapter-num {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--sml-bg-elevated);
  border: 1px solid var(--sml-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem;
  color: var(--sml-text-muted);
  flex-shrink: 0;
}
.sml-chapter-item.active .sml-chapter-num {
  background: var(--sml-active-accent);
  border-color: var(--sml-active-accent);
  color: #fff;
}

.sml-chapter-time {
  font-size: 0.72rem;
  font-family: monospace;
  color: var(--sml-active-accent);
  flex-shrink: 0;
  width: 52px;
}

.sml-chapter-title {
  font-size: 0.85rem;
  font-weight: 300;
  color: var(--sml-text-primary);
}

/* ══════════════════════════════════════════
   ACTIONS (RSS, lien épisode)
══════════════════════════════════════════ */
.sml-player__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 20px;
  border-top: 1px solid var(--sml-border);
  background: var(--sml-bg-surface);
}

.sml-action-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--sml-font-body);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sml-text-muted);
  text-decoration: none;
  padding: 5px 12px;
  border-radius: 99px;
  border: 1px solid var(--sml-border);
  transition: all var(--sml-transition);
}
.sml-action-link:hover {
  color: var(--sml-active-accent);
  border-color: var(--sml-active-accent);
  background: var(--sml-active-accent-muted);
}

/* ══════════════════════════════════════════
   YOUTUBE EMBED
══════════════════════════════════════════ */
.sml-player__yt-wrap {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  margin: 16px 20px;
  border-radius: var(--sml-radius-md);
}
.sml-player__yt-wrap iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border-radius: var(--sml-radius-md);
}

/* ══════════════════════════════════════════
   GRILLE & LISTE ÉPISODES
══════════════════════════════════════════ */
.sml-episodes-wrap {
  font-family: var(--sml-font-body);
}

/* Grille */
.sml-episodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* Liste */
.sml-episodes-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Card épisode */
.sml-ep-card {
  background: var(--sml-bg-secondary);
  border: 1px solid var(--sml-border);
  border-radius: var(--sml-radius-md);
  overflow: hidden;
  transition: transform var(--sml-transition), box-shadow var(--sml-transition);
}
.sml-ep-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--sml-shadow-md);
}

.sml-ep-thumb {
  position: relative;
  aspect-ratio: 16/9;
  background: var(--sml-bg-elevated) center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sml-ep-play-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  border: 2px solid rgba(255,255,255,0.7);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity var(--sml-transition), background var(--sml-transition), border-color var(--sml-transition);
}
.sml-ep-card:hover .sml-ep-play-btn { opacity: 1; }
.sml-ep-play-btn:hover {
  background: var(--sml-active-accent);
  border-color: var(--sml-active-accent);
}
.sml-ep-play-btn svg { width: 18px; height: 18px; }

.sml-ep-badge {
  position: absolute;
  bottom: 8px; left: 8px;
  background: var(--sml-active-accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  font-family: var(--sml-font-body);
  padding: 2px 8px;
  border-radius: 99px;
  letter-spacing: 0.05em;
}

.sml-ep-info { padding: 14px; }

.sml-ep-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.sml-ep-date {
  font-size: 0.72rem;
  color: var(--sml-text-muted);
  font-weight: 300;
}

.sml-ep-duration {
  font-size: 0.72rem;
  font-family: monospace;
  color: var(--sml-active-accent);
  background: var(--sml-active-accent-muted);
  padding: 2px 8px;
  border-radius: 99px;
}

.sml-ep-title {
  font-family: var(--sml-font-display);
  font-size: 1rem;
  font-weight: 400;
  margin: 0 0 6px;
  line-height: 1.25;
}
.sml-ep-title a {
  color: var(--sml-text-primary);
  text-decoration: none;
  transition: color var(--sml-transition);
}
.sml-ep-title a:hover { color: var(--sml-active-accent); }

.sml-ep-excerpt {
  font-size: 0.82rem;
  font-weight: 300;
  color: var(--sml-text-secondary);
  line-height: 1.55;
  margin: 0 0 12px;
}

.sml-ep-listen-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--sml-font-body);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sml-active-accent);
  background: var(--sml-active-accent-muted);
  border: 1px solid transparent;
  border-radius: 99px;
  padding: 5px 14px;
  cursor: pointer;
  transition: all var(--sml-transition);
}
.sml-ep-listen-btn:hover {
  background: var(--sml-active-accent);
  color: #fff;
}

/* Player flottant (chargé via REST) */
#sml-floating-player {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: min(720px, calc(100vw - 40px));
  z-index: 9999;
  animation: smlSlideUp 0.3s ease;
}
@keyframes smlSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.sml-no-episodes {
  color: var(--sml-text-muted);
  font-style: italic;
  text-align: center;
  padding: 2rem;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .sml-player__header { flex-direction: column; align-items: flex-start; }
  .sml-player__controls { gap: 6px; }
  .sml-player__vol-wrap { display: none; }
  .sml-episodes-grid { grid-template-columns: 1fr; }
  #sml-floating-player { bottom: 0; border-radius: var(--sml-radius-lg) var(--sml-radius-lg) 0 0; }
}
