/* =====================================================================
   Billboard Finder — styles
   ===================================================================== */
:root {
  --brand: #e11d48;
  --brand-dark: #be123c;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --panel: #ffffff;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(15, 23, 42, .14);
  --sidebar-w: 360px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 14px; }
body.modal-open { overflow: hidden; }
button { font-family: inherit; cursor: pointer; }
[hidden] { display: none !important; }
code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

.app { display: flex; height: 100vh; height: 100dvh; }

/* ---------------- Sidebar ---------------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line);
  z-index: 5;
}
.sidebar__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.brand__mark {
  width: 28px; height: 20px; border-radius: 4px; background: var(--brand); position: relative;
  box-shadow: inset 0 0 0 3px #fff, 0 0 0 2px var(--brand);
}
.brand__mark::after {
  content: ""; position: absolute; left: 50%; bottom: -8px; width: 3px; height: 8px;
  background: var(--brand); transform: translateX(-50%);
}
.sidebar__close { display: none; }

.icon-btn {
  width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: transparent; color: var(--ink-2); font-size: 24px; line-height: 1;
}
.icon-btn:hover { background: #f1f5f9; }

/* Search */
.search { position: relative; padding: 0 20px 12px; }
.search__icon { position: absolute; left: 34px; top: 12px; width: 18px; height: 18px; fill: var(--muted); pointer-events: none; }
.search input {
  width: 100%; height: 44px; padding: 0 40px 0 42px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
  font: inherit; font-size: 14px; color: var(--ink); outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.search input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(225, 29, 72, .15); }
