/* =========================================================
   Radio — feuille de style unique.
   Même socle que podcasts.yodan.ninja (sombre, barre latérale, lecteur
   fixé en bas) ; accent orange pour distinguer les deux applications.
   ========================================================= */
:root {
  --bg:          #12121f;
  --bg-card:     #1c1c2e;
  --bg-hover:    #252540;
  --sidebar-bg:  #0e0e1a;
  --border:      rgba(255,255,255,0.08);
  --accent:      #ff8a3d;
  --accent-soft: rgba(255,138,61,0.14);
  /* Texte posé sur l'accent : sombre, le blanc sur orange manque de contraste. */
  --on-accent:   #1b1006;
  --accent-blue: #4f8ef7;
  --text:        #e8e8f0;
  --text-muted:  #8a8aa8;
  --text-light:  #b0b0c8;
  --success:     #2ecc71;
  --danger:      #ef5b4c;
  --logo-bg:     #f3f3f6;
  --sidebar-w:   240px;
  --player-h:    76px;
  --radius:      10px;
  --radius-sm:   6px;
  --transition:  0.18s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
button:disabled { cursor: default; }
input, select, textarea { font: inherit; color: inherit; }
ul { list-style: none; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85em; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* =========================================================
   Mise en page
   ========================================================= */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
  transition: transform var(--transition);
}

.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  padding-bottom: calc(var(--player-h) + 24px);
}

.content {
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* =========================================================
   Barre latérale
   ========================================================= */
.sidebar-header {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}

/* « brand » et non « logo » : .logo est le carré du logo d'une radio. */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}

.mobile-header { display: none; }

.sidebar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 8px 4px;
  padding: 7px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition);
}
.sidebar-search:focus-within { border-color: var(--accent); }
.sidebar-search-icon { color: var(--text-muted); flex-shrink: 0; }
.sidebar-search-input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.85rem;
  width: 100%;
  min-width: 0;
}
.sidebar-search-input::placeholder { color: var(--text-muted); }

.nav-links { padding: 12px 0; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text-muted);
  font-size: 0.93rem;
  border-radius: var(--radius-sm);
  margin: 2px 8px;
  transition: background var(--transition), color var(--transition);
}
.nav-link:hover { background: var(--bg-hover); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); }
/* Déconnexion : un bouton de formulaire habillé en lien de navigation. */
.nav-link--button { width: calc(100% - 16px); text-align: left; }

.sidebar-footer { margin-top: auto; padding: 12px 0; border-top: 1px solid var(--border); }

/* =========================================================
   En-têtes de page
   ========================================================= */
.page-header { margin-bottom: 24px; }
.page-header--flex { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-header-actions form { display: contents; }
.page-title { font-size: 1.6rem; font-weight: 700; }
.page-count { font-size: 1rem; font-weight: 500; color: var(--text-muted); margin-left: 4px; }
.page-intro { margin-top: 10px; color: var(--text-muted); font-size: 0.9rem; line-height: 1.55; max-width: 720px; }
.page-kicker { font-size: 0.85rem; margin-bottom: 6px; }

.section { margin-bottom: 36px; }
.section--spaced { margin-top: 40px; }
.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* =========================================================
   Boutons
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.87rem;
  font-weight: 500;
  transition: background var(--transition), opacity var(--transition), color var(--transition);
  white-space: nowrap;
  cursor: pointer;
}
.btn:hover { opacity: 0.88; }
.btn:disabled { opacity: 0.5; }
.btn--primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn--secondary { background: var(--bg-hover); color: var(--text); border: 1px solid var(--border); }
.btn--danger-soft { color: var(--danger); border: 1px solid rgba(239,91,76,0.35); }
.btn--danger-soft:hover { background: rgba(239,91,76,0.1); opacity: 1; }
.btn--full { width: 100%; }
.btn--sm { padding: 5px 12px; font-size: 0.8rem; }
.btn--icon { padding: 7px; border-radius: 50%; color: var(--text-muted); }
.btn--icon:hover { background: var(--bg-hover); color: var(--text); opacity: 1; }
.btn.btn--play { color: var(--accent); }
.btn.btn--primary.btn--play { color: var(--on-accent); }

