/* ============================================================
   INSUREGROUP QUOTE FORM — Custom Styles
   Brand: #EF5B34 orange | #1863DC blue | #0E4775 navy
   Fonts: Lato (body) | Montserrat (headings/labels)
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --orange:       #EF5B34;
  --orange-dark:  #D44E2A;
  --orange-light: #FFF4F1;
  --blue:         #1863DC;
  --navy:         #0E4775;
  --navy-soft:    #1A5A8A;
  --gray-50:      #F8FAFC;
  --gray-100:     #F1F5F9;
  --gray-200:     #E2E8F0;
  --gray-300:     #CBD5E1;
  --gray-400:     #94A3B8;
  --gray-500:     #64748B;
  --gray-700:     #334155;
  --white:        #FFFFFF;

  --font-body:    'Lato', Helvetica, Arial, sans-serif;
  --font-heading: 'Montserrat', Helvetica, Arial, sans-serif;

  --radius-sm:    6px;
  --radius-md:    10px;
  --radius-lg:    16px;
  --shadow-card:  0 4px 32px rgba(14, 71, 117, 0.10);
  --shadow-tile:  0 4px 14px rgba(239, 91, 52, 0.18);
  --transition:   all 0.2s ease;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-body);
  background: var(--gray-100);
  color: var(--gray-700);
  min-height: 100vh;
}
button { cursor: pointer; font-family: var(--font-body); border: none; background: none; }
input, select, textarea { font-family: var(--font-body); font-size: 1rem; }
a { color: var(--orange); text-decoration: none; }

/* ── Header ─────────────────────────────────────────────────── */
.iq-header {
  background: var(--navy);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(14, 71, 117, 0.25);
}
.iq-header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.iq-logo-wrap { display: flex; align-items: center; gap: 10px; }
.iq-logo { height: 32px; }
.iq-logo-text {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: var(--white);
  letter-spacing: -0.01em;
}
.iq-logo-text strong { color: var(--orange); }
.iq-header-link {
  color: var(--gray-200);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: var(--transition);
}
.iq-header-link:hover { color: var(--white); }

/* ── Main layout ────────────────────────────────────────────── */
.iq-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 16px 64px;
}
.iq-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* ── Progress bar ───────────────────────────────────────────── */
#iq-progress {
  background: var(--white);
  padding: 20px 32px 0;
  border-bottom: 1px solid var(--gray-100);
}
.iq-progress-steps {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  position: relative;
  max-width: 680px;
  margin: 0 auto;
}
.iq-progress-steps::before {
  content: '';
  position: absolute;
  top: 16px;
  left: 10%;
  right: 10%;
  height: 2px;
  background: var(--blue);
  z-index: 0;
}
.iq-progress-line {
  position: absolute;
  top: 16px;
  left: 10%;
  height: 2px;
  background: var(--orange);
  z-index: 1;
  transition: width 0.4s ease;
}
.iq-progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 2;
  flex: 1;
}
.iq-step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--white);
  border: 2px solid var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--blue);
  transition: var(--transition);
}
.iq-progress-step.is-complete .iq-step-dot {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--white);
}
.iq-progress-step.is-active .iq-step-dot {
  background: var(--white);
  border-color: var(--orange);
  color: var(--orange);
}
.iq-step-label {
  font-size: 0.65rem;
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--blue);
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
  padding-bottom: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.6;
}
.iq-progress-step.is-active .iq-step-label { color: var(--orange); opacity: 1; }
.iq-progress-step.is-complete .iq-step-label { color: var(--orange); opacity: 0.8; }

/* ── Step body ──────────────────────────────────────────────── */
#iq-body { padding: 40px 40px 8px; min-height: 400px; }

.iq-step { display: none; }
.iq-step.is-active {
  display: block;
  animation: stepFadeIn 0.35s ease forwards;
}
@keyframes stepFadeIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Step heading ───────────────────────────────────────────── */
.iq-step-heading {
  margin-bottom: 28px;
}
.iq-step-eyebrow {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 8px;
}
.iq-step-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.25;
  margin-bottom: 6px;
}
.iq-step-sub {
  font-size: 0.95rem;
  color: var(--gray-500);
  line-height: 1.5;
}

