/* ============================================================
   Hoy Trasnoche — micrositio
   Paleta tomada del sitio original: negro, coral #f45454,
   ámbar #fec345 y Poppins.
   ============================================================ */

:root {
  --negro:      #000000;
  --panel:      #0d0d0f;
  --panel-alto: #16161a;
  --borde:      #26262c;
  --texto:      #f7f7f7;
  --tenue:      #9c9ca6;
  --coral:      #f45454;
  --coral-osc:  #d33f3f;
  --ambar:      #fec345;
  --verde:      #4ec98b;
  --radio:      14px;
  --alto-rep:   84px;
  --sombra:     0 10px 30px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--negro);
  color: var(--texto);
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { padding-bottom: calc(var(--alto-rep) + 24px); }

.oculto { display: none !important; }

svg { width: 20px; height: 20px; fill: none; stroke: currentColor;
      stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* Los triángulos de play y las barras de pausa son sólidos, no trazo */
.boton-play svg, .play-overlay svg, .tarjeta-acciones svg[data-solido] { fill: currentColor; stroke: none; }
.boton-play svg { fill: currentColor; stroke: none; }
.play-overlay svg { fill: currentColor; stroke: none; }

/* ── Botones ─────────────────────────────────────────────── */

.boton {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit; font-weight: 600; font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .06s;
}
.boton:active { transform: translateY(1px); }
.boton:disabled { opacity: .45; cursor: not-allowed; }

.boton-primario  { background: var(--coral); color: #fff; }
.boton-primario:hover:not(:disabled) { background: var(--coral-osc); }

.boton-secundario { background: transparent; color: var(--ambar); border-color: var(--ambar); }
.boton-secundario:hover:not(:disabled) { background: rgba(254, 195, 69, .12); }

.boton-fantasma { background: transparent; color: var(--tenue); border-color: var(--borde); }
.boton-fantasma:hover { color: var(--texto); border-color: var(--tenue); }

.boton-peligro { background: transparent; color: var(--coral); border-color: var(--coral); }
.boton-peligro:hover { background: rgba(244, 84, 84, .12); }

.boton-mini { padding: 5px 12px; font-size: 12px; background: transparent;
              color: var(--tenue); border-color: var(--borde); }
.boton-mini:hover { color: var(--texto); }

.boton-ancho { width: 100%; justify-content: center; }

.icono {
  display: inline-flex; align-items: center; justify-content: center;
  position: relative;
  width: 36px; height: 36px;
  padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--tenue);
  cursor: pointer; text-decoration: none;
  transition: background .15s, color .15s;
}
.icono:hover { background: var(--panel-alto); color: var(--texto); }
.icono-num {
  position: absolute; bottom: 2px; right: 2px;
  font-size: 8px; font-weight: 700; color: inherit;
}

/* ── Login ───────────────────────────────────────────────── */

.pantalla-login {
  display: grid; place-items: center;
  min-height: 100vh; padding: 24px;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(244, 84, 84, .17), transparent 70%),
    var(--negro);
}
.login-caja {
  width: 100%; max-width: 380px;
  padding: 40px 32px;
  background: var(--panel);
  border: 1px solid var(--borde);
  border-radius: 20px;
  box-shadow: var(--sombra);
  text-align: center;
}
.login-logo { width: 190px; max-width: 100%; height: auto; margin-bottom: 6px; }
.login-bajada { margin: 0 0 26px; color: var(--tenue); font-size: 14px; }
.login-form { display: grid; gap: 16px; }

.campo { display: grid; gap: 7px; text-align: left; }
.campo-label { font-size: 12px; font-weight: 600; color: var(--tenue);
               text-transform: uppercase; letter-spacing: .06em; }
.campo input {
  width: 100%; padding: 13px 15px;
  background: var(--negro);
  border: 1px solid var(--borde); border-radius: 11px;
  color: var(--texto); font: inherit; font-size: 15px;
  letter-spacing: .05em;
}
.campo input:focus { outline: none; border-color: var(--coral); }

