.filter-bar {
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 1000;
    background-color: #fff;
    padding: 0.5rem;
}

#map-canvas {
    height: 100%;
}

.sidebar {
    width: 400px;
    overflow-y: scroll;
}

.content {
    margin-top: 0;
    height: calc(100vh - 176px);
}

/* Mobile layout: horizontal scrollable filter bar */
@media (max-width: 768px) {
  .filter-bar {
    padding: 0.15rem;
  }

  .sidebar {
    width: 100%;
    height: 50vh;
    overflow-y: auto;
  }

  .flex-grow-1 {
    height: 50vh;
  }

  #filter-top-bar {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-behavior: smooth;
    gap: 0.15rem;
    padding-bottom: 0.15rem;
  }

  #filter-top-bar::-webkit-scrollbar {
    display: none;
  }

  .filter-group {
    flex: 0 0 auto;
    width: 100px;
  }

  .filter-group .form-control,
  .filter-group .btn,
  .filter-group .form-select {
    font-size: 0.75rem;
    padding: 0.1rem 0.3rem;
    height: 26px;
  }

  .filter-group .dropdown-menu {
    font-size: 0.75rem;
    overflow-y: auto;
    width: 120px;
  }

  .filter-group .form-check {
    margin-bottom: 0.1rem;
  }

  .filter-group .apply-dropdown {
    font-size: 0.7rem;
    padding: 0.2rem;
  }

  .filter-group .btn-outline-secondary,
  .filter-group .form-select {
    background-color: #fff;
    border-color: #ced4da;
    color: #212529;
  }

  .filter-group .btn-outline-secondary:hover,
  .filter-group .form-select:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
    color: #212529;
  }

  .content {
    margin-top: 0;
  }
}

/* Desktop layout: single row of filters */
.sidebar {
    height: 100%;
}

@media screen and (min-width: 1280px) {
    .sidebar {
        width: 750px;
        flex: 0 0 750px;
    }
}

.flex-grow-1 {
    height: 100%;
}

#filter-top-bar {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    margin: 0 auto;
}

.filter-group {
    flex: 1;
    min-width: 100px;
}

.filter-group .form-control,
.filter-group .btn,
.filter-group .form-select {
    font-size: 15px;
    padding: 0.15rem 0.35rem;
    height: 35px;
    line-height: 15px;
    min-height: auto;
    border-width: 1px;
}

.filter-group .dropdown-menu {
    font-size: 0.8rem;
    overflow-y: auto;
    width: 100%;
}

.filter-group .dropdown-menu.dropdown-lg {
    width: 250px;
}

.filter-group .form-check {
    margin-bottom: 0.15rem;
}

.filter-group .apply-dropdown {
    font-size: 0.75rem;
    padding: 0.25rem;
}

.filter-group .btn-outline-secondary,
.filter-group .form-select {
    background-color: #fff;
    border-color: #ced4da;
    color: #212529;
}

.filter-group .btn-outline-secondary:hover,
.filter-group .form-select:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
    color: #212529;
}

/* Prevent dropdown auto-close */
.dropdown-menu {
    position: absolute !important;
}

#property-list .item, #property-list .item * {
    pointer-events: auto !important;
}

#property-list-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
#property-list-overlay i {
  font-size: 24px;
  color: #333;
}

/* General bubble styling */
.custom-bubble-enhanced {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 11px; /* Fits 20px height */
    font-weight: bold;
    text-align: center;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box;
    width: 40px !important;
    height: 20px !important;
}

.custom-bubble-enhanced div {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden; /* Prevent text clipping */
}

/* Specific marker styling */

.leaflet-marker-icon.custom-bubble-enhanced,
.leaflet-marker-icon.custom-circle-marker {
    background-color: #1a73e8;
}

.leaflet-marker-icon.custom-circle-marker {
    border: 2px solid #ffffff;
    border-radius: 50% !important;
    overflow:hidden;
}

.leaflet-marker-icon.custom-bubble-enhanced {
    font-family: Arial, sans-serif;
    font-size: 11px;
    font-weight: bold;
    text-align: center;
    line-height: 20px; /* Matches 20px height */
    border-radius: 5px; /* Slightly larger for aesthetics */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    margin: 0 !important;
    overflow: visible !important; /* Allow pointer */
    width: 40px !important;
    height: 20px !important; /* Bubble body only */
}

.leaflet-marker-icon.custom-bubble-enhanced::after {
    content: '';
    position: absolute;
    bottom: -5px; /* Position 5px pointer */
    left: 50%;
    transform: translateX(-50%);
    border-left: 5px solid transparent; /* Smaller base */
    border-right: 5px solid transparent;
    border-top: 5px solid #1a73e8; /* 5px pointer */
    z-index: 1; /* Ensure visibility */
}

.custom-bubble-enhanced.custom-bubble-selected {
    background-color: #003087;
    line-height: 20px;
}

.custom-bubble-enhanced.custom-bubble-selected::after {
    border-top: 5px solid #003087;
}

.leaflet-marker-icon.custom-bubble-enhanced.custom-bubble-hover{
    background-color: #ac0000;
}


.leaflet-marker-icon.custom-bubble-enhanced.custom-bubble-hover::after{
    border-top: 5px solid #ac0000;
}

.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.leaflet-popup-content {
    font-family: Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    width: 250px;
    margin: 0;
}

.leaflet-popup-content img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 0;
}

.popup-content .popup-image {
    width: 100%;
    height: 150px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 4px;
    margin-bottom: 8px;
}

.popup-content .popup-data {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.leaflet-popup-content .popup-data {
    margin: 0;
    padding: 10px;
}

.leaflet-popup-tip {
    background-color: #fff;
}

.leaflet-layer img {
    filter: contrast(1.15);
}

#no-listings-message {
    margin: 0 0 1rem 0;
}