/* =====================================================================
   Mon Salon — p02 Search (/search.html)  ·  builds on /assets/site/ms.css
   Markup: search.html + cards/map rendered by /assets/js/search.js
   Design: SearchPage.dc.html (desktop 1440 list + 40 % sticky map,
   phone 390 list/map toggle).
   ===================================================================== */

.sp { width: 100%; max-width: var(--ms-max); margin-inline: auto; padding-bottom: 8px; }

/* ---------- Top: title, bar, filters, count row ---------- */
.sp-top { display: flex; flex-direction: column; gap: 16px; padding: clamp(24px, 3vw, 40px) var(--ms-gutter-sm) 0; }
.sp-title { margin: 0; font-family: var(--ms-serif); font-weight: 600; font-size: clamp(30px, 3vw, 44px); line-height: 1.1; }

.sp-bar {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 6px;
  background: var(--ms-white); border-radius: 26px; box-shadow: 0 14px 36px -24px rgba(46,58,40,.35);
  position: relative; z-index: 6;
}
.sp-field {
  flex: 2 1 220px; display: flex; align-items: center; gap: 6px; height: 48px; padding: 0 16px 0 6px;
  border-radius: 20px; background: var(--ms-cream); min-width: 0;
}
.sp-field__go {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--ms-cta);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.sp-field__go:hover { background: var(--ms-white); }
.sp-field__input {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
  font: 500 15px var(--ms-sans); color: var(--ms-deep);
}
.sp-field__input::placeholder { color: var(--ms-text-3); }
.sp-field__input::-webkit-search-cancel-button { cursor: pointer; }
.sp-field:focus-within { box-shadow: inset 0 0 0 2px var(--ms-mint); }

/* City / category dropdowns (search.js toggles .open) */
.sp-dd {
  position: relative; flex: 1 1 160px; min-width: 0; display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 14px;
  border-radius: 20px; background: var(--ms-cream); color: var(--ms-deep);
  font: 600 14.5px var(--ms-sans); cursor: pointer; user-select: none;
}
.sp-dd__ico { flex-shrink: 0; color: var(--ms-cta); }
.sp-dd .search-nav-select-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-dd__chev { flex-shrink: 0; transition: transform .2s ease; }
.sp-dd.open .sp-dd__chev { transform: rotate(180deg); }
.sp-dd.open, .sp-dd:hover { background: var(--ms-beige); }
.custom-dropdown {
  display: none; position: absolute; top: 54px; inset-inline-start: 0; z-index: 20;
  min-width: max(100%, 220px); max-height: 300px; overflow-y: auto; padding: 6px;
  background: var(--ms-white); border: 1px solid var(--ms-border); border-radius: 18px;
  box-shadow: 0 20px 44px -18px rgba(46,58,40,.35); cursor: default;
}
.sp-dd.open .custom-dropdown { display: flex; flex-direction: column; }
.custom-dropdown-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px; padding: 8px 12px;
  border-radius: 12px; font: 500 14px var(--ms-sans); color: var(--ms-deep); cursor: pointer; white-space: nowrap;
}
.custom-dropdown-item:hover, .custom-dropdown-item:focus-visible { background: var(--ms-cream); outline: none; }
.custom-dropdown-item.selected { background: var(--ms-beige); font-weight: 700; }
.custom-dropdown-check { color: var(--ms-cta); visibility: hidden; flex-shrink: 0; }
.custom-dropdown-item.selected .custom-dropdown-check { visibility: visible; }

.sp-near {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 14px;
  border-radius: 20px; border: 0; background: var(--ms-mint); color: var(--ms-deep);
  font: 700 13px var(--ms-sans); cursor: pointer; white-space: nowrap;
}
.sp-near:hover { background: #CDE8BF; }
.sp-near.active { background: var(--ms-deep); color: var(--ms-cream); }
.sp-near.is-busy svg { animation: spSpin 1s linear infinite; }
@keyframes spSpin { to { transform: rotate(360deg); } }

.sp-filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.sp-filters::-webkit-scrollbar { display: none; }
.sp-filter {
  flex-shrink: 0; height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--ms-border);
  background: var(--ms-white); color: var(--ms-deep); font: 600 14px var(--ms-sans); cursor: pointer; white-space: nowrap;
}
.sp-filter:hover { border-color: var(--ms-cta); }
.sp-filter.active { background: var(--ms-mint); border-color: var(--ms-mint); }

