/* ========================================================
   SEARCH PAGE — Horizontal filter bar, results grid, carousel, pagination
   ======================================================== */

/* ===== Layout ===== */
.search-container {
  max-width: 1400px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 1rem;
  padding: 1.5rem 2rem 2rem;
  position: relative; z-index: 1;
}

/* ===== Search Bar ===== */
.search-bar-wrap { width: 100%; }
.search-bar {
  position: relative; display: flex; align-items: center;
  background: var(--bg-glass); backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-glass); border-radius: var(--radius);
  padding: 0 1.25rem; transition: border-color 0.3s, box-shadow 0.3s;
}
.search-bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow), var(--glass-shadow);
}
.search-bar-icon { flex-shrink: 0; color: var(--text-muted); transition: color 0.3s; }
.search-bar:focus-within .search-bar-icon { color: var(--primary-light); }
.search-bar-input {
  flex: 1; padding: 0.85rem 0.75rem;
  background: transparent; border: none; outline: none;
  color: var(--text-primary); font-family: inherit; font-size: 0.95rem;
}
.search-bar-input::placeholder { color: var(--text-muted); }
.search-bar-kbd {
  font-family: inherit; font-size: 0.65rem; font-weight: 600;
  color: var(--text-muted); background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-glass); border-radius: 6px;
  padding: 0.2rem 0.5rem; white-space: nowrap; user-select: none;
}

/* ===== Filter Bar (horizontal) ===== */
.filter-bar {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  background: var(--bg-glass); backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-glass); border-radius: var(--radius);
  padding: 0.6rem 1rem; position: relative;
}

/* ---- Rent / Sale toggle ---- */
.filter-toggle {
  position: relative; display: flex;
  background: rgba(255,255,255,0.04); border-radius: 8px;
  border: 1px solid var(--border-glass); overflow: hidden; flex-shrink: 0;
}
.toggle-btn {
  position: relative; z-index: 1; padding: 0.5rem 1rem;
  background: transparent; border: none; cursor: pointer;
  font-family: inherit; font-size: 0.8rem; font-weight: 600;
  color: var(--text-secondary); transition: color 0.3s; white-space: nowrap;
}
.toggle-btn.active { color: #fff; }
.toggle-indicator {
  position: absolute; top: 2px; left: 2px;
  height: calc(100% - 4px); width: calc(50% - 2px);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 6px; transition: transform 0.3s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 2px 10px var(--primary-glow);
}
.toggle-indicator.right { transform: translateX(100%); }

/* ---- Pill selects ---- */
.filter-pills {
  display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; flex: 1;
  position: relative;
}
.filter-pill { position: relative; }
.filter-pill select {
  appearance: none; -webkit-appearance: none;
  padding: 0.45rem 2rem 0.45rem 0.85rem;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border-glass);
  border-radius: 20px; color: var(--text-secondary);
  font-family: inherit; font-size: 0.8rem; font-weight: 500;
  cursor: pointer; transition: all 0.3s; white-space: nowrap;
}
.filter-pill select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.filter-pill select option { background: var(--bg-surface); color: var(--text-primary); }
.filter-pill::after {
  content: ''; position: absolute; right: 0.7rem; top: 50%; transform: translateY(-50%);
  width: 0; height: 0;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid var(--text-muted); pointer-events: none;
}

/* ---- Pill buttons (dropdown triggers) ---- */
.filter-pill-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.45rem 0.85rem; background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-glass); border-radius: 20px;
  color: var(--text-secondary); font-family: inherit;
  font-size: 0.8rem; font-weight: 500; cursor: pointer;
  transition: all 0.3s; white-space: nowrap;
}
.filter-pill-btn:hover {
  background: rgba(255,255,255,0.07); border-color: var(--border-glass-hover);
}
.filter-pill-btn.open {
  border-color: var(--primary); color: var(--primary-light);
  background: rgba(124,58,237,0.1);
}
.filter-pill-btn.has-value {
  border-color: var(--primary); color: var(--primary-light);
  background: rgba(124,58,237,0.12);
}
.filter-pill-btn svg {
  transition: transform 0.3s;
}
.filter-pill-btn.open svg { transform: rotate(180deg); }

