/**
 * Project Locations Map - Frontend Styles
 */

/* Map Container */
.project-locations-map {
    width: 100%;
    min-height: 400px;
    z-index: 1;
}

/* Map Legend */
.project-map-legend {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 20px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    overflow-x: auto;
}

.project-map-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.project-map-legend-icon {
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.project-map-legend-icon svg {
    display: block;
}

.project-map-legend-label {
    font-size: 12px;
    color: #333;
    font-weight: 500;
}

/* Custom Marker */
.project-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: markerScale 2s ease-in-out infinite;
}

.project-marker:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    animation: none;
    transform: scale(1.1);
}

/* Scale up and down animation */
@keyframes markerScale {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Popup Styles */
.project-popup {
    min-width: 280px;
    max-width: 320px;
    padding: 0;
}

.project-popup .leaflet-popup-content-wrapper {
    padding: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.project-popup .leaflet-popup-content {
    margin: 0;
    width: 100% !important;
}

.project-popup .leaflet-popup-tip {
    background: #fff;
}

/* Popup Content */
.project-popup-content {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.project-popup-image {
    width: 100%;
    height: 160px;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-popup-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.project-popup-image .no-image {
    color: #fff;
    font-size: 14px;
    opacity: 0.8;
}

.project-popup-info {
    padding: 16px;
}

.project-popup-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.3;
}

.project-popup-location {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.project-popup-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #005F8A;
    color: #fff !important;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.project-popup-link:hover {
    background: #004d70;
    color: #fff !important;
    text-decoration: none;
}

.leaflet-container a.project-popup-link {
    color: #fff !important;
}

.leaflet-container a.project-popup-link:hover {
    color: #fff !important;
}

.project-popup-link svg {
    width: 16px;
    height: 16px;
}

/* Loading State */
.project-map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #f8f9fa;
}

.project-map-loading::after {
    content: "Loading map...";
    color: #666;
    font-size: 14px;
}

/* Marker Cluster Styles (if using clustering) */
.marker-cluster {
    background-color: rgba(102, 126, 234, 0.6);
    border-radius: 50%;
}

.marker-cluster div {
    background-color: rgba(102, 126, 234, 0.9);
    border-radius: 50%;
    color: #fff;
    font-weight: 600;
}

.marker-cluster-small {
    background-color: rgba(102, 126, 234, 0.6);
}

.marker-cluster-small div {
    background-color: rgba(102, 126, 234, 0.9);
}

.marker-cluster-medium {
    background-color: rgba(118, 75, 162, 0.6);
}

.marker-cluster-medium div {
    background-color: rgba(118, 75, 162, 0.9);
}

.marker-cluster-large {
    background-color: rgba(231, 76, 60, 0.6);
}

.marker-cluster-large div {
    background-color: rgba(231, 76, 60, 0.9);
}

/* Responsive Styles */
@media (max-width: 768px) {
    .project-popup {
        min-width: 240px;
        max-width: 280px;
    }
    
    .project-popup-image {
        height: 120px;
    }
    
    .project-popup-title {
        font-size: 16px;
    }
    
    .project-popup-description {
        font-size: 13px;
    }
}

/* Dark Mode Support (optional) */
@media (prefers-color-scheme: dark) {
    .project-locations-map {
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    }
}

/* Animation for markers appearing */
@keyframes markerPulse {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.leaflet-marker-icon {
    animation: markerPulse 0.3s ease-out;
}

/* Custom scrollbar for popup if content is long */
.project-popup-content::-webkit-scrollbar {
    width: 6px;
}

.project-popup-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.project-popup-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.project-popup-content::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}