.sp-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sp-count { font-size: 15px; font-weight: 700; }
.sp-row__end { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; max-width: 100%; }
.sp-sort {
  display: flex; align-items: center; gap: 4px; padding: 4px; max-width: 100%; overflow-x: auto; scrollbar-width: none;
  border-radius: 999px; background: var(--ms-white); border: 1px solid var(--ms-border);
}
.sp-sort::-webkit-scrollbar { display: none; }
.sp-sort__label { font-size: 13px; color: var(--ms-text-3); font-weight: 600; padding: 0 8px; white-space: nowrap; }
.sp-sort .sort-dropdown-item {
  flex-shrink: 0; height: 32px; padding: 0 12px; border-radius: 999px; border: 0; background: transparent; color: var(--ms-deep);
  font: 600 13px var(--ms-sans); cursor: pointer; white-space: nowrap;
}
.sp-sort .sort-dropdown-item:hover { background: var(--ms-cream); }
.sp-sort .sort-dropdown-item.active { background: var(--ms-deep); color: var(--ms-cream); }
.sp-maptoggle {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--ms-border); background: var(--ms-white); color: var(--ms-deep);
  font: 600 13.5px var(--ms-sans); cursor: pointer; white-space: nowrap;
}
.sp-maptoggle svg { color: var(--ms-cta); }
.sp-maptoggle:hover { border-color: var(--ms-cta); }
.sp-view { display: none; padding: 4px; background: var(--ms-white); border: 1px solid var(--ms-border); border-radius: 999px; }
.sp-view__btn {
  height: 34px; padding: 0 14px; border-radius: 999px; border: 0; cursor: pointer; background: transparent; color: var(--ms-deep);
  font: 600 13px var(--ms-sans);
}
.sp-view__btn.active { background: var(--ms-deep); color: var(--ms-cream); }

