/* ============================================================
   Berbaz — tema claro. Paleta de marca: morado primario, turquesa
   secundario, acentos cálidos (amarillo/coral). Códigos facilitados por Jon.
   ============================================================ */

:root {
  --indigo: #3510A8;          /* morado principal (header, botones, pasos) */
  --indigo-dark: #4A20D4;     /* hover de botones */
  --indigo-deep: #24107F;     /* morado oscuro: fondo/degradado del hero */
  --indigo-soft: #F2F3FA;     /* fondos sutiles (cajas info) */
  --violet: #4C1DCC;          /* morado de acento: emisor, etiquetas, enlaces */
  --teal: #00A99D;            /* turquesa secundario (oyente / success) */
  --teal-soft: #d6f3f0;
  --yellow: #FFC72C;
  --coral: #FF4F6D;
  --ink: #1F2937;             /* texto principal */
  --body: #4B5563;            /* texto secundario */
  --muted: #6B7280;
  --bg: #F8F9FC;
  --card: #ffffff;
  --line: #E5E7EB;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(36, 16, 127, 0.05), 0 8px 24px -12px rgba(36, 16, 127, 0.18);
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
[hidden] { display: none !important; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--body);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

h1, h2, h3 { color: var(--ink); letter-spacing: -0.02em; line-height: 1.15; }
a { color: var(--violet); }

/* ---------- marca ---------- */

.brand { display: inline-flex; align-items: center; gap: 0.55rem; text-decoration: none; }
/* Símbolo del logo (infinito+onda) junto al wordmark en las barras superiores. */
.brand-mark { height: 26px; width: auto; display: block; }
.brand-word { font-weight: 800; font-size: 1.35rem; letter-spacing: -0.02em; color: var(--indigo); line-height: 1; }
/* Logo completo sobre el hero morado: tarjeta clara para que se lea bien. */
.brand-badge { background: #fff; padding: 0.4rem 0.7rem; border-radius: 12px; display: inline-flex; align-self: flex-start; box-shadow: 0 6px 16px -8px rgba(0,0,0,0.3); }
.brand-hero { height: 60px; width: auto; display: block; }

/* ---------- botones ---------- */

.btn {
  appearance: none; border: none; cursor: pointer; font-family: inherit;
  font-weight: 700; font-size: 1rem; border-radius: 999px;
  padding: 0.85rem 1.6rem; display: inline-flex; align-items: center; gap: 0.5rem;
  transition: transform 0.12s cubic-bezier(0.22,1,0.36,1), background 0.18s, box-shadow 0.18s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--indigo); color: #fff; box-shadow: 0 10px 20px -10px rgba(53,16,168,0.7); }
.btn-primary:hover { background: var(--indigo-dark); }
.btn-light { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.btn-light:hover { box-shadow: 0 12px 28px -12px rgba(36,16,127,0.35); }
.btn-ghost { background: transparent; color: var(--body); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--muted); color: var(--ink); }
.btn-danger { background: #fff; color: var(--coral); border: 1px solid #f6d2d8; }
.btn-danger:hover { background: #fff5f6; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-full { width: 100%; justify-content: center; }

/* ---------- topbar (paneles internos) ---------- */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem clamp(1.25rem, 5vw, 3rem);
  background: var(--card); border-bottom: 1px solid var(--line);
}
.topbar .right { display: flex; align-items: center; gap: 1rem; }
.link-quiet { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.link-quiet:hover { color: var(--ink); }

/* ---------- cards ---------- */

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.wrap { max-width: 720px; margin: 0 auto; padding: clamp(1.5rem, 5vw, 3rem) clamp(1.25rem, 5vw, 2rem); }

/* ---------- indicador de pasos ---------- */

.steps { display: flex; gap: clamp(1rem, 5vw, 3rem); justify-content: center; padding: 1.25rem; flex-wrap: wrap; }
.steps .step { display: flex; align-items: center; gap: 0.55rem; color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.steps .num { width: 26px; height: 26px; border-radius: 50%; background: var(--indigo-soft); color: var(--indigo); display: grid; place-items: center; font-size: 0.85rem; font-weight: 800; }
.steps .step.active { color: var(--ink); }
.steps .step.active .num { background: var(--indigo); color: #fff; }
.steps .step.done .num { background: var(--teal); color: #fff; }

/* ---------- steppers ---------- */

.field { display: flex; gap: 0.9rem; align-items: flex-start; }
.field .icon { width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center; }
/* Iconos: círculos sólidos con glifo blanco (emisor morado, oyente turquesa). */
.icon.emit { background: var(--violet); }
.icon.recv { background: var(--teal); }
.field .icon svg, .link-row .avatar svg { width: 22px; height: 22px; fill: #fff; }
.field h3 { font-size: 1.05rem; }
.field p { color: var(--muted); font-size: 0.9rem; }

.stepper { display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; margin-top: 0.9rem; }
.stepper button { appearance: none; border: none; background: #fff; font-size: 1.5rem; height: 56px; cursor: pointer; color: var(--indigo); transition: background 0.15s; }
.stepper button:hover { background: var(--indigo-soft); }
.stepper .val { text-align: center; font-size: 1.5rem; font-weight: 800; color: var(--ink); }

/* ---------- selector de idiomas (chips) ---------- */

.lang-grid { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.9rem; }
.lang-chip {
  appearance: none; cursor: pointer; font-family: inherit; font-weight: 600; font-size: 0.95rem;
  border: 1.5px solid var(--line); background: #fff; color: var(--body);
  border-radius: 999px; padding: 0.5rem 1rem; display: inline-flex; align-items: center; gap: 0.45rem;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.lang-chip:hover { border-color: var(--indigo); }
.lang-chip[aria-pressed="true"] { background: var(--indigo); border-color: var(--indigo); color: #fff; }

/* ---------- aviso ---------- */

.note { display: flex; gap: 0.6rem; background: var(--indigo-soft); color: #444444; border-radius: var(--radius-sm); padding: 0.85rem 1rem; font-size: 0.9rem; }
.note.warn { background: #fff5f6; color: #b3293c; }

/* ---------- pills de sección ---------- */

.section-pill { display: inline-block; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.3rem 0.7rem; border-radius: 7px; }
.pill-emit { background: var(--violet); color: #fff; }
.pill-recv { background: var(--teal); color: #fff; }

/* ---------- filas de enlace + QR ---------- */

.link-row { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.link-row + .link-row { margin-top: 0.75rem; }
.link-row .avatar { width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 1.2rem; }
.link-row .meta { flex: 1; min-width: 0; }
.link-row .meta .title { font-weight: 700; color: var(--ink); }
.link-row .meta .url { display: flex; align-items: center; gap: 0.4rem; color: var(--violet); font-size: 0.85rem; word-break: break-all; }
.link-row .meta .url button { appearance: none; border: none; background: none; cursor: pointer; color: var(--muted); padding: 2px; }
.link-row .meta .url button:hover { color: var(--violet); }
.link-row .qr { width: 74px; height: 74px; border-radius: 10px; flex: none; }
.link-row .live { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }

/* ---------- estado / puntos ---------- */

.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.active { background: var(--teal); }
.dot.connecting, .dot.reconnecting { background: var(--yellow); animation: pulse 1.2s infinite; }
.dot.error { background: var(--coral); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- hero / landing ---------- */

.hero {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: clamp(0.5rem, 2vw, 1.25rem);
}
.hero-card {
  position: relative; overflow: hidden;
  width: 100%; max-width: 520px;
  /* Cabe en una pantalla sin scroll: nunca más alta que el viewport */
  min-height: min(560px, calc(100dvh - 2.5rem));
  border-radius: 26px; padding: clamp(1.75rem, 5vw, 2.5rem);
  /* Extra a la izquierda: la pelota amarilla decorativa no pisa el texto */
  padding-left: clamp(2.5rem, 7vw, 3.5rem);
  padding-bottom: 1.2rem;
  background: linear-gradient(160deg, #3510A8 0%, #2C148F 55%, #24107F 100%);
  color: #fff; display: flex; flex-direction: column;
  box-shadow: 0 30px 60px -25px rgba(36,16,127,0.6);
}
.hero-card .shape { position: absolute; z-index: 0; pointer-events: none; }
.shape.teal { width: 190px; height: 190px; background: #1CC9B7; border-radius: 50%; top: 70px; right: -70px; opacity: 0.95; }
.shape.yellow { width: 78px; height: 78px; background: var(--yellow); border-radius: 50%; top: 150px; left: -26px; }
.shape.coral { width: 0; height: 0; border-left: 60px solid transparent; border-right: 60px solid transparent; border-bottom: 104px solid var(--coral); bottom: 80px; left: 24px; transform: rotate(18deg); }
.shape.dots { width: 130px; height: 90px; right: 40px; bottom: 110px; background-image: radial-gradient(rgba(139,92,246,0.85) 2px, transparent 2px); background-size: 18px 18px; }
.hero-card .content { position: relative; z-index: 1; display: flex; flex-direction: column; flex: 1; }
.hero-card h1 { color: #fff; font-size: clamp(2rem, 7vw, 2.7rem); font-weight: 800; margin-top: auto; }
.hero-card .sub { color: #D9D7F5; margin-top: 0.9rem; font-size: 1.05rem; max-width: 26ch; }
/* El CTA y el formulario de login ocupan la MISMA altura reservada: al
   pulsar "Saioa hasi" se intercambian sin que la tarjeta salte ni crezca. */
.hero-card .cta { margin-top: 1.25rem; min-height: 128px; }
.hero-foot { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 1rem; white-space: nowrap; margin-top: 0.9rem; padding-top: 0.8rem; border-top: 1px solid rgba(255,255,255,0.15); font-size: 0.82rem; }
.hero-foot a, .hero-foot span { color: rgba(255,255,255,0.7); text-decoration: none; }
.mail-link { display: inline-flex; align-items: center; gap: 0.4rem; }
.mail-link:hover { color: #fff; }

.login-form { margin-top: 1.25rem; min-height: 128px; display: grid; gap: 0.6rem; align-content: start; }
.login-form input {
  font-family: inherit; font-size: 1rem; padding: 0.85rem 1rem; border-radius: 12px;
  border: none; background: rgba(255,255,255,0.95); color: var(--ink);
}
.login-form input::placeholder { color: var(--muted); }
.pass-wrap { position: relative; }
.pass-wrap input { width: 100%; padding-right: 2.9rem; }
.pass-toggle {
  position: absolute; right: 0.4rem; top: 50%; transform: translateY(-50%);
  appearance: none; background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 0.45rem; display: flex; border-radius: 8px;
}
.pass-toggle:hover { color: var(--ink); }
.login-error { color: #ffd0d6; font-size: 0.88rem; min-height: 1em; }

/* ---------- panel: bloques y grupos ---------- */

.block { padding: clamp(1.25rem, 4vw, 1.75rem); }
.block + .block { margin-top: 1.25rem; }
.block-title { font-size: 1.4rem; font-weight: 800; }
.block-sub { color: var(--muted); margin-top: 0.3rem; }
.group { margin-top: 1.5rem; }
.group + .group { margin-top: 1.75rem; }
.group-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.8rem; }
.row-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; flex-wrap: wrap; }
.divider { height: 1px; background: var(--line); margin: 1.5rem 0; }

/* sesiones recientes (mini cards) */
.session-mini { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.session-mini:hover { border-color: var(--indigo); background: var(--indigo-soft); }
.session-mini + .session-mini { margin-top: 0.6rem; }
.session-mini .langs { font-size: 0.82rem; color: var(--muted); }

.copied-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 0.6rem 1.1rem; border-radius: 999px; font-size: 0.9rem; box-shadow: var(--shadow); opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.copied-toast.show { opacity: 1; }

/* ---------- escenario emisor / oyente ---------- */

.stage { max-width: 560px; margin: 0 auto; padding: clamp(1.5rem, 5vw, 3rem) clamp(1.25rem, 5vw, 2rem); display: flex; flex-direction: column; align-items: center; gap: 1.5rem; min-height: calc(100dvh - 68px); }
.stage .eyebrow { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.stage h1 { font-size: clamp(1.6rem, 5vw, 2.2rem); text-align: center; }

.status-pill { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--muted); font-weight: 600; }

/* micrófono */
.mic-wrap { position: relative; margin: 1rem 0; }
.mic-btn {
  appearance: none; width: clamp(130px, 34vw, 180px); height: clamp(130px, 34vw, 180px);
  border-radius: 50%; border: none; cursor: pointer; position: relative; z-index: 1;
  font-family: inherit; font-weight: 800; font-size: 1.1rem;
  background: var(--indigo); color: #fff; box-shadow: 0 16px 32px -12px rgba(53,16,168,0.7);
  transition: background 0.2s, transform 0.12s;
}
.mic-btn:active { transform: scale(0.97); }
.mic-btn.live { background: var(--coral); box-shadow: 0 16px 32px -12px rgba(255,79,109,0.7); }
.vu-ring { position: absolute; inset: -16px; border-radius: 50%; border: 4px solid var(--coral); opacity: 0; transform: scale(0.9); pointer-events: none; transition: transform 0.08s linear, opacity 0.2s; }

.chips { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; }
.chip { display: inline-flex; align-items: center; gap: 0.45rem; border: 1px solid var(--line); border-radius: 999px; padding: 0.4rem 0.9rem; font-size: 0.85rem; color: var(--body); background: #fff; }

.transcript { width: 100%; }
.transcript .label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 0.5rem; }
.transcript p { font-size: 1.05rem; color: var(--ink); min-height: 1.5em; }

/* oyente: subtítulos */
.listen-start { display: flex; flex-direction: column; align-items: center; gap: 1rem; margin: auto 0; }
.play-btn { width: clamp(120px, 32vw, 160px); height: clamp(120px, 32vw, 160px); border-radius: 50%; border: none; cursor: pointer; background: var(--teal); color: #fff; font-size: 2.5rem; box-shadow: 0 16px 32px -12px rgba(0,169,157,0.55); transition: transform 0.12s; }
.play-btn:active { transform: scale(0.97); }
.captions { width: 100%; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 0.8rem; min-height: 45vh; overflow: hidden; }
.caption-line { font-size: clamp(1.25rem, 4vw, 1.75rem); line-height: 1.35; color: var(--ink); animation: rise 0.4s cubic-bezier(0.22,1,0.36,1); }
.caption-line.past { color: var(--muted); font-size: clamp(1rem, 3vw, 1.3rem); }
.caption-line.current::after { content: ""; display: inline-block; width: 0.5em; height: 1.05em; margin-left: 0.15em; vertical-align: text-bottom; background: var(--teal); animation: blink 1.1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.bar { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 1rem; }
input[type="range"] { accent-color: var(--teal); width: 130px; }

.error-box { background: #fff5f6; color: #b3293c; border: 1px solid #f6d2d8; border-radius: var(--radius-sm); padding: 1rem 1.2rem; text-align: center; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
