/* ============================================
   FETALMED — Lead Forms v2
   Formulários de captura de leads com 3 variantes
   Usa variáveis do design-system.css
   ============================================ */

/* ── Wrapper — fixed bottom sheet ────────────── */
.fm-lead-form-wrapper {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9998;
}

.fm-lead-form-wrapper.fm--expandido {
  display: block;
  animation: fm-slideUp 0.4s ease;
}

.fm-lead-form-wrapper.fm--compacto {
  display: block;
}

@keyframes fm-slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.fm-lead-form-wrapper.fm--expandido .fm-form-compacto { display: none; }
.fm-lead-form-wrapper.fm--expandido .fm-lead-form__card { display: block; }

.fm-lead-form-wrapper.fm--compacto .fm-lead-form__card { display: none; }
.fm-lead-form-wrapper.fm--compacto .fm-form-compacto { display: flex; }

/* ── Compact bar ─────────────────────────────── */
.fm-form-compacto {
  display: none;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  padding: 0 16px;
  cursor: pointer;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 500;
  transition: opacity 0.2s;
}
.fm-form-compacto:hover { opacity: 0.85; }

.fm-form-compacto--gestante { background: var(--teal-50);  color: var(--teal-800); }
.fm-form-compacto--medico   { background: #f0f9ff;          color: var(--color-navy); }
.fm-form-compacto--geral { background: var(--rosa-50);  color: #be123c; }

.fm-form-compacto__arrow {
  font-size: 18px;
  font-weight: 300;
  line-height: 1;
}

/* ── Card container ──────────────────────────── */
.fm-lead-form__card {
  max-width: 760px;
  margin: 0 auto;
  position: relative;
  background: transparent;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 -4px 30px rgba(0,0,0,0.15);
  overflow: hidden;
}

/* ── Close button ────────────────────────────── */
.fm-btn-fechar {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--color-text-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 2;
}
.fm-btn-fechar:hover { background: rgba(0,0,0,.06); }

/* ── Tab bar ─────────────────────────────────── */
.fm-tabs {
  display: flex;
  gap: 0;
  padding: 0;
  background: #e2e8f0;
}

.fm-tabs__btn {
  flex: 1;
  padding: 10px 16px;
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: all 0.2s;
  background: #f1f5f9;
  color: #475569;
  border-bottom: 3px solid transparent;
}

.fm-tabs__btn--gestante.active { background: var(--teal-50);  color: var(--teal-800); border-bottom-color: var(--color-primary); }
.fm-tabs__btn--medico.active   { background: #f0f9ff;          color: var(--color-navy);  border-bottom-color: var(--color-navy); }
.fm-tabs__btn--geral.active { background: var(--rosa-50);  color: #be123c;            border-bottom-color: var(--color-gestantes); }
.fm-tab-icon { display: inline-block; vertical-align: middle; margin-right: 4px; filter: brightness(0) saturate(100%); opacity: .55; transition: all .2s; }
.fm-tabs__btn.active .fm-tab-icon { opacity: 1; }
.fm-tabs__btn--gestante.active .fm-tab-icon { filter: brightness(0) saturate(100%) invert(27%) sepia(51%) saturate(2878%) hue-rotate(166deg) brightness(97%) contrast(101%); opacity: 1; }
.fm-tabs__btn--medico.active .fm-tab-icon { filter: brightness(0) saturate(100%) invert(8%) sepia(25%) saturate(2583%) hue-rotate(192deg) brightness(96%) contrast(105%); opacity: 1; }
.fm-tabs__btn--geral.active .fm-tab-icon { filter: brightness(0) saturate(100%) invert(15%) sepia(95%) saturate(6932%) hue-rotate(340deg) brightness(79%) contrast(100%); opacity: 1; }

/* ── Tab panels ──────────────────────────────── */
.fm-tab-panel { display: none; }
.fm-tab-panel.active { display: block; }

/* ── Form card (inside panel) ────────────────── */
.fm-form-card {
  background: var(--color-white);
  overflow: hidden;
  border-radius: 0;
}

/* ── Accent bar ──────────────────────────────── */
.fm-accent { height: 4px; width: 100%; }
.fm-accent--gestante { background: linear-gradient(90deg, #0e7490, #22d3ee); }
.fm-accent--medico   { background: linear-gradient(90deg, #1e293b, #0e7490); }
.fm-accent--geral { background: linear-gradient(90deg, #e11d48, #fb7185); }

/* ── Form body (2-column grid) ───────────────── */
.fm-lead-form__body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

/* ── Left panel ──────────────────────────────── */
.fm-lead-form__left {
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.fm-bg--gestante { background: linear-gradient(145deg, #ecfeff 0%, #cffafe 100%); }
.fm-bg--medico   { background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%); }
.fm-bg--geral { background: linear-gradient(145deg, #fff1f2 0%, #ffe4e6 100%); }

/* ── Badge ───────────────────────────────────── */
.fm-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
  width: fit-content;
}

.fm-badge--gestante { background: var(--color-primary); color: #fff; }
.fm-badge--medico   { background: rgba(255,255,255,0.15); color: #e2e8f0; border: 1px solid rgba(255,255,255,0.2); }
.fm-badge--geral { background: var(--color-gestantes); color: #fff; }

/* ── Left panel text ─────────────────────────── */
.fm-lead-form__left h2 {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 10px;
}

.fm-bg--gestante h2 { color: var(--color-text-strong); }
.fm-bg--medico h2   { color: #fff; }
.fm-bg--geral h2 { color: var(--color-text-strong); }

.fm-lead-form__left > p {
  font-size: 14px;
  font-weight: 300;
  line-height: 1.65;
  margin-bottom: 24px;
}

.fm-bg--gestante > p { color: var(--color-text-mid); }
.fm-bg--medico > p   { color: #cbd5e1; }
.fm-bg--geral > p { color: var(--color-text-mid); }

/* ── Benefits list ───────────────────────────── */
.fm-benefits {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  margin: 0;
}

.fm-benefits li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

.fm-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.fm-check--gestante { background: var(--color-primary); }
.fm-check--medico   { background: rgba(255,255,255,0.2); }
.fm-check--geral { background: var(--color-gestantes); }

.fm-bg--gestante .fm-benefits li { color: var(--color-text-mid); }
.fm-bg--medico .fm-benefits li   { color: #cbd5e1; }
.fm-bg--geral .fm-benefits li { color: var(--color-text-mid); }

/* ── Authority line ──────────────────────────── */
.fm-autoridade {
  font-size: 12px;
  font-weight: 500;
  font-style: italic;
  margin-top: 16px;
  margin-bottom: 0;
}
.fm-bg--gestante .fm-autoridade { color: var(--color-text-mid); }
.fm-bg--medico .fm-autoridade   { color: #94a3b8; }
.fm-bg--geral .fm-autoridade { color: var(--color-text-mid); }

/* ── Doctor photo ────────────────────────────── */
.fm-doctor {
  margin-top: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.fm-doctor__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.fm-doctor__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fm-doctor__avatar--gestante { background: linear-gradient(135deg, var(--color-primary) 0%, #155e75 100%); border: 2px solid rgba(255,255,255,0.6); }
.fm-doctor__avatar--medico   { background: linear-gradient(135deg, #334155 0%, #1e293b 100%); border: 2px solid rgba(255,255,255,0.2); }
.fm-doctor__avatar--geral { background: linear-gradient(135deg, var(--color-gestantes) 0%, #9f1239 100%); border: 2px solid rgba(255,255,255,0.6); }

.fm-doctor__info p:first-child {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 0;
  line-height: 1.3;
}

.fm-doctor__info p:last-child {
  font-size: 11px;
  font-weight: 300;
  margin-bottom: 0;
  opacity: 0.75;
  line-height: 1.3;
}

.fm-bg--gestante .fm-doctor__info p { color: var(--color-text-mid); }
.fm-bg--medico .fm-doctor__info p   { color: #e2e8f0; }
.fm-bg--geral .fm-doctor__info p { color: var(--color-text-mid); }

/* ── Right panel (form) ──────────────────────── */
.fm-lead-form__right {
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #fff;
}

.fm-lead-form__right h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-strong);
  margin-bottom: 4px;
}

.fm-lead-form__right > p {
  font-size: 12px;
  font-weight: 400;
  color: #475569;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* ── Fields grid ─────────────────────────────── */
.fm-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.fm-field-full { grid-column: 1 / -1; }

.fm-field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: relative;
}

.fm-field-group label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-light);
}

.fm-field-group input,
.fm-field-group select {
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--color-text-strong);
  background: #fff;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.fm-field-group input::placeholder {
  color: #94a3b8;
  font-weight: 300;
  font-size: 13px;
}

/* Focus by variant */
.fm-field-group input:focus,
.fm-field-group select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(14,116,144,.1);
}

.fm-focus--medico input:focus,
.fm-focus--medico select:focus {
  border-color: var(--color-navy);
  box-shadow: 0 0 0 3px rgba(30,41,59,.1);
}

.fm-focus--geral input:focus,
.fm-focus--geral select:focus {
  border-color: var(--color-gestantes);
  box-shadow: 0 0 0 3px rgba(225,29,72,.1);
}

/* Select arrow */
.fm-field-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* Phone valid indicator */
.fm-field-group.fm-tel--valido::after {
  content: '\2713';
  position: absolute;
  right: 12px;
  bottom: 12px;
  color: #16a34a;
  font-size: 14px;
  font-weight: 700;
  pointer-events: none;
}

/* Validation errors */
.fm-input--erro {
  border-color: #e11d48 !important;
  box-shadow: 0 0 0 3px rgba(225,29,72,.1) !important;
}

.fm-field-error {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: #e11d48;
  margin-top: 4px;
}

/* ── CTA button ──────────────────────────────── */
.fm-cta {
  width: 100%;
  padding: 14px 24px;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
  position: relative;
  overflow: hidden;
  color: #fff;
}

.fm-cta::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background 0.2s;
}

.fm-cta:hover::after { background: rgba(255,255,255,0.1); }
.fm-cta:active { transform: translateY(1px); }
.fm-cta:disabled { opacity: 0.6; cursor: not-allowed; }

.fm-cta--gestante { background: linear-gradient(135deg, #0e7490, #0891b2); box-shadow: 0 4px 12px rgba(14,116,144,.3); }
.fm-cta--medico   { background: linear-gradient(135deg, #1e293b, #334155); box-shadow: 0 4px 12px rgba(30,41,59,.3); }
.fm-cta--geral { background: linear-gradient(135deg, #e11d48, #fb7185); box-shadow: 0 4px 12px rgba(225,29,72,.3); }

/* ── Spinner ─────────────────────────────────── */
.fm-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: fm-spin 0.6s linear infinite;
}

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

/* ── Micro copy ──────────────────────────────── */
.fm-microcopy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 11px;
  font-weight: 300;
  color: var(--color-text-light);
}

.fm-microcopy span { display: flex; align-items: center; gap: 3px; }
.fm-micro-dot { color: var(--color-border); }

/* ── LGPD / privacy ─────────────────────────── */
.fm-lgpd {
  text-align: center;
  font-size: 10px;
  font-weight: 400;
  color: #475569;
  margin-top: 8px;
  line-height: 1.5;
}

.fm-lgpd a {
  color: #475569;
  text-decoration: underline;
}

.fm-lgpd a:hover { color: var(--color-text-mid); }

/* ── Success state ───────────────────────────── */
.fm-lead-form__sucesso {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  text-align: center;
  gap: 12px;
  background: #fff;
  grid-column: 1 / -1;
}

.fm-lead-form__sucesso.active {
  display: flex;
}

.fm-sucesso-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.fm-sucesso-icon--gestante { background: var(--teal-50); }
.fm-sucesso-icon--medico   { background: #f1f5f9; }
.fm-sucesso-icon--geral { background: var(--rosa-50); }

.fm-lead-form__sucesso h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text-strong);
}

.fm-lead-form__sucesso p {
  font-size: 13px;
  font-weight: 300;
  color: var(--color-text-mid);
  max-width: 280px;
  line-height: 1.6;
}

/* ── Checkbox comercial (medico) ─────────────── */
.fm-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 4px;
}

.fm-checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--color-navy);
  flex-shrink: 0;
}

.fm-checkbox-row label {
  font-size: 11px;
  font-weight: 400;
  color: var(--color-text-light);
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.4;
  cursor: pointer;
}

/* ── Pulse animation (scroll trigger) ────────── */
.fm-lead-form__card.fm--pulse {
  animation: fm-pulse 0.6s ease;
}

@keyframes fm-pulse {
  0%   { box-shadow: var(--shadow-lg); }
  50%  { box-shadow: 0 0 0 6px rgba(14,116,144,.15), var(--shadow-lg); }
  100% { box-shadow: var(--shadow-lg); }
}

/* ── Mobile responsive ───────────────────────── */
@media (max-width: 600px) {
  .fm-lead-form__body {
    grid-template-columns: 1fr;
  }

  .fm-lead-form__left {
    padding: 24px 24px 20px;
  }

  /* Hide benefits and doctor on mobile */
  .fm-benefits,
  .fm-doctor,
  .fm-autoridade {
    display: none;
  }

  .fm-lead-form__left h2 {
    font-size: 18px;
  }

  .fm-lead-form__left > p {
    font-size: 13px;
    margin-bottom: 0;
  }

  .fm-lead-form__right {
    padding: 24px;
  }

  .fm-lead-form__right h3 {
    font-size: 13px;
  }

  .fm-lead-form__right > p {
    font-size: 11px;
    margin-bottom: 18px;
  }

  /* Single column fields on mobile */
  .fm-fields-grid {
    grid-template-columns: 1fr;
  }

  /* iOS zoom fix: font-size >= 16px */
  .fm-field-group input,
  .fm-field-group select {
    font-size: 16px;
  }

  .fm-cta {
    font-size: 13px;
    padding: 13px 20px;
  }

  .fm-microcopy { font-size: 10px; }

  /* Tabs smaller on mobile */
  .fm-tabs { gap: 4px; padding: 0 2px; }
  .fm-tabs__btn { padding: 8px 10px; font-size: 11px; }
}

@media (max-width: 480px) {
  .fm-tabs__btn .fm-tab-label-full { display: none; }
  .fm-tabs__btn .fm-tab-label-short { display: inline; }
}

@media (min-width: 481px) {
  .fm-tabs__btn .fm-tab-label-short { display: none; }
}

/* ── IG dropdowns (gestante) ─────────────────── */
.fm-ig-row {
  margin-bottom: 16px;
}
.fm-ig-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-strong);
  margin-bottom: 6px;
}
.fm-ig-fields {
  display: flex;
  gap: 12px;
}
.fm-ig-field {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}
.fm-ig-select {
  flex: 1;
  padding: 10px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-strong);
  background: #fff;
  cursor: pointer;
  transition: border-color .2s;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
.fm-ig-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(14,116,144,.1);
}
.fm-ig-unit {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-light);
  white-space: nowrap;
}
.fm-ig-select.fm-ig-filled {
  border-color: var(--color-primary);
  background-color: var(--teal-50);
}

/* === ANTI-SPAM: Hide honeypot field === */
.fm-hp { position: absolute; left: -9999px; opacity: 0; height: 0; overflow: hidden; }
