/* ==============================================
   Store Locator — Frontend v6
   Mobile: JCO-style + pill buttons + bounded list
   Desktop: side-by-side sticky
   ============================================== */

:root {
  --sl-orange:       #f09a0d;
  --sl-orange-dark:  #d98c0b;
  --sl-orange-soft:  #fef3dc;
  --sl-orange-muted: #fdf8f0;
  --sl-white:        #ffffff;
  --sl-bg:           #f5f5f5;
  --sl-border:       #ededed;
  --sl-text:         #111111;
  --sl-text-muted:   #666666;
  --sl-text-light:   #b8b8b8;
  --sl-green:        #25d366;
  --sl-green-dark:   #1fba59;
  --sl-purple:       #c13584;
  --sl-shadow-sm:    0 1px 4px rgba(0,0,0,0.06);
  --sl-shadow-md:    0 2px 14px rgba(0,0,0,0.09);
  --sl-shadow-lg:    0 8px 32px rgba(0,0,0,0.14);
  --sl-radius-lg:    12px;
  --sl-radius:       8px;
  --sl-radius-sm:    6px;
  --sl-ease:         0.17s ease;
}

/* ── Reset ─────────────────────────────── */
.sl-wrap, .sl-wrap *, .sl-wrap *::before, .sl-wrap *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
.sl-wrap {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--sl-text);
  background: var(--sl-bg);
  padding: 0;
  margin: 0 auto;
  max-width: 100%;
}

/* ══════════════════════════════════════════
   MAP
   ══════════════════════════════════════════ */
.sl-map-wrap {
  width: 100%;
  position: relative;
  overflow: hidden;
}
#sl-map { width: 100%; display: block; }

.leaflet-control-attribution { display: none !important; }
.leaflet-control-zoom {
  border: 1px solid rgba(0,0,0,0.12) !important;
  border-radius: var(--sl-radius) !important;
  box-shadow: var(--sl-shadow-md) !important;
  overflow: hidden;
}
.leaflet-control-zoom a {
  width: 32px !important; height: 32px !important;
  line-height: 30px !important; color: #555 !important;
  font-size: 16px !important;
  border-bottom-color: rgba(0,0,0,0.08) !important;
}
.leaflet-control-zoom a:hover {
  background: var(--sl-orange-soft) !important;
  color: var(--sl-orange) !important;
}

/* ══════════════════════════════════════════
   PANEL (search sticky + list)
   ══════════════════════════════════════════ */
.sl-panel {
  background: var(--sl-white);
  position: relative;
}

/* ── Sticky search + filter ─────────────── */
.sl-sticky-top {
  background: var(--sl-white);
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--sl-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.sl-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}
.sl-search-icon {
  position: absolute;
  right: 13px;
  color: var(--sl-text-light);
  pointer-events: none;
  display: flex; align-items: center;
}
#sl-search {
  width: 100%;
  height: 46px;
  padding: 0 42px 0 14px;
  border: 1.5px solid var(--sl-border);
  border-radius: var(--sl-radius);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--sl-text);
  background: var(--sl-white);
  outline: none;
  transition: border-color var(--sl-ease), box-shadow var(--sl-ease);
  -webkit-appearance: none;
}
#sl-search::placeholder {
  color: var(--sl-text-light);
  letter-spacing: 0.08em;
  font-size: 0.79rem;
}
#sl-search:focus {
  border-color: var(--sl-orange);
  box-shadow: 0 0 0 3px rgba(240,154,13,0.10);
}

