/* =========================================================
   IHT POPUP — popup-form.css  v6
   ========================================================= */
:root {
  --pop-brand:  #f59e0b;
  --pop-bd:     #d97706;
  --pop-dark:   #0f1831;
  --pop-ink:    #0f172a;
  --pop-muted:  #64748b;
  --pop-line:   #e2e8f0;
  --pop-ok:     #22c55e;
  --pop-err:    #ef4444;
  --pop-z:      9999;
}

/* Force hidden always works regardless of global CSS */
#ihtConsultForm [hidden],
.iht-popup-success[hidden] { display: none !important; }

/* -------------------------------------------------------
   BACKDROP
   ------------------------------------------------------- */
.iht-popup-backdrop {
  position: fixed; inset: 0; z-index: var(--pop-z);
  background: rgba(0,0,0,.62);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .24s ease, visibility .24s ease;
}
.iht-popup-backdrop.is-open {
  opacity: 1; visibility: visible; pointer-events: auto;
}
body.iht-popup-open { overflow: hidden; }

/* -------------------------------------------------------
   POPUP SHELL
   ------------------------------------------------------- */
.iht-popup {
  position: relative;
  display: grid;
  grid-template-columns: 230px 1fr;
  width: min(800px, 100%);
  height: min(580px, calc(100dvh - 32px));
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 28px 70px rgba(0,0,0,.32);
  transform: scale(.96) translateY(12px);
  transition: transform .25s cubic-bezier(.22,1,.36,1);
}
.iht-popup-backdrop.is-open .iht-popup {
  transform: scale(1) translateY(0);
}

/* -------------------------------------------------------
   CLOSE BUTTON
   ------------------------------------------------------- */
.iht-popup-close {
  position: absolute; top: 12px; right: 12px; z-index: 20;
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(255,255,255,.16); color: #fff;
  cursor: pointer; display: grid; place-items: center; padding: 0;
  transition: background .15s;
}
.iht-popup-close:hover { background: rgba(255,255,255,.30); }
.iht-popup-close svg { width: 13px; height: 13px; }

/* =======================================================
   LEFT PANEL
   ======================================================= */
.iht-popup-left {
  background: var(--pop-dark);
  padding: 28px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
  min-width: 0;
}

.iht-popup-logo {
  height: 36px; width: auto;
  object-fit: contain; object-position: left center;
  display: block; max-width: 100%;
}

.iht-popup-trust h2 {
  margin: 0 0 6px;
  font-size: 20px; line-height: 1.22;
  color: #fff; font-weight: 800;
  letter-spacing: -.02em;
}
.iht-popup-sub {
  margin: 0; color: #94a3b8;
  font-size: 12.5px; line-height: 1.5;
}

/* Benefits */
.iht-popup-benefits {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 10px;
}
.iht-popup-benefits li {
  display: flex; align-items: flex-start; gap: 9px;
  color: #cbd5e1; font-size: 12.5px; line-height: 1.45;
}
.iht-chk {
  flex-shrink: 0; width: 17px; height: 17px; border-radius: 50%;
  background: rgba(34,197,94,.18); border: 1px solid rgba(34,197,94,.35);
  display: grid; place-items: center; margin-top: 1px;
}
.iht-chk svg {
  width: 9px; height: 9px;
  fill: none; stroke: var(--pop-ok); stroke-width: 2.2;
}

/* Stats */
.iht-popup-stats {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,.09);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.iht-popup-stat {
  display: flex; align-items: center;
  justify-content: space-between; gap: 10px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 8px; padding: 8px 12px;
  min-width: 0;
}
.iht-popup-stat strong {
  font-size: 14px; font-weight: 800; color: var(--pop-brand);
  white-space: nowrap; flex-shrink: 0;
}
.iht-popup-stat span {
  font-size: 11px; color: #94a3b8;
  line-height: 1.2; text-align: right; white-space: nowrap;
}

/* =======================================================
   RIGHT PANEL
   ======================================================= */
.iht-popup-right {
  display: flex;
  flex-direction: column;
  /* padding: top right bottom left */
  padding: 28px 32px 26px;
  overflow-y: auto;
  min-width: 0;
}

/* -------------------------------------------------------
   STEP BAR
   ------------------------------------------------------- */
.iht-popup-steps {
  display: flex; align-items: center;
  margin-bottom: 22px; flex-shrink: 0;
}
.iht-popup-step {
  display: flex; align-items: center; gap: 7px; flex-shrink: 0;
}
.step-num {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--pop-line); background: #fff;
  color: var(--pop-muted); font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
  transition: background .2s, border-color .2s, color .2s;
  flex-shrink: 0;
}
.step-label { font-size: 13px; color: var(--pop-muted); font-weight: 500; }
.iht-popup-step.active .step-num {
  background: var(--pop-brand); border-color: var(--pop-brand); color: #fff;
}
.iht-popup-step.active .step-label { color: var(--pop-ink); font-weight: 700; }
.iht-popup-step.done .step-num {
  background: var(--pop-ok); border-color: var(--pop-ok); color: #fff;
}
.step-line {
  flex: 1; height: 2px; background: var(--pop-line);
  margin: 0 10px; border-radius: 2px; transition: background .2s;
}
.step-line.done { background: var(--pop-ok); }

