/* ── Google Fonts imported in HTML ── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:    #242E3D;
  --gold:    #F4C33B;
  --blue:    #009FE3;
  --gray:    #CBD5E1;
  --white:   #ffffff;
  --surface: #F8FAFC;
  --border:  #E2E8F0;
  --text:    #1E293B;
  --muted:   #64748B;
  --shadow:  0 2px 12px rgba(0,0,0,.10);
  --radius:  12px;
}

body {
  font-family: "Montserrat", sans-serif;
  background: var(--white);
  color: var(--text);
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 60px;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--navy);
  flex-shrink: 0;
}

.logo-mark {
  height: 40px;
  width: auto;
  flex-shrink: 0;
  display: block;
  object-fit: contain;
}

.logo-text {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.3px;
}

.logo-text span { color: var(--gold); }

/* Right group: lang toggle + tagline stacked/inline */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.header-tagline {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-align: right;
  line-height: 1.3;
}

/* ── Language toggle ─────────────────────────────────────────────────────── */
.lang-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}

.lang-btn {
  background: none;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 10px;
  line-height: 1;
  transition: background .15s, color .15s;
}

.lang-btn.active {
  background: var(--navy);
  color: var(--white);
}

.lang-btn:hover:not(.active) {
  color: var(--navy);
  background: var(--border);
}

/* ── Hero ────────────────────────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 28px 24px 16px;
}

.hero h1 {
  font-size: clamp(20px, 3.5vw, 30px);
  font-weight: 800;
  color: var(--navy);
  line-height: 1.2;
  margin-bottom: 8px;
}

.hero h1 .gold { color: var(--gold); }

.hero p {
  font-size: 13px;
  color: var(--muted);
  max-width: 500px;
  margin: 0 auto;
}

/* ── Controls ─────────────────────────────────────────────────────────────── */
.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 24px 14px;
}

.search-wrap {
  position: relative;
}

.search-wrap input {
  padding: 8px 12px 8px 36px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  width: 210px;
  outline: none;
  transition: border-color .2s;
}

.search-wrap input:focus { border-color: var(--blue); }

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  font-size: 13px;
}

.stats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface);
  border: 1.5px solid var(--border);
}

.stat-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.stat-dot.dot-active-ffm { background: var(--navy); }
.stat-dot.dot-active-sbm { background: var(--gold); }
.stat-dot.dot-referral    { background: var(--blue); }
.stat-dot.dot-inactive    { background: var(--gray); }

.stat-num { color: var(--navy); font-weight: 700; }

/* ── Product line toggle ─────────────────────────────────────────────────── */
#line-toggle-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 60px;
  z-index: 90;
}

#line-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.line-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 20px;
  border-radius: 8px;
  border: 2px solid var(--navy);
  background: var(--white);
  color: var(--navy);
  cursor: pointer;
  transition: background .15s, color .15s;
  line-height: 1;
}

.line-btn:hover:not(.active) {
  background: rgba(36, 46, 61, .08);
}

.line-btn.active {
  background: var(--navy);
  color: var(--white);
}

/* ── Coming soon caption ─────────────────────────────────────────────────── */
.coming-soon-msg {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  text-align: center;
  margin: 0;
}

/* ── Map area ─────────────────────────────────────────────────────────────── */
.map-section {
  display: flex;
  gap: 0;
  position: relative;
  padding: 0 16px 12px;
}

#map-wrapper {
  flex: 1;
  min-width: 0;
  position: relative;
}

/* ── Loading / error overlay ──────────────────────────────────────────────── */
.map-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(248, 250, 252, 0.95);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  z-index: 10;
  padding: 24px;
}

.map-overlay-error { color: #b91c1c; }
.map-overlay-error strong { font-size: 15px; display: block; }
.map-overlay-error span { font-size: 12px; font-weight: 400; color: var(--muted); word-break: break-word; max-width: 420px; }

#us-map {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
}

/* State paths */
.state-path {
  cursor: pointer;
  transition: filter .15s, opacity .15s;
}

.state-path:hover,
.state-path:focus {
  filter: brightness(1.12);
  outline: none;
}

.state-path.selected {
  stroke: var(--blue) !important;
  stroke-width: 2.5px !important;
  filter: drop-shadow(0 0 6px rgba(0,159,227,.5));
}

.state-path.dimmed {
  opacity: 0.2;
}

.state-label.dimmed {
  opacity: 0.15;
}

/* ── Tooltip ──────────────────────────────────────────────────────────────── */
#tooltip {
  position: fixed;
  display: none;
  z-index: 200;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 10px 14px;
  font-size: 12px;
  pointer-events: none;
  max-width: 200px;
  line-height: 1.5;
}

#tooltip strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
}

.tt-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 3px;
}