.sl-filter-row {
  display: flex;
  gap: 7px;
  align-items: center;
}
.sl-select {
  flex: 1;
  height: 38px;
  padding: 0 26px 0 10px;
  border: 1.5px solid var(--sl-border);
  border-radius: var(--sl-radius-sm);
  font-size: 0.79rem;
  color: var(--sl-text);
  background: var(--sl-white)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23aaa' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    no-repeat right 8px center;
  appearance: none; -webkit-appearance: none;
  outline: none; cursor: pointer;
  transition: border-color var(--sl-ease);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sl-select:focus { border-color: var(--sl-orange); }

.sl-btn-reset {
  flex-shrink: 0;
  height: 38px; padding: 0 13px;
  border: 1.5px solid var(--sl-border);
  border-radius: var(--sl-radius-sm);
  background: var(--sl-white);
  font-size: 0.78rem; font-weight: 500;
  color: var(--sl-text-muted); cursor: pointer;
  white-space: nowrap; transition: all var(--sl-ease);
}
.sl-btn-reset:hover {
  border-color: var(--sl-orange);
  color: var(--sl-orange); background: var(--sl-orange-muted);
}

/* ══════════════════════════════════════════
   LIST — bounded height + scroll on mobile
   ══════════════════════════════════════════ */
.sl-list {
  background: var(--sl-white);
  /* Mobile: bounded so it doesn't scroll page infinitely */
  max-height: 420px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.sl-list::-webkit-scrollbar { width: 3px; }
.sl-list::-webkit-scrollbar-track { background: transparent; }
.sl-list::-webkit-scrollbar-thumb { background: #e0e0e0; border-radius: 3px; }
.sl-list::-webkit-scrollbar-thumb:hover { background: var(--sl-orange); }

/* ══════════════════════════════════════════
   STORE CARD
   ══════════════════════════════════════════ */
.sl-store-card {
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--sl-border);
  cursor: pointer;
  background: var(--sl-white);
  transition: background var(--sl-ease);
  display: block;
}
.sl-store-card:last-child { border-bottom: none; }
.sl-store-card:hover      { background: var(--sl-orange-muted); }
.sl-store-card.active     {
  background: var(--sl-orange-soft);
  border-left: 3px solid var(--sl-orange);
  padding-left: 13px;
}

/* No bullet in new layout */
.sl-card-bullet { display: none; }

.sl-store-info { display: block; }

.sl-store-name {
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--sl-text);
  margin: 0 0 5px;
  line-height: 1.3;
}
.sl-store-address {
  display: block;
  margin: 0 0 3px;
}
.sl-addr-line {
  display: block;
  font-size: 0.8rem;
  color: var(--sl-text-muted);
  line-height: 1.55;
}
.sl-store-loc {
  font-size: 0.78rem;
  color: var(--sl-text-light);
  margin: 0 0 11px;
  line-height: 1.4;
}

/* ── Pill action buttons ────────────────── */
.sl-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

/* Base pill */
.sl-btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;       /* fully rounded / pill */
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-decoration: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity var(--sl-ease), transform var(--sl-ease);
  -webkit-appearance: none;
  line-height: 1;
}
.sl-btn-pill:hover  { opacity: 0.85; }
.sl-btn-pill:active { transform: scale(0.97); }
.sl-btn-pill svg    { flex-shrink: 0; }

/* Direction — orange */
.sl-btn-direction {
  background: var(--sl-orange);
  color: #fff;
}

