/* ═══════════════════════════════════════════════════════════════
   Public contractor directory styles (thin-client of the app's
   /api/directory/* endpoints). Uses tokens from colors_and_type.css.
   ═══════════════════════════════════════════════════════════════ */

/* [hidden] must win over the display:flex rules below */
[hidden] { display: none !important; }

/* Cluster marker (map-browse, zoom < 8) */
.cluster-badge {
  display: flex; align-items: center; justify-content: center;
  background: var(--asphalt); color: var(--marking-yellow);
  border: 2px solid var(--marking-yellow); border-radius: 50%;
  font-family: var(--font-mono); font-weight: 700; font-size: 12px;
  width: 38px; height: 38px; box-shadow: var(--shadow-sm);
}
.c-phone { font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--asphalt); margin-top: 10px; }
.c-newnote { font-size: 12px; color: var(--fg-3); margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--rule); font-style: italic; }

/* ── Compact hero (directory-only override; this stylesheet loads only here) ── */
#pageHeader .page-hero { padding-top: 56px; padding-bottom: 26px; }
#pageHeader .section-title { font-size: clamp(26px, 3.6vw, 38px); }

/* ── Header ── */
.dir-header { max-width: 1180px; margin: 0 auto 16px; }

/* Institutional one-liner — demoted to a quiet footnote at the bottom of the page */
.dir-oneliner {
  max-width: 1180px;
  margin: 32px auto 0;
  padding: 14px 4px 0;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  line-height: 1.6;
  color: var(--fg-3);
}
.dir-oneliner strong { color: var(--fg-2); font-weight: 700; }

.dir-searchbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--line-white);
  border: 1.5px solid var(--border);
  border-top: 3px solid var(--marking-yellow);
  border-radius: var(--r-xl);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.dir-search-heading {
  display: flex; flex-direction: column; gap: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}
.dir-search-heading-title {
  font-family: var(--font-sans);
  font-size: 18px; font-weight: 700;
  color: var(--asphalt, var(--fg-1));
  letter-spacing: -0.005em;
}
.dir-search-heading-sub {
  font-size: 13px; color: var(--fg-3); line-height: 1.5;
}
.dir-search-row {
  display: flex; gap: 12px; align-items: flex-end;
}
.dir-search-field { flex: 1; min-width: 220px; position: relative; }

/* Address autocomplete dropdown */
.ac-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  z-index: 1200;
  background: var(--line-white);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  max-height: 280px;
  overflow-y: auto;
}
.ac-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--fg-1);
  cursor: pointer;
  border-bottom: 1px solid var(--rule);
  line-height: 1.4;
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover, .ac-item.ac-active { background: var(--yellow-light); }
.ac-item .ac-pin {
  flex: 0 0 auto; width: 14px; height: 14px; margin-top: 2px; color: var(--fg-3);
}
.ac-item .ac-line2 { color: var(--fg-3); font-size: 12px; }
.ac-empty { padding: 12px 14px; font-size: 13px; color: var(--fg-3); }
.ac-attr {
  padding: 7px 14px; font-size: 10px; color: var(--fg-3);
  border-top: 1px solid var(--rule); background: var(--subtle-bg-alt);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.dir-search-field label {
  display: block;
  font-family: var(--font-sans);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--fg-3); margin-bottom: 6px;
}
.dir-search-field input {
  width: 100%;
  padding: 12px 14px; min-height: 46px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-size: 15px; font-family: var(--font-sans);
  color: var(--fg-1); background: var(--line-white); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.dir-search-field input:focus { border-color: var(--link); box-shadow: 0 0 0 3px rgba(0,51,160,0.12); }
.dir-search-btn { height: 46px; white-space: nowrap; }

.dir-search-hint { font-size: 13px; color: var(--fg-3); margin: 12px 4px 0; }
.linklike {
  background: none; border: none; padding: 0;
  color: var(--link); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline;
}
.linklike:hover { color: var(--link-hover); }

/* ── Filter bar ── */
.dir-filterbar {
  max-width: 1180px; margin: 0 auto 14px;
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px;
  padding: 2px 2px 14px;
  border-bottom: 1px solid var(--rule);
}
.filter-group { display: flex; flex-direction: column; gap: 5px; }
.filter-group label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--fg-3);
}
.filter-group select {
  padding: 8px 12px; min-height: 38px; min-width: 180px;
  border: 1.5px solid var(--border); border-radius: var(--r-md);
  font-size: 13px; font-family: var(--font-sans); color: var(--fg-1); background: var(--line-white);
}
.filter-check {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--fg-2); font-weight: 600; padding-bottom: 8px; cursor: pointer;
}
.filter-spacer { flex: 1; }
.filter-note {
  font-size: 11px; color: var(--fg-3); max-width: 240px; line-height: 1.45; padding-bottom: 4px;
  font-style: italic;
}

