/* ===========================================================================
   Podcast Studio — UI moderna
   =========================================================================== */
:root {
  --bg-0: #07080d;
  --bg-1: #0d1018;
  --card: rgba(22, 26, 38, 0.72);
  --card-solid: #161a26;
  --card-2: #1c2130;
  --stroke: rgba(255, 255, 255, 0.08);
  --stroke-strong: rgba(255, 255, 255, 0.16);
  --text: #eef1f8;
  --muted: #99a0b4;
  --faint: #6b7080;
  --accent: #8b5cff;
  --accent-2: #25d8b0;
  --accent-3: #ff7ac3;
  --danger: #ff6b6b;
  --ok: #36d399;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --grad: linear-gradient(135deg, var(--accent), var(--accent-2));
  --grad-text: linear-gradient(120deg, #b69bff 0%, #7ad9ff 45%, #5fe6c0 100%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg-0);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Fondo animado con auroras de color ------------------------------------- */
.bg-aurora {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(45rem 45rem at 12% -8%, rgba(139, 92, 255, 0.22), transparent 60%),
    radial-gradient(40rem 40rem at 105% 8%, rgba(37, 216, 176, 0.18), transparent 60%),
    radial-gradient(48rem 48rem at 50% 120%, rgba(255, 122, 195, 0.12), transparent 60%),
    var(--bg-0);
  filter: saturate(115%);
}
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 80%);
  animation: gridDrift 40s linear infinite;
}
@keyframes gridDrift { to { background-position: 44px 44px; } }

/* Header ------------------------------------------------------------------ */
header {
  text-align: center;
  padding: 3rem 1rem 1.2rem;
  position: relative;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -1px;
  margin: 0;
}
.brand .logo {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 14px;
  background: var(--grad);
  box-shadow: 0 8px 26px rgba(139, 92, 255, 0.45);
  font-size: 1.5rem;
  animation: floaty 5s ease-in-out infinite;
}
@keyframes floaty { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-6px)} }
.brand .word {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 200% auto;
  animation: shine 6s linear infinite;
}
@keyframes shine { to { background-position: 200% center; } }
.tagline { color: var(--muted); margin: 0.6rem auto 0; max-width: 42rem; }

/* Layout ------------------------------------------------------------------ */
main {
  max-width: 880px;
  margin: 0 auto;
  padding: 1rem 1.1rem 5rem;
  display: flex;
  flex-direction: column;
  gap: 1.3rem;
}

/* Tarjetas con entrada animada ------------------------------------------- */
.card {
  position: relative;
  background: var(--card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow);
  animation: cardIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  padding: 1px;
  background: linear-gradient(135deg, rgba(139, 92, 255, 0.5), transparent 40%, transparent 60%, rgba(37, 216, 176, 0.4));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.5;
  pointer-events: none;
}
.card:nth-of-type(1) { animation-delay: 0.05s; }
.card:nth-of-type(2) { animation-delay: 0.12s; }
.card:nth-of-type(3) { animation-delay: 0.19s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(0.99); } to { opacity: 1; transform: none; } }

.card h2 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.card h2 .num {
  display: grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  font-size: 0.8rem;
  border-radius: 8px;
  background: rgba(139, 92, 255, 0.18);
  color: #c9b6ff;
  border: 1px solid rgba(139, 92, 255, 0.35);
}
.card h3 { margin: 0.1rem 0 0.7rem; font-size: 0.95rem; color: var(--accent-2); }
.hint { color: var(--muted); font-size: 0.86rem; margin: 0.1rem 0 1rem; }

/* Campos ------------------------------------------------------------------ */
.field { display: flex; flex-direction: column; gap: 0.4rem; margin: 0.85rem 0; }
.field > span { font-size: 0.82rem; color: var(--muted); font-weight: 500; }
input[type="text"], textarea, select {
  background: rgba(10, 12, 18, 0.7);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  color: var(--text);
  padding: 0.7rem 0.8rem;
  font: inherit;
  width: 100%;
  resize: vertical;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
input[type="text"]::placeholder, textarea::placeholder { color: var(--faint); }
input[type="text"]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(139, 92, 255, 0.16);
  background: rgba(10, 12, 18, 0.95);
}
select { cursor: pointer; }

