/* ==========================================================================
   MAP FILTER & SPLIT VIEW STYLES (property-list-view.html)
   ========================================================================== */

/* --- Split layout container --- */
#standalone-map-section {
    display: none;
    width: 100%;
    margin-top: 18px;
    box-sizing: border-box;
}

#standalone-map-section.active {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 22px;
    width: 100%;
}

/* --- Left Column: Sticky Map Wrapper --- */
#standalone-map-wrapper {
    position: sticky;
    top: 20px;
    flex: 0 0 46%;
    max-width: 46%;
    height: calc(100vh - 160px);
    min-height: 520px;
    max-height: 860px;
    background: #f1f5f9;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.07);
    border: 1px solid #e2e8f0;
    margin: 0;
    box-sizing: border-box;
    z-index: 10;
}

/* Google Map fills wrapper */
#standalone-map {
    width: 100%;
    height: 100%;
    border-radius: 16px;
}

/* --- Right Column: Scrollable Cards Pane --- */
#map-property-cards-col {
    flex: 1 1 54%;
    min-width: 0;
    height: calc(100vh - 160px);
    min-height: 520px;
    max-height: 860px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 6px 24px 2px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

/* Sleek custom scrollbar for right column */
#map-property-cards-col::-webkit-scrollbar {
    width: 6px;
}
#map-property-cards-col::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 8px;
}
#map-property-cards-col::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 8px;
}
#map-property-cards-col::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* --- Results Header in Map View --- */
.map-cards-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2px 14px 2px;
    margin-bottom: 2px;
}

.map-cards-count {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    font-size: 14.5px;
    font-weight: 500;
    color: #475569;
}

.map-cards-count span {
    font-weight: 700;
    color: #0f172a;
}

/* --- Cards Container (2-column responsive grid inside right pane) --- */
#map-property-cards-col .property-cards-container {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 18px !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box;
}

/* --- Individual Property Card in Map View --- */
#map-property-cards-col .property-card {
    background-color: #ffffff;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #eef0f5;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    overflow: hidden;
    position: relative;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease;
    cursor: pointer;
}

#map-property-cards-col .property-card:hover {
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
    border-color: #cbd5e1;
}

/* --- Active/Highlighted Card when Map Marker is Hovered --- */
#map-property-cards-col .property-card.map-card-highlighted {
    border-color: #1a7a7a !important;
    box-shadow: 0 0 0 2px #1a7a7a, 0 8px 24px rgba(26, 122, 122, 0.22) !important;
    transform: translateY(-3px);
}

/* --- Image Slider Container --- */
#map-property-cards-col .image-slider-container {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
    border-radius: 14px 14px 0 0;
    background: #f1f3f7;
}

#map-property-cards-col .image-slider {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#map-property-cards-col .property-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 14px 14px 0 0;
    transition: transform 0.4s ease;
}

#map-property-cards-col .property-card:hover .property-image {
    transform: scale(1.03);
}

/* --- Bottom Gradient Overlay on Image (Price + Specs) --- */
#map-property-cards-col .image-bottom-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px 12px 10px 12px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.65) 45%, rgba(0, 0, 0, 0.92) 100%);
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 4;
    pointer-events: none;
}

#map-property-cards-col .property-price {
    font-size: 16.5px;
    font-weight: 700;
    color: #ffffff;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    letter-spacing: -0.01em;
    line-height: 1.2;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

#map-property-cards-col .prop-area-room {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
    font-size: 11px;
    color: #f8fafc;
    font-weight: 400;
    line-height: 1.3;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
    overflow: hidden;
}

#map-property-cards-col .prop-spec-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    font-size: 11px;
    color: #ffffff;
}

#map-property-cards-col .prop-spec-item i {
    font-size: 10px;
    opacity: 0.95;
}

#map-property-cards-col .prop-spec-divider {
    color: rgba(255, 255, 255, 0.5);
    font-size: 10px;
    margin: 0 1px;
}

/* --- Card Details Section Below Image --- */
#map-property-cards-col .property-details {
    padding: 12px 14px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    background: #ffffff;
    flex: 1;
    justify-content: center;
    box-sizing: border-box;
}

#map-property-cards-col .property-address-main {
    font-size: 13.5px;
    font-weight: 600;
    color: #111827;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

#map-property-cards-col .property-address-sub {
    font-size: 12px;
    font-weight: 400;
    color: #6b7280;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    margin-top: 1px;
}

/* --- Property Status / Type Badge --- */
#map-property-cards-col .prop-status-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: rgba(28, 28, 28, 0.78);
    color: #fff;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 3px 9px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    z-index: 6;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

#map-property-cards-col .prop-status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4caf66;
    display: inline-block;
    flex-shrink: 0;
}

/* --- Slider Navigation Arrows --- */
#map-property-cards-col .slider-prev,
#map-property-cards-col .slider-next {
    position: absolute;
    top: 45%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.88);
    border: none;
    padding: 0;
    cursor: pointer;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    color: #1f2937;
    transition: all 0.2s ease;
    z-index: 5;
    opacity: 0;
}

#map-property-cards-col .property-card:hover .slider-prev,
#map-property-cards-col .property-card:hover .slider-next {
    opacity: 0.9;
}

