/* Custom variables for a premium, dark-themed dashboard */
:root {
    --bg-dark: #0f111a;
    --panel-bg: rgba(22, 28, 45, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --accent-color: #94a3b8; /* Muted slate gray */
    --accent-hover: #cbd5e1; /* Light silver slate */
    --danger-color: #ef4444; /* Bright Red */
    --warning-color: #f59e0b; /* Amber */
    --success-color: #10b981; /* Emerald */
    --font-stack: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Base styles and resets */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
    overflow: hidden;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-stack);
    overflow: hidden;
    height: 100vh;
    height: 100dvh; /* fit the actually-visible viewport on mobile (toolbars) */
    width: 100%;
    max-width: 100%;
}

/* App Container Layout */
.app-container {
    display: flex;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.03), transparent 60%);
}

/* Sidebar Styling */
.sidebar {
    width: 380px;
    min-width: 350px;
    height: 100%;
    background-color: rgba(15, 17, 26, 0.95);
    border-right: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

/* Floating "About" button, bottom-left of the map (desktop only) */
.about-fab {
    position: absolute;
    bottom: 14px;
    left: 14px;
    z-index: 1000;
    background: rgba(15, 17, 26, 0.9);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(8px);
    border-radius: 30px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 15px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.about-fab:hover {
    color: var(--text-primary);
    border-color: var(--accent-color);
}

.about-fab i {
    color: var(--accent-color);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 27px;
    color: var(--danger-color);
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.logo-img {
    width: 34px;
    height: 34px;
    object-fit: contain;
    flex-shrink: 0;
    display: block;
}

.logo-area h1 {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0;
    min-width: 0;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Pulse Ring for logo animation */
.pulse-ring {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: var(--danger-color);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    animation: pulse 1.8s infinite;
    top: 32px;
    left: 20px;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Filters & Analytics Content Panels */
.control-panel {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    flex-shrink: 0;
}

.panel-section h3 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-section h3 i {
    color: var(--accent-color);
}

/* Form inputs & controls */
.filter-group {
    margin-bottom: 18px;
}

.filter-group label {
    display: block;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.filter-group label span {
    float: right;
    font-weight: 600;
    color: var(--accent-color);
}

input[type="range"] {
    width: 100%;
    accent-color: var(--accent-color);
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
}

select {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
    font-size: 16px;
    transition: all 0.2s ease;
}

select:focus {
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.03);
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.range-inputs input {
    width: 35%;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    text-align: center;
}

.range-inputs span {
    color: var(--text-secondary);
    font-size: 13px;
}

.time-presets {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.03);
    padding: 2px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.preset-btn {
    flex: 1;
    background: transparent;
    border: 1px solid transparent;
    padding: 5px 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    text-align: center;
}

.preset-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.preset-btn.active {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.range-inputs.hidden {
    display: none !important;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-color);
    color: var(--text-primary);
}


/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    text-align: center;
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative; /* positioning context for the About pop-out */
}

/* About pop-out modal (overlays the map / main area) */
.about-modal {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 1200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.about-modal.open {
    display: flex;
    animation: about-fade 0.2s ease;
}

@keyframes about-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.about-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 10, 16, 0.72);
    backdrop-filter: blur(3px);
}

.about-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    max-height: 100%;
    overflow-y: auto;
    background: #121624;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    padding: 24px 26px;
    color: var(--text-secondary);
    line-height: 1.55;
    font-size: 14px;
}

.about-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: all 0.2s ease;
}

.about-close:hover {
    color: #ffffff;
    border-color: var(--accent-color);
}

.about-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 19px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 14px;
    padding-right: 36px;
}

.about-logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.about-card p {
    margin-bottom: 12px;
}

.about-card a {
    color: var(--accent-hover);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.about-card a:hover {
    color: #ffffff;
}

.about-sources {
    margin-top: 16px;
}

.about-sources h3 {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: none;
    color: var(--accent-color);
    margin-bottom: 8px;
}

.about-sources ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.about-sources li {
    padding: 3px 0 3px 16px;
    position: relative;
    color: var(--text-primary);
}

.about-sources li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 11px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent-color);
}

.about-sep {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 18px 0 14px;
}

.about-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.about-home {
    font-weight: 600;
}

.about-social {
    display: flex;
    align-items: center;
    gap: 12px;
}

.about-social-link {
    color: var(--text-secondary);
    font-size: 20px;
    text-decoration: none !important;
    transition: color 0.2s ease, transform 0.2s ease;
}

.about-social-link:hover {
    color: #ffffff;
    transform: translateY(-1px);
}

/* Map Container styling */
.map-container {
    flex-grow: 1;
    width: 100%;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

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

/* Adjusting Leaflet controls to look more premium */
.leaflet-bar {
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

.leaflet-bar a {
    background-color: var(--bg-dark) !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border-color) !important;
    transition: background-color 0.2s;
}

.leaflet-bar a:hover {
    background-color: #1a1e2e !important;
}

.leaflet-popup-content-wrapper {
    background: rgba(15, 17, 26, 0.95) !important;
    border: 1px solid var(--border-color) !important;
    backdrop-filter: blur(8px);
    color: var(--text-primary) !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5) !important;
    max-width: 280px !important;
}

.leaflet-popup-content {
    margin: 8px 12px !important;
    line-height: 1.3 !important;
}

.leaflet-popup-close-button {
    color: var(--text-secondary) !important;
    padding: 6px 6px 0 0 !important;
    transition: color 0.2s ease;
}

.leaflet-popup-close-button:hover {
    color: #ffffff !important;
}

.leaflet-popup-tip {
    background: rgba(15, 17, 26, 0.95) !important;
    border-left: 1px solid var(--border-color) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

/* Leaflet Attribution control customization */
.leaflet-control-attribution {
    background: rgba(15, 17, 26, 0.75) !important;
    color: var(--accent-color) !important;
}

.leaflet-control-attribution a {
    color: var(--text-secondary) !important;
}

.leaflet-control-attribution a:hover {
    color: var(--text-primary) !important;
}

.leaflet-attribution-flag {
    display: none !important;
}

/* Custom Quake Marker Icon */
.custom-quake-icon {
    display: flex !important;
    justify-content: center;
    align-items: center;
    background: transparent !important;
    border: none !important;
}

.quake-dot {
    border-radius: 50%;
    transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1);
    flex-shrink: 0;
    box-sizing: border-box;
}

.custom-quake-icon:hover .quake-dot {
    transform: scale(1.15);
}

/* Custom Popup Styles */
.custom-popup {
    padding: 0;
    font-family: var(--font-stack);
}

.popup-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--danger-color);
    display: flex;
    align-items: center;
    gap: 4px;
}

.popup-details {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 12px;
    color: var(--text-secondary);
}

.popup-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.popup-source-link {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 2px;
}

.popup-source-link a {
    color: var(--accent-hover);
    text-decoration: none;
}

.popup-source-link a:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* Map Overlay Card */
.map-overlay-card {
    position: absolute;
    bottom: 14px;
    right: 14px;
    z-index: 1000;
    pointer-events: none;
}

.connection-status {
    background: rgba(15, 17, 26, 0.9);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(8px);
    padding: 10px 16px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-color);
}

.status-dot.fresh {
    background-color: var(--success-color);
}

.status-dot.pulsing {
    animation: statusPulse 1.5s infinite alternate;
}

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

.status-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Bottom Dashboard Panels */
.dashboard-visuals {
    height: calc(30% + 15px);
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow: hidden;
    position: relative;
    border-top: 1px solid var(--border-color);
    transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000; /* Ensure it is clickable over the Leaflet map container */
}

.dashboard-visuals.collapsed {
    height: 24px !important;
    flex: none !important;
    min-height: 24px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

/* Panel Drag Handle */
.panel-drag-handle {
    width: 100%;
    height: 24px;
    background: rgba(22, 28, 45, 0.4);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: ns-resize;
    user-select: none;
    transition: background 0.2s ease;
    z-index: 10;
    flex-shrink: 0;
    touch-action: none; /* Crucial: prevents browser scroll from canceling touchmove swipes */
}

.panel-drag-handle:hover {
    background: rgba(22, 28, 45, 0.6);
}

.handle-bar {
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
    transition: background 0.2s ease, transform 0.2s ease;
}

.panel-drag-handle:hover .handle-bar {
    background: rgba(255, 255, 255, 0.45);
}

.dashboard-visuals.collapsed .handle-bar,
.seismic-log-panel.collapsed .handle-bar {
    transform: scaleX(1.2);
    background: var(--warning-color);
}

.visual-panel {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    overflow: hidden;
}

.visual-panel:last-child {
    border-right: none;
}

.panel-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(22, 28, 45, 0.2);
}

.panel-header h2 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-header h2 i {
    color: var(--accent-color);
}

.header-stats {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.stat-badge {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.stat-badge span {
    color: var(--text-primary);
    font-weight: 700;
}

.stat-badge i {
    color: var(--accent-color);
    font-size: 12px;
}

.stat-badge.warning {
    border-color: rgba(245, 158, 11, 0.2);
    background: rgba(245, 158, 11, 0.05);
    color: var(--warning-color);
}

.stat-badge.warning span {
    color: var(--warning-color);
}

.stat-badge.warning i {
    color: var(--warning-color);
}


/* Custom Interactive Chart Legend */
.custom-chart-legend {
    display: flex;
    gap: 16px;
    align-items: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    transition: opacity 0.2s ease;
}

.legend-item:hover {
    color: var(--text-primary);
}

.legend-item.dimmed {
    opacity: 0.3;
    text-decoration: line-through;
}

.legend-color-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.legend-color-box.count-box {
    width: 18px;
    height: 18px;
    background-color: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 3.5px;
}

.legend-color-box.mag-line-circle {
    width: 24px;
    height: 18px;
}

.legend-color-box.mag-line-circle .line {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 2px;
    background-color: var(--danger-color);
    transform: translateY(-50%);
}

.legend-color-box.mag-line-circle .circle {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 4px;
    height: 4px;
    background-color: var(--danger-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

/* Chart Canvas container */
.chart-container {
    flex-grow: 1;
    padding: 16px 24px;
    position: relative;
    max-height: calc(100% - 50px);
}

/* Table styling */
.table-container {
    flex-grow: 1;
    overflow-y: auto;
    max-height: calc(100% - 50px);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
    text-align: left;
}

.data-table th {
    position: sticky;
    top: 0;
    background-color: #121624;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.data-table th:hover {
    color: var(--text-primary);
}

.data-table td {
    padding: 12px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
}

.data-table tbody tr {
    cursor: pointer;
    transition: background-color 0.2s;
}

.data-table tbody tr:hover {
    background-color: rgba(52, 211, 153, 0.06);
}

.data-table tbody tr.active-row {
    background-color: rgba(52, 211, 153, 0.12) !important;
}

.data-table tbody tr.active-row td {
    color: var(--text-primary);
}

.mag-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 12px;
    text-align: center;
}

.mag-badge.low {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--success-color);
}

.mag-badge.mid {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--warning-color);
}

.mag-badge.high {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--danger-color);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

.mag-badge.unknown {
    background-color: rgba(156, 163, 175, 0.15);
    color: var(--text-secondary);
}

.loading-cell {
    text-align: center;
    padding: 40px !important;
    color: var(--text-secondary);
    font-style: italic;
}

/* Custom Scrollbar for premium look */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Seismic log sidebar panel styling */
.seismic-log-panel {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-top: 1px solid var(--border-color);
    transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1), min-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.seismic-log-panel.collapsed {
    height: 24px !important;
    min-height: 24px !important;
    flex: none !important;
    overflow: hidden !important;
}

.seismic-log-header {
    padding: 10px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background: rgba(22, 28, 45, 0.2);
}

/* Event count, shown on the same row as the sort controls */
.log-count {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.3px;
}

.log-title-area {
    display: flex;
    align-items: center;
    gap: 8px;
}

.seismic-log-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.seismic-log-header h3 i {
    color: var(--accent-color);
}

.total-events-text {
    font-size: 12px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.45);
}

.sorting-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sorting-controls span {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    font-weight: 500;
}

.sort-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.45);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sort-btn:hover {
    border-color: var(--accent-color);
    color: var(--text-primary);
}

.sort-btn.active {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.seismic-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.seismic-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: rgba(22, 28, 45, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.seismic-item:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.03);
}

.seismic-item.selected {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.02);
}

.seismic-mag-col {
    display: flex;
    align-items: center;
    justify-content: center;
}

.mag-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
}

.mag-circle.low {
    background-color: var(--success-color);
}

.mag-circle.mid {
    background-color: var(--warning-color);
}

.mag-circle.high {
    background-color: var(--danger-color);
}

.mag-circle.unknown {
    background-color: #6b7280;
}

.seismic-info-col {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.seismic-place {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.seismic-meta {
    font-size: 11px;
    color: var(--text-secondary);
}

.loading-text {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    padding: 20px 0;
}

/* Mobile Responsiveness styling */
.mobile-tabs {
    display: none;
}

/* Desktop: collapsing/dragging panels is a mobile affordance only, so the
   drag handle is hidden and the sidebar log fills the available space. */
@media (min-width: 1025px) {
    .panel-drag-handle {
        display: none;
    }
}

@media (max-width: 1024px) {
    body {
        overflow: hidden;
        height: 100vh;
        height: 100dvh;
        width: 100vw;
    }

    .app-container {
        flex-direction: column;
        height: 100vh;
        height: 100dvh;
        width: 100vw;
        overflow: hidden;
        position: relative;
    }

    .sidebar {
        display: contents;
    }

    .sidebar-header {
        order: 1;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 16px;
        min-height: 48px;
        flex-shrink: 0;
        background-color: rgba(15, 17, 26, 0.95);
        border-bottom: 1px solid var(--border-color);
        position: relative;
        z-index: 200;
    }

    .sidebar-header .logo-area {
        margin-bottom: 0;
        gap: 8px;
    }

    .sidebar-header .logo-area h1 {
        font-size: clamp(12.5px, 4vw, 16px);
        white-space: nowrap;
        line-height: 1.2;
        overflow: visible;
    }

    .sidebar-header .logo-icon {
        font-size: 16px;
    }

    .sidebar-header .logo-img {
        width: 26px;
        height: 26px;
    }

    .sidebar-header .pulse-ring {
        display: none;
    }

    .sidebar-header .subtitle {
        display: none;
    }

    /* Mobile Tab Navigation */
    .mobile-tabs {
        order: 2;
        display: flex;
        height: 44px;
        background-color: #121624;
        border-bottom: 1px solid var(--border-color);
        flex-shrink: 0;
        z-index: 100;
    }

    .tab-link {
        flex: 1;
        background: transparent;
        border: none;
        border-bottom: 2px solid transparent;
        color: var(--text-secondary);
        font-size: 12px;
        font-weight: 600;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
        transition: all 0.2s ease;
    }

    /* The desktop floating About button is replaced by the About tab on mobile */
    .about-fab {
        display: none;
    }

    /* Full-screen pop-out on mobile so the card has room to breathe */
    .about-modal {
        position: fixed;
        z-index: 2000;
    }

    .tab-link:hover {
        color: var(--text-primary);
    }

    .tab-link.active {
        color: var(--accent-color);
        border-bottom-color: var(--accent-color);
    }

    .tab-link#mobile-filter-toggle.active {
        color: var(--accent-color);
        background: rgba(255, 255, 255, 0.06);
    }

    /* main-content holds the map and timeline chart */
    .main-content {
        order: 4;
        min-height: 0;
        display: flex;
        flex-direction: column;
        background-color: var(--bg-dark);
    }

    /* Overlay the recent-quake notice on top of the map instead of letting it
       push the map/panels down and eat vertical space. */
    #recent-alert-container {
        position: absolute;
        top: 92px; /* 48px header + 44px tab bar */
        left: 0;
        right: 0;
        z-index: 1015; /* above map + zoom (1000), below filter overlay (1020) */
    }

    .map-container {
        min-height: 180px;
        height: auto;
        border-bottom: 1px solid var(--border-color);
    }

    .map-overlay-card {
        bottom: 10px;
        right: 10px;
    }

    .connection-status {
        padding: 7px 12px;
    }

    .connection-status .status-text {
        font-size: 12px;
    }

    /* Collapsible Filter Panel as a drop-down overlay */
    .control-panel {
        order: 6;
        display: none;
        position: absolute;
        top: 92px; /* 48px header + 44px tab bar */
        left: 0;
        right: 0;
        z-index: 1020; /* Keep above Leaflet zoom buttons (1000) and recent alert banner */
        background: rgba(15, 17, 26, 0.98);
        border-top: none;
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
        padding: 16px;
        backdrop-filter: blur(20px);
        gap: 0;
    }

    .control-panel.show-filters {
        display: block;
        animation: slideDown 0.25s ease forwards;
    }

    @keyframes slideDown {
        from { transform: translateY(-10px); opacity: 0; }
        to { transform: translateY(0); opacity: 1; }
    }

    .control-panel .panel-section {
        width: 100%;
    }

    .control-panel .panel-section h3 {
        display: none;
    }

    /* 2-column grid for mobile filters, year range spanning full width */
    @media (max-width: 600px) {
        .control-panel .panel-section {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
        }

        .control-panel .filter-group {
            margin-bottom: 0;
        }

        .control-panel .filter-group:last-child {
            grid-column: span 2;
        }
    }

    /* 3-column layout for tablet filters */
    @media (min-width: 601px) {
        .control-panel .panel-section {
            display: grid;
            grid-template-columns: 1fr 1fr 1.2fr;
            gap: 16px;
        }

        .control-panel .filter-group {
            margin-bottom: 0;
        }
    }

    .filter-group label {
        font-size: 12px;
        margin-bottom: 4px;
    }

    select {
        padding: 6px 10px;
        font-size: 13px;
    }

    .range-inputs input {
        padding: 6px;
        font-size: 13px;
    }

    .btn-icon {
        width: 30px;
        height: 30px;
        padding: 6px;
    }

    /* Tab Log Layout Configuration */
    .app-container.tab-log .seismic-log-panel {
        order: 5;
        display: flex;
        flex: 1;
        min-height: 0;
        background-color: rgba(15, 17, 26, 0.95);
        border-top: 1px solid var(--border-color);
        transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1), min-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .app-container.tab-log .main-content {
        flex: 1;
    }

    .app-container.tab-log .main-content .dashboard-visuals {
        display: none !important;
    }

    .app-container.tab-log .main-content .map-container {
        flex: 1;
        height: 100%;
        border-bottom: none;
    }

    /* Tab Chart Layout Configuration */
    .app-container.tab-chart .seismic-log-panel {
        display: none !important;
    }

    .app-container.tab-chart .main-content {
        flex: 2;
    }

    .app-container.tab-chart .main-content .map-container {
        flex: 1;
        min-height: 160px;
        border-bottom: none;
    }

    .app-container.tab-chart .main-content .dashboard-visuals {
        display: flex !important;
        flex: 1;
        min-height: 140px;
    }

    .visual-panel {
        height: 100%;
        border-right: none;
        border-bottom: none;
    }

    .panel-header {
        padding: 8px 16px;
        flex-wrap: wrap;
        gap: 4px 12px;
    }

    .panel-header h2 {
        font-size: 13px;
    }

    .custom-chart-legend {
        gap: 12px;
        flex-wrap: wrap;
    }

    .chart-container {
        padding: 6px 16px;
    }

    .seismic-log-panel {
        display: flex;
        flex-direction: column;
    }

    .seismic-log-header {
        padding: 8px 16px;
        flex-wrap: wrap;
        gap: 6px 12px;
    }

    .sorting-controls {
        padding: 0;
    }

    .seismic-list {
        padding: 8px 16px;
        gap: 6px;
    }

    .seismic-item {
        padding: 8px 12px;
        gap: 10px;
    }

    .mag-circle {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .seismic-place {
        font-size: 12px;
    }

    .seismic-meta {
        font-size: 10px;
    }

    .sidebar-footer {
        display: none;
    }
}

/* Recent Alert Banner */
.recent-alert-banner {
    margin: 12px 24px 4px 24px;
    padding: 12px 14px;
    background: #2a1318;
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 8px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: alert-slide-down 0.4s ease-out;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.recent-alert-banner:hover {
    border-color: rgba(239, 68, 68, 0.7);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    transform: translateY(-1px);
}

.recent-alert-icon {
    color: var(--danger-color);
    font-size: 17px;
    margin-top: 1px;
    text-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

.recent-alert-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-grow: 1;
}

.recent-alert-title {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.recent-alert-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.35;
}

.recent-alert-time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 2px;
}

.recent-alert-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-size: 16px;
    padding: 2px 6px;
    margin-top: -2px;
    margin-right: -4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.recent-alert-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

/* Radio-wave pulse marker for recent quakes */
.pulsing-gps-marker {
    background: transparent !important;
    border: none !important;
}

.gps-pulse {
    position: relative;
    width: 100px;
    height: 100px;
    pointer-events: none;
}

/* Solid centre dot */
.gps-pulse .core {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;
    border-radius: 50%;
}

/* Expanding rings (radio waves) */
.gps-pulse .wave {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 100px;
    height: 100px;
    margin: -50px 0 0 -50px;
    border-radius: 50%;
    border: 2.5px solid;
    opacity: 0;
    transform: scale(0.12);
    animation: radio-wave 2.4s ease-out infinite;
}

.gps-pulse.pulse-high .core { background: #ef4444; box-shadow: 0 0 12px #ef4444; }
.gps-pulse.pulse-high .wave { border-color: #ef4444; }
.gps-pulse.pulse-mid .core { background: #f59e0b; box-shadow: 0 0 12px #f59e0b; }
.gps-pulse.pulse-mid .wave { border-color: #f59e0b; }
.gps-pulse.pulse-low .core { background: #10b981; box-shadow: 0 0 12px #10b981; }
.gps-pulse.pulse-low .wave { border-color: #10b981; }

/* Desktop-specific adjustments to make recent quakes more visible */
@media (min-width: 1025px) {
    .gps-pulse .wave {
        animation: radio-wave-desktop 2.2s ease-out infinite;
    }
}

@keyframes radio-wave-desktop {
    0%   { transform: scale(0.12); opacity: 1; }
    50%  { opacity: 0.5; }
    100% { transform: scale(2.0); opacity: 0; }
}

@keyframes radio-wave {
    0%   { transform: scale(0.12); opacity: 0.9; }
    70%  { opacity: 0.12; }
    100% { transform: scale(1); opacity: 0; }
}

@keyframes alert-slide-down {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes alert-icon-pulse {
    from {
        opacity: 0.7;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1.1);
    }
}

@keyframes pulse-emit-red {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }
    100% {
        transform: scale(4.5);
        opacity: 0;
    }
}

@keyframes pulse-emit-amber {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }
    100% {
        transform: scale(4.5);
        opacity: 0;
    }
}

@keyframes pulse-emit-emerald {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }
    100% {
        transform: scale(4.5);
        opacity: 0;
    }
}

@media (max-width: 1024px) {
    /* Overlaid on the map — solid background + strong shadow for legibility */
    .recent-alert-banner {
        margin: 10px 12px;
        padding: 10px 12px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
    }
}

/* Respect users who opt out of animation (stops the pulse rings, status dot
   pulsing and panel/marker transitions) */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
