/* ============================================
   MICROGRID SIMULATOR v4.0 - PREMIUM STYLES
   Advanced CSS with 3D Effects, Animations
   ============================================ */

/* ===== CSS VARIABLES ===== */
:root {
    /* Primary Colors */
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    
    /* Energy Colors */
    --solar: #fbbf24;
    --solar-glow: rgba(251, 191, 36, 0.5);
    --battery: #10b981;
    --battery-glow: rgba(16, 185, 129, 0.5);
    --grid: #ef4444;
    --grid-glow: rgba(239, 68, 68, 0.5);
    --diesel: #f97316;
    --load: #ffffff;
    
    /* Background */
    --bg-dark: #0a0f1a;
    --bg-medium: #111827;
    --bg-light: #1f2937;
    --bg-card: rgba(17, 24, 39, 0.8);
    
    /* Glass Effect */
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-hover: rgba(255, 255, 255, 0.06);
    
    /* Text */
    --text-white: #f9fafb;
    --text-light: #e5e7eb;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;
    
    /* Effects */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Rajdhani', sans-serif;
    background: var(--bg-dark);
    color: var(--text-white);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Background Grid Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        linear-gradient(rgba(99, 102, 241, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
}

/* ===== LOADING SCREEN ===== */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-dark), var(--bg-medium));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.5s, visibility 0.5s;
}

#loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-content {
    text-align: center;
}

.energy-loader {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 30px;
}

.loader-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 3px solid transparent;
    animation: loader-spin 1.5s linear infinite;
}

.loader-ring:nth-child(1) {
    width: 100px;
    height: 100px;
    border-top-color: var(--primary);
    animation-duration: 1.5s;
}

.loader-ring:nth-child(2) {
    width: 80px;
    height: 80px;
    border-right-color: var(--solar);
    animation-duration: 1.2s;
    animation-direction: reverse;
}

.loader-ring:nth-child(3) {
    width: 60px;
    height: 60px;
    border-bottom-color: var(--battery);
    animation-duration: 0.9s;
}

.loader-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    color: var(--solar);
    animation: pulse-glow 1s ease-in-out infinite;
}

@keyframes loader-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes pulse-glow {
    0%, 100% { 
        opacity: 0.5;
        filter: drop-shadow(0 0 5px var(--solar));
    }
    50% { 
        opacity: 1;
        filter: drop-shadow(0 0 20px var(--solar));
    }
}

.loader-content h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    letter-spacing: 4px;
    color: var(--primary-light);
    margin-bottom: 10px;
}

.loader-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.loader-bar {
    width: 200px;
    height: 4px;
    background: var(--bg-light);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin: 0 auto;
}

.loader-progress {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--solar));
    border-radius: var(--radius-full);
    transition: width 0.3s;
}

/* ===== ACHIEVEMENT POPUP ===== */
.achievement-popup {
    position: fixed;
    top: 20px;
    right: -400px;
    background: linear-gradient(135deg, var(--bg-light), var(--bg-medium));
    border: 1px solid var(--solar);
    border-radius: var(--radius-lg);
    padding: 15px 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 9999;
    box-shadow: 0 10px 40px rgba(251, 191, 36, 0.3);
    transition: right 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.achievement-popup.show {
    right: 20px;
}

.achievement-glow {
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, var(--solar), var(--primary), var(--solar));
    border-radius: var(--radius-lg);
    z-index: -1;
    opacity: 0.5;
    filter: blur(10px);
    animation: achievement-glow 2s ease-in-out infinite;
}

@keyframes achievement-glow {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

.achievement-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--solar), #f59e0b);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #111;
    animation: bounce-icon 0.5s ease;
}

@keyframes bounce-icon {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.achievement-title {
    display: block;
    font-size: 0.75rem;
    color: var(--solar);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.achievement-name {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-white);
}

/* ===== TUTORIAL OVERLAY ===== */
.tutorial-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    backdrop-filter: blur(10px);
}

.tutorial-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 40px;
    max-width: 500px;
    text-align: center;
    animation: fade-in-up 0.5s ease;
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tutorial-icon {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.tutorial-step h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.tutorial-step p {
    color: var(--text-muted);
}

.tutorial-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 30px;
    gap: 15px;
}

.tutorial-dots {
    display: flex;
    gap: 8px;
}

.tutorial-dots .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bg-light);
    cursor: pointer;
    transition: var(--transition-normal);
}

.tutorial-dots .dot.active {
    background: var(--primary);
    transform: scale(1.2);
}

/* ===== APP WRAPPER ===== */
.app-wrapper {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 15px;
    gap: 15px;
}

/* ===== HEADER HUD ===== */
.hud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    padding: 12px 25px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-icon-wrapper {
    position: relative;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon-wrapper i {
    font-size: 1.8rem;
    color: var(--solar);
    filter: drop-shadow(0 0 10px var(--solar));
    animation: electric-pulse 2s ease-in-out infinite;
}

@keyframes electric-pulse {
    0%, 100% { 
        filter: drop-shadow(0 0 5px var(--solar));
        transform: scale(1);
    }
    50% { 
        filter: drop-shadow(0 0 20px var(--solar));
        transform: scale(1.1);
    }
}

.logo-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--solar);
    animation: pulse-ring 2s ease-out infinite;
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.logo-text h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 2px;
    line-height: 1.2;
}

.logo-text h1 span {
    color: var(--primary-light);
}

.logo-text p {
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 3px;
    text-transform: uppercase;
}

/* Day Navigation */
.day-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--glass);
    padding: 8px 15px;
    border-radius: var(--radius-full);
    border: 1px solid var(--glass-border);
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.nav-btn:hover {
    color: var(--text-white);
    background: var(--glass-hover);
}

.day-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 50px;
}

.day-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    letter-spacing: 2px;
}

.day-number {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary-light);
}

/* HUD Stats */
.hud-stats {
    display: flex;
    gap: 20px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    background: var(--glass);
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    transition: var(--transition-normal);
}

.stat-item:hover {
    background: var(--glass-hover);
    transform: translateY(-2px);
}

