/* Custom styles for the earthquake monitor */

/* Transparency for UI components with glass effect */
.bg-dark-200, .bg-dark-100, .bg-dark-300, .bg-dark-400 {
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* Set default transparency for components with varying levels */
.container .bg-dark-200 {
    background-color: rgba(37, 42, 48, 0.7) !important; /* dark-200 with alpha */
}

.container .bg-dark-100 {
    background-color: rgba(45, 51, 57, 0.65) !important; /* dark-100 with alpha */
}

.container .bg-dark-300 {
    background-color: rgba(29, 33, 37, 0.7) !important; /* dark-300 with alpha */
}

.container .bg-dark-400 {
    background-color: rgba(23, 26, 30, 0.75) !important; /* dark-400 with alpha */
}

/* Restore full opacity on hover with subtle scale effect */
.container .bg-dark-200:hover,
.container .bg-dark-100:hover,
.container .bg-dark-300:hover,
.container .bg-dark-400:hover {
    opacity: 1 !important;
    background-color: rgba(37, 42, 48, 0.85) !important;
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

/* Exclude map container from transparency */
#map {
    opacity: 1 !important;
}

/* Add subtle glow to active components */
.container .active-component {
    box-shadow: 0 0 15px rgba(102, 241, 76, 0.2);
    border: 1px solid rgba(102, 241, 76, 0.1);
}

/* Magnitude circle styles with enhanced glass effect */
.magnitude-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-weight: bold;
    color: white;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 6px rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Add shine effect to magnitude circles */
.magnitude-circle::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(135deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0) 100%);
    transform: rotate(45deg);
    pointer-events: none;
}

/* Scale effect on hover */
.earthquake-item:hover .magnitude-circle {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5), inset 0 0 8px rgba(255, 255, 255, 0.3);
}

.mag-1 { background-color: #2860EB; } /* accent-blue */
.mag-2 { background-color: #66F14C; } /* accent-green */
.mag-3 { background-color: #eab308; } /* yellow-500 */
.mag-4 { background-color: #F68A02; } /* accent-orange */
.mag-5 { background-color: #FF4747; } /* accent-red */
.mag-6-plus { background-color: #b91c1c; } /* red-700 */

/* Earthquake list item hover effect with glass morphism */
.earthquake-item {
    transition: all 0.3s ease;
    cursor: pointer;
    border-left: 3px solid transparent;
    position: relative;
    margin: 4px 0;
    border-radius: 0 8px 8px 0;
    overflow: hidden;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    background-color: rgba(29, 33, 37, 0.4); /* dark-300 with alpha */
}

.earthquake-item:hover {
    background-color: rgba(29, 33, 37, 0.7); /* dark-300 with alpha */
    border-left: 3px solid #66F14C; /* accent-green */
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Add subtle animation for list items */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

#earthquakeList li.earthquake-item {
    animation: fadeIn 0.5s ease-out forwards;
    animation-delay: calc(var(--item-index, 0) * 0.05s);
    opacity: 0;
}

/* Show all/show less button styling */
#showAllBtn {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 500;
    transition: all 0.3s ease;
    opacity: 0.8;
}

#showAllBtn:hover {
    opacity: 1;
    background-color: rgba(40, 96, 235, 0.1);
}

/* Center map button styling with enhanced effects */
.center-map-btn {
    transition: all 0.3s ease;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(102, 241, 76, 0.1); /* accent-green with alpha */
    box-shadow: 0 0 0 0 rgba(102, 241, 76, 0);
}

.earthquake-item:hover .center-map-btn {
    background-color: rgba(102, 241, 76, 0.9); /* accent-green with alpha */
    color: #171A1E; /* dark-400 */
    transform: scale(1.2) rotate(15deg);
    box-shadow: 0 0 0 8px rgba(102, 241, 76, 0.1);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(102, 241, 76, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(102, 241, 76, 0); }
    100% { box-shadow: 0 0 0 0 rgba(102, 241, 76, 0); }
}

/* Add a tooltip to indicate the action with enhanced styling */
.earthquake-item::after {
    content: "Click to center on map";
    position: absolute;
    top: 50%;
    right: 45px;
    transform: translateY(-50%);
    background-color: rgba(31, 41, 55, 0.9); /* dark blue with alpha */
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 10;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.earthquake-item:hover::after {
    opacity: 1;
    visibility: visible;
    right: 60px;
}

/* Custom scrollbar for earthquake list */
#earthquakeList::-webkit-scrollbar {
    width: 8px;
}

#earthquakeList::-webkit-scrollbar-track {
    background: #1D2125; /* dark-300 */
    border-radius: 4px;
}

#earthquakeList::-webkit-scrollbar-thumb {
    background: #2D3339; /* dark-100 */
    border-radius: 4px;
}

#earthquakeList::-webkit-scrollbar-thumb:hover {
    background: #66F14C; /* accent-green */
}

/* Leaflet popup customization with enhanced glass effect */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 0 3px rgba(102, 241, 76, 0.3); /* Stronger shadow and green glow */
    background-color: rgba(37, 42, 48, 0.98) !important; /* dark-200 with higher opacity */
    color: white;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(102, 241, 76, 0.2); /* Green border for better visibility */
    overflow: hidden;
    transform: scale(1.05); /* Slightly larger popups */
    transition: transform 0.2s ease-out;
}

.leaflet-popup-content {
    margin: 16px;
    line-height: 1.6;
    opacity: 1 !important;
    min-width: 200px; /* Ensure popups have a minimum width */
}

