/* Muse Marbella — search bar redesign (Drumelia-inspired, Muse brand)
 *
 * Replaces the cramped /properties search with a clean 4x2 grid +
 * spacious chip row in our brand: #002F29 forest, #8FEACC mint,
 * #C9A961 gold, #F5F0E6 cream. Manrope body + Philosopher H1.
 *
 * Layout target (matches Drumelia reference):
 *   ┌─ H1 (Philosopher) "Luxury Properties for Sale in Marbella" ─┐
 *   │  Intro text (Manrope)                                       │
 *   │  Read more ↓                                                │
 *   │  ┌────────────┬────────────┬────────────┬────────────┐      │
 *   │  │ All Areas  │ All Subar. │ All Types  │ Any Beds   │      │
 *   │  ├────────────┼────────────┼────────────┼────────────┤      │
 *   │  │ From Price │ To Price   │ From Size  │ To Size    │      │
 *   │  └────────────┴────────────┴────────────┴────────────┘      │
 *   │  ┌─────────────────────────────────┬─ CLEAR  SEARCH ─┐      │
 *   │  │ Enter ref. number, area...      │                 │      │
 *   │  └─────────────────────────────────┴─────────────────┘      │
 *   │  Detailed search ↓                                          │
 *   │  ◄ [chip] [chip] [chip] [chip] [chip] [chip] [chip] ►       │
 *   └─────────────────────────────────────────────────────────────┘
 *   "769 properties for sale in Marbella"
 */

/* ─── Container ────────────────────────────────────────────────────── */

.muse-search,
.cat-search {
  background: #F5F0E6;
  padding: 2rem;
  border-radius: 12px;
  margin: 2rem 0;
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #002F29;
}

@media (max-width: 768px) {
  .muse-search,
  .cat-search { padding: 1.25rem 1rem; border-radius: 8px; }
}

/* ─── H1 + intro (above the search panel) ──────────────────────────── */

.muse-search-h1,
.properties-page h1.first-screen__title {
  font-family: 'Philosopher', Georgia, serif;
  font-size: clamp(1.75rem, 4vw, 3rem);
  font-weight: 700;
  color: #002F29;
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
  text-transform: none;
}

.muse-search-intro,
.properties-page .first-screen__text {
  font-size: 1.05rem;
  line-height: 1.7;
  color: rgba(0, 47, 41, 0.78);
  max-width: 72ch;
  margin: 0 0 1rem;
}

.muse-search-readmore,
.properties-page #show_cat_desc {
  background: none;
  border: none;
  color: #002F29;
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
  padding: 0;
  margin: 0 0 2rem;
}
.muse-search-readmore:hover {
  color: #044d44;
}

/* ─── Select + input grid (4 cols × 2 rows on desktop) ───────────────── */

