/* ==========================================================================
   REM OFFPLAN MAP STYLES — 7 Visual Styles for Top-Map Layout
   Applied via class: map-style-{style} on the layout-container
   Works on: [offplan_projects_archive], [rem_properties], 
             [rem_sell_properties], [rem_rental_properties]
   ========================================================================== */

:root {
    --rem-map-accent: #D5B139;
    --rem-map-accent-rgb: 213, 177, 57;
}


/* ==========================================================================
   STYLE 1: DEFAULT — Standard rounded corners (no extra styling needed)
   Class: .map-style-default
   ========================================================================== */
.map-style-default .top-map-wrapper {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 24px;
}

.map-style-default #map-container {
    border-radius: 10px !important;
    overflow: hidden;
}


/* ==========================================================================
   STYLE 2: GLASSMORPHISM — Frosted glass border, glow, floating feel
   Class: .map-style-glassmorphism
   ========================================================================== */
.map-style-glassmorphism .top-map-wrapper {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 24px;
}

.map-style-glassmorphism #map-container {
    border-radius: 20px !important;
    overflow: hidden;
    border: 1.5px solid rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.3) !important;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.15),
        0 0 40px rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.08),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05) !important;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    transition: box-shadow 0.5s ease, border-color 0.5s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1) !important;
    transform: translateY(0);
}

.map-style-glassmorphism #map-container:hover {
    border-color: rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.55) !important;
    box-shadow: 
        0 28px 70px rgba(0, 0, 0, 0.2),
        0 0 55px rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.12),
        inset 0 0 0 1px rgba(255, 255, 255, 0.08) !important;
    transform: translateY(-4px);
}

/* Subtle accent glow ring */
.map-style-glassmorphism .top-map-wrapper::before {
    content: "";
    position: absolute;
    top: -8px;
    left: calc(50% - 200px);
    width: 400px;
    height: 8px;
    background: linear-gradient(90deg, transparent, rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.3), transparent);
    border-radius: 50%;
    filter: blur(10px);
    pointer-events: none;
    z-index: 2;
}

.map-style-glassmorphism .top-map-wrapper {
    position: relative;
}


/* ==========================================================================
   STYLE 3: CINEMATIC — Full-bleed edge-to-edge, dark gradient fade
   Class: .map-style-cinematic
   ========================================================================== */
.map-style-cinematic .top-map-wrapper {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    position: relative;
}

.map-style-cinematic #map-container {
    border-radius: 0 !important;
    border: none !important;
    height: 500px !important;
    margin-bottom: 0 !important;
    box-shadow: none !important;
    position: relative;
}

/* Dark gradient curtain fading into listings below */
.map-style-cinematic .top-map-wrapper::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.5) 50%, rgba(0, 0, 0, 0.85) 100%);
    pointer-events: none;
    z-index: 5;
}

/* Subtle vignette on sides */
.map-style-cinematic .top-map-wrapper::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.15) 0%, transparent 15%, transparent 85%, rgba(0, 0, 0, 0.15) 100%);
    pointer-events: none;
    z-index: 4;
}


/* ==========================================================================
   STYLE 4: FRAMED LUXURY — Elegant accent border, ornamental inset
   Class: .map-style-framed-luxury
   ========================================================================== */
.map-style-framed-luxury .top-map-wrapper {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    padding: 20px 24px;
    position: relative;
}

.map-style-framed-luxury #map-container {
    border-radius: 4px !important;
    overflow: hidden;
    border: 2px solid rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.5) !important;
    box-shadow: 
        0 0 0 8px rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.06),
        0 16px 48px rgba(0, 0, 0, 0.12) !important;
    position: relative;
}

/* Double-frame ornamental border */
.map-style-framed-luxury #map-container::before {
    content: "";
    position: absolute;
    inset: 6px;
    border: 1px solid rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.2);
    border-radius: 2px;
    pointer-events: none;
    z-index: 10;
}

/* Corner ornaments */
.map-style-framed-luxury #map-container::after {
    content: "";
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.7), transparent);
    z-index: 10;
}

/* Top decorative line above frame */
.map-style-framed-luxury .top-map-wrapper::before {
    content: "";
    display: block;
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.7), rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.2));
    margin: 0 auto 16px;
}

.map-style-framed-luxury .top-map-wrapper::after {
    content: "";
    display: block;
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.2), rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.7));
    margin: 16px auto 0;
}


/* ==========================================================================
   STYLE 5: COLLAPSIBLE ACCORDION — Starts collapsed, expand on click
   Class: .map-style-collapsible
   ========================================================================== */