.stat-icon {
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 1rem;
}

.clock-stat .stat-icon {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-light);
}

.cost-stat .stat-icon {
    background: rgba(239, 68, 68, 0.2);
    color: var(--grid);
}

.energy-stat .stat-icon {
    background: rgba(251, 191, 36, 0.2);
    color: var(--solar);
}

.eco-stat .stat-icon {
    background: rgba(16, 185, 129, 0.2);
    color: var(--battery);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-info .label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-info .value {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    font-weight: 700;
}

/* Achievement Badge */
.achievement-badge {
    position: relative;
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--solar), #f59e0b);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: 0 4px 15px rgba(251, 191, 36, 0.4);
}

.achievement-badge:hover {
    transform: scale(1.1) rotate(10deg);
}

.achievement-badge i {
    font-size: 1.3rem;
    color: #111;
}

.achievement-badge span {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== MAIN LAYOUT ===== */
/* Note: Additional .main-layout rules in FULLSCREEN MODE section for !important overrides */

/* ===== VISUALIZATION SECTION ===== */
/* Note: Additional .vis-section rules in FULLSCREEN MODE section */
.vis-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* ===== ENVIRONMENT BOX (3D Village) ===== */
.environment-box {
    position: relative;
    height: 320px;
    background: linear-gradient(180deg, #1a1f35 0%, #0f1424 100%);
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    transition: background 1s ease;
}

/* Weather States */
.environment-box.env-sunny {
    background: linear-gradient(180deg, #1e3a5f 0%, #0f172a 100%);
}

.environment-box.env-cloudy {
    background: linear-gradient(180deg, #374151 0%, #1f2937 100%);
}

.environment-box.env-rainy {
    background: linear-gradient(180deg, #1e1b4b 0%, #0c0a1d 100%);
}

/* Time Indicator */
.time-indicator {
    position: absolute;
    top: 15px;
    left: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: var(--radius-full);
    backdrop-filter: blur(10px);
    z-index: 20;
}

.time-icons {
    display: flex;
    gap: 5px;
}

.time-sun, .time-moon {
    font-size: 1rem;
    transition: var(--transition-normal);
}

.time-sun {
    color: var(--solar);
    opacity: 1;
}

.time-moon {
    color: #a5b4fc;
    opacity: 0.3;
}

.time-indicator.night .time-sun {
    opacity: 0.3;
}

.time-indicator.night .time-moon {
    opacity: 1;
}

#time-period {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
}

/* Sun/Moon Orbit */
.sun-orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 450px;
    height: 250px;
    transform: translate(-50%, -60%);
    pointer-events: none;
    z-index: 5;
}

.celestial-body {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    transition: transform 0.5s ease;
}

.sun-icon {
    font-size: 3rem;
    color: var(--solar);
    filter: drop-shadow(0 0 30px var(--solar));
    animation: sun-pulse 3s ease-in-out infinite;
}

.moon-icon {
    position: absolute;
    top: 0;
    left: 0;
    font-size: 2.5rem;
    color: #e2e8f0;
    filter: drop-shadow(0 0 20px rgba(226, 232, 240, 0.5));
    opacity: 0;
    transition: opacity 0.5s;
}

@keyframes sun-pulse {
    0%, 100% { 
        transform: scale(1);
        filter: drop-shadow(0 0 20px var(--solar));
    }
    50% { 
        transform: scale(1.1);
        filter: drop-shadow(0 0 40px var(--solar));
    }
}

/* Stars */
.stars-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1s;
}

.stars-container.visible {
    opacity: 1;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    animation: twinkle 2s ease-in-out infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* Rain Effect */
.rain {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s;
}

.rain.active {
    opacity: 1;
}

.rain-drop {
    position: absolute;
    width: 2px;
    height: 20px;
    background: linear-gradient(transparent, rgba(255, 255, 255, 0.5));
    animation: rain-fall linear infinite;
}

@keyframes rain-fall {
    0% {
        transform: translateY(-20px);
        opacity: 0;
    }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% {
        transform: translateY(320px);
        opacity: 0;
    }
}

/* Clouds */
.clouds {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s;
}

.clouds.active {
    opacity: 1;
}

.cloud {
    position: absolute;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    filter: blur(5px);
    animation: cloud-float linear infinite;
}

@keyframes cloud-float {
    from { transform: translateX(-200px); }
    to { transform: translateX(calc(100vw + 200px)); }
}

/* Lightning */
.lightning {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: rgba(255, 255, 255, 0);
    transition: background 0.1s;
}

.lightning.flash {
    background: rgba(255, 255, 255, 0.3);
}

/* Energy Particles Canvas */
#energy-particles-canvas {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 15;
}

/* Weather Badge */
.env-weather-display {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: var(--radius-full);
    backdrop-filter: blur(10px);
    z-index: 20;
}

.env-weather-display i {
    font-size: 1.2rem;
}

#env-weather-label {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1px;
}

#env-temp {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--solar);
}

/* Data Source Badge */
.data-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    backdrop-filter: blur(10px);
    z-index: 20;
    transition: all var(--transition-normal);
}

.data-badge.authentic {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.3), rgba(16, 185, 129, 0.1));
    border: 1px solid rgba(16, 185, 129, 0.5);
    color: #10b981;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
    animation: authenticPulse 2s ease-in-out infinite;
}

.data-badge.simulated {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.3), rgba(251, 191, 36, 0.1));
    border: 1px solid rgba(251, 191, 36, 0.5);
    color: #fbbf24;
}

.data-badge i {
    font-size: 0.8rem;
}

@keyframes authenticPulse {
    0%, 100% { box-shadow: 0 0 15px rgba(16, 185, 129, 0.2); }
    50% { box-shadow: 0 0 25px rgba(16, 185, 129, 0.4); }
}

/* Real Data Indicators */
.real-data-indicators {
    position: absolute;
    bottom: 15px;
    left: 15px;
    display: grid;
    grid-template-columns: repeat(3, auto);
    gap: 6px;
    max-width: 340px;
    z-index: 20;
}