/* ---- Dropdown panels ---- */
.filter-dropdown {
  position: absolute; top: calc(100% + 0.5rem); left: 0;
  min-width: 260px; padding: 1rem;
  background: var(--bg-glass-heavy); backdrop-filter: var(--glass-blur-heavy);
  -webkit-backdrop-filter: var(--glass-blur-heavy);
  border: 1px solid var(--border-glass-hover); border-radius: var(--radius);
  box-shadow: var(--glass-shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: all 0.25s cubic-bezier(.4,0,.2,1); z-index: 100;
}
.filter-dropdown.open {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.filter-dropdown label {
  display: block; font-size: 0.7rem; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 0.5rem;
}
.filter-dropdown-row {
  display: flex; align-items: center; gap: 0.5rem;
}
.filter-dropdown-row input {
  flex: 1; padding: 0.55rem 0.7rem;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border-glass);
  border-radius: 8px; color: var(--text-primary);
  font-family: inherit; font-size: 0.85rem; transition: all 0.3s;
}
.filter-dropdown-row input::placeholder { color: var(--text-muted); }
.filter-dropdown-row input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.filter-dropdown-sep { color: var(--text-muted); font-weight: 300; }

/* ---- Chips ---- */
.chip-group { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  padding: 0.4rem 0.75rem; border: 1px solid var(--border-glass);
  border-radius: 20px; background: rgba(255,255,255,0.04);
  color: var(--text-secondary); font-family: inherit;
  font-size: 0.8rem; font-weight: 500; cursor: pointer;
  transition: all 0.25s; white-space: nowrap;
}
.chip:hover {
  background: rgba(255,255,255,0.07); border-color: var(--border-glass-hover);
}
.chip.active {
  border-color: var(--primary); color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 2px 12px var(--primary-glow);
}

/* ---- Clear button ---- */
.filter-clear {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.45rem 0.85rem; background: transparent;
  border: 1px solid transparent; border-radius: 20px;
  color: var(--text-muted); font-family: inherit;
  font-size: 0.8rem; font-weight: 500; cursor: pointer;
  transition: all 0.3s; white-space: nowrap; flex-shrink: 0;
}
.filter-clear:hover {
  color: var(--danger); border-color: rgba(248,113,113,0.2);
  background: rgba(248,113,113,0.08);
}

/* ===== Results ===== */
.results { display: flex; flex-direction: column; gap: 1.5rem; }
.results-header {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-glass); backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-glass);
  padding: 1rem 1.5rem; border-radius: var(--radius);
}
.results-count { font-weight: 600; }
.results-count span {
  background: linear-gradient(135deg, var(--primary-light), var(--secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

.sort-select {
  padding: 0.5rem 1rem; border: 1px solid var(--border-glass);
  border-radius: 10px; font-size: 0.875rem;
  background: rgba(255,255,255,0.04); color: var(--text-primary); font-family: inherit;
}
.sort-select option { background: var(--bg-surface); color: var(--text-primary); }
.sort-select:focus { outline: none; border-color: var(--primary); }

.active-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.filter-tag {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  background: rgba(124, 58, 237, 0.15);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 20px; font-size: 0.75rem; color: var(--primary-light);
}
.filter-tag button {
  background: none; border: none; cursor: pointer;
  color: var(--primary-light); font-size: 1rem; line-height: 1; transition: color 0.2s;
}
.filter-tag button:hover { color: #f87171; }

/* ===== Property Cards (search variant) ===== */
.properties-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem;
}
.property-card {
  background: var(--bg-glass); backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius); overflow: hidden;
  transition: all 0.4s; cursor: pointer; position: relative;
}
.property-card::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  opacity: 0; transition: opacity 0.4s;
}
.property-card:hover::after { opacity: 1; }
.property-card:hover {
  transform: translateY(-6px);
  border-color: var(--border-glass-hover);
  box-shadow: var(--glass-shadow-lg), var(--glass-glow);
}
.property-card-link { text-decoration: none; color: inherit; display: block; }

/* ===== Image Carousel ===== */
.property-carousel {
  width: 100%; height: 200px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.8), rgba(30, 41, 59, 0.6));
}
.carousel-track { display: flex; height: 100%; transition: transform 0.3s ease-out; }
.carousel-slide { min-width: 100%; height: 100%; }
.carousel-slide img { width: 100%; height: 100%; object-fit: cover; }
.carousel-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px;
  background: var(--bg-glass-heavy); backdrop-filter: blur(8px);
  border: 1px solid var(--border-glass); border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: var(--text-primary);
  opacity: 0; transition: all 0.3s; z-index: 2;
}
.property-card:hover .carousel-btn { opacity: 1; }
.carousel-btn:hover { background: rgba(124, 58, 237, 0.3); border-color: var(--primary); }
.carousel-btn.prev { left: 0.5rem; }
.carousel-btn.next { right: 0.5rem; }
.carousel-indicators {
  position: absolute; bottom: 0.75rem; left: 50%;
  transform: translateX(-50%); display: flex; gap: 0.35rem; z-index: 2;
}
.carousel-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,0.3); border: none; cursor: pointer; transition: all 0.2s;
}
.carousel-dot.active {
  background: var(--primary-light); transform: scale(1.3);
  box-shadow: 0 0 8px var(--primary-glow);
}
.carousel-counter {
  position: absolute; bottom: 0.75rem; right: 0.75rem;
  background: var(--bg-glass-heavy); color: var(--text-secondary);
  font-size: 0.7rem; padding: 0.25rem 0.5rem;
  border-radius: 6px; z-index: 2; border: 1px solid var(--border-glass);
}