.badge {
  display: inline-block;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge--success { background: rgba(46,204,113,0.16); color: var(--success); }

/* Icônes à deux états : lecture / arrêt, selon l'élément [data-play-key]
   englobant, que player.js marque .is-playing ou .is-loading. */
.icon-stop, .when-playing { display: none; }
.is-playing .icon-play, .is-loading .icon-play,
.is-playing .when-stopped, .is-loading .when-stopped { display: none; }
.is-playing .icon-stop, .is-loading .icon-stop { display: inline; }
.is-playing .when-playing, .is-loading .when-playing { display: inline; }

/* Étoile favorite */
.fav-btn svg { transition: fill var(--transition), color var(--transition); }
.fav-btn[data-favorite="1"] { color: var(--accent); }
.fav-btn[data-favorite="1"] svg { fill: currentColor; }
.fav-btn .when-fav { display: none; }
.fav-btn[data-favorite="1"] .when-fav { display: inline; }
.fav-btn[data-favorite="1"] .when-not-fav { display: none; }

/* =========================================================
   Formulaires
   ========================================================= */
.input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  width: 100%;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}
.input:focus { border-color: var(--accent); }
select.input { padding-right: 32px; }
textarea.input { resize: vertical; min-height: 70px; }

.form-group { margin-bottom: 16px; min-width: 0; }
.form-group label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 6px; }
.form-help { font-size: 0.78rem; color: var(--text-muted); line-height: 1.45; margin-top: 6px; }
.form-help ul { list-style: disc; padding-left: 16px; }
.form-error { font-size: 0.8rem; color: var(--danger); margin-top: 6px; line-height: 1.45; }
.required { color: var(--accent); }

.form-card {
  padding: 22px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 820px;
}
.form-card .input { background: var(--bg); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-group--wide { grid-column: 1 / -1; }
.form-group--check { margin-bottom: 12px; }
.check { display: inline-flex !important; align-items: center; gap: 10px; cursor: pointer; color: var(--text) !important; font-size: 0.9rem !important; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.form-intro { margin: -6px 0 14px; font-size: 0.88rem; line-height: 1.5; max-width: 720px; }
.import-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; max-width: 620px; }
.import-form .input { flex: 1; min-width: 220px; padding: 7px 10px; }

.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 0.88rem; }
.alert--error { background: rgba(239,91,76,0.14); color: var(--danger); border: 1px solid rgba(239,91,76,0.3); }

/* Interrupteur : la case native, masquée, reste focusable et porte l'état. */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch-input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  position: relative;
  width: 38px; height: 21px;
  border-radius: 999px;
  background: var(--border);
  transition: background var(--transition);
  flex-shrink: 0;
}
.switch-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform var(--transition), background var(--transition);
}
.switch-input:checked + .switch-track { background: var(--accent); }
.switch-input:checked + .switch-track .switch-thumb { transform: translateX(17px); background: var(--on-accent); }
.switch-input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-text { font-size: 0.85rem; color: var(--text-light); }

/* Barre de filtres (Mes radios, Découvrir) */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-search { position: relative; flex: 1 1 240px; min-width: 0; }
.filter-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.filter-input { padding-left: 38px; }
.filter-select { width: auto; max-width: 100%; }

/* Pastilles (étiquettes, genres) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; }
.chips--inline { margin: 4px 0 12px; }
.chip {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-light);
  font-size: 0.8rem;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.chip:hover { background: var(--bg-hover); color: var(--text); }
.chip.is-active { background: var(--accent-soft); border-color: rgba(255,138,61,0.45); color: var(--accent); }

/* =========================================================
   Logo d'une radio (ou ses initiales)
   ========================================================= */
.logo {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: hsl(var(--hue, 220) 40% 30%);
  color: hsl(var(--hue, 220) 85% 88%);
  container-type: inline-size;
  flex-shrink: 0;
}
.logo-initials {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-size: 1.1rem;
  font-size: 30cqi;
  line-height: 1;
}
.logo-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* Fond clair : la plupart des logos sont dessinés pour un fond blanc. */
  background: var(--logo-bg);
  padding: 7%;
}
.logo--broken .logo-img { display: none; }
.logo--fill { width: 100%; border-radius: var(--radius) var(--radius) 0 0; }
.logo--sm { width: 48px; }
.logo--player { width: 52px; border-radius: 7px; }

