/* ==========================================================================
   BIAGGI Eyewear — store locator (MapLibre GL)
   ========================================================================== */

.locator {
  display: flex;
  height: calc(100vh - var(--header-h));
  height: calc(100svh - var(--header-h));
  min-height: 620px;
  margin-top: var(--header-h);
  border-bottom: 1px solid var(--line);
}

/* ---------- Panel ---------- */

.loc-panel {
  flex: 0 0 420px; max-width: 100%;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--ink);
  min-height: 0;
}
.loc-panel__head { padding: 36px 32px 22px; display: flex; flex-direction: column; gap: 18px; border-bottom: 1px solid var(--line); }
.loc-panel__head h1 { font-size: 34px; }

.loc-search {
  display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 18px;
  border-radius: 999px; background: var(--paper); color: var(--ink-text);
  transition: box-shadow .4s var(--ease);
}
.loc-search:focus-within { box-shadow: 0 0 0 4px rgba(242, 59, 64, .35); }
.loc-search svg { width: 18px; height: 18px; flex: none; }
.loc-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 15px; color: var(--ink-text); }
.loc-search input::-webkit-search-cancel-button { cursor: pointer; }

.loc-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  height: 40px; padding: 0 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid #3A3933; background: transparent; color: var(--soft);
  font-size: 13px; font-weight: 600; transition: background-color .35s var(--ease), color .35s, border-color .35s;
}
.chip:hover { border-color: var(--paper); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--paper); border-color: var(--paper); color: var(--ink); }
.loc-select {
  height: 40px; padding: 0 36px 0 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid #3A3933; background-color: var(--ink); color: var(--soft);
  font: inherit; font-size: 13px; font-weight: 600; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23C9C6BE' stroke-width='1.6'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  max-width: 100%;
}
.loc-locate {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0;
  border: 0; background: none; color: var(--red); font-size: 14px; font-weight: 600; cursor: pointer; align-self: flex-start;
}
.loc-locate svg { width: 16px; height: 16px; }
.loc-locate.is-busy svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.results-meta { padding: 14px 32px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); min-height: 48px; }
.results-meta strong { color: var(--text); }

.store-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.store-list::-webkit-scrollbar { width: 6px; }
.store-list::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }

.store-item {
  width: 100%; display: flex; gap: 16px; align-items: flex-start; padding: 18px 32px;
  border: 0; border-left: 3px solid transparent; border-bottom: 1px solid #1E1D19;
  background: transparent; text-align: left; cursor: pointer; color: var(--text);
  transition: background-color .3s, border-color .3s;
  animation: item-in .6s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 25ms);
}
@keyframes item-in { from { opacity: 0; transform: translateX(-12px); } }
.store-item:hover { background: #121210; }
.store-item.is-selected { background: var(--ink-2); border-left-color: var(--red-fill); }
.store-item__pin { width: 18px; height: auto; flex: none; margin-top: 2px; opacity: .9; }
.store-item__text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.store-item .name { font-size: 15px; font-weight: 700; }
.store-item .city { font-size: 13px; color: var(--muted); }
.store-list-empty { padding: 28px 32px; color: var(--muted); font-size: 14px; }

/* ---------- Map ---------- */

.loc-map { flex: 1; position: relative; min-width: 0; background: #191917; }
#map { position: absolute; inset: 0; }

.store-marker { width: 30px; height: 44px; cursor: pointer; }
.store-marker img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0,0,0,.45)); transform-origin: 50% 100%; transition: transform .35s var(--ease); animation: drop .6s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 15ms); }
.store-marker:hover img, .store-marker.is-hover img { transform: scale(1.18); }
.store-marker.is-selected { z-index: 5; }
.store-marker.is-selected img { transform: scale(1.45); }
@keyframes drop { from { opacity: 0; transform: translateY(-18px); } }

.maplibregl-ctrl-group { background: var(--ink) !important; border: 1px solid var(--line-2); box-shadow: none !important; border-radius: 6px !important; overflow: hidden; }
.maplibregl-ctrl-group button { width: 40px !important; height: 40px !important; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line-2) !important; }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1); }
.maplibregl-ctrl-attrib { background: rgba(13,13,11,.7) !important; color: var(--dim); font-size: 11px; }
.maplibregl-ctrl-attrib a { color: var(--soft) !important; }

.sahara-label { color: var(--muted); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; pointer-events: none; }

/* ---------- Detail card ---------- */

.loc-detail {
  position: absolute; left: 24px; bottom: 24px; z-index: 5;
  width: min(380px, calc(100% - 48px));
  background: var(--paper); color: var(--ink-text);
  border-radius: 8px; padding: 26px; box-shadow: 0 24px 50px rgba(0,0,0,.45);
  display: flex; flex-direction: column; gap: 14px;
}
.loc-detail:not([hidden]) { animation: card-in .55s var(--ease) both; }
@keyframes card-in { from { opacity: 0; transform: translateY(18px) scale(.98); } }
.loc-detail__top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.detail-city { font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--red-dark); margin-bottom: 4px; }
.detail-name { font-size: 19px; font-weight: 700; line-height: 1.3; font-family: var(--font-body); }
.detail-close {
  width: 36px; height: 36px; flex: none; border-radius: 999px; border: 1px solid #CFCAC0; background: transparent;
  color: var(--ink-text); cursor: pointer; font-size: 18px; line-height: 1; transition: background-color .3s, color .3s;
}
.detail-close:hover { background: var(--ink-text); color: var(--paper); }
.detail-fields { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.detail-row { display: grid; grid-template-columns: 92px 1fr; gap: 12px; font-size: 14px; line-height: 1.5; }
.detail-row dt { color: var(--ink-muted); font-weight: 600; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; padding-top: 2px; }
.detail-row dd { margin: 0; color: #2C2A26; }
.detail-row a { text-decoration: underline; text-underline-offset: 3px; }
.detail-actions { display: flex; gap: 8px; margin-top: 6px; }
.detail-actions .btn { flex: 1; height: 48px; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .locator { flex-direction: column; height: auto; min-height: 0; }
  .loc-panel { flex: none; border-right: 0; display: contents; }
  .loc-panel__head { order: 1; padding: 28px var(--gutter) 18px; }
  .loc-panel__head h1 { font-size: 28px; }
  .loc-map { order: 2; height: 62svh; min-height: 420px; flex: none; }
  .results-meta { order: 3; padding: 14px var(--gutter); }
  .store-list { order: 4; flex: none; overflow: visible; max-height: none; }
  .store-item { padding: 16px var(--gutter); }
  .loc-detail { left: 12px; right: 12px; bottom: 12px; width: auto; padding: 20px; }
  .loc-filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter); }
  .loc-filters::-webkit-scrollbar { display: none; }
  .chip, .loc-select { flex: none; }
}

.loc-filters label { position: relative; flex: none; }
.loc-select { max-width: 210px; text-overflow: ellipsis; }

/* Share-a-city link */
.loc-actions { display: flex; flex-wrap: wrap; gap: 4px 22px; align-items: center; }
.loc-share { color: var(--text); }
.loc-share:hover { color: var(--red); }
.loc-share-status { font-size: 13px; color: #7FD69A; min-height: 0; margin-top: -10px; }
.loc-share-status:empty { display: none; }
