/* =========================================================================
   CLICK TV — Asistente de activación
   Paleta: negro cálido, blanco hueso, rojo cine. Tipografía: Fraunces
   (display, con carácter editorial) + Inter (cuerpo) + JetBrains Mono
   (cifras del ticket).
   ========================================================================= */

:root {
  --bg: #0a0a0b;
  --bg-elev: #141216;
  --bg-elev-2: #1c191d;
  --border: #2b262a;
  --border-soft: #221f22;
  --white: #f7f5f2;
  --muted: #a89fa0;
  --muted-2: #756c6e;
  --red: #e3122c;
  --red-dark: #9c1220;
  --red-glow: rgba(227, 18, 44, 0.35);
  --gold: #c9a24b;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Menlo, monospace;

  --radius: 14px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 15% 0%, rgba(227, 18, 44, 0.10), transparent 45%),
    radial-gradient(circle at 100% 20%, rgba(227, 18, 44, 0.06), transparent 40%);
  color: var(--white);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--red); }

button { font-family: inherit; }
button:focus-visible,
a:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---------- Topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(10, 10, 11, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 0.02em;
}

.brand-mark-accent { color: var(--red); }
.brand-dot { color: var(--muted-2); margin: 0 2px; }

.topbar-status {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.02em;
}

.dot-live {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 0 var(--red-glow);
  animation: pulse 2.4s infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 var(--red-glow); }
  70%  { box-shadow: 0 0 0 7px rgba(227, 18, 44, 0); }
  100% { box-shadow: 0 0 0 0 rgba(227, 18, 44, 0); }
}

.progress-track {
  height: 2px;
  background: var(--border-soft);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--red-dark), var(--red));
  transition: width 0.4s ease;
}

/* ---------- Layout ---------- */

.layout {
  flex: 1;
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
  padding: 32px 24px 48px;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 28px;
  align-items: start;
}

@media (max-width:880px){

.layout{
    display:flex;
    flex-direction:column;
}

.chat-panel{
    order:1;
}

.ticket-panel{
    order:2;
    margin-top:20px;
    position:static;
}

}

/* ---------- Chat panel ---------- */

.chat-panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 60vh;
  overflow: hidden;
}

.chat-stream {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  max-height: 70vh;
}

@media (max-width: 880px) {
  .chat-stream { max-height: 56vh; padding: 20px; }
}

.bubble {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  max-width: 86%;
  animation: rise 0.28s ease;
}

.bubble-user {
  align-self: flex-end;
  background: rgba(227, 18, 44, 0.10);
  border-color: rgba(227, 18, 44, 0.35);
}

.bubble-final {
  border-color: var(--red);
  box-shadow: 0 0 0 1px rgba(227, 18, 44, 0.15) inset;
}

.bubble-system { color: var(--muted); font-style: italic; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bubble-text {
  font-size: 15px;
  line-height: 1.6;
  white-space: normal;
}

.bubble-img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

.final-status {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: 13px;
  color: var(--muted);
}

.final-ok { color: #8fd19e; }
.final-error { color: var(--red); }

/* ---------- Opciones (botones / lista) ---------- */

.options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: rise 0.28s ease;
}

.opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--white);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.opt:hover:not(:disabled) {
  border-color: var(--red);
  background: rgba(227, 18, 44, 0.08);
}

.opt:active:not(:disabled) { transform: scale(0.99); }

.opt:disabled { opacity: 0.45; cursor: default; }

.opt-selected {
  border-color: var(--red);
  background: rgba(227, 18, 44, 0.14);
  opacity: 1 !important;
}

.opt-title { font-size: 14.5px; font-weight: 500; }
.opt-desc { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.opt-arrow { color: var(--red); font-size: 16px; flex-shrink: 0; }

.opt-continue {
  justify-content: center;
  background: var(--red);
  border-color: var(--red);
  font-weight: 600;
}

.opt-continue:hover:not(:disabled) { background: var(--red-dark); border-color: var(--red-dark); }
.opt-continue .opt-arrow { color: var(--white); }

/* ---------- Botón "Continuar por WhatsApp" (nodo final) ---------- */

.opt-whatsapp {
  justify-content: center;
  gap: 10px;
  background: #1f9c48;
  border-color: #1f9c48;
  font-weight: 600;
  text-decoration: none;
}

.opt-whatsapp:hover { background: #17853c; border-color: #17853c; }
.opt-whatsapp .opt-arrow { color: var(--white); }

.opt-whatsapp-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--white);
}

