/**
 * OS Property Locator Map Styles
 * OpenStreetMap Integration
 */

/* ============================================
   MAIN CONTAINER
   ============================================ */
.osproperty-locator {
    padding: 20px 0;
}

/* ============================================
   SEARCH CONTROLS
   ============================================ */
.locator-search-controls {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.locator-search-controls .card-body {
    padding: 20px;
}

.locator-search-controls .nav-tabs {
    border-bottom: 2px solid #dee2e6;
}

.locator-search-controls .nav-tabs .nav-link {
    color: #495057;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 10px 20px;
    font-weight: 500;
}

.locator-search-controls .nav-tabs .nav-link:hover {
    border-color: transparent;
    background-color: #f8f9fa;
}

.locator-search-controls .nav-tabs .nav-link.active {
    color: #007bff;
    border-bottom-color: #007bff;
    background-color: transparent;
}

.locator-search-controls .tab-content {
    padding: 20px 0;
}

/* Radius Slider */
#radius-slider {
    margin-top: 10px;
}

.noUi-connect {
    background: #007bff;
}

.noUi-handle {
    border: 2px solid #007bff;
    background: #fff;
}

#radius-display {
    font-weight: bold;
    color: #007bff;
}

/* Drawing Tools */
.drawing-tools-panel {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.drawing-tools-panel .btn-group {
    width: 100%;
}

.drawing-tools-panel .btn {
    flex: 1;
}

/* Filters */
.locator-filter {
    transition: border-color 0.3s;
}

.locator-filter:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

/* ============================================
   MAP CONTAINER
   ============================================ */
.map-container-wrapper {
    position: relative;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#locator-map {
    border-radius: 8px;
    z-index: 1;
}

/* Map Overlay Controls */
.map-overlay-controls {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.95);
    padding: 8px 15px;
    border-radius: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.map-overlay-controls .badge {
    font-size: 13px;
    padding: 6px 12px;
}

/* Map Loading Overlay */
.map-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.map-loading-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* ============================================
   CUSTOM MARKERS
   ============================================ */
.custom-marker {
    background-color: #007bff;
    border: 3px solid #fff;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: bold;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: all 0.3s;
}

.custom-marker:hover {
    transform: scale(1.2);
    z-index: 1000;
}

.custom-marker.marker-featured {
    background-color: #ffc107;
    border-color: #fff;
    animation: pulse 2s infinite;
}

.custom-marker.marker-active {
    background-color: #28a745;
    transform: scale(1.3);
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    }
    50% {
        box-shadow: 0 2px 20px rgba(255,193,7,0.8);
    }
}

/* Marker Cluster */
.marker-cluster-small {
    background-color: rgba(0, 123, 255, 0.6);
}

.marker-cluster-small div {
    background-color: rgba(0, 123, 255, 0.8);
    color: #fff;
    font-weight: bold;
}

.marker-cluster-medium {
    background-color: rgba(255, 193, 7, 0.6);
}

.marker-cluster-medium div {
    background-color: rgba(255, 193, 7, 0.8);
    color: #fff;
    font-weight: bold;
}

.marker-cluster-large {
    background-color: rgba(220, 53, 69, 0.6);
}

.marker-cluster-large div {
    background-color: rgba(220, 53, 69, 0.8);
    color: #fff;
    font-weight: bold;
}

/* ============================================
   PROPERTY POPUP
   ============================================ */
.osproperty-map-popup {
    min-width: 280px;
    max-width: 320px;
}

.osproperty-map-popup .popup-image {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
    border-radius: 6px 6px 0 0;
}

.osproperty-map-popup .popup-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.osproperty-map-popup .badge-featured {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #ffc107;
    color: #000;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: bold;
    border-radius: 3px;
}

.osproperty-map-popup .popup-content {
    padding: 15px;
}

.osproperty-map-popup .popup-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.3;
}

.osproperty-map-popup .popup-title a {
    color: #333;
    text-decoration: none;
}

.osproperty-map-popup .popup-title a:hover {
    color: #007bff;
}

.osproperty-map-popup .popup-price {
    font-size: 18px;
    color: #28a745;
    margin-bottom: 8px;
}

.osproperty-map-popup .popup-address {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
}

.osproperty-map-popup .popup-address i {
    color: #dc3545;
    margin-right: 5px;
}

.osproperty-map-popup .popup-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 13px;
    color: #666;
}

.osproperty-map-popup .popup-meta .meta-item {
    display: flex;
    align-items: center;
}

.osproperty-map-popup .popup-meta i {
    margin-right: 4px;
    color: #007bff;
}

.osproperty-map-popup .popup-distance {
    font-size: 12px;
    color: #17a2b8;
    margin-bottom: 8px;
}

.osproperty-map-popup .popup-distance i {
    margin-right: 5px;
}

.osproperty-map-popup .popup-features {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
}

.osproperty-map-popup .popup-features strong {
    color: #333;
}