.real-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: var(--radius-sm);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-light);
    transition: all var(--transition-fast);
    white-space: nowrap;
    overflow: hidden;
}

.real-indicator:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
}

.real-indicator i {
    font-size: 0.8rem;
    width: 14px;
    text-align: center;
    flex-shrink: 0;
}

.real-indicator i.fa-thermometer-half { color: #ef4444; }
.real-indicator i.fa-tint { color: #3b82f6; }
.real-indicator i.fa-wind { color: #8b5cf6; }
.real-indicator i.fa-sun { color: #fbbf24; }
.real-indicator i.fa-wave-square { color: #10b981; }
.real-indicator i.fa-bolt { color: #f97316; }

.real-indicator span {
    font-family: 'Orbitron', monospace;
    font-size: 0.65rem;
    min-width: 45px;
    text-overflow: ellipsis;
    overflow: hidden;
}

/* Efficiency Ring */
.efficiency-ring {
    position: absolute;
    top: 60px;
    right: 15px;
    width: 80px;
    height: 80px;
    z-index: 20;
}

.efficiency-ring svg {
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: var(--bg-light);
    stroke-width: 8;
}

.ring-fill {
    fill: none;
    stroke: var(--battery);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 251;
    stroke-dashoffset: 251;
    transition: stroke-dashoffset 0.5s ease;
    filter: drop-shadow(0 0 5px var(--battery));
}

.efficiency-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.efficiency-value span {
    display: block;
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--battery);
}

.efficiency-value small {
    font-size: 0.6rem;
    color: var(--text-muted);
    letter-spacing: 1px;
}

/* Appliance Board */
.appliance-board {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 20;
}

.appliance-icons {
    display: flex;
    gap: 8px;
}

.app-icon {
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: 0.9rem;
    transition: var(--transition-normal);
    cursor: pointer;
}

.app-icon.active {
    background: var(--solar);
    color: #111;
    box-shadow: 0 0 15px var(--solar-glow);
    animation: appliance-glow 1s ease-in-out infinite;
}

@keyframes appliance-glow {
    0%, 100% { box-shadow: 0 0 10px var(--solar-glow); }
    50% { box-shadow: 0 0 25px var(--solar-glow); }
}

.appliance-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 15px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: var(--radius-full);
    border: 1px solid var(--solar);
}

.tag-icon {
    color: var(--solar);
}

.tag-text {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-white);
    letter-spacing: 1px;
}

/* ===== INFRASTRUCTURE COMPONENTS ===== */
.infrastructure {
    position: absolute;
    bottom: 30px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-evenly;
    padding: 0 20px;
    z-index: 10;
}

.comp-box {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.9));
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    width: 120px;
    cursor: pointer;
    transition: var(--transition-normal);
    transform-style: preserve-3d;
    animation: float-component 4s ease-in-out infinite;
}

.comp-box:nth-child(1) { animation-delay: 0s; }
.comp-box:nth-child(2) { animation-delay: 0.5s; }
.comp-box:nth-child(3) { animation-delay: 1s; }
.comp-box:nth-child(4) { animation-delay: 1.5s; }
.comp-box:nth-child(5) { animation-delay: 2s; }

@keyframes float-component {
    0%, 100% { transform: translateY(0) rotateX(5deg); }
    50% { transform: translateY(-8px) rotateX(5deg); }
}

.comp-box:hover {
    transform: translateY(-15px) scale(1.05) rotateX(0deg);
    box-shadow: var(--shadow-lg);
}

.comp-glow {
    position: absolute;
    inset: -2px;
    border-radius: var(--radius-lg);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: -1;
}

.solar-comp .comp-glow {
    background: var(--solar-glow);
    filter: blur(15px);
}

.house-comp .comp-glow {
    background: rgba(255, 255, 255, 0.3);
    filter: blur(15px);
}

.battery-comp .comp-glow {
    background: var(--battery-glow);
    filter: blur(15px);
}

.grid-comp .comp-glow {
    background: var(--grid-glow);
    filter: blur(15px);
}

.diesel-comp .comp-glow {
    background: rgba(249, 115, 22, 0.4);
    filter: blur(15px);
}

.comp-box.active .comp-glow {
    opacity: 0.6;
}

.comp-3d-wrapper {
    position: relative;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comp-img {
    height: 55px;
    width: auto;
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.5));
    transition: var(--transition-normal);
}

.comp-box:hover .comp-img {
    transform: scale(1.1);
}

/* Solar Rays */
.solar-rays {
    position: absolute;
    inset: -20px;
    opacity: 0;
    transition: opacity 0.3s;
}

.solar-comp.active .solar-rays {
    opacity: 1;
}

.ray {
    position: absolute;
    width: 3px;
    height: 20px;
    background: linear-gradient(var(--solar), transparent);
    top: 50%;
    left: 50%;
    transform-origin: center center;
    animation: ray-pulse 1.5s ease-in-out infinite;
}

.ray:nth-child(1) { transform: rotate(0deg) translateY(-40px); animation-delay: 0s; }
.ray:nth-child(2) { transform: rotate(90deg) translateY(-40px); animation-delay: 0.2s; }
.ray:nth-child(3) { transform: rotate(180deg) translateY(-40px); animation-delay: 0.4s; }
.ray:nth-child(4) { transform: rotate(270deg) translateY(-40px); animation-delay: 0.6s; }

@keyframes ray-pulse {
    0%, 100% { opacity: 0.3; height: 15px; }
    50% { opacity: 1; height: 25px; }
}

/* House Lights */
.house-lights {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.window-light {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--solar);
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.3s;
    box-shadow: 0 0 10px var(--solar);
}

.window-light:nth-child(1) { top: 30%; left: 30%; }
.window-light:nth-child(2) { top: 30%; left: 55%; }
.window-light:nth-child(3) { top: 55%; left: 42%; }

.house-comp.active .window-light {
    opacity: 1;
    animation: window-flicker 3s ease-in-out infinite;
}

