/* ANEXA · Flat Dark — diseño insignia
   ═══════════════════════════════════════════════════════════════════════════
   MÓVIL PRIMERO Y SIN TAMAÑOS FIJOS.

   El player vive dentro de iframes y divs de cualquier medida, así que no se
   mide contra la ventana: se mide contra SU PROPIO contenedor (container
   queries) y todo lo suyo —tipografía, botón, carátula, espacios— se expresa
   en unidades del contenedor (cqmin/cqh/cqw). Resultado: en vez de saltar
   entre medidas inventadas, crece y se encoge de forma continua.

   La base (sin ninguna consulta) es el caso más chico y vertical: móvil.
   De ahí solo se REACOMODA cuando la forma de la caja lo pide.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --bg-color: #121214;
  --card-bg: #1e1e24;
  --accent-color: #FF5A1F;   /* naranja de marca ANEXA */
  --text-main: #ffffff;
  --text-sec: #9a9aa6;
}

* { box-sizing: border-box; }

body, html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  font-family: 'Outfit', sans-serif;
  overflow: hidden;
}

/* Contenedor de referencia: lo de dentro se mide contra esta caja. */
.player-wrapper {
  container-type: size;
  container-name: player;
  width: 100%;
  height: 100%;
  min-height: 0;
}

/* ─── BASE (móvil / vertical): una columna, carátula protagonista ───────── */
.dashboard-layout {
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas:
    "cover"
    "info";
  gap: 3cqmin;
  padding: 4cqmin;
  align-items: center;
  justify-items: center;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.left-side {
  grid-area: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.right-side {
  grid-area: info;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.5cqmin;
  width: 100%;
  min-width: 0;
  min-height: 0;
  text-align: center;
}

.dash-panel { max-height: 100%; }

/* Carátula cuadrada ajustada a su celda: el ancho sale del alto y el alto del
   ancho, tomando el menor. Llena sin deformarse ni desbordar. */
.cover-art-container {
  width: auto;
  height: 100%;
  /* Tope: en una pantalla grande la carátula no debe crecer sin fin; a partir
     de aquí el espacio de más queda como aire alrededor. */
  max-width: min(100%, 450px);
  max-height: min(100%, 450px);
  aspect-ratio: 1 / 1;
  border-radius: 4cqmin;
  background: linear-gradient(145deg, #26262e 0%, #17171c 100%);
  background-size: cover;
  background-position: center;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 3cqmin 7cqmin rgba(0, 0, 0, 0.65);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  transition: box-shadow 0.6s ease, transform 0.6s ease;
}

.cover-fallback-icon {
  font-size: 14cqmin;
  color: rgba(255, 255, 255, 0.14);
}

.cover-art-container[style*="background-image"] .cover-fallback-icon { opacity: 0; }

.player-wrapper.is-playing .cover-art-container {
  transform: scale(1.02);
  box-shadow: 0 3cqmin 7cqmin rgba(0, 0, 0, 0.65), 0 0 5cqmin rgba(255, 90, 31, 0.22);
}

/* ─── Textos ───────────────────────────────────────────────────────────── */
.station-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  max-width: 100%;
}

.badge-status {
  font-size: clamp(9px, 2.6cqmin, 11px);
  color: var(--accent-color);
  font-weight: 800;
  letter-spacing: 0.25em;
  margin-bottom: 0.4cqmin;
  white-space: nowrap;
}

.station-title {
  font-size: clamp(0.95rem, 8cqmin, 3.2rem);
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* "Ahora suena" con marquesina cuando el texto no cabe */
.track-marquee {
  overflow: hidden;
  max-width: 100%;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
}

.track-title {
  font-size: clamp(0.72rem, 4cqmin, 1.2rem);
  color: var(--text-sec);
  font-weight: 300;
  margin: 0;
  white-space: nowrap;
  display: inline-block;
  padding: 0 14px;
}

.track-title.is-marquee {
  animation: marqueeSlide var(--marq-dur, 9s) linear infinite alternate;
}

@keyframes marqueeSlide {
  0%   { transform: translateX(0); }
  12%  { transform: translateX(0); }
  88%  { transform: translateX(calc(-1 * var(--marq-dist, 0px))); }
  100% { transform: translateX(calc(-1 * var(--marq-dist, 0px))); }
}

/* ─── Ecualizador ──────────────────────────────────────────────────────── */
.linear-eq {
  display: flex;
  align-items: flex-end;
  gap: 1cqmin;
  height: 7cqmin;
  max-height: 32px;
  width: 40cqmin;
  max-width: 150px;
}

.l-bar {
  flex: 1;
  border-radius: 2px 2px 0 0;
  background-color: var(--accent-color);
  opacity: 0.18;
}

.player-wrapper.is-playing .l-bar {
  opacity: 0.95;
  animation: lBounce 0.4s infinite alternate;
}

.player-wrapper.is-playing .l-bar:nth-child(2n) { animation-duration: 0.34s; }
.player-wrapper.is-playing .l-bar:nth-child(3n) { animation-duration: 0.48s; }

@keyframes lBounce {
  0%   { transform: scaleY(0.2); transform-origin: bottom; }
  100% { transform: scaleY(1.3); transform-origin: bottom; }
}

/* ─── Controles ────────────────────────────────────────────────────────── */
.control-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5cqmin;
  max-width: 100%;
}

.play-btn-large {
  width: clamp(38px, 18cqmin, 76px);
  height: clamp(38px, 18cqmin, 76px);
  aspect-ratio: 1 / 1;
  flex: 0 0 auto;
  border-radius: 50%;
  border: none;
  background-color: var(--accent-color);
  color: #fff;
  font-size: clamp(1rem, 8cqmin, 2.3rem);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 2cqmin 6cqmin rgba(255, 90, 31, 0.35);
}

.play-btn-large:hover:not(:disabled) { transform: scale(1.06); }
.play-btn-large:active:not(:disabled) { transform: scale(0.97); }
.play-btn-large:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

.play-btn-large:disabled {
  background-color: #2c2c33;
  color: #6a6a75;
  box-shadow: none;
  cursor: not-allowed;
}

.vol-control {
  display: flex;
  align-items: center;
  gap: 2.5cqmin;
  min-width: 0;
  width: 55cqmin;
  max-width: 250px;
}

.vol-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-color);
  cursor: pointer;
  transition: transform 0.15s;
}