.osproperty-map-popup .popup-actions {
    margin-top: 12px;
}

.osproperty-map-popup .popup-actions .btn {
    width: 100%;
    font-size: 13px;
    padding: 8px 15px;
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    padding: 0;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.leaflet-popup-content {
    margin: 0;
    max-width: 320px;
}

.leaflet-popup-tip {
    background: #fff;
}

/* ============================================
   PROPERTIES SIDEBAR
   ============================================ */
.properties-sidebar {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    height: 600px;
    display: flex;
    flex-direction: column;
}

.properties-sidebar .sidebar-header {
    padding: 15px 20px;
    border-bottom: 2px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.properties-sidebar .sidebar-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.properties-sidebar .sort-controls {
    min-width: 180px;
}

.properties-list-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

/* Custom Scrollbar */
.properties-list-scroll::-webkit-scrollbar {
    width: 8px;
}

.properties-list-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.properties-list-scroll::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.properties-list-scroll::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ============================================
   PROPERTY LIST ITEM
   ============================================ */
.property-list-item {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
    transition: all 0.3s;
    cursor: pointer;
}

.property-list-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
    border-color: #007bff;
}

.property-list-item.active {
    border-color: #28a745;
    box-shadow: 0 4px 12px rgba(40,167,69,0.3);
}

.property-list-item .property-item-image {
    position: relative;
    width: 100%;
    height: 150px;
    overflow: hidden;
}

.property-list-item .property-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.property-list-item:hover .property-item-image img {
    transform: scale(1.1);
}

.property-list-item .badge-featured {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 10px;
    padding: 4px 8px;
}

.property-list-item .property-item-content {
    padding: 12px;
}

.property-list-item .property-item-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.3;
}

.property-list-item .property-item-title a {
    color: #333;
    text-decoration: none;
}

.property-list-item .property-item-title a:hover {
    color: #007bff;
}

.property-list-item .property-item-price {
    font-size: 16px;
    color: #28a745;
    font-weight: bold;
    margin-bottom: 6px;
}

.property-list-item .property-item-address {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
}

.property-list-item .property-item-address i {
    color: #dc3545;
    margin-right: 5px;
    margin-top: 2px;
}

.property-list-item .property-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 12px;
    color: #666;
    margin-bottom: 6px;
}

.property-list-item .property-item-meta span {
    display: flex;
    align-items: center;
}

.property-list-item .property-item-meta i {
    margin-right: 4px;
    color: #007bff;
}

.property-list-item .property-item-distance {
    font-size: 11px;
    color: #17a2b8;
    font-weight: 600;
}

.property-list-item .property-item-distance i {
    margin-right: 4px;
}

/* No Properties Message */
.no-properties-message {
    padding: 40px 20px;
}

.no-properties-message i {
    opacity: 0.3;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .locator-map-results .col-md-8,
    .locator-map-results .col-md-4 {
        width: 100%;
    }
    
    .map-container-wrapper {
        margin-bottom: 20px;
    }
    
    #locator-map {
        height: 400px !important;
    }
    
    .properties-sidebar {
        height: auto;
        max-height: 500px;
    }
    
    .map-overlay-controls {
        flex-direction: column;
        gap: 8px;
    }
    
    .locator-search-controls .row > div {
        margin-bottom: 10px;
    }
}

/* ============================================
   LEAFLET DRAW CUSTOMIZATION
   ============================================ */
.leaflet-draw-toolbar a {
    background-color: #007bff !important;
    border-color: #007bff !important;
}

.leaflet-draw-toolbar a:hover {
    background-color: #0056b3 !important;
}

.leaflet-draw-actions a {
    background-color: #fff;
    color: #007bff;
}

.leaflet-draw-actions a:hover {
    background-color: #f8f9fa;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.property-list-item {
    animation: fadeIn 0.3s ease-in-out;
}

/* ============================================
   UTILITIES
   ============================================ */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cursor-pointer {
    cursor: pointer;
}

/* Loading State */
.loading-state {
    opacity: 0.6;
    pointer-events: none;
}

/* Success/Error Messages */
.alert-floating {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    min-width: 300px;
    animation: slideInRight 0.3s ease-in-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================
   USER LOCATION MARKER
   ============================================ */
.user-location-marker {
    z-index: 1000 !important;
}

/* Modal customization for fallback dialogs */
#smartFallbackModal .modal-header,
#progressiveSearchModal .modal-header {
    border-bottom: none;
}

#smartFallbackModal .modal-footer,
#progressiveSearchModal .modal-footer {
    border-top: none;
}

#smartFallbackModal .modal-body p.lead,
#progressiveSearchModal .modal-body p.lead {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

/* Pulsing animation for user location */
@keyframes pulse-user-location {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(0, 123, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 123, 255, 0);
    }
}

.user-location-marker div {
    animation: pulse-user-location 2s infinite;
}