@keyframes window-flicker {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* Battery Indicator */
.battery-indicator {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 50px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    border: 2px solid var(--battery);
    overflow: hidden;
    display: none;
}

.battery-level {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to top, var(--battery), #34d399);
    transition: height 0.5s;
}

.battery-charge-effect {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: charge-wave 1s linear infinite;
    opacity: 0;
}

@keyframes charge-wave {
    from { transform: translateY(100%); }
    to { transform: translateY(-100%); }
}

.battery-comp.charging .battery-charge-effect {
    opacity: 1;
}

/* KW Tags */
.kw-tag {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: var(--radius-full);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 8px;
}

.solar-tag { color: var(--solar); border: 1px solid var(--solar); }
.load-tag { color: var(--text-white); border: 1px solid var(--text-muted); }
.battery-tag { color: var(--battery); border: 1px solid var(--battery); }
.grid-tag { color: var(--grid); border: 1px solid var(--grid); }
.diesel-tag { color: var(--diesel); border: 1px solid var(--diesel); }

.comp-box h3 {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 2px;
    margin-top: 5px;
    text-transform: uppercase;
}

/* Energy Bars */
.energy-bar {
    width: 80%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    margin-top: 8px;
    overflow: hidden;
}

.energy-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: var(--radius-full);
    transition: width 0.5s;
}

.solar-bar-fill { background: var(--solar); }
.load-bar-fill { background: var(--text-white); }

/* Charge Direction */
.charge-direction {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    margin-top: 5px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.charging-icon {
    transition: transform 0.3s, color 0.3s;
    font-size: 1rem;
}

.charge-label {
    font-weight: 600;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.charge-power {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
}

.charge-direction.charging .charge-label {
    color: var(--battery);
}

.charge-direction.charging .charge-power {
    color: var(--battery);
    text-shadow: 0 0 10px var(--battery-glow);
}

.charge-direction.charging .charging-icon {
    color: var(--battery);
    animation: charge-bounce 0.5s ease-in-out infinite;
}

.charge-direction.discharging .charge-label {
    color: #22d3ee;
}

.charge-direction.discharging .charge-power {
    color: #22d3ee;
    text-shadow: 0 0 10px rgba(34, 211, 238, 0.5);
}

.charge-direction.discharging .charging-icon {
    color: #22d3ee;
    animation: discharge-bounce 0.5s ease-in-out infinite;
}

@keyframes charge-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(3px); }
}

@keyframes discharge-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* Grid Price Tag */
.grid-price-tag {
    margin-top: 8px;
    padding: 3px 10px;
    background: rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    color: var(--grid);
}

/* Diesel */
.diesel-icon-wrapper {
    font-size: 2.5rem;
    color: var(--diesel);
}

.diesel-smoke {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
}

.diesel-comp.active .diesel-smoke {
    opacity: 1;
}

.smoke-particle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: rgba(100, 100, 100, 0.5);
    border-radius: 50%;
    filter: blur(3px);
    animation: smoke-rise 2s ease-out infinite;
}

.smoke-particle:nth-child(1) { left: 0; animation-delay: 0s; }
.smoke-particle:nth-child(2) { left: 10px; animation-delay: 0.5s; }
.smoke-particle:nth-child(3) { left: 5px; animation-delay: 1s; }

@keyframes smoke-rise {
    0% {
        opacity: 0.6;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-30px) scale(2);
    }
}

/* Grid Electricity Effect */
.grid-electricity {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* Flow SVG */
.flow-svg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 8;
}

/* ===== SANKEY DIAGRAM ===== */
.energy-sankey {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    padding: 15px;
}

.sankey-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.sankey-header h4 {
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sankey-header h4 i {
    color: var(--primary-light);
}

.sankey-legend {
    display: flex;
    gap: 15px;
}

.legend-item {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

.solar-legend i { color: var(--solar); }
.battery-legend i { color: var(--battery); }
.grid-legend i { color: var(--grid); }

.sankey-diagram {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 100px;
}

.sankey-sources, .sankey-destinations {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sankey-node {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--glass);
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    min-width: 120px;
}

.node-icon {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.solar-node .node-icon { background: rgba(251, 191, 36, 0.2); color: var(--solar); }
.battery-node .node-icon { background: rgba(16, 185, 129, 0.2); color: var(--battery); }
.grid-node .node-icon { background: rgba(239, 68, 68, 0.2); color: var(--grid); }
.load-node .node-icon { background: rgba(255, 255, 255, 0.1); color: var(--text-white); }
.charge-node .node-icon { background: rgba(16, 185, 129, 0.2); color: var(--battery); }

.node-info {
    display: flex;
    flex-direction: column;
}

.node-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.node-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
}

.sankey-flows {
    flex: 1;
    position: relative;
    min-height: 100px;
}

#sankey-canvas {
    width: 100%;
    height: 100%;
}

/* ===== CHART CONTAINER ===== */
.chart-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    padding: 20px;
    position: relative;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--glass-border);
}

.chart-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.chart-title h3 {
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-title h3 i {
    color: var(--primary-light);
}

.chart-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-icon:hover {
    background: var(--glass-hover);
    color: var(--text-white);
}

.btn-icon.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
}

.chart-toggles {
    display: flex;
    gap: 8px;
}

.toggle-btn {
    padding: 6px 12px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: var(--transition-fast);
}

.toggle-btn:hover {
    background: var(--glass-hover);
}

.toggle-btn.active.solar-toggle {
    background: var(--solar);
    color: #111;
    border-color: var(--solar);
}

.toggle-btn.active.load-toggle {
    background: var(--text-white);
    color: #111;
    border-color: var(--text-white);
}

.toggle-btn.active.grid-toggle {
    background: var(--grid);
    color: white;
    border-color: var(--grid);
}

.toggle-btn.active.battery-toggle {
    background: #22d3ee;
    color: #111;
    border-color: #22d3ee;
}

.toggle-btn.active.soc-toggle {
    background: var(--battery);
    color: white;
    border-color: var(--battery);
}

.chart-box {
    height: 200px;
    position: relative;
}

