/**
 * fc-login-modal · modal.css
 *
 * Diseño mobile-first con bottom-sheet pattern.
 * En mobile el modal aparece desde abajo (más natural, más cerca del pulgar).
 * En desktop se centra en pantalla con animación scale+fade.
 *
 * Paleta Fullcarro:
 *   Primary 1 (naranja):  #FF9540 / soft #FFD4A0
 *   Primary 2 (navy):     #374B5C
 *   Soft warm bg:         #FFF8E5 / #FFFBF5
 *   Success green:        #16A34A / WhatsApp #25D366
 */

/* ═══════════════════════════════════════════════════════════
 *  Tokens
 * ═══════════════════════════════════════════════════════════ */

#fclm-modal {
  --fc-orange:        #FF9540;
  --fc-orange-soft:   #FFD4A0;
  --fc-orange-bg:     #FFFBF5;
  --fc-orange-bg-2:   #FFF4E5;
  --fc-navy:          #374B5C;
  --fc-navy-soft:     #5A6878;
  --fc-ink:           #1F2937;
  --fc-muted:         #6B7280;
  --fc-line:          #E5E7EB;
  --fc-line-soft:     #F3F4F6;
  --fc-white:         #FFFFFF;
  --fc-shadow-sm:     0 1px 2px rgba(31, 41, 55, .04);
  --fc-shadow-md:     0 4px 16px rgba(31, 41, 55, .08);
  --fc-shadow-lg:     0 24px 60px rgba(31, 41, 55, .22), 0 8px 24px rgba(31, 41, 55, .12);
  --fc-shadow-orange: 0 4px 16px rgba(255, 149, 64, .18);

  --fc-radius-sm:     8px;
  --fc-radius-md:     12px;
  --fc-radius-lg:     18px;
  --fc-radius-xl:     22px;

  --fc-ease:          cubic-bezier(.4, 0, .2, 1);
  --fc-ease-bounce:   cubic-bezier(.34, 1.56, .64, 1);
}

/* ═══════════════════════════════════════════════════════════
 *  Container · oculto por defecto
 * ═══════════════════════════════════════════════════════════ */

.fclm-modal {
  position: fixed;
  inset: 0;
  z-index: 99998;
  display: none;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.fclm-modal.is-open  { display: block; }

/* Backdrop con leve blur */
.fclm-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity .25s var(--fc-ease);
}
.fclm-modal.is-visible .fclm-modal__backdrop { opacity: 1; }

/* ═══════════════════════════════════════════════════════════
 *  Card · MOBILE FIRST (bottom-sheet)
 * ═══════════════════════════════════════════════════════════ */

.fclm-modal__card {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--fc-white);
  border-radius: var(--fc-radius-xl) var(--fc-radius-xl) 0 0;
  padding: 8px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: var(--fc-shadow-lg);
  max-height: 92vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--fc-ink);
  transform: translateY(100%);
  transition: transform .35s var(--fc-ease);
  -webkit-overflow-scrolling: touch;
}
.fclm-modal.is-visible .fclm-modal__card { transform: translateY(0); }

/* Drag handle visual (solo decorativo, indica swipe-down en mobile) */
.fclm-modal__card::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  background: var(--fc-line);
  border-radius: 999px;
  margin: 0 auto 16px;
}

/* ═══════════════════════════════════════════════════════════
 *  Card · DESKTOP (≥640px) — modal centrado con scale
 * ═══════════════════════════════════════════════════════════ */

@media (min-width: 640px) {
  .fclm-modal.is-open {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
  }
  .fclm-modal__card {
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
    max-width: 440px;
    width: 100%;
    border-radius: var(--fc-radius-xl);
    padding: 24px 32px;
    max-height: min(640px, 90vh);
    transform: translateY(20px) scale(.96);
    transition: transform .3s var(--fc-ease-bounce);
  }
  .fclm-modal.is-visible .fclm-modal__card { transform: translateY(0) scale(1); }
  .fclm-modal__card::before { display: none; }
}

