:root {
    --accent-primary: #00e676;
    --accent-secondary: #00bfa5;
    --bg-dark: #0a0e1a;
    --glass-bg: rgba(255,255,255,0.05);
    --glass-border: rgba(255,255,255,0.12);
    --glass-blur: 16px;
}

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

body {
    font-family: 'IBM Plex Sans', sans-serif;
    background: var(--bg-dark);
    color: #e0e0e0;
    overflow-x: hidden;
    min-height: 100vh;
}

.mono { font-family: 'JetBrains Mono', monospace; }

/* Material Symbols config */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24;
    vertical-align: middle;
}
.material-symbols-outlined.filled {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Icon helper */
.icon-sm { font-size: 16px; }
.icon-md { font-size: 20px; }
.icon-lg { font-size: 24px; }
.icon-xl { font-size: 28px; }

/* Animated background */
.bg-mesh {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: 
        radial-gradient(ellipse at 20% 50%, rgba(0,191,165,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(48,79,254,0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(156,39,176,0.05) 0%, transparent 50%);
    animation: meshShift 30s ease-in-out infinite alternate;
}

@keyframes meshShift {
    0% { background-position: 0% 0%, 100% 0%, 50% 100%; }
    50% { background-position: 30% 20%, 70% 40%, 40% 60%; }
    100% { background-position: 10% 40%, 90% 10%, 60% 80%; }
}

/* Dot grid */
.dot-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image: radial-gradient(circle, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 30px 30px;
}

/* Bokeh orbs */
.bokeh-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.3;
    animation: float 20s ease-in-out infinite alternate;
    z-index: 0;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(20px, -30px) scale(1.1); }
    66% { transform: translate(-15px, 20px) scale(0.9); }
    100% { transform: translate(10px, -10px) scale(1.05); }
}

/* Glass panels */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    transition: all 0.3s ease;
}

.glass:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.2);
    transform: scale(1.01);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.glass-static {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: 14px;
}

/* KPI card glow */
.kpi-glow {
    box-shadow: 0 0 20px rgba(var(--glow-color), 0.15), inset 0 0 20px rgba(var(--glow-color), 0.05);
}

/* Pulse animation */
@keyframes pulse-glow {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.pulse { animation: pulse-glow 2s ease-in-out infinite; }
.pulse-fast { animation: pulse-glow 1s ease-in-out infinite; }

/* Sparkline */
.sparkline-path {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: drawLine 1.5s ease forwards;
}

@keyframes drawLine {
    to { stroke-dashoffset: 0; }
}

/* Count up animation helper */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
}

/* Stagger delays */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }
.delay-6 { animation-delay: 0.6s; }
.delay-7 { animation-delay: 0.7s; }
.delay-8 { animation-delay: 0.8s; }

/* Progress ring animation */
@keyframes ring-fill {
    from { stroke-dashoffset: var(--circumference); }
    to { stroke-dashoffset: var(--dash-offset); }
}

/* Bar grow animation */
@keyframes barGrow {
    from { transform: scaleY(0); }
    to { transform: scaleY(1); }
}

.bar-animate {
    transform-origin: bottom;
    animation: barGrow 1s ease forwards;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.02); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* Tab active state */
.tab-active {
    background: rgba(255,255,255,0.1) !important;
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 12px rgba(0,230,118,0.2);
}

/* Domain transition */
.domain-enter {
    animation: domainFadeIn 0.3s ease forwards;
}

@keyframes domainFadeIn {
    from { opacity: 0; filter: blur(4px); }
    to { opacity: 1; filter: blur(0); }
}

/* Map node pulse */
@keyframes nodePulse {
    0%, 100% { r: 4; opacity: 0.8; }
    50% { r: 6; opacity: 1; }
}

/* Status indicator */
@keyframes statusBlink {
    0%, 90%, 100% { opacity: 1; }
    95% { opacity: 0.3; }
}

.status-active { animation: statusBlink 3s ease infinite; }

/* Critical alert */
@keyframes criticalPulse {
    0%, 100% { box-shadow: 0 0 5px rgba(255,23,68,0.3); }
    50% { box-shadow: 0 0 15px rgba(255,23,68,0.6); }
}

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

/* Responsive */
@media (max-width: 768px) {
    .kpi-row { 
        display: flex !important;
        overflow-x: auto;
        padding-bottom: 8px;
        scroll-snap-type: x mandatory;
    }
    .kpi-row > * {
        min-width: 200px;
        scroll-snap-align: start;
    }
}

/* Globe icon pulse */
@keyframes globePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.globe-pulse {
    display: inline-flex;
    animation: globePulse 3s ease-in-out infinite;
}

/* Location dropdown */
.sids-dropdown {
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    color: #fff;
    padding: 8px 36px 8px 12px;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='rgba(255,255,255,0.6)' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 5.5l6.5 6.5 6.5-6.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    min-width: 200px;
    transition: all 0.3s ease;
    outline: none;
}
.sids-dropdown:hover, .sids-dropdown:focus {
    border-color: rgba(255,255,255,0.3);
    background-color: rgba(255,255,255,0.1);
}
.sids-dropdown option {
    background: #141828;
    color: #e0e0e0;
    padding: 6px;
}
.sids-dropdown optgroup {
    background: #0d1020;
    color: rgba(255,255,255,0.5);
    font-weight: 600;
    font-style: normal;
}

/* Source badge */
.source-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.5);
}

/* Donut chart */
@keyframes donutFill {
    from { stroke-dashoffset: var(--circumference); }
}

/* Area chart fill */
@keyframes areaReveal {
    from { clip-path: inset(0 100% 0 0); }
    to { clip-path: inset(0 0 0 0); }
}

.area-reveal {
    animation: areaReveal 1.5s ease forwards;
}

/* Horizontal bar grow */
@keyframes hBarGrow {
    from { width: 0; }
}

.hbar-animate {
    animation: hBarGrow 1s ease forwards;
}

/* Gauge needle */
@keyframes needleSweep {
    from { transform: rotate(-90deg); }
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: modalFadeIn 0.25s ease forwards;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    width: 100%;
    max-width: 680px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    box-shadow: 0 24px 80px rgba(0,0,0,0.5), 0 0 40px rgba(0,230,118,0.05);
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-body {
    overflow-y: auto;
    flex: 1;
}

.modal-body::-webkit-scrollbar { width: 4px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }
.modal-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* Chart tooltip */
.chart-tooltip {
    background: rgba(10, 14, 26, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    padding: 8px 12px;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    z-index: 20;
}

/* Map tooltip */
.map-tooltip {
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.15) !important;
}

/* Module clickable indicator */
.module-clickable {
    transition: all 0.3s ease;
    position: relative;
}

.module-clickable:hover {
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.2);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.module-clickable::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: linear-gradient(135deg, rgba(255,255,255,0.03), transparent);
    pointer-events: none;
}

.module-clickable:hover::after {
    opacity: 1;
}

/* Ocean current animation */
@keyframes oceanFlow {
    from { stroke-dashoffset: 0; }
    to { stroke-dashoffset: -18; }
}

.ocean-current {
    animation: oceanFlow 8s linear infinite;
}

/* Enhanced responsive */
@media (max-width: 640px) {
    .modal-content {
        max-width: 100%;
        max-height: 90vh;
        border-radius: 14px 14px 0 0;
        margin-top: auto;
    }
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }
}