/* Prediction Badge */
.prediction-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 5px 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    opacity: 0;
    transform: translateY(-10px);
    transition: var(--transition-normal);
}

.prediction-badge.active {
    opacity: 1;
    transform: translateY(0);
}

/* ===== COST COMPARISON PANEL ===== */
.cost-comparison-panel {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    padding: 15px;
}

.comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.comparison-header h4 {
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.comparison-header h4 i {
    color: var(--primary-light);
}

.comparison-mode {
    display: flex;
    gap: 5px;
}

.mode-indicator {
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.65rem;
    font-weight: 700;
}

.baseline-mode {
    background: rgba(239, 68, 68, 0.2);
    color: var(--grid);
}

.smart-mode {
    background: rgba(16, 185, 129, 0.2);
    color: var(--battery);
}

.comparison-bars {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bar-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.bar-label {
    min-width: 90px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.label-icon {
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

.baseline-group .label-icon {
    background: rgba(239, 68, 68, 0.2);
    color: var(--grid);
}

.smart-group .label-icon {
    background: rgba(16, 185, 129, 0.2);
    color: var(--battery);
}

.comparison-bar {
    flex: 1;
    height: 30px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    position: relative;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    width: 0%;
    border-radius: var(--radius-sm);
    transition: width 0.5s ease;
}

.baseline-fill {
    background: linear-gradient(90deg, var(--grid), #f87171);
}

.smart-fill {
    background: linear-gradient(90deg, var(--battery), #34d399);
}

.bar-value {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-white);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.savings-display {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
    border-radius: var(--radius-md);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.savings-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--battery);
    border-radius: 50%;
    color: white;
    font-size: 1.2rem;
}

.savings-info {
    display: flex;
    flex-direction: column;
}

.savings-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.savings-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--battery);
}

.savings-percent {
    font-size: 0.8rem;
    color: var(--battery);
}

/* ===== RESULTS CARD ===== */
.results-card {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--primary);
    padding: 25px;
    text-align: center;
    overflow: hidden;
}

#confetti-canvas {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.results-header {
    margin-bottom: 20px;
}

.results-icon {
    font-size: 3rem;
    color: var(--solar);
    margin-bottom: 10px;
    animation: trophy-bounce 1s ease infinite;
}

@keyframes trophy-bounce {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-10px) rotate(5deg); }
}

.results-header h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.3rem;
    letter-spacing: 3px;
    color: var(--primary-light);
}

.results-config {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding: 12px;
    background: var(--glass);
    border-radius: var(--radius-md);
}

.config-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.config-item i {
    color: var(--primary-light);
}

.config-item b {
    color: var(--text-white);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.result-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px;
    background: var(--glass);
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    transition: var(--transition-normal);
}

.result-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.result-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1rem;
}

.result-item:nth-child(1) .result-icon { background: rgba(239, 68, 68, 0.2); color: var(--grid); }
.result-item:nth-child(2) .result-icon { background: rgba(251, 191, 36, 0.2); color: var(--solar); }
.result-item:nth-child(3) .result-icon { background: rgba(99, 102, 241, 0.2); color: var(--primary-light); }
.result-item:nth-child(4) .result-icon { background: rgba(249, 115, 22, 0.2); color: var(--diesel); }
.result-item:nth-child(5) .result-icon { background: rgba(16, 185, 129, 0.2); color: var(--battery); }
.result-item:nth-child(6) .result-icon { background: rgba(236, 72, 153, 0.2); color: #ec4899; }

.result-info {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.result-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.result-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-white);
}

.soh-gauge {
    width: 60px;
    height: 8px;
    background: var(--bg-light);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin: 5px 0;
}

.soh-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--grid), var(--solar), var(--battery));
    border-radius: var(--radius-full);
    transition: width 0.5s;
}

.savings-banner {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(251, 191, 36, 0.1));
    border-radius: var(--radius-md);
    border: 1px solid var(--solar);
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--solar);
}

.savings-banner i {
    font-size: 1.5rem;
}

.results-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* ===== CONTROL SECTION ===== */
/* Note: Main .control-section styles defined in FULLSCREEN MODE section */

/* Cards */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    padding: 20px;
    transition: var(--transition-normal);
}

.card:hover {
    border-color: rgba(99, 102, 241, 0.3);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--glass-border);
}

.card-header h2 {
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h2 i {
    color: var(--primary-light);
}

/* Scenario Grid */
.scenario-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.scenario-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 12px 8px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-normal);
}

.scenario-btn:hover {
    background: var(--glass-hover);
    color: var(--text-white);
    transform: translateY(-3px);
}

.scenario-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.scenario-icon {
    font-size: 1.5rem;
}

.scenario-btn span {
    font-size: 0.7rem;
    font-weight: 600;
}

/* Control Groups */
.control-group {
    margin-bottom: 18px;
}

.control-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.value-badge {
    padding: 3px 10px;
    background: var(--primary);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
}

/* Weather Grid */
.weather-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.weather-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-normal);
}

.weather-btn i {
    font-size: 1.3rem;
}

.weather-btn span {
    font-size: 0.7rem;
    font-weight: 600;
}

.weather-btn:hover {
    background: var(--glass-hover);
    color: var(--text-white);
}

.weather-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.weather-btn[data-weather="sunny"].active {
    background: var(--solar);
    border-color: var(--solar);
    color: #111;
}

.weather-btn[data-weather="rainy"].active {
    background: #6366f1;
    border-color: #6366f1;
}

/* Sliders */
.slider-container {
    position: relative;
}

.custom-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    background: var(--bg-light);
    border-radius: var(--radius-full);
    outline: none;
    cursor: pointer;
}

.custom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.5);
    transition: var(--transition-fast);
}

.custom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.solar-slider::-webkit-slider-thumb { background: var(--solar); box-shadow: 0 2px 10px var(--solar-glow); }
.battery-slider::-webkit-slider-thumb { background: var(--battery); box-shadow: 0 2px 10px var(--battery-glow); }
.grid-slider::-webkit-slider-thumb { background: var(--grid); box-shadow: 0 2px 10px var(--grid-glow); }

