/*
 * Mapbox Markers Styles
 * Styles for community markers, lot markers, and interactive map elements
 */

/* Mapbox Container */
.page-id-6460 { background-color:#EFF0EF }
.page-id-6460 .space-top { padding-top:70px !important; }

#map-container { 
    width: 100%; 
}

.elementor-shortcode:has(.mapboxgl-map) { 
    width: 100%; 
    height: auto; 
}

/* Mapbox Wrapper with Filter Bar */
.mapbox-wrapper {
    width: 100%;
    border-radius: 0px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Filter Bar */
.mapbox-filter-bar {
    background-color:#2D4841;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
}

.mapbox-filter-bar .filter-group {
    display: flex;
    flex-direction: column;
    gap: 0px;
    min-width: 140px;
}

.mapbox-filter-bar .filter-group label {
    font-size: 17px;
    font-weight: 400;
    color: white;
    text-transform: capitalize;
    letter-spacing: 0;
    font-family: "arboria", sans-serif;
    margin-bottom:0;
}
.mapbox-filter-bar .filter-group select,
.mapbox-filter-bar .filter-group select option { font-size: 17px; font-weight: 400; }

.mapbox-filter-bar .filter-group:has(.clear-filters-btn) { margin-left:auto; }

.mapbox-filter-bar .filter-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 0px;
    font-size: 14px;
    background: white;
    color: #333;
    cursor: pointer;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    width:266px;
}

.mapbox-filter-bar .filter-select:focus {
    outline: none;
    border-color: #1B6551;
    box-shadow: 0 0 0 2px rgba(27, 101, 81, 0.2);
}

.mapbox-filter-bar .clear-filters-btn {
    background-color:transparent;
    color: white;
    padding: 8px 16px;
    border-radius: 0px;
    font-size: 17px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    justify-content: center;
    align-items: center;
    width:199px; 
    height:59px;
    border:1px solid white;
}

.mapbox-filter-bar .clear-filters-btn:hover {
    opacity:0.8;
    background-color:transparent;
}

/* Mapbox Container with Sidebar */
.mapbox-container {
    display: flex;
    width: 100%;
    height: 600px;
}

