/* ==========================================
   Golf House - Buy / Resale Marketplace
   ========================================== */

/* ---- Layout ---- */
.buy-layout {
  display: flex;
  min-height: 100vh;
  padding-top: 80px;
  gap: 0;
  background: var(--dark-900);
}

/* ---- Filters Sidebar ---- */
.filters-sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--dark-800);
  border-left: 1px solid var(--dark-600);
  padding: 1.5rem;
  overflow-y: auto;
  height: calc(100vh - 80px);
  position: sticky;
  top: 80px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--dark-500) transparent;
}

.filters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.filters-header h2 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--white);
}

.filters-header button {
  background: none;
  border: none;
  color: var(--dark-300);
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  transition: all 0.3s;
}

.filters-header button:hover {
  color: var(--gold);
  background: rgba(212, 175, 55, 0.1);
}

/* Filter Card */
.filter-card {
  background: var(--dark-700);
  border: 1px solid var(--dark-500);
  border-radius: 16px;
  overflow: hidden;
  flex-shrink: 0;
}

.filter-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.filter-card-header:hover {
  background: rgba(255,255,255,0.02);
}

.filter-card-header h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-card-header h3 svg {
  width: 16px;
  height: 16px;
  color: var(--gold);
}

.filter-card-header .toggle-icon {
  width: 16px;
  height: 16px;
  color: var(--dark-300);
  transition: transform 0.3s;
}

.filter-card.collapsed .toggle-icon {
  transform: rotate(180deg);
}

.filter-card-body {
  padding: 0 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: all 0.3s;
}

.filter-card.collapsed .filter-card-body {
  display: none !important;
}

/* Price Range Options */
.price-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.8rem;
  color: var(--dark-200);
}

.price-option:hover {
  background: rgba(212, 175, 55, 0.08);
}

.price-option.active {
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold);
  font-weight: 700;
}

.price-option .count {
  font-size: 0.7rem;
  color: var(--dark-400);
  background: var(--dark-600);
  padding: 2px 8px;
  border-radius: 6px;
}

.price-option.active .count {
  background: rgba(212, 175, 55, 0.2);
  color: var(--gold);
}

/* Range Slider */
.range-slider-container {
  padding: 0.5rem 0;
}

.range-values {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 0.75rem;
  direction: ltr;
}

.range-track {
  position: relative;
  height: 6px;
  background: var(--dark-500);
  border-radius: 3px;
  margin: 0 0 1rem;
  direction: ltr;
}

.range-fill {
  position: absolute;
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold-light));
  border-radius: 3px;
  left: 0%;
  right: 0%;
}

.range-track input[type="range"] {
  position: absolute;
  width: 100%;
  height: 6px;
  top: -2px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  pointer-events: none;
  z-index: 2;
}

.range-track input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gold);
  border: 3px solid var(--dark-800);
  cursor: pointer;
  pointer-events: all;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.4);
}

.range-track input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gold);
  border: 3px solid var(--dark-800);
  cursor: pointer;
  pointer-events: all;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.4);
}

/* Checkbox/Radio Items */
.filter-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.82rem;
  color: var(--dark-200);
}

.filter-option:hover {
  background: rgba(255,255,255,0.03);
  color: var(--white);
}

.filter-option.active {
  color: var(--gold);
}

.filter-checkbox {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 2px solid var(--dark-400);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.filter-option.active .filter-checkbox {
  background: var(--gold);
  border-color: var(--gold);
}

.filter-checkbox svg {
  width: 12px;
  height: 12px;
  color: var(--dark-900);
  opacity: 0;
}

.filter-option.active .filter-checkbox svg {
  opacity: 1;
}

/* Reset Button */
.reset-filters-btn {
  width: 100%;
  padding: 0.75rem;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold), var(--gold-light));
  color: var(--dark-900);
  font-weight: 800;
  font-size: 0.85rem;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s;
  font-family: 'Tajawal', sans-serif;
  margin-top: auto;
}

.reset-filters-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(212, 175, 55, 0.3);
}

