/* ============================================
   FORMULARIO DE COTIZACIÓN (modal + CTAs)
   Archivo propio a propósito: styles.css se sirve con cache de 30 días y
   el rediseño lo pisa a gusto. Usa los tokens de :root de styles.css.
   ============================================ */

/* ── Botones que abren el formulario ─────── */
.btn-cotizar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 24px;
  border: 1.5px solid #1C7BBE;
  background: var(--white, #fff);
  color: #1C7BBE;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.btn-cotizar:hover {
  background: #1C7BBE;
  color: var(--white, #fff);
  transform: translateY(-1px);
}

/* CTA dentro del estado vacío del chat */
.lead-cta {
  position: relative; /* por encima del video de fondo del chat (z-index 0) */
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
}
.lead-cta__hint {
  margin: 0;
  font-size: 13px;
  color: var(--gray-light, #888);
}
.lead-cta .btn-cotizar {
  background: linear-gradient(135deg, #1C7BBE 0%, #5BB4F0 100%);
  border-color: transparent;
  color: var(--white, #fff);
  box-shadow: 0 4px 12px rgba(28, 123, 190, 0.25);
}
.lead-cta .btn-cotizar:hover {
  filter: brightness(1.06);
}

/* ── Modal (rediseño 2026-11-09) ─────────────
   Como el formulario de AISA: a la izquierda el panel de marca (azul del cotizador, título, bajada
   y logo; la torre del logo grande y tenue de fondo), a la derecha el formulario sobre blanco.
   Celular: hoja que sube desde abajo, con el panel azul como franja arriba (sin logo).
   Colores con valor de respaldo porque chat.html no carga landing.css. */
.lead-modal [hidden] { display: none !important; }

.lead-modal {
  --lf-azul: var(--azul, #1C7BBE);
  --lf-azul-osc: #1668A3;
  --lf-tinte: var(--azul-tinte, #EAF3FB);
  --lf-tinta: var(--tinta, #1A2F44);
  --lf-tinta-75: rgba(26, 47, 68, .8);
  --lf-panel: #F3F6F9;
  --lf-profundo: var(--azul-profundo, #12324A);
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.lead-modal[hidden] { display: none; }
/* Las mismas letras en todas las páginas (chat.html no carga landing.css): Figtree y Fraunces */
.lead-modal, .lead-modal * { font-family: 'Figtree', system-ui, sans-serif; }
.lead-modal .lead-form__title, .lead-form__confirm h3, .lead-form__success h3 {
  font-family: 'Fraunces', Georgia, serif !important;
  font-variation-settings: "opsz" 18, "SOFT" 100, "WONK" 0;
}

.lead-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 50, 74, .5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: lead-fade .3s ease both;
}

.lead-modal__card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  width: 100%;
  max-width: 920px;
  max-height: calc(100dvh - 48px);
  overflow: hidden;
  background: #fff;
  border-radius: 32px;
  box-shadow: 0 40px 90px -30px rgba(18, 50, 74, .55), 0 12px 30px -16px rgba(18, 50, 74, .3);
  color: var(--lf-tinta);
  animation: lead-pop .45s cubic-bezier(.2, .7, .2, 1) both;
}

/* panel de marca: el mismo azul del recuadro del cotizador (sitio.css, .cotz-panel) */
.lead-modal__brand {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: 52px 44px 44px;
  color: #fff;
  background:
    radial-gradient(ellipse 80% 45% at 30% 0%, rgba(255, 255, 255, .18) 0%, rgba(255, 255, 255, 0) 70%),
    linear-gradient(165deg, #2A8AD0 0%, #1C6FB0 55%, #17588F 100%);
}
.lead-modal__torre {
  position: absolute;
  z-index: -1;
  right: -14%;
  bottom: -8%;
  width: 78%;
  height: auto;
  opacity: .1;
  pointer-events: none;
}
.lead-modal__brand .lead-form__title { color: #fff; font-size: clamp(36px, 3.8vw, 46px); margin-bottom: 16px; }
.lead-modal__brand .lead-form__subtitle { margin: 0; max-width: 28ch; color: rgba(255, 255, 255, .88); }
.lead-modal__logo { display: block; width: 168px; height: auto; }

.lead-modal__body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 76px 48px 40px;
}

@keyframes lead-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes lead-pop {
  from { opacity: 0; transform: translateY(24px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .lead-modal__card, .lead-modal__backdrop { animation: none; }
}

.lead-modal__close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--lf-panel);
  color: var(--lf-tinta);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background-color .2s ease;
}
.lead-modal__close:hover { background: #E4EAF0; }
.lead-modal__close:focus-visible { outline: 3px solid var(--lf-azul); outline-offset: 2px; }

/* ── Textos ──────────────────────────────── */
.lead-form__title {
  margin: 0 0 10px;
  font-family: var(--font-display, 'DM Serif Display', serif);
  font-weight: 600;
  font-size: clamp(32px, 3.4vw, 40px);
  line-height: 1.05;
  letter-spacing: -0.015em;
  text-wrap: balance;
  color: var(--lf-tinta);
}
.lead-form__subtitle {
  margin: 0 0 28px;
  font-size: 18px;
  line-height: 1.45;
  text-wrap: balance;
  color: var(--lf-tinta-75);
}

/* ── Campos: rellenos en gris liso, sin borde; al escribir se aclaran y se marca el azul ── */
.lead-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.lead-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--lf-tinta);
}
.lead-field em {
  font-style: normal;
  font-weight: 500;
  color: rgba(26, 47, 68, .55);
}
.lead-field input {
  font: inherit;
  font-size: 17px; /* 16px o más evita el zoom automático de iOS */
  font-weight: 500;
  min-height: 56px;
  padding: 0 18px;
  border: 2px solid transparent;
  border-radius: 16px;
  background: var(--lf-panel);
  color: var(--lf-tinta);
  outline: none;
  transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
}
.lead-field input::placeholder { color: rgba(26, 47, 68, .42); font-weight: 400; }
.lead-field input:hover { background: #EDF1F5; }
.lead-field input:focus {
  background: #fff;
  border-color: var(--lf-azul);
  box-shadow: 0 0 0 5px var(--lf-tinte);
}
.lead-field input[aria-invalid="true"] {
  border-color: #D14B3F;
  background: #FDF3F2;
}

/* Honeypot: fuera de la vista, no display:none (algunos bots lo detectan) */
.lead-hp {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.lead-form__error {
  margin: 0;
  padding: 12px 16px;
  border-radius: 14px;
  background: #FDECEC;
  color: #B42318;
  font-size: 15px;
  line-height: 1.45;
}
.lead-form__error a {
  color: inherit;
  font-weight: 700;
}

/* botón lleno, azul de marca, texto en una sola línea */
.lead-form__submit {
  margin-top: 8px;
  min-height: 60px;
  padding: 0 28px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  color: #fff;
  background: var(--lf-azul);
  box-shadow: 0 14px 30px -14px rgba(28, 123, 190, .75);
  transition: background-color .2s ease, box-shadow .2s ease;
}
.lead-form__submit:hover { background: var(--lf-azul-osc); box-shadow: 0 16px 34px -14px rgba(28, 123, 190, .9); }
.lead-form__submit:focus-visible { outline: 3px solid var(--lf-azul); outline-offset: 3px; }
.lead-form__submit:disabled {
  opacity: .7;
  cursor: wait;
}
.lead-form__submit--ghost {
  background: var(--lf-panel);
  color: var(--lf-tinta);
  box-shadow: none;
}
.lead-form__submit--ghost:hover { background: #E4EAF0; box-shadow: none; }

.lead-form__note {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.45;
  color: rgba(26, 47, 68, .6);
  text-align: center;
  text-wrap: balance;
}

/* ── Confirmar el teléfono ───────────────── */
.lead-form__confirm {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 12px;
}
.lead-form__confirm h3,
.lead-form__success h3 {
  margin: 0;
  font-family: var(--font-display, 'DM Serif Display', serif);
  font-weight: 600;
  font-size: clamp(30px, 3vw, 36px);
  line-height: 1.08;
  letter-spacing: -0.015em;
  text-wrap: balance;
  color: var(--lf-tinta);
}
.lead-form__confirm p,
.lead-form__success p {
  margin: 0;
  font-size: 18px;
  line-height: 1.45;
  color: var(--lf-tinta-75);
}
.lead-form__confirm .lead-form__confirm-phone {
  padding: 20px;
  border-radius: 20px;
  background: var(--lf-tinte);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
  color: var(--lf-tinta);
}
.lead-form__confirm .lead-form__submit { margin-top: 0; }

/* ── Éxito ───────────────────────────────── */
.lead-form__success {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 12px;
}
.lead-form__check {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 6px;
  border-radius: 50%;
  background: var(--lf-azul);
  box-shadow: 0 14px 30px -12px rgba(28, 123, 190, .7);
  color: #fff;
  font-size: 30px;
  font-weight: 700;
}
.lead-form__success p { margin-bottom: 10px; }

body.lead-modal-open { overflow: hidden; }

/* Celular y tablet angosta: hoja desde abajo, foto como franja arriba */
@media (max-width: 760px) {
  .lead-modal { align-items: flex-end; padding: 0; }
  .lead-modal__card {
    display: flex;
    flex-direction: column;
    max-width: none;
    max-height: 94dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 28px 28px 0 0;
    animation-name: lead-sheet;
  }
  .lead-modal__brand { flex: none; gap: 0; padding: 30px 20px 26px; }
  .lead-modal__brand-text { padding-right: 52px; }
  .lead-modal__logo { display: none; }
  .lead-modal__torre { right: -12%; bottom: -48%; width: 52%; opacity: .08; }
  .lead-modal__brand .lead-form__title { font-size: 32px; margin-bottom: 10px; }
  .lead-modal__brand .lead-form__subtitle { font-size: 17px; max-width: none; }
  .lead-modal__body { overflow: visible; padding: 24px 20px calc(22px + env(safe-area-inset-bottom)); }
  .lead-modal__close { top: 14px; right: 14px; background: rgba(255, 255, 255, .16); color: #fff; }
  .lead-modal__close:hover { background: rgba(255, 255, 255, .26); }
  .lead-form { gap: 14px; }
  .lead-field input { min-height: 54px; }
  @keyframes lead-sheet { from { transform: translateY(100%); } to { transform: none; } }
}

/* ── Mobile ──────────────────────────────── */
@media (max-width: 600px) {
  /* El header ya va justo con logo + tabs + Contactanos: el botón vive en el chat
     y en #cotizar (anuncios). */
  .header .btn-cotizar { display: none; }
  /* El estado vacío del chat mide justo para el logo + 4 chips y recorta lo que sobra
     (overflow hidden). Con el CTA abajo ya no entra en un iPhone SE: en mobile lo
     dejamos scrollear en vez de recortar. */
  .chat-empty {
    overflow-y: auto;
    justify-content: flex-start;
    padding: 24px 20px;
    gap: 24px;
  }
  .lead-cta { margin-top: 0; padding-bottom: 8px; }
}
