/* ═══════════════════════════════════════════════════════════════
   css/lead-capture.css
   ───────────────────────────────────────────────────────────────
   Styles for the site-wide lead-capture system (js/lead-capture.js).
   Three surfaces:
     1. .odiv-lc-sticky    — desktop bottom bar (≥992px)
     2. .odiv-lc-pill      — floating WhatsApp pill (mobile + pricing)
     3. .odiv-lc-modal     — exit-intent / scroll-60% modal

   Reuses tokens from variables.css (ODIV dark theme, WhatsApp green).
   No new CSS variables defined except one layout offset.

   Z-index stack:
     modal overlay         9997  (below existing .modal-overlay / drawer)
     sticky bar + pill     9996  (below mobile-cta-bar 9998)
   ══════════════════════════════════════════════════════════════ */

:root {
  /* All three are written by lead-capture.js watchBottomOffset():
     • sticky-bottom  = height of cookie banner (when visible), else 0
     • pill-bottom    = 16 + cookie-banner + mobile-cta-bar (as applicable)
     • bottom-offset  = legacy alias for pill-bottom (kept for back-compat) */
  --lead-capture-sticky-bottom: 0px;
  --lead-capture-pill-bottom: 16px;
  --lead-capture-bottom-offset: 16px;
}

/* ── 1. STICKY BOTTOM BAR (desktop ≥992px) ─────────────────────── */

.odiv-lc-sticky {
  position: fixed;
  /* Sits above the cookie banner when that's visible (JS bumps the var). */
  bottom: var(--lead-capture-sticky-bottom, 0);
  left: 0;
  right: 0;
  z-index: 9996;
  display: none;               /* JS toggles 'is-visible' to show */
  padding: 12px max(16px, env(safe-area-inset-left)) calc(12px + env(safe-area-inset-bottom));
  background: rgba(15, 17, 23, 0.94);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  transform: translateY(100%);
  opacity: 0;
  transition:
    transform 0.35s cubic-bezier(0.32, 0.72, 0, 1),
    opacity 0.25s ease;
}

.odiv-lc-sticky.is-visible {
  display: flex;
  transform: translateY(0);
  opacity: 1;
}

.odiv-lc-sticky__inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  /* close | copy | form  — close moved to LEFT (opposite corner from
     the ASK ODIV voice widget which owns bottom-right). */
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 16px;
  /* Reserve right-side breathing room so the submit button never
     abuts the ASK ODIV pill when it overlaps at large viewport widths. */
  padding-right: clamp(0px, 3vw, 72px);
}

.odiv-lc-sticky__copy {
  min-width: 0;
}

.odiv-lc-sticky__headline {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.odiv-lc-sticky__sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.3;
}

.odiv-lc-sticky__form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(200px, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.odiv-lc-sticky__close {
  /* 44×44 hit target — WCAG 2.5.5 minimum recommendation. */
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
}
.odiv-lc-sticky__close:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  color: var(--text-primary);
}
.odiv-lc-sticky__close:focus-visible {
  outline: 2px solid var(--accent-green);
  outline-offset: 2px;
}

/* Compact sticky form hides the opt-in checkbox and shows it
   lightly under the buttons in the success/expanded state. */
.odiv-lc-sticky .odiv-lc-field--name { display: none; }
.odiv-lc-sticky .odiv-lc-field--optin {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--text-muted);
}

/* ── 2. FLOATING WHATSAPP PILL (mobile + pricing page) ─────────── */

/* Capsule with icon + label — NOT a circle WhatsApp icon.
   The icon+label pattern mirrors the ASK ODIV voice widget on the
   other side, reading as a sibling affordance (not a chat shortcut). */
.odiv-lc-pill {
  position: fixed;
  left: 16px;
  bottom: var(--lead-capture-pill-bottom, 16px);
  z-index: 9996;
  min-height: 48px;
  padding: 0 18px 0 14px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 999px;
  background: var(--accent-green);
  color: #000;
  display: none;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.35), 0 2px 6px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.15s ease;
  white-space: nowrap;
}

.odiv-lc-pill.is-visible { display: inline-flex; }
.odiv-lc-pill:hover {
  transform: translateY(-2px);
  background: #1eba5a;
  box-shadow: 0 10px 28px rgba(37, 211, 102, 0.45), 0 4px 10px rgba(0, 0, 0, 0.35);
}
.odiv-lc-pill:active { transform: translateY(0) scale(0.97); }
.odiv-lc-pill:focus-visible {
  outline: 3px solid rgba(37, 211, 102, 0.5);
  outline-offset: 3px;
}

.odiv-lc-pill svg { width: 18px; height: 18px; }
.odiv-lc-pill__label { font-weight: 600; }

/* On very narrow mobile, collapse to a compact chip */
@media (max-width: 480px) {
  .odiv-lc-pill { padding: 0 14px 0 12px; min-height: 44px; font-size: 13px; }
}

/* ── 3. MODAL (exit-intent desktop, scroll-60% mobile) ─────────── */

.odiv-lc-modal {
  position: fixed;
  inset: 0;
  z-index: 9997;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.odiv-lc-modal.is-visible { display: flex; opacity: 1; }

/* Hide 3rd-party floating widgets while our modal is open.
   Without this, the ASK ODIV voice widget (#voice-widget-wrapper)
   physically overlaps the modal's Send button on mobile. Re-shows
   automatically when the body class is removed on modal close. */
body.odiv-lc-modal-open #voice-widget-wrapper,
body.odiv-lc-modal-open .voice-widget-wrapper,
body.odiv-lc-modal-open .voice-widget-container {
  visibility: hidden !important;
  pointer-events: none !important;
}

.odiv-lc-modal__card {
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 28px 24px 24px;
  box-shadow: var(--shadow-elevated);
  position: relative;
  transform: translateY(8px) scale(0.98);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.25s ease;
}

.odiv-lc-modal.is-visible .odiv-lc-modal__card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.odiv-lc-modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.odiv-lc-modal__close:hover { background: rgba(255, 255, 255, 0.08); color: var(--text-primary); }
.odiv-lc-modal__close:focus-visible {
  outline: 2px solid var(--accent-green);
  outline-offset: 2px;
}

.odiv-lc-modal__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--color-success-bg);
  color: var(--accent-green);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 12px;
}

.odiv-lc-modal__headline {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.25;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.odiv-lc-modal__sub {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* ── 4. FORM (shared by sticky + modal) ────────────────────────── */

.odiv-lc-form {
  display: grid;
  gap: 10px;
}

.odiv-lc-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.odiv-lc-field__label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

/* Sticky bar hides labels (compact layout). */
.odiv-lc-sticky .odiv-lc-field__label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.odiv-lc-input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.4;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.odiv-lc-input::placeholder {
  color: var(--text-muted);
}

.odiv-lc-input:focus {
  outline: none;
  border-color: var(--accent-green);
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.2);
}

.odiv-lc-input[aria-invalid="true"] {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.odiv-lc-error {
  font-size: 12px;
  color: var(--color-error-light);
  line-height: 1.3;
  min-height: 1em;
}

/* Honeypot — invisible to humans, still interactable for bots. */
.odiv-lc-honeypot {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  left: -9999px !important;
}

.odiv-lc-optin {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: start;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.odiv-lc-optin input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--accent-green);
  cursor: pointer;
  flex-shrink: 0;
}

.odiv-lc-optin label { cursor: pointer; }
.odiv-lc-optin a { color: var(--accent-green); text-decoration: underline; }

.odiv-lc-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  padding: 0 18px;
  border: 1px solid var(--accent-green);
  border-radius: var(--radius-md);
  background: var(--accent-green);
  color: #000;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.2s ease, transform 0.1s ease;
  white-space: nowrap;
}

.odiv-lc-submit:hover:not(:disabled) {
  background: #1eba5a;
  border-color: #1eba5a;
  box-shadow: 0 0 20px rgba(37, 211, 102, 0.3);
  transform: translateY(-1px);
}
.odiv-lc-submit:active:not(:disabled) { transform: translateY(0); }
.odiv-lc-submit:focus-visible {
  outline: 3px solid rgba(37, 211, 102, 0.45);
  outline-offset: 2px;
}

.odiv-lc-submit:disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
  box-shadow: none;
}

/* ── 5. SUCCESS / ERROR STATES (post-submit) ───────────────────── */

.odiv-lc-result {
  display: none;
  padding: 20px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: var(--bg-surface);
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
}

.odiv-lc-result.is-visible { display: block; }
.odiv-lc-result--success {
  border-color: rgba(37, 211, 102, 0.35);
  background: var(--color-success-bg);
  color: var(--text-primary);
}
.odiv-lc-result--error {
  border-color: rgba(239, 68, 68, 0.35);
  background: var(--color-error-bg);
  color: var(--text-primary);
}

.odiv-lc-result__title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

/* ── 6. intl-tel-input overrides (match ODIV dark theme) ───────── */

.odiv-lc-form .iti { width: 100%; }
.odiv-lc-form .iti__tel-input,
.odiv-lc-form .iti input[type="tel"] {
  width: 100%;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  height: 42px;
  padding-left: 52px;
  padding-right: 12px;
  font-family: var(--font-sans);
  font-size: 14px;
}
.odiv-lc-form .iti__tel-input:focus {
  outline: none;
  border-color: var(--accent-green);
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.2);
}

/* v24 wraps search + country list in .iti__dropdown-content. Open upward
   by default — our forms live in bottom-sticky / modal surfaces where
   the native downward dropdown gets clipped. */
.odiv-lc-form .iti__dropdown-content {
  bottom: 100%;
  top: auto;
  margin-bottom: 4px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-elevated);
  overflow: hidden; /* clip inner search/list to rounded corners */
}

.odiv-lc-form .iti__country-list {
  background: transparent; /* container owns the bg now */
  color: var(--text-primary);
  border: none;
  border-radius: 0;
  box-shadow: none;
  max-height: 260px;
  overflow-y: auto;
  margin: 0;
  padding: 4px 0;
}

