/**
 * IntelliRealty Map View Styles
 * Leaflet.js Integration with Property Cards
 *
 * @package IntelliRealty
 * @version 1.0.0
 */

/* Bricks Shortcode container - ensure it has height */
.brxe-shortcode:has(.ir-map-view-wrapper) {
    height: 100%;
    min-height: 500px;
}

/* Map View Wrapper */
.ir-map-view-wrapper {
    width: 100%;
    height: 100%;
    min-height: 500px;
    position: relative;
}

/* Map Container */
.ir-map-view-container {
    width: 100%;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    background: #f3f4f6;
}

/* Map Element */
.ir-map-view-map {
    width: 100%;
    height: 100%;
    min-height: 500px;
    position: relative;
    z-index: 1;
}

/* Loading State */
.ir-map-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    z-index: 1000;
    gap: 16px;
}

.ir-map-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e5e7eb;
    border-top-color: #0067A5;
    border-radius: 50%;
    animation: ir-map-spin 1s linear infinite;
}

@keyframes ir-map-spin {
    to {
        transform: rotate(360deg);
    }
}

.ir-map-loading span {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

/* Error State */
.ir-map-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 400px;
    color: #ef4444;
    font-size: 16px;
    background: #fef2f2;
    border-radius: 12px;
}

/* Custom Map Markers */
.ir-map-marker {
    background: transparent !important;
    border: none !important;
}

.ir-marker-inner {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0, 103, 165, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    border: 3px solid #0067A5;
}

.ir-marker-inner:hover {
    transform: scale(1.15);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.35);
}

.ir-marker-icon {
    font-size: 16px;
    filter: grayscale(1) brightness(10);
}

/* Marker States */
.ir-marker-visible .ir-marker-inner {
    opacity: 1;
}

.ir-marker-other .ir-marker-inner {
    opacity: 0.5;
    filter: saturate(0.5);
}

/* Approximate Location Markers - dashed border style */
.ir-marker-approximate .ir-marker-inner {
    border: 3px dashed #0067A5 !important;
    border-style: dashed !important;
    background: rgba(255, 255, 255, 0.9) !important;
}

.ir-marker-approximate .ir-marker-icon {
    filter: none;
}

/* Cluster Markers - Heroldo Blue Theme (standard marker-cluster classes) */
.marker-cluster {
    background: #0067A5;
    border-radius: 50%;
    color: white;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 103, 165, 0.4);
    border: 3px solid white;
}

.marker-cluster div {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: 50%;
}

.marker-cluster-small {
    background: #0067A5;
}

.marker-cluster-small div {
    background: rgba(0, 103, 165, 0.6);
}

.marker-cluster-medium {
    background: #005a91;
    box-shadow: 0 4px 15px rgba(0, 103, 165, 0.5);
}

.marker-cluster-medium div {
    background: rgba(0, 90, 145, 0.6);
}

.marker-cluster-large {
    background: #004d7a;
    box-shadow: 0 4px 15px rgba(0, 103, 165, 0.6);
}

.marker-cluster-large div {
    background: rgba(0, 77, 122, 0.6);
}

/* Map Popup Styles - Matching Agent Card Design */
.ir-map-popup .leaflet-popup-content-wrapper {
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    background: #fff;
}

.ir-map-popup .leaflet-popup-content {
    margin: 0;
    width: 280px !important;
    color: #333;
}

.ir-map-popup .leaflet-popup-tip {
    background: white;
}

.ir-map-popup .leaflet-popup-close-button {
    color: rgba(255,255,255,0.8) !important;
    font-size: 20px !important;
    padding: 8px 12px !important;
    top: 0 !important;
    right: 10px !important;
    z-index: 10;
}

.ir-map-popup .leaflet-popup-close-button:hover {
    color: #fff !important;
}

.ir-popup-content {
    font-family: inherit;
}

.ir-popup-image {
    position: relative;
    width: 100%;
    height: 160px;
    overflow: hidden;
    background: linear-gradient(135deg, #0067A5 0%, #005a91 100%);
}

.ir-popup-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ir-popup-type {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 103, 165, 0.9);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(4px);
}

.ir-popup-details {
    padding: 16px;
    background: #fff;
}

