/* ========================================================
   PROPERTIES PAGE — Sidebar filters + results grid, carousel, pagination
   ======================================================== */

/* ===== Layout ===== */
.properties-page {
  max-width: 1400px; margin: 0 auto;
  padding: 1.5rem 2rem 2rem;
  position: relative; z-index: 1;
}

.properties-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 1.75rem;
  align-items: start;
}

/* ===== Sidebar ===== */
.properties-sidebar {
  position: sticky; top: 90px;
  align-self: start;
  display: flex; flex-direction: column; gap: 1.1rem;
  padding: 1.25rem 1.25rem 1.5rem;
  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);
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}
.properties-sidebar::-webkit-scrollbar { width: 6px; }
.properties-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1); border-radius: 3px;
}

.sidebar-header {
  display: none; /* desktop: no header needed; only used in mobile drawer */
}
.sidebar-close { display: none; }

.sidebar-section { display: flex; flex-direction: column; gap: 0.55rem; }
.sidebar-label {
  font-size: 0.72rem; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.6px;
}

.sidebar-search {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.sidebar-search:hover { border-color: rgba(255, 255, 255, 0.2); }
.sidebar-search:focus-within {
  border-color: rgba(167, 139, 250, 0.55);
  background: rgba(167, 139, 250, 0.06);
}
.sidebar-search-icon { color: var(--text-muted); flex-shrink: 0; }
.sidebar-search input {
  flex: 1; min-width: 0;
  background: transparent; border: 0; outline: 0;
  color: var(--text-primary); font-family: inherit; font-size: 0.9rem;
}
.sidebar-search input::placeholder { color: var(--text-muted); }

/* Rent / Sale toggle (now inside sidebar — full-width) */
.sidebar-toggle {
  position: relative; display: flex;
  background: rgba(255,255,255,0.04); border-radius: 10px;
  border: 1px solid var(--border-glass); overflow: hidden;
  padding: 2px;
}
.toggle-btn {
  position: relative; z-index: 1; flex: 1;
  padding: 0.55rem 0.5rem;
  background: transparent; border: none; cursor: pointer;
  font-family: inherit; font-size: 0.85rem; font-weight: 600;
  color: var(--text-secondary); transition: color 0.3s;
  text-align: center;
}
.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: 8px; transition: transform 0.3s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 2px 10px var(--primary-glow);
}

/* Selects — legacy fallback chrome (EdSelect hides the native <select> and renders
   a custom dropdown via .ed-select). These rules only apply if JS fails to load. */
.sidebar-select-wrap { position: relative; }
.sidebar-select {
  appearance: none; -webkit-appearance: none;
  width: 100%;
  padding: 0.65rem 2.2rem 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 11px;
  color: var(--text-primary); font-family: inherit;
  font-size: 0.88rem; font-weight: 500; cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.sidebar-select:hover { border-color: rgba(255, 255, 255, 0.2); }
.sidebar-select:focus {
  outline: none;
  border-color: rgba(167, 139, 250, 0.55);
  background: rgba(167, 139, 250, 0.06);
}
.sidebar-select option { background: var(--bg-surface); color: var(--text-primary); }
.sidebar-select-wrap::after {
  content: ''; position: absolute; right: 0.85rem; top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0; pointer-events: none;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid var(--text-muted);
}
/* When EdSelect has wrapped the select, neutralize the legacy chrome */
.sidebar-select-wrap:has(.ed-select)::after { display: none; }

/* Range inputs (price, surface) */
.sidebar-range { display: flex; align-items: center; gap: 0.5rem; }
.sidebar-range input {
  flex: 1; min-width: 0;
  padding: 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 11px;
  color: var(--text-primary); font-family: inherit;
  font-size: 0.88rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.sidebar-range input::placeholder { color: var(--text-muted); }
.sidebar-range input:hover { border-color: rgba(255, 255, 255, 0.2); }
.sidebar-range input:focus {
  outline: none;
  border-color: rgba(167, 139, 250, 0.55);
  background: rgba(167, 139, 250, 0.06);
}
.sidebar-range input[type="number"]::-webkit-outer-spin-button,
.sidebar-range input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.sidebar-range input[type="number"] { -moz-appearance: textfield; }
.sidebar-range-sep { color: var(--text-muted); font-weight: 300; }

/* Sidebar footer actions */
.sidebar-actions {
  display: flex; gap: 0.6rem; margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-glass);
}
.sidebar-clear, .sidebar-apply {
  flex: 1; padding: 0.7rem 1rem;
  border-radius: 10px; cursor: pointer;
  font-family: inherit; font-size: 0.85rem; font-weight: 600;
  transition: all 0.2s;
}
.sidebar-clear {
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border-glass);
}
.sidebar-clear:hover {
  color: var(--danger); border-color: rgba(248,113,113,0.3);
  background: rgba(248,113,113,0.08);
}
.sidebar-apply {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; border: 1px solid transparent;
  box-shadow: 0 4px 15px var(--primary-glow);
  display: none; /* visible only on mobile drawer */
}