/* ── Blocks (progressive disclosure) ───────────────────────── */
.iq-block { margin-bottom: 32px; }
.iq-block.is-hidden {
  display: none;
}
.iq-block.is-revealed {
  display: block;
  animation: blockSlideIn 0.4s ease forwards;
}
@keyframes blockSlideIn {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Field wrapper ──────────────────────────────────────────── */
.iq-field { margin-bottom: 24px; }
.iq-field:last-child { margin-bottom: 0; }
.iq-field-label {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 12px;
  display: block;
}
.iq-field-desc {
  font-size: 0.82rem;
  color: var(--gray-400);
  margin-top: 6px;
}
.iq-required { color: var(--orange); margin-left: 3px; }

/* ── Tile grids (mobile-first) ──────────────────────────────── */
/* Default for ALL data-cols values on small screens: 2 columns. */
.iq-tiles {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, 1fr);
}
/* Very narrow (< 360px): single column so labels don't get squished. */
@media (max-width: 359px) {
  .iq-tiles { grid-template-columns: 1fr; }
}
/* Tablet and up: honour data-cols. */
@media (min-width: 560px) {
  .iq-tiles[data-cols="2"] { grid-template-columns: repeat(2, 1fr); }
  .iq-tiles[data-cols="3"] { grid-template-columns: repeat(3, 1fr); }
  .iq-tiles[data-cols="4"] { grid-template-columns: repeat(2, 1fr); }
  .iq-tiles[data-cols="5"] { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 720px) {
  .iq-tiles[data-cols="4"] { grid-template-columns: repeat(4, 1fr); }
  .iq-tiles[data-cols="5"] { grid-template-columns: repeat(5, 1fr); }
}

/* ── Tile card ──────────────────────────────────────────────── */
.iq-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 12px;
  min-height: 88px;
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.iq-tile:hover {
  border-color: var(--orange);
  box-shadow: var(--shadow-tile);
  transform: translateY(-1px);
}
.iq-tile.is-selected {
  border-color: var(--orange);
  border-width: 2px;
  background: var(--orange-light);
}
.iq-tile.is-selected::after {
  content: '✓';
  position: absolute;
  top: 7px;
  right: 9px;
  font-size: 0.7rem;
  font-weight: 900;
  color: var(--orange);
  font-family: var(--font-heading);
}
.iq-tile-img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex-shrink: 0;
}
.iq-tile-img.is-lg {
  width: 64px;
  height: 64px;
}
.iq-tile-label {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.3;
}
.iq-tile.is-selected .iq-tile-label { color: var(--orange-dark); }
/* Text-only tile: slightly taller and vertically centered */
.iq-tile.is-text-only { min-height: 72px; padding: 18px 14px; }
.iq-tile.is-text-only .iq-tile-label { font-size: 0.85rem; }

/* Step 1 large tiles */
.iq-tiles.is-step1 .iq-tile { min-height: 110px; padding: 20px 16px; }

/* ── Text inputs ────────────────────────────────────────────── */
.iq-input,
.iq-select,
.iq-textarea {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--gray-700);
  background: var(--white);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
}
.iq-input::placeholder,
.iq-textarea::placeholder { color: var(--gray-400); }
.iq-input:focus,
.iq-select:focus,
.iq-textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(24, 99, 220, 0.12);
}
.iq-textarea { resize: vertical; min-height: 100px; line-height: 1.5; }

/* ── Select wrapper (chevron) ───────────────────────────────── */
.iq-select-wrap { position: relative; }
.iq-select-wrap::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--gray-400);
  pointer-events: none;
}
.iq-select { padding-right: 36px; cursor: pointer; }

/* ── Row helpers ────────────────────────────────────────────── */
.iq-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.iq-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}
@media (max-width: 500px) {
  .iq-row-2, .iq-row-3 { grid-template-columns: 1fr; }
}

/* ── Inline text field (conditionally shown inside tile block) */
.iq-inline-field {
  margin-top: 16px;
  display: none;
}
.iq-inline-field.is-visible { display: block; }

/* ── Address field ──────────────────────────────────────────── */
.iq-address { display: flex; flex-direction: column; gap: 10px; }

/* ── Optional badge ─────────────────────────────────────────── */
.iq-optional {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--gray-400);
  margin-left: 6px;
}