.vol-slider::-webkit-slider-thumb:hover { transform: scale(1.25); }

.vol-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: none;
  border-radius: 50%;
  background: var(--accent-color);
  cursor: pointer;
}

.vol-slider::-moz-range-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════
   REACOMODOS SEGÚN LA FORMA DE LA CAJA (no de la pantalla)
   Tres formas, ninguna atada a medidas de pantalla: se activan por la
   PROPORCIÓN del contenedor del player.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Más ancho que alto → dos columnas: carátula | datos ──────────────── */
@container player (aspect-ratio > 1.15) {
  .dashboard-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: "cover info";
    gap: 4cqh;
    padding: 6cqh 5cqw;
  }
  .right-side {
    align-items: flex-start;
    text-align: left;
    gap: 3.5cqh;
  }
  .station-meta { align-items: flex-start; }
  .control-row { justify-content: flex-start; gap: 4cqh; }
  .station-title { font-size: clamp(1rem, 13cqh, 3.2rem); }
  .track-title { font-size: clamp(0.75rem, 6cqh, 1.2rem); }
  .play-btn-large {
    width: clamp(40px, 30cqh, 76px);
    height: clamp(40px, 30cqh, 76px);
    font-size: clamp(1rem, 14cqh, 2.3rem);
  }
  .linear-eq { height: 12cqh; width: 26cqw; }
  .vol-control { width: 30cqw; gap: 1.5cqw; }
  .cover-fallback-icon { font-size: 24cqh; }
}

/* ── Barra (mucho más ancha que alta) → una sola fila ─────────────────── */
@container player (aspect-ratio > 2.6) {
  .dashboard-layout {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "cover info";
    /* Relleno chico: en una barra cada píxel de alto cuenta para que la
       carátula se vea grande. */
    padding: 6cqh 2.5cqw;
    gap: 2.5cqw;
  }
  /* El panel de datos se vuelve la fila: textos estirados al centro y los
     controles pegados al borde derecho. */
  .right-side {
    flex-direction: row;
    align-items: center;
    gap: 2.5cqw;
  }
  .station-meta { flex: 1 1 auto; align-items: flex-start; }
  .station-title { font-size: clamp(0.9rem, 22cqh, 1.9rem); }
  .track-title { font-size: clamp(0.7rem, 15cqh, 1rem); }
  .linear-eq { display: none; }          /* lo primero que sobra en una barra */
  .control-row { flex: 0 0 auto; gap: 1.5cqw; }
  .play-btn-large {
    width: clamp(36px, 46cqh, 64px);
    height: clamp(36px, 46cqh, 64px);
    font-size: clamp(1rem, 22cqh, 1.7rem);
    box-shadow: none;
  }
  .vol-control { width: 12cqw; max-width: 130px; }
  .cover-art-container { border-radius: 2cqh; }
}

/* ── Pastilla (barra finita) → solo botón y título ────────────────────── */
@container player (aspect-ratio > 2.6) and (max-height: 78px) {
  .dashboard-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "info";
  }
  .left-side { display: none; }          /* no cabe carátula que se vea */
  .vol-control { display: none; }        /* el oyente usa el volumen del sistema */
  .right-side { flex-direction: row-reverse; gap: 3cqw; }
  .badge-status { display: none; }
}

/* ── Columna muy angosta → el texto manda, la carátula se va ──────────── */
@container player (max-width: 220px) {
  .left-side { display: none; }
  .linear-eq { display: none; }
  .control-row { flex-direction: column; gap: 3cqmin; }
  .vol-control { width: 100%; }
}

/* ─── Respaldo para navegadores sin container queries (anteriores a 2023) ── */
@supports not (container-type: size) {
  .dashboard-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: "cover info";
    gap: 24px;
    padding: 24px 32px;
  }
  .right-side { align-items: flex-start; text-align: left; gap: 18px; }
  .station-meta { align-items: flex-start; }
  .station-title { font-size: clamp(1.2rem, 4vw, 3rem); }
  .play-btn-large { width: 64px; height: 64px; font-size: 2rem; }
  .cover-fallback-icon { font-size: 3rem; }
  .linear-eq { height: 28px; width: 140px; }
  .vol-control { width: 200px; }
}

@supports not (container-type: size) {
  @media (max-width: 768px) {
    .dashboard-layout {
      grid-template-columns: minmax(0, 1fr);
      grid-template-rows: minmax(0, 1fr) auto;
      grid-template-areas: "cover" "info";
    }
    .right-side { align-items: center; text-align: center; }
    .station-meta { align-items: center; }
  }
  @media (max-height: 240px) {
    .left-side { display: none; }
    .linear-eq { display: none; }
  }
}

/* Quien prefiere menos movimiento, menos animación. */
@media (prefers-reduced-motion: reduce) {
  .player-wrapper.is-playing .l-bar,
  .track-title.is-marquee { animation: none; }
  .cover-art-container { transition: none; }
}
