/* ═══════════════════════════════════════════════════════════════════════════
   NOACH DISASTER OBSERVATORY - DASHBOARD STYLES
   ═══════════════════════════════════════════════════════════════════════════
   Version: 4.1.0 - Complete (Inline Styles Merged)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════════
   [1] CSS CUSTOM PROPERTIES
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    /* Layout */
    --header-height: 64px;
    --footer-height: 48px;
    --sidebar-width: 320px;
    --sidebar-width-xl: 384px;
    --border-radius-lg: 16px;
    --border-radius-xl: 20px;

    /* Transitions */
    --transition-base: 200ms ease;
    --transition-smooth: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fade: 500ms ease-out;

    /* Brand Colors */
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-primary-light: #dbeafe;

    /* Slate Palette */
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;

    /* Status Colors */
    --status-active: #16a34a;
    --status-coming: #eab308;
    --status-unavailable: #9ca3af;

    /* Severity Colors (Earthquakes) */
    --eq-light-color: #FFEE58;
    --eq-moderate-color: #FF9800;
    --eq-strong-color: #F44336;

    /* Pulse Ring Colors */
    --eq-light-pulse: rgba(255, 238, 88, 0.6);
    --eq-moderate-pulse: rgba(255, 152, 0, 0.6);
    --eq-strong-pulse: rgba(244, 67, 54, 0.6);

    /* Marker Sizes */
    --eq-light-size: 50px;
    --eq-moderate-size: 60px;
    --eq-strong-size: 70px;

    /* Animation Properties */
    --eq-pulse-opacity: 0.7;
    --eq-pulse-duration: 2s;

    /* Dynamic Zoom Scale (JS controlled) */
    --zoom-scale: 1;

    /* Marker Pin Icons (Embedded SVG) */
    --eq-light-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 24 24' fill='%23FFEE58' stroke='%23000000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3C/svg%3E");
    --eq-moderate-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 24 24' fill='%23FF9800' stroke='%23000000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3C/svg%3E");
    --eq-strong-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 24 24' fill='%23F44336' stroke='%23000000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3C/svg%3E");
}

/* ═══════════════════════════════════════════════════════════════════════════
   [2] BASE STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

* {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ═══════════════════════════════════════════════════════════════════════════
   [3] PAGE LOADER
   ═══════════════════════════════════════════════════════════════════════════ */

#loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background-color: var(--slate-100);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
    transition: opacity var(--transition-fade), visibility var(--transition-fade);
}

#loader.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#loader .loader-icon {
    width: 72px;
    height: 72px;
    animation: loader-pulse 2s ease-in-out infinite;
}

@keyframes loader-pulse {
    0%, 100% { 
        transform: scale(1); 
        opacity: 1; 
    }
    50% { 
        transform: scale(1.05); 
        opacity: 0.85; 
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   [4] MAIN CONTENT VISIBILITY
   ═══════════════════════════════════════════════════════════════════════════ */

#main-content {
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-fade), visibility var(--transition-fade);
}

#main-content.visible {
    opacity: 1;
    visibility: visible;
}

/* ═══════════════════════════════════════════════════════════════════════════
   [5] FOCUS STATES & ACCESSIBILITY
   ═══════════════════════════════════════════════════════════════════════════ */

a:focus-visible,
button:focus-visible,
input:focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   [6] MAP CONTAINER
   ═══════════════════════════════════════════════════════════════════════════ */

#map {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--slate-200) 0%, var(--slate-300) 100%);
    border-radius: var(--border-radius-xl);
}

/* Hide default MapLibre/MapTiler controls */
.maplibregl-ctrl-top-right,
.maplibregl-ctrl-top-left,
.maplibregl-ctrl-bottom-right,
.maplibregl-ctrl-bottom-left,
.mapboxgl-ctrl-top-right,
.mapboxgl-ctrl-top-left,
.mapboxgl-ctrl-bottom-right,
.mapboxgl-ctrl-bottom-left {
    display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   [7] UI OVERLAY LAYER
   ═══════════════════════════════════════════════════════════════════════════ */

#ui-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}

#ui-layer > * {
    pointer-events: auto;
}

/* ═══════════════════════════════════════════════════════════════════════════
   [8] STATUS BADGES
   ═══════════════════════════════════════════════════════════════════════════ */

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.625rem;
    border-radius: 6px;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.status-badge.active {
    background-color: var(--status-active);
    color: white;
}

.status-badge.coming-soon {
    background-color: var(--status-coming);
    color: white;
}

.status-badge.unavailable {
    background-color: var(--status-unavailable);
    color: white;
}

/* ═══════════════════════════════════════════════════════════════════════════
   [9] COUNTRY LIST ITEMS
   ═══════════════════════════════════════════════════════════════════════════ */

.country-item {
    transition: background-color var(--transition-base);
}

.country-item:hover:not([class*="cursor-not-allowed"]) {
    background-color: var(--color-primary-light);
}

.country-item img {
    transition: transform var(--transition-base);
}

.country-item:hover:not([class*="cursor-not-allowed"]) img {
    transform: scale(1.1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   [10] EARTHQUAKE MARKERS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Base Marker Container */
.eq-marker {
    position: absolute;
    cursor: pointer;
    width: var(--eq-size);
    height: var(--eq-size);
    transform: scale(var(--zoom-scale, 1));
    transform-origin: bottom center;
    transition: none;
    user-select: none;
    -webkit-user-select: none;
}

/* Magnitude Classes */
.eq-marker.light {
    --eq-size: var(--eq-light-size);
    --eq-color: var(--eq-light-color);
    --eq-pulse-color: var(--eq-light-pulse);
    --eq-icon: var(--eq-light-icon);
}

.eq-marker.moderate {
    --eq-size: var(--eq-moderate-size);
    --eq-color: var(--eq-moderate-color);
    --eq-pulse-color: var(--eq-moderate-pulse);
    --eq-icon: var(--eq-moderate-icon);
}

.eq-marker.strong {
    --eq-size: var(--eq-strong-size);
    --eq-color: var(--eq-strong-color);
    --eq-pulse-color: var(--eq-strong-pulse);
    --eq-icon: var(--eq-strong-icon);
}

/* Glow Effect */
.eq-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(var(--eq-size) * 0.6);
    height: calc(var(--eq-size) * 0.6);
    border-radius: 50%;
    background: var(--eq-pulse-color);
    filter: blur(3px);
    opacity: 0.6;
    pointer-events: none;
    z-index: 1;
}

/* Pulse Ring */
.eq-pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: var(--eq-size);
    height: var(--eq-size);
    border-radius: 50%;
    background: var(--eq-pulse-color);
    opacity: var(--eq-pulse-opacity);
    animation: eq-pulse var(--eq-pulse-duration) ease-out infinite;
    pointer-events: none;
    z-index: 2;
}

/* Core Pin Icon */
.eq-core {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -100%);
    width: 28px;
    height: 28px;
    background-image: var(--eq-icon);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
    transition: transform var(--transition-base);
    pointer-events: none;
    z-index: 3;
}

.eq-marker:hover .eq-core {
    transform: translate(-50%, -100%) scale(1.15);
    filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.5));
}

/* New Event Badge */
.eq-new-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e53935;
    border: 2px solid white;
    box-shadow: 0 0 10px rgba(229, 57, 53, 0.8);
    animation: eq-new-pulse 1s ease-in-out infinite;
    z-index: 4;
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   [11] ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

@keyframes eq-pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: var(--eq-pulse-opacity);
    }
    50% {
        transform: translate(-50%, -50%) scale(2.2);
        opacity: 0;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}

@keyframes eq-new-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.6;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   [12] EARTHQUAKE POPUPS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Popup Container */
.disaster-popup {
    z-index: 1000 !important;
}

.disaster-popup .maplibregl-popup-content,
.disaster-popup .mapboxgl-popup-content {
    background: linear-gradient(135deg, var(--slate-800) 0%, var(--slate-900) 100%);
    color: white;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-width: 300px;
    max-width: 340px;
    position: relative;
    z-index: 1001;
}

/* Close Button */
.disaster-popup .maplibregl-popup-close-button,
.disaster-popup .mapboxgl-popup-close-button {
    color: white;
    font-size: 22px;
    padding: 8px;
    right: 6px;
    top: 6px;
    opacity: 0.7;
    transition: opacity var(--transition-base);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.disaster-popup .maplibregl-popup-close-button:hover,
.disaster-popup .mapboxgl-popup-close-button:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

/* Popup Arrow */
.disaster-popup .maplibregl-popup-tip,
.disaster-popup .mapboxgl-popup-tip {
    border-top-color: var(--slate-900);
    z-index: 1000;
}

/* Popup Header */
.eq-popup-header {
    background: linear-gradient(135deg, var(--slate-700) 0%, var(--slate-800) 100%);
    padding: 18px;
    border-radius: 12px 12px 0 0;
}

.eq-popup-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 6px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.3;
}

.eq-popup-location {
    font-size: 13px;
    color: var(--slate-400);
    margin: 0;
    line-height: 1.5;
}

/* Popup Body */
.eq-popup-body {
    padding: 18px;
}

.eq-data-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.eq-data-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 8px;
    border-left: 3px solid;
    transition: background var(--transition-base);
}

.eq-data-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.eq-data-item.magnitude { border-left-color: var(--eq-light-color); }
.eq-data-item.depth { border-left-color: #3b82f6; }
.eq-data-item.time { border-left-color: #8b5cf6; }
.eq-data-item.status { border-left-color: #10b981; }

.eq-data-label {
    font-size: 11px;
    color: var(--slate-400);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 6px 0;
    font-weight: 600;
}

.eq-data-value {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: white;
    line-height: 1.3;
}

/* Popup Footer */
.eq-popup-footer {
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 0 0 12px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.eq-popup-link {
    color: #60a5fa;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: color var(--transition-base);
    white-space: nowrap;
}

.eq-popup-link:hover {
    color: #93c5fd;
    text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════════════════════
   [13] EARTHQUAKE BADGES
   ═══════════════════════════════════════════════════════════════════════════ */

/* Magnitude Badge */
.eq-magnitude-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 17px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.eq-magnitude-badge.light {
    background: var(--eq-light-color);
    color: #1a1a1a;
}

.eq-magnitude-badge.moderate {
    background: var(--eq-moderate-color);
    color: white;
}

.eq-magnitude-badge.strong {
    background: var(--eq-strong-color);
    color: white;
}

/* Depth Badge */
.eq-depth-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    margin-left: 6px;
    letter-spacing: 0.3px;
}

.eq-depth-badge.shallow {
    background: #fef3c7;
    color: #92400e;
}

.eq-depth-badge.intermediate {
    background: #dbeafe;
    color: #1e40af;
}

.eq-depth-badge.deep {
    background: #e0e7ff;
    color: #3730a3;
}

.eq-depth-badge.unknown {
    background: var(--slate-200);
    color: var(--slate-600);
}

/* ═══════════════════════════════════════════════════════════════════════════
   [14] TSUNAMI WARNING
   ═══════════════════════════════════════════════════════════════════════════ */

.eq-tsunami-warning {
    background: rgba(229, 57, 53, 0.12);
    border: 1px solid rgba(229, 57, 53, 0.4);
    border-radius: 8px;
    padding: 12px;
    margin-top: 10px;
}

.eq-tsunami-warning p {
    margin: 0;
    color: #fca5a5;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0.3px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   [15] SCROLLBAR STYLING
   ═══════════════════════════════════════════════════════════════════════════ */

#country-list::-webkit-scrollbar {
    width: 6px;
}

#country-list::-webkit-scrollbar-track {
    background: var(--slate-100);
}

#country-list::-webkit-scrollbar-thumb {
    background: var(--slate-300);
    border-radius: 3px;
}

#country-list::-webkit-scrollbar-thumb:hover {
    background: var(--slate-400);
}

/* ═══════════════════════════════════════════════════════════════════════════
   [16] RESPONSIVE DESIGN
   ═══════════════════════════════════════════════════════════════════════════ */

/* Tablet (≤768px) */
@media (max-width: 768px) {
    .disaster-popup .maplibregl-popup-content,
    .disaster-popup .mapboxgl-popup-content {
        min-width: 280px;
        max-width: 92vw;
    }

    .eq-popup-header {
        padding: 16px;
    }

    .eq-popup-body {
        padding: 16px;
    }

    .eq-data-grid {
        gap: 10px;
    }

    .eq-data-item {
        padding: 10px;
    }

    .eq-popup-title {
        font-size: 16px;
    }

    .eq-popup-location {
        font-size: 12px;
    }

    .eq-data-value {
        font-size: 14px;
    }
}

/* Mobile (≤480px) */
@media (max-width: 480px) {
    .disaster-popup .maplibregl-popup-content,
    .disaster-popup .mapboxgl-popup-content {
        min-width: 260px;
        max-width: 95vw;
    }

    .eq-popup-header {
        padding: 14px;
    }

    .eq-popup-body {
        padding: 14px;
    }

    .eq-data-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .eq-magnitude-badge {
        min-width: 32px;
        height: 32px;
        font-size: 15px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   [17] PRINT STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

@media print {
    #loader,
    .mobile-menu,
    .menu-toggle-label,
    #user-menu-container,
    #refresh-data-btn {
        display: none !important;
    }

    #main-content {
        opacity: 1 !important;
        visibility: visible !important;
    }

    .eq-marker,
    .eq-pulse-ring,
    .eq-glow,
    .loader-icon {
        animation: none !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   [18] REDUCED MOTION
   ═══════════════════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   [19] NO-JS FALLBACK
   ═══════════════════════════════════════════════════════════════════════════ */

html:not(.js) #loader {
    display: none;
}

html:not(.js) #main-content {
    opacity: 1;
    visibility: visible;
}

