:root {
    --bg-deep: #05070a;
    --bg-surface: #0a0e14;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --glass: rgba(15, 23, 42, 0.7);
    --border: rgba(255, 255, 255, 0.08);
    
    --mag-minor: #22c55e;
    --mag-moderate: #eab308;
    --mag-major: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Glassmorphism Navigation */
.glass-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--glass);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 2px;
}

.logo h1 span {
    color: var(--accent);
}

.pulse-ring {
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 0 rgba(99, 102, 241, 0.4);
    animation: ring-pulse 2s infinite;
}

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

.stats-overview {
    display: flex;
    gap: 2rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.stat-item .label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.stat-item .value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    font-weight: 600;
}

.stat-item.highlight .value {
    color: var(--mag-major);
}

/* Main Layout */
main {
    display: flex;
    flex: 1;
    position: relative;
}

#map-container {
    flex: 1;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
    background: var(--bg-deep);
}

/* Sidebar */
.sidebar {
    width: 400px;
    background: var(--glass);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--mag-major);
}

.pulse {
    width: 8px;
    height: 8px;
    background: var(--mag-major);
    border-radius: 50%;
    animation: flash 1s infinite alternate;
}

@keyframes flash {
    from { opacity: 1; }
    to { opacity: 0.3; }
}

.quake-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Quake Card */
.quake-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1rem;
    display: flex;
    gap: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.quake-card:hover {
    background: rgba(255, 255, 255, 0.07);
    transform: translateX(-5px);
    border-color: var(--accent);
}

.mag-badge {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 800;
    flex-shrink: 0;
}

.mag-badge.minor { background: rgba(34, 197, 94, 0.1); color: var(--mag-minor); }
.mag-badge.moderate { background: rgba(234, 179, 8, 0.1); color: var(--mag-moderate); }
.mag-badge.major { background: rgba(239, 68, 68, 0.1); color: var(--mag-major); box-shadow: 0 0 15px rgba(239, 68, 68, 0.2); }

.quake-info {
    flex: 1;
}

.quake-info h3 {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.quake-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

/* Legend */
.legend {
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    padding: 1rem;
    border-radius: 1rem;
    z-index: 1000;
    border: 1px solid var(--border);
}

.legend h3 {
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.mag-minor { background: var(--mag-minor); }
.mag-moderate { background: var(--mag-moderate); }
.mag-major { background: var(--mag-major); }

/* Footer */
.glass-footer {
    padding: 0.75rem 2rem;
    background: var(--glass);
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* Leaflet Dark Theme Overrides */
.leaflet-container {
    background: var(--bg-deep) !important;
}

.leaflet-popup-content-wrapper, .leaflet-popup-tip {
    background: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border);
}

/* Mobile and Tablet Responsiveness */
@media (max-width: 1024px) {
    main {
        flex-direction: column;
        overflow-y: auto;
    }

    #map-container {
        height: 50vh;
        flex: none;
    }

    .sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border);
        flex: 1;
        min-height: 500px;
    }

    .legend {
        bottom: 1rem;
        left: 1rem;
        padding: 0.75rem;
        font-size: 0.7rem;
    }

    .legend h3 {
        font-size: 0.7rem;
    }
}

@media (max-width: 640px) {
    .glass-nav {
        padding: 1rem;
    }

    .logo h1 {
        font-size: 1.2rem;
        letter-spacing: 1px;
    }

    .stats-overview {
        gap: 1rem;
    }

    .stat-item .value {
        font-size: 1rem;
    }

    .sidebar-header h2 {
        font-size: 1.2rem;
    }

    body {
        overflow: auto;
    }
    
    #app {
        height: auto;
        min-height: 100vh;
    }
    
    #map-container {
        height: 60vh;
    }
}