.login-error {
  margin: 0; padding: 10px 13px;
  background: rgba(244, 84, 84, .12);
  border: 1px solid rgba(244, 84, 84, .4);
  border-radius: 10px;
  color: #ffb4b4; font-size: 13px;
}
.login-nota { margin: 24px 0 0; color: #63636d; font-size: 11.5px; line-height: 1.5; }

/* ── Cabecera ────────────────────────────────────────────── */

.cabecera {
  position: sticky; top: 0; z-index: 30;
  padding: 16px 26px 14px;
  background: rgba(0, 0, 0, .93);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--borde);
}
.cabecera-fila { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.cabecera-logo { height: 42px; width: auto; }
.cabecera-datos { flex: 1; min-width: 200px; color: var(--tenue); font-size: 13px; }
.cabecera-datos strong { color: var(--texto); font-weight: 600; }

.acciones { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.buscador { flex: 1; min-width: 190px; display: flex; justify-content: flex-end; }
.buscador input {
  width: 100%; max-width: 320px; padding: 10px 16px;
  background: var(--panel); border: 1px solid var(--borde); border-radius: 999px;
  color: var(--texto); font: inherit; font-size: 14px;
}
.buscador input:focus { outline: none; border-color: var(--coral); }

/* ── Panel de trabajo ────────────────────────────────────── */

.panel-job {
  margin: 18px 26px 0; padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--borde);
  border-left: 3px solid var(--coral);
  border-radius: var(--radio);
}
.job-cab { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.job-chip {
  padding: 4px 11px; border-radius: 999px;
  background: rgba(244, 84, 84, .15); color: var(--coral);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
}
.job-chip.listo  { background: rgba(78, 201, 139, .15); color: var(--verde); }
.job-chip.error  { background: rgba(244, 84, 84, .2);  color: #ff8f8f; }
.job-chip.aviso  { background: rgba(254, 195, 69, .15); color: var(--ambar); }
.job-paso { flex: 1; min-width: 160px; font-size: 14px; }
.job-contador { color: var(--tenue); font-size: 13px; font-variant-numeric: tabular-nums; }
.job-episodio { margin-top: 8px; color: var(--tenue); font-size: 13px; }
.job-episodio strong { color: var(--texto); }

.barra { height: 6px; margin-top: 12px; background: var(--panel-alto);
         border-radius: 999px; overflow: hidden; }
.barra-relleno {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--coral), var(--ambar));
  border-radius: 999px;
  transition: width .3s ease;
}
.barra-relleno.indeterminada {
  width: 35% !important;
  animation: vaiven 1.5s ease-in-out infinite;
}
@keyframes vaiven {
  0%   { margin-left: 0; }
  50%  { margin-left: 65%; }
  100% { margin-left: 0; }
}

.job-log {
  max-height: 240px; margin: 12px 0 0; padding: 12px;
  overflow: auto;
  background: var(--negro); border: 1px solid var(--borde); border-radius: 10px;
  color: var(--tenue);
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 11.5px; line-height: 1.65;
  white-space: pre-wrap; word-break: break-word;
}

/* ── Grilla de episodios ─────────────────────────────────── */

.contenido { padding: 22px 26px 40px; }

.grilla {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
  gap: 22px;
}

.tarjeta {
  background: var(--panel);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  overflow: hidden;
  transition: border-color .18s, transform .18s;
}
.tarjeta:hover { border-color: #3a3a44; transform: translateY(-2px); }
.tarjeta.sonando { border-color: var(--coral); }

.tarjeta-portada { position: relative; aspect-ratio: 1; background: var(--panel-alto); }
.tarjeta-portada img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Las carátulas del podcast tienen texto grande arriba y el número se les
   encimaba. Este degradado lo despega sin tapar la ilustración. */
.tarjeta-portada::before {
  content: '';
  position: absolute; inset: 0 0 auto 0; height: 58px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, .72), transparent);
  pointer-events: none;
}

.play-overlay {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  width: 100%; height: 100%;
  border: 0; padding: 0;
  background: rgba(0, 0, 0, .45);
  color: #fff; cursor: pointer;
  opacity: 0; transition: opacity .18s;
}
.play-overlay svg { width: 46px; height: 46px; }
.tarjeta:hover .play-overlay,
.play-overlay:focus-visible { opacity: 1; }

.tarjeta-numero {
  position: absolute; top: 9px; left: 9px;
  padding: 3px 9px; border-radius: 999px;
  background: rgba(0, 0, 0, .78);
  color: var(--ambar); font-size: 11px; font-weight: 700;
}

.tarjeta-cuerpo { padding: 13px 14px 11px; }
.tarjeta-titulo {
  margin: 0 0 5px; font-size: 14px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}
