/**
 * Brownstone Projects Map - Custom WPSL Styles
 * Matches the design with category filters and custom info windows
 */

/* ==========================================================================
   Map Container & Layout
   ========================================================================== */

.wpsl-brownstone-projects {
    position: relative;
    width: 100%;
    margin: 0;
    padding: 0;
}

#wpsl-gmap-wrapper {
    position: relative;
    width: 100%;
}

#wpsl-gmap.wpsl-gmap-canvas {
    width: 100%;
    min-height: 600px;
    height: 80vh !important;
}

/* ==========================================================================
   Category Filters - Top Right Overlay
   ========================================================================== */

#wpsl-category-filters {
    position: absolute;
    top: 40px;
    right: 40px;
    z-index: 100;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: nowrap;
    box-sizing: border-box;
}

.wpsl-filter-group {
    display: flex;
    align-items: stretch;
    background: transparent;
    position: relative;
}

.wpsl-filter-group > label {
    display: flex;
    align-items: center;
    background-color: #1a2a3a;
    color: #ffffff;
    font-family: 'Raleway', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 0 15px;
    margin: 0;
    white-space: nowrap;
    text-transform: uppercase;
    line-height: 1;
    height: 42px;
}

/* Hide the native select - we'll use custom dropdown */
.wpsl-custom-dropdown select {
    display: none !important;
}

/* Custom Dropdown Container */
.wpsl-custom-dropdown {
    position: relative;
}

/* Custom Dropdown Trigger Button */
.wpsl-dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #ffffff;
    border: none;
    padding: 8px 15px;
    font-family: 'Raleway', sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: #333333;
    cursor: pointer;
    min-width: 220px;
    min-height: 42px;
    text-transform: uppercase;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    position: relative;
    line-height: 1.3;
    word-break: break-word;
}

.wpsl-dropdown-trigger span {
    flex: 1;
}

.wpsl-dropdown-trigger:hover {
    background-color: #f8f8f8;
}

.wpsl-dropdown-trigger::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #1a2a3a;
    margin-left: 15px;
    transition: transform 0.2s ease;
}

.wpsl-dropdown-trigger.active::after {
    transform: rotate(180deg);
}

/* Custom Dropdown Menu */
.wpsl-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    z-index: 101;
    max-height: 300px;
    overflow-y: auto;
}

.wpsl-dropdown-menu.open {
    display: block;
}

/* Dropdown Options */
.wpsl-dropdown-option {
    display: block;
    padding: 6px 15px;
    font-family: 'Raleway', sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: #333333;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    line-height: 1.4;
}

.wpsl-dropdown-option:hover {
    background-color: #439EFD;
    color: #ffffff;
}

.wpsl-dropdown-option.selected {
    background-color: #439EFD;
    color: #ffffff;
}

/* Hide WPSL's custom dropdown styling if present */
#wpsl-category-filters .wpsl-selected-item,
#wpsl-category-filters .wpsl-dropdown-list,
#wpsl-category-filters .wpsl-selected,
#wpsl-category-filters ul.wpsl-dropdown {
    display: none !important;
}

/* ==========================================================================
   Custom Info Window Popup
   ========================================================================== */

/* Reset all WPSL info window defaults */
.wpsl-info-window,
#wpsl-gmap .wpsl-info-window,
.gm-style .wpsl-info-window {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 600px !important;
    width: 600px !important;
    font-family: 'Raleway', sans-serif !important;
}

/* Force override WPSL default max-width */
#wpsl-gmap .wpsl-info-window {
    max-width: 600px !important;
    width: 600px !important;
}

.wpsl-info-window p,
#wpsl-gmap .wpsl-info-window p {
    margin: 0 !important;
    padding: 0 !important;
}

/* Hide any default WPSL content inside info window */
.wpsl-info-window > p:not(:empty),
.wpsl-info-window span:not([class]) {
    display: none !important;
}

/* Main popup container */
.wpsl-brownstone-popup {
    display: flex !important;
    flex-direction: row !important;
    background: #ffffff !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: hidden !important;
    width: 600px !important;
    max-width: 600px !important;
    min-height: 220px !important;
}

