/* Hero telvoice.cl — teléfono con agente embebido (misma UI que panel cliente) */

.hero-phone-slot--agent {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  margin-top: 1.5rem;
}

@media (min-width: 768px) {
  .hero-phone-slot--agent {
    margin-top: 0;
  }
}

.hero-phone-float--agent {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(320px, 90vw);
  height: min(640px, 85svh, 85vh);
  border-radius: 48px;
  border: 12px solid #dae2fd;
  background: #131b2e;
  box-shadow: 0 20px 60px -15px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.hero-phone-float--agent:focus-within {
  animation: none;
}

.hero-phone-notch {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 20;
  width: 9rem;
  height: 1.5rem;
  transform: translateX(-50%);
  border-radius: 0 0 1rem 1rem;
  background: #dae2fd;
}

.hero-phone-screen {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 3.75rem 0 0;
  overflow: hidden;
  background: linear-gradient(180deg, #f8fafd 0%, #eef3fa 100%);
}

.hero-phone-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex-shrink: 0;
  padding: 0 0.65rem 0.65rem;
  margin-bottom: 0;
  border-bottom: 1px solid rgba(0, 82, 204, 0.1);
}

.hero-phone-header-logo {
  width: 3rem;
  height: 3rem;
  flex-shrink: 0;
}

.hero-phone-header-logo.tva-agent-iso-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
}

.hero-phone-header-logo .telvoice-agent-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
}

.hero-phone-header-text {
  flex: 1;
  min-width: 0;
}

.hero-phone-header-title {
  margin: 0;
  font-family: Montserrat, sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: #131b2e;
  line-height: 1.25;
}

.hero-phone-header-sub {
  margin: 0.125rem 0 0;
  font-size: 0.6875rem;
  color: #64748b;
  line-height: 1.3;
}

.hero-phone-header-status {
  margin: 0.2rem 0 0;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
}

.hero-phone-header-status--online {
  color: #047857;
}