.mapbox-sidebar {
    width: 350px;
    background: white;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mapbox-map-wrapper {
    flex: 1;
    position: relative;
}

/* Sidebar Header */
.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.sidebar-title {
    margin: 0;
    font-size: 20px;
    font-weight: 500;
    color: #1D6452;
    font-family: "arboria", sans-serif;
}

.sidebar-back-btn {
    background: #1D6452;
    color: white;
    border: none;
    border-radius: 0px;
    font-size: 15px;
    cursor: pointer;
    margin-top: 10px;
    transition: opacity 0.3s ease;
    width:198px;
    height:40px;
    display:flex;
    font-weight:400;
    align-items: center;
    justify-content: center;
    padding-left:20px;
    position: relative;
}

.sidebar-back-btn:before {
    content: '';
    position: absolute;
    left: 5px;
    top: 50%;
    transform: translateY(-50%) rotate(180deg);
    width: 22px;
    height: 19px;
    background-image: url(../images/full-arrow-white.svg);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.sidebar-back-btn:hover {
    opacity:0.8;
}

/* Sidebar Content */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Communities List */
.communities-list {
    padding: 0;
}

.community-item {
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.community-item:hover {
    background-color: #f8f9fa;
}

.community-item.active {
    background-color: #e8f5e8;
    border-left: 4px solid #1B6551;
}

.community-item h4 {
    margin: 0 0 2.5px 0;
    font-size: 16px;
    font-weight: 500;
    color: #1B6551;
    font-family: "arboria", sans-serif;
}

.community-city {
    margin: 0 0 5px 0;
    font-size: 14px;
    color: #666;
}

.community-stats {
    display: flex;
    gap: 15px;
}

.stat {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat.for-sale {
    color: #1B6551;
}

.stat.move-in-ready {
    color: #1B6551;
}

.stat.sold {
    color: #A08355;
}

/* Properties List */
.properties-list {
    padding: 0;
}

.property-item {
    display: flex;
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s ease;
    gap: 12px;
}

.property-item:hover {
    background-color: #f8f9fa;
}

.property-item.active {
    background-color: #e8f5e8;
    border-left: 4px solid #1B6551;
}

/* Property Thumbnail */
.property-thumbnail {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 0px;
    overflow: hidden;
    background-color: #f0f0f0;
}

.property-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Property Details Container */
.property-details {
    flex: 1;
    min-width: 0; /* Allows text to truncate properly */
}

.property-item h4 {
    margin: 0 0 5px 0;
    font-size: 15px;
    font-weight: 500;
    color: #0D0708;
    font-family: "arboria", sans-serif;
}

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

.property-model,
.property-elevation {
    margin: 0 0 5px 0;
    font-size: 12px;
    color: #555;
}

.property-model strong,
.property-elevation strong {
    color: #1B6551;
    font-weight: 500;
}

.property-status {
    display: inline-block;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.property-status.status-for_sale {
    background-color: #e8f5e8;
    color: #1B6551;
}

.property-status.status-move-in-ready {
    background-color: #e8f5e8;
    color: #1B6551;
}

.property-status.status-sold {
    background-color: #f5f0e8;
    color: #A08355;
}

/* Mobile Controls - Hidden on desktop */
.mapbox-mobile-controls {
    display: none;
}

.mapbox-mobile-filter-panel {
    display: none;
}

.mapbox-legend-popup {
    display: none;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    /* Show mobile controls */
    .mapbox-mobile-controls {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 15px 20px;
        background: #2D4841;
        gap: 10px;
    }
    
    .mapbox-mobile-controls .mobile-filter-toggle {
        background: transparent;
        border: 1px solid #AECBC3;
        border-radius: 0;
        color: white;
        width: 200px;
        height: 60px;
        padding: 0 50px 0 20px;
        font-size: 17px;
        font-weight: 400;
        font-family: "arboria", sans-serif;
        cursor: pointer;
        position: relative;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        margin: 0;
        box-shadow: none;
        outline: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        transition: opacity 0.3s ease;
    }
    
    .mapbox-mobile-controls .mobile-filter-toggle::after {
        content: '';
        position: absolute;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        width: 33px;
        height: 27px;
        background: url('../images/icon-filter.svg') no-repeat center center;
        background-size: contain;
    }
    
    .mapbox-mobile-controls .mobile-filter-toggle:hover {
        opacity: 0.8;
    }
    
    .mobile-legend-toggle {
        color: white;
        font-size: 15px;
        font-weight: 400;
        text-decoration: underline !important;
        font-family: "arboria", sans-serif;
    }
    
    .mobile-legend-toggle:hover {
        opacity: 0.8;
    }
    
    /* Mobile Filter Panel */
    .mapbox-mobile-filter-panel {
        display: block;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        background: #2D4841;
        z-index: 1000;
        padding: 40px 20px 20px;
        transform: translateY(-100%);
        transition: transform 0.3s ease;
    }
    
    .mapbox-mobile-filter-panel.active {
        transform: translateY(0);
    }
    
    .mapbox-mobile-filter-panel .mobile-filter-close {
        position: absolute;
        top: 20px;
        right: 20px;
        background: url('../images/x-close-white.svg') no-repeat center center;
        background-size: 30px 30px;
        background-color: transparent;
        border: 1px solid white;
        border-radius: 0;
        width: 35px;
        height: 35px;
        cursor: pointer;
        padding: 0;
        margin: 0;
        font-size: 0;
        line-height: 1;
        color: transparent;
        box-shadow: none;
        outline: none;
        text-indent: -9999px;
        overflow: hidden;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }
    
    .mapbox-mobile-filter-panel .mobile-filter-close:hover,
    .mapbox-mobile-filter-panel .mobile-filter-close:focus,
    .mapbox-mobile-filter-panel .mobile-filter-close:active {
        background-color: transparent;
        border-color: white;
        box-shadow: none;
        outline: none;
        opacity: 0.8;
    }
    
    .mobile-filter-content {
        display: flex;
        flex-direction: column;
        gap: 15px;
        padding-top: 20px;
        align-items: center;
    }
    
    .mobile-filter-content .filter-group {
        width: 100%;
        max-width:266px;
    }
    
    .mobile-filter-content .filter-group label {
        color: white;
        margin-bottom: 5px;
        display: block;
    }
    
    .mobile-filter-content .filter-select {
        width: 100%;
        max-width:266px;
        padding: 12px;
        font-size: 16px;
        border: 1px solid rgba(255,255,255,0.3);
        background: white;
    }
    
    .mobile-filter-submit {
        background: transparent;
        border: 1px solid #AECBC3;
        border-radius: 0;
        color: white;
        width: 200px;
        height: 60px;
        padding: 0;
        font-size: 17px;
        font-weight: 400;
        font-family: "arboria", sans-serif;
        cursor: pointer;
        margin-top: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        transition: opacity 0.3s ease;
    }
    
    .mobile-filter-submit:hover {
        opacity: 0.8;
    }
    
    .mobile-filter-clear {
        background: transparent;
        border: none;
        color: white;
        padding: 0;
        font-size: 15px;
        font-weight: 400;
        text-decoration: underline;
        font-family: "arboria", sans-serif;
        cursor: pointer;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        transition: opacity 0.3s ease;
    }
    
    .mobile-filter-clear:hover {
        opacity: 0.8;
    }
    
    /* Legend Popup */
    .mapbox-legend-popup {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 10000;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    .mapbox-legend-popup.active {
        opacity: 1;
        visibility: visible;
    }
    
    .legend-popup-overlay {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.7);
    }
    
    .legend-popup-content {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: white;
        padding: 30px 20px;
        width: 90%;
        max-width:391px;
        max-height: 90vh;
        overflow-y: auto;
        border-radius: 0;
    }
    
    .legend-popup-content h3 {
        margin: 0 0 20px 0;
        font-size: 20px;
        font-weight: 600;
        color: #1D6452;
        font-family: "arboria", sans-serif;
    }
    
    .legend-popup-close {
        position: absolute;
        top: 20px;
        right: 20px;
        background: url('../images/x-close.svg') no-repeat center center;
        background-size: 30px 30px;
        background-color: transparent;
        border: 1px solid #AECBC3;
        border-radius: 0;
        width: 35px;
        height: 35px;
        cursor: pointer;
        padding: 0;
        margin: 0;
        font-size: 0;
        line-height: 1;
        color: transparent;
        box-shadow: none;
        outline: none;
        text-indent: -9999px;
        overflow: hidden;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }
    
    .legend-popup-close:hover,
    .legend-popup-close:focus,
    .legend-popup-close:active {
        background-color: transparent;
        border-color: #333;
        box-shadow: none;
        outline: none;
        opacity: 0.8;
    }
    
    .legend-popup-close-bottom {
        background: transparent;
        border: none;
        color: #333;
        padding: 0;
        font-size: 15px;
        font-weight: 400;
        text-decoration: underline;
        font-family: "arboria", sans-serif;
        cursor: pointer;
        margin-top: 20px;
        display: block;
        width: 100%;
        text-align: center;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        transition: opacity 0.3s ease;
    }
    
    .legend-popup-close-bottom:hover {
        opacity: 0.8;
    }
    
    .legend-popup-content .map-legend {
        padding: 0;
    }
    
    .legend-popup-content .map-legend-column {
        flex-direction: column;
        gap: 20px;
    }
    
    /* Hide desktop filter bar on mobile */
    .mapbox-filter-bar {
        display: none;
    }
    
    /* Position wrapper for mobile filter panel */
    .mapbox-wrapper {
        position: relative;
        overflow: hidden;
    }
    
    .filter-controls {
        gap: 15px;
    }
    
    .filter-group {
        min-width: 120px;
        flex: 1;
    }
    
    .mapbox-container {
        display: flex;
        flex-direction: column;
        width: 100%;
        overflow: hidden;
    }
    
    .mapbox-sidebar {
        width: 100%;
        order: 2;
        max-height: 300px;
    }
    
    .mapbox-map-wrapper {
        width: 100%;
        aspect-ratio: 9 / 16;
        min-height: auto;
        overflow: hidden;
        order: 1;
    }
    
    .mapbox-map-wrapper > div {
        width: 100%;
        height: 100%;
    }
    
    .sidebar-content {
        max-height: 250px;
    }
}

@media (max-width: 480px) {
    .filter-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    .clear-filters-btn {
        margin-top: 5px;
        width: 100%;
    }
    
    .mapbox-filter-bar {
        padding: 10px 15px;
    }
    
    .mapbox-sidebar {
        max-height: 250px;
    }
    
    .mapbox-map-wrapper {
        aspect-ratio: 9 / 16;
        height: auto;
    }
    
    .community-item,
    .property-item {
        padding: 15px;
    }
    
    .sidebar-header {
        padding: 15px;
    }
}

/* Mapbox Custom Markers and Popups */
.custom-marker {
    transition: all 0.3s ease;
}

.custom-marker:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4) !important;
}

.mapboxgl-popup {
    max-width: 300px;
}

.mapboxgl-popup-content {
    padding: 0;
    border-radius: 0px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.mapbox-popup-content {
    padding: 20px;
    font-family: "arboria", sans-serif;
}

.mapbox-popup-content h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 500;
    color: #1B6551;
    line-height: 1.3;
}

s.mapbox-popup-content h3 .popup-title-link {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.mapbox-popup-content h3 .popup-title-link:hover {
    color: #A08355;
    text-decoration: underline;
}

.mapbox-popup-content p {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 400;
    color: #0D0708;
    line-height: 1.4;
}

.mapbox-popup-content p:last-child {
    margin-bottom: 0;
}

.mapbox-popup-content .popup-link {
    display: inline-block;
    background-color: #1B6551;
    color: white !important;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 0px;
    font-size: 14px;
    font-weight: 400;
    transition: background-color 0.3s ease;
    border: none;
    cursor: pointer;
}

.mapbox-popup-content .popup-link:hover {
    background-color: #A08355;
    text-decoration: none;
}

.mapbox-popup-content a[href^="tel:"] {
    color: #1B6551 !important;
    text-decoration: none;
}

.mapbox-popup-content a[href^="tel:"]:hover {
    color: #A08355 !important;
    text-decoration: underline;
}

.mapboxgl-popup-close-button {
    font-size: 20px;
    color: #666;
    right: 8px;
    top: 8px;
}

.mapboxgl-popup-close-button:hover {
    color: #1B6551;
}

/* Status Indicators in Popups */
.mapbox-popup-content .status-for_sale {
    color: #1B6551 !important;
    font-weight: 500;
    text-transform: capitalize;
}

.mapbox-popup-content .status-sold {
    color: #A08355 !important;
    font-weight: 500;
    text-transform: capitalize;
}

/* Community Markers */
.community-marker {
    position: relative;
}

.community-marker:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.5) !important;
}

.community-marker:before {
    content: '';
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background-color: #A08355;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Enhanced Popup Buttons */
.mapbox-popup-content .popup-link.secondary {
    background-color: #666;
    margin-top: 10px;
    font-size: 13px;
    padding: 6px 12px;
}

.mapbox-popup-content .popup-link.secondary:hover {
    background-color: #444;
}

/* Popup Home Images */
.popup-image-container {
    margin-bottom: 15px;
    text-align: center;
}

.popup-home-image {
    width: 100%;
    max-width: 300px;
    height: auto;
    border-radius: 0px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    object-fit: cover;
}

/* Community Popup Styling */
.mapbox-popup-content p strong {
    color: #0D0708;
}

.mapbox-popup-content .status-for_sale {
    color: #1B6551 !important;
    font-weight: 500;
}

.mapbox-popup-content .status-sold {
    color: #A08355 !important;
    font-weight: 500;
}

/* Smooth transitions for marker changes */
.custom-marker, .community-marker {
    opacity: 0;
    animation: fadeInMarker 0.5s ease-in-out forwards;
}

@keyframes fadeInMarker {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Admin Interface Styling */
body.post-type-map_marker .form-table th,
body.post-type-community_marker .form-table th,
body.post-type-lot_marker .form-table th {
    width: 150px;
    font-weight: 500;
}

body.post-type-map_marker .form-table input[type="text"],
body.post-type-community_marker .form-table input[type="text"],
body.post-type-lot_marker .form-table input[type="text"],
body.post-type-map_marker .form-table input[type="number"],
body.post-type-community_marker .form-table input[type="number"],
body.post-type-lot_marker .form-table input[type="number"] {
    font-size: 14px;
    padding: 8px 12px;
}

body.post-type-map_marker .form-table select,
body.post-type-community_marker .form-table select,
body.post-type-lot_marker .form-table select {
    font-size: 14px;
    padding: 8px 12px;
}

/* Map Marker List Table Columns */
.wp-admin .widefat .column-address {
    width: 30%;
}

.wp-admin .widefat .column-status {
    width: 15%;
}

.wp-admin .widefat .column-community,
.wp-admin .widefat .column-community_name {
    width: 20%;
}

.wp-admin .widefat .column-coordinates {
    width: 25%;
}

.wp-admin .widefat .column-city {
    width: 20%;
}

.wp-admin .widefat .column-lot_count {
    width: 15%;
}

/* Status badges in admin list */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 0px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-badge.for_sale {
    background-color: #1B6551;
    color: white;
}

.status-badge.sold {
    background-color: #A08355;
    color: white;
}

@media (max-width: 768px) {
    .home .elementor-shortcode .mapbox-container .mapbox-sidebar { display:none; }
    .home .elementor-shortcode .mapbox-container, .home .elementor-shortcode .mapbox-map-wrapper { height:auto; }
    .mapbox-container { height:800px; }
    .elementor-shortcode .mapbox-sidebar { max-height:400px; }
}