.ir-popup-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937 !important;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ir-popup-address {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #666;
}

/* Approximate location notice in popup */
.ir-popup-approximate-notice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    font-size: 11px;
    line-height: 1.4;
    color: #92400e;
}

.ir-popup-approximate-notice svg {
    flex-shrink: 0;
    margin-top: 1px;
    color: #f59e0b;
}

.ir-popup-approximate-notice span {
    flex: 1;
}

.ir-popup-meta {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    padding: 10px 12px;
    background: rgba(0, 103, 165, 0.06);
    border-radius: 8px;
    flex-wrap: wrap;
}

.ir-popup-meta span {
    font-size: 12px;
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ir-popup-structure::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%230067A5"><path d="M7 14c1.66 0 3-1.34 3-3S8.66 8 7 8s-3 1.34-3 3 1.34 3 3 3zm0-4c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zM19 7h-8v7H3V5H1v15h2v-3h18v3h2v-9c0-2.21-1.79-4-4-4zm2 8h-8V9h6c1.1 0 2 .9 2 2v4z"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    flex-shrink: 0;
}

.ir-popup-baths::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%230067A5"><path d="M7 7c0-1.1.9-2 2-2s2 .9 2 2-.9 2-2 2-2-.9-2-2zm11.47 2.47L15 12.93V18H9v-5.07l-3.47-3.46c-.19-.19-.5-.19-.69 0-.19.2-.19.51 0 .71L8 13.35V20h8v-6.65l3.16-3.17c.19-.2.19-.51 0-.71-.19-.19-.5-.19-.69 0zM9 5c0-.55.45-1 1-1h4c.55 0 1 .45 1 1s-.45 1-1 1h-4c-.55 0-1-.45-1-1z"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    flex-shrink: 0;
}

.ir-popup-area::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%230067A5"><path d="M19 12h-2v3h-3v2h5v-5zM7 9h3V7H5v5h2V9zm14-6H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16.01H3V4.99h18v14.02z"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    flex-shrink: 0;
}

.ir-popup-price {
    margin: 0 0 12px 0;
    font-size: 20px;
    font-weight: 700;
    color: #0067A5;
}