/* ── Result count ── */
.dir-resultcount {
  max-width: 1180px; margin: 0 auto 14px;
  font-family: var(--font-mono); font-size: 13px; color: var(--fg-2); letter-spacing: 0.02em;
}
.dir-resultcount strong { color: var(--fg-1); }
.dir-resultcount .rc-cert { color: var(--fire-red); font-weight: 700; }

/* ── Team callout ── */
.dir-teamcallout {
  max-width: 1180px; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--yellow-light);
  border: 1.5px solid var(--marking-yellow);
  border-radius: var(--r-xl);
  padding: 14px 20px;
}
.teamcallout-title { font-weight: 800; font-size: 15px; color: var(--asphalt); }
.teamcallout-sub { font-size: 13px; color: var(--fg-2); }

/* ── Layout ── */
.dir-layout {
  max-width: 1180px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr 280px; gap: 24px; align-items: start;
}
.dir-sidebar { position: sticky; top: 96px; }

/* ── Map (full content width, the hero of the page) ── */
.map-wrapper {
  position: relative;
  max-width: 1180px; margin: 0 auto 22px;
  height: 480px; border-radius: var(--r-xl); overflow: hidden;
  border: 1.5px solid var(--border);
}
#dirMap { height: 100%; width: 100%; }
.map-legend {
  position: absolute; bottom: 12px; left: 12px; z-index: 500;
  background: rgba(255,255,255,0.94); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 8px 12px;
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 11px; font-weight: 600; color: var(--fg-2);
  box-shadow: var(--shadow-xs);
}
.map-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: middle; border: 1.5px solid #fff; }
/* Two-state legend mirrors the addPin() colors in directory.js */
.dot-member { background: #2D6EB5; }
.dot-listed { background: #1A1A1A; }

/* Google Maps InfoWindow content + load fallback */
.gmap-pop { min-width: 150px; font-family: var(--font-sans); }
.map-fallback { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--fg-3); font-size: 14px; background: var(--subtle-bg-alt); }

/* Map loading overlay: visible until first tilesloaded fires (or the
   Google script errors). The wrapper is removed from the DOM once the
   map is ready, so it never lingers behind interactive UI. */
.map-loading {
  position: absolute; inset: 0; z-index: 600;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px;
  background: var(--subtle-bg-alt);
  color: var(--fg-2);
  font-size: 14px;
  transition: opacity 200ms ease;
}
.map-loading.is-hidden { opacity: 0; pointer-events: none; }
.map-spinner {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--handicap-blue);
  animation: dir-map-spin 0.9s linear infinite;
}
.map-loading-text {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
}
@keyframes dir-map-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .map-spinner { animation-duration: 2.4s; }
}

.popup-name { font-size: 14px; font-weight: 800; color: var(--asphalt); }
.popup-meta { font-size: 12px; color: var(--fg-3); margin-top: 2px; }
.popup-tier { font-family: var(--font-mono); font-size: 11px; font-weight: 700; }

/* ── Browse prompt (map mode) ── */
.browse-prompt {
  text-align: center; padding: 30px 24px; background: var(--subtle-bg-alt);
  border: 1px dashed var(--border); border-radius: var(--r-xl);
}
.browse-prompt h3 { font-size: 18px; font-weight: 800; color: var(--asphalt); margin: 0 0 6px; }
.browse-prompt p { font-size: 14px; color: var(--fg-2); max-width: 560px; margin: 0 auto; line-height: 1.6; }

/* ── Browse-mode hint (when cards show without a search) ── */
.browse-hint {
  font-size: 13px; color: var(--fg-3); line-height: 1.5;
  padding: 10px 14px; margin-bottom: 6px;
  background: var(--subtle-bg-alt); border: 1px solid var(--rule); border-radius: var(--r-md);
}

/* ── Result list ── */
.contractor-list { display: flex; flex-direction: column; gap: 14px; }
.bucket-label {
  font-family: var(--font-mono); font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--fg-3); margin: 10px 2px 2px;
  display: flex; align-items: center; gap: 10px;
}
.bucket-label::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

