/**
 * Earthquake Tracker - Map Stylesheet
 * Leaflet.js Custom Styles
 */

/* Custom Marker Styles */
.earthquake-marker {
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s;
}

.earthquake-marker:hover {
    transform: scale(1.2);
    z-index: 1000 !important;
}

/* Magnitude-based marker sizes */
.marker-mag-1 { width: 8px; height: 8px; }
.marker-mag-2 { width: 12px; height: 12px; }
.marker-mag-3 { width: 16px; height: 16px; }
.marker-mag-4 { width: 20px; height: 20px; }
.marker-mag-5 { width: 26px; height: 26px; }
.marker-mag-6 { width: 32px; height: 32px; }
.marker-mag-7 { width: 40px; height: 40px; }
.marker-mag-8 { width: 50px; height: 50px; }
.marker-mag-9 { width: 60px; height: 60px; }

/* Magnitude colors */
.marker-minor { background-color: #22c55e; }
.marker-light { background-color: #eab308; }
.marker-moderate { background-color: #f97316; }
.marker-strong { background-color: #ef4444; }

/* Pulsing animation for strong earthquakes */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.marker-strong.earthquake-marker {
    animation: pulse 2s infinite;
}

/* Custom Popup Styles */
.leaflet-popup-content-wrapper {
    background: #1e293b;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border: 1px solid #334155;
}

.leaflet-popup-content {
    margin: 0;
    padding: 1rem;
    color: #f8fafc;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.leaflet-popup-tip {
    background: #1e293b;
    border: 1px solid #334155;
}

.leaflet-popup-close-button {
    color: #94a3b8;
    padding: 8px;
}

.leaflet-popup-close-button:hover {
    color: #f8fafc;
}

/* Popup Content */
.popup-content {
    min-width: 200px;
}

.popup-magnitude {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.popup-location {
    font-size: 0.875rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.popup-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid #334155;
}

.popup-detail-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.popup-link {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
    transition: transform 0.2s;
}

.popup-link:hover {
    transform: translateY(-2px);
    color: white;
}

/* Cluster Styles */
.marker-cluster {
    background-color: rgba(59, 130, 246, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.875rem;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.marker-cluster-small {
    background-color: rgba(34, 197, 94, 0.8);
    width: 30px;
    height: 30px;
}

.marker-cluster-medium {
    background-color: rgba(234, 179, 8, 0.8);
    width: 40px;
    height: 40px;
}

.marker-cluster-large {
    background-color: rgba(249, 115, 22, 0.8);
    width: 50px;
    height: 50px;
}

/* Depth Circle */
.depth-circle {
    fill: rgba(59, 130, 246, 0.1);
    stroke: #3b82f6;
    stroke-width: 2;
    stroke-dasharray: 5, 5;
}

/* Epicenter Marker */
.epicenter-marker {
    background-color: #ef4444;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.6);
    animation: pulse-epicenter 2s infinite;
}

@keyframes pulse-epicenter {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        box-shadow: 0 0 0 30px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Leaflet Controls Customization */
.leaflet-control-zoom {
    border: none !important;
    border-radius: 8px !important;
    overflow: hidden;
}

.leaflet-control-zoom a {
    background-color: #1e293b !important;
    color: #f8fafc !important;
    border: 1px solid #334155 !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 1.25rem !important;
}

.leaflet-control-zoom a:hover {
    background-color: #334155 !important;
}

.leaflet-control-attribution {
    background-color: rgba(15, 23, 42, 0.8) !important;
    color: #64748b !important;
    font-size: 0.625rem !important;
    padding: 4px 8px !important;
}

.leaflet-control-attribution a {
    color: #94a3b8 !important;
}

.leaflet-control-scale {
    background-color: rgba(15, 23, 42, 0.8);
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid #334155;
}

.leaflet-control-scale-line {
    border-color: #94a3b8 !important;
    color: #94a3b8 !important;
}

/* Layer Control */
.leaflet-control-layers {
    background-color: #1e293b !important;
    border: 1px solid #334155 !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

.leaflet-control-layers-toggle {
    filter: invert(1);
}

.leaflet-control-layers-list {
    color: #f8fafc;
}

.leaflet-control-layers-base label,
.leaflet-control-layers-overlays label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    cursor: pointer;
}

.leaflet-control-layers-selector {
    margin: 0;
}

/* Location Button */
.locate-btn {
    background-color: #1e293b;
    border: 1px solid #334155;
    border-radius: 4px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #f8fafc;
    font-size: 1.125rem;
    transition: background-color 0.2s;
}

.locate-btn:hover {
    background-color: #334155;
}

.locate-btn.active {
    background-color: #3b82f6;
    border-color: #3b82f6;
}

/* Loading Overlay */
.map-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.map-loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #334155;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.map-loading-text {
    margin-top: 1rem;
    color: #94a3b8;
    font-size: 0.875rem;
}

/* No JS Fallback */
.map-no-js {
    background-color: #1e293b;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
    color: #94a3b8;
}

.map-no-js i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.map-no-js a {
    margin-top: 1rem;
    color: #3b82f6;
}

/* Responsive */
@media (max-width: 768px) {
    .leaflet-control-zoom {
        display: none;
    }
    
    .popup-content {
        min-width: 150px;
    }
    
    .popup-magnitude {
        font-size: 1.25rem;
    }
    
    .marker-mag-7,
    .marker-mag-8,
    .marker-mag-9 {
        width: 30px;
        height: 30px;
    }
}

/* Dark mode for Leaflet tiles */
.leaflet-tile-pane {
    filter: brightness(0.8) contrast(1.1);
}

/* Satellite view */
.satellite-view .leaflet-tile-pane {
    filter: none;
}

/* Tectonic Plates Layer */
.tectonic-plates-layer path {
    stroke: #f97316;
    stroke-width: 2;
    stroke-opacity: 0.7;
    fill: none;
    stroke-dasharray: 10, 5;
}

/* User Location Marker */
.user-location-marker {
    background-color: #3b82f6;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.6);
    width: 16px;
    height: 16px;
}

.user-location-accuracy {
    fill: rgba(59, 130, 246, 0.2);
    stroke: #3b82f6;
    stroke-width: 1;
}

/* Info Control */
.map-info-control {
    background-color: rgba(15, 23, 42, 0.9);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #334155;
    color: #f8fafc;
    font-size: 0.875rem;
    max-width: 300px;
}

.map-info-control h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
}

.map-info-control p {
    margin: 0;
    color: #94a3b8;
}