.map-style-collapsible .top-map-wrapper {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 24px;
    position: relative;
}

.map-style-collapsible #map-container {
    border-radius: 14px !important;
    overflow: hidden;
    height: 0 !important;
    min-height: 0 !important;
    margin-bottom: 0 !important;
    border: 1px solid rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.2);
    transition: height 0.6s cubic-bezier(0.16, 1, 0.3, 1), 
                margin-bottom 0.4s ease,
                border-color 0.3s ease !important;
    opacity: 0;
}

.map-style-collapsible #map-container.rem-map-expanded {
    height: 400px !important;
    margin-bottom: 20px !important;
    opacity: 1;
    border-color: rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.35);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
}

/* Toggle bar button */
.rem-map-toggle-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 24px;
    margin-bottom: 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.08), rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.03));
    border: 1px solid rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.25);
    color: var(--rem-map-accent, #D5B139);
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.rem-map-toggle-bar:hover {
    background: linear-gradient(135deg, rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.15), rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.05));
    border-color: rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.45);
    box-shadow: 0 4px 16px rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.1);
}

/* Globe icon */
.rem-map-toggle-bar .rem-toggle-icon {
    flex-shrink: 0;
    opacity: 0.85;
    transition: opacity 0.3s ease, transform 0.4s ease;
}

.rem-map-toggle-bar:hover .rem-toggle-icon {
    opacity: 1;
    transform: rotate(15deg);
}

.rem-map-toggle-bar.is-expanded .rem-toggle-icon {
    opacity: 1;
    transform: rotate(360deg);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Chevron arrow */
.rem-map-toggle-bar .rem-toggle-chevron {
    flex-shrink: 0;
    transition: transform 0.35s ease;
}

.rem-map-toggle-bar.is-expanded .rem-toggle-chevron {
    transform: rotate(180deg);
}

/* Text label */
.rem-map-toggle-bar .rem-toggle-text {
    transition: opacity 0.2s ease;
}


/* ==========================================================================
   CUSTOM MAP PINS — Teardrop SVG markers (primary color driven)
   ========================================================================== */

/* Remove Leaflet's default divIcon background */
.rem-custom-pin {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
}

/* Pin SVG styling & smooth hover */
.rem-custom-pin svg {
    display: block;
    transform-origin: bottom center;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.28));
    cursor: pointer;
}

/* Hover: pin pops up above adjacent pins without shifting Leaflet coordinates */
.rem-custom-pin:hover {
    z-index: 99999 !important;
}

.rem-custom-pin:hover svg {
    transform: scale(1.35);
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45));
}

/* ==========================================================================
   POPUP STYLING — Premium popups for all map styles
   ========================================================================== */

.leaflet-popup-content-wrapper {
    border-radius: 10px !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18) !important;
    padding: 0 !important;
    overflow: hidden;
}

.leaflet-popup-content {
    margin: 0 !important;
    min-width: 200px;
}

.leaflet-popup-content img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 10px 10px 0 0;
}

.leaflet-popup-content div[style*="font-weight: 600"] {
    padding: 10px 14px 4px;
    font-size: 14px;
}

.leaflet-popup-content div[style*="color: #555"] {
    padding: 0 14px 10px;
    font-size: 12px;
}

.leaflet-popup-tip {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12) !important;
}


/* ==========================================================================
   STYLE 6: FULL WIDTH DARK — 100vw dark-themed, no padding
   Class: .map-style-full-bleed-dark
   ========================================================================== */
.map-style-full-bleed-dark .top-map-wrapper {
    max-width: 100vw !important;
    width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    padding: 0 !important;
    position: relative;
    background: #0a0e14;
}

.map-style-full-bleed-dark #map-container {
    border-radius: 0 !important;
    border: none !important;
    height: 450px !important;
    margin-bottom: 0 !important;
    box-shadow: none !important;
}

/* Dark frame top & bottom bars */
.map-style-full-bleed-dark .top-map-wrapper::before {
    content: "";
    display: block;
    height: 4px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.6) 20%, 
        rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.8) 50%, 
        rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.6) 80%, 
        transparent 100%);
}

.map-style-full-bleed-dark .top-map-wrapper::after {
    content: "";
    display: block;
    height: 3px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.4) 25%, 
        rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.6) 50%, 
        rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.4) 75%, 
        transparent 100%);
    margin-bottom: 24px;
}

/* Dark overlay tint on the map tiles */
.map-style-full-bleed-dark #map-container::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(10, 14, 20, 0.15);
    pointer-events: none;
    z-index: 2;
    mix-blend-mode: multiply;
}