/* Dropzone ---------------------------------------------------------------- */
.dropzone {
  position: relative;
  border: 1.5px dashed var(--stroke-strong);
  border-radius: 14px;
  padding: 1.6rem;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.dropzone:hover { border-color: var(--accent); background: rgba(139, 92, 255, 0.06); }
.dropzone.drag {
  border-color: var(--accent-2);
  background: rgba(37, 216, 176, 0.1);
  transform: scale(1.01);
}
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dz-inner { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; color: var(--muted); pointer-events: none; }
.dz-icon { font-size: 2rem; animation: floaty 4s ease-in-out infinite; }
.file-list { list-style: none; margin: 0.9rem 0 0; padding: 0; text-align: left; }
.file-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
  background: var(--card-2); border: 1px solid var(--stroke);
  border-radius: 10px; padding: 0.45rem 0.7rem; margin-top: 0.4rem; font-size: 0.85rem;
  animation: chipIn 0.35s ease both;
}
@keyframes chipIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
.file-list .rm { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 1.05rem; line-height: 1; padding: 0 0.2rem; transition: transform 0.15s; }
.file-list .rm:hover { transform: scale(1.25) rotate(90deg); }

/* Segmentos (radios tipo pill) ------------------------------------------- */
.radio-row { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.pill {
  position: relative;
  display: inline-flex; flex-direction: column; gap: 0.1rem;
  background: var(--card-2); border: 1px solid var(--stroke);
  border-radius: 14px; padding: 0.6rem 0.95rem; cursor: pointer; font-size: 0.9rem;
  transition: border-color 0.18s, background 0.18s, transform 0.12s, box-shadow 0.18s;
  user-select: none;
}
.pill:hover { transform: translateY(-2px); border-color: var(--stroke-strong); }
.pill em { color: var(--faint); font-style: normal; font-size: 0.74rem; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill:has(input:checked) {
  border-color: transparent;
  background: linear-gradient(135deg, rgba(139, 92, 255, 0.28), rgba(37, 216, 176, 0.18));
  box-shadow: 0 0 0 1.5px var(--accent), 0 8px 22px rgba(139, 92, 255, 0.25);
}
.pill:has(input:checked) em { color: #cfe9e1; }

.check {
  display: flex; align-items: center; gap: 0.6rem; margin: 1rem 0; font-size: 0.92rem; cursor: pointer;
  padding: 0.7rem 0.85rem; border: 1px solid var(--stroke); border-radius: 12px; background: var(--card-2);
  transition: border-color 0.18s, background 0.18s;
}
.check:hover { border-color: var(--stroke-strong); }
.check input { width: 1.15rem; height: 1.15rem; accent-color: var(--accent-2); }

/* Voces ------------------------------------------------------------------- */
.voices { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.voice-block {
  background: var(--card-2); border: 1px solid var(--stroke);
  border-radius: 14px; padding: 1.05rem;
  transition: transform 0.25s, opacity 0.25s;
}
#host-b-block { animation: cardIn 0.4s ease both; }
@media (max-width: 640px) { .voices { grid-template-columns: 1fr; } }

/* Botón principal --------------------------------------------------------- */
button.primary {
  position: relative;
  overflow: hidden;
  background: var(--grad);
  background-size: 180% auto;
  color: white; border: none; border-radius: 14px;
  padding: 1.05rem 1.2rem; font-size: 1.08rem; font-weight: 700;
  cursor: pointer; transition: transform 0.12s, box-shadow 0.2s, background-position 0.5s;
  box-shadow: 0 12px 30px rgba(139, 92, 255, 0.35);
}
button.primary:hover { transform: translateY(-2px); background-position: right center; box-shadow: 0 16px 40px rgba(139, 92, 255, 0.5); }
button.primary:active { transform: translateY(0); }
button.primary::after {
  content: "";
  position: absolute; top: 0; left: -120%;
  width: 60%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
}
button.primary:hover::after { animation: sweep 0.9s ease; }
@keyframes sweep { to { left: 140%; } }
button.primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

/* Stepper de progreso ----------------------------------------------------- */
.stepper { display: flex; justify-content: space-between; position: relative; margin: 0.4rem 0 1.4rem; }
.stepper::before {
  content: ""; position: absolute; top: 18px; left: 6%; right: 6%; height: 3px;
  background: var(--stroke); border-radius: 3px;
}
.stepper .track-fill {
  position: absolute; top: 18px; left: 6%; height: 3px; border-radius: 3px;
  background: var(--grad); width: 0%;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 12px rgba(37, 216, 176, 0.6);
}
.step { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; z-index: 1; flex: 1; }
.step .dot {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1rem;
  background: var(--card-solid); border: 2px solid var(--stroke-strong);
  transition: all 0.35s; color: var(--muted);
}
.step .lbl { font-size: 0.72rem; color: var(--faint); text-align: center; transition: color 0.3s; }
.step.done .dot { background: var(--grad); border-color: transparent; color: white; }
.step.done .lbl { color: var(--muted); }
.step.active .dot {
  border-color: var(--accent); color: #d7c8ff; background: rgba(139, 92, 255, 0.18);
  box-shadow: 0 0 0 0 rgba(139, 92, 255, 0.55);
  animation: pulse 1.5s infinite;
}
.step.active .lbl { color: var(--text); font-weight: 600; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(139, 92, 255, 0.5); }
  70% { box-shadow: 0 0 0 12px rgba(139, 92, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(139, 92, 255, 0); }
}

/* Barra de progreso animada ---------------------------------------------- */
.progress-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.4rem; }
.progress-head .pct { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.25rem; }
.progress-bar { position: relative; background: rgba(0, 0, 0, 0.4); border-radius: 999px; height: 14px; overflow: hidden; border: 1px solid var(--stroke); }
#progress-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3), var(--accent));
  background-size: 300% 100%;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  animation: flow 3s linear infinite;
  position: relative;
}
@keyframes flow { to { background-position: 300% 0; } }
#progress-fill::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(45deg, rgba(255,255,255,0.18) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.18) 50%, rgba(255,255,255,0.18) 75%, transparent 75%);
  background-size: 22px 22px;
  animation: stripes 0.8s linear infinite;
}
@keyframes stripes { to { background-position: 22px 0; } }
.stage-text { font-weight: 600; color: var(--muted); }

/* Ecualizador decorativo -------------------------------------------------- */
.eq { display: inline-flex; gap: 3px; align-items: flex-end; height: 18px; }
.eq span { width: 3px; background: var(--accent-2); border-radius: 2px; animation: eq 1s ease-in-out infinite; }
.eq span:nth-child(1) { animation-delay: 0s; height: 40%; }
.eq span:nth-child(2) { animation-delay: 0.2s; height: 80%; }
.eq span:nth-child(3) { animation-delay: 0.4s; height: 55%; }
.eq span:nth-child(4) { animation-delay: 0.1s; height: 95%; }
.eq span:nth-child(5) { animation-delay: 0.3s; height: 60%; }
@keyframes eq { 0%,100%{ transform: scaleY(0.4); } 50%{ transform: scaleY(1); } }

/* Log --------------------------------------------------------------------- */
.log {
  background: rgba(0, 0, 0, 0.45); border: 1px solid var(--stroke); border-radius: 12px;
  padding: 0.85rem; max-height: 240px; overflow-y: auto; font-size: 0.8rem;
  color: var(--muted); white-space: pre-wrap; word-break: break-word; margin: 0;
  font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  scrollbar-width: thin;
}
.log::-webkit-scrollbar { width: 8px; }
.log::-webkit-scrollbar-thumb { background: var(--stroke-strong); border-radius: 8px; }

/* Resultado --------------------------------------------------------------- */
#result-card { text-align: center; }
.result-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: rgba(54, 211, 153, 0.14); color: var(--ok);
  border: 1px solid rgba(54, 211, 153, 0.35); border-radius: 999px;
  padding: 0.3rem 0.8rem; font-size: 0.78rem; font-weight: 600; margin-bottom: 0.6rem;
  animation: popIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes popIn { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: scale(1); } }