.ir-popup-link {
    display: block;
    width: 100%;
    text-align: center;
    background: #0067A5 !important;
    color: #fff !important;
    text-decoration: none !important;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.ir-popup-link:hover {
    color: #fff !important;
    background: #005a91 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 103, 165, 0.3);
}

.ir-popup-link:visited,
.ir-popup-link:active,
.ir-popup-link:focus {
    color: #fff !important;
}

/* Map Legend */
.ir-map-legend {
    background: white;
    padding: 12px 16px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    font-size: 12px;
    line-height: 1.6;
}

.ir-legend-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ir-legend-content p {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ir-legend-title {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px !important;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 6px !important;
}

.ir-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.ir-legend-visible {
    background: #0067A5;
}

.ir-legend-other {
    background: #9ca3af;
}

/* Property Card Highlight */
.ir-card-highlighted {
    outline: 3px solid #0067A5 !important;
    outline-offset: 2px;
    box-shadow: 0 0 20px rgba(0, 103, 165, 0.3) !important;
    transition: outline 0.3s ease, box-shadow 0.3s ease;
}

/* Leaflet Control Overrides */
.ir-map-view-map .leaflet-control-zoom {
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    overflow: hidden;
}

.ir-map-view-map .leaflet-control-zoom a {
    width: 36px;
    height: 36px;
    line-height: 36px;
    font-size: 18px;
    color: #374151;
    background: white;
    border: none !important;
}

.ir-map-view-map .leaflet-control-zoom a:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.ir-map-view-map .leaflet-control-zoom-in {
    border-radius: 8px 8px 0 0;
}

.ir-map-view-map .leaflet-control-zoom-out {
    border-radius: 0 0 8px 8px;
}

/* Attribution Styling */
.ir-map-view-map .leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.8);
    padding: 4px 8px;
    font-size: 10px;
    border-radius: 4px 0 0 0;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .ir-map-view-container {
        border-radius: 8px;
    }

    .ir-map-view-map {
        min-height: 600px;
    }

    .ir-map-popup .leaflet-popup-content {
        width: 260px !important;
    }

    .ir-popup-image {
        height: 120px;
    }

    .ir-popup-title {
        font-size: 14px;
    }

    .ir-popup-price {
        font-size: 16px;
    }

    .ir-map-legend {
        font-size: 11px;
        padding: 10px 12px;
    }

    /* HIDE map wrapper on mobile by default (but keep FAB visible) */
    .ir-map-view-wrapper {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    /* Show map ONLY when activated via FAB button - fullscreen overlay */
    .ir-map-view-wrapper.ir-mobile-active {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        z-index: 999999 !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        animation: irMapSlideUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }

    @keyframes irMapSlideUp {
        from {
            transform: translateY(100%);
            opacity: 0.8;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    .ir-map-view-wrapper.ir-mobile-active .ir-map-view-container {
        width: 100% !important;
        height: calc(100vh - 60px) !important;
        min-height: calc(100vh - 60px) !important;
        max-height: calc(100vh - 60px) !important;
        border-radius: 0 !important;
        margin: 0 !important;
        margin-top: 60px !important;
        padding: 0 !important;
    }

    .ir-map-view-wrapper.ir-mobile-active .ir-map-view-map {
        width: 100% !important;
        height: calc(100vh - 60px) !important;
        min-height: calc(100vh - 60px) !important;
        max-height: calc(100vh - 60px) !important;
    }

    /* Ensure Leaflet container fills the space */
    .ir-map-view-wrapper.ir-mobile-active .leaflet-container {
        width: 100% !important;
        height: 100% !important;
    }

    /* Mobile Map Header */
    .ir-mobile-map-header {
        display: none;
    }

    .ir-map-view-wrapper.ir-mobile-active .ir-mobile-map-header {
        display: flex !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 60px;
        background: linear-gradient(135deg, #0067A5 0%, #005a91 100%);
        align-items: center;
        justify-content: space-between;
        padding: 0 16px;
        z-index: 1000001;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    }

    .ir-mobile-map-header h3 {
        margin: 0;
        color: white;
        font-size: 16px;
        font-weight: 600;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .ir-mobile-map-header h3 svg {
        width: 20px;
        height: 20px;
    }

    .ir-mobile-map-header .ir-mobile-map-close-btn {
        background: rgba(255, 255, 255, 0.15);
        border: none;
        color: white;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background 0.2s ease;
    }

    .ir-mobile-map-header .ir-mobile-map-close-btn:hover {
        background: rgba(255, 255, 255, 0.25);
    }

    .ir-mobile-map-header .ir-mobile-map-close-btn svg {
        width: 24px;
        height: 24px;
    }

    /* Show legend on mobile fullscreen but compact */
    .ir-map-view-wrapper.ir-mobile-active .ir-map-legend {
        display: block !important;
        font-size: 10px;
        padding: 8px 10px;
        max-width: 160px;
    }

    /* Move attribution to not overlap with content */
    .ir-map-view-wrapper.ir-mobile-active .leaflet-control-attribution {
        font-size: 9px;
        max-width: 150px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

@media (max-width: 480px) {
    .ir-map-view-map {
        min-height: 500px;
    }

    .ir-map-popup .leaflet-popup-content {
        width: 240px !important;
    }

    .ir-popup-meta {
        gap: 8px;
    }

    .ir-popup-meta span {
        font-size: 11px;
    }
}

/* Mobile Map Header - hidden by default, shown only in mobile fullscreen */
.ir-mobile-map-header {
    display: none;
}

/* Mobile Floating Map Button */
.ir-mobile-map-fab {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99990;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0067A5 0%, #005a91 100%);
    border: none;
    box-shadow: 0 4px 20px rgba(0, 103, 165, 0.5), 0 0 0 4px rgba(0, 103, 165, 0.2);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.ir-mobile-map-fab:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(0, 103, 165, 0.5);
}

.ir-mobile-map-fab:active {
    transform: scale(0.95);
}

.ir-mobile-map-fab svg {
    width: 28px;
    height: 28px;
    color: white;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.ir-mobile-map-fab .ir-fab-label {
    position: absolute;
    right: 70px;
    background: white;
    color: #1f2937;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateX(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.ir-mobile-map-fab:hover .ir-fab-label {
    opacity: 1;
    transform: translateX(0);
}

/* Mobile Close Button (inside fullscreen map) */
.ir-mobile-map-close {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999999;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: white;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
}

.ir-mobile-map-close svg {
    width: 24px;
    height: 24px;
    color: #374151;
}

.ir-mobile-map-close:hover {
    background: #f3f4f6;
}

/* Show FAB on tablet/mobile (when map sidebar is hidden) */
@media (max-width: 1024px) {
    .ir-mobile-map-fab {
        display: flex;
    }

    .ir-mobile-map-fab.ir-fab-hidden {
        display: none;
    }

    .ir-mobile-map-close.ir-close-visible {
        display: flex;
    }
}

/* Fullscreen Map Option */
.ir-map-view-fullscreen {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    border-radius: 0;
    height: 100vh !important;
}

.ir-map-view-fullscreen .ir-map-view-map {
    height: 100vh;
    min-height: 100vh;
}

/* Fullscreen Toggle Button */
.ir-map-fullscreen-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background: white;
    border: none;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    transition: background 0.2s ease;
}

.ir-map-fullscreen-btn:hover {
    background: #f3f4f6;
}

.ir-map-fullscreen-btn svg {
    width: 20px;
    height: 20px;
    color: #374151;
}

/* Animation for markers appearing */
@keyframes ir-marker-appear {
    from {
        opacity: 0;
        transform: scale(0.5) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.ir-map-marker {
    animation: ir-marker-appear 0.3s ease-out;
}

/* ===========================================
   SPLIT VIEW LAYOUT - Properties + Map
   Structure:
   Section
     └─ Container.ir-property-grid
          ├─ Block (properties - scrollable)
          └─ Block (map - fixed)
   =========================================== */

/* Container with ir-property-grid - this is the flex container */
.ir-property-grid {
    display: flex !important;
    flex-direction: row !important;
    gap: 24px;
    height: 85vh;
    min-height: 600px;
    max-height: 900px;
    overflow: hidden;
}

/* First block - Property list with internal scroll */
.ir-property-grid > .brxe-block:first-child {
    flex: 0 0 45%;
    max-width: 45%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 16px;
    scrollbar-width: thin;
    scrollbar-color: #0067A5 #f1f1f1;
}

/* Custom scrollbar for property list */
.ir-property-grid > .brxe-block:first-child::-webkit-scrollbar {
    width: 6px;
}

.ir-property-grid > .brxe-block:first-child::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.ir-property-grid > .brxe-block:first-child::-webkit-scrollbar-thumb {
    background: #0067A5;
    border-radius: 3px;
}

.ir-property-grid > .brxe-block:first-child::-webkit-scrollbar-thumb:hover {
    background: #005a91;
}

/* Second block - Map column fills remaining space */
.ir-property-grid > .brxe-block:last-child {
    flex: 1;
    height: 100%;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}

/* Map wrapper inside the block */
.ir-property-grid .ir-map-view-wrapper {
    height: 100% !important;
    position: relative !important;
}

.ir-property-grid .ir-map-view-container {
    height: 100% !important;
    min-height: 100% !important;
}

.ir-property-grid .ir-map-view-map {
    height: 100% !important;
    min-height: 100% !important;
}

/* Property cards inside split view */
.ir-property-grid .brxe-post-item {
    margin-bottom: 16px;
}

/* Results count header inside scroll area */
.ir-split-view .ir-results-header {
    position: sticky;
    top: 0;
    background: #fff;
    padding: 12px 0;
    margin-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ir-split-view .ir-results-count {
    font-size: 14px;
    color: #666;
}

.ir-split-view .ir-results-count strong {
    color: #0067A5;
    font-weight: 600;
}

/* Load more button at bottom of list */
.ir-split-view .ir-load-more {
    display: block;
    width: 100%;
    padding: 14px 24px;
    margin-top: 16px;
    background: rgba(0, 103, 165, 0.08);
    border: 1px solid rgba(0, 103, 165, 0.2);
    border-radius: 8px;
    color: #0067A5;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.ir-split-view .ir-load-more:hover {
    background: rgba(0, 103, 165, 0.15);
    border-color: #0067A5;
}

/* Mobile responsive - stack vertically */
@media (max-width: 1024px) {
    .ir-property-grid {
        flex-direction: column !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    .ir-property-grid > .brxe-block:first-child {
        flex: none !important;
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        padding-right: 0 !important;
    }

    /* Hide only the map wrapper, keep FAB visible */
    .ir-property-grid > .brxe-block:last-child {
        display: block !important;
        position: static !important;
        width: auto !important;
        height: auto !important;
        overflow: visible !important;
    }

    /* Hide the map wrapper itself on mobile */
    .ir-property-grid .ir-map-view-wrapper {
        display: none !important;
    }

    /* But show it when activated via FAB button - fullscreen overlay */
    .ir-property-grid .ir-map-view-wrapper.ir-mobile-active,
    .ir-map-view-wrapper.ir-mobile-active {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        z-index: 999999 !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        animation: irMapSlideUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }

    .ir-map-view-wrapper.ir-mobile-active .ir-map-view-container {
        width: 100% !important;
        height: calc(100vh - 60px) !important;
        min-height: calc(100vh - 60px) !important;
        max-height: calc(100vh - 60px) !important;
        border-radius: 0 !important;
        margin: 0 !important;
        margin-top: 60px !important;
        padding: 0 !important;
    }

    .ir-map-view-wrapper.ir-mobile-active .ir-map-view-map {
        width: 100% !important;
        height: calc(100vh - 60px) !important;
        min-height: calc(100vh - 60px) !important;
        max-height: calc(100vh - 60px) !important;
    }

    .ir-map-view-wrapper.ir-mobile-active .ir-mobile-map-header {
        display: flex !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 60px;
        background: linear-gradient(135deg, #0067A5 0%, #005a91 100%);
        align-items: center;
        justify-content: space-between;
        padding: 0 16px;
        z-index: 1000001;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    }

    .ir-map-view-wrapper.ir-mobile-active .ir-mobile-map-header h3 {
        margin: 0;
        color: white;
        font-size: 16px;
        font-weight: 600;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .ir-map-view-wrapper.ir-mobile-active .ir-mobile-map-close-btn {
        background: rgba(255, 255, 255, 0.15);
        border: none;
        color: white;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    @keyframes irMapSlideUp {
        from {
            transform: translateY(100%);
            opacity: 0.8;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
}

/* Legacy split view support */
.ir-split-view-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.ir-split-view-layout .ir-map-view-wrapper {
    position: sticky;
    top: 100px;
}

@media (max-width: 1024px) {
    .ir-split-view-layout {
        grid-template-columns: 1fr;
    }

    .ir-split-view-layout .ir-map-view-wrapper {
        position: relative;
        top: 0;
        order: -1;
        margin-bottom: 24px;
    }
}

/**
 * Bricks Builder Grid Layout - Map Height Sync
 * JavaScript handles dynamic height matching via syncMapHeight()
 * These CSS rules support that and add sticky behavior
 */

/* Make map sticky so it stays visible while scrolling property cards */
#property-query .ir-map-view-wrapper,
.ir-property-grid .ir-map-view-wrapper {
    position: sticky;
    top: 20px;
    align-self: flex-start;
}

/* Responsive - disable sticky on mobile/tablet */
@media (max-width: 1024px) {
    #property-query .ir-map-view-wrapper,
    .ir-property-grid .ir-map-view-wrapper {
        position: relative;
        top: 0;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .ir-map-view-container {
        background: #1f2937;
    }

    .ir-map-loading {
        background: rgba(31, 41, 55, 0.95);
    }

    .ir-map-loading span {
        color: #9ca3af;
    }

    .ir-map-legend {
        background: #374151;
        color: #e5e7eb;
    }

    .ir-legend-title {
        color: #f3f4f6;
        border-bottom-color: #4b5563;
    }

    .ir-map-popup .leaflet-popup-content-wrapper {
        background: #374151;
    }

    .ir-map-popup .leaflet-popup-tip {
        background: #374151;
    }

    .ir-popup-title {
        color: #f3f4f6;
    }

    .ir-popup-address,
    .ir-popup-meta span {
        color: #9ca3af;
    }
}