.slider-ticks {
    display: flex;
    justify-content: space-between;
    padding: 5px 2px 0;
}

.slider-ticks span {
    font-size: 0.6rem;
    color: var(--text-dim);
}

/* Toggle & Speed Row */
.control-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.toggle-control, .speed-control {
    flex: 1;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-light);
    border-radius: var(--radius-full);
    transition: var(--transition-normal);
}

.toggle-knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: var(--transition-normal);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--battery);
}

.toggle-switch input:checked + .toggle-slider .toggle-knob {
    transform: translateX(30px);
    background: white;
}

.toggle-status {
    display: block;
    margin-top: 5px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
}

.toggle-status.active {
    color: var(--battery);
}

/* Speed Slider */
.speed-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: var(--bg-light);
    border-radius: var(--radius-full);
    outline: none;
    margin-top: 10px;
}

.speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 10px;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: var(--transition-normal);
}

.btn-primary {
    flex: 1;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
    background: var(--glass);
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: var(--glass-hover);
    color: var(--text-white);
}

.btn-lg {
    padding: 15px 25px;
    font-size: 0.95rem;
}

.btn-sm {
    padding: 8px 15px;
    font-size: 0.75rem;
}

/* ===== PRICING CARD ===== */
.pricing-content {
    text-align: center;
}

.current-price {
    margin-bottom: 15px;
}

.price-label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.price-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-white);
}

.price-unit {
    font-size: 1rem;
    color: var(--text-muted);
}

.price-indicator {
    margin-bottom: 15px;
}

.indicator-badge {
    display: inline-block;
    padding: 5px 15px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.indicator-badge.off-peak {
    background: rgba(16, 185, 129, 0.2);
    color: var(--battery);
    border: 1px solid var(--battery);
}

.indicator-badge.peak {
    background: rgba(239, 68, 68, 0.2);
    color: var(--grid);
    border: 1px solid var(--grid);
}

.price-timeline {
    position: relative;
}

.timeline-track {
    position: relative;
    height: 10px;
    background: var(--bg-light);
    border-radius: var(--radius-full);
    overflow: visible;
}

.timeline-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--battery), var(--solar));
    border-radius: var(--radius-full);
    transition: width 0.3s;
}

.peak-zone {
    position: absolute;
    top: 0;
    height: 100%;
    left: 70.83%;
    width: 25%;
    background: rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-full);
}

.timeline-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: var(--primary);
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: left 0.3s;
}

.timeline-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
}

.timeline-labels span {
    font-size: 0.6rem;
    color: var(--text-dim);
}

.timeline-labels .peak-time {
    color: var(--grid);
    font-weight: 700;
}

/* ===== AUDIT CARD ===== */
.hour-select {
    padding: 5px 10px;
    background: var(--bg-light);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-white);
    font-size: 0.8rem;
    cursor: pointer;
}

.telemetry-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

.telemetry-table th {
    text-align: left;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--glass-border);
}

.telemetry-table td {
    padding: 10px 0;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--glass-border);
}

.source-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
}

.source-indicator.solar { background: var(--solar); }
.source-indicator.load { background: var(--text-white); }
.source-indicator.battery { background: var(--battery); }
.source-indicator.grid { background: var(--grid); }
.source-indicator.diesel { background: var(--diesel); }

/* Health Section */
.health-section {
    padding-top: 15px;
    border-top: 1px solid var(--glass-border);
}

.health-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.health-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.health-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--battery);
}

.health-bar {
    height: 8px;
    background: var(--bg-light);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.health-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--grid), var(--solar), var(--battery));
    border-radius: var(--radius-full);
    transition: width 0.5s;
}

.health-info {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.7rem;
    color: var(--text-dim);
}

.degradation-warn {
    color: var(--grid);
    animation: pulse 1s infinite;
}

/* ===== ECO CARD ===== */
.eco-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.eco-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    text-align: center;
}

.eco-icon {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.2rem;
}

.eco-icon.tree {
    background: rgba(16, 185, 129, 0.2);
    color: var(--battery);
}

.eco-icon.car {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-light);
}

.eco-icon.co2 {
    background: rgba(239, 68, 68, 0.2);
    color: var(--grid);
}

.eco-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-white);
}

.eco-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ===== FOOTER ===== */
.app-footer {
    text-align: center;
    padding: 15px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.footer-brand {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    color: var(--primary-light);
}

.footer-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9000;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    animation: modal-in 0.3s ease;
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

.modal-header h2 {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h2 i {
    color: var(--primary-light);
}

.modal-close {
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--grid);
    color: white;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.compare-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.compare-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: var(--transition-normal);
}

.compare-card:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
}

/* ===== TOOLTIP ===== */
.global-tooltip {
    position: fixed;
    padding: 8px 15px;
    background: var(--bg-light);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-white);
    pointer-events: none;
    opacity: 0;
    z-index: 10000;
    transition: opacity 0.2s;
}

.global-tooltip.visible {
    opacity: 1;
}

/* ===== ANIMATIONS ===== */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .main-layout {
        flex-direction: column;
    }
    
    .control-section {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .control-section .card {
        flex: 1;
        min-width: 300px;
    }
}

@media (max-width: 768px) {
    .hud-header {
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .hud-stats {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .stat-item {
        flex: 1;
        min-width: 100px;
    }
    
    .infrastructure {
        flex-wrap: wrap;
        gap: 10px;
        padding: 0 10px;
    }
    
    .comp-box {
        width: 100px;
    }
    
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Real data indicators responsive */
    .real-data-indicators {
        max-width: 200px;
        bottom: 10px;
        left: 10px;
    }
    
    .real-indicator {
        padding: 3px 6px;
        font-size: 0.65rem;
    }
    
    .real-indicator span {
        min-width: 40px;
        font-size: 0.6rem;
    }
    
    .data-badge {
        font-size: 0.6rem;
        padding: 4px 8px;
    }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-light);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ===== HELP BUTTON ===== */
.help-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: 2px solid rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse-help 2s infinite;
}

.help-btn:hover {
    transform: scale(1.15) rotate(10deg);
    box-shadow: 0 0 25px var(--primary-light);
}

@keyframes pulse-help {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.5); }
    50% { box-shadow: 0 0 20px 5px rgba(99, 102, 241, 0.3); }
}