/* -------------------------------------------------------
   FORM SHELL — vertically distributes content
   ------------------------------------------------------- */
.iht-popup-form {
  flex: 1; display: flex; flex-direction: column; min-height: 0;
}

/* Each fieldset fills available height so content + button
   are spaced naturally — no cramping at top, button at bottom */
.iht-popup-fieldset {
  border: 0; padding: 0; margin: 0;
  display: flex; flex-direction: column;
  flex: 1; min-height: 0;
}

.iht-popup-legend {
  font-size: 15px; font-weight: 700; color: var(--pop-ink);
  margin-bottom: 20px; display: block; flex-shrink: 0;
  line-height: 1.35;
}
.iht-opt { font-size: 11.5px; font-weight: 400; color: var(--pop-muted); }

/* -------------------------------------------------------
   FORM GROUPS
   ------------------------------------------------------- */
.iht-form-group {
  display: flex; flex-direction: column;
  gap: 5px; margin-bottom: 14px; flex-shrink: 0;
}
.iht-form-row2 {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 14px; flex-shrink: 0; margin-bottom: 14px;
}
.iht-form-row2 .iht-form-group { margin-bottom: 0; }

.iht-form-label {
  font-size: 12.5px; font-weight: 600; color: var(--pop-ink);
}
.req { color: var(--pop-err); }

.iht-form-input {
  height: 42px;
  border: 1.5px solid #d0d7e3;
  border-radius: 9px;
  padding: 0 12px;
  font-size: 14px; font-family: inherit;
  color: var(--pop-ink);
  background: #f4f6f9;
  outline: none; width: 100%;
  transition: border-color .15s, box-shadow .15s, background .15s;
  box-sizing: border-box;
}
.iht-form-input:focus {
  border-color: var(--pop-brand);
  box-shadow: 0 0 0 3px rgba(245,158,11,.13);
  background: #fff;
}
.iht-form-input.has-error { border-color: var(--pop-err); background: #fff8f8; }
.iht-form-input::placeholder { color: #a8b5c2; }

/* Phone */
.iht-phone-wrap { position: relative; display: flex; align-items: center; }
.iht-flag {
  position: absolute; left: 10px; z-index: 1;
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 700; color: var(--pop-ink);
  pointer-events: none; white-space: nowrap; user-select: none;
}
.iht-flag svg { border-radius: 2px; flex-shrink: 0; }
.iht-phone-inp { padding-left: 56px; }

/* Select */
.iht-select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 30px; cursor: pointer;
}

.iht-form-error {
  font-size: 11px; color: var(--pop-err);
  font-weight: 500; min-height: 14px; line-height: 1.2;
}

/* -------------------------------------------------------
   CONCERN CARDS
   ------------------------------------------------------- */
.iht-concern-grid {
  display: grid; grid-template-columns: repeat(4,1fr);
  gap: 8px; margin-bottom: 16px; flex-shrink: 0;
}
.iht-concern-card {
  display: flex; flex-direction: column;
  align-items: center; gap: 7px;
  padding: 12px 6px 10px;
  border: 1.5px solid var(--pop-line); border-radius: 10px;
  cursor: pointer; text-align: center;
  font-size: 11.5px; font-weight: 600; color: var(--pop-muted);
  background: #f8fafc;
  transition: border-color .14s, background .14s, color .14s;
  position: relative; line-height: 1.25;
  user-select: none;
}
.iht-concern-card input[type="radio"] {
  position: absolute; opacity: 0; width: 0; height: 0;
}
.iht-concern-card svg {
  width: 22px; height: 22px; color: #94a3b8; transition: color .14s;
}
.iht-concern-card:has(input:checked),
.iht-concern-card.selected {
  border-color: var(--pop-brand);
  background: rgba(245,158,11,.07);
  color: var(--pop-ink);
}
.iht-concern-card:has(input:checked) svg,
.iht-concern-card.selected svg { color: var(--pop-brand); }

/* -------------------------------------------------------
   NAV BUTTONS
   Step 1: Next centered, pushed to bottom
   Step 2: Back left, Continue right, pushed to bottom
   ------------------------------------------------------- */
.iht-nav-center {
  margin-top: auto;   /* push to bottom of flex column */
  padding-top: 20px;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

.iht-popup-nav {
  display: flex; align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;   /* push to bottom of flex column */
  padding-top: 20px;
  flex-shrink: 0;
}

.iht-popup-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 44px; padding: 0 24px; border-radius: 9px;
  font-size: 14px; font-weight: 700; font-family: inherit;
  cursor: pointer; border: 1.5px solid transparent;
  transition: background .15s, border-color .15s, transform .15s, box-shadow .15s;
  white-space: nowrap; text-decoration: none;
}

.iht-btn-wide {
  min-width: 160px; justify-content: center;
  height: 46px; font-size: 15px;
}

.iht-btn-primary {
  background: var(--pop-brand); color: #fff; border-color: var(--pop-brand);
}
.iht-btn-primary:hover {
  background: var(--pop-bd); border-color: var(--pop-bd);
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(245,158,11,.32);
}

.iht-btn-ghost {
  background: #fff; color: var(--pop-ink); border-color: var(--pop-line);
}
.iht-btn-ghost:hover { border-color: #cbd5e1; }

.iht-btn-submit {
  background: var(--pop-dark); color: #fff;
  border-color: var(--pop-dark); padding: 0 32px;
}
.iht-btn-submit:hover {
  background: #1a2644;
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(15,24,49,.26);
}
.iht-btn-submit:disabled {
  opacity: .6; cursor: not-allowed; transform: none; box-shadow: none;
}

.submit-spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.3); border-top-color: #fff;
  border-radius: 50%; animation: iht-spin .7s linear infinite;
}
@keyframes iht-spin { to { transform: rotate(360deg); } }

