/* Members Map Section Styling */
.members-map-section {
    /* margin-top: 1rem; */
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 2px solid #e9ecef;
}

.members-map-header {
    background: none;
    color: #698EE9;
    padding: 1.5rem;
    text-align: center;
    margin-top: 3rem;
}

.members-map-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.members-map-title i {
    font-size: 1.5rem;
}

.members-map-subtitle {
    margin: 0.5rem 0 0 0;
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 400;
    color: #6c757d;
}

/* Map Container */
.map-container {
    position: relative;
    height: 500px;
    width: 100%;
    /* background: #f8f9fa; */
    border-radius: 0 0 12px 12px;
}

#membersMap {
    height: 100%;
    width: 100%;
    border-radius: 0 0 12px 12px;
}

/* Map Controls */
.map-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.map-control-btn {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 0.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    color: #495057;
    min-width: 120px;
    text-align: center;
}

.map-control-btn:hover {
    background: #f8f9fa;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.map-control-btn.active {
    background: #698EE9;
    color: white;
    border-color: #698EE9;
}

/* Custom Map Marker Styles - Pinpoint Design */
.member-marker {
    background: white;
    border: 3px solid #698EE9;
    border-radius: 50% 50% 50% 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: #698EE9;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(105, 142, 233, 0.3);
    position: relative;
    transform: rotate(-45deg);
}

.member-marker-label{
    transform: rotate(45deg);
}

/* Content inside marker should be rotated back */
/* .member-marker::before {
    content: attr(data-count);
    transform: rotate(45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
} */

.member-marker:hover {
    transform: rotate(-45deg) scale(1.1);
    box-shadow: 0 4px 16px rgba(105, 142, 233, 0.4);
    z-index: 100;
}

.member-marker.director {
    border-color: #EDAA03;
    color: #EDAA03;
    box-shadow: 0 2px 8px rgba(237, 170, 3, 0.3);
}

.member-marker.director:hover {
    box-shadow: 0 4px 16px rgba(237, 170, 3, 0.4);
}

.member-marker.inactive {
    border-color: #6c757d;
    color: #6c757d;
    /* opacity: 0.7; */
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
}

