/* ===== storefinder.css — compact, production-ready ===== */

/* Theme tokens (override per site/theme if desired) */
.storefinder {
  --sf-bg: #fff;
  --sf-border: #e5e7eb;
  --sf-text: #111827;
  --sf-muted: #6b7280;
  --sf-accent: #111827; /* used for selected brand outline */
  --sf-radius: 10px;
  --sf-gap: 8px;

  height: calc(100vh - 80px);  /* subtract 80px header height */
  max-height: calc(100vh - 80px);
  min-height: 360px;     /* reasonable min height for mobile */
  color: var(--sf-text);
  background: var(--sf-bg);
  display: grid;
  grid-template-rows: auto 1fr; /* row 1: form, row 2: content */
  overflow: hidden;             /* keep page scroll outside widget */
}

/* Full-width controls bar */
.storefinder__form {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--sf-bg);
  border-bottom: 1px solid var(--sf-border);
  padding: 10px;

  display: flex;
  align-items: center;
  gap: var(--sf-gap);
  flex-wrap: wrap;
}

/* Brand logo checkboxes row */
.storefinder__brands {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sf-gap);
  align-items: center;
  width: 100%;
  margin-bottom: 4px;
}

/* Inputs/layout in form */
.storefinder__search { flex: 1 1 320px; min-width: 220px; }
.storefinder__radius { flex: 0 0 auto; width: 90px; max-width: 110px; }
.storefinder__submit,
.storefinder__geolocate,
.storefinder__btn {
  width: auto !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  line-height: 1.1;
  padding: 8px 12px;
  border: 1px solid var(--sf-border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}


.storefinder__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #111;
  text-decoration: none;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.storefinder__btn:hover {
  background: #f7f7f7;
  border-color: #d1d5db;
}

.storefinder__btn:active {
  background: #efefef;
}

.storefinder__btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(17, 24, 39, .15);
}


/* Optional emphasis variant if you want the Map button to pop */
.storefinder__btn--primary {
  background: #111;
  color: #fff;
  border-color: #111;
}
.storefinder__btn--primary:hover { background: #222; }


/* Two-column layout under the form */
.storefinder__wrap {
  display: grid;
  grid-template-columns:400px 1fr; /* sidebar | map */
  column-gap: 16px;
  height: 100%;
  min-height: 0;
}

/* LEFT: results (scrollable) */
.storefinder__results {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--sf-border);
  background: var(--sf-bg);
  padding-right: 12px;
  box-sizing: border-box;
}

.storefinder__list {
  flex: 1 1 auto;
  overflow: auto;
  min-height: 0;
  padding: 10px;

  /* Smooth scrolling + containment */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  backface-visibility: hidden;
  transform: translateZ(0);
  will-change: scroll-position;
  scrollbar-gutter: stable both-edges;
}

/* RIGHT: map */
.storefinder__map {
  height: 100%;
  min-height: 480px;
  position: relative;
  z-index: 1;
  overflow: hidden; /* clip tile overdraw */
}

/* Scope Leaflet sizing to this widget only */
.storefinder .leaflet-container { height: 100% !important; width: 100% !important; }
.storefinder .leaflet-container img { max-width: none !important; }

/* Result items */
.storefinder__item {
  display: block;
  padding: 10px 8px;
  border-bottom: 1px solid #eee;
  text-decoration: none;
  color: inherit;
}
.storefinder__item:last-child { border-bottom: 0; }
.storefinder__item-title { font-weight: 700; }
.storefinder__item-meta { color: var(--sf-muted); margin-top: 2px; }
.storefinder__item-cta { margin-top: 6px; display: flex; gap: 8px; }

/* States */
.storefinder__loading,
.storefinder__empty,
.storefinder__error { padding: 10px 12px; }

/* --- Brand logo checkboxes --- */
.storefinder__brands .brand-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.storefinder__brands .brand-check input[type="checkbox"] { display: none; } /* hide native */

.storefinder__brands .brand-check__img {
  width: 88px;
  height: 88px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  border-radius: var(--sf-radius);
  overflow: hidden;
  background: #fff;
  transition: border-color .18s ease, box-shadow .18s ease, transform .06s ease;
}
.storefinder__brands .brand-check__img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
.storefinder__brands .brand-check input[type="checkbox"]:checked + .brand-check__img {
  border-color: var(--sf-accent);
  box-shadow: 0 0 0 3px rgba(0,0,0,.06) inset;
}
.storefinder__brands .brand-check:active .brand-check__img { transform: scale(.98); }

/* “Clear” button for brands */
.storefinder__brands .brand-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--sf-border);
  border-radius: 16px;
  background: #fff;
  cursor: pointer;
  font-size: .9rem;
}

/* Brand logos inside result items (deduped & consistent) */
.storefinder__item-brands {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 6px 0 4px;
}
.storefinder__item-brands img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  border-radius: 4px;
  background: #fff;
  border: 1px solid #eee;
  padding: 2px;
  vertical-align: middle;
}

/* Mobile: stack content; form wraps naturally */
@media (max-width: 900px) {
  .storefinder { height: auto; min-height: 0; }
  .storefinder__wrap { grid-template-columns: 1fr; height: auto; }
  .storefinder__results { border-right: 0; border-bottom: 1px solid var(--sf-border); }
  .storefinder__search { flex: 1 1 100%; min-width: 0; }
  .storefinder__map { min-height: 360px; }
  .storefinder__brands .brand-check__img { width: 72px; height: 72px; }
}

