/* Funnel marketing — lead capture + AI chat */

.funnel-lead-capture,
.funnel-lead-capture *,
.funnel-lead-capture *::before,
.funnel-lead-capture *::after {
  box-sizing: border-box;
}

/* Seller funnel pages — aligned with funnel content column */
.funnel-lead-capture-zone {
  width: 100%;
  max-width: var(--funnel-content-max, 1080px);
  margin: 0 auto;
  padding: 0 var(--funnel-content-pad-x, 20px) clamp(28px, 4vw, 48px);
}

.funnel-lead-capture {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

.funnel-lead-capture__inner {
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 3vw, 28px);
  width: 100%;
  padding: clamp(20px, 3vw, 32px);
  border-radius: 16px;
  border: 1px solid rgba(34, 197, 94, 0.28);
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.92) 0%, rgba(6, 78, 59, 0.35) 100%);
}

@media (min-width: 900px) {
  .funnel-lead-capture__inner {
    flex-direction: row;
    align-items: flex-start;
    gap: clamp(24px, 4vw, 40px);
  }

  .funnel-lead-capture__copy {
    flex: 1 1 42%;
    min-width: 0;
  }

  .funnel-lead-capture__form {
    flex: 1 1 58%;
    min-width: 0;
    max-width: 440px;
    margin-left: auto;
  }
}

.funnel-lead-capture__copy {
  width: 100%;
}

.funnel-lead-capture__eyebrow {
  margin: 0 0 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #86efac;
}

.funnel-lead-capture__title {
  margin: 0 0 10px;
  font-size: clamp(1.25rem, 2.5vw, 1.65rem);
  line-height: 1.2;
  color: #f8fafc;
}

.funnel-lead-capture__sub {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.55;
  color: #cbd5e1;
}

.funnel-lead-capture__form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  margin: 0;
}

.funnel-lead-capture__hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.funnel-lead-capture__field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  width: 100%;
  margin: 0;
  cursor: default;
}

.funnel-lead-capture__field span {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
  line-height: 1.3;
}

.funnel-lead-capture__field input {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(2, 6, 23, 0.65);
  color: #f8fafc;
  font-size: 16px;
  line-height: 1.4;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
}

.funnel-lead-capture__field input:focus {
  outline: 2px solid rgba(34, 197, 94, 0.55);
  outline-offset: 1px;
  border-color: rgba(34, 197, 94, 0.65);
}

.funnel-lead-capture__checks {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  padding: 2px 0 4px;
}

.funnel-lead-capture__check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  margin: 0;
  font-size: 0.82rem;
  color: #cbd5e1;
  line-height: 1.45;
  cursor: pointer;
}

.funnel-lead-capture__check span {
  flex: 1;
  min-width: 0;
}

.funnel-lead-capture__check input {
  margin: 2px 0 0;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  min-height: 16px;
  accent-color: #22c55e;
}

.funnel-lead-capture__submit {
  display: block;
  width: 100%;
  min-height: 48px;
  margin: 4px 0 0;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 100%);
  color: #052e16;
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
}

.funnel-lead-capture__status {
  margin: 0;
  min-height: 1.2em;
  font-size: 0.85rem;
  color: #86efac;
  text-align: center;
}

.funnel-lead-capture__status.is-error {
  color: #fca5a5;
}

/* AI funnel / pay landing — light card on white funnel pages */
body.pay-landing-body .funnel-lead-capture__inner,
body.pay-funnel-body .funnel-lead-capture__inner {
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.06);
}

body.pay-landing-body .funnel-lead-capture__eyebrow,
body.pay-funnel-body .funnel-lead-capture__eyebrow {
  color: #15803d;
}

body.pay-landing-body .funnel-lead-capture__title,
body.pay-funnel-body .funnel-lead-capture__title {
  color: #0f172a;
}

body.pay-landing-body .funnel-lead-capture__sub,
body.pay-funnel-body .funnel-lead-capture__sub {
  color: #475569;
}

body.pay-landing-body .funnel-lead-capture__field span,
body.pay-funnel-body .funnel-lead-capture__field span {
  color: #64748b;
}

body.pay-landing-body .funnel-lead-capture__field input,
body.pay-funnel-body .funnel-lead-capture__field input {
  background: #fff;
  border-color: #cbd5e1;
  color: #0f172a;
}

body.pay-landing-body .funnel-lead-capture__check,
body.pay-funnel-body .funnel-lead-capture__check {
  color: #475569;
}

body.pay-landing-body .funnel-lead-capture__status,
body.pay-funnel-body .funnel-lead-capture__status {
  color: #15803d;
}

body.pay-landing-body .funnel-lead-capture__status.is-error,
body.pay-funnel-body .funnel-lead-capture__status.is-error {
  color: #dc2626;
}