/* -------------------------------------------------------
   SUCCESS STATE
   ------------------------------------------------------- */
.iht-popup-success {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 14px;
  flex: 1; justify-content: center; padding: 10px 20px;
}
.success-icon svg { width: 58px; height: 58px; }
.success-heading { margin: 0; font-size: 20px; font-weight: 800; color: var(--pop-ink); }
.success-msg { margin: 0; color: var(--pop-muted); font-size: 14px; line-height: 1.6; max-width: 30ch; }

.iht-wa-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 46px; padding: 0 26px; border-radius: 999px;
  background: #25d366; color: #fff;
  font: 700 14px/1 Inter, system-ui, sans-serif;
  text-decoration: none; border: none;
  box-shadow: 0 4px 14px rgba(37,211,102,.30);
  transition: background .15s, transform .15s;
}
.iht-wa-btn:hover { background: #1fba59; transform: translateY(-1px); }

/* -------------------------------------------------------
   FLOATING CTA
   ------------------------------------------------------- */
.iht-float-cta {
  position: fixed; bottom: 22px; right: 18px; z-index: 1500;
  display: inline-flex; align-items: center; gap: 7px;
  height: 48px; padding: 0 20px; border-radius: 999px;
  background: var(--pop-brand); color: #fff;
  font: 700 13.5px/1 Inter, system-ui, sans-serif;
  border: none; cursor: pointer;
  box-shadow: 0 6px 22px rgba(245,158,11,.38);
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity .22s, visibility .22s, transform .15s, background .15s;
}
.iht-float-cta.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.iht-float-cta:hover { background: var(--pop-bd); transform: translateY(-2px); }
.iht-float-cta svg { width: 16px; height: 16px; }

/* =======================================================
   RESPONSIVE — MOBILE
   ======================================================= */
@media (max-width: 700px) {
  .iht-popup {
    grid-template-columns: 1fr;
    height: auto;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
  }
  .iht-popup-left {
    padding: 20px 20px 16px; gap: 10px;
  }
  .iht-popup-trust h2 { font-size: 17px; }
  .iht-popup-benefits { display: none; }
  .iht-popup-stats {
    flex-direction: row; gap: 6px;
    margin-top: 0; padding-top: 12px;
  }
  .iht-popup-stat { flex: 1; flex-direction: column; text-align: center; padding: 7px 6px; }
  .iht-popup-stat span { text-align: center; }
  .iht-popup-right { padding: 20px 20px 22px; }
  .iht-popup-legend { font-size: 14px; margin-bottom: 16px; }
  .iht-concern-grid { grid-template-columns: repeat(2,1fr); gap: 8px; }
  .iht-form-row2 { grid-template-columns: 1fr; gap: 0; }
  .iht-form-row2 .iht-form-group { margin-bottom: 14px; }
  /* On mobile nav buttons don't need as much top padding */
  .iht-nav-center,
  .iht-popup-nav { padding-top: 14px; }
}

@media (max-width: 480px) {
  .iht-popup-backdrop { padding: 0; align-items: flex-end; }
  .iht-popup { border-radius: 16px 16px 0 0; max-height: 92dvh; }
  .step-label { display: none; }
  .iht-popup-right { padding: 18px 18px 20px; }
}