#map-property-cards-col .slider-prev:hover,
#map-property-cards-col .slider-next:hover {
    background-color: #ffffff;
    color: #000;
    opacity: 1;
    transform: translateY(-50%) scale(1.08);
}

#map-property-cards-col .slider-prev {
    left: 8px;
}

#map-property-cards-col .slider-next {
    right: 8px;
}

/* --- Fullscreen Button on Map --- */
.map-fullscreen-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1000;
    width: 38px;
    height: 38px;
    background: #ffffff;
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s, transform 0.2s;
}

.map-fullscreen-btn:hover {
    background: #f8fafc;
    transform: scale(1.05);
}

/* --- Fullscreen Mode for Map Wrapper --- */
#standalone-map-wrapper.is-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    inset: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    min-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    min-height: 100vh !important;
    flex: none !important;
    border-radius: 0 !important;
    border: none !important;
    margin: 0 !important;
    box-shadow: none !important;
    z-index: 99999 !important;
}

#standalone-map-wrapper.is-fullscreen #standalone-map {
    width: 100% !important;
    height: 100% !important;
    min-width: 100% !important;
    min-height: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
}

body.map-fullscreen-active {
    overflow: hidden !important;
}

/* --- Loading Spinner Overlay --- */
.map-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 900;
}

.map-loading-overlay.visible {
    display: flex;
}

.map-spinner {
    width: 36px;
    height: 36px;
    border: 3.5px solid #e0f2f1;
    border-top: 3.5px solid #1a7a7a;
    border-radius: 50%;
    animation: mapSpin 0.75s linear infinite;
}

@keyframes mapSpin {
    to {
        transform: rotate(360deg);
    }
}

/* --- InfoWindow Chrome Reset --- */
.gm-style .gm-style-iw-c {
    padding: 0 !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2) !important;
    border: none !important;
}

.gm-style .gm-style-iw-d {
    overflow: hidden !important;
    padding: 0 !important;
}

.gm-style .gm-style-iw-tc {
    display: none !important;
}

.gm-style .gm-style-iw button.gm-ui-hover-effect {
    display: none !important;
}

/* --- Empty Cards State --- */
.map-empty-state {
    padding: 48px 24px;
    text-align: center;
    color: #64748b;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border-radius: 14px;
    border: 1px dashed #cbd5e1;
    margin: 12px 0;
}

.map-empty-icon {
    font-size: 32px;
    color: #94a3b8;
    margin-bottom: 12px;
}

.map-empty-state h4 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 6px;
}

.map-empty-state p {
    font-size: 13px;
    color: #64748b;
    max-width: 320px;
    margin: 0 auto;
    line-height: 1.45;
}

/* ==========================================================================
   RESPONSIVENESS BREAKPOINTS
   ========================================================================== */

/* --- Desktop & Laptop (992px to 1279px) --- */
@media (max-width: 1279px) and (min-width: 992px) {
    #standalone-map-wrapper {
        flex: 0 0 45%;
        max-width: 45%;
        height: calc(100vh - 160px);
    }

    #map-property-cards-col {
        flex: 1 1 55%;
        height: calc(100vh - 160px);
    }

    #map-property-cards-col .property-cards-container {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 14px !important;
    }

    #map-property-cards-col .image-slider-container {
        height: 160px;
    }

    #map-property-cards-col .property-price {
        font-size: 15px;
    }

    #map-property-cards-col .property-details {
        padding: 10px 12px 12px 12px;
    }
}

/* --- Tablets & Small Laptops (768px to 991px) --- */
@media (max-width: 991px) and (min-width: 768px) {
    #standalone-map-wrapper {
        flex: 0 0 42%;
        max-width: 42%;
        height: calc(100vh - 150px);
    }

    #map-property-cards-col {
        flex: 1 1 58%;
        height: calc(100vh - 150px);
    }

    #map-property-cards-col .property-cards-container {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }

    #map-property-cards-col .image-slider-container {
        height: 200px;
    }
}

/* --- Mobile Devices (< 768px) --- */
@media (max-width: 767px) {
    #standalone-map-section.active {
        flex-direction: column !important;
        gap: 16px;
    }

    /* Map: Full width on mobile */
    #standalone-map-wrapper {
        position: relative !important;
        top: auto !important;
        flex: none !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 290px !important;
        min-height: 290px !important;
        margin: 0 !important;
        border-radius: 14px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    }

    #standalone-map {
        width: 100% !important;
        height: 290px !important;
        border-radius: 14px;
    }

    /* Cards column: full width, normal scrolling */
    #map-property-cards-col {
        flex: none !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: none !important;
        overflow-y: visible !important;
        padding: 0 !important;
    }

    /* Single column cards on mobile */
    #map-property-cards-col .property-cards-container {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
        padding: 0 !important;
    }

    #map-property-cards-col .image-slider-container {
        height: 210px;
    }

    #map-property-cards-col .property-price {
        font-size: 17px;
    }

    #map-property-cards-col .property-details {
        padding: 12px 14px 14px 14px;
    }

    #map-property-cards-col .property-address-main {
        font-size: 14px;
    }

    #map-property-cards-col .property-address-sub {
        font-size: 12px;
    }

    #map-property-cards-col .prop-area-room {
        font-size: 12px;
    }
}