/* ---- Main Content ---- */
.buy-main {
  flex: 1;
  padding: 1.5rem 2rem 3rem;
  overflow-y: auto;
}

.buy-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.prop-broker-info .label {
  font-size: 0.75rem;
  color: var(--white) !important;
  margin-bottom: 0.1rem;
}

.prop-broker-info .name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--white) !important;
}

.results-info h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--white);
}

.results-info h1 span {
  color: var(--dark-200);
  font-weight: 500;
  font-size: 1.1rem;
  margin-right: 0.5rem;
  transition: color 0.3s;
}

.buy-tabs {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--dark-700);
  border-radius: 12px;
  padding: 4px;
}

.buy-tab {
  padding: 0.45rem 1rem;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--dark-300);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  background: none;
  font-family: 'Tajawal', sans-serif;
}

.buy-tab:hover {
  color: var(--white);
}

.buy-tab.active {
  background: var(--gold);
  color: var(--dark-900);
  font-weight: 700;
}

/* Search Bar */
.buy-search {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--dark-700);
  border: 1px solid var(--dark-500);
  border-radius: 14px;
  padding: 0.5rem 1rem;
  width: 320px;
  transition: border-color 0.3s;
}

.buy-search:focus-within {
  border-color: var(--gold);
}

.buy-search svg {
  width: 18px;
  height: 18px;
  color: var(--dark-400);
  flex-shrink: 0;
}

.buy-search input {
  flex: 1;
  background: none;
  border: none;
  color: var(--white);
  font-size: 0.85rem;
  font-family: 'Tajawal', sans-serif;
  outline: none;
}

.buy-search input::placeholder {
  color: var(--dark-400);
}

/* ---- Property Grid ---- */
.property-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

/* Property Card */
.prop-card {
  background: var(--dark-700);
  border: 1px solid var(--dark-500);
  border-radius: 20px;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.prop-card:hover {
  transform: translateY(-6px);
  border-color: rgba(212, 175, 55, 0.4);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.prop-card-img {
  position: relative;
  height: 220px;
  overflow: hidden;
}

.prop-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s;
}

.prop-card:hover .prop-card-img img {
  transform: scale(1.06);
}

.prop-card-img .no-img {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--dark-600);
  color: var(--dark-400);
}

.prop-card-img .no-img svg {
  width: 48px;
  height: 48px;
}

.prop-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(10, 10, 10, 0.75);
  backdrop-filter: blur(8px);
  color: var(--white);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

.prop-badge svg {
  width: 12px;
  height: 12px;
}

.prop-actions-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 6px;
}

.prop-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(10, 10, 10, 0.6);
  backdrop-filter: blur(8px);
  border: none;
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.prop-action-btn:hover {
  background: var(--gold);
  color: var(--dark-900);
}

.prop-action-btn.favorited {
  background: #e74c3c;
}

.prop-action-btn svg {
  width: 14px;
  height: 14px;
}

.prop-price-tag {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: var(--gold);
  color: var(--dark-900);
  padding: 0.35rem 0.9rem;
  border-radius: 10px;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.prop-card-body {
  padding: 1.2rem;
}

.prop-card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 0.5rem;
}

.prop-card-location {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--dark-300);
  margin-bottom: 1rem;
}

.prop-card-location svg {
  width: 14px;
  height: 14px;
  color: var(--gold);
}

.prop-card-features {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.prop-feature {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--dark-200);
  background: var(--dark-600);
  padding: 0.3rem 0.65rem;
  border-radius: 8px;
}

.prop-feature svg {
  width: 14px;
  height: 14px;
  color: var(--gold);
}

.prop-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--dark-500);
}

.prop-broker {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.prop-broker img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  object-fit: cover;
}

.prop-broker-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--dark-500);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dark-300);
}

.prop-broker-placeholder svg {
  width: 16px;
  height: 16px;
}

.prop-broker-info {
  font-size: 0.75rem;
}

.prop-broker-info .label {
  color: var(--dark-400);
  font-size: 0.65rem;
}

.prop-broker-info .name {
  color: var(--white);
  font-weight: 600;
}

.prop-details-btn {
  padding: 0.45rem 1rem;
  background: rgba(212, 175, 55, 0.1);
  color: var(--gold);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.3s;
  font-family: 'Tajawal', sans-serif;
  cursor: pointer;
}

.prop-details-btn:hover {
  background: var(--gold);
  color: var(--dark-900);
}

/* Empty State */
.buy-empty {
  text-align: center;
  padding: 5rem 2rem;
  background: var(--dark-800);
  border: 1px dashed var(--dark-500);
  border-radius: 20px;
}

.buy-empty svg {
  width: 64px;
  height: 64px;
  color: var(--dark-400);
  margin-bottom: 1rem;
}

.buy-empty h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 0.5rem;
}

.buy-empty p {
  color: var(--dark-300);
  font-size: 0.95rem;
}

/* Mobile filter toggle */
.mobile-filter-toggle {
  display: none;
  padding: 0.6rem 1.2rem;
  background: var(--dark-700);
  border: 1px solid var(--dark-500);
  color: var(--white);
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.85rem;
  align-items: center;
  gap: 0.5rem;
}

.mobile-filter-toggle svg {
  width: 16px;
  height: 16px;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .property-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .filters-sidebar {
    display: none;
    position: fixed;
    top: 0;
    inset-inline-start: 0;
    width: 300px;
    height: 100vh;
    z-index: 1001;
    padding-top: 2rem;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
  }

  .filters-sidebar.mobile-open {
    display: flex;
  }

  .mobile-filter-toggle {
    display: flex;
  }

  .property-grid {
    grid-template-columns: 1fr;
  }

  .buy-search {
    width: 100%;
  }

  .buy-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .buy-main {
    padding: 1rem;
  }
}

/* Special Boosts Filter Checkboxes */
.boost-filter-label {
  display: block;
  cursor: pointer;
  user-select: none;
}

.hidden-checkbox {
  display: none;
}

.boost-filter-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem;
  border-radius: 10px;
  background: var(--dark-800);
  border: 1px solid var(--dark-600);
  transition: all 0.3s;
}

.boost-filter-label:hover .boost-filter-content {
  border-color: var(--dark-500);
  background: var(--dark-700);
}

.boost-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  opacity: 0.5;
  transition: all 0.3s;
}

.hidden-checkbox:checked + .boost-filter-content {
  border-color: currentColor;
  background: var(--dark-500, oklab(83.641% -0.0129 0.03418)) !important;
}

.hidden-checkbox:checked + .boost-filter-content .boost-dot {
  opacity: 1;
  box-shadow: 0 0 10px currentColor;
}