/* ---------- Main: list + map ---------- */
.sp-main { display: flex; gap: 24px; align-items: flex-start; padding: 20px var(--ms-gutter-sm) 0; }
.sp-list { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.sp-map {
  flex: 0 0 40%; position: sticky; top: 16px; height: min(820px, calc(100vh - 32px)); min-height: 480px;
  border-radius: 28px; overflow: hidden; background: #E9E4D8; isolation: isolate;
}
.sp-main.is-nomap .sp-map { display: none; }
.sp-map__canvas { position: absolute; inset: 0; width: 100%; height: 100%; background: #E9E4D8; }
.sp-map__count {
  position: absolute; top: 14px; inset-inline-start: 14px; z-index: 500; padding: 8px 14px; border-radius: 999px;
  background: var(--ms-white); font-size: 13px; font-weight: 700; box-shadow: 0 8px 18px -10px rgba(46,58,40,.5); pointer-events: none;
}
.sp-map__count:empty { display: none; }
.leaflet-container { font-family: var(--ms-sans); }
.sp-map .leaflet-control-zoom { border: 0; box-shadow: 0 8px 18px -10px rgba(46,58,40,.5); border-radius: 14px; overflow: hidden; }
.sp-map .leaflet-control-zoom a { color: var(--ms-deep); }

/* Rating pins (L.divIcon, iconSize null) */
.sp-pin-wrap { background: none; border: 0; }
.sp-pin {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -100%);
  padding: 7px 12px; border-radius: 999px; background: var(--ms-white); color: var(--ms-deep);
  font: 700 13px var(--ms-sans); white-space: nowrap; box-shadow: 0 8px 18px -8px rgba(46,58,40,.5); cursor: pointer;
}
.sp-pin:hover { background: var(--ms-mint); }
.sp-pin.is-active { background: var(--ms-deep); color: var(--ms-cream); }

/* Bubble card (click on a pin) */
.sp-bubble {
  position: absolute; z-index: 600; inset-inline-start: 14px; bottom: 16px; width: min(360px, calc(100% - 28px));
  display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 22px; background: var(--ms-white);
  box-shadow: 0 18px 40px -16px rgba(46,58,40,.45);
}
.sp-bubble[hidden] { display: none; }
.ms-body a.sp-bubble__link { flex: 1; min-width: 0; display: flex; gap: 12px; align-items: center; color: var(--ms-deep); text-decoration: none; }
.sp-bubble__img { width: 80px; height: 80px; flex-shrink: 0; border-radius: 16px; object-fit: cover; background: var(--ms-beige); display: block; }
.sp-bubble__txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sp-bubble__name { font-family: var(--ms-serif); font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-bubble__city { font-size: 12.5px; color: var(--ms-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-bubble__rating { font-size: 12.5px; }
.ms-body a.sp-bubble__book { flex-shrink: 0; height: 40px; padding: 0 14px; font-size: 13px; }

/* ---------- Cards ---------- */
.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.sp-card {
  display: flex; flex-direction: column; border-radius: 24px; background: var(--ms-white); overflow: hidden; cursor: pointer;
  box-shadow: 0 1px 2px rgba(46,58,40,.04), 0 14px 30px -22px rgba(46,58,40,.35);
  transition: transform .25s ease, box-shadow .25s ease;
}
.sp-card:hover { transform: translateY(-2px); box-shadow: var(--ms-shadow-card); }
.sp-card__media { position: relative; aspect-ratio: 16 / 10; background: var(--ms-beige); }
.sp-card__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-card__img--empty { display: flex; align-items: center; justify-content: center; color: var(--ms-cta); background: var(--ms-beige); }
.sp-card__badges { position: absolute; top: 12px; inset-inline-start: 12px; display: flex; gap: 6px; pointer-events: none; }
.sp-badge { font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; background: var(--ms-white); color: var(--ms-deep); }
.sp-badge--open { background: var(--ms-mint); }
.sp-badge--dark { background: var(--ms-deep); color: var(--ms-cream); }
.sp-card__body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.sp-card__name { margin: 0; font-family: var(--ms-serif); font-size: 20px; font-weight: 600; line-height: 1.25; min-width: 0; }
.ms-body .sp-card__name a { color: var(--ms-deep); text-decoration: none; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-card__rating { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.sp-card__rating span:last-child { color: var(--ms-text-3); }
.sp-star { color: var(--ms-cta); }
.sp-card__place { font-size: 14px; color: var(--ms-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-card__svc {
  display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; padding: 10px 12px; border-radius: 14px;
  background: var(--ms-cream); font-size: 13.5px;
}
.sp-card__svc span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-card__svc b { white-space: nowrap; }
.sp-card__actions { display: flex; gap: 8px; margin-top: auto; padding-top: 6px; }
.sp-btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; height: 42px; padding: 0 12px; border-radius: 999px;
  font: 600 14px var(--ms-sans); text-decoration: none; white-space: nowrap;
}
.ms-body a.sp-btn--ghost { border: 1px solid var(--ms-border); color: var(--ms-deep); background: var(--ms-white); }
.ms-body a.sp-btn--ghost:hover { border-color: var(--ms-cta); color: var(--ms-deep); }
.ms-body a.sp-btn--cta { background: var(--ms-cta); color: #fff; font-weight: 700; }
.ms-body a.sp-btn--cta:hover { background: var(--ms-cta-hover); color: #fff; }

.sp-more {
  align-self: center; height: 50px; padding: 0 28px; border-radius: 999px; border: 1px solid var(--ms-border);
  background: var(--ms-white); color: var(--ms-deep); font: 600 15px var(--ms-sans); cursor: pointer;
}
.sp-more:hover { border-color: var(--ms-cta); }
.sp-more[hidden] { display: none; }

/* Skeleton */
.sp-skel { border-radius: 24px; background: var(--ms-white); overflow: hidden; }
.sp-skel__img { aspect-ratio: 16 / 10; background: #ECE7DD; animation: spPulse 1.4s ease-in-out infinite; }
.sp-skel__body { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.sp-skel__body i, .sp-skel__body b { display: block; height: 12px; border-radius: 8px; background: #ECE7DD; animation: spPulse 1.4s ease-in-out infinite; }
.sp-skel__body i:nth-child(1) { height: 18px; width: 60%; }
.sp-skel__body i:nth-child(2) { width: 40%; animation-delay: .1s; }
.sp-skel__body i:nth-child(3) { width: 75%; animation-delay: .2s; }
.sp-skel__body b { height: 40px; border-radius: 999px; margin-top: 6px; animation-delay: .3s; }
@keyframes spPulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* Empty / error / denied */
.sp-state {
  padding: 56px 24px; border-radius: 28px; background: var(--ms-white);
  display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
}
.sp-state__icon {
  width: 72px; height: 72px; border-radius: 50%; background: var(--ms-beige); color: var(--ms-cta);
  display: flex; align-items: center; justify-content: center; font-family: var(--ms-serif); font-size: 30px;
}
.sp-state__t { margin: 0; font-family: var(--ms-serif); font-size: 26px; font-weight: 600; }
.sp-state__d { margin: 0; font-size: 16px; color: var(--ms-text-2); max-width: 380px; }

/* ---------- Tablet / phone ---------- */
@media (max-width: 1180px) {
  .sp-map { flex-basis: 42%; }
  .sp-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}
@media (max-width: 899px) {
  .sp-maptoggle { display: none; }
  .sp-view { display: flex; }
  .sp-main { display: block; }
  .sp-map { display: none; position: relative; top: auto; height: max(420px, calc(100vh - 200px)); max-height: 660px; }
  .sp-main.is-mapview .sp-list { display: none; }
  .sp-main.is-mapview .sp-map, .sp-main.is-mapview.is-nomap .sp-map { display: block; }
  .sp-bubble { inset-inline-end: 12px; inset-inline-start: 12px; width: auto; bottom: 16px; }
}
@media (max-width: 600px) {
  .sp-dd, .sp-near { flex: 1 1 calc(50% - 3px); }
  .sp-field { flex-basis: 100%; }
  .sp-near { justify-content: center; }
  .sp-row { align-items: flex-start; }
  .sp-row__end { width: 100%; justify-content: space-between; flex-wrap: nowrap; }
  .sp-sort { flex: 1 1 auto; min-width: 0; }
  .sp-view { flex-shrink: 0; }
  .sp-grid { grid-template-columns: 1fr; }
}