/* Invert Leaflet tiles for dark mode appearance */
.map-style-full-bleed-dark .leaflet-tile-pane {
    filter: brightness(0.7) contrast(1.2) saturate(0.8) !important;
}


/* ==========================================================================
   STYLE 7: FULL WIDTH ACCENT — 100vw with luxury border accent
   Class: .map-style-full-bleed-gold
   ========================================================================== */
.map-style-full-bleed-gold .top-map-wrapper {
    max-width: 100vw !important;
    width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    padding: 0 !important;
    position: relative;
}

.map-style-full-bleed-gold #map-container {
    border-radius: 0 !important;
    height: 450px !important;
    margin-bottom: 0 !important;
    border-top: 3px solid var(--rem-map-accent, #D5B139) !important;
    border-bottom: 3px solid var(--rem-map-accent, #D5B139) !important;
    border-left: none !important;
    border-right: none !important;
    box-shadow: 
        0 -8px 30px rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.08),
        0 8px 30px rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.08) !important;
    transition: box-shadow 0.4s ease !important;
}

.map-style-full-bleed-gold #map-container:hover {
    box-shadow: 
        0 -12px 40px rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.12),
        0 12px 40px rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.12) !important;
}

/* Accent label badge */
.map-style-full-bleed-gold .top-map-wrapper::before {
    content: "EXPLORE LOCATIONS";
    display: flex;
    align-items: center;
    justify-content: center;
    width: max-content;
    margin: 0 auto 0;
    padding: 8px 28px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--rem-map-accent, #D5B139);
    background: linear-gradient(135deg, rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.08), rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.03));
    border: 1px solid rgba(var(--rem-map-accent-rgb, 213, 177, 57), 0.25);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    position: relative;
    z-index: 3;
}

/* Bottom fade gradient into content */
.map-style-full-bleed-gold .top-map-wrapper::after {
    content: "";
    display: block;
    height: 50px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.06), transparent);
    margin-bottom: 20px;
}


/* ==========================================================================
   CLEAN / REMOVE ACCENTS MODE — When admin selects "Remove Accent (None)"
   Class: .rem-map-accent-none
   ========================================================================== */
.rem-map-accent-none .top-map-wrapper::before,
.rem-map-accent-none .top-map-wrapper::after,
.rem-map-accent-none #map-container::before,
.rem-map-accent-none #map-container::after {
    display: none !important;
}

.rem-map-accent-none.map-style-full-bleed-gold #map-container,
.rem-map-accent-none .map-style-full-bleed-gold #map-container,
.rem-map-accent-none.map-style-full-bleed-dark #map-container,
.rem-map-accent-none .map-style-full-bleed-dark #map-container {
    border-top: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
}

.rem-map-accent-none.map-style-glassmorphism #map-container,
.rem-map-accent-none .map-style-glassmorphism #map-container {
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
}

.rem-map-accent-none.map-style-framed-luxury #map-container,
.rem-map-accent-none .map-style-framed-luxury #map-container {
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08) !important;
}

.rem-map-accent-none .rem-map-toggle-bar {
    border-color: rgba(0, 0, 0, 0.15) !important;
    color: inherit !important;
    background: #f8f9fa !important;
}


/* ==========================================================================
   RESPONSIVE — Mobile adaptations for all styles
   ========================================================================== */
@media (max-width: 768px) {
    .map-style-glassmorphism #map-container {
        border-radius: 14px !important;
    }
    
    .map-style-glassmorphism .top-map-wrapper::before {
        display: none;
    }

    .map-style-cinematic #map-container {
        height: 350px !important;
    }

    .map-style-cinematic .top-map-wrapper::after {
        height: 60px;
    }

    .map-style-framed-luxury #map-container::before {
        inset: 4px;
    }

    .map-style-collapsible #map-container.rem-map-expanded {
        height: 300px !important;
    }

    .map-style-full-bleed-dark #map-container,
    .map-style-full-bleed-gold #map-container {
        height: 350px !important;
    }

    .map-style-full-bleed-gold .top-map-wrapper::before {
        font-size: 9px;
        padding: 6px 20px;
    }
}

@media (max-width: 480px) {
    .map-style-cinematic #map-container {
        height: 280px !important;
    }

    .map-style-full-bleed-dark #map-container,
    .map-style-full-bleed-gold #map-container {
        height: 280px !important;
    }

    .map-style-collapsible #map-container.rem-map-expanded {
        height: 250px !important;
    }
}