/* ═══════════════════════════════════════════════════════════
 *  Botón cerrar (X)
 * ═══════════════════════════════════════════════════════════ */

.fclm-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  background: var(--fc-line-soft);
  color: var(--fc-muted);
  cursor: pointer;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s var(--fc-ease);
  z-index: 2;
}
.fclm-modal__close:hover {
  background: var(--fc-line);
  color: var(--fc-ink);
  transform: rotate(90deg);
}
@media (min-width: 640px) {
  .fclm-modal__close {
    background: transparent;
    top: 14px;
    right: 14px;
  }
  .fclm-modal__close:hover {
    background: var(--fc-line-soft);
  }
}

/* ═══════════════════════════════════════════════════════════
 *  Header · ULTRA COMPACTO horizontal
 *  Icono pequeño + texto en 2 líneas tight a la derecha.
 *  Total altura: ~52px (era ~140px en layout vertical original).
 *  CRÍTICO: !important en display:flex para vencer cualquier
 *  reset del tema padre o reglas legacy cacheadas.
 * ═══════════════════════════════════════════════════════════ */

.fclm-modal__header {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 12px;
  margin-bottom: 14px;
  text-align: left;
}

.fclm-modal__icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #25D366 0%, #1FAA52 100%);
  color: var(--fc-white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(37, 211, 102, .28);
  margin: 0;
}
.fclm-modal__icon--phone {
  background: linear-gradient(135deg, var(--fc-orange) 0%, #F97316 100%);
  box-shadow: 0 3px 10px rgba(255, 149, 64, .32);
}
.fclm-modal__icon--chat {
  background: linear-gradient(135deg, var(--fc-navy) 0%, #1E2D3D 100%);
  box-shadow: 0 3px 10px rgba(55, 75, 92, .28);
}
.fclm-modal__icon svg { width: 22px; height: 22px; }

.fclm-modal__header-text {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}

.fclm-modal__title {
  font-family: 'Comfortaa', 'Inter', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--fc-navy);
  margin: 0 0 2px;
  line-height: 1.15;
  letter-spacing: -.01em;
  text-align: left;
}
@media (min-width: 640px) {
  .fclm-modal__title { font-size: 18px; }
}

.fclm-modal__subtitle {
  font-size: 12.5px;
  color: var(--fc-muted);
  margin: 0;
  line-height: 1.35;
  text-align: left;
}
.fclm-modal__subtitle strong {
  color: var(--fc-navy);
  font-weight: 700;
}

/* ═══════════════════════════════════════════════════════════
 *  Tabs (segmented control)
 * ═══════════════════════════════════════════════════════════ */

.fclm-modal__tabs {
  display: flex;
  gap: 4px;
  background: var(--fc-line-soft);
  border-radius: var(--fc-radius-md);
  padding: 4px;
  margin-bottom: 14px;
}
.fclm-modal__tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 12px;
  font: 600 13px/1 'Inter', sans-serif;
  color: var(--fc-muted);
  border-radius: var(--fc-radius-sm);
  cursor: pointer;
  transition: all .2s var(--fc-ease);
  min-height: 36px;
}
.fclm-modal__tab:hover:not(.is-active) { color: var(--fc-navy); }
.fclm-modal__tab.is-active {
  background: var(--fc-white);
  color: var(--fc-navy);
  box-shadow: var(--fc-shadow-sm);
}

/* ═══════════════════════════════════════════════════════════
 *  Mensaje feedback
 * ═══════════════════════════════════════════════════════════ */