/* =========================================================
   Cartes de radio
   ========================================================= */
.stations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}

.station-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}
.station-card:hover { background: var(--bg-hover); }
.station-card.is-playing, .station-card.is-loading { border-color: rgba(255,138,61,0.6); }

.station-card-cover, .station-header-cover {
  position: relative;
  display: block;
  width: 100%;
  border-radius: var(--radius) var(--radius) 0 0;
}

.cover-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10,10,20,0.45);
  color: #fff;
  opacity: 0;
  transition: opacity var(--transition);
  border-radius: inherit;
}
.station-card-cover:hover .cover-overlay,
.station-card-cover:focus-visible .cover-overlay,
.station-header-cover:hover .cover-overlay,
.station-header-cover:focus-visible .cover-overlay,
.is-loading .cover-overlay { opacity: 1; }

.station-card-body { padding: 10px 12px 12px; min-width: 0; }
.station-card-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.3;
}
.station-card-name:hover { color: var(--accent); }
.station-card-meta { margin-top: 4px; font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Étoile posée sur le logo. Sur écran tactile (pas de survol), toujours là. */
.station-card > .fav-btn {
  position: absolute;
  top: 6px; right: 6px;
  background: rgba(10,10,20,0.6);
  color: #fff;
}
.station-card > .fav-btn[data-favorite="1"] { color: var(--accent); }
.station-card > .fav-btn:hover { background: rgba(10,10,20,0.8); }
@media (hover: hover) {
  .station-card > .fav-btn[data-favorite="0"] { opacity: 0; }
  .station-card:hover > .fav-btn, .station-card > .fav-btn:focus-visible { opacity: 1; }
}

.down-badge {
  display: inline-block;
  padding: 0 6px;
  margin-right: 4px;
  border-radius: 4px;
  background: rgba(239,91,76,0.16);
  color: var(--danger);
  font-size: 0.7rem;
}

/* Égaliseur animé : la radio qui joue */
.eq {
  position: absolute;
  left: 8px; bottom: 8px;
  display: none;
  align-items: flex-end;
  gap: 3px;
  height: 18px;
  padding: 4px 5px;
  border-radius: 5px;
  background: rgba(10,10,20,0.7);
  box-sizing: content-box;
}
.eq i {
  display: block;
  width: 3px;
  height: 100%;
  background: var(--accent);
  border-radius: 1px;
  transform-origin: bottom;
  animation: eq 0.9s ease-in-out infinite;
}
.eq i:nth-child(2) { animation-delay: -0.3s; animation-duration: 0.7s; }
.eq i:nth-child(3) { animation-delay: -0.55s; animation-duration: 1.1s; }
.is-playing .eq { display: flex; }
.is-loading .eq { display: flex; opacity: 0.5; }
.is-loading .eq i { animation-play-state: paused; }
.eq--sm { left: 3px; bottom: 3px; height: 10px; padding: 2px 3px; gap: 2px; }
.eq--sm i { width: 2px; }
@keyframes eq {
  0%, 100% { transform: scaleY(0.25); }
  50% { transform: scaleY(1); }
}

/* =========================================================
   Lignes de radio (récentes, résultats de l'annuaire)
   ========================================================= */
.station-rows { display: flex; flex-direction: column; gap: 4px; }
.station-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: background var(--transition), border-color var(--transition);
}
.station-row:hover { background: var(--bg-hover); }
.station-row.is-playing, .station-row.is-loading { border-color: rgba(255,138,61,0.5); }
.station-row-logo { position: relative; flex-shrink: 0; border-radius: var(--radius-sm); }
.station-row-body { flex: 1; min-width: 0; }
.station-row-name { display: block; font-size: 0.92rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.station-row-name:hover { color: var(--accent); }
.station-row-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.station-row-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.station-row-actions form { display: contents; }

/* =========================================================
   Fiche d'une radio
   ========================================================= */
.station-header { display: flex; gap: 28px; align-items: flex-start; margin-bottom: 32px; }
.station-header-cover { width: 180px; flex-shrink: 0; border-radius: var(--radius); }
.station-header-cover .logo--fill { border-radius: var(--radius); }
.station-header-body { flex: 1; min-width: 0; }
.station-header-kicker { display: flex; flex-wrap: wrap; gap: 0 10px; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 6px; }
.station-header-kicker span + span::before { content: "·"; margin-right: 10px; }
.station-header-title { font-size: 1.7rem; font-weight: 700; line-height: 1.2; margin-bottom: 8px; overflow-wrap: anywhere; }
.station-header-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.station-header-actions form { display: contents; }
.station-header.is-playing .station-header-cover,
.station-header.is-loading .station-header-cover { box-shadow: 0 0 0 2px var(--accent); }

.now-playing {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  margin-top: 8px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  max-width: 560px;
}
.now-playing-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); font-weight: 700; }
.now-playing-title { font-size: 0.95rem; font-weight: 500; overflow-wrap: anywhere; }