/* ── Paid (color) card ── */
.ccard {
  position: relative;
  border: 1.5px solid var(--border); border-radius: var(--r-xl);
  background: var(--line-white); padding: 18px 20px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.ccard:hover { border-color: var(--marking-yellow); box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.ccard--promoted {
  border: 2px solid var(--marking-yellow);
  background: linear-gradient(180deg, var(--yellow-light), var(--line-white) 60%);
}
.promoted-tag {
  position: absolute; top: -10px; left: 18px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  background: var(--asphalt); color: var(--marking-yellow); padding: 4px 10px; border-radius: var(--r-sm);
}
.ccard-top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.ccard-id { min-width: 0; }
.ccard-name { font-size: 17px; font-weight: 800; color: var(--fg-1); letter-spacing: -0.01em; }
.founding-ribbon {
  display: inline-block; margin-left: 8px; vertical-align: middle;
  font-family: var(--font-mono); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  background: var(--asphalt); color: var(--marking-yellow); padding: 2px 7px; border-radius: var(--r-sm);
}
.ccard-meta { font-family: var(--font-mono); font-size: 12px; color: var(--fg-3); margin-top: 3px; }
.ccard-distance { font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--fg-1); white-space: nowrap; }

.tier-badge {
  display: inline-block; font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  padding: 4px 11px; border-radius: var(--r-sm); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 10px;
}
.tier-master { background: rgba(200,16,46,0.10); color: #C8102E; }
.tier-professional { background: rgba(232,168,56,0.16); color: #B67A1E; }
.tier-associate { background: rgba(74,144,217,0.14); color: #2F6CB5; }

.verify-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.verify-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; color: var(--body-gray);
  background: var(--concrete); padding: 4px 9px; border-radius: var(--r-pill);
}
.verify-pill svg { width: 12px; height: 12px; color: #2E7D32; }

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag {
  font-size: 11px; font-weight: 600; color: var(--fg-2);
  background: var(--subtle-bg-alt); border: 1px solid var(--rule);
  padding: 3px 9px; border-radius: var(--r-pill);
}
.tag-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-3); align-self: center; margin-right: 2px; }

.ccard-stats {
  display: flex; flex-wrap: wrap; gap: 18px; margin-top: 14px;
  padding-top: 12px; border-top: 1px solid var(--rule);
  font-size: 13px; color: var(--fg-2);
}
.ccard-stats b { color: var(--fg-1); }
.stars { color: var(--marking-yellow); letter-spacing: 1px; }
.stars-shadow { color: var(--light-gray); }
.rating-num { color: var(--fg-1); font-weight: 700; }

.ccard-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; align-items: center; }
.report-link {
  margin-left: auto; font-size: 11px; color: var(--fg-3); text-decoration: none; cursor: pointer;
  background: none; border: none; padding: 0; font-family: inherit;
}
.report-link:hover { color: var(--fire-red); text-decoration: underline; }

.more-free-line {
  text-align: center; padding: 16px; font-size: 13px; color: var(--fg-3);
  border: 1px dashed var(--border); border-radius: var(--r-xl); background: var(--subtle-bg-alt);
}

.show-more-listed {
  display: block; width: 100%; margin-top: 12px; padding: 14px 16px;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--fg-1);
  background: var(--subtle-bg-alt); border: 1px dashed var(--border);
  border-radius: var(--r-xl); cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
.show-more-listed:hover { background: var(--surface); border-color: var(--fg-3); }
.show-more-listed:focus-visible { outline: 2px solid var(--handicap-blue); outline-offset: 2px; }

/* ── Listed contractor card (formerly free + imported_unverified) ──
   Unified two-column card for non-member contractors. Left: business info
   + Contact CTA. Right: "Is this your business?" + Claim + Report. */
.lcard {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--line-white);
  padding: 16px 18px;
  margin-bottom: 10px;
}
.lcard-main {
  min-width: 0;
  display: flex; flex-direction: column; gap: 4px;
}
.lcard-name { font-size: 15px; font-weight: 700; color: var(--body-gray); }
.lcard-meta { font-family: var(--font-mono); font-size: 12px; color: var(--curb-gray); margin-top: 3px; }
.lcard-phone { font-family: var(--font-mono); font-size: 12px; color: var(--curb-gray); margin-top: 2px; }
.lcard-contact {
  align-self: flex-start;
  margin-top: 12px;
  font-size: 13px; padding: 9px 16px;
}
.lcard-claim {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 8px; min-width: 180px;
  padding-left: 20px;
  border-left: 1px solid var(--rule);
  text-align: right;
}
.lcard-claim-prompt {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--fg-2);
}
.lcard-claim-btn { font-size: 12px; padding: 8px 14px; }
.lcard-report {
  background: none; border: 0; padding: 2px 0;
  font-size: 11px; color: var(--fg-3); cursor: pointer;
  text-decoration: underline; font-family: inherit;
}
.lcard-report:hover { color: var(--fire-red); }
@media (max-width: 720px) {
  .lcard { grid-template-columns: 1fr; gap: 14px; }
  .lcard-claim {
    border-left: 0; padding-left: 0;
    border-top: 1px solid var(--rule); padding-top: 14px;
    align-items: flex-start; text-align: left;
  }
}