/* ===== HELP MODAL ===== */
.help-modal .help-content {
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.help-body {
    overflow-y: auto;
    padding: 25px !important;
    flex: 1;
}

.help-section {
    margin-bottom: 30px;
}

.help-section h4 {
    color: var(--primary-light);
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Orbitron', sans-serif;
}

.help-section h4 i {
    width: 35px;
    height: 35px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.intro-section {
    text-align: center;
    padding: 20px;
}

.help-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.help-icon-large {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--solar), var(--primary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
    animation: float 3s ease-in-out infinite;
    box-shadow: 0 0 40px var(--solar-glow);
}

.help-hero h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-white);
    font-family: 'Orbitron', sans-serif;
}

.help-hero p {
    color: var(--text-muted);
    font-size: 1rem;
}

.help-content-box {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.help-list {
    list-style: none;
    display: grid;
    gap: 10px;
}

.help-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-light);
    font-size: 0.95rem;
}

.help-list li i {
    color: var(--battery);
    font-size: 0.8rem;
}

.help-diagram {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-md);
}

.diag-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.diag-item i {
    font-size: 2rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.diag-item.solar i { background: rgba(251, 191, 36, 0.2); color: var(--solar); }
.diag-item.battery i { background: rgba(16, 185, 129, 0.2); color: var(--battery); }
.diag-item.house i { background: rgba(99, 102, 241, 0.2); color: var(--primary-light); }

.diag-item span {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.diag-arrow {
    color: var(--text-dim);
    font-size: 1.2rem;
    animation: arrow-pulse 1.5s ease-in-out infinite;
}

@keyframes arrow-pulse {
    0%, 100% { transform: translateX(0); opacity: 0.5; }
    50% { transform: translateX(5px); opacity: 1; }
}

.help-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.help-card {
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.help-card:hover {
    transform: translateY(-5px) scale(1.02);
}

.help-card.baseline {
    border-color: rgba(239, 68, 68, 0.3);
}

.help-card.baseline:hover {
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.2);
}

.help-card.smart {
    border-color: rgba(16, 185, 129, 0.3);
}

.help-card.smart:hover {
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.2);
}

.help-card .card-icon {
    width: 50px;
    height: 50px;
    margin: 0 auto 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.help-card.baseline .card-icon {
    background: rgba(239, 68, 68, 0.2);
    color: var(--grid);
}

.help-card.smart .card-icon {
    background: rgba(16, 185, 129, 0.2);
    color: var(--battery);
}

.help-card h5 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-white);
}

.help-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.pricing-visual {
    display: flex;
    gap: 10px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.price-time {
    flex: 1;
    min-width: 120px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-md);
    padding: 15px;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.price-time.off-peak {
    border-color: rgba(16, 185, 129, 0.3);
}

.price-time.peak {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.1);
}

.price-time .time {
    display: block;
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-bottom: 5px;
}

.price-time .price {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;
}

.price-time.off-peak .price { color: var(--battery); }
.price-time.peak .price { color: var(--grid); }

.price-time .label {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    margin-top: 5px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.1);
}

.price-time.peak .label { background: rgba(239, 68, 68, 0.3); color: var(--grid); }
.price-time.off-peak .label { background: rgba(16, 185, 129, 0.2); color: var(--battery); }

.help-tip {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(251, 191, 36, 0.05));
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: var(--radius-md);
    padding: 15px;
    margin-top: 15px;
}

.help-tip i {
    font-size: 1.5rem;
    color: var(--solar);
}

.help-tip span {
    font-size: 0.9rem;
    color: var(--text-light);
}

.components-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.comp-explain {
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.comp-explain:hover {
    transform: translateY(-5px);
}

.comp-explain i {
    font-size: 2rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin: 0 auto 12px;
}

.comp-explain.solar i { background: rgba(251, 191, 36, 0.2); color: var(--solar); }
.comp-explain.battery i { background: rgba(16, 185, 129, 0.2); color: var(--battery); }
.comp-explain.grid i { background: rgba(239, 68, 68, 0.2); color: var(--grid); }
.comp-explain.diesel i { background: rgba(249, 115, 22, 0.2); color: var(--diesel); }

.comp-explain.solar:hover { border-color: rgba(251, 191, 36, 0.4); box-shadow: 0 10px 25px rgba(251, 191, 36, 0.15); }
.comp-explain.battery:hover { border-color: rgba(16, 185, 129, 0.4); box-shadow: 0 10px 25px rgba(16, 185, 129, 0.15); }
.comp-explain.grid:hover { border-color: rgba(239, 68, 68, 0.4); box-shadow: 0 10px 25px rgba(239, 68, 68, 0.15); }
.comp-explain.diesel:hover { border-color: rgba(249, 115, 22, 0.4); box-shadow: 0 10px 25px rgba(249, 115, 22, 0.15); }

.comp-explain h5 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-white);
}

.comp-explain p {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.steps-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 15px;
    counter-reset: steps;
}

.steps-list li {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.step-num {
    width: 35px;
    height: 35px;
    min-width: 35px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    font-family: 'Orbitron', sans-serif;
}

.step-content {
    flex: 1;
}

.step-content strong {
    display: block;
    color: var(--text-white);
    font-size: 1rem;
    margin-bottom: 4px;
}

.step-content p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.metrics-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.metric-explain {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--primary);
}

.metric-name {
    font-weight: 700;
    color: var(--primary-light);
    font-size: 0.9rem;
}

.metric-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: right;
    flex: 1;
    margin-left: 20px;
}

.help-footer {
    text-align: center;
    padding: 20px;
    border-top: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
}

.help-footer .btn-lg {
    padding: 15px 40px;
    font-size: 1.1rem;
    animation: glow-btn 2s ease-in-out infinite;
}