/* Image section - spans top, left, and bottom edges */
.wpsl-brownstone-popup-image {
    flex: 0 0 250px !important;
    width: 250px !important;
    min-width: 250px !important;
    min-height: 220px !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-color: #e0e0e0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.wpsl-brownstone-popup-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Content section */
.wpsl-brownstone-popup-content {
    flex: 1 !important;
    padding: 25px 20px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
}

/* Title */
.wpsl-brownstone-popup-title {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #1a2a3a !important;
    margin: 0 0 15px 0 !important;
    padding: 0 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    line-height: 1.3 !important;
    font-family: 'Raleway', sans-serif !important;
}

/* Details container */
.wpsl-brownstone-popup-details {
    margin: 0 0 20px 0 !important;
    padding: 0 !important;
}

/* Individual detail row */
.wpsl-brownstone-popup-detail {
    display: flex !important;
    margin-bottom: 6px !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
    align-items: baseline !important;
}

.wpsl-brownstone-popup-detail-label {
    font-weight: 700 !important;
    color: #439efd !important;
    text-transform: uppercase !important;
    min-width: 70px !important;
    letter-spacing: 0.5px !important;
    margin-right: 10px !important;
    font-size: 12px !important;
}

.wpsl-brownstone-popup-detail-value {
    font-family: 'Raleway', sans-serif !important;
    color: #1a2a3a !important;
    text-transform: uppercase !important;
    font-weight: 400 !important;
    font-size: 13px !important;
    letter-spacing: 0.3px !important;
}

/* Learn More button */
.wpsl-brownstone-popup-button {
    display: inline-block !important;
    padding: 10px 30px !important;
    font-family: 'Raleway', sans-serif !important;
    font-size: 13px !important;
    line-height: 13px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    text-decoration: none !important;
    letter-spacing: 1.5px !important;
    cursor: pointer !important;
    align-self: flex-start !important;
    text-align: center !important;
    color: #1a2a3a !important;
    border: 2px solid #439efd !important;
    overflow: hidden !important;
    background-image: linear-gradient(to right, #439efd 50%, white 50%) !important;
    background-color: white !important;
    background-size: 200% 100% !important;
    background-position: 100% 0 !important;
    transition: background-position 0.5s ease-out, color 0.5s ease-out !important;
}

.wpsl-brownstone-popup-button:hover {
    color: white !important;
    background-position: 0 0 !important;
    text-decoration: none !important;
}

/* ==========================================================================
   InfoBox Styles (if using InfoBox instead of default)
   ========================================================================== */

.wpsl-infobox {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
}

.wpsl-infobox > img {
    display: none !important;
}

/* ==========================================================================
   Marker Cluster Styles - Solid blue circles with white text
   ========================================================================== */

/* Ensure cluster text is white and bold */
.cluster,
.cluster > div,
.cluster div,
div.cluster div {
    color: #ffffff !important;
    font-weight: 700 !important;
    font-family: 'Raleway', sans-serif !important;
}

/* Target cluster text elements */
.gm-style .cluster div[style*="text-align"],
.gm-style .cluster div[style*="position: absolute"],
.gm-style .cluster div[style*="line-height"] {
    color: #ffffff !important;
    font-weight: bold !important;
}

/* ==========================================================================
   Google Maps InfoWindow Overrides - CRITICAL FOR POPUP DISPLAY
   ========================================================================== */

/* Main info window outer container - NO padding so image goes edge-to-edge */
.gm-style .gm-style-iw-c {
    padding: 0 !important;
    max-width: 600px !important;
    min-width: 600px !important;
    width: 600px !important;
    border-radius: 0 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2) !important;
    background: #ffffff !important;
    overflow: hidden !important;
}

/* Content wrapper - hide scrollbars */
.gm-style .gm-style-iw-d {
    overflow: hidden !important;
    max-height: none !important;
    max-width: none !important;
}

/* Hide any scrollbar that might appear */
.gm-style .gm-style-iw-d::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* Info window tail/arrow */
.gm-style .gm-style-iw-tc::after {
    background: #ffffff !important;
}

/* Position close button container in top right corner */
.gm-style .gm-style-iw-chr {
    display: block !important;
    position: absolute !important;
    right: 20px !important;
    top: -10px !important;
    z-index: 100 !important;
    width: auto !important;
    height: auto !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Style the close button - no background */
.gm-style .gm-style-iw-c button.gm-ui-hover-effect {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 24px !important;
    height: 24px !important;
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    opacity: 1 !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin: 0 !important;
}

.gm-style .gm-style-iw-c button.gm-ui-hover-effect:hover {
    opacity: 0.7 !important;
    background: transparent !important;
    background-color: transparent !important;
}

/* Make the X icon visible - target all possible elements */
.gm-style .gm-style-iw-c button.gm-ui-hover-effect span,
.gm-style .gm-style-iw-chr button span {
    display: block !important;
    width: 14px !important;
    height: 14px !important;
    background-color: #333333 !important;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E") center/contain no-repeat !important;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E") center/contain no-repeat !important;
}

/* Also target the img if Google uses an image */
.gm-style .gm-style-iw-c button.gm-ui-hover-effect img,
.gm-style .gm-style-iw-chr button img {
    display: block !important;
    width: 14px !important;
    height: 14px !important;
    filter: invert(0) !important;
    opacity: 1 !important;
}

/* Fallback: Add X using ::after if nothing else works */
.gm-style .gm-style-iw-c button.gm-ui-hover-effect::after {
    content: '✕' !important;
    font-size: 16px !important;
    color: #333333 !important;
    font-weight: bold !important;
    line-height: 1 !important;
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */

/* Stack dropdowns vertically at 1000px */
@media screen and (max-width: 1000px) {
    #wpsl-category-filters {
        flex-direction: column;
        flex-wrap: wrap;
        align-items: flex-end;
        gap: 8px;
        left: 20px;
    }

    .wpsl-filter-group {
        max-width: calc(100vw - 40px);
    }

    .wpsl-filter-group > label {
        width: 180px;
        min-width: 140px;
        flex-shrink: 1;
        justify-content: center;
    }

    .wpsl-dropdown-trigger {
        min-width: 140px;
        width: 180px;
        flex-shrink: 1;
    }
}

/* Medium screens - slightly smaller popup */
@media screen and (max-width: 900px) {
    .gm-style .gm-style-iw-c {
        max-width: 450px !important;
        min-width: 450px !important;
        width: 450px !important;
    }

    .wpsl-info-window,
    #wpsl-gmap .wpsl-info-window,
    .gm-style .wpsl-info-window {
        max-width: 450px !important;
        width: 450px !important;
    }

    .wpsl-brownstone-popup {
        width: 450px !important;
        max-width: 450px !important;
        min-height: 180px !important;
    }

    .wpsl-brownstone-popup-image {
        flex: 0 0 180px !important;
        width: 180px !important;
        min-width: 180px !important;
        min-height: 180px !important;
    }
}

@media screen and (max-width: 768px) {
    #wpsl-gmap.wpsl-gmap-canvas {
        min-height: 400px;
        height: 60vh !important;
    }

    .wpsl-filter-group > label {
        width: 150px;
        min-width: 100px;
        font-size: 10px;
        padding: 0 10px;
    }

    .wpsl-dropdown-trigger {
        width: 150px;
        min-width: 100px;
        font-size: 10px;
    }

    /* Stack popup vertically on small screens */
    .gm-style .gm-style-iw-c {
        max-width: 300px !important;
        min-width: 280px !important;
        width: 300px !important;
        max-height: none !important;
        padding: 0 !important;
    }

    .gm-style .gm-style-iw-d {
        max-height: none !important;
        overflow: visible !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .wpsl-info-window,
    #wpsl-gmap .wpsl-info-window,
    .gm-style .wpsl-info-window {
        max-width: 300px !important;
        width: 300px !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .wpsl-brownstone-popup {
        flex-direction: column !important;
        width: 300px !important;
        max-width: 300px !important;
        min-height: auto !important;
    }

    .wpsl-brownstone-popup-image {
        flex: none !important;
        width: 300px !important;
        min-width: 300px !important;
        max-width: 300px !important;
        height: 160px !important;
        min-height: 160px !important;
        margin: 0 !important;
        padding: 0 !important;
        border-radius: 0 !important;
        display: block !important;
    }

    .wpsl-brownstone-popup-content {
        width: 100% !important;
        max-width: 100% !important;
        padding: 15px !important;
        min-height: auto !important;
        height: auto !important;
        box-sizing: border-box !important;
    }

    .wpsl-brownstone-popup-title {
        font-size: 14px !important;
        margin-bottom: 10px !important;
    }

    .wpsl-brownstone-popup-detail {
        font-size: 11px !important;
    }

    .wpsl-brownstone-popup-detail-label {
        font-size: 10px !important;
        min-width: 55px !important;
    }

    .wpsl-brownstone-popup-detail-value {
        font-size: 11px !important;
    }

    .wpsl-brownstone-popup-button {
        padding: 8px 20px !important;
        font-size: 11px !important;
    }
}

@media screen and (max-width: 480px) {
    .wpsl-filter-group > label {
        width: 120px;
        min-width: 80px;
        font-size: 9px;
        padding: 0 8px;
    }

    .wpsl-dropdown-trigger {
        width: 120px;
        min-width: 80px;
        font-size: 9px;
    }

    .gm-style .gm-style-iw-c {
        max-width: 260px !important;
        min-width: 260px !important;
        width: 260px !important;
    }

    .wpsl-info-window,
    #wpsl-gmap .wpsl-info-window,
    .gm-style .wpsl-info-window {
        max-width: 260px !important;
        width: 260px !important;
    }

    .wpsl-brownstone-popup {
        width: 260px !important;
        max-width: 260px !important;
    }

    .wpsl-brownstone-popup-image {
        width: 260px !important;
        min-width: 260px !important;
        max-width: 260px !important;
        height: 140px !important;
        min-height: 140px !important;
    }

    .wpsl-brownstone-popup-title {
        font-size: 13px !important;
    }

    .wpsl-brownstone-popup-detail {
        font-size: 10px !important;
    }

    .wpsl-brownstone-popup-button {
        padding: 6px 15px !important;
        font-size: 10px !important;
    }
}

/* ==========================================================================
   Hide Default WPSL Elements We Don't Need
   ========================================================================== */

.wpsl-brownstone-projects .wpsl-search,
.wpsl-brownstone-projects #wpsl-result-list,
.wpsl-brownstone-projects .wpsl-provided-by {
    display: none !important;
}

/* Hide start/origin marker (red marker) */
.gm-style img[src*="red.png"],
.gm-style img[src*="red@2x.png"],
.gm-style img[src*="start"] {
    display: none !important;
    visibility: hidden !important;
}

/* ==========================================================================
   Map Grayscale Style (optional - matches your screenshot)
   ========================================================================== */

/* Uncomment below if you want the grayscale map style applied via CSS */
/*
#wpsl-gmap img {
    filter: grayscale(100%);
    -webkit-filter: grayscale(100%);
}
*/