/* ── Sidebar (state counts in browse mode) ── */
.sidebar-card {
  background: var(--line-white); border: 1.5px solid var(--border); border-radius: var(--r-xl);
  padding: 16px 18px;
}
.sidebar-card h4 {
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--asphalt); margin: 0 0 12px;
}
.state-row {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; padding: 9px 4px; border: none; background: none; border-bottom: 1px solid var(--rule);
  font-size: 13px; color: var(--fg-1); cursor: pointer; font-family: var(--font-sans);
}
.state-row:hover { color: var(--link); }
.state-row .num {
  font-family: var(--font-mono); font-weight: 700; font-size: 12px;
  background: var(--yellow-light); color: var(--asphalt); padding: 2px 9px; border-radius: var(--r-sm);
}

/* ── Paid card, mirroring the app's ContractorCard ── */
.ccard-meta { font-family: var(--font-sans); font-size: 12px; color: var(--fg-3); margin-top: 2px; }
.ccard-distline { font-size: 12px; color: var(--fg-3); margin-top: 4px; }
.ccard-rating-wrap { text-align: right; flex-shrink: 0; white-space: nowrap; }
.ccard-rating { font-size: 14px; font-weight: 700; color: #E8A838; }
.ccard-rating-n { font-size: 12px; color: var(--fg-3); }
.ccard-norating { font-size: 12px; color: var(--fg-3); }
.ccard-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.app-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: var(--r-md);
}
.ccard-details { font-size: 12.5px; color: var(--fg-2); line-height: 1.55; margin-top: 12px; }
.ccard-details p { margin: 0 0 3px; }
.dl-label { color: var(--fg-3); }
.dl-cpls { color: #2563EB; }
.dl-strong { font-weight: 600; color: var(--fg-1); }
.ccard-cta { flex: 1; min-width: 120px; font-size: 13px; padding: 9px 16px; text-align: center; }
.ccard-cta .ext-arrow { font-size: 10px; margin-left: 3px; opacity: 0.7; }

/* ── Sidebar Talk-to-Team (demoted, under the counts card) ── */
.sidebar-team { margin-top: 14px; padding: 0 2px; }
.sidebar-team-text { font-size: 12px; color: var(--fg-3); line-height: 1.5; margin-bottom: 6px; }
.sidebar-team-link {
  background: none; border: none; padding: 0; font: inherit; font-size: 13px; font-weight: 600;
  color: var(--link); cursor: pointer;
}
.sidebar-team-link:hover { color: var(--link-hover); }

/* ── Modal (report-issue / talk-to-team) ── */
.dir-modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.dir-modal-backdrop { position: absolute; inset: 0; background: rgba(26,26,26,0.55); }
.dir-modal-dialog {
  position: relative; z-index: 1; width: 100%; max-width: 440px;
  background: var(--line-white); border-radius: var(--r-xl);
  border-top: 4px solid var(--marking-yellow); box-shadow: var(--shadow-md);
  padding: 24px 24px 22px; max-height: 90vh; overflow-y: auto;
}
.dir-modal-x { position: absolute; top: 8px; right: 12px; background: none; border: none; font-size: 26px; line-height: 1; color: var(--fg-3); cursor: pointer; }
.dir-modal-x:hover { color: var(--asphalt); }
.dir-modal-title { font-size: 19px; font-weight: 800; color: var(--asphalt); margin: 0 0 2px; }
.dir-modal-sub { font-size: 13px; color: var(--fg-2); margin: 0 0 16px; line-height: 1.5; }
.dir-field { display: block; margin-bottom: 14px; }
.dir-field > span { display: block; font-size: 12px; font-weight: 700; color: var(--fg-2); margin-bottom: 5px; }
.dir-opt { font-weight: 500; color: var(--fg-3); }
.dir-field select, .dir-field input, .dir-field textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--r-md);
  font-size: 14px; font-family: var(--font-sans); color: var(--fg-1); background: var(--line-white); outline: none;
}
.dir-field select:focus, .dir-field input:focus, .dir-field textarea:focus { border-color: var(--link); box-shadow: 0 0 0 3px rgba(0,51,160,0.12); }
.dir-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.dir-modal-err { font-size: 13px; color: var(--fire-red); margin-bottom: 12px; }
.dir-modal-success { text-align: center; padding: 10px 0 4px; }
.dir-modal-check { width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 50%; background: rgba(46,125,50,0.12); color: #2E7D32; font-size: 26px; display: flex; align-items: center; justify-content: center; }
.dir-modal-success p { font-size: 14px; color: var(--fg-1); margin: 0 0 18px; }

@media (max-width: 940px) {
  .dir-layout { grid-template-columns: 1fr; }
  .dir-sidebar { position: static; }
}
@media (max-width: 600px) {
  .dir-search-row { flex-direction: column; align-items: stretch; }
  .dir-search-btn { width: 100%; }
  .ccard-actions { flex-direction: column; }
  .ccard-cta { width: 100%; }
  .report-link { margin-left: 0; text-align: center; }
}