.boost-red .boost-filter-content { color: #ef4444; }
.boost-red .boost-dot { background: #ef4444; }

.boost-yellow .boost-filter-content { color: #eab308; }
.boost-yellow .boost-dot { background: #eab308; }

.boost-orange .boost-filter-content { color: #f97316; }
.boost-orange .boost-dot { background: #f97316; }

.boost-blue .boost-filter-content { color: #3b82f6; }
.boost-blue .boost-dot { background: #3b82f6; }

.boost-filter-content .label-text {
  color: var(--white);
  font-size: 0.9rem;
  font-weight: 600;
}

/* Ribbons on Property Cards */
.prop-ribbons-container {
  position: absolute;
  top: 15px;
  left: -5px;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  z-index: 5;
}

.prop-ribbon {
  position: relative;
  padding: 0.3rem 0.5rem 0.3rem 1rem;
  color: #fff;
  font-weight: 800;
  font-size: 0.8rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  border-radius: 0 4px 4px 0;
}

.prop-ribbon::before {
  content: '';
  position: absolute;
  left: 0;
  top: 100%;
  border-width: 5px 0 0 5px;
  border-style: solid;
  filter: brightness(0.6);
}

.ribbon-حرق-سعر { background: #ef4444; }
.ribbon-حرق-سعر::before { border-color: #ef4444 transparent transparent transparent; }

.ribbon-وحده-لقطه { background: #eab308; color: #000; }
.ribbon-وحده-لقطه::before { border-color: #eab308 transparent transparent transparent; }

.ribbon-خصم-مطور, .ribbon-خصم-شركه { background: #f97316; }
.ribbon-خصم-مطور::before, .ribbon-خصم-شركه::before { border-color: #f97316 transparent transparent transparent; }

.ribbon-من-تنفيذ-الشركه { background: #3b82f6; }
.ribbon-من-تنفيذ-الشركه::before { border-color: #3b82f6 transparent transparent transparent; }

/* Video Play Overlay on Property Cards */
.prop-video-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  z-index: 2;
  transition: background 0.3s;
}

.prop-video-play-overlay svg {
  color: rgba(255, 255, 255, 0.9);
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
  transition: all 0.3s;
}

.prop-card:hover .prop-video-play-overlay {
  background: rgba(0, 0, 0, 0.15);
}

.prop-card:hover .prop-video-play-overlay svg {
  transform: scale(1.15);
  color: var(--gold);
}

.prop-card-img video {
  transition: transform 0.6s;
}

.prop-card:hover .prop-card-img video {
  transform: scale(1.06);
}

[data-theme="light"] .buy-layout { background: #f5f5f5; }
[data-theme="light"] .filters-sidebar { background: #ffffff; border-left-color: #e0e0e0; }
[data-theme="light"] .filters-header h2, [data-theme="light"] .filter-card-header h3 { color: #111; }
[data-theme="light"] .filter-card { background: #ffffff; border-color: #e0e0e0; box-shadow: 0 4px 15px rgba(0,0,0,0.03); }
[data-theme="light"] .filter-card-header:hover { background: rgba(0,0,0,0.03); }
[data-theme="light"] .filter-option, [data-theme="light"] .price-option { color: #444; }
[data-theme="light"] .filter-option:hover, [data-theme="light"] .price-option:hover { background: rgba(0,0,0,0.03); }
[data-theme="light"] .filter-option.active, [data-theme="light"] .price-option.active { background: rgba(212, 175, 55, 0.1); color: var(--dark-900); }
[data-theme="light"] .price-option .count { background: #f0f0f0; color: #666; }
[data-theme="light"] .results-info h1, [data-theme="light"] #resultsCount { color: #111 !important; }
[data-theme="light"] .buy-search { background: #ffffff; border-color: #e0e0e0; }
[data-theme="light"] .buy-search input { color: #111; }
[data-theme="light"] .buy-search input::placeholder { color: #888; }
[data-theme="light"] .buy-tab { background: #ffffff; color: #444; border-color: #e0e0e0; }
[data-theme="light"] .buy-tab:hover { background: #f5f5f5; }
[data-theme="light"] .buy-tab.active { background: var(--gold); color: #111; border-color: var(--gold); }
[data-theme="light"] .prop-card { background: #ffffff; border-color: #e0e0e0; box-shadow: 0 5px 20px rgba(0,0,0,0.05); }

[data-theme="light"] .prop-badge {
  background: rgba(255, 255, 255, 0.95);
  color: #000;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .prop-badge svg {
  color: #fff;
  filter: drop-shadow(0 0 1px #000);
}

[data-theme="light"] .prop-action-btn { background: rgba(255,255,255,0.9); color: #333; }
[data-theme="light"] .prop-action-btn:hover { background: var(--gold); color: #111; }
[data-theme="light"] .prop-card-title { color: #111; }
[data-theme="light"] .prop-card-location { color: #666; }
[data-theme="light"] .prop-feature { background: #f5f5f5; color: #444; }
[data-theme="light"] .prop-card-footer { border-top-color: #eee; }
[data-theme="light"] .prop-broker-info .label { color: #888; }
[data-theme="light"] .prop-broker-info .name { color: #111; }
[data-theme="light"] .buy-empty { background: #ffffff; border-color: #e0e0e0; }
[data-theme="light"] .buy-empty h2 { color: #111; }
[data-theme="light"] .buy-empty p { color: #666; }
[data-theme="light"] .mobile-filter-toggle { background: #ffffff; color: #111; border-color: #e0e0e0; }