/* ---------- Input de texto ---------- */

.input-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: rise 0.28s ease;
}

.input-block textarea {
  width: 100%;
  resize: vertical;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 14.5px;
  padding: 12px 14px;
}

.input-block input[type="tel"] {
  width: 100%;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 14.5px;
  padding: 12px 14px;
}

.input-file {
  font-size: 12px;
  color: var(--muted);
}

.input-hint { font-size: 12px; color: var(--muted-2); }
.input-error { font-size: 12px; color: var(--red); min-height: 14px; }

/* ---------- Controles inferiores ---------- */

.chat-controls {
  display: flex;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border-soft);
  background: var(--bg-elev);
}

.ctrl-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.ctrl-btn:hover:not(:disabled) { color: var(--white); border-color: var(--muted-2); }
.ctrl-btn:disabled { opacity: 0.35; cursor: default; }
.ctrl-btn-ghost:hover { color: var(--red); border-color: var(--red); }

/* ---------- Ticket lateral (elemento distintivo) ---------- */

.ticket-panel { position: sticky; top: 96px; }
.ticket-panel.ticket-hidden { display: none; }

.ticket {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.ticket::before {
  content: "";
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--red), var(--red-dark));
}

.ticket-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 20px 22px 14px 26px;
}

.ticket-eyebrow {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 18px;
  color: var(--white);
}

.ticket-step {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--gold);
  letter-spacing: 0.04em;
}

.ticket-perf {
  height: 0;
  border-top: 1.5px dashed var(--border);
  margin: 0 22px;
  position: relative;
}

.ticket-perf::before,
.ticket-perf::after {
  content: "";
  position: absolute;
  top: -7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
}

.ticket-perf::before { left: -29px; }
.ticket-perf::after { right: -29px; }

.ticket-body {
  padding: 16px 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 80px;
}

.ticket-empty {
  font-size: 13px;
  color: var(--muted-2);
  margin: 0;
  line-height: 1.5;
}

.ticket-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 8px;
}

.ticket-k {
  color: var(--muted);
  font-weight: 500;
  flex-shrink: 0;
}

.ticket-v {
  text-align: right;
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.ticket-total { padding: 16px 26px 6px; }

.ticket-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
}

.ticket-total-row strong { color: var(--red); font-size: 18px; }
.ticket-total-cop { opacity: 0.6; font-size: 12px; margin-top: 2px; }
.ticket-total-cop strong { color: var(--muted); font-size: 13px; }

.ticket-foot {
  padding: 16px 26px 22px;
  font-size: 11px;
  color: var(--muted-2);
  letter-spacing: 0.02em;
}

/* ---------- Pasos del flujo (solo el paso actual visible) ---------- */

.flow-step {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.flow-step.step-hidden {
  display: none;
}

/* ---------- Copiar número de teléfono ---------- */

.phone-copy {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  background: rgba(227, 18, 44, 0.08);
  border: 1px solid rgba(227, 18, 44, 0.28);
  border-radius: 999px;
  padding: 3px 6px 3px 12px;
  margin: 1px 2px;
}

.phone-copy-number {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.02em;
  color: var(--red);
  letter-spacing: 0.02em;
}

.phone-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid rgba(227, 18, 44, 0.4);
  border-radius: 50%;
  background: var(--red);
  color: var(--white);
  cursor: pointer;
  vertical-align: middle;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.phone-copy-btn:hover {
  background: var(--red-dark);
  border-color: var(--red-dark);
  transform: scale(1.06);
}

.phone-copy-btn-done {
  background: #1c7a3a;
  border-color: #1c7a3a;
  color: var(--white);
}

.copy-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--white);
  font-size: 13px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
}

.copy-toast-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Consecutivo del boleto (estilo factura) ---------- */

.ticket-id {
  margin: 0 22px 14px 26px;
  display: none;
}

.ticket-id.ticket-id-visible {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gold);
  background: rgba(201, 162, 75, 0.10);
  border: 1px dashed rgba(201, 162, 75, 0.55);
  border-radius: 999px;
  padding: 5px 14px;
}

.final-ticket-number {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--gold);
}

/* ---------- Pie de página ---------- */

.page-foot {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: var(--muted-2);
  border-top: 1px solid var(--border-soft);
}