/* Mobile drawer infrastructure */
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 90;
  background: rgba(8, 11, 22, 0.65); backdrop-filter: blur(4px);
  opacity: 0; transition: opacity 0.25s;
}
.sidebar-backdrop.is-visible { display: block; opacity: 1; }

/* Mobile FAB */
.filters-fab {
  display: none;
  position: fixed; bottom: 1.25rem; left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  align-items: center; gap: 0.5rem;
  padding: 0.7rem 1.2rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; border: 0; border-radius: 999px;
  font-family: inherit; font-size: 0.9rem; font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 30px -8px var(--primary-glow), 0 2px 8px rgba(0,0,0,0.3);
}
.filters-fab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px;
  padding: 0 6px;
  background: rgba(255,255,255,0.25);
  border-radius: 999px;
  font-size: 0.72rem; font-weight: 700;
}

/* ---- Chips ---- */
.chip-group { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.42rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary); font-family: inherit;
  font-size: 0.8rem; font-weight: 500; cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
  white-space: nowrap;
}
.chip__icon { color: var(--text-muted); flex-shrink: 0; transition: color 0.25s ease; }
.chip:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}
.chip:hover .chip__icon { color: var(--text-secondary); }
.chip.active {
  border-color: rgba(167, 139, 250, 0.55);
  color: #fff;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.32), rgba(6, 182, 212, 0.22));
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.18);
}
.chip.active .chip__icon { color: #fff; }

/* ===== Results ===== */
.results { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }
.results-header {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 0.75rem;
  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-tools { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.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 — legacy chrome (EdSelect renders editorial dropdown on top) */
.sort-select {
  padding: 0.55rem 1rem; border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px; font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.04); color: var(--text-primary); font-family: inherit;
  font-weight: 500;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.sort-select option { background: var(--bg-surface); color: var(--text-primary); }
.sort-select:hover { border-color: rgba(255, 255, 255, 0.2); }
.sort-select:focus {
  outline: none;
  border-color: rgba(167, 139, 250, 0.55);
  background: rgba(167, 139, 250, 0.06);
}

.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(260px, 1fr)); gap: 1.25rem;
}
/* Anchor wrapper — keeps the card semantically a real link (right-click,
   open-in-new-tab, prefetch, SEO) instead of a JS-only navigation hack. */
.property-card-link {
  text-decoration: none; color: inherit; display: block;
  outline: none;
}
.property-card-link:focus-visible .property-card {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}
.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;
  height: 100%;
}
.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-link:hover .property-card::after { opacity: 1; }
.property-card-link:hover .property-card {
  transform: translateY(-6px);
  border-color: var(--border-glass-hover);
  box-shadow: var(--glass-shadow-lg), var(--glass-glow);
}

/* ===== 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: 1200px) {
  .properties-layout { grid-template-columns: 260px minmax(0, 1fr); gap: 1.25rem; }
}

@media (max-width: 960px) {
  .properties-page { padding: 1rem; }

  /* Single-column layout; sidebar becomes a slide-in drawer */
  .properties-layout { grid-template-columns: 1fr; }

  .properties-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(360px, 88vw);
    max-height: 100vh;
    border-radius: 0;
    border: 0;
    border-right: 1px solid var(--border-glass);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(.4,0,.2,1);
    z-index: 100;
    background: var(--bg-surface);
    backdrop-filter: none;
    padding: 1rem 1.1rem 1.5rem;
    overflow-y: auto;
  }
  .properties-sidebar.is-open { transform: translateX(0); }

  .sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
    padding-bottom: 0.5rem; margin-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-glass);
  }
  .sidebar-title { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); }
  .sidebar-close {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    background: transparent; border: 0;
    color: var(--text-secondary); font-size: 1.5rem;
    cursor: pointer; border-radius: 8px;
  }
  .sidebar-close:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }
  .sidebar-apply { display: inline-flex; align-items: center; justify-content: center; }

  body.sidebar-open { overflow: hidden; }
  .filters-fab { display: inline-flex; }
}

@media (max-width: 768px) {
  .properties-grid { grid-template-columns: 1fr; }
  .results-header { padding: 0.85rem 1rem; }
}

@media (max-width: 480px) {
  .chip { font-size: 0.78rem; padding: 0.35rem 0.65rem; }
}
