/**
 * 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: 12px 20px calc(24px + 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: 32px 32px 28px;
    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 · icono + título + subtítulo
 * ═══════════════════════════════════════════════════════════ */

.fclm-modal__header {
  text-align: center;
  margin-bottom: 20px;
}

.fclm-modal__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: var(--fc-radius-lg);
  background: linear-gradient(135deg, #25D366 0%, #1FAA52 100%);
  color: var(--fc-white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(37, 211, 102, .32);
  position: relative;
}
.fclm-modal__icon::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  background: inherit;
  filter: blur(12px);
  opacity: .25;
  z-index: -1;
}
.fclm-modal__icon--phone {
  background: linear-gradient(135deg, var(--fc-orange) 0%, #F97316 100%);
  box-shadow: 0 6px 18px rgba(255, 149, 64, .35);
}
.fclm-modal__icon--chat {
  background: linear-gradient(135deg, var(--fc-navy) 0%, #1E2D3D 100%);
  box-shadow: 0 6px 18px rgba(55, 75, 92, .32);
}
.fclm-modal__icon svg { width: 28px; height: 28px; }

.fclm-modal__title {
  font-family: 'Comfortaa', 'Inter', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--fc-navy);
  margin: 0 0 6px;
  line-height: 1.25;
  letter-spacing: -.01em;
}
@media (min-width: 640px) {
  .fclm-modal__title { font-size: 24px; }
}

.fclm-modal__subtitle {
  font-size: 14px;
  color: var(--fc-muted);
  margin: 0;
  line-height: 1.5;
  max-width: 340px;
  margin-inline: auto;
}
.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: 18px;
}
.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 · destacado como opción preferente ─── */
.fclm-modal__google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 14px 18px;
  background: var(--fc-orange-bg);
  color: var(--fc-navy);
  border: 2px solid var(--fc-orange-soft);
  border-radius: var(--fc-radius-md);
  font: 700 14.5px/1 'Inter', sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: all .2s var(--fc-ease);
  box-shadow: var(--fc-shadow-orange);
  box-sizing: border-box;
  letter-spacing: -.005em;
  text-align: center;
}
.fclm-modal__google:hover {
  border-color: var(--fc-orange);
  background: var(--fc-orange-bg-2);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(255, 149, 64, .25);
  color: var(--fc-navy);
}
.fclm-modal__google:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(255, 149, 64, .15);
}
.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;
}
.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;
}
.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;
}
.fclm-modal__field input::placeholder {
  color: #D7DCE2;
  font-weight: 400;
  opacity: 1;
}
.fclm-modal__field input::-webkit-input-placeholder { color: #D7DCE2; font-weight: 400; }
.fclm-modal__field input::-moz-placeholder         { color: #D7DCE2; font-weight: 400; opacity: 1; }
.fclm-modal__field input:-ms-input-placeholder     { color: #D7DCE2; font-weight: 400; }
.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);
}

/* ═══════════════════════════════════════════════════════════
 *  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 */
@media (max-width: 359px) {
  .fclm-modal__card {
    padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  }
  .fclm-modal__title { font-size: 20px; }
  .fclm-modal__icon  { width: 50px; height: 50px; }
  .fclm-modal__icon svg { width: 24px; height: 24px; }
}