.fclm-modal__msg {
  display: none;
  padding: 11px 14px;
  border-radius: var(--fc-radius-sm);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 14px;
}
.fclm-modal__msg.is-show { display: block; }
.fclm-modal__msg.is-error   { background: #FEE2E2; color: #991B1B; border-left: 3px solid #DC2626; }
.fclm-modal__msg.is-success { background: #DCFCE7; color: #166534; border-left: 3px solid #16A34A; }
.fclm-modal__msg.is-info    { background: var(--fc-orange-bg); color: #92400E; border-left: 3px solid var(--fc-orange); }

/* ═══════════════════════════════════════════════════════════
 *  Forms
 * ═══════════════════════════════════════════════════════════ */

.fclm-modal__form {
  display: none;
}
.fclm-modal__form.is-active {
  display: block;
}

/* ─── Botón Google · alternativa SECUNDARIA al final del form ───
 * Más sutil que el botón submit principal, pero aún identificable
 * como Google con el icono multicolor. Border más suave, sin sombra
 * dominante, font-weight más normal. La intención: "si no quieres
 * llenar el form, también puedes usar Google".
 */
.fclm-modal__google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 12px 16px;
  background: var(--fc-white);
  color: var(--fc-navy);
  border: 1.5px solid var(--fc-line);
  border-radius: var(--fc-radius-md);
  font: 600 14px/1 'Inter', sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: all .18s var(--fc-ease);
  box-sizing: border-box;
  letter-spacing: -.005em;
  text-align: center;
}
.fclm-modal__google:hover {
  border-color: var(--fc-orange-soft);
  background: var(--fc-orange-bg);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 149, 64, .15);
  color: var(--fc-navy);
}
.fclm-modal__google:active {
  transform: translateY(0);
  box-shadow: none;
}
.fclm-modal__google svg { flex-shrink: 0; }

/* ─── Separador "o con tu correo" ─── */
.fclm-modal__separator {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--fc-muted);
  margin: 18px 0 16px;
}
.fclm-modal__separator::before,
.fclm-modal__separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--fc-line);
}
.fclm-modal__separator span {
  padding: 0 14px;
  font: 600 10.5px/1 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #9CA3AF;
}

/* ─── Fields ─── */
.fclm-modal__field {
  margin-bottom: 12px;
}

/* Fila de 2 campos lado a lado (Nombre+Email, WhatsApp+Contraseña).
   Ahorra ~80px de altura vertical vs layout 1-columna.
   En mobile <380px se mantiene en 2 columnas con padding reducido. */
.fclm-modal__field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.fclm-modal__field-row .fclm-modal__field {
  margin-bottom: 12px;
  min-width: 0; /* permite que inputs largos no rompan el grid */
}
.fclm-modal__field-row .fclm-modal__field input {
  width: 100%; /* asegura que llene la celda del grid */
}

/* Hint full-width que aplica a la fila anterior (ej: nota del WhatsApp) */
.fclm-modal__hint--full {
  display: block;
  margin-top: -4px;
  margin-bottom: 12px;
}

/* Mobile muy pequeño (<360px): caer a 1 columna */
@media (max-width: 359px) {
  .fclm-modal__field-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}
.fclm-modal__field label {
  display: block;
  font: 600 11.5px/1 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--fc-navy-soft);
  margin-bottom: 6px;
}

/* Indicador rojo de campo obligatorio (asterisco visual) */
.fclm-modal__req {
  color: #DC2626;
  font-weight: 700;
  font-size: 14px;
  line-height: 0;
  margin-left: 3px;
  vertical-align: middle;
}
.fclm-modal__field input {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  border: 1.5px solid var(--fc-line);
  border-radius: var(--fc-radius-md);
  font: 500 15px/1.4 'Inter', sans-serif;
  color: var(--fc-ink);
  background: var(--fc-white);
  transition: all .15s var(--fc-ease);
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}
/* Placeholders en gris medio — visibles como sugerencia, pero sin competir con labels.
 * Usamos !important porque el tema padre Listivo aplica placeholder color
 * más oscuro a inputs en general (lo vimos en la verificación).
 */