#result-title { margin: 0.2rem 0; font-size: 1.45rem; }
.meta { color: var(--muted); margin: 0.3rem 0 1.1rem; font-variant-numeric: tabular-nums; }
audio { width: 100%; margin-bottom: 1.1rem; border-radius: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; }
.btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  background: var(--grad); color: #06241c; text-decoration: none;
  border: none; border-radius: 11px; padding: 0.65rem 1rem; font-weight: 700; cursor: pointer; font-size: 0.9rem;
  transition: transform 0.14s, filter 0.18s; color: #04221b;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--stroke-strong); }
.btn.ghost:hover { border-color: var(--accent); }
.transcript {
  text-align: left;
  background: rgba(0, 0, 0, 0.4); border: 1px solid var(--stroke); border-radius: 12px;
  padding: 1.1rem; margin-top: 1.1rem; max-height: 440px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-word; font-size: 0.92rem; line-height: 1.75;
  animation: cardIn 0.4s ease both;
}

/* Error ------------------------------------------------------------------- */
.error-card { border-color: rgba(255, 107, 107, 0.5); }
.error-card h2 { color: var(--danger); }
.shake { animation: shake 0.4s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-7px)} 40%,80%{transform:translateX(7px)} }

footer { text-align: center; color: var(--faint); font-size: 0.8rem; padding: 1.5rem 1rem 2.5rem; }
.hidden { display: none !important; }

/* Toast ------------------------------------------------------------------- */
#toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(2rem);
  background: var(--card-solid); border: 1px solid var(--stroke-strong); color: var(--text);
  padding: 0.7rem 1.1rem; border-radius: 12px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity 0.3s, transform 0.3s; z-index: 50; font-size: 0.9rem;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.05ms !important; }
}