/* ── Validation error ───────────────────────────────────────── */
.iq-error-msg {
  font-size: 0.82rem;
  color: #DC2626;
  margin-top: 6px;
  display: none;
}
.iq-field.has-error .iq-input,
.iq-field.has-error .iq-select,
.iq-field.has-error .iq-textarea {
  border-color: #DC2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}
.iq-field.has-error .iq-error-msg { display: block; }
.iq-field.has-error .iq-tiles .iq-tile:not(.is-selected) {
  border-color: #FECACA;
}

/* ── Navigation ─────────────────────────────────────────────── */
#iq-nav {
  padding: 20px 40px 32px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.iq-btn {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 13px 28px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.iq-btn-prev {
  color: var(--navy);
  border: 1.5px solid var(--gray-300);
  background: var(--white);
}
.iq-btn-prev:hover {
  border-color: var(--navy);
  background: var(--gray-50);
}
.iq-btn-next {
  background: var(--orange);
  color: var(--white);
  border: 1.5px solid var(--orange);
  margin-left: auto;
}
.iq-btn-next:hover { background: var(--orange-dark); border-color: var(--orange-dark); }
.iq-btn-submit {
  background: var(--navy);
  color: var(--white);
  border: 1.5px solid var(--navy);
  margin-left: auto;
}
.iq-btn-submit:hover { background: var(--navy-soft); border-color: var(--navy-soft); }
.iq-btn svg { width: 16px; height: 16px; fill: currentColor; }
.iq-nav-spacer { flex: 1; }

/* ── Consent checkbox row ──────────────────────────────────── */
.iq-consent-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}
.iq-consent-row:hover {
  border-color: var(--gray-300);
}
.iq-consent-cb {
  margin-top: 2px;
  width: 18px;
  height: 18px;
  accent-color: var(--orange);
  cursor: pointer;
  flex-shrink: 0;
}
.iq-consent-text {
  font-size: 0.9rem;
  color: var(--gray-700);
  line-height: 1.5;
}
.iq-field.has-error .iq-consent-row {
  border-color: #DC2626;
  background: #FEF2F2;
}

/* ── Honeypot (off-screen, screen-reader-safe) ─────────────── */
/* Bots tend to fill every input they find; humans never see this. */
.iq-hp {
  position: absolute !important;
  left: -10000px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
}
.iq-hp input { width: 1px; height: 1px; }

/* ── Confirmation screen ────────────────────────────────────── */
.iq-confirm {
  text-align: center;
  padding: 60px 40px;
}
.iq-confirm-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--orange-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}
.iq-confirm-icon svg { width: 36px; height: 36px; stroke: var(--orange); fill: none; stroke-width: 2.5; }
.iq-confirm h2 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 12px;
}
.iq-confirm p { color: var(--gray-500); font-size: 1rem; line-height: 1.6; }

/* ── Responsive adjustments ─────────────────────────────────── */
@media (max-width: 640px) {
  .iq-main { padding: 16px 12px 48px; }
  #iq-body { padding: 28px 20px 8px; }

  /* Progress: was vertically squished (no bottom padding when labels hide).
     Add breathing room so dots aren't flush with the body edge. */
  #iq-progress { padding: 18px 20px 16px; }
  .iq-step-title { font-size: 1.3rem; }
  .iq-step-label { display: none; }
  .iq-progress-step { gap: 0; }
  .iq-progress-steps::before { left: 16px; right: 16px; }
  .iq-progress-line { left: 16px; }

  /* Step 1 stays at 2 columns (overrides .is-step1's 3-col rule). */
  .iq-tiles.is-step1 { grid-template-columns: repeat(2, 1fr); }

  /* Nav buttons: equal-width side-by-side, no spacer, smaller padding so
     'Previous' and 'Continue' both fit comfortably on narrow phones. */
  #iq-nav {
    padding: 16px 20px 24px;
    gap: 10px;
    flex-wrap: nowrap;
  }
  .iq-nav-spacer { display: none; }
  .iq-btn {
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    padding: 13px 14px;
    font-size: 0.9rem;
    margin-left: 0 !important;
  }
}

/* Extra-narrow phones (<360px): drop button labels to bare essentials. */
@media (max-width: 359px) {
  .iq-btn { padding: 12px 8px; font-size: 0.85rem; letter-spacing: 0; }
}
