/* M. Craig Realty — Map Search Styles */

/* Map Container */
.map-container {
    position: relative;
    width: 100%;
    height: 600px;
    background: var(--gray-900);
    border: 1px solid rgba(212,175,55,0.2);
    display: none;
}
.map-container.active { display: block; }
.list-container.active { display: block; }
.list-container { display: block; }

#searchMap {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* View Toggle */
.view-toggle {
    display: flex;
    border: 1px solid rgba(212,175,55,0.3);
    overflow: hidden;
}
.view-toggle button {
    padding: 0.5rem 1.25rem;
    background: transparent;
    border: none;
    color: var(--gray-400);
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}
.view-toggle button:first-child { border-right: 1px solid rgba(212,175,55,0.3); }
.view-toggle button.active {
    background: var(--gold);
    color: #000;
}
.view-toggle button:hover:not(.active) {
    background: rgba(212,175,55,0.1);
    color: var(--gold);
}
.view-toggle svg { width: 16px; height: 16px; }

/* Map Price Markers */
.price-marker {
    background: var(--gold);
    color: #000;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    border: none;
    text-align: center;
    line-height: 1.2;
    transition: all 0.2s;
}
.price-marker:hover,
.price-marker.active {
    background: #000;
    color: var(--gold);
    transform: scale(1.15);
    z-index: 1000 !important;
}
.price-marker::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--gold);
}
.price-marker:hover::after,
.price-marker.active::after {
    border-top-color: #000;
}

/* Map Popup */
.map-popup {
    width: 280px;
}
.map-popup-card {
    background: var(--gray-900);
    border: none;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
}
.map-popup-card .leaflet-popup-content-wrapper {
    background: var(--gray-900);
    border: 1px solid rgba(212,175,55,0.3);
    border-radius: 0;
    padding: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.map-popup-card .leaflet-popup-content {
    margin: 0;
    width: 280px;
}
.map-popup-card .leaflet-popup-tip {
    background: var(--gray-900);
    border: 1px solid rgba(212,175,55,0.3);
}
.popup-image {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}
.popup-info { padding: 0.75rem; }
.popup-price {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 0.25rem;
}
.popup-address {
    font-size: 0.8125rem;
    color: #fff;
    margin-bottom: 0.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.popup-city {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}
.popup-meta {
    display: flex;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--gray-400);
    border-top: 1px solid rgba(212,175,55,0.15);
    padding-top: 0.5rem;
}
.popup-meta span { color: var(--gold); }
.popup-link {
    display: block;
    text-align: center;
    padding: 0.5rem;
    background: rgba(212,175,55,0.1);
    color: var(--gold);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-decoration: none;
    border-top: 1px solid rgba(212,175,55,0.15);
    transition: background 0.3s;
}
.popup-link:hover { background: rgba(212,175,55,0.2); }

/* Map Controls */
.map-controls {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    right: auto;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.map-control-btn {
    width: 2.5rem;
    height: 2.5rem;
    background: var(--gray-900);
    border: 1px solid rgba(212,175,55,0.3);
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.map-control-btn:hover {
    background: var(--gold);
    color: #000;
}
.map-control-btn.active {
    background: var(--gold);
    color: #000;
}
.map-control-btn svg { width: 18px; height: 18px; }

/* Map Results Count */
.map-results-bar {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: var(--gray-900);
    border: 1px solid rgba(212,175,55,0.3);
    padding: 0.5rem 1.25rem;
    font-size: 0.8125rem;
    color: var(--gray-400);
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.map-results-bar strong { color: var(--gold); }

/* Loading Overlay */
.map-loading {
    position: absolute;
    inset: 0;
    background: rgba(13,13,13,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
}
.map-loading.show { display: flex; }
.map-spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid rgba(212,175,55,0.2);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Mobile Map */
@media (max-width: 767px) {
    .map-container {
        height: calc(100vh - 140px);
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 35;
        border: none;
        border-radius: 0;
    }
    .map-container.active ~ .props-grid {
        display: none;
    }
    .map-controls {
        top: auto;
        bottom: 5rem;
        right: 1rem;
    }
    .map-results-bar {
        bottom: 1rem;
        font-size: 0.75rem;
        padding: 0.375rem 1rem;
    }
    .mobile-map-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 36;
        background: var(--gray-900);
        border-top: 1px solid rgba(212,175,55,0.3);
        max-height: 45vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        display: none;
    }
    .mobile-map-panel.show { display: block; }
    .mobile-map-handle {
        width: 3rem;
        height: 4px;
        background: rgba(212,175,55,0.5);
        margin: 0.75rem auto 0.5rem;
        border-radius: 2px;
    }
    .mobile-map-cards {
        display: flex;
        gap: 1rem;
        padding: 0 1rem 1rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
    }
    .mobile-map-card {
        flex-shrink: 0;
        width: 260px;
        background: var(--black);
        border: 1px solid rgba(212,175,55,0.2);
        overflow: hidden;
        scroll-snap-align: start;
        text-decoration: none;
        color: inherit;
    }
    .mobile-map-card img {
        width: 100%;
        height: 120px;
        object-fit: cover;
    }
    .mobile-map-card-info { padding: 0.75rem; }
    .mobile-map-card-price {
        font-family: 'Playfair Display', Georgia, serif;
        font-size: 1rem;
        font-weight: 700;
        color: var(--gold);
    }
    .mobile-map-card-addr {
        font-size: 0.75rem;
        color: #fff;
        margin-top: 0.125rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .mobile-map-card-meta {
        font-size: 0.6875rem;
        color: var(--gray-500);
        margin-top: 0.25rem;
    }
}

/* Draw Tools */
.draw-tools {
    position: absolute;
    bottom: 7rem;
    left: 1rem;
    z-index: 50;
    display: none;
}
.draw-tools.show { display: flex; gap: 0.375rem; }
.draw-tool-btn {
    width: 2.5rem;
    height: 2.5rem;
    background: var(--gray-900);
    border: 1px solid rgba(212,175,55,0.3);
    color: var(--gray-400);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.draw-tool-btn:hover, .draw-tool-btn.active {
    background: var(--gold);
    color: #000;
    border-color: var(--gold);
}
.draw-tool-btn svg { width: 16px; height: 16px; }

/* Clear Draw Button */
.clear-draw-btn {
    position: absolute;
    bottom: 10.5rem;
    left: 1rem;
    z-index: 50;
    display: none;
    padding: 0.375rem 0.75rem;
    background: #EF4444;
    color: #fff;
    border: none;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.clear-draw-btn.show { display: block; }