/* Multi-member marker for locations with multiple members */
.member-marker.multi {
    background: linear-gradient(135deg, #698EE9 0%, #5a7ed4 100%);
    color: white;
    font-size: 1em;
    font-weight: 700;
}

.member-marker.multi.director {
    background: linear-gradient(135deg, #EDAA03 0%, #d4940a 100%);
}

/* Pinpoint style with separate circle and point (RECOMMENDED) */
.member-marker-alt {
    position: relative;
    width: 40px;
    height: 48px;
}

.member-marker-alt .marker-circle {
    background: white;
    border: 3px solid #698EE9;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: #698EE9;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(105, 142, 233, 0.3);
    position: absolute;
    top: 0;
    left: 4px;
    line-height: 1;
    text-align: center;
    box-sizing: border-box;
}

.member-marker-alt .marker-point {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #698EE9;
}

.member-marker-alt:hover .marker-circle {
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(105, 142, 233, 0.4);
}

.member-marker-alt.director .marker-circle {
    border-color: #EDAA03;
    color: #EDAA03;
    box-shadow: 0 2px 8px rgba(237, 170, 3, 0.3);
}

.member-marker-alt.director .marker-point {
    border-top-color: #EDAA03;
}

.member-marker-alt.director:hover .marker-circle {
    box-shadow: 0 4px 16px rgba(237, 170, 3, 0.4);
}

.member-marker-alt.inactive .marker-circle {
    border-color: #6c757d;
    color: #6c757d;
    opacity: 0.7;
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
}

.member-marker-alt.inactive .marker-point {
    border-top-color: #6c757d;
    opacity: 0.7;
}

.member-marker-alt.multi .marker-circle {
    background: linear-gradient(135deg, #698EE9 0%, #5a7ed4 100%);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
}

.member-marker-alt.multi.director .marker-circle {
    background: linear-gradient(135deg, #EDAA03 0%, #d4940a 100%);
}

/* Popup Styles */
.leaflet-container a.leaflet-popup-close-button {
    top: 2% !important;
    right: 2% !important;
}

.member-popup {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 280px;
    min-width: 200px;
}

.popup-header {
    background: #f0f0f0;
    color: #6c757d;
    padding: 0.75rem;
    margin: -0.5rem -1.15rem 0.75rem -1rem;
    border-radius: 4px 4px 0 0;
    border-radius: 12px;
}

.popup-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.popup-location {
    font-size: 0.85rem;
    opacity: 0.9;
    margin: 0.25rem 0 0 0;
}

.popup-members {
    max-height: 200px;
    overflow-y: auto;
}

.popup-member {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e9ecef;
}

.popup-member:last-child {
    border-bottom: none;
}

.popup-member-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: #6c757d;
    border: 2px solid #e9ecef;
    flex-shrink: 0;
}

.popup-member-info {
    flex-grow: 1;
}

.popup-member-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #212529;
    margin: 0;
}

.popup-member-position {
    font-size: 0.8rem;
    color: #6c757d;
    margin: 0;
}

.popup-member-status {
    padding: 0.15rem 0.4rem;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.popup-member-status.active {
    background: #d4edda;
    color: #155724;
}

.popup-member-status.inactive {
    background: #e3e3e3;
    color: #495057;
}

.popup-member-status.director {
    background: #FFF9E6;
    color: #B8820A;
}

/* Map Legend */
.map-legend {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 1000;
    max-width: 200px;
}

.legend-title {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
    font-size: 0.8rem;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-marker {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 600;
    flex-shrink: 0;
}

.legend-marker.active {
    border-color: #698EE9;
    color: #698EE9;
    background: white;
}

.legend-marker.director {
    border-color: #EDAA03;
    color: #EDAA03;
    background: white;
}

.legend-marker.inactive {
    border-color: #6c757d;
    color: #6c757d;
    background: white;
    opacity: 0.7;
}

.legend-marker.multi {
    background: linear-gradient(135deg, #698EE9 0%, #5a7ed4 100%);
    color: white;
    border-color: #698EE9;
}

/* Loading State */
.map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6c757d;
    font-size: 1.1rem;
}

.map-loading i {
    margin-right: 0.5rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Error State */
.map-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #dc3545;
    text-align: center;
    padding: 2rem;
}

.map-error i {
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.map-error h4 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.map-error p {
    font-size: 0.9rem;
    color: #6c757d;
}

/* Responsive Design */
@media (max-width: 768px) {
    .members-map-title {
        font-size: 1.5rem;
    }
    
    .members-map-subtitle {
        font-size: 0.9rem;
    }
    
    .map-container {
        height: 600px;
    }
    
    .map-controls {
        position: relative;
        top: auto;
        right: auto;
        flex-direction: row;
        justify-content: center;
        margin: 1rem;
        flex-wrap: wrap;
    }
    
    .map-control-btn {
        min-width: 100px;
        font-size: 0.8rem;
    }
    
    .map-legend {
        position: relative;
        bottom: auto;
        left: auto;
        margin: 1rem;
        max-width: none;
        padding: .75rem;
    }

    .legend-title{
        margin-bottom: 0rem;
    }

    .map-legend {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .map-legend .legend-item-container {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 1rem;
        /* justify-content: center; */
    }

    .map-legend .legend-item {
        flex-direction: row;
        align-items: center;
    }

    /* .legend-title {
        display: none;
    } */
    
    .member-marker-alt .marker-circle {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }
    
    .member-marker-alt {
        width: 36px;
        height: 44px;
    }
    
    .popup-header {
        padding: 0.5rem;
    }
    
    .popup-title {
        font-size: 0.9rem;
    }
    
    .popup-location {
        font-size: 0.8rem;
    }
}

@media (max-width: 576px) {
    .members-map-header {
        padding: 1rem;
    }
    
    .members-map-title {
        font-size: 1.35rem;
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .map-container {
        height: 600px;
    }
    
    .member-marker-alt .marker-circle {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
    }
    
    .member-marker-alt {
        width: 32px;
        height: 40px;
    }
    
    .map-control-btn {
        min-width: 80px;
        padding: 0.4rem;
        font-size: 0.75rem;
    }
}