/* WarriorPlus / marketing funnel sites — dark sections */
body.wp-home .funnel-lead-capture__inner {
  background: linear-gradient(145deg, #0f0829 0%, #1e1b4b 100%);
  border-color: rgba(255, 193, 7, 0.35);
}

body.wp-home .funnel-lead-capture__submit {
  background: linear-gradient(180deg, #ffd54f 0%, #ffc107 100%);
  color: #111;
}

@media (max-width: 899px) {
  .funnel-lead-capture-zone {
    padding-left: max(16px, var(--funnel-content-pad-x, 20px));
    padding-right: max(16px, var(--funnel-content-pad-x, 20px));
  }

  .funnel-lead-capture__inner {
    padding: 20px 18px;
  }
}

@media (max-width: 480px) {
  .funnel-lead-capture-zone {
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* AI chat widget — bottom baseline; dock left or right */
.funnel-ai-chat {
  position: fixed;
  bottom: max(12px, env(safe-area-inset-bottom));
  top: auto;
  z-index: 9999;
  font-family: Inter, system-ui, sans-serif;
  pointer-events: none;
}

/* afripay-funnel-theme sets body > * { position:relative } — keep chat fixed on body */
body.al-funnel-public > .funnel-ai-chat,
body.al-funnel-public > #funnel-ai-chat {
  position: fixed !important;
  z-index: 9999 !important;
}

.funnel-ai-chat--right {
  right: max(12px, env(safe-area-inset-right));
  left: auto;
}

.funnel-ai-chat--left {
  left: max(12px, env(safe-area-inset-left));
  right: auto;
}

body.wp-home .funnel-ai-chat,
body.afh-premium .funnel-ai-chat,
body.al-funnel-public .funnel-ai-chat,
body.pay-landing-body .funnel-ai-chat,
body.pay-funnel-body .funnel-ai-chat {
  bottom: max(12px, env(safe-area-inset-bottom)) !important;
}

.funnel-ai-chat__toggle,
.funnel-ai-chat__panel {
  pointer-events: auto;
}

.funnel-ai-chat__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  min-width: 48px;
  padding: 0 16px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #9333ea 0%, #7c3aed 100%);
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(124, 58, 237, 0.45);
  position: relative;
  z-index: 1;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.funnel-ai-chat--right .funnel-ai-chat__panel {
  right: 0;
  left: auto;
}

.funnel-ai-chat--left .funnel-ai-chat__panel {
  left: 0;
  right: auto;
}

.funnel-ai-chat__panel {
  position: absolute;
  bottom: calc(100% + 8px);
  width: min(340px, calc(100vw - 24px));
  max-height: min(380px, calc(100dvh - 88px));
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: #0f172a;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.funnel-ai-chat__panel[hidden] {
  display: none !important;
}

.funnel-ai-chat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  color: #f8fafc;
  font-size: 0.85rem;
}

.funnel-ai-chat__head strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.funnel-ai-chat__head-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.funnel-ai-chat__dock {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.funnel-ai-chat__dock-btn {
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #94a3b8;
  font-size: 0.78rem;
  line-height: 1;
  cursor: pointer;
}

.funnel-ai-chat__dock-btn.is-active {
  background: rgba(124, 58, 237, 0.35);
  color: #f8fafc;
}

.funnel-ai-chat__close {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  min-width: 36px;
  min-height: 36px;
  flex-shrink: 0;
  padding: 0;
}

.funnel-ai-chat__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.funnel-ai-chat__messages {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 72px;
}

.funnel-ai-chat__msg {
  max-width: 92%;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.82rem;
  line-height: 1.4;
}

.funnel-ai-chat__msg--bot {
  align-self: flex-start;
  background: rgba(30, 41, 59, 0.95);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.funnel-ai-chat__msg--user {
  align-self: flex-end;
  background: #7c3aed;
  color: #fff;
}

.funnel-ai-chat__composer {
  display: flex;
  flex-shrink: 0;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  background: #0f172a;
}

.funnel-ai-chat__composer input {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: #020617;
  color: #f8fafc;
  font-size: 16px;
}

.funnel-ai-chat__composer button {
  flex-shrink: 0;
  min-width: 56px;
  min-height: 38px;
  padding: 0 12px;
  border: none;
  border-radius: 8px;
  background: #22c55e;
  color: #052e16;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
}

.funnel-ai-chat__capture {
  padding: 8px 10px 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.15);
  display: grid;
  gap: 6px;
  background: rgba(2, 6, 23, 0.35);
}

.funnel-ai-chat__capture-title {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
}

.funnel-ai-chat__capture input {
  width: 100%;
  box-sizing: border-box;
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: #020617;
  color: #f8fafc;
  font-size: 16px;
}

.funnel-ai-chat__capture-check {
  font-size: 0.75rem;
  color: #cbd5e1;
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 0;
  cursor: pointer;
}

.funnel-ai-chat__capture-check input {
  width: auto;
  min-height: 0;
  margin: 0;
}

.funnel-ai-chat__capture-submit {
  min-height: 36px;
  border: none;
  border-radius: 8px;
  background: #fbbf24;
  color: #111;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
}

@media (max-width: 700px) {
  .funnel-ai-chat__panel {
    max-height: min(340px, calc(100dvh - 76px));
    width: min(320px, calc(100vw - 20px));
  }
}

@media (max-width: 480px) {
  .funnel-ai-chat--right {
    right: max(10px, env(safe-area-inset-right));
  }

  .funnel-ai-chat--left {
    left: max(10px, env(safe-area-inset-left));
  }

  .funnel-ai-chat {
    bottom: max(10px, env(safe-area-inset-bottom));
  }

  .funnel-ai-chat__toggle-label {
    display: none;
  }

  .funnel-ai-chat__toggle {
    width: 50px;
    height: 50px;
    min-width: 50px;
    min-height: 50px;
    padding: 0;
    border-radius: 50%;
  }

  .funnel-ai-chat__panel {
    right: 0;
    max-height: min(300px, calc(100dvh - 70px));
  }
}