@keyframes glow-btn {
    0%, 100% { box-shadow: 0 0 10px rgba(99, 102, 241, 0.3); }
    50% { box-shadow: 0 0 30px rgba(99, 102, 241, 0.6); }
}

/* ===== ENHANCED 3D EFFECTS ===== */
.comp-box {
    transform-style: preserve-3d;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.comp-box:hover {
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4), 0 0 30px var(--primary-light);
}

.card {
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    left: var(--mouse-x, 50%);
    top: var(--mouse-y, 50%);
    transform: translate(-50%, -50%);
}

.card:hover::before {
    opacity: 1;
}

/* Glowing borders on active components */
.comp-box.active {
    animation: glow-pulse 1.5s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% { box-shadow: 0 0 15px var(--solar-glow); }
    50% { box-shadow: 0 0 35px var(--solar-glow), 0 0 60px var(--solar-glow); }
}

.comp-box.active.charging {
    animation: charge-pulse 1s ease-in-out infinite;
}

@keyframes charge-pulse {
    0%, 100% { box-shadow: 0 0 15px var(--battery-glow); }
    50% { box-shadow: 0 0 40px var(--battery-glow), inset 0 0 20px var(--battery-glow); }
}

.comp-box.active.discharging {
    animation: discharge-pulse 0.8s ease-in-out infinite;
}

@keyframes discharge-pulse {
    0%, 100% { box-shadow: 0 0 15px rgba(34, 211, 238, 0.5); }
    50% { box-shadow: 0 0 40px rgba(34, 211, 238, 0.7), inset 0 0 20px rgba(34, 211, 238, 0.3); }
}

/* Float animation */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Energy Sankey Canvas */
#sankey-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.sankey-container {
    position: relative;
}

/* 3D Chart Mode */
/* ===== 3D CHART MODE ===== */
.chart-3d-mode {
    perspective: 2000px;
    transform-style: preserve-3d;
}

.chart-3d-mode .chart-box {
    position: relative;
    transform: rotateX(25deg) rotateY(-10deg) translateZ(50px);
    transform-style: preserve-3d;
    transition: transform 0.5s ease;
    box-shadow: 
        0 50px 100px rgba(0, 0, 0, 0.5),
        0 30px 60px rgba(99, 102, 241, 0.15),
        inset 0 0 30px rgba(99, 102, 241, 0.1);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(17, 24, 39, 0.95), rgba(10, 15, 26, 0.98));
    animation: chart3DFloat 8s ease-in-out infinite;
}

/* Continuous 3D floating animation */
@keyframes chart3DFloat {
    0%, 100% {
        transform: rotateX(25deg) rotateY(-10deg) translateZ(50px);
    }
    25% {
        transform: rotateX(20deg) rotateY(-5deg) translateZ(60px);
    }
    50% {
        transform: rotateX(25deg) rotateY(5deg) translateZ(50px);
    }
    75% {
        transform: rotateX(30deg) rotateY(-8deg) translateZ(55px);
    }
}

.chart-3d-mode .chart-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.1) 0%, transparent 50%);
    border-radius: var(--radius-lg);
    pointer-events: none;
}

.chart-3d-mode .chart-box::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 10%;
    width: 80%;
    height: 20px;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.4) 0%, transparent 70%);
    filter: blur(10px);
    transform: rotateX(90deg);
    animation: shadowPulse 8s ease-in-out infinite;
}

@keyframes shadowPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

.chart-3d-mode:hover .chart-box {
    animation-play-state: paused;
    transform: rotateX(20deg) rotateY(-5deg) translateZ(70px);
}

/* 3D Grid Lines Effect */
.chart-3d-mode .chart-box canvas {
    position: relative;
    z-index: 1;
}

/* Fix SOC overflow in 3D mode */
.chart-3d-mode .chart-box {
    overflow: visible;
    padding-right: 60px; /* Space for right Y-axis */
}

.chart-3d-mode canvas {
    max-width: calc(100% - 10px) !important;
}

/* Floating Labels in 3D */
.chart-3d-mode .chart-toggles {
    transform: translateZ(30px);
}

.chart-3d-mode .prediction-badge {
    transform: translateZ(60px);
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
}

/* ===== FULLSCREEN MODE ===== */
.fullscreen-active {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background: var(--bg-dark) !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 20px !important;
    overflow: auto;
}

.fullscreen-active .chart-box {
    height: calc(100vh - 150px) !important;
    overflow: visible !important;
    padding-right: 70px !important; /* Ensure right Y-axis (SOC%) is visible */
}

/* Fix 3D + Fullscreen combination */
.fullscreen-active.chart-3d-mode .chart-box {
    padding-right: 80px !important;
    transform-origin: center center !important;
}

.fullscreen-active canvas {
    max-width: calc(100% - 20px) !important;
}

/* Reset styles when NOT fullscreen - ensure layout restores */
.chart-container:not(.fullscreen-active) {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: auto !important;
    height: auto !important;
    z-index: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: var(--bg-card) !important;
    border-radius: var(--radius-lg) !important;
}

/* CRITICAL: Ensure control section width is always correct */
.control-section {
    width: 360px;
    min-width: 360px;
    max-width: 360px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Ensure main layout stays as flex row */
.main-layout {
    display: flex !important;
    gap: 15px;
    flex: 1;
}

/* Vis section takes remaining space */
.vis-section {
    flex: 1;
    min-width: 0;
}

/* Results Card Animation */
#persistent-results {
    animation: results-appear 0.5s ease forwards;
}

@keyframes results-appear {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Comparison Bars Animation */
.fill-bar {
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

#baseline-fill {
    background: linear-gradient(90deg, var(--grid), #ff6b6b);
}

#smart-fill {
    background: linear-gradient(90deg, var(--battery), #22d3ee);
    box-shadow: 0 0 20px var(--battery-glow);
}

/* Particle glow effect */
.energy-particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: particle-float 2s ease-in-out infinite;
}

@keyframes particle-float {
    0%, 100% { opacity: 0.8; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.5); }
}