.tt-active-ffm { background: var(--navy); color: #fff; }
.tt-active-sbm { background: var(--gold); color: var(--navy); }
.tt-referral   { background: var(--blue); color: #fff; }
.tt-inactive   { background: var(--gray); color: var(--muted); }

.tt-count { color: var(--muted); font-size: 11px; display: block; margin-top: 2px; }

/* ── Detail panel ─────────────────────────────────────────────────────────── */
#detail-panel {
  width: 320px;
  flex-shrink: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  max-height: 80vh;
  overflow-y: auto;
  position: sticky;
  top: 76px;
  align-self: flex-start;
  display: none;
}

#detail-panel.open { display: block; }

.empty-panel-msg {
  text-align: center;
  padding: 32px 0;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  margin-top: 6px;
}

.panel-state-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.2;
}

.status-pill {
  flex-shrink: 0;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.status-active-ffm   { background: var(--navy); color: #fff; }
.status-active-sbm   { background: var(--gold); color: var(--navy); }
.status-referral-sbm { background: var(--blue); color: #fff; border: 2px solid var(--gold); }
.status-referral-jit { background: var(--blue); color: #fff; }
.status-inactive     { background: var(--gray); color: var(--muted); }
.status-active       { background: var(--navy); color: #fff; }
.status-referral     { background: var(--blue); color: #fff; }

.status-message {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 16px;
}

.carrier-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.carrier-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.carrier-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.no-carriers {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
}

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-available {
  background: var(--navy);
  color: #fff;
}

.badge-referral {
  background: rgba(0,159,227,.1);
  border: 1.5px solid var(--blue);
  color: #0077aa;
}

.badge-jit {
  background: rgba(244,195,59,.15);
  border: 1.5px solid var(--gold);
  color: #8a6d00;
}

/* ── Badge legend ─────────────────────────────────────────────────────────── */
.badge-legend {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

.badge-legend li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.badge-legend .badge { margin-top: 1px; }

/* ── Get Appointed button ─────────────────────────────────────────────────── */
.get-appointed-btn {
  display: block;
  width: 100%;
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  margin: 16px 0;
  cursor: pointer;
  transition: opacity .15s;
}

.get-appointed-btn:hover { opacity: 0.85; }

/* ── Close button ─────────────────────────────────────────────────────────── */
.close-btn {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: var(--muted);
  padding: 4px 6px;
  border-radius: 6px;
  line-height: 1;
  transition: background .15s, color .15s;
}

.close-btn:hover { background: var(--surface); color: var(--navy); }

/* ── Legend ───────────────────────────────────────────────────────────────── */
.map-legend {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 24px 20px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
}

.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-dot.dot-active-ffm    { background: var(--navy); }
.legend-dot.dot-active-sbm    { background: var(--gold); }
.legend-dot.dot-referral      { background: var(--blue); }
.legend-dot.dot-inactive      { background: var(--gray); }

/* ── Special callout (CT, NM) ─────────────────────────────────────────────── */
.special-callout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #FEF5E0;
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text);
}

.callout-icon {
  flex-shrink: 0;
  font-size: 15px;
  line-height: 1.6;
}

.special-callout a {
  color: #8a6d00;
  text-decoration: underline;
}

.special-callout a:hover { color: var(--navy); }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 12px 24px 20px;
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

/* ── Desktop ──────────────────────────────────────────────────────────────── */
@media (min-width: 961px) {
  .close-btn { display: none; }
  #us-map {
    max-height: calc(100vh - 360px);
    width: auto;
    margin: 0 auto;
  }
}

/* ── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .map-section { padding: 0 8px 8px; }
  .header-tagline { display: none; }
  .hero { padding: 20px 16px 12px; }
  .controls { padding: 0 12px 12px; }

  #backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 300;
  }

  #backdrop.visible { display: block; }

  #detail-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    max-height: 70vh;
    border-radius: var(--radius) var(--radius) 0 0;
    z-index: 400;
    transform: translateY(100%);
    transition: transform .3s ease;
    display: block;
    padding: 24px 20px 32px;
  }

  #detail-panel.open {
    transform: translateY(0);
    display: block;
  }
}

@media (max-width: 480px) {
  .search-wrap input { width: 170px; }
  .stats { gap: 5px; }
  .stat-pill { padding: 4px 9px; font-size: 11px; }
  #line-toggle-bar { padding: 8px 12px; }
  .line-btn { padding: 7px 14px; font-size: 12px; }
}

/* ── Embed mode (?embed=1, loaded inside an iframe) ──────────────────────── */
/* min-height: 100vh would peg the reported height to the iframe height and
   prevent it from ever shrinking, so drop it in embed mode. */
body.embed-mode { min-height: 0; }

/* The iframe is sized to fit content via postMessage; never scroll inside. */
html.embed-mode,
html.embed-mode body { overflow: hidden; }

body.embed-mode .site-header,
body.embed-mode .site-footer { display: none; }

body.embed-mode .hero { padding-top: 10px; }

/* The vh-based cap would create a resize feedback loop inside the iframe
   (iframe height ← content height ← vh); let the map size by width instead. */
body.embed-mode #us-map { max-height: none; }