.leaflet-popup-tip {
    background-color: rgba(37, 42, 48, 0.98) !important; /* dark-200 with higher opacity */
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(102, 241, 76, 0.2); /* Green border for better visibility */
}

/* Add animation for popup appearance */
@keyframes popupFadeIn {
    0% { opacity: 0; transform: translateY(10px) scale(0.95); }
    70% { opacity: 1; transform: translateY(-5px) scale(1.05); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.leaflet-popup {
    animation: popupFadeIn 0.4s ease-out forwards;
    z-index: 2000 !important; /* Ensure popups are above all other elements */
    filter: drop-shadow(0 0 10px rgba(102, 241, 76, 0.3)); /* Add green glow */
}

.earthquake-popup h3 {
    margin: 0 0 8px 0;
    font-weight: 600;
    color: white;
    border-bottom: 1px solid #2D3339; /* dark-100 */
    padding-bottom: 6px;
}

.earthquake-popup p {
    margin: 4px 0;
    color: #A0A7B0; /* light gray */
}

.earthquake-popup a {
    display: inline-block;
    margin-top: 8px;
    color: #2860EB; /* accent-blue */
    text-decoration: none;
    font-weight: 500;
}

.earthquake-popup a:hover {
    text-decoration: underline;
    color: #66F14C; /* accent-green */
}

/* Error message styling */
.error-message {
    background-color: rgba(255, 71, 71, 0.1); /* accent-red with alpha */
    border: 1px solid #252A30; /* dark-200 */
    border-left: 4px solid #FF4747; /* accent-red */
    color: white;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
}

/* Loading animation */
@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.loading-pulse {
    animation: pulse 1.5s infinite ease-in-out;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .magnitude-circle {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

/* Map attribution styling */
.leaflet-control-attribution {
    font-size: 10px !important;
    background-color: rgba(37, 42, 48, 0.8) !important; /* dark-200 with alpha */
    color: #A0A7B0 !important; /* light gray */
    padding: 2px 5px !important;
    border-radius: 3px !important;
}

.leaflet-control-attribution a {
    color: #66F14C !important; /* accent-green */
}

/* Map controls styling */
.leaflet-control-zoom a {
    background-color: rgba(37, 42, 48, 0.8) !important; /* dark-200 with alpha */
    color: white !important;
    border-color: #2D3339 !important; /* dark-100 */
}

.leaflet-control-zoom a:hover {
    background-color: #2D3339 !important; /* dark-100 */
}

/* Ensure map container and markers are fully opaque */
.leaflet-container {
    background-color: transparent !important;
    z-index: 1;
}

/* Make sure markers are fully visible with enhanced styling */
.earthquake-marker {
    opacity: 1 !important;
    z-index: 500 !important;
    filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.5));
    transition: all 0.3s ease !important;
}

/* Style for active/selected marker */
.earthquake-marker-active {
    z-index: 1500 !important; /* Higher than regular markers but lower than popups */
    filter: drop-shadow(0 0 10px rgba(102, 241, 76, 0.8)) !important;
    transform: scale(1.2) !important;
}

/* Add pulse effect to markers */
@keyframes markerPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.9; }
    100% { transform: scale(1); opacity: 1; }
}

.earthquake-marker:hover {
    filter: drop-shadow(0 0 8px rgba(102, 241, 76, 0.8)) !important;
    animation: markerPulse 1.5s infinite ease-in-out;
}

/* Make sure popups are fully visible with enhanced styling */
.earthquake-popup-container {
    margin-top: -25px !important; /* Increased offset for popups */
    margin-left: 0 !important; /* Center horizontally */
}

/* Style for the popup when a marker is clicked */
.earthquake-popup-active {
    transform: scale(1.1) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7), 0 0 0 4px rgba(102, 241, 76, 0.4) !important;
}

/* Popup styles are defined above */

/* Ensure map container is fully visible with enhanced styling */
.bg-dark-200 #map {
    background-color: transparent !important;
    border: 2px solid rgba(102, 241, 76, 0.5) !important; /* accent-green with alpha */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3), inset 0 0 10px rgba(102, 241, 76, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

/* Make the map container panel more visible */
.bg-dark-200:has(#map),
.lg\:col-span-2 .bg-dark-200 {
    background-color: rgba(37, 42, 48, 0.85) !important; /* dark-200 with higher opacity */
}

/* Tooltip styling */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: 120px;
    background-color: #1f2937;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    margin-left: -60px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.75rem;
}

.tooltip .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #1f2937 transparent transparent transparent;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Visualization styling */
.active-viz-type {
    background-color: #171A1E !important; /* dark-400 */
    color: #66F14C !important; /* accent-green */
    border-color: #66F14C !important; /* accent-green */
    font-weight: 600;
}

#visualizationContent canvas {
    max-width: 100%;
    filter: brightness(1.1) contrast(1.1);
}

.viz-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 0.75rem;
}

.viz-legend-item {
    display: flex;
    align-items: center;
}

.viz-legend-color {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    margin-right: 4px;
}

.viz-tooltip {
    background-color: rgba(37, 42, 48, 0.9); /* dark-200 with alpha */
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    padding: 8px 12px;
    font-size: 0.875rem;
    border: 1px solid #2D3339; /* dark-100 */
    color: white;
}

.viz-no-data {
    text-align: center;
    color: #A0A7B0; /* light gray */
    font-style: italic;
    padding: 20px;
}

/* Additional styles for dark theme */