/* v24 search input — without this, the browser-default focus ring shows
   green on white over our dark modal (the ugly look in Image #146). */
.odiv-lc-form .iti__search-input {
  width: 100%;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: none;
  border-bottom: 1px solid var(--glass-border);
  border-radius: 0;
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
}
.odiv-lc-form .iti__search-input::placeholder {
  color: var(--text-secondary);
}
.odiv-lc-form .iti__search-input:focus {
  border-bottom-color: var(--accent-green);
  box-shadow: none;
  outline: none;
}

.odiv-lc-form .iti__country {
  padding: 8px 12px;
  color: var(--text-primary);
}
.odiv-lc-form .iti__country-name {
  color: var(--text-primary);
}
.odiv-lc-form .iti__country.iti__highlight,
.odiv-lc-form .iti__country:hover {
  background: rgba(37, 211, 102, 0.12);
}
.odiv-lc-form .iti__dial-code {
  color: var(--text-secondary);
}
.odiv-lc-form .iti__selected-flag:focus,
.odiv-lc-form .iti__selected-country-primary:focus {
  outline: 2px solid var(--accent-green);
  outline-offset: -2px;
}

/* "No results" message shown when search has no matches. */
.odiv-lc-form .iti__no-country {
  color: var(--text-secondary);
  padding: 12px;
  font-size: 13px;
  text-align: center;
}

/* ── 7. RESPONSIVE BREAKPOINTS ─────────────────────────────────── */

/* Below 992px: hide sticky bar. JS decides pill/modal-only based on page. */
@media (max-width: 991.98px) {
  .odiv-lc-sticky { display: none !important; }
  .odiv-lc-modal__card {
    max-width: none;
    padding: 24px 18px 20px;
    border-radius: var(--radius-lg);
  }
  .odiv-lc-modal__headline { font-size: 19px; }
}

/* Small screens: modal full-bleed feel */
@media (max-width: 480px) {
  .odiv-lc-modal {
    padding: 0;
    align-items: flex-end;
  }
  .odiv-lc-modal__card {
    max-height: 90vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
}

/* Very narrow sticky bar — collapse form below copy, close stays on LEFT */
@media (max-width: 1200px) and (min-width: 992px) {
  .odiv-lc-sticky__inner {
    grid-template-columns: auto 1fr;
  }
  .odiv-lc-sticky__close { grid-column: 1; grid-row: 1; }
  .odiv-lc-sticky__copy  { grid-column: 2; grid-row: 1; }
  .odiv-lc-sticky__form {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: 8px;
  }
}

/* ── 8. TOAST (post-submit async notification) ──────────────────
   Shown immediately after the modal/sticky closes on submit so the
   user gets a "Sending… → Sent" confirmation without being trapped
   behind a spinner. Top-center placement avoids collision with the
   floating pill (bottom-left), voice widget (bottom-right), mobile
   CTA bar (bottom-full), and cookie banner.

   z-index 10000 — sits above the modal overlay (9997) so a stale
   toast remains visible if the user re-opens the form. */

.odiv-lc-toast {
  position: fixed;
  top: calc(20px + env(safe-area-inset-top));
  left: 50%;
  transform: translate(-50%, calc(-100% - 32px));
  z-index: 10000;
  max-width: min(420px, calc(100vw - 32px));
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px 12px 14px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-elevated);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.4;
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.25s ease;
  pointer-events: auto;
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
}

.odiv-lc-toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.odiv-lc-toast__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.odiv-lc-toast__msg {
  min-width: 0;
  flex: 1;
}

.odiv-lc-toast--success {
  border-color: rgba(37, 211, 102, 0.45);
  background: linear-gradient(180deg, rgba(37, 211, 102, 0.10), var(--bg-card));
}
.odiv-lc-toast--success .odiv-lc-toast__icon { color: var(--accent-green); }

.odiv-lc-toast--error {
  border-color: rgba(239, 68, 68, 0.45);
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.10), var(--bg-card));
}
.odiv-lc-toast--error .odiv-lc-toast__icon { color: var(--color-error-light); }

.odiv-lc-toast--pending .odiv-lc-toast__icon { color: var(--accent-green); }
.odiv-lc-toast--pending .odiv-lc-toast__icon svg {
  animation: odiv-lc-spin 0.9s linear infinite;
  transform-origin: 50% 50%;
}

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

@media (max-width: 480px) {
  .odiv-lc-toast {
    top: calc(14px + env(safe-area-inset-top));
    font-size: 13.5px;
    padding: 11px 16px 11px 12px;
    max-width: calc(100vw - 24px);
  }
}

/* ── 9. MOTION PREFERENCES ─────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .odiv-lc-sticky,
  .odiv-lc-modal,
  .odiv-lc-modal__card,
  .odiv-lc-pill,
  .odiv-lc-submit,
  .odiv-lc-input,
  .odiv-lc-toast { transition: none !important; }
  .odiv-lc-pill:hover { transform: none; }
  .odiv-lc-submit:hover:not(:disabled) { transform: none; }
  .odiv-lc-toast--pending .odiv-lc-toast__icon svg { animation: none; }
}