.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.detail-card { padding: 18px 20px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 0.88rem; }
.facts dt { color: var(--text-muted); }
.facts dd { min-width: 0; }
.url { overflow-wrap: anywhere; color: var(--text-light); }
.notes { font-size: 0.9rem; line-height: 1.6; color: var(--text-light); }

/* =========================================================
   Lecteur
   ========================================================= */
/* Masqué tant qu'aucune radio n'est chargée : player.js ajoute .is-active */
.player-bar {
  position: fixed;
  bottom: 0; left: var(--sidebar-w); right: 0;
  height: var(--player-h);
  background: var(--sidebar-bg);
  border-top: 1px solid var(--border);
  display: none;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  z-index: 200;
}
.player-bar.is-active { display: flex; }

.player-logo { flex-shrink: 0; line-height: 0; }
.player-logo[href] { cursor: pointer; }
.player-info { flex: 1; min-width: 0; }
.player-station { font-size: 0.92rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-station-link[href]:hover { color: var(--accent); text-decoration: underline; }
.player-meta { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; min-height: 1.2em; }
.player-bar[data-state="playing"] .player-meta { color: var(--text-light); }
.player-bar[data-state="error"] .player-meta { color: var(--danger); }

.player-controls { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.player-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-muted);
  padding: 8px;
  border-radius: 999px;
  transition: color var(--transition), background var(--transition);
}
.player-btn:hover { color: var(--text); background: var(--bg-hover); }
.player-btn--main { width: 46px; height: 46px; color: var(--on-accent); background: var(--accent); }
.player-btn--main:hover { color: var(--on-accent); background: var(--accent); opacity: 0.9; }

.player-bar .icon-stop { display: none; }
.player-bar[data-state="playing"] .player-btn--main .icon-play,
.player-bar[data-state="loading"] .player-btn--main .icon-play { display: none; }
.player-bar[data-state="playing"] .player-btn--main .icon-stop { display: block; }