.tarjeta-meta { margin: 0 0 11px; color: var(--tenue); font-size: 11.5px; }
.tarjeta-pie { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tarjeta-acciones { display: flex; gap: 2px; }
.tarjeta-acciones .icono { width: 30px; height: 30px; }
.tarjeta-acciones svg { width: 16px; height: 16px; }

.chip {
  padding: 3px 9px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; white-space: nowrap;
}
.chip-server { background: rgba(78, 201, 139, .13); color: var(--verde); }
.chip-nube   { background: rgba(254, 195, 69, .13); color: var(--ambar); }
.chip-falta  { background: var(--panel-alto); color: var(--tenue); }

.tarjeta-estado:not(:empty) {
  margin-top: 9px; padding-top: 9px;
  border-top: 1px solid var(--borde);
  color: var(--ambar); font-size: 11.5px;
}

.vacio { max-width: 520px; margin: 70px auto; text-align: center; color: var(--tenue); }
.vacio h2 { margin: 0 0 10px; color: var(--texto); font-size: 20px; }
.vacio p { line-height: 1.7; font-size: 14px; }
.vacio strong { color: var(--ambar); }

.sin-resultados { margin: 50px 0; color: var(--tenue); text-align: center; }

/* ── Reproductor ─────────────────────────────────────────── */

.reproductor {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; align-items: center; gap: 16px;
  height: var(--alto-rep); padding: 0 20px;
  background: rgba(13, 13, 15, .97);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--borde);
}
.rep-portada { width: 54px; height: 54px; border-radius: 9px; object-fit: cover; flex: none; }
.rep-info { min-width: 0; width: 210px; flex: none; }
.rep-titulo { font-size: 13.5px; font-weight: 600; white-space: nowrap;
              overflow: hidden; text-overflow: ellipsis; }
.rep-sub { color: var(--tenue); font-size: 11.5px; white-space: nowrap;
           overflow: hidden; text-overflow: ellipsis; }

.rep-controles { display: flex; align-items: center; gap: 6px; flex: none; }
.boton-play {
  display: grid; place-items: center;
  width: 46px; height: 46px; padding: 0;
  border: 0; border-radius: 50%;
  background: var(--coral); color: #fff;
  cursor: pointer;
  transition: background .15s, transform .06s;
}
.boton-play:hover { background: var(--coral-osc); }
.boton-play:active { transform: scale(.94); }
.boton-play svg { width: 24px; height: 24px; }

.rep-tiempo { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 120px; }
.rep-tiempo span { color: var(--tenue); font-size: 11.5px;
                   font-variant-numeric: tabular-nums; flex: none; }

.scrub {
  flex: 1; height: 5px; margin: 0;
  appearance: none; -webkit-appearance: none;
  /* --avance (0-100) lo actualiza app.js: sin esto la barra se ve toda igual
     y no se distingue lo ya escuchado de lo que falta. */
  background: linear-gradient(to right,
              var(--coral) 0 calc(var(--avance, 0) * 1%),
              var(--panel-alto) calc(var(--avance, 0) * 1%) 100%);
  border-radius: 999px; cursor: pointer;
}
.scrub::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--coral); border: 0; cursor: pointer;
}
.scrub::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--coral); border: 0; cursor: pointer;
}
.scrub:focus { outline: none; }
.scrub:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(244, 84, 84, .3); }

.rep-extra { display: flex; align-items: center; gap: 6px; flex: none; }

/* ── Adaptación a pantallas chicas ───────────────────────── */

@media (max-width: 860px) {
  .cabecera { padding: 13px 16px 12px; }
  .contenido { padding: 18px 16px 30px; }
  .panel-job { margin: 14px 16px 0; }
  .buscador { justify-content: flex-start; }
  .buscador input { max-width: none; }
  .rep-info { width: 130px; }
}

@media (max-width: 620px) {
  :root { --alto-rep: 128px; }
  .grilla { grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: 14px; }
  .tarjeta-titulo { font-size: 12.5px; }
  .cabecera-logo { height: 34px; }

  /* Grilla en vez de flex para que el acomodo sea predecible: dos botones
     por fila, y la cancelación y el buscador a lo ancho. Con flex el corte
     de línea depende del ancho de cada etiqueta y cambia según el texto.
     minmax(0, 1fr) permite que las columnas se achiquen por debajo de su
     contenido, cosa que flex no hace. */
  .acciones {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .acciones .boton { width: 100%; justify-content: center; }
  #btn-cancelar, .buscador { grid-column: 1 / -1; }

  /* Lo mismo en el panel de trabajo: el paso tenía un mínimo de 160px que no
     entraba junto al chip y el contador. */
  .job-paso, .job-contador { min-width: 0; overflow-wrap: anywhere; }
  .job-paso { flex-basis: 100%; }

  /* El reproductor no puede empujar hacia afuera aunque el título sea largo */
  .reproductor > * { min-width: 0; }

  /* El reproductor pasa a dos filas: datos + control arriba, barra abajo */
  .reproductor { flex-wrap: wrap; height: var(--alto-rep); padding: 10px 14px; align-content: center; }
  .rep-info { width: auto; flex: 1; }
  .rep-tiempo { order: 3; width: 100%; flex-basis: 100%; }
  .rep-portada { width: 44px; height: 44px; }
}