.fclm-modal__field input::placeholder {
  color: #A8AFB8 !important;
  font-weight: 400 !important;
  font-style: italic !important;
  opacity: 1 !important;
}
.fclm-modal__field input::-webkit-input-placeholder { color: #A8AFB8 !important; font-weight: 400 !important; font-style: italic !important; }
.fclm-modal__field input::-moz-placeholder         { color: #A8AFB8 !important; font-weight: 400 !important; font-style: italic !important; opacity: 1 !important; }
.fclm-modal__field input:-ms-input-placeholder     { color: #A8AFB8 !important; font-weight: 400 !important; font-style: italic !important; }
.fclm-modal__field input:hover {
  border-color: #CBD5E1;
}
.fclm-modal__field input:focus {
  outline: none;
  border-color: var(--fc-orange);
  box-shadow: 0 0 0 4px rgba(255, 149, 64, .12);
}
.fclm-modal__field input.has-error {
  border-color: #DC2626;
  background: #FEF2F2;
}
.fclm-modal__hint {
  display: block;
  font-size: 11.5px;
  color: #9CA3AF;
  margin-top: 5px;
  line-height: 1.4;
}

/* ─── Consent checkbox ─── */
.fclm-modal__consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 16px 0 18px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--fc-muted);
  line-height: 1.5;
  user-select: none;
}
.fclm-modal__consent input[type="checkbox"] {
  margin-top: 1px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--fc-orange);
  cursor: pointer;
}
.fclm-modal__consent a {
  color: var(--fc-orange);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 149, 64, .35);
  transition: border-color .15s ease;
}
.fclm-modal__consent a:hover {
  border-bottom-color: var(--fc-orange);
}

/* ─── Submit button ─── */
.fclm-modal__submit {
  width: 100%;
  min-height: 54px;
  padding: 15px 24px;
  background: linear-gradient(135deg, var(--fc-orange) 0%, #F97316 100%);
  color: var(--fc-white);
  border: none;
  border-radius: var(--fc-radius-md);
  font: 700 15.5px/1 'Inter', sans-serif;
  letter-spacing: -.005em;
  cursor: pointer;
  transition: all .2s var(--fc-ease);
  position: relative;
  box-shadow: 0 6px 18px rgba(255, 149, 64, .32), inset 0 1px 0 rgba(255, 255, 255, .2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.fclm-modal__submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(255, 149, 64, .42), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.fclm-modal__submit:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(255, 149, 64, .35);
}
.fclm-modal__submit:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.fclm-modal__submit-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: var(--fc-white);
  border-radius: 50%;
  animation: fclm-spin .7s linear infinite;
}
.fclm-modal__submit.is-loading .fclm-modal__submit-spinner { display: inline-block; }
.fclm-modal__submit.is-loading .fclm-modal__submit-label   { opacity: .6; }

@keyframes fclm-spin { to { transform: rotate(360deg); } }

.fclm-modal__legal {
  text-align: center;
  font-size: 12.5px;
  color: var(--fc-muted);
  margin: 12px 0 0;
  line-height: 1.5;
}
.fclm-modal__legal strong {
  color: #16A34A;
  font-weight: 700;
}
.fclm-modal__legal a {
  color: var(--fc-navy-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--fc-line);
}
.fclm-modal__legal a:hover {
  color: var(--fc-orange);
  border-bottom-color: var(--fc-orange-soft);
}

/* ═══════════════════════════════════════════════════════════
 *  Vista OTP · 6 inputs de 1 dígito (segmented input)
 * ═══════════════════════════════════════════════════════════ */

.fclm-modal__form--otp { /* mismas reglas que .form pero pueden necesitar overrides */ }

.fclm-modal__otp-intro {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--fc-orange-bg);
  border-radius: var(--fc-radius-md);
  margin-bottom: 18px;
}
.fclm-modal__otp-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: var(--fc-orange);
  color: var(--fc-white);
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.fclm-modal__otp-text {
  margin: 0;
  font-size: 13px;
  color: var(--fc-navy);
  line-height: 1.5;
  flex: 1;
  min-width: 0;
}
.fclm-modal__otp-text strong {
  color: var(--fc-orange);
  font-weight: 700;
  word-break: break-all;
}

