/* ---------- Demo page layout ---------- */
.demo-page { padding: 56px 0 100px; min-height: 70vh; }
.demo-step { max-width: 1100px; margin: 0 auto; }
.demo-step-wide { max-width: 1760px; padding: 0 24px; }
.demo-intro { max-width: 640px; margin: 0 auto 40px; text-align: center; }
.demo-intro h1 { font-size: clamp(1.9rem, 3.5vw, 2.6rem); margin-bottom: 14px; }
.demo-sub { color: var(--text-muted); font-size: 1.05rem; }

/* ---------- Lead form ---------- */
.demo-form {
  max-width: 440px;
  margin: 0 auto;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-size: 0.85rem; font-weight: 600; color: var(--navy); }
.form-row input {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
}
.form-row input:focus { outline: 2px solid var(--red); outline-offset: 1px; }
.demo-legal { font-size: 0.78rem; color: var(--text-muted); text-align: center; }
.demo-legal a { color: var(--red-dark); font-weight: 600; }

/* ---------- Selector de tipo de negocio ---------- */
.vertical-picker {
  display: flex;
  gap: 2px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
}
.vertical-option { flex: 1; }
.vertical-option input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}
.vertical-option span {
  display: block;
  text-align: center;
  padding: 10px 6px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.vertical-option input:checked + span {
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: var(--white);
  box-shadow: 0 6px 16px rgba(217, 49, 62, 0.28);
}
.vertical-option input:focus-visible + span { outline: 2px solid var(--red); outline-offset: 2px; }
.vertical-option.is-disabled span { color: #B7BEC9; cursor: not-allowed; }
.vertical-option.is-disabled small {
  display: block;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 2px;
  color: #B7BEC9;
}

/* ---------- Call panels ---------- */
.call-panels {
  display: grid;
  grid-template-columns: 0.85fr 1.3fr;
  gap: 24px;
  align-items: stretch;
}
.call-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 720px;
  max-height: 82vh;
  overflow: hidden;
}
.calendar-panel { padding: 0; }
.panel-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--navy);
  background: var(--bg-light);
}
#call-status-text { white-space: nowrap; }
.panel-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #94A3B8;
  flex-shrink: 0;
}
.panel-dot.live { background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,0.15); animation: pulse-dot 1.5s infinite; }
.panel-dot.ended { background: var(--text-muted); }
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Cronómetro de la llamada activa */
.call-timer {
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-light);
  border-radius: 999px;
  padding: 3px 10px;
  margin-left: 4px;
}

/* Fila propia para los indicadores de voz (waveform, estado, cronómetro):
   con flex-basis:100% siempre caen en su propia linea bajo el estado y los
   controles, para que nunca compriman el texto de estado en panels estrechos. */
.voice-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-basis: 100%;
  margin-top: 2px;
}
.voice-waveform {
  display: none;
  align-items: center;
  gap: 3px;
  height: 16px;
}
.panel-dot.live ~ .voice-meta .voice-waveform { display: flex; }
.voice-waveform span {
  width: 3px;
  border-radius: 2px;
  background: var(--red);
  animation: wf-bounce 1.1s ease-in-out infinite;
}
.voice-waveform span:nth-child(1) { height: 35%; animation-delay: -1.1s; }
.voice-waveform span:nth-child(2) { height: 85%; animation-delay: -0.8s; }
.voice-waveform span:nth-child(3) { height: 55%; animation-delay: -0.5s; }
.voice-waveform span:nth-child(4) { height: 100%; animation-delay: -0.3s; }
.voice-waveform span:nth-child(5) { height: 50%; animation-delay: -0.1s; }
@keyframes wf-bounce { 0%, 100% { transform: scaleY(0.35); } 50% { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) {
  .voice-waveform span { animation: none; height: 60% !important; }
}

/* Micrófono con microinteracción antes de empezar */
#start-call-btn svg {
  transition: transform 0.25s var(--ease, ease);
}
#start-call-btn:hover svg { transform: scale(1.15); }
#start-call-btn { position: relative; }
#start-call-btn::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 2px solid rgba(217, 49, 62, 0.35);
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.25s var(--ease, ease), transform 0.25s var(--ease, ease);
  pointer-events: none;
}
#start-call-btn:hover::before { opacity: 1; transform: scale(1); }
@media (prefers-reduced-motion: reduce) {
  #start-call-btn svg, #start-call-btn::before { transition: none; }
}