/* WhatsApp — green */
.sl-btn-wa {
  background: var(--sl-green);
  color: #fff;
}
.sl-btn-wa:hover { color: #fff; }

/* Instagram — gradient purple-orange */
.sl-btn-ig {
  background: linear-gradient(135deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  color: #fff;
}
.sl-btn-ig:hover { color: #fff; }

/* ══════════════════════════════════════════
   STATE BOX
   ══════════════════════════════════════════ */
.sl-state-box {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 24px; gap: 10px;
  color: var(--sl-text-muted); font-size: 0.84rem; text-align: center;
}
.sl-spinner {
  width: 26px; height: 26px;
  border: 2.5px solid var(--sl-border);
  border-top-color: var(--sl-orange);
  border-radius: 50%;
  animation: sl-spin 0.7s linear infinite;
}
@keyframes sl-spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════
   POPUP
   ══════════════════════════════════════════ */
.leaflet-popup-content-wrapper {
  border-radius: var(--sl-radius-lg) !important;
  box-shadow: var(--sl-shadow-lg) !important;
  padding: 0 !important; overflow: hidden; border: none !important;
}
.leaflet-popup-content { margin: 0 !important; width: 230px !important; }
.leaflet-popup-close-button {
  top: 10px !important; right: 10px !important;
  color: rgba(255,255,255,0.85) !important;
  font-size: 18px !important; font-weight: 300 !important;
  line-height: 1 !important; background: none !important; border: none !important;
}
.leaflet-popup-close-button:hover { color: #fff !important; }
.leaflet-popup-tip-container { display: none !important; }

.sl-popup-head { background: var(--sl-orange); padding: 12px 34px 10px 14px; }
.sl-popup-title { font-size: 0.87rem; font-weight: 700; color: #fff; margin: 0; line-height: 1.3; }
.sl-popup-body  { padding: 11px 14px 13px; }
.sl-popup-detail {
  font-size: 0.78rem; color: var(--sl-text-muted);
  margin: 0 0 4px; line-height: 1.5;
}
.sl-popup-detail:last-of-type { margin-bottom: 11px; }
.sl-popup-wa {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; background: var(--sl-green); color: #fff;
  font-size: 0.81rem; font-weight: 600;
  padding: 9px; border-radius: var(--sl-radius-sm);
  text-decoration: none; transition: background var(--sl-ease);
}
.sl-popup-wa:hover { background: var(--sl-green-dark); color: #fff; }

/* Tooltip */
.sl-tooltip.leaflet-tooltip {
  background: rgba(17,17,17,0.88) !important; color: #fff !important;
  border: none !important; border-radius: 6px !important;
  font-size: 0.75rem !important; font-weight: 600 !important;
  padding: 5px 9px !important; white-space: nowrap !important;
  pointer-events: none !important; line-height: 1.4 !important;
}
.sl-tooltip.leaflet-tooltip::before { display: none !important; }

/* ══════════════════════════════════════════
   DESKTOP ≥ 900px  —  side-by-side
   ══════════════════════════════════════════ */
@media (min-width: 900px) {
  .sl-wrap {
    display: flex;
    height: 78vh;
    min-height: 600px;
    max-width: 1300px;
    margin: 0 auto;
    border-radius: var(--sl-radius-lg);
    overflow: hidden;
    box-shadow: var(--sl-shadow-md);
    background: var(--sl-white);
  }

  /* Map: left, sticky full height */
  .sl-map-wrap { flex: 1; height: 100%; position: sticky; top: 0; border-radius: 0; }
  #sl-map { height: 100% !important; min-height: unset; }

  /* Panel: right column, own scroll */
  .sl-panel {
    width: 380px; flex-shrink: 0;
    height: 100%; overflow-y: auto;
    border-left: 1px solid var(--sl-border);
    display: flex; flex-direction: column;
  }
  .sl-panel::-webkit-scrollbar { width: 4px; }
  .sl-panel::-webkit-scrollbar-thumb { background: #e0e0e0; border-radius: 4px; }
  .sl-panel::-webkit-scrollbar-thumb:hover { background: var(--sl-orange); }

  .sl-sticky-top { padding: 16px 18px 12px; flex-shrink: 0; }
  #sl-search { font-size: 0.85rem; }

  /* List: fills remaining space, no max-height cap on desktop */
  .sl-list { flex: 1; max-height: none; overflow-y: visible; }

  /* Slightly bigger cards on desktop */
  .sl-store-card { padding: 18px 20px 15px; }
  .sl-store-card.active { padding-left: 17px; }
  .sl-store-name { font-size: 0.93rem; }
}

/* ══════════════════════════════════════════
   MOBILE < 900px  —  JCO stacked
   ══════════════════════════════════════════ */
@media (max-width: 899px) {
  .sl-wrap { display: block; border-radius: 0; box-shadow: none; }

  /* Map compact, edge-to-edge */
  .sl-map-wrap { border-radius: 0; }
  #sl-map { height: 260px !important; }

  /* Panel full width */
  .sl-panel { width: 100%; }

  .sl-sticky-top { padding: 11px 14px 8px; }
  #sl-search { height: 44px; font-size: 0.8rem; }
  .sl-filter-row { gap: 6px; }
  .sl-select { height: 36px; font-size: 0.77rem; }
  .sl-btn-reset { height: 36px; font-size: 0.75rem; padding: 0 11px; }

  /* List BOUNDED — scroll inside, not full page */
  .sl-list { max-height: 420px !important; overflow-y: auto !important; }

  /* Card sizing */
  .sl-store-card { padding: 15px 14px 13px; }
  .sl-store-name { font-size: 0.95rem; }
  .sl-addr-line  { font-size: 0.79rem; }
  .sl-store-loc  { font-size: 0.76rem; margin-bottom: 9px; }

  /* Pill buttons on mobile */
  .sl-btn-pill   { height: 32px; padding: 0 13px; font-size: 0.71rem; }
}

@media (max-width: 480px) {
  #sl-map { height: 220px !important; }
  .sl-sticky-top { padding: 10px 12px 7px; }
  .sl-store-card { padding: 13px 12px 11px; }
  /* Stack buttons if very narrow */
  .sl-card-actions { gap: 6px; }
}