.search input::-webkit-search-cancel-button { display: none; }
.search__clear {
  position: absolute; right: 28px; top: 7px; width: 30px; height: 30px;
  border: 0; background: transparent; color: var(--muted); font-size: 20px; border-radius: 50%;
}
.search__clear:hover { background: #e2e8f0; }
.search__suggestions {
  position: absolute; left: 20px; right: 20px; top: 50px; z-index: 20;
  list-style: none; margin: 0; padding: 6px; background: #fff;
  border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
}
.suggestion { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.suggestion:hover, .suggestion.is-active { background: #f1f5f9; }
.suggestion--empty { color: var(--muted); cursor: default; }
.suggestion__text { display: flex; flex-direction: column; min-width: 0; }
.suggestion__text strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggestion__text small { color: var(--muted); font-size: 12px; }
mark { background: #fde68a; color: inherit; border-radius: 2px; padding: 0 1px; }

.summary {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 20px 10px; color: var(--muted); font-size: 13px;
}
.summary strong { color: var(--ink); }
.link-btn { border: 0; background: none; color: var(--brand); font-weight: 600; font-size: 13px; padding: 0; }
.link-btn:hover { text-decoration: underline; }

/* Expandable menus */
.menus { flex: 1; overflow-y: auto; border-top: 1px solid var(--line); }
.menu { border-bottom: 1px solid var(--line); }
.menu__toggle {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 14px 20px; border: 0; background: #fff; text-align: left;
  font-size: 14px; font-weight: 600; color: var(--ink);
}
.menu__toggle:hover { background: var(--bg); }
.menu__title { flex: 1; }
.menu__badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--brand); color: #fff; font-size: 11px; line-height: 20px; text-align: center;
}
.menu__chev {
  width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .2s; margin: -4px 4px 0;
}
.menu.is-open .menu__chev { transform: rotate(-135deg); margin-top: 4px; }
.menu__body { padding: 0 12px 12px; }
.menu--results .menu__body { padding: 0 0 8px; }

.checklist { list-style: none; margin: 0; padding: 0; }
.check {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer;
}
.check:hover { background: var(--bg); }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check__box {
  width: 18px; height: 18px; border: 2px solid #cbd5e1; border-radius: 5px; flex-shrink: 0;
  display: grid; place-items: center; transition: all .15s;
}
.check input:checked + .check__box { background: var(--brand); border-color: var(--brand); }
.check input:checked + .check__box::after {
  content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}
.check input:focus-visible + .check__box { box-shadow: 0 0 0 3px rgba(225, 29, 72, .25); }
.check__label { flex: 1; }
.check__count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.check.is-zero { opacity: .45; }

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

/* Results list */
.results { list-style: none; margin: 0; padding: 0; }
.result {
  display: flex; gap: 12px; padding: 10px 20px; cursor: pointer;
  border-left: 3px solid transparent; outline: none;
}
.result:hover, .result:focus-visible { background: var(--bg); }
.result.is-active { background: #fff1f2; border-left-color: var(--brand); }
.result__thumb { width: 72px; height: 48px; object-fit: cover; border-radius: 6px; flex-shrink: 0; background: #e2e8f0; }
.result__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.result__title { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result__meta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.result__meta .dot { width: 8px; height: 8px; }
.empty { padding: 16px 20px; color: var(--muted); margin: 0; }

/* Contact block (sidebar footer + photo sheet) */
.contact { flex-shrink: 0; padding: 14px 20px 16px; border-top: 1px solid var(--line); background: var(--bg); font-size: 13px; }
.contact__label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.contact__who { display: flex; flex-direction: column; margin-bottom: 8px; }
.contact__who strong { font-size: 14px; }
.contact__who span { color: var(--muted); }
.contact__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.contact__list li { display: flex; align-items: flex-start; gap: 7px; min-width: 0; color: var(--ink-2); line-height: 1.35; }
.contact__list li:nth-last-child(-n+2):has(span) { grid-column: 1 / -1; }
.contact__list a { color: var(--ink); text-decoration: none; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact__list a:hover { color: var(--brand); text-decoration: underline; }
.contact__icon { width: 15px; height: 15px; fill: var(--brand); flex-shrink: 0; margin-top: 1px; }
.contact--sheet { margin: 16px -24px -24px; border-radius: 0 0 16px 0; }
.contact--sheet:empty { display: none; }
.quote__direct { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; text-align: center; }
.quote__direct a { color: var(--brand); font-weight: 600; text-decoration: none; }

/* ---------------- Map ---------------- */
.map-wrap { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; background: #e5e7eb; }

.map-status {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(248, 250, 252, .85); z-index: 4; padding: 20px;
}
.map-status__box {
  max-width: 440px; background: #fff; padding: 22px 26px; border-radius: var(--radius);
  box-shadow: var(--shadow); text-align: center; line-height: 1.6;
}
.map-status__box p { margin: 0; }
.map-status.is-error .spinner { display: none; }
.map-status.is-error .map-status__box { border-top: 4px solid var(--brand); }
.spinner {
  width: 30px; height: 30px; margin: 0 auto 10px; border-radius: 50%;
  border: 3px solid #e2e8f0; border-top-color: var(--brand); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.map-btn {
  display: none; position: absolute; top: 12px; left: 12px; z-index: 6;
  align-items: center; gap: 8px; height: 40px; padding: 0 14px;
  border: 0; border-radius: 20px; background: #fff; box-shadow: var(--shadow);
  font-weight: 600; color: var(--ink);
}
.map-btn svg { width: 18px; height: 18px; fill: currentColor; }

.legend {
  position: absolute; left: 12px; bottom: 26px; z-index: 2;
  display: flex; flex-wrap: wrap; gap: 6px 12px; max-width: calc(100% - 80px);
  padding: 8px 12px; background: rgba(255, 255, 255, .95); border-radius: 10px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .12); font-size: 12px; color: var(--ink-2);
}
.legend__item { display: inline-flex; align-items: center; gap: 6px; }

/* Pins (Advanced Marker content) */
.pin { position: relative; width: 32px; height: 38px; cursor: pointer; transition: transform .15s; transform-origin: 50% 100%; }
.pin__head {
  position: absolute; left: 2px; top: 0; width: 28px; height: 28px;
  background: var(--c, #475569); border: 2px solid #fff; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg); box-shadow: -2px 2px 6px rgba(15, 23, 42, .35);
  display: grid; place-items: center;
}
.pin__icon { width: 14px; height: 14px; fill: #fff; transform: rotate(45deg); }
.pin:hover { transform: scale(1.12); }
.pin.is-active { transform: scale(1.3); }
.pin.is-active .pin__head { border-color: #fde68a; }

/* Clusters */
.cluster {
  display: grid; place-items: center; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 14px;
  box-shadow: 0 0 0 6px rgba(225, 29, 72, .25), 0 4px 12px rgba(15, 23, 42, .3);
  border: 2px solid #fff; cursor: pointer;
  transform: translateY(50%);            /* centre the circle on the point */
  transition: transform .15s;
}
.cluster:hover { transform: translateY(50%) scale(1.08); }

/* ---------------- Popup card (inside Google InfoWindow) ---------------- */
.gm-style .gm-style-iw-c { padding: 0 !important; border-radius: 14px !important; box-shadow: var(--shadow) !important; }
.gm-style .gm-style-iw-d { overflow: hidden !important; padding: 0 !important; max-height: none !important; }

.card { width: 320px; font-family: var(--font); color: var(--ink); position: relative; }
.card__close {
  position: absolute; top: 8px; right: 8px; z-index: 2; width: 30px; height: 30px;
  border: 0; border-radius: 50%; background: rgba(15, 23, 42, .65); color: #fff; font-size: 20px; line-height: 1;
}
.card__close:hover { background: rgba(15, 23, 42, .85); }
.card__media { position: relative; height: 170px; background: #e2e8f0; }
.card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card__tag {
  position: absolute; left: 10px; bottom: 10px; padding: 3px 9px; border-radius: 999px;
  color: #fff; font-size: 11px; font-weight: 600; letter-spacing: .02em;
}
.card__body { padding: 12px 16px 16px; }
.card__ids { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.card__ids strong { color: var(--ink); font-weight: 600; }
.card__title { margin: 4px 0 6px; font-size: 16px; line-height: 1.3; }
.card__loc { display: flex; gap: 6px; margin: 0 0 12px; color: var(--ink-2); font-size: 13px; line-height: 1.45; }
.card__loc svg { width: 16px; height: 16px; flex-shrink: 0; fill: var(--brand); margin-top: 1px; }
.card__stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 12px;
  padding: 10px; background: var(--bg); border-radius: 10px;
}
.card__stats dt { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.card__stats dd { margin: 2px 0 0; font-weight: 600; font-size: 13px; }
.card__label { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 6px; }
.chips { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { padding: 4px 9px; border-radius: 999px; background: #fff1f2; color: var(--brand-dark); font-size: 12px; font-weight: 500; }
.card__spec {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px;
  color: var(--brand); font-weight: 600; font-size: 13px; text-decoration: none;
}
.card__spec svg { width: 16px; height: 16px; fill: currentColor; }
.card__spec:hover { text-decoration: underline; }
.card__actions { display: flex; gap: 8px; }
.card__actions .btn { flex: 1; }

/* Buttons */
.btn {
  height: 40px; padding: 0 16px; border-radius: 10px; font-weight: 600; font-size: 14px;
  border: 1px solid transparent; transition: background .15s, border-color .15s;
}
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dark); }
.btn--ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: #cbd5e1; background: var(--bg); }

/* ---------------- Modals ---------------- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .55); }
.modal__panel {
  position: relative; width: 100%; max-width: 520px; max-height: calc(100vh - 40px); overflow-y: auto;
  background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 24px;
  animation: pop .18s ease-out;
}
.modal__panel--wide { max-width: 900px; padding: 0; }
.modal__close { position: absolute; top: 10px; right: 10px; z-index: 2; background: rgba(255, 255, 255, .9); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.photosheet { display: grid; grid-template-columns: 1.2fr 1fr; }
.photosheet__img { width: 100%; height: 100%; min-height: 320px; object-fit: contain; background: #0f172a; border-radius: 16px 0 0 16px; display: block; }
.photosheet__info { padding: 24px; }
.photosheet__info h2 { margin: 6px 0 6px; font-size: 20px; }
.muted { color: var(--muted); margin: 0 0 14px; line-height: 1.5; }
.spec-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; font-size: 13px; }
.spec-table th, .spec-table td { text-align: left; padding: 7px 0; border-bottom: 1px solid var(--line); }
.spec-table th { color: var(--muted); font-weight: 500; width: 45%; }

/* Quote form */
.quote h2 { margin: 0 0 4px; font-size: 20px; }
.quote__for { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field input, .field select, .field textarea {
  font: inherit; font-weight: 400; font-size: 14px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: #fff; outline: none;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(225, 29, 72, .12); }
.field .is-invalid, .is-invalid { border-color: #dc2626 !important; }
.form-error { color: #dc2626; font-size: 13px; margin: 0 0 10px; }
.quote__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.quote-success { text-align: center; padding: 20px 10px 6px; }
.quote-success__icon {
  width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 50%;
  display: grid; place-items: center; background: #dcfce7; color: #16a34a; font-size: 28px; font-weight: 700;
}
.quote-success h2 { margin: 0 0 6px; }
.quote-success p { color: var(--muted); margin: 0 0 18px; line-height: 1.5; }

/* ---------------- Responsive ---------------- */
@media (max-width: 820px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(92vw, 380px);
    transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow); z-index: 50;
  }
  body.sidebar-visible .sidebar { transform: none; }
  .sidebar__close { display: block; }
  .map-btn { display: inline-flex; }
  .legend { bottom: 30px; font-size: 11px; }
  .card { width: 270px; }
  .card__media { height: 130px; }
  .photosheet { grid-template-columns: 1fr; }
  .photosheet__img { min-height: 0; height: 220px; border-radius: 16px 16px 0 0; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .contact--sheet { border-radius: 0 0 16px 16px; }
}
@media (max-height: 700px) and (min-width: 821px) {
  .contact__who, .contact__list li:has(span) { display: none; }  /* keep the footer compact on short screens */
}

/* ---------------- Print (Photo Sheet) ---------------- */
@media print {
  body.modal-open .app, .modal__backdrop, .modal__close, .no-print { display: none !important; }
  .modal { position: static; padding: 0; display: block; }
  .modal__panel { box-shadow: none; max-height: none; max-width: none; animation: none; }
  .photosheet { grid-template-columns: 1fr; }
  .photosheet__img { border-radius: 0; height: auto; }
}