/* Accessibility: visible keyboard focus for interactive items */
.storefinder a:focus-visible,
.storefinder button:focus-visible,
.storefinder input:focus-visible,
.storefinder select:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
  border-radius: 6px;
}

/* Motion reduction */
@media (prefers-reduced-motion: reduce) {
  .storefinder__brands .brand-check__img { transition: none; }
}

/* star marker for preferred locations */
.sf-marker--preferred {
  font-size: 30px;
  line-height: 24px;
  text-align: center;
  color: #162046; /* amber/yellow */
  text-shadow: 0 0 2px #fff, 0 1px 1px rgba(0,0,0,.35);
}

/* group header in the list */
.storefinder__group {
  font-weight: 700;
  font-size: 0.95rem;
  padding: 8px 8px 6px;
  border-bottom: 1px solid #eee;
  background: #fafafa;
}


/* 1) Use dynamic viewport height and subtract known offsets */
:root { --sf-header: 96px; /* adjust to your sticky header height */ }
.storefinder {
  /* If the section that contains this has vertical padding, set --sf-section-pad to that px amount */
  --sf-section-pad: 0px;      /* e.g., 40px if section has 40px top + 40px bottom => set to 80px */
  box-sizing: border-box;
  height: calc(100dvh - var(--sf-header) - var(--sf-section-pad));
  max-height: calc(100dvh - var(--sf-header) - var(--sf-section-pad));
  min-height: 360px;
}

/* 2) Let inner grid children actually shrink */
.storefinder__wrap    { height: 100%; min-height: 0; }
.storefinder__results { min-height: 0; }
.storefinder__list    { min-height: 0; }

/* 3) Remove hard map floor height so the grid can fit */
.storefinder__map {
  height: 100%;
  min-height: 0;          /* was 480px — this forces overflow */
  position: relative;
  overflow: hidden;
}

/* 4) Leaflet container still fills whatever space you give it */
.storefinder .leaflet-container { height: 100% !important; width: 100% !important; }

/* 5) If the page has a sticky admin bar sometimes, subtract it only when present */
body.admin-bar .storefinder {
  height: calc(100dvh - var(--sf-header) - var(--sf-section-pad) - 32px);
  max-height: calc(100dvh - var(--sf-header) - var(--sf-section-pad) - 32px);
}

/* 6) OPTIONAL: if the Elementor/section wrapper has padding, zero it here
   (best: add a class to the section that contains the widget, e.g., .sf-section) */
.sf-section { padding-block: 0 !important; }   /* apply this class to the section in the editor */


/* === FINAL OVERRIDES — paste at the very end === */
:root { --sf-header: 96px; }  /* set to your site header height */

.storefinder{
  /* ONE canonical sizing rule */
  box-sizing: border-box;
  height: calc(100dvh - var(--sf-header));
  max-height: calc(100dvh - var(--sf-header));
  min-height: 360px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* form on top; map+list fills the rest */
.storefinder__wrap{
  flex: 1 1 auto;
  min-height: 0; /* allows children to shrink/scroll */
  display: grid;
  grid-template-columns: 400px 1fr; /* your sidebar|map */
  column-gap: 16px;
}

/* left column scrolls */
.storefinder__results{ min-height: 0; display: flex; flex-direction: column; }
.storefinder__list{ min-height: 0; flex: 1 1 auto; overflow: auto; }

/* kill any map floors, let it fill available space */
.storefinder__map{
  height: 100%;
  min-height: 0 !important;   /* beats earlier 480px rules */
  overflow: hidden;
}
.storefinder .leaflet-container{ height: 100% !important; width: 100% !important; }

/* mobile */
@media (max-width: 900px){
  .storefinder{ height: auto; max-height: none; }
  .storefinder__wrap{ grid-template-columns: 1fr; }
  .storefinder__map{ min-height: 360px !important; }
}

.storefinder .leaflet-pane,
.storefinder .leaflet-tile-container,
.storefinder .leaflet-marker-pane {
  will-change: transform;
}

/* === Active brand logo "lift" effect === */
.storefinder__brands .brand-check__img {
  transition: 
    transform .15s ease,
    box-shadow .15s ease; /* smooth lift & shadow */
}

.storefinder__brands .brand-check input[type="checkbox"]:checked + .brand-check__img {
  transform: translateY(-10px); /* lift it up */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15); /* add shadow */
}

/* Preferred store tiles */
.storefinder__item.preferred {
  background: #e6f0fa;  /* light blue background */
  border-left: 4px solid #1e40af; /* darker blue accent on the left */
  border-radius: 6px;
  padding-left: 10px;
}

.storefinder__item.preferred:hover {
  background: #dbeafe;  /* slightly darker blue on hover */
}

/* slightly lift/clean shadow on the SVG pin */
.leaflet-marker-icon.sf-pin svg {
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.25));
}

/* belt-and-suspenders: keep preferred above others */
.leaflet-marker-icon.sf-pin--preferred { z-index: 1000; }

/* lighter preferred pin */
.sf-pin--preferred { color: #60a5fa; }       /* blue-400 */

.leaflet-marker-icon.sf-marker--preferred-img {
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.25));
}
