/* ───────── RESET + ROOT ───────── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --accent: #0a4f94;
  --gold: #c39a00;
  --gap: 1rem;
  --card-bg: #ffffff;
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.6;
}

html {
  font-size: 17px;
}

img {
  display: block;
  width: 100%;
  height: auto;
}

/* ───────── GRID / CARDS ───────── */
body {
  padding: var(--gap);
}

.grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(3, 1fr);
  max-width: 960px;
  margin: 0 auto;
}

@media (max-width: 1000px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

.card {
  border: 1px solid #e0e0e0;
  border-radius: 0.5rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s;
  position: relative;
  background: var(--card-bg);
}

.card:hover {
  transform: translateY(-3px);
}

.thumb {
  height: 160px;
  object-fit: cover;
  background: #f5f5f5;
}

.body {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.title {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: var(--accent);
  text-align: center;
}

.cta {
  margin-top: 0.75rem;
  text-align: right;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}

.status-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: capitalize;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  pointer-events: none;
}

/* Property details container */
.property-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 0.75rem;
}

.detail-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

.detail-icon {
  font-size: 0.9rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.detail-text {
  flex: 1;
  color: #666;
  line-height: 1.3;
}

.detail-text.price {
  font-weight: 600;
  color: var(--accent);
}

/* ───────── HEADER ───────── */
.modern-header {
  background: linear-gradient(135deg, #0a4f94 0%, #1e3c72 100%);
  padding: 1.2rem 0;
  box-shadow: 0 4px 20px rgba(10, 79, 148, 0.3);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: #fff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: #0a4f94;
}

.brand-title {
  font-size: 1.65rem;
  font-weight: 700;
  color: #fff;
}

/* ───────── MAP ───────── */
.map-container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

#propertyMap {
  width: 100%;
  height: 500px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  background: #f8f9fa;
  position: relative;
}

/* ───────── MAP MARKERS & CLUSTERS ───────── */
/* Remove white background circle */
.leaflet-marker-icon.marker-cluster {
  background: none !important;
}

.marker-cluster .cluster-inner {
  width: 36px;
  height: 36px;
  line-height: 36px;
  border-radius: 50%;
  color: #fff;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.marker-cluster.cluster-small .cluster-inner {
  background: #0a4f94;
}

.marker-cluster.cluster-medium .cluster-inner {
  background: #c39a00;
}

.marker-cluster.cluster-large .cluster-inner {
  background: #b30000;
}

/* ───────── CUSTOM PIN MARKERS ───────── */
.custom-pin-marker {
  background: transparent !important;
  border: none !important;
}

.custom-pin {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  /* Reduced hover effect */
  transition: transform 0.1s ease;
}

.custom-pin:hover {
  /* Very subtle scale instead of movement */
  transform: scale(1.05);
}

/* ───────── MAP POPUPS ───────── */
.leaflet-popup-content-wrapper {
  border-radius: 8px;
}

.leaflet-popup-content {
  margin: 12px;
}

.property-popup-enhanced {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 320px;
  font-family: system-ui, sans-serif;
}

.popup-main-content {
  display: flex;
  gap: 12px;
}

.popup-thumb {
  flex-shrink: 0;
  width: 140px;
  height: 100px;
  border-radius: 6px;
  overflow: hidden;
  background: #f5f5f5;
}

.popup-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.popup-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.popup-title {
  font-size: 14px;
  margin: 0;
  line-height: 1.3;
  margin-bottom: 4px;
}

.popup-developer,
.popup-location,
.popup-price {
  font-size: 12px;
  font-weight: 600;
  color: #0a4f94;
  margin: 2px 0;
}

.leaflet-popup-content .popup-cta {
  background: var(--accent) !important;
  color: #fff !important;
  font-size: 11px !important;
  padding: 6px 12px !important;
  border-radius: 4px !important;
  text-decoration: none !important;
  display: block !important;
  width: 100%;
  text-align: center;
  box-sizing: border-box;
}

.leaflet-popup-content .popup-cta:hover {
  background: #083d73 !important;
  color: #fff !important;
}

/* ───────── SEARCH / FILTER BAR ───────── */
.controls-container {
  max-width: 960px;
  margin: 1.8rem auto 1.2rem;
  padding: 0 1rem;
}

.controls-bar {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.controls-left {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex: 1;
}

.search-wrapper {
  position: relative;
  flex: 0 1 300px;
}

.search-input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 3rem;
  border: 1px solid #ddd;
  border-radius: 30px;
  font-size: 1rem;
  background: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.25s;
}

.search-input:focus {
  outline: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #666;
  font-size: 1rem;
}

.filter-button {
  background: linear-gradient(135deg, #0a4f94, #1e3c72);
  color: #fff;
  border: none;
  padding: 0.7rem 1.3rem;
  border-radius: 25px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.25s, opacity 0.25s;
}

.filter-button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.filter-button.has-filters {
  background: linear-gradient(135deg, #28a745, #218838);
  font-weight: 600;
}

.prop-counter {
  margin-left: auto;
  white-space: normal;
  max-width: 350px;
  text-align: right;
  font-weight: 600;
  font-size: 0.9rem;
  color: #555;
  padding: 0.5rem;
  background: #f8f9fa;
  border-radius: 6px;
}

/* ───────── FILTER PANEL ───────── */
.filter-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s;
}

.filter-overlay.active {
  opacity: 1;
  visibility: visible;
}

.filter-panel {
  position: fixed;
  top: 0;
  right: -420px;
  width: 420px;
  height: 100vh;
  background: #fff;
  box-shadow: -6px 0 25px rgba(0, 0, 0, 0.1);
  transition: right 0.3s ease;
  overflow-y: auto;
  z-index: 2002;
}

.filter-panel.active {
  right: 0;
}

.filter-header {
  background: linear-gradient(135deg, #0a4f94, #1e3c72);
  color: #fff;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.filter-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.close-filter {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
}

.filter-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  padding: 1rem;
}

.filter-group {
  margin-bottom: 0;
}

.filter-group.full-width {
  grid-column: 1 / -1;
}

.filter-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: #495057;
}

.filter-select,
.filter-input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  font-size: 0.85rem;
}

.filter-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.apply-filters,
.clear-filters {
  flex: 1;
  cursor: pointer;
  transition: opacity 0.25s;
}

.apply-filters {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.85rem;
  border-radius: 8px;
  font-weight: 600;
}

.apply-filters:hover {
  opacity: 0.9;
}

.clear-filters {
  background: #6c757d;
  color: #fff;
  border: none;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
}

.clear-filters:hover {
  opacity: 0.9;
}

/* Filter tags display */
.filter-tags {
  display: none;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #f8f9fa;
  border-radius: 8px;
  margin-top: 0.75rem;
  align-items: center;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 20px;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  color: #495057;
}

.filter-tag span {
  font-weight: 500;
  font-size: 0.75rem;
}

.remove-tag {
  background: none;
  border: none;
  color: #6c757d;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  margin-left: 0.25rem;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.remove-tag:hover {
  opacity: 1;
  color: #dc3545;
}

.clear-all-filters {
  background: #6c757d;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 0.25rem 1rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
}

.clear-all-filters:hover {
  background: #5a6268;
}

/* Empty state */
.empty-state {
  max-width: 400px;
  margin: 3rem auto;
  text-align: center;
  padding: 2rem;
}

.empty-content {
  background: white;
  border-radius: 12px;
  padding: 3rem 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.empty-icon {
  font-size: 3rem;
  margin: 0;
  opacity: 0.5;
}

.empty-state h3 {
  color: var(--accent);
  margin: 1rem 0 0.5rem;
}

.empty-state p {
  color: #666;
  margin: 0;
}

/* ───────── RESPONSIVE ───────── */
@media (max-width: 768px) {
  .controls-bar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .controls-left {
    width: 100%;
  }
  
  .filter-button,
  .prop-counter {
    width: 100%;
    text-align: center;
  }
  
  .filter-content {
    grid-template-columns: 1fr;
  }
  
  .filter-tags {
    gap: 0.4rem;
    padding: 0.5rem;
  }
  
  .filter-tag {
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
  }
  
  .prop-counter {
    text-align: center;
    max-width: 100%;
  }
}