/* ==========================================
   ENERGY FLOW ANIMATION
   ========================================== */
@keyframes dash {
    from {
        stroke-dashoffset: 0;
    }
    to {
        stroke-dashoffset: -100;
    }
}

.flow-path {
    animation: dash 2s linear infinite;
    transition: opacity 0.4s ease-in-out;
}

/* ==========================================
   THEME PALETTE DEFINITIONS
   ========================================== */

/* 1. Oceanic Deep Blue (Default) */
:root, body.theme-ocean {
    --bg-main: #020817;
    --card-bg: #0f172a;
    --card-border: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent-primary: #38bdf8;    /* Ice Blue */
    --accent-secondary: #6366f1; /* Electric Blue */
    --tab-active-bg: #38bdf8;
    --tab-active-text: #020817;
}

/* 2. Emerald Forest (Eco / Sustainable) */
body.theme-forest {
    --bg-main: #022c22;
    --card-bg: #064e3b;
    --card-border: #065f46;
    --text-main: #ecfdf5;
    --text-muted: #6ee7b7;
    --accent-primary: #4ade80;    /* Mint Green */
    --accent-secondary: #2dd4bf; /* Teal */
    --tab-active-bg: #4ade80;
    --tab-active-text: #022c22;
}

/* 3. Cyberpunk Neon (High-Tech & Futuristic) */
body.theme-cyber {
    --bg-main: #030712;
    --card-bg: #0f172a;
    --card-border: #3b82f6;
    --text-main: #f9fafb;
    --text-muted: #a1a1aa;
    --accent-primary: #06b6d4;    /* Neon Cyan */
    --accent-secondary: #ec4899; /* Hot Magenta */
    --tab-active-bg: #06b6d4;
    --tab-active-text: #030712;
}

/* 4. Sunset Solar (Warm & Energetic) */
body.theme-sunset {
    --bg-main: #18120b;
    --card-bg: #231910;
    --card-border: #45321f;
    --text-main: #fef3c7;
    --text-muted: #d97706;
    --accent-primary: #f97316;    /* Sunset Orange */
    --accent-secondary: #eab308; /* Golden Yellow */
    --tab-active-bg: #f97316;
    --tab-active-text: #18120b;
}

/* 5. Midnight Obsidian (OLED Dark) - Added */
body.theme-obsidian {
    --bg-main: #000000;
    --card-bg: #0a0a0a;
    --card-border: #262626;
    --text-main: #ffffff;
    --text-muted: #a3a3a3;
    --accent-primary: #a855f7;    /* Purple */
    --accent-secondary: #3b82f6; /* Blue */
    --tab-active-bg: #a855f7;
    --tab-active-text: #000000;
}


/* ==========================================
   LIGHT THEME PALETTES
   ========================================== */

/* 1. Modern Clean Minimalist (Light) */
body.theme-clean-light {
    --bg-main: #f1f5f9;
    --card-bg: #ffffff;
    --card-border: #cbd5e1;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --accent-primary: #d97706;    /* Amber */
    --accent-secondary: #059669; /* Emerald */
    --tab-active-bg: #0f172a;
    --tab-active-text: #ffffff;
}

/* 2. Soft Warm Ivory (Light) */
body.theme-warm-ivory {
    --bg-main: #f4f1ea;
    --card-bg: #ffffff;
    --card-border: #e2d9cc;
    --text-main: #292524;
    --text-muted: #78716c;
    --accent-primary: #ea580c;    /* Burnt Orange */
    --accent-secondary: #0d9488; /* Teal */
    --tab-active-bg: #292524;
    --tab-active-text: #ffffff;
}

/* ==========================================
   FUTURE LIGHT COMMAND (Sci-Fi Hologram)
   ========================================== */

body.theme-holo-light {
    --bg-main: #f0fdf4;             /* Ultra-light pale mint tint */
    --card-bg: rgba(255, 255, 255, 0.85);/* Frosted holographic glass */
    --card-border: #38bdf8;             /* Bright Cyber Cyan border */
    --text-main: #0c4a6e;               /* Deep futuristic navy/cyan */
    --text-muted: #0369a1;              /* Glowing teal-blue text */
    --accent-primary: #0284c7;          /* Electric Cyan */
    --accent-secondary: #0d9488;        /* Deep Neon Teal */
    --tab-active-bg: #0284c7;
    --tab-active-text: #ffffff;
}

/* Ensure the body and cards utilize the holographic glow effects when active */
body.theme-holo-light .card {
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px 0 rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.4);
}

body.theme-holo-light .tab-btn.active {
    box-shadow: 0 0 12px rgba(2, 132, 199, 0.4);
}

/* ==========================================
   GLOBAL LAYOUT & SEAMLESS SCROLLING
   ========================================== */

body, html {
    min-height: 100vh;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.dashboard-container {
    min-height: 100vh;
    width: 100%;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-sizing: border-box;
    overflow-y: visible !important;
}

.card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 0.85rem;
    padding: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Fluid Stat Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
}

/* Chart card stretches to fill available bottom space cleanly */
.chart-card {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 320px;
    margin-bottom: 0; /* Removes trailing bottom gap */
}

.chart-wrapper {
    flex: 1;
    position: relative;
    width: 100%;
    min-height: 240px;
}

/* Custom styling for active dimension tabs */
.tab-btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--text-main);
    background-color: var(--card-border);
}

.tab-btn.active {
    color: var(--tab-active-text);
    background-color: var(--tab-active-bg);
}

/* Hide scrollbar for Chrome, Safari and Opera */
html::-webkit-scrollbar,
body::-webkit-scrollbar,
.dashboard-container::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
html,
body,
.dashboard-container {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}