/* Controles de la llamada (reiniciar / silenciar / volumen / colgar) */
.call-controls { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.call-controls-group { display: flex; align-items: center; gap: 8px; }
.call-controls-group[hidden] { display: none; }
.call-control-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--white);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--navy);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.call-control-btn:hover { background: var(--bg-light); }
.call-control-btn svg { width: 12px; height: 12px; flex-shrink: 0; }
.call-control-btn .restart-ic { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.call-control-btn.is-active { background: var(--navy); color: var(--white); border-color: var(--navy); }
.call-control-btn[hidden] { display: none; }

/* Botones redondos, solo icono (micrófono / altavoz / colgar) */
.call-control-round { width: 34px; height: 34px; padding: 0; justify-content: center; flex-shrink: 0; }
.call-control-round svg { width: 16px; height: 16px; }
.call-control-round .mic-ic,
.call-control-round .speaker-ic { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.call-control-round .mic-slash { opacity: 0; transition: opacity 0.15s ease; }
.call-control-round.is-active .mic-slash { opacity: 1; }
/* La onda grande solo se ve cuando el volumen está reforzado (botón activo) */
.call-control-round .wave-lg { opacity: 0.3; transition: opacity 0.15s ease; }
.call-control-round.is-active .wave-lg { opacity: 1; }
/* Colgar: icono de teléfono girado 135º, el gesto habitual para "fin de llamada" */
.call-control-danger { color: var(--white); background: var(--red); border-color: var(--red); }
.call-control-danger:hover { background: var(--red-dark); border-color: var(--red-dark); }
.call-control-danger .hangup-ic { fill: currentColor; transform: rotate(135deg); transform-origin: center; }

/* Transcript panel */
.transcript-list {
  flex: 1;
  /* Sin esto, un hijo flex con overflow:auto puede seguir creciendo para
     encajar todo su contenido (min-height:auto por defecto) en vez de
     quedarse fijo y crear su propio scroll interno -- entonces el que
     recorta los mensajes antiguos es el .call-panel de fuera (que tiene
     overflow:hidden), sin dar ninguna barra para llegar a ellos. */
  min-height: 0;
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* Firefox -- barra visible (no "thin" casi invisible) para que se note que
     se puede subir y bajar a revisar la conversacion. */
  scrollbar-width: auto;
  scrollbar-color: var(--text-muted) var(--border);
}
.transcript-list::-webkit-scrollbar { width: 11px; }
.transcript-list::-webkit-scrollbar-track { background: var(--border); border-radius: 999px; }
.transcript-list::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 999px;
  border: 2px solid var(--border);
  background-clip: padding-box;
}
.transcript-list::-webkit-scrollbar-thumb:hover { background: var(--navy); }
.transcript-empty {
  margin: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 20px;
}
.mic-ic { width: 48px; height: 48px; color: var(--border); fill: none; stroke: currentColor; stroke-width: 1.5; }
.play-ic { width: 16px; height: 16px; fill: currentColor; }
.mic-note { font-size: 0.82rem; color: var(--text-muted); max-width: 260px; }

/* Instrucciones antes de iniciar la llamada */
.demo-instructions {
  text-align: left;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  max-width: 380px;
  margin: 0 auto;
}
.demo-instructions h3 {
  font-family: 'Manrope', sans-serif;
  font-size: 0.95rem;
  color: var(--navy);
  margin-bottom: 12px;
}
.demo-instructions ul {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 0;
  padding-left: 18px;
}
.demo-instructions li {
  font-size: 0.83rem;
  line-height: 1.45;
  color: var(--text-muted);
}
.demo-instructions li strong { color: var(--navy); }

.transcript-bubble {
  max-width: 82%;
  padding: 11px 15px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.4;
  animation: bubble-in 0.2s ease;
}
@keyframes bubble-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.transcript-bubble.role-agent { background: var(--bg-light); color: var(--navy); align-self: flex-start; border-bottom-left-radius: 4px; }
.transcript-bubble.role-user { background: linear-gradient(135deg, var(--red), var(--red-dark)); color: var(--white); align-self: flex-end; border-bottom-right-radius: 4px; }
.transcript-bubble .role-label { display: block; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.65; margin-bottom: 3px; }

.call-ended-banner {
  margin: 12px 20px 20px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(34,197,94,0.1);
  color: #15803d;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
}
.call-error-banner {
  margin: 12px 20px 20px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(217, 49, 62, 0.08);
  color: var(--red-dark);
  font-size: 0.85rem;
  text-align: center;
}

/* ---------- Mock del panel CRM (solo visual, no interactivo) ---------- */
.crm-mock { display: flex; flex: 1; min-height: 0; }
.crm-sidebar {
  width: 140px;
  flex-shrink: 0;
  background: var(--navy);
  color: #94A3B8;
  display: flex;
  flex-direction: column;
  padding: 18px 0;
  pointer-events: none;
  user-select: none;
}
.crm-sidebar-logo {
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 0.76rem;
  color: var(--white);
  padding: 0 16px 16px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.crm-nav { display: flex; flex-direction: column; gap: 2px; }
.crm-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #94A3B8;
  border-left: 3px solid transparent;
}
.crm-nav-item svg { width: 15px; height: 15px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.6; }
.crm-nav-item.active {
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
  border-left-color: var(--red);
}
.crm-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ---------- Grid calendar (estilo panel real de Omari) ---------- */
.grid-cal-header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--navy);
  color: var(--white);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.grid-cal-header strong { font-family: 'Manrope', sans-serif; font-size: 0.95rem; }
.grid-cal-header span { font-size: 0.74rem; color: #94A3B8; }

.grid-cal-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--white);
  flex-shrink: 0;
}
.cal-nav-btn {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  color: var(--navy);
}
.cal-nav-btn:hover { background: var(--bg-light); }
.cal-current-date { font-size: 0.82rem; font-weight: 700; color: var(--navy); flex: 1; text-align: center; }
.cal-today-btn {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--red-dark);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
}
.cal-toast-area { padding: 0 16px; flex-shrink: 0; }
.other-day-banner {
  margin: 10px 0 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.1);
  font-size: 0.76rem;
  color: #15803d;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  animation: bubble-in 0.2s ease;
}
.other-day-banner button {
  border: none;
  background: #16a34a;
  color: var(--white);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.grid-cal-wrap { flex: 1; overflow: auto; padding: 0 8px; }
.grid-cal { position: relative; min-width: 480px; max-width: 700px; margin: 0 auto; }
.grid-cal-swipe-hint { display: none; }
.grid-cal-loading {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.grid-cal-columns {
  display: grid;
  grid-template-columns: 52px repeat(var(--n-stylists, 3), 1fr);
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}
.grid-cal-columns > div {
  padding: 12px 8px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--navy);
  border-left: 1px solid var(--border);
}
.grid-cal-columns > div:first-child { border-left: none; }
.grid-cal-columns small { display: block; font-weight: 500; color: var(--text-muted); font-size: 0.72rem; margin-top: 2px; }

.grid-cal-body {
  display: grid;
  grid-template-columns: 56px repeat(var(--n-stylists, 3), 1fr);
  position: relative;
}
.grid-cal-hour-labels { display: flex; flex-direction: column; }
.grid-cal-hour-label {
  height: var(--hour-h, 76px);
  font-size: 0.74rem;
  color: var(--text-muted);
  text-align: right;
  padding-right: 8px;
  transform: translateY(-7px);
  border-top: 1px solid var(--border);
}
.grid-cal-col { position: relative; border-left: 1px solid var(--border); }
.grid-cal-col .hour-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--border); }

.grid-cal-event {
  position: absolute;
  left: 3px; right: 3px;
  border-radius: 9px;
  padding: 5px 8px;
  font-size: 0.76rem;
  line-height: 1.25;
  /* visible, no hidden: con columnas estrechas (6 mesas) el contenido a
     veces necesita mas alto del que da la franja horaria -- prioriza que se
     lea completo sobre encajar al pixel, aunque roce el siguiente evento. */
  overflow: visible;
  z-index: 1;
  background: rgba(15, 23, 42, 0.07);
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-left: 4px solid var(--navy);
  color: var(--navy);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}
.grid-cal-event:hover { z-index: 2; }
.grid-cal-event strong {
  display: block;
  font-size: 0.78rem;
  margin-bottom: 1px;
  white-space: normal;
  overflow-wrap: break-word;
}
.grid-cal-event .event-name {
  display: block;
  white-space: normal;
  overflow-wrap: break-word;
}
.grid-cal-event.event-new {
  background: rgba(34, 197, 94, 0.15);
  border-left-color: #16a34a;
  color: #14532d;
  animation: highlight-fade 2.5s ease;
}
.grid-cal-event .new-badge {
  display: inline-block;
  margin-top: 2px;
  background: #22c55e;
  color: white;
  font-size: 0.64rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  text-transform: uppercase;
}
@keyframes highlight-fade { 0% { background: rgba(34,197,94,0.35); } 100% { background: rgba(34,197,94,0.15); } }
.grid-cal-event .paella-badge {
  display: inline-block;
  margin-top: 2px;
  margin-left: 4px;
  background: #eab308;
  color: white;
  font-size: 0.64rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
}

@media (max-width: 860px) {
  .call-panels { grid-template-columns: 1fr; }
  .call-panel { min-height: 480px; max-height: none; }
}

@media (max-width: 640px) {
  .crm-mock { flex-direction: column; }
  .crm-sidebar { width: auto; flex-direction: row; align-items: center; overflow-x: auto; padding: 10px 12px; gap: 4px; }
  .crm-sidebar-logo { display: none; }
  .crm-nav { flex-direction: row; gap: 6px; }
  .crm-nav-item { padding: 6px 10px; white-space: nowrap; border-radius: 999px; border-left: none; flex-shrink: 0; }
  .crm-nav-item.active { box-shadow: inset 0 0 0 1px var(--red); }

  /* El calendario (grid-cal) tiene un ancho minimo mayor que la pantalla, asi
     que se desplaza horizontalmente dentro de grid-cal-wrap -- sin este aviso
     no era obvio para el visitante que hay mas columnas fuera de la vista. */
  .grid-cal-swipe-hint {
    display: block;
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted);
    padding: 6px 12px 2px;
  }
}