.muse-search-grid,
.cat-search .s-search__filter-items-select {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

@media (max-width: 1024px) {
  .muse-search-grid,
  .cat-search .s-search__filter-items-select {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 540px) {
  .muse-search-grid,
  .cat-search .s-search__filter-items-select {
    grid-template-columns: 1fr;
  }
}

/* ─── Form controls (selects + price/size inputs) ──────────────────── */

.cat-search .s-search__filter-item,
.muse-search-cell {
  position: relative;
  background: #fff;
  border: 1px solid rgba(0, 47, 41, 0.12);
  border-radius: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.cat-search .s-search__filter-item:focus-within,
.muse-search-cell:focus-within {
  border-color: #002F29;
  box-shadow: 0 0 0 3px rgba(143, 234, 204, 0.35);
}

.cat-search select,
.cat-search input[type="text"],
.cat-search input[type="number"],
.muse-search-cell select,
.muse-search-cell input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  padding: 0.9rem 2.5rem 0.9rem 1rem;
  font: 600 0.95rem/1.2 'Manrope', sans-serif;
  color: #002F29;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

/* Custom dropdown caret */
.cat-search .s-search__filter-item::after,
.muse-search-cell.has-select::after {
  content: '';
  position: absolute;
  right: 1rem;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid #002F29;
  border-bottom: 2px solid #002F29;
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}
.cat-search input[type="text"] + .s-search__filter-item::after,
.cat-search .s-search__filter-item-input::after {
  display: none;
}

/* Disabled select */
.cat-search select:disabled,
.muse-search-cell select:disabled {
  color: rgba(0, 47, 41, 0.4);
  cursor: not-allowed;
}

/* Ref-number input + CLEAR + SEARCH row */
.cat-search .s-search__filter-item-input,
.muse-search-search-row {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.cat-search .s-search__filter-item-input {
  display: block;
  padding: 0;
}
.cat-search input#searchform-ref {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  font-size: 1rem;
  color: #002F29;
  padding: 1rem 1.25rem;
}
.cat-search input#searchform-ref::placeholder {
  color: rgba(0, 47, 41, 0.45);
}

/* ─── Buttons (CLEAR + SEARCH) ─────────────────────────────────────── */

.cat-search .s-search__filter-btn-wrap,
.muse-search-btn-wrap {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.cat-search-btn-new,
.cat-search .button-grey-1[onclick*="reset"],
.muse-search-btn-clear {
  background: transparent;
  color: #002F29;
  border: 1px solid rgba(0, 47, 41, 0.25);
  padding: 1rem 2rem;
  border-radius: 8px;
  font: 600 0.95rem/1 'Manrope', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.15s ease;
}
.cat-search-btn-new:hover,
.muse-search-btn-clear:hover {
  border-color: #002F29;
  background: rgba(0, 47, 41, 0.04);
}

.cat-search-btn-find,
.muse-search-btn-search {
  background: #002F29;
  color: #8FEACC;
  border: none;
  padding: 1rem 2.5rem;
  border-radius: 8px;
  font: 700 0.95rem/1 'Manrope', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
  flex: 1;
  max-width: 220px;
}
.cat-search-btn-find:hover,
.muse-search-btn-search:hover {
  background: #044d44;
}
.cat-search-btn-find:active,
.muse-search-btn-search:active { transform: translateY(1px); }

.cat-search-btn-find:focus-visible,
.cat-search-btn-new:focus-visible {
  outline: 3px solid #C9A961;
  outline-offset: 2px;
}

/* ─── Detailed search expand toggle ────────────────────────────────── */

.muse-search-detailed-toggle {
  background: none;
  border: none;
  color: rgba(0, 47, 41, 0.7);
  font: 500 0.9rem/1 'Manrope', sans-serif;
  cursor: pointer;
  padding: 0.5rem 0;
  margin: 0.5rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.muse-search-detailed-toggle::after {
  content: '↓';
  display: inline-block;
  transition: transform 0.2s ease;
}
.muse-search-detailed-toggle.is-open::after {
  transform: rotate(180deg);
}

/* ─── Chip row (horizontal scroll, ALL 13 visible by default) ──────── */

.cat-search .s-search__filter-opt-row,
.muse-search-chips {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 0.5rem;
  margin: 1rem 0 0;
  padding: 0.25rem 0 1rem;
}
.cat-search .s-search__filter-opt-row::-webkit-scrollbar,
.muse-search-chips::-webkit-scrollbar { display: none; }

/* Hide the "show more" + button — chips always visible now */
.s-search__filter-opt-show-more,
.cat-search-btn-expand,
.filter-opt-show-more {
  display: none !important;
}

/* Force all chip rows visible (defeats the .hidden / opt-extra classes) */
.s-search__filter-opt-extra,
.s-search__filter-opt-row.hidden,
.s-search__filter-opt-row.d-none {
  display: flex !important;
  visibility: visible !important;
}

/* Individual chip styling */
.cat-search .s-search__filter-opt-item,
.cat-search .s-search__filter-opt-row label,
.muse-search-chip {
  flex: 0 0 auto;
  scroll-snap-align: start;
  background: #fff;
  border: 1px solid rgba(0, 47, 41, 0.18);
  border-radius: 999px;
  padding: 0.65rem 1.25rem;
  font: 600 0.8rem/1 'Manrope', sans-serif;
  color: #002F29;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  user-select: none;
}
.cat-search .s-search__filter-opt-row label:hover,
.muse-search-chip:hover {
  border-color: #002F29;
  background: rgba(143, 234, 204, 0.15);
}

/* Checked chip → solid mint background */
.cat-search .s-search__filter-opt-row label:has(input:checked),
.cat-search .s-search__filter-opt-row label input:checked + .checkbox-mod + span,
.muse-search-chip.is-active {
  background: #8FEACC;
  border-color: #002F29;
  color: #002F29;
}
.cat-search .s-search__filter-opt-row label input:checked ~ * {
  font-weight: 700;
}

/* Hide native checkbox inside chip */
.cat-search .s-search__filter-opt-row input[type="checkbox"],
.cat-search .s-search__filter-opt-row .checkbox-mod {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* ─── Property count + sort header ─────────────────────────────────── */

.muse-search-count,
.properties-page .cat-cat-counter,
.cat-counter-h2 {
  font-family: 'Philosopher', Georgia, serif;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 700;
  color: #002F29;
  margin: 2rem 0 0.5rem;
}

.muse-search-sort-row,
.cat-sort-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font: 500 0.95rem/1 'Manrope', sans-serif;
  color: rgba(0, 47, 41, 0.7);
  margin-bottom: 1.5rem;
}

/* ─── Mobile-first refinements ─────────────────────────────────────── */

@media (max-width: 640px) {
  .cat-search .s-search__filter-btn-wrap,
  .muse-search-btn-wrap {
    flex-direction: column;
  }
  .cat-search-btn-find,
  .cat-search-btn-new,
  .muse-search-btn-search,
  .muse-search-btn-clear {
    width: 100%;
    max-width: none;
  }
}

/* Reduced-motion respect */
@media (prefers-reduced-motion: reduce) {
  .muse-search-chip,
  .cat-search select,
  .cat-search-btn-find,
  .cat-search-btn-new,
  .muse-search-detailed-toggle::after {
    transition: none;
  }
}