/* Grid de 6 inputs */
.fclm-modal__otp-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}
.fclm-modal__otp-digit {
  width: 100%;
  height: 56px;
  text-align: center;
  font: 700 22px/1 'Inter', 'Courier New', monospace;
  color: var(--fc-navy);
  background: var(--fc-white);
  border: 2px solid var(--fc-line);
  border-radius: var(--fc-radius-md);
  box-sizing: border-box;
  transition: all .15s var(--fc-ease);
  -webkit-appearance: none;
  appearance: none;
  letter-spacing: 0;
  padding: 0;
}
.fclm-modal__otp-digit:hover {
  border-color: #CBD5E1;
}
.fclm-modal__otp-digit:focus {
  outline: none;
  border-color: var(--fc-orange);
  box-shadow: 0 0 0 4px rgba(255, 149, 64, .15);
  transform: translateY(-1px);
}
.fclm-modal__otp-digit.is-filled {
  background: var(--fc-orange-bg);
  border-color: var(--fc-orange-soft);
}
.fclm-modal__otp-digit.has-error {
  border-color: #DC2626;
  background: #FEF2F2;
  animation: fclm-shake .35s ease;
}

@keyframes fclm-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* Pequeño mobile (<360px): reducir altura de digits para que quepan */
@media (max-width: 359px) {
  .fclm-modal__otp-digit { height: 48px; font-size: 18px; }
  .fclm-modal__otp-grid  { gap: 6px; }
}

/* Acciones secundarias (reenviar / volver) */
.fclm-modal__otp-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.fclm-modal__link-btn {
  background: transparent;
  border: none;
  color: var(--fc-orange);
  font: 600 13px/1.4 'Inter', sans-serif;
  cursor: pointer;
  padding: 6px 4px;
  transition: color .15s ease;
}
.fclm-modal__link-btn:hover:not(:disabled) {
  color: #F97316;
  text-decoration: underline;
}
.fclm-modal__link-btn:disabled {
  color: var(--fc-muted);
  cursor: not-allowed;
}
.fclm-modal__link-btn span {
  font-weight: 400;
  color: var(--fc-muted);
}

/* Submit desactivado mientras OTP incompleto */
.fclm-modal__submit:disabled {
  opacity: .5;
  cursor: not-allowed;
  background: var(--fc-line) !important;
  box-shadow: none !important;
  color: var(--fc-muted) !important;
}

/* ═══════════════════════════════════════════════════════════
 *  Footer de confianza · trust signals
 * ═══════════════════════════════════════════════════════════ */

.fclm-modal__trust {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--fc-line-soft);
}
.fclm-modal__trust-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--fc-muted);
  font-weight: 500;
}
.fclm-modal__trust-item svg {
  color: #16A34A;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
 *  Body lock cuando modal abierto
 * ═══════════════════════════════════════════════════════════ */

body.fclm-modal-open {
  overflow: hidden;
  /* Mantener posición de scroll para evitar saltos en mobile */
  position: fixed;
  width: 100%;
}

/* ═══════════════════════════════════════════════════════════
 *  Compatibilidad con tema (reset de defaults heredados)
 * ═══════════════════════════════════════════════════════════ */

#fclm-modal *,
#fclm-modal *::before,
#fclm-modal *::after {
  box-sizing: border-box;
}
#fclm-modal input {
  font-family: inherit;
}
#fclm-modal button {
  font-family: inherit;
}

/* Pequeños mobile (<360px): reducir un poco padding + icono */
@media (max-width: 359px) {
  .fclm-modal__card {
    padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  }
  .fclm-modal__title    { font-size: 17px; }
  .fclm-modal__subtitle { font-size: 12.5px; }
  .fclm-modal__icon     { width: 44px; height: 44px; }
  .fclm-modal__icon svg { width: 22px; height: 22px; }
  .fclm-modal__header   { gap: 12px; }
}