/* No images */
.no-images {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--text-muted);
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.6), rgba(30, 41, 59, 0.4));
}
.no-images-icon { font-size: 2.5rem; margin-bottom: 0.5rem; opacity: 0.4; }
.no-images-text { font-size: 0.75rem; font-weight: 500; }

/* Favorite button */
.property-favorite {
  position: absolute; top: 0.75rem; right: 0.75rem;
  width: 36px; height: 36px;
  background: var(--bg-glass-heavy); backdrop-filter: blur(8px);
  border: 1px solid var(--border-glass); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 3; transition: all 0.3s;
  font-size: 1rem; color: var(--text-secondary);
}
.property-favorite:hover {
  transform: scale(1.1); border-color: var(--border-glass-hover);
  background: rgba(124, 58, 237, 0.2);
}
.property-favorite.active {
  color: #f87171; border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.1);
}

/* Property type badges */
.property-badge {
  display: inline-block; padding: 0.3rem 0.7rem; border-radius: 6px;
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 0.5rem;
}
.badge-apartment { background: rgba(96,165,250,0.15); color: #93c5fd; border: 1px solid rgba(96,165,250,0.2); }
.badge-house { background: rgba(52,211,153,0.15); color: #6ee7b7; border: 1px solid rgba(52,211,153,0.2); }
.badge-office { background: rgba(192,132,252,0.15); color: #d8b4fe; border: 1px solid rgba(192,132,252,0.2); }
.badge-land { background: rgba(251,191,36,0.15); color: #fcd34d; border: 1px solid rgba(251,191,36,0.2); }
.badge-rent { background: rgba(52,211,153,0.15); color: #6ee7b7; border: 1px solid rgba(52,211,153,0.2); }
.badge-sale { background: rgba(124,58,237,0.15); color: var(--primary-light); border: 1px solid rgba(124,58,237,0.2); }

/* Property content */
.property-content { padding: 1rem 1.25rem 1.25rem; }
.property-price {
  font-size: 1.35rem; font-weight: 800;
  background: linear-gradient(135deg, var(--primary-light), var(--secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: 0.5rem;
}
.property-price span { font-size: 0.8rem; font-weight: 400; -webkit-text-fill-color: var(--text-muted); }
.property-promo {
  display: inline-block;
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: white; font-size: 0.65rem; font-weight: 700;
  padding: 0.3rem 0.6rem; border-radius: 6px;
  margin-bottom: 0.75rem; text-transform: uppercase;
}
.property-title { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.25rem; line-height: 1.3; }
.property-location { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.property-features {
  display: flex; gap: 1rem; padding-top: 1rem;
  border-top: 1px solid var(--border-glass);
}
.feature { display: flex; align-items: center; gap: 0.25rem; font-size: 0.85rem; color: var(--text-secondary); }

/* ===== Pagination ===== */
.pagination { display: flex; justify-content: center; gap: 0.5rem; margin-top: 2rem; }
.pagination button {
  padding: 0.6rem 1.1rem; border: 1px solid var(--border-glass);
  border-radius: 10px; background: var(--bg-glass); backdrop-filter: blur(8px);
  cursor: pointer; font-weight: 500; color: var(--text-secondary);
  transition: all 0.3s; font-family: inherit;
}
.pagination button:hover {
  border-color: var(--border-glass-hover);
  background: rgba(124, 58, 237, 0.1); color: var(--primary-light);
}
.pagination button.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; border-color: var(--primary);
  box-shadow: 0 4px 15px var(--primary-glow);
}
.pagination button:disabled { opacity: 0.3; cursor: not-allowed; }

/* ===== No Results ===== */
.no-results {
  text-align: center; padding: 4rem 2rem;
  background: var(--bg-glass); backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-glass); border-radius: var(--radius);
}
.no-results h3 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.no-results p { color: var(--text-muted); margin-bottom: 1.5rem; }

/* ===== Auth State ===== */
.guest-only, .auth-only { display: none; }
body.is-guest .guest-only { display: flex; }
body.is-authenticated .auth-only { display: flex; }

/* ===== Loading ===== */
.loading {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 3rem;
  color: var(--text-muted); gap: 1rem;
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border-glass);
  border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .search-container { padding: 1rem; }
  .filter-bar { gap: 0.4rem; }
  .filter-dropdown { min-width: 220px; }
}
@media (max-width: 768px) {
  .search-container { padding: 0.75rem; }
  .filter-bar { padding: 0.5rem 0.6rem; }
  .filter-toggle { width: 100%; }
  .toggle-btn { flex: 1; text-align: center; }
  .filter-pills { width: 100%; }
  .filter-pill { flex: 1; }
  .filter-pill select { width: 100%; }
  .properties-grid { grid-template-columns: 1fr; }
  .results-header { flex-direction: column; gap: 0.5rem; align-items: stretch; }
  .search-bar-kbd { display: none; }
}
@media (max-width: 480px) {
  .filter-pill-btn { font-size: 0.75rem; padding: 0.4rem 0.65rem; }
  .chip { font-size: 0.75rem; padding: 0.35rem 0.6rem; }
}