.hero-phone-agent-embed {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  width: 100%;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Embed — tokens panel claro */
.hero-phone-agent-embed .tva-root--hero-embed {
  position: static;
  inset: auto;
  z-index: 1;
  width: 100%;
  max-width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  font-family: Inter, system-ui, sans-serif;
}

.hero-phone-agent-embed .tva-panel--inline {
  position: static;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  max-height: none;
  opacity: 1;
  visibility: visible;
  transform: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  overflow: hidden;
}

.hero-phone-agent-embed .tva-suggestions {
  flex-shrink: 0;
  width: 100%;
  margin: 0;
  background: #f8fafc;
  border-bottom: 1px solid rgba(203, 213, 225, 0.95);
}

.hero-phone-agent-embed .tva-suggestions-toggle {
  gap: 0.35rem;
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.65rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #0052cc;
}

.hero-phone-agent-embed .tva-suggestions-dot {
  display: none !important;
}

.hero-phone-agent-embed .tva-suggestions-panel--accordion {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0 0.65rem;
  transform: translateY(-4px);
  pointer-events: none;
  transition:
    max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.28s ease,
    transform 0.28s ease,
    padding 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-phone-agent-embed .tva-suggestions-panel--accordion.is-expanded {
  max-height: 9rem;
  opacity: 1;
  transform: translateY(0);
  padding: 0 0.65rem 0.5rem;
  pointer-events: auto;
  overflow-y: auto;
}

.hero-phone-agent-embed .tva-quick {
  gap: 0.3rem;
  width: 100%;
}

.hero-phone-agent-embed .tva-quick button {
  font-size: 0.625rem;
  padding: 0.3rem 0.5rem;
  border-radius: 9999px;
  border: 1px solid rgba(0, 82, 204, 0.14);
  background: #fff;
  color: #334155;
}

.hero-phone-agent-embed .tva-quick button:hover {
  background: #eff6ff;
  border-color: rgba(0, 82, 204, 0.28);
  color: #0052cc;
}

.hero-phone-screen.tv-light-theme .hero-phone-agent-embed .tva-messages {
  flex: 1;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
  overflow-y: auto;
  padding: 0.45rem 0.65rem 0.65rem;
  gap: 0.5625rem;
  background: transparent;
  -webkit-overflow-scrolling: touch;
}

.hero-phone-agent-embed .tva-messages {
  flex: 1;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
  overflow-y: auto;
  padding: 0.45rem 0.65rem 0.65rem;
  gap: 0.5625rem;
  background: transparent;
  -webkit-overflow-scrolling: touch;
}

.hero-phone-agent-embed .tva-msg {
  max-width: 100%;
  font-size: 0.75rem;
  line-height: 1.5;
}

.hero-phone-agent-embed .tva-msg--enter {
  animation: tv-hero-embed-msg-in 0.48s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes tv-hero-embed-msg-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-phone-agent-embed .tva-msg--bot.tva-msg--with-avatar {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  width: 100%;
  max-width: 100%;
  padding: 0;
  background: transparent;
  border: none;
}

.hero-phone-agent-embed .tva-msg-avatar-wrap {
  flex-shrink: 0;
  line-height: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  overflow: hidden;
}

.hero-phone-agent-embed .tva-msg-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.hero-phone-agent-embed .tva-msg-bubble {
  flex: 1;
  min-width: 0;
  padding: 0.625rem 0.75rem;
  font-size: 0.75rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 1rem 1rem 1rem 0.35rem;
}

.hero-phone-agent-embed .tva-msg--user {
  align-self: flex-end;
  max-width: 88%;
  color: #fff;
  background: linear-gradient(135deg, #0052cc, #0369a1);
  border-radius: 1rem 1rem 0.35rem 1rem;
  padding: 0.625rem 0.75rem;
}

.hero-phone-agent-embed .tva-msg--typing .tva-msg-bubble {
  opacity: 0.75;
  font-style: italic;
}

.hero-phone-screen.tv-light-theme .hero-phone-agent-embed .tva-form {
  flex-shrink: 0;
  gap: 0.4rem;
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.65rem calc(0.65rem + env(safe-area-inset-bottom, 0px));
  margin-top: auto;
  border-top: 1px solid rgba(203, 213, 225, 0.95);
  background: #fff;
}

.hero-phone-agent-embed .tva-form {
  flex-shrink: 0;
  gap: 0.4rem;
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.65rem calc(0.65rem + env(safe-area-inset-bottom, 0px));
  margin-top: auto;
  border-top: 1px solid rgba(203, 213, 225, 0.95);
  background: #fff;
}

.hero-phone-agent-embed .tva-conversation-actions {
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 0.35rem 0.65rem 0.35rem;
  background: #fff;
  border-top: 1px solid rgba(203, 213, 225, 0.95);
}

.hero-phone-agent-embed .tva-form input {
  border: 1px solid rgba(203, 213, 225, 0.95);
  border-radius: 9999px;
  padding: 0.45rem 0.65rem;
  font-size: 0.6875rem;
  background: #fff;
  color: #0f172a;
}

.hero-phone-agent-embed .tva-form input::placeholder {
  color: #94a3b8;
}

.hero-phone-agent-embed .tva-form input:focus {
  outline: none;
  border-color: #0052cc;
  box-shadow: 0 0 0 2px rgba(0, 82, 204, 0.12);
}

.hero-phone-agent-embed .tva-form button[type="submit"] {
  border-radius: 9999px;
  padding: 0.5rem 0.75rem;
  font-size: 0.6875rem;
  font-weight: 600;
  background: linear-gradient(135deg, #0052cc, #0369a1);
  color: #fff;
  border: none;
  white-space: nowrap;
}

.hero-phone-agent-embed .tva-drawer-ctas button,
.hero-phone-agent-embed .tva-conversation-actions button {
  font-size: 0.6875rem;
  padding: 0.45rem 0.65rem;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, #0052cc, #0369a1);
  color: #fff;
  border: none;
}

@media (max-width: 767px) {
  /* Altura fija en svh: no encoge el teléfono cuando aparece el teclado */
  .hero-phone-float--agent {
    width: min(300px, 100%);
    height: min(580px, 85svh);
    max-height: 580px;
  }

  /* iOS hace zoom de página si el input es < 16px */
  .hero-phone-agent-embed .tva-form input {
    font-size: 1rem;
    line-height: 1.25;
  }

  .hero-phone-agent-embed .tva-form input::placeholder {
    font-size: 0.875rem;
  }

  /* Anula text-align:center global de main p/h* en móvil */
  .hero-phone-slot--agent,
  .hero-phone-slot--agent .hero-phone-screen,
  .hero-phone-slot--agent .hero-phone-header,
  .hero-phone-slot--agent .hero-phone-header p,
  .hero-phone-slot--agent .hero-phone-agent-embed,
  .hero-phone-slot--agent .hero-phone-agent-embed .tva-panel--inline,
  .hero-phone-slot--agent .hero-phone-agent-embed .tva-messages,
  .hero-phone-slot--agent .hero-phone-agent-embed .tva-msg-bubble,
  .hero-phone-slot--agent .hero-phone-agent-embed .tva-suggestions-toggle,
  .hero-phone-slot--agent .hero-phone-agent-embed .tva-form,
  .hero-phone-slot--agent .hero-phone-agent-embed .tva-quick button {
    text-align: left;
  }

  .hero-phone-slot--agent .hero-phone-agent-embed .tva-messages {
    align-items: stretch;
  }

  .hero-phone-slot--agent .hero-phone-agent-embed .tva-msg--bot,
  .hero-phone-slot--agent .hero-phone-agent-embed .tva-msg--bot.tva-msg--with-avatar {
    align-self: flex-start;
  }

  .hero-phone-slot--agent .hero-phone-agent-embed .tva-msg--user {
    align-self: flex-end;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-phone-agent-embed .tva-msg--enter,
  .hero-phone-agent-embed .tva-suggestions-panel--accordion {
    animation: none;
    transition-duration: 0.01ms !important;
  }
}