.spinner {
  display: none;
  width: 22px; height: 22px;
  border: 2.5px solid rgba(27,16,6,0.25);
  border-top-color: var(--on-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.player-bar[data-state="loading"] .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.player-sleep.is-armed { color: var(--accent); }
.player-sleep-label { font-size: 0.72rem; font-variant-numeric: tabular-nums; }
.player-sleep-label:empty { display: none; }

.player-extra { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.player-volume-label { display: flex; align-items: center; gap: 6px; color: var(--text-muted); }
.player-volume { width: 90px; accent-color: var(--accent); cursor: pointer; }

/* =========================================================
   Voile d'attente (ajout avec vérification du flux, import, test)
   ========================================================= */
.loader {
  position: fixed;
  inset: 0;
  background: rgba(18,18,31,0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}
.loader-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.loader-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
.loader-title { font-weight: 600; font-size: 0.95rem; }

/* =========================================================
   Connexion
   ========================================================= */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login-container {
  width: 100%;
  max-width: 380px;
  padding: 40px 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.login-logo { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 32px; color: var(--accent); }
.login-logo h1 { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.login-form .btn { margin-top: 8px; }

/* Installation (premier compte) */
.login-container--wide { max-width: 440px; }
.login-container--wide .login-logo { margin-bottom: 20px; }
.setup-intro { font-size: 0.9rem; color: var(--text-light); line-height: 1.5; margin-bottom: 16px; }
.setup-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 20px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.setup-hint code {
  display: block;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--text);
  overflow-wrap: anywhere;
}
p.setup-hint code { display: inline; margin: 0; }

/* =========================================================
   Compte
   ========================================================= */
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  align-items: start;
  max-width: 900px;
}
.account-card { padding: 20px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); }
.account-hint { font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 18px; }
.account-form .form-group:last-of-type { margin-bottom: 20px; }

/* =========================================================
   Utilitaires et messages
   ========================================================= */
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.source-note { font-size: 0.8rem; margin-top: 8px; line-height: 1.5; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 56px 20px;
  color: var(--text-muted);
  text-align: center;
}
.empty-state svg { color: var(--accent); margin-bottom: 4px; }
.empty-state p { font-size: 1.05rem; color: var(--text-light); }
.empty-state .empty-state-sub { font-size: 0.9rem; color: var(--text-muted); max-width: 440px; line-height: 1.5; }
.empty-state-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }

.messages { margin-bottom: 20px; display: flex; flex-direction: column; gap: 6px; }
.message { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.88rem; line-height: 1.45; overflow-wrap: anywhere; }
.message--success { background: rgba(46,204,113,0.12); color: var(--success); }
.message--error { background: rgba(239,91,76,0.12); color: var(--danger); }
.message--warning { background: rgba(243,156,18,0.12); color: #f39c12; }
.message--info { background: rgba(79,142,247,0.12); color: var(--accent-blue); }

/* =========================================================
   Statistiques — graphiques rendus côté serveur (HTML/CSS, sans JS),
   repris de podcasts. Une seule teinte (l'accent) : chaque graphique porte
   une seule série, la couleur n'y encode que la grandeur. Les valeurs
   exactes sont dans les infobulles (attribut title), le maximum est
   étiqueté directement.
   ========================================================= */
.period-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.period-switch-item {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}
.period-switch-item:hover { color: var(--text); }
.period-switch-item.is-active { background: var(--bg-hover); color: var(--text); font-weight: 600; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 18px;
  text-align: center;
}
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--accent); margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.stat-unit { font-size: 1rem; font-weight: 500; color: var(--text-muted); }
.stat-label { font-size: 0.82rem; color: var(--text-muted); }
.stats-note { font-size: 0.8rem; color: var(--text-muted); margin: -8px 0 28px; line-height: 1.5; }

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.charts-row { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 32px; }
.charts-row--two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.chart-card + .charts-row, .chart-card + .section { margin-top: 16px; }

.bar-chart {
  display: flex;
  align-items: stretch;
  gap: 2px;
  height: 200px;
  padding-top: 18px; /* place de l'étiquette du maximum */
}
.bar-chart--small { height: 150px; }
.bar-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.bar-track {
  flex: 1;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-bottom: 1px solid var(--border);
}
.bar {
  width: 100%;
  max-width: 28px;
  min-height: 0;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  transition: filter var(--transition);
}
.bar-col:hover .bar { filter: brightness(1.2); }
.bar-col:hover .bar-track { background: rgba(255,255,255,0.03); }
.bar-peak {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--text-light);
  white-space: nowrap;
  pointer-events: none;
}
.bar-label {
  height: 18px;
  padding-top: 4px;
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
  overflow: visible;
}

.rank-list { display: flex; flex-direction: column; gap: 8px; list-style: none; padding: 0; }
.rank-row {
  display: grid;
  grid-template-columns: minmax(140px, 2fr) 3fr auto;
  align-items: center;
  gap: 12px;
  font-size: 0.86rem;
}
.rank-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
a.rank-name:hover .rank-name-text { color: var(--accent); }
.rank-name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-gone { color: var(--text-muted); font-size: 0.78rem; }
.rank-track { height: 10px; background: rgba(255,255,255,0.04); border-radius: 0 4px 4px 0; }
.rank-bar { display: block; height: 100%; min-width: 2px; background: var(--accent); border-radius: 0 4px 4px 0; }
.rank-value { color: var(--text-light); font-variant-numeric: tabular-nums; white-space: nowrap; }
.logo--xs { width: 28px; border-radius: 5px; }

.heatmap-scroll { overflow-x: auto; padding-bottom: 6px; }
.heatmap { display: inline-flex; gap: 3px; }
.heatmap-week { display: flex; flex-direction: column; gap: 3px; }
.heatmap-month { height: 14px; font-size: 0.66rem; color: var(--text-muted); white-space: nowrap; width: 12px; overflow: visible; }
.heatmap-cell { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
/* Séquentiel, une seule teinte : du presque éteint au plein éclat. */
.heatmap-cell--0 { background: rgba(255,255,255,0.05); }
.heatmap-cell--1 { background: rgba(255,138,61,0.28); }
.heatmap-cell--2 { background: rgba(255,138,61,0.50); }
.heatmap-cell--3 { background: rgba(255,138,61,0.75); }
.heatmap-cell--4 { background: var(--accent); }
.heatmap-cell--void { background: transparent; }
.heatmap-cell[title]:hover { outline: 1px solid var(--text-light); }
.heatmap-legend { display: flex; align-items: center; gap: 4px; margin-top: 8px; font-size: 0.72rem; color: var(--text-muted); }

@media (max-width: 768px) {
  /* Sélecteur de période : pleine largeur, cibles égales au pouce. */
  .period-switch { display: flex; width: 100%; }
  .period-switch-item { flex: 1; text-align: center; padding: 8px 2px; }

  /* Cartes de chiffres : deux par ligne au lieu d'une colonne interminable. */
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 24px; }
  .stat-card { padding: 14px 8px; }
  .stat-value { font-size: 1.3rem; margin-bottom: 4px; }
  .stat-unit { font-size: 0.8rem; }
  .stat-label { font-size: 0.74rem; line-height: 1.35; }

  .chart-card { padding: 14px 10px; }
  .bar-chart { height: 150px; gap: 1px; }
  .bar-chart--small { height: 120px; }
  .bar { border-radius: 2px 2px 0 0; }
  .bar-label { font-size: 0.6rem; }

  /* Classement : le nom sur sa propre ligne, entier, la barre en dessous. */
  .rank-list { gap: 12px; }
  .rank-row { grid-template-columns: 1fr auto; gap: 4px 10px; }
  .rank-name { grid-column: 1; }
  .rank-name-text { white-space: normal; }
  .rank-value { grid-column: 2; grid-row: 1; }
  .rank-track { grid-column: 1 / -1; grid-row: 2; height: 8px; }

  /* Calendrier : plus large que l'écran, il défile. Le conteneur en rtl
     place le défilement à droite au chargement, donc sur les semaines les
     plus récentes ; le contenu, lui, reste en lecture gauche -> droite. */
  .heatmap-scroll { direction: rtl; }
  .heatmap { direction: ltr; }
}

/* =========================================================
   Mobile
   ========================================================= */
@media (max-width: 768px) {
  :root {
    --sidebar-w: 0px;
    --player-pad-y: max(env(safe-area-inset-bottom), 10px);
    --player-h: calc(52px + 2 * var(--player-pad-y));
  }

  body { flex-direction: column; }

  .sidebar { transform: translateX(-240px); width: 240px; }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,0.5); }

  .mobile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    padding-top: max(env(safe-area-inset-top), 10px);
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 99;
  }
  .hamburger-btn { display: flex; align-items: center; padding: 4px; color: var(--text); }
  .mobile-logo { display: flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 700; font-size: 1rem; }

  .main-wrapper { margin-left: 0; }
  .content { padding: 20px 16px; }
  .page-title { font-size: 1.35rem; }

  .player-bar { left: 0; height: auto; padding: var(--player-pad-y) 12px; gap: 10px; }
  .player-extra { display: none; }
  .player-btn { padding: 7px; }
  .player-btn--main { width: 42px; height: 42px; }
  .player-controls { gap: 0; }

  .stations-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
  .station-card-body { padding: 8px 10px 10px; }

  .station-header { flex-direction: column; gap: 16px; }
  .station-header-cover { width: 140px; }
  .station-header-title { font-size: 1.4rem; }

  .form-grid { grid-template-columns: 1fr; }
  .form-card { padding: 16px; }

  .filter-select { flex: 1 1 140px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .eq i { animation: none; transform: scaleY(0.7); }
  .spinner, .loader-spinner { animation-duration: 2s; }
}
