/**
 * LightEarth Web Pro - Premium Design System
 * Version: 2.0.0 - Complete Redesign
 * Theme: Modern Solar Energy Dashboard with Unified Color Palette
 * 
 * Color Palette:
 * - Primary: Teal (#0d9488 to #14b8a6)
 * - Secondary: Indigo (#4f46e5 to #6366f1)
 * - Accent: Amber (#f59e0b to #fbbf24)
 * - Success: Emerald (#10b981 to #34d399)
 * - Warning: Orange (#f97316 to #fb923c)
 * - Danger: Rose (#f43f5e to #fb7185)
 * - Background: Slate (#0f172a to #1e293b)
 */

/* ========================================
   CSS VARIABLES - DESIGN TOKENS
   ======================================== */

:root {
    /* Primary Colors */
    --color-primary-50: #f0fdfa;
    --color-primary-100: #ccfbf1;
    --color-primary-200: #99f6e4;
    --color-primary-300: #5eead4;
    --color-primary-400: #2dd4bf;
    --color-primary-500: #14b8a6;
    --color-primary-600: #0d9488;
    --color-primary-700: #0f766e;
    --color-primary-800: #115e59;
    --color-primary-900: #134e4a;

    /* Secondary (Indigo) */
    --color-secondary-50: #eef2ff;
    --color-secondary-100: #e0e7ff;
    --color-secondary-500: #6366f1;
    --color-secondary-600: #4f46e5;
    --color-secondary-700: #4338ca;

    /* Accent (Amber) */
    --color-accent-50: #fffbeb;
    --color-accent-100: #fef3c7;
    --color-accent-400: #fbbf24;
    --color-accent-500: #f59e0b;
    --color-accent-600: #d97706;

    /* Background */
    --bg-dark-900: #0f172a;
    --bg-dark-800: #1e293b;
    --bg-dark-700: #334155;
    --bg-light-50: #f8fafc;
    --bg-light-100: #f1f5f9;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-glow-teal: 0 0 20px rgba(20, 184, 166, 0.3);
    --shadow-glow-indigo: 0 0 20px rgba(99, 102, 241, 0.3);

    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-2xl: 2rem;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   BASE STYLES
   ======================================== */

html {
    scroll-behavior: smooth;
}

body {
    background: linear-gradient(135deg, var(--bg-light-50) 0%, var(--bg-light-100) 100%);
    min-height: 100vh;
}

.dark body {
    background: linear-gradient(135deg, var(--bg-dark-900) 0%, var(--bg-dark-800) 100%);
}

/* ========================================
   GLASSMORPHISM UTILITIES
   ======================================== */

.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.dark .glass {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-lg);
}

.dark .glass-card {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ========================================
   CHART STYLES
   ======================================== */

.chart-container {
    position: relative;
    height: 40vh;
    width: 100%;
    margin-bottom: 1.5rem;
    background: white;
    border-radius: var(--radius-xl);
    padding: 20px;
    padding-right: 25px;
    box-shadow: var(--shadow-md);
    overflow: visible !important;
    transition: var(--transition-normal);
}

.chart-container:hover {
    box-shadow: var(--shadow-lg);
}

.chart-container canvas {
    overflow: visible !important;
}

#soc-section {
    overflow: visible !important;
}

#soc-section .chart-container {
    padding-right: 35px;
}

.dark .chart-container {
    background: var(--bg-dark-800);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

@media (max-width: 640px) {
    .chart-container {
        height: 45vh;
        padding: 12px;
        border-radius: var(--radius-lg);
    }
}

/* Custom tooltip styling */
.chartjs-tooltip {
    opacity: 0;
    position: absolute;
    background: linear-gradient(135deg, var(--bg-dark-800), var(--bg-dark-900));
    color: white;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 12px;
    pointer-events: none;
    transform: translate(-50%, 0);
    transition: opacity 0.2s ease;
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chartjs-legend {
    font-size: 11px !important;
    padding: 5px !important;
}

canvas:hover {
    cursor: crosshair;
}

/* ========================================
   STAT CARDS - Modern Design
   ======================================== */

.stat-card {
    transition: var(--transition-normal);
    cursor: pointer;
    border-radius: var(--radius-xl);
    background: white;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary-500), var(--color-secondary-500));
    opacity: 0;
    transition: var(--transition-normal);
}

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

.dark .stat-card {
    background: var(--bg-dark-800);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl), var(--shadow-glow-teal);
}

.stat-card:active {
    transform: translateY(-2px);
}

/* ========================================
   ENERGY FLOW CARDS - Glassmorphism
   ======================================== */

.energy-card {
    transition: var(--transition-normal);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.energy-card.inactive {
    opacity: 0.5;
    filter: grayscale(0.5);
}

.energy-card img {
    transition: var(--transition-normal);
}

.energy-card.inactive img {
    opacity: 0.5;
    filter: grayscale(100%);
}

.flow-item {
    transition: var(--transition-normal);
}

.flow-item:hover {
    transform: scale(1.02);
}

.flow-item.inactive img {
    opacity: 0.5;
    filter: grayscale(100%);
}

/* ========================================
   VALUE UPDATE ANIMATION - Enhanced
   ======================================== */

.value-updated {
    animation: valueFlash 0.6s ease-out;
}

@keyframes valueFlash {
    0% { 
        background: linear-gradient(135deg, rgba(20, 184, 166, 0.3), rgba(99, 102, 241, 0.3));
        transform: scale(1.05);
    }
    50% {
        background: linear-gradient(135deg, rgba(20, 184, 166, 0.15), rgba(99, 102, 241, 0.15));
        transform: scale(1.02);
    }
    100% { 
        background: transparent;
        transform: scale(1);
    }
}

.cell-blink {
    animation: cellBlink 0.6s ease-out;
}

@keyframes cellBlink {
    0% { 
        box-shadow: 0 0 20px rgba(20, 184, 166, 0.8);
        transform: scale(1.05);
    }
    100% { 
        box-shadow: none;
        transform: scale(1);
    }
}

.cell-no-communication {
    opacity: 0.4;
    background: linear-gradient(135deg, #6b7280, #4b5563) !important;
}

.cell-no-communication .cell-voltage {
    color: #9ca3af !important;
}

.cell-no-communication::after {
    content: '⚠';
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 10px;
    color: #ef4444;
}

/* ========================================
   BATTERY CELL GRID - Refined
   ======================================== */

.battery-cell-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

@media (min-width: 640px) {
    .battery-cell-grid {
        grid-template-columns: repeat(8, 1fr);
    }
}

.battery-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 6px;
    border-radius: var(--radius-md);
    font-size: 11px;
    font-weight: 600;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    color: #374151;
    transition: var(--transition-normal);
    min-height: 40px;
    box-shadow: var(--shadow-sm);
}

.dark .battery-cell {
    background: linear-gradient(135deg, var(--bg-dark-700), var(--bg-dark-800));
    color: #e5e7eb;
}

@media (min-width: 640px) {
    .battery-cell {
        font-size: 12px;
        padding: 12px 8px;
    }
}

/* Cell status colors with gradients */
.battery-cell.cell-excellent {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.battery-cell.cell-good {
    background: linear-gradient(135deg, #14b8a6, #0d9488);
    color: white;
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
}

.battery-cell.cell-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* ========================================
   HERO SECTION - Premium Dark Theme
   ======================================== */

.hero-landing {
    background: linear-gradient(135deg, 
        #0a0f1a 0%, 
        #0d1929 20%, 
        #0f1f36 40%,
        #0d1929 60%,
        #0a1423 80%,
        #0a0f1a 100%
    );
    border-radius: var(--radius-2xl);
    margin-bottom: 1.5rem;
    padding: 2rem 1rem;
    position: relative;
    overflow: hidden;
}

@media (min-width: 640px) {
    .hero-landing {
        border-radius: var(--radius-2xl);
        padding: 3rem 2rem;
    }
}

.hero-bg-gradient {
    background: 
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(20, 184, 166, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 60%, rgba(99, 102, 241, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 20% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
}

.hero-grid-pattern {
    background-image: 
        linear-gradient(rgba(20, 184, 166, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(20, 184, 166, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
}

/* Floating Elements - Teal/Indigo theme */
.hero-float-element {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
    animation: float 12s ease-in-out infinite;
}

.hero-float-1 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, var(--color-primary-600), var(--color-primary-500));
    top: -20%;
    left: -10%;
    animation-delay: 0s;
}

.hero-float-2 {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, var(--color-secondary-600), var(--color-secondary-500));
    bottom: -15%;
    right: -5%;
    animation-delay: -4s;
}

.hero-float-3 {
    width: 250px;
    height: 250px;
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
    top: 40%;
    right: 10%;
    animation-delay: -8s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -30px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(-30px, -15px) scale(1.02); }
}

/* Logo Container */
.hero-logo-container {
    position: relative;
    display: inline-block;
}

.hero-logo-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    border: 2px solid rgba(20, 184, 166, 0.4);
    border-radius: 50%;
    animation: ring-pulse 3s ease-out infinite;
}

.hero-logo-ring-2 {
    width: 150px;
    height: 150px;
    border-color: rgba(99, 102, 241, 0.3);
    animation-delay: 1s;
}

@keyframes ring-pulse {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(1.6); opacity: 0; }
}

.hero-logo-pulse {
    animation: logo-glow 4s ease-in-out infinite;
}

@keyframes logo-glow {
    0%, 100% { box-shadow: 0 0 30px rgba(20, 184, 166, 0.4), 0 0 60px rgba(20, 184, 166, 0.2); }
    50% { box-shadow: 0 0 50px rgba(99, 102, 241, 0.5), 0 0 100px rgba(20, 184, 166, 0.3); }
}

/* Title Animation */
.hero-title {
    animation: title-fade-in 1s ease-out;
}

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

/* Input Card - Glassmorphism */
.hero-input-card {
    animation: card-slide-up 0.8s ease-out 0.3s both;
}

@keyframes card-slide-up {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Date Buttons */
.hero-date-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 184, 166, 0.15);
    border: 2px solid rgba(20, 184, 166, 0.3);
    border-radius: var(--radius-md);
    color: white;
    transition: var(--transition-normal);
}

.hero-date-btn:hover {
    background: rgba(20, 184, 166, 0.3);
    border-color: var(--color-primary-400);
    transform: scale(1.05);
}

.hero-date-btn:active {
    transform: scale(0.95);
}

/* Submit Button - Premium Gradient */
.hero-submit-btn {
    background: linear-gradient(135deg, 
        var(--color-primary-600) 0%, 
        var(--color-primary-500) 40%, 
        var(--color-secondary-500) 100%
    );
    color: white;
    box-shadow: 
        0 10px 40px rgba(20, 184, 166, 0.4),
        0 0 0 0 rgba(99, 102, 241, 0.5);
    position: relative;
    overflow: hidden;
}

.hero-submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    transition: left 0.5s ease;
}

.hero-submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 
        0 15px 50px rgba(20, 184, 166, 0.5),
        0 0 0 4px rgba(99, 102, 241, 0.25);
}

.hero-submit-btn:hover::before {
    left: 100%;
}

.hero-submit-btn:active {
    transform: translateY(0);
}

/* Scroll Indicator */
.hero-scroll-indicator {
    animation: bounce-fade 2s ease-in-out infinite;
}

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

/* Date input styling */
.hero-landing input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.5;
    cursor: pointer;
}

.hero-landing input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 0.8;
}

/* Mobile Optimizations */
@media (max-width: 640px) {
    .hero-landing {
        min-height: 80vh;
        padding-top: 1.5rem;
    }
    
    .hero-float-element {
        filter: blur(60px);
        opacity: 0.25;
    }
    
    .hero-float-1 { width: 200px; height: 200px; }
    .hero-float-2 { width: 150px; height: 150px; }
    .hero-float-3 { width: 120px; height: 120px; }
    
    .hero-logo-ring { width: 100px; height: 100px; }
    .hero-logo-ring-2 { width: 130px; height: 130px; }
}

/* ========================================
   COMPACT SEARCH BAR - Refined
   ======================================== */

#compactSearch {
    position: sticky;
    top: 60px;
    z-index: 40;
    transition: top var(--transition-normal);
}

.header-hidden ~ main #compactSearch,
body:has(#mainHeader.header-hidden) #compactSearch {
    top: 0;
}

/* ========================================
   CONNECTION STATUS - Enhanced
   ======================================== */

.status-connected {
    background: linear-gradient(135deg, #10b981, #059669);
    animation: pulse-connected 2s infinite;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.status-disconnected {
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    box-shadow: 0 0 10px rgba(244, 63, 94, 0.5);
}

.status-connecting {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    animation: pulse-connecting 1s infinite;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

@keyframes pulse-connected {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    50% { opacity: 0.8; box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
}

@keyframes pulse-connecting {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.2); }
}

/* ========================================
   LOADING SPINNER - Modern
   ======================================== */

.loading-spinner {
    border: 3px solid rgba(20, 184, 166, 0.1);
    border-top: 3px solid var(--color-primary-500);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   SCROLLBAR - Refined
   ======================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

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

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--color-primary-500), var(--color-secondary-500));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--color-primary-600), var(--color-secondary-600));
}

/* ========================================
   MOBILE RESPONSIVENESS
   ======================================== */

@media (max-width: 640px) {
    #realTimeFlow .grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    #realTimeFlow .flow-item {
        height: auto;
        min-height: 95px;
        padding: 8px 6px;
    }
    
    #realTimeFlow .flow-item .w-10 {
        width: 36px !important;
        height: 36px !important;
    }
    
    #realTimeFlow .flow-item .w-5 {
        width: 18px !important;
        height: 18px !important;
    }
    
    #realTimeFlow .battery-icon-container {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        min-height: 36px !important;
    }
    
    #realTimeFlow .battery-percent-large {
        font-size: 10px !important;
    }
    
    #realTimeFlow .text-\[10px\] {
        font-size: 9px !important;
    }
    
    #realTimeFlow .text-sm {
        font-size: 12px !important;
    }
}

/* ========================================
   TOUCH-FRIENDLY
   ======================================== */

@media (pointer: coarse) {
    .stat-card,
    .energy-card,
    button {
        min-height: 44px;
    }
    
    .battery-cell {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ========================================
   CALCULATOR BUTTON - Enhanced
   ======================================== */

.calculator-btn {
    background: linear-gradient(135deg, var(--color-accent-500) 0%, var(--color-accent-600) 100%);
    color: white;
    border-radius: var(--radius-md);
    padding: 10px 20px;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-normal);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.calculator-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

/* ========================================
   CELL SECTION - Enhanced
   ======================================== */

#cellGrid .grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

@media (min-width: 640px) {
    #cellGrid .grid {
        grid-template-columns: repeat(8, 1fr);
        gap: 10px;
    }
}

.cell-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 6px;
    border-radius: var(--radius-md);
    min-height: 55px;
    transition: var(--transition-normal);
    position: relative;
}

.cell-item .cell-label {
    font-size: 9px;
    font-weight: 600;
    opacity: 0.85;
}

.cell-item .cell-voltage {
    font-size: 11px;
    font-weight: 700;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

@media (min-width: 640px) {
    .cell-item {
        min-height: 60px;
        padding: 10px 8px;
    }
    
    .cell-item .cell-label {
        font-size: 10px;
    }
    
    .cell-item .cell-voltage {
        font-size: 12px;
    }
}

/* Cell colors with refined gradients */
.cell-good {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.cell-ok {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.cell-warning {
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    color: white;
}

.cell-default {
    background: linear-gradient(135deg, var(--bg-dark-700), var(--bg-dark-800));
    color: white;
}

/* ========================================
   CELL MAX/MIN HIGHLIGHT
   ======================================== */

.cell-badge {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 7px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 10;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow-md);
}

@media (min-width: 640px) {
    .cell-badge {
        font-size: 8px;
        padding: 3px 8px;
        top: -8px;
    }
}

.cell-badge-max {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    animation: badge-pulse-max 2s ease-in-out infinite;
}

.cell-badge-min {
    background: linear-gradient(135deg, var(--color-accent-500), var(--color-accent-600));
    color: white;
    animation: badge-pulse-min 2s ease-in-out infinite;
}

@keyframes badge-pulse-max {
    0%, 100% { box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4); }
    50% { box-shadow: 0 4px 16px rgba(59, 130, 246, 0.7); }
}

@keyframes badge-pulse-min {
    0%, 100% { box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4); }
    50% { box-shadow: 0 4px 16px rgba(245, 158, 11, 0.7); }
}

.cell-max-highlight {
    box-shadow: 0 0 0 2px #3b82f6, 0 0 16px rgba(59, 130, 246, 0.5);
    animation: cell-glow-max 2s ease-in-out infinite;
}

.cell-min-highlight {
    box-shadow: 0 0 0 2px var(--color-accent-500), 0 0 16px rgba(245, 158, 11, 0.5);
    animation: cell-glow-min 2s ease-in-out infinite;
}

@keyframes cell-glow-max {
    0%, 100% { box-shadow: 0 0 0 2px #3b82f6, 0 0 12px rgba(59, 130, 246, 0.4); }
    50% { box-shadow: 0 0 0 3px #3b82f6, 0 0 20px rgba(59, 130, 246, 0.7); }
}

@keyframes cell-glow-min {
    0%, 100% { box-shadow: 0 0 0 2px var(--color-accent-500), 0 0 12px rgba(245, 158, 11, 0.4); }
    50% { box-shadow: 0 0 0 3px var(--color-accent-500), 0 0 20px rgba(245, 158, 11, 0.7); }
}

/* ========================================
   FIXED CALCULATE BUTTON
   ======================================== */

#fixedCalculateBtn {
    animation: slideUp 0.3s ease;
}

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

#fixedCalculateBtn a {
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
}

#fixedCalculateBtn a:hover {
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.5);
}

/* ========================================
   GROUPED SUMMARY CARDS - Premium
   ======================================== */

#summaryStats .grid > div {
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

#summaryStats .grid > div::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: var(--transition-normal);
}

#summaryStats .grid > div:hover::after {
    opacity: 1;
}

#summaryStats .grid > div:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl), var(--shadow-glow-teal);
}

@media (max-width: 640px) {
    #summaryStats .grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .fab,
    .compact-search-bar,
    header,
    .hero-toggle,
    .cell-toggle,
    #fixedCalculateBtn {
        display: none !important;
    }
    
    .chart-container {
        break-inside: avoid;
        height: 300px;
    }
}

/* ========================================
   COMBINED CHART LEGEND BUTTONS
   ======================================== */

.legend-btn {
    font-weight: 500;
    cursor: pointer;
    opacity: 0.5;
    border-color: #e2e8f0;
    background: #f8fafc;
    color: #64748b;
    border-radius: 9999px;
    transition: var(--transition-normal);
}

.dark .legend-btn {
    background: var(--bg-dark-700);
    border-color: var(--bg-dark-800);
    color: #94a3b8;
}

.legend-btn:hover {
    opacity: 0.75;
}

.legend-btn.active {
    opacity: 1;
    font-weight: 600;
}

.legend-btn.active[data-color="amber"] {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-color: var(--color-accent-500);
    color: #92400e;
}

.legend-btn.active[data-color="green"] {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    border-color: #22c55e;
    color: #166534;
}

.legend-btn.active[data-color="red"] {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    border-color: #f43f5e;
    color: #be123c;
}

.legend-btn.active[data-color="blue"] {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    border-color: #3b82f6;
    color: #1e40af;
}

.legend-btn.active[data-color="purple"] {
    background: linear-gradient(135deg, #ede9fe, #ddd6fe);
    border-color: var(--color-secondary-500);
    color: #5b21b6;
}

.legend-btn.active[data-color="cyan"] {
    background: linear-gradient(135deg, var(--color-primary-100), var(--color-primary-200));
    border-color: var(--color-primary-500);
    color: var(--color-primary-800);
}

.dark .legend-btn.active[data-color="amber"] {
    background: rgba(245, 158, 11, 0.2);
    border-color: var(--color-accent-500);
    color: #fbbf24;
}

.dark .legend-btn.active[data-color="green"] {
    background: rgba(34, 197, 94, 0.2);
    border-color: #22c55e;
    color: #4ade80;
}

.dark .legend-btn.active[data-color="red"] {
    background: rgba(244, 63, 94, 0.2);
    border-color: #f43f5e;
    color: #fb7185;
}

.dark .legend-btn.active[data-color="blue"] {
    background: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
    color: #60a5fa;
}

.dark .legend-btn.active[data-color="purple"] {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--color-secondary-500);
    color: #a5b4fc;
}

.dark .legend-btn.active[data-color="cyan"] {
    background: rgba(20, 184, 166, 0.2);
    border-color: var(--color-primary-500);
    color: var(--color-primary-300);
}

/* ========================================
   ENERGY FLOW ANIMATION - Comet Style
   ======================================== */

.energy-dot {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    z-index: 50;
    pointer-events: none;
    transform: translate(-50%, -50%);
}

.energy-dot::before {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    opacity: 0.6;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.energy-dot::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    opacity: 0.35;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* PV Dots - Amber */
.energy-dot-pv {
    background: var(--color-accent-400);
    box-shadow: 0 0 8px 2px rgba(251, 191, 36, 0.7);
    animation: pv-flow 1.5s ease-in-out infinite;
}
.energy-dot-pv-2 {
    animation: pv-flow 1.5s ease-in-out infinite;
    animation-delay: -0.3s;
    width: 10px;
    height: 10px;
}
.energy-dot-pv-3 {
    animation: pv-flow 1.5s ease-in-out infinite;
    animation-delay: -0.6s;
    width: 9px;
    height: 9px;
    opacity: 0.9;
}
.energy-dot-pv-4 {
    animation: pv-flow 1.5s ease-in-out infinite;
    animation-delay: -0.9s;
    width: 8px;
    height: 8px;
    opacity: 0.85;
}
.energy-dot-pv-5 {
    animation: pv-flow 1.5s ease-in-out infinite;
    animation-delay: -1.2s;
    width: 7px;
    height: 7px;
    opacity: 0.8;
}

/* EVN Dots - Teal */
.energy-dot-evn {
    background: var(--color-primary-400);
    box-shadow: 0 0 8px 2px rgba(20, 184, 166, 0.7);
    animation: evn-flow 1.5s ease-in-out infinite;
}
.energy-dot-evn-2 {
    animation: evn-flow 1.5s ease-in-out infinite;
    animation-delay: -0.3s;
    width: 10px;
    height: 10px;
}
.energy-dot-evn-3 {
    animation: evn-flow 1.5s ease-in-out infinite;
    animation-delay: -0.6s;
    width: 9px;
    height: 9px;
    opacity: 0.9;
}
.energy-dot-evn-4 {
    animation: evn-flow 1.5s ease-in-out infinite;
    animation-delay: -0.9s;
    width: 8px;
    height: 8px;
    opacity: 0.85;
}
.energy-dot-evn-5 {
    animation: evn-flow 1.5s ease-in-out infinite;
    animation-delay: -1.2s;
    width: 7px;
    height: 7px;
    opacity: 0.8;
}

/* Battery Dots */
.energy-dot-battery {
    background: var(--color-primary-400);
    box-shadow: 0 0 8px 2px rgba(20, 184, 166, 0.7);
}

.energy-dot-battery.charging {
    animation: battery-charge 1.8s ease-in-out infinite;
}
.energy-dot-battery-2.charging {
    animation: battery-charge 1.8s ease-in-out infinite;
    animation-delay: -0.6s;
    width: 10px;
    height: 10px;
}
.energy-dot-battery-3.charging {
    animation: battery-charge 1.8s ease-in-out infinite;
    animation-delay: -1.2s;
    width: 9px;
    height: 9px;
    opacity: 0.85;
}

.energy-dot-battery.discharging {
    background: #f97316;
    box-shadow: 0 0 8px 2px rgba(249, 115, 22, 0.7);
    animation: battery-discharge 1.8s ease-in-out infinite;
}
.energy-dot-battery-2.discharging {
    background: #f97316;
    box-shadow: 0 0 8px 2px rgba(249, 115, 22, 0.7);
    animation: battery-discharge 1.8s ease-in-out infinite;
    animation-delay: -0.6s;
    width: 10px;
    height: 10px;
}
.energy-dot-battery-3.discharging {
    background: #f97316;
    box-shadow: 0 0 8px 2px rgba(249, 115, 22, 0.7);
    animation: battery-discharge 1.8s ease-in-out infinite;
    animation-delay: -1.2s;
    width: 9px;
    height: 9px;
    opacity: 0.85;
}

/* Essential Load Dots - Indigo */
.energy-dot-essential {
    background: var(--color-secondary-500);
    box-shadow: 0 0 8px 2px rgba(99, 102, 241, 0.7);
    animation: essential-flow 1.2s ease-in-out infinite;
}
.energy-dot-essential-2 {
    animation: essential-flow 1.2s ease-in-out infinite;
    animation-delay: -0.4s;
    width: 10px;
    height: 10px;
}
.energy-dot-essential-3 {
    animation: essential-flow 1.2s ease-in-out infinite;
    animation-delay: -0.8s;
    width: 9px;
    height: 9px;
    opacity: 0.85;
}

/* Load Dots - Emerald */
.energy-dot-load {
    background: #10b981;
    box-shadow: 0 0 8px 2px rgba(16, 185, 129, 0.7);
    animation: load-flow 1.5s ease-in-out infinite;
}
.energy-dot-load-2 {
    animation: load-flow 1.5s ease-in-out infinite;
    animation-delay: -0.5s;
    width: 10px;
    height: 10px;
}
.energy-dot-load-3 {
    animation: load-flow 1.5s ease-in-out infinite;
    animation-delay: -1.0s;
    width: 9px;
    height: 9px;
    opacity: 0.85;
}

/* Keyframe Animations - Desktop (consistent positioning) */
/* Grid columns: left=16.67%, center-left=33.33%, center=50%, center-right=66.67%, right=83.33% */
@keyframes pv-flow {
    0% { left: 16.67%; top: 0%; opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    5% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    30% { left: 16.67%; top: 48%; }
    50% { left: 33.33%; top: 50%; }
    70% { left: 50%; top: 52%; }
    95% { left: 50%; top: 98%; opacity: 1; }
    100% { left: 50%; top: 100%; opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
}

@keyframes evn-flow {
    0% { left: 83.33%; top: 0%; opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    5% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    30% { left: 83.33%; top: 48%; }
    50% { left: 66.67%; top: 50%; }
    70% { left: 50%; top: 52%; }
    95% { left: 50%; top: 98%; opacity: 1; }
    100% { left: 50%; top: 100%; opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
}

@keyframes battery-charge {
    0% { left: 50%; top: 0%; opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    5% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    30% { left: 50%; top: 48%; }
    50% { left: 33.33%; top: 50%; }
    70% { left: 16.67%; top: 52%; }
    95% { left: 16.67%; top: 98%; opacity: 1; }
    100% { left: 16.67%; top: 100%; opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
}

@keyframes battery-discharge {
    0% { left: 16.67%; top: 100%; opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    5% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    30% { left: 16.67%; top: 52%; }
    50% { left: 33.33%; top: 50%; }
    70% { left: 50%; top: 48%; }
    95% { left: 50%; top: 2%; opacity: 1; }
    100% { left: 50%; top: 0%; opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
}

@keyframes essential-flow {
    0% { left: 50%; top: 0%; opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    10% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    90% { opacity: 1; }
    100% { left: 50%; top: 100%; opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
}

@keyframes load-flow {
    0% { left: 50%; top: 0%; opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    5% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    30% { left: 50%; top: 48%; }
    50% { left: 66.67%; top: 50%; }
    70% { left: 83.33%; top: 52%; }
    95% { left: 83.33%; top: 98%; opacity: 1; }
    100% { left: 83.33%; top: 100%; opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
}

/* ========================================
   ENERGY FLOW ICON GLOW EFFECTS
   ======================================== */

.icon-glow-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    margin-bottom: 8px;
}

@media (min-width: 640px) {
    .icon-glow-container {
        width: 72px;
        height: 72px;
    }
}

.icon-glow-img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    position: relative;
    z-index: 20;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15));
}

@media (min-width: 640px) {
    .icon-glow-img {
        width: 64px;
        height: 64px;
    }
}

.icon-glow-aura {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    border-radius: 50%;
    z-index: 1;
    filter: blur(16px);
    opacity: 0.6;
    animation: icon-aura-pulse 5s ease-in-out infinite;
}

@media (min-width: 640px) {
    .icon-glow-aura {
        width: 84px;
        height: 84px;
        filter: blur(20px);
    }
}

@keyframes icon-aura-pulse {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(0.85); 
        opacity: 0.5; 
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.15); 
        opacity: 0.8; 
    }
}

/* PV - Amber glow */
.icon-glow-pv .icon-glow-aura {
    background: radial-gradient(circle, rgba(251, 191, 36, 0.9) 0%, rgba(249, 115, 22, 0.5) 40%, transparent 70%);
}

/* ========================================
   PV SUN ICONS - Multiple Suns Animation
   ======================================== */

/* Base sun styles */
.sun-animated {
    position: absolute;
    z-index: 25;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.sun-animated.visible {
    opacity: 1;
}

.sun-icon {
    width: 20px;
    height: 20px;
    filter: drop-shadow(0 0 2px rgba(251, 191, 36, 0.5)) drop-shadow(0 0 4px rgba(245, 158, 11, 0.3));
}

@media (min-width: 640px) {
    .sun-icon {
        width: 24px;
        height: 24px;
    }
}

/* Sun 1 - Main sun (top center) */
.sun-main {
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
}

.sun-main.visible .sun-icon {
    animation: sun-pulse 3s ease-in-out infinite;
}

/* Sun 2 - Left sun */
.sun-2 {
    top: 8px;
    left: -4px;
}

.sun-2.visible .sun-icon {
    animation: sun-pulse 3s ease-in-out infinite 0.5s;
}

/* Sun 3 - Right sun */
.sun-3 {
    top: 8px;
    right: -4px;
}

.sun-3.visible .sun-icon {
    animation: sun-pulse 3s ease-in-out infinite 1s;
}

@media (min-width: 640px) {
    .sun-main {
        top: -4px;
    }
    .sun-2 {
        top: 6px;
        left: -6px;
    }
    .sun-3 {
        top: 6px;
        right: -6px;
    }
}

/* Sun pulse animation */
@keyframes sun-pulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 2px rgba(251, 191, 36, 0.5)) drop-shadow(0 0 4px rgba(245, 158, 11, 0.3));
    }
    50% {
        transform: scale(1.1);
        filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.6)) drop-shadow(0 0 8px rgba(245, 158, 11, 0.4));
    }
}

/* EVN Grid - Amber glow (matching lightning/PV theme) */
.icon-glow-evn .icon-glow-aura {
    background: radial-gradient(circle, rgba(251, 191, 36, 0.9) 0%, rgba(249, 115, 22, 0.5) 40%, transparent 70%);
    animation-delay: 0.8s;
}

/* Inverter - Indigo glow */
.icon-glow-inverter .icon-glow-aura {
    background: radial-gradient(circle, rgba(99, 102, 241, 0.9) 0%, rgba(79, 70, 229, 0.5) 40%, transparent 70%);
    animation-delay: 1s;
}

/* Battery - Emerald glow */
.icon-glow-battery .icon-glow-aura {
    background: radial-gradient(circle, rgba(16, 185, 129, 0.9) 0%, rgba(5, 150, 105, 0.5) 40%, transparent 70%);
    animation-delay: 0.5s;
}
.icon-glow-battery .battery-icon-wrapper {
    display: flex;
    align-items: center;
    position: relative;
    z-index: 20;
    border-radius: 6px;
}

/* Essential Load - Indigo glow */
.icon-glow-essential .icon-glow-aura {
    background: radial-gradient(circle, rgba(99, 102, 241, 0.9) 0%, rgba(79, 70, 229, 0.5) 40%, transparent 70%);
    animation-delay: 1.5s;
}

/* Load - Emerald glow */
.icon-glow-load .icon-glow-aura {
    background: radial-gradient(circle, rgba(16, 185, 129, 0.9) 0%, rgba(5, 150, 105, 0.5) 40%, transparent 70%);
    animation-delay: 2s;
}

/* Dark mode enhancements */
.dark .icon-glow-aura {
    opacity: 0.8;
    animation: icon-aura-pulse-dark 5s ease-in-out infinite;
}

@keyframes icon-aura-pulse-dark {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(0.9); 
        opacity: 0.7; 
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.2); 
        opacity: 1; 
    }
}

/* ========================================
   EVN ELECTRIC SPARK ANIMATION
   ======================================== */

.evn-spark-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 30;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.evn-spark-container.active {
    opacity: 1;
}

/* Ẩn tất cả tia cũ */
.evn-spark {
    display: none;
}

/* Tia sét chính - dùng hình ảnh PNG */
.evn-spark-container.active::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 22px;
    background-image: url('/icons/lightning-bolt-small.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(0 0 4px #fbbf24) drop-shadow(0 0 8px #f59e0b);
    opacity: 0;
    animation: evn-lightning-flash 2.5s ease-in-out infinite;
}

@keyframes evn-lightning-flash {
    0%, 100% {
        opacity: 0;
        transform: translateX(-50%) scale(0.8);
    }
    12% {
        opacity: 1;
        transform: translateX(-50%) scale(1.15);
    }
    20% {
        opacity: 0.3;
        transform: translateX(-50%) scale(1);
    }
    28% {
        opacity: 1;
        transform: translateX(-50%) scale(1.1);
    }
    45% {
        opacity: 0.8;
        transform: translateX(-50%) scale(1);
    }
    65% {
        opacity: 0;
        transform: translateX(-50%) scale(0.9);
    }
}

/* ========================================
   SOC CHART SECTION - Enhanced
   ======================================== */

.soc-chart-container {
    height: 220px;
}

@media (min-width: 640px) {
    .soc-chart-container {
        height: 280px;
    }
}

/* ========================================
   GRADIENT BACKGROUNDS - Updated Palette
   ======================================== */

.gradient-pv {
    background: linear-gradient(135deg, var(--color-accent-400) 0%, var(--color-accent-500) 100%);
}

.gradient-battery {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.gradient-grid {
    background: linear-gradient(135deg, var(--color-secondary-500) 0%, var(--color-secondary-600) 100%);
}

.gradient-load {
    background: linear-gradient(135deg, var(--color-primary-500) 0%, var(--color-primary-600) 100%);
}

.gradient-essential {
    background: linear-gradient(135deg, var(--color-secondary-500) 0%, var(--color-secondary-600) 100%);
}

/* ========================================
   BATTERY ICON WITH FILL
   ======================================== */

.battery-icon-container {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    position: relative;
    min-width: 52px;
    min-height: 52px;
    border-radius: var(--radius-md);
}

@media (min-width: 640px) {
    .battery-icon-container {
        min-width: 60px;
        min-height: 60px;
    }
}

.battery-fill {
    transition: height 0.5s ease;
}

.battery-percent-large {
    font-size: 16px;
    font-weight: 900;
    text-shadow: 0 2px 4px rgba(0,0,0,0.6);
    letter-spacing: -0.5px;
}

@media (min-width: 640px) {
    .battery-percent-large {
        font-size: 18px;
    }
}

/* ========================================
   SECTION CARDS - Unified Style
   ======================================== */

#soc-section,
#energy-chart-section,
#batteryCellSection > div {
    border: none;
    box-shadow: var(--shadow-lg);
    transition: var(--transition-normal);
}

#soc-section:hover,
#energy-chart-section:hover,
#batteryCellSection > div:hover {
    box-shadow: var(--shadow-xl);
}

/* SOC Section special styling */
#soc-section {
    background: linear-gradient(135deg, white, #f0fdfa);
    border-left: 4px solid var(--color-primary-500);
}

.dark #soc-section {
    background: linear-gradient(135deg, var(--bg-dark-800), #0f2927);
}

/* Energy Chart Section */
#energy-chart-section {
    background: linear-gradient(135deg, white, #f8fafc);
    border-left: 4px solid var(--color-secondary-500);
}

.dark #energy-chart-section {
    background: linear-gradient(135deg, var(--bg-dark-800), #1a1a2e);
}

/* Cell Section */
#batteryCellSection > div {
    background: linear-gradient(135deg, white, #f0fdfa);
    border-left: 4px solid var(--color-primary-500);
}

.dark #batteryCellSection > div {
    background: linear-gradient(135deg, var(--bg-dark-800), #0f2927);
}

/* ========================================
   SOLAR RADIATION FORECAST
   ======================================== */

#solarForecastSection {
    background: white;
    border-radius: 12px;
    padding: 12px;
    border: 1px solid #e2e8f0;
}

.dark #solarForecastSection {
    background: var(--bg-dark-800);
    border-color: var(--bg-dark-700);
}

/* Solar hour item */
.solar-hour-item {
    flex-shrink: 0;
    width: 56px;
    padding: 6px 4px;
    border-radius: 10px;
    text-align: center;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

@media (min-width: 640px) {
    .solar-hour-item {
        width: 62px;
        padding: 8px 6px;
    }
}

/* Solar hour item time text */
.solar-hour-item .solar-time {
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
}

@media (min-width: 640px) {
    .solar-hour-item .solar-time {
        font-size: 12px;
    }
}

/* Solar hour item icon */
.solar-hour-item .solar-icon {
    font-size: 18px;
    margin: 2px 0;
    line-height: 1;
}

@media (min-width: 640px) {
    .solar-hour-item .solar-icon {
        font-size: 20px;
        margin: 3px 0;
    }
}

/* Solar hour item radiation value */
.solar-hour-item .solar-value {
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
}

@media (min-width: 640px) {
    .solar-hour-item .solar-value {
        font-size: 14px;
    }
}

/* Solar hour rain probability */
.solar-hour-item .solar-rain {
    font-size: 9px;
    font-weight: 600;
    margin-top: 2px;
    line-height: 1;
}

@media (min-width: 640px) {
    .solar-hour-item .solar-rain {
        font-size: 10px;
    }
}

.solar-hour-item:hover {
    transform: translateY(-2px);
}

.solar-hour-item.current {
    border-color: var(--color-accent-400);
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.3);
}

/* Solar level colors */
.solar-level-none {
    background: linear-gradient(180deg, #1e293b 0%, #334155 100%);
}

.solar-level-low {
    background: linear-gradient(180deg, #fef3c7 0%, #fde68a 100%);
}

.solar-level-medium {
    background: linear-gradient(180deg, #fde68a 0%, #fbbf24 100%);
}

.solar-level-high {
    background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
}

.solar-level-extreme {
    background: linear-gradient(180deg, #f59e0b 0%, #ea580c 100%);
}

.dark .solar-level-none {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
}

.dark .solar-level-low {
    background: linear-gradient(180deg, #78350f 0%, #451a03 100%);
}

.dark .solar-level-medium {
    background: linear-gradient(180deg, #92400e 0%, #78350f 100%);
}

.dark .solar-level-high {
    background: linear-gradient(180deg, #b45309 0%, #92400e 100%);
}

.dark .solar-level-extreme {
    background: linear-gradient(180deg, #c2410c 0%, #b45309 100%);
}

/* Custom scrollbar for solar forecast */
#solarHourlyScroll::-webkit-scrollbar {
    height: 4px;
}

#solarHourlyScroll::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 2px;
}

#solarHourlyScroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.dark #solarHourlyScroll::-webkit-scrollbar-track {
    background: #1e293b;
}

.dark #solarHourlyScroll::-webkit-scrollbar-thumb {
    background: #475569;
}

/* Solar City Selector */
#solar-city-select {
    font-size: 10px;
    min-width: 100px;
    max-width: 140px;
}

#solar-city-select option {
    padding: 4px 8px;
}

#solar-city-select optgroup {
    font-weight: 600;
    color: #64748b;
}

.dark #solar-city-select optgroup {
    color: #94a3b8;
}

/* ========================================
   MOBILE PERFORMANCE OPTIMIZATIONS
   ======================================== */

/* GPU acceleration for animated elements */
.sun-animated,
.evn-spark-container,
.energy-dot,
.icon-glow-aura,
.icon-glow-img,
.lightning-bolt {
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Reduce animations on mobile for better performance */
@media (max-width: 640px) {
    /* Slower, simpler animations on mobile */
    .sun-animated.visible .sun-icon {
        animation-duration: 5s !important;
    }
    
    .icon-glow-aura {
        animation-duration: 8s !important;
    }
    
    .evn-spark-container.active::before {
        animation-duration: 5s !important;
    }
    
    /* Reduce energy dot animations */
    .energy-dot {
        animation-duration: 2.5s !important;
    }
    
    /* Simplify glow effects on mobile */
    .sun-icon {
        filter: drop-shadow(0 0 2px rgba(251, 191, 36, 0.4)) !important;
    }
    
    .evn-spark-container.active::before {
        filter: drop-shadow(0 0 2px #fbbf24) !important;
    }
    
    /* Disable some secondary animations on mobile */
    .icon-glow-aura {
        animation: none !important;
        opacity: 0.4 !important;
    }
    
    /* ========== MOBILE ENERGY FLOW ANIMATIONS - CENTERED ========== */
    /* Override keyframes for mobile to center the dots on the flow lines */
    
    /* PV flow - starts at left column center (16.67%) */
    .energy-dot-pv,
    .energy-dot-pv-2,
    .energy-dot-pv-3,
    .energy-dot-pv-4,
    .energy-dot-pv-5 {
        animation-name: pv-flow-mobile !important;
    }
    
    /* EVN flow - starts at right column center (83.33%) */
    .energy-dot-evn,
    .energy-dot-evn-2,
    .energy-dot-evn-3,
    .energy-dot-evn-4,
    .energy-dot-evn-5 {
        animation-name: evn-flow-mobile !important;
    }
    
    /* Battery charging - from center to left column */
    .energy-dot-battery.charging,
    .energy-dot-battery-2.charging,
    .energy-dot-battery-3.charging {
        animation-name: battery-charge-mobile !important;
    }
    
    /* Battery discharging - from left column to center */
    .energy-dot-battery.discharging,
    .energy-dot-battery-2.discharging,
    .energy-dot-battery-3.discharging {
        animation-name: battery-discharge-mobile !important;
    }
    
    /* Essential flow - from center straight down */
    .energy-dot-essential,
    .energy-dot-essential-2,
    .energy-dot-essential-3 {
        animation-name: essential-flow-mobile !important;
    }
    
    /* Load flow - from center to right column */
    .energy-dot-load,
    .energy-dot-load-2,
    .energy-dot-load-3 {
        animation-name: load-flow-mobile !important;
    }
}

/* Mobile-specific keyframes - adjusted positions for 3-column grid layout */
/* On mobile, grid uses gap-2 (0.5rem) so positions need slight adjustment */
/* The flow lines use left-[16.67%] and left-[83.33%] which are 1/6 and 5/6 of container */

@keyframes pv-flow-mobile {
    0% { 
        left: 16.67%; 
        top: 0%; 
        opacity: 0; 
        transform: translate(-50%, -50%) scale(0.5); 
    }
    5% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    30% { left: 16.67%; top: 48%; }
    50% { left: 33.33%; top: 50%; }
    70% { left: 50%; top: 52%; }
    95% { left: 50%; top: 98%; opacity: 1; }
    100% { left: 50%; top: 100%; opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
}

@keyframes evn-flow-mobile {
    0% { 
        left: 83.33%; 
        top: 0%; 
        opacity: 0; 
        transform: translate(-50%, -50%) scale(0.5); 
    }
    5% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    30% { left: 83.33%; top: 48%; }
    50% { left: 66.67%; top: 50%; }
    70% { left: 50%; top: 52%; }
    95% { left: 50%; top: 98%; opacity: 1; }
    100% { left: 50%; top: 100%; opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
}

@keyframes battery-charge-mobile {
    0% { left: 50%; top: 0%; opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    5% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    30% { left: 50%; top: 48%; }
    50% { left: 33.33%; top: 50%; }
    70% { left: 16.67%; top: 52%; }
    95% { left: 16.67%; top: 98%; opacity: 1; }
    100% { left: 16.67%; top: 100%; opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
}

@keyframes battery-discharge-mobile {
    0% { left: 16.67%; top: 100%; opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    5% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    30% { left: 16.67%; top: 52%; }
    50% { left: 33.33%; top: 50%; }
    70% { left: 50%; top: 48%; }
    95% { left: 50%; top: 2%; opacity: 1; }
    100% { left: 50%; top: 0%; opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
}

@keyframes essential-flow-mobile {
    0% { left: 50%; top: 0%; opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    10% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    90% { opacity: 1; }
    100% { left: 50%; top: 100%; opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
}

@keyframes load-flow-mobile {
    0% { left: 50%; top: 0%; opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    5% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    30% { left: 50%; top: 48%; }
    50% { left: 66.67%; top: 50%; }
    70% { left: 83.33%; top: 52%; }
    95% { left: 83.33%; top: 98%; opacity: 1; }
    100% { left: 83.33%; top: 100%; opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
}

/* Respect user's reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .sun-animated,
    .evn-spark-container,
    .energy-dot,
    .icon-glow-aura {
        animation: none !important;
    }
    
    .sun-animated.visible {
        opacity: 1;
    }
    
    .evn-spark-container.active {
        opacity: 1;
    }
}

/* ========================================
   LOAD HEAT EFFECT - Tải tiêu thụ Animation
   Shows heat level based on power consumption
   ======================================== */

/* Base card styling */
.load-heat-card {
    transition: all 0.5s ease-in-out;
}

/* Heat waves container */
.heat-waves-container {
    background: linear-gradient(180deg, transparent 0%, transparent 100%);
    transition: all 0.5s ease-in-out;
}

/* Heat level classes */
/* Level 0: < 1000W - Cool (no effect) */
.load-heat-card.heat-level-0 {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(30, 41, 59, 0.9);
}

/* Level 1: 1000-2000W - Warm yellow */
.load-heat-card.heat-level-1 {
    border-color: rgba(250, 204, 21, 0.5);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.9) 0%, rgba(250, 204, 21, 0.15) 100%);
    box-shadow: 0 0 20px rgba(250, 204, 21, 0.2);
}

.load-heat-card.heat-level-1 .heat-waves-container {
    opacity: 0.3;
    background: linear-gradient(180deg, transparent 60%, rgba(250, 204, 21, 0.3) 100%);
    animation: heat-wave-slow 3s ease-in-out infinite;
}

.load-heat-card.heat-level-1 #load-power-3d,
.load-heat-card.heat-level-1 #load-label-3d {
    color: #facc15;
}

/* Level 2: 2000-3000W - Orange warm */
.load-heat-card.heat-level-2 {
    border-color: rgba(251, 146, 60, 0.6);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.9) 0%, rgba(251, 146, 60, 0.2) 100%);
    box-shadow: 0 0 25px rgba(251, 146, 60, 0.3);
}

.load-heat-card.heat-level-2 .heat-waves-container {
    opacity: 0.5;
    background: linear-gradient(180deg, transparent 40%, rgba(251, 146, 60, 0.4) 100%);
    animation: heat-wave-medium 2s ease-in-out infinite;
}

.load-heat-card.heat-level-2 #load-power-3d,
.load-heat-card.heat-level-2 #load-label-3d {
    color: #fb923c;
}

.load-heat-card.heat-level-2 #load-icon-3d {
    filter: drop-shadow(0 0 8px rgba(251, 146, 60, 0.6));
}

/* Level 3: 3000-4000W - Red-orange hot */
.load-heat-card.heat-level-3 {
    border-color: rgba(249, 115, 22, 0.7);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.85) 0%, rgba(249, 115, 22, 0.3) 100%);
    box-shadow: 0 0 30px rgba(249, 115, 22, 0.4);
}

.load-heat-card.heat-level-3 .heat-waves-container {
    opacity: 0.7;
    background: linear-gradient(180deg, transparent 20%, rgba(249, 115, 22, 0.5) 100%);
    animation: heat-wave-fast 1.5s ease-in-out infinite;
}

.load-heat-card.heat-level-3 #load-power-3d,
.load-heat-card.heat-level-3 #load-label-3d {
    color: #f97316;
}

.load-heat-card.heat-level-3 #load-icon-3d {
    filter: drop-shadow(0 0 12px rgba(249, 115, 22, 0.8));
    animation: icon-pulse 1.5s ease-in-out infinite;
}

/* Level 4: > 4000W - Red hot! */
.load-heat-card.heat-level-4 {
    border-color: rgba(239, 68, 68, 0.8);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.8) 0%, rgba(239, 68, 68, 0.35) 100%);
    box-shadow: 0 0 40px rgba(239, 68, 68, 0.5), 0 0 60px rgba(239, 68, 68, 0.2);
}

.load-heat-card.heat-level-4 .heat-waves-container {
    opacity: 1;
    background: linear-gradient(180deg, transparent 0%, rgba(239, 68, 68, 0.6) 100%);
    animation: heat-wave-intense 1s ease-in-out infinite;
}

.load-heat-card.heat-level-4::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 50%, rgba(239, 68, 68, 0.1) 100%);
    animation: heat-shimmer 0.5s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 1;
}

.load-heat-card.heat-level-4 #load-power-3d,
.load-heat-card.heat-level-4 #load-label-3d {
    color: #ef4444;
    animation: text-glow-red 1s ease-in-out infinite alternate;
}

.load-heat-card.heat-level-4 #load-icon-3d {
    filter: drop-shadow(0 0 15px rgba(239, 68, 68, 1));
    animation: icon-shake 0.3s ease-in-out infinite;
}

/* Heat wave animations */
@keyframes heat-wave-slow {
    0%, 100% { 
        transform: translateY(0);
        opacity: 0.3;
    }
    50% { 
        transform: translateY(-5px);
        opacity: 0.5;
    }
}

@keyframes heat-wave-medium {
    0%, 100% { 
        transform: translateY(0);
        opacity: 0.5;
    }
    50% { 
        transform: translateY(-8px);
        opacity: 0.7;
    }
}

@keyframes heat-wave-fast {
    0%, 100% { 
        transform: translateY(0);
        opacity: 0.7;
    }
    50% { 
        transform: translateY(-10px);
        opacity: 0.9;
    }
}

@keyframes heat-wave-intense {
    0%, 100% { 
        transform: translateY(0) scaleY(1);
        opacity: 0.8;
    }
    50% { 
        transform: translateY(-12px) scaleY(1.1);
        opacity: 1;
    }
}

@keyframes heat-shimmer {
    0% { opacity: 0.1; }
    100% { opacity: 0.3; }
}

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

@keyframes icon-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

@keyframes text-glow-red {
    0% { text-shadow: 0 0 5px rgba(239, 68, 68, 0.5); }
    100% { text-shadow: 0 0 15px rgba(239, 68, 68, 0.8), 0 0 25px rgba(239, 68, 68, 0.4); }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .load-heat-card,
    .load-heat-card .heat-waves-container,
    .load-heat-card #load-icon-3d,
    .load-heat-card #load-power-3d,
    .load-heat-card #load-label-3d {
        animation: none !important;
    }
}

/* ========================================
   ESSENTIAL LOAD HEAT EFFECT - Tải cổng load
   Same levels as Load Heat Effect (1000/2000/3000/4000W)
   ======================================== */

/* Base card styling */
.essential-heat-card {
    transition: all 0.5s ease-in-out;
}

/* Level 0: < 1000W - Cool (no effect) */
.essential-heat-card.essential-level-0 {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(30, 41, 59, 0.9);
}

/* Level 1: 1000-2000W - Warm yellow */
.essential-heat-card.essential-level-1 {
    border-color: rgba(250, 204, 21, 0.5);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.9) 0%, rgba(250, 204, 21, 0.15) 100%);
    box-shadow: 0 0 20px rgba(250, 204, 21, 0.2);
}

.essential-heat-card.essential-level-1 #essential-power-3d,
.essential-heat-card.essential-level-1 .essential-label {
    color: #facc15;
}

.essential-heat-card.essential-level-1 #essential-icon-3d {
    filter: drop-shadow(0 0 6px rgba(250, 204, 21, 0.5));
    animation: essential-glow-slow 3s ease-in-out infinite;
}

/* Level 2: 2000-3000W - Orange warm */
.essential-heat-card.essential-level-2 {
    border-color: rgba(251, 146, 60, 0.6);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.9) 0%, rgba(251, 146, 60, 0.2) 100%);
    box-shadow: 0 0 25px rgba(251, 146, 60, 0.3);
}

.essential-heat-card.essential-level-2 #essential-power-3d,
.essential-heat-card.essential-level-2 .essential-label {
    color: #fb923c;
}

.essential-heat-card.essential-level-2 #essential-icon-3d {
    filter: drop-shadow(0 0 10px rgba(251, 146, 60, 0.6));
    animation: essential-glow-medium 2s ease-in-out infinite;
}

/* Level 3: 3000-4000W - Red-orange hot */
.essential-heat-card.essential-level-3 {
    border-color: rgba(249, 115, 22, 0.7);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.85) 0%, rgba(249, 115, 22, 0.3) 100%);
    box-shadow: 0 0 30px rgba(249, 115, 22, 0.4);
}

.essential-heat-card.essential-level-3 #essential-power-3d,
.essential-heat-card.essential-level-3 .essential-label {
    color: #f97316;
}

.essential-heat-card.essential-level-3 #essential-icon-3d {
    filter: drop-shadow(0 0 12px rgba(249, 115, 22, 0.8));
    animation: icon-pulse 1.5s ease-in-out infinite;
}

/* Level 4: > 4000W - Red hot! */
.essential-heat-card.essential-level-4 {
    border-color: rgba(239, 68, 68, 0.8);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.8) 0%, rgba(239, 68, 68, 0.35) 100%);
    box-shadow: 0 0 40px rgba(239, 68, 68, 0.5), 0 0 60px rgba(239, 68, 68, 0.2);
}

.essential-heat-card.essential-level-4 #essential-power-3d,
.essential-heat-card.essential-level-4 .essential-label {
    color: #ef4444;
    animation: text-glow-red 1s ease-in-out infinite alternate;
}

.essential-heat-card.essential-level-4 #essential-icon-3d {
    filter: drop-shadow(0 0 15px rgba(239, 68, 68, 1));
    animation: icon-shake 0.3s ease-in-out infinite;
}

/* Essential glow animations */
@keyframes essential-glow-slow {
    0%, 100% { 
        filter: drop-shadow(0 0 6px rgba(250, 204, 21, 0.5));
    }
    50% { 
        filter: drop-shadow(0 0 12px rgba(250, 204, 21, 0.7));
    }
}

@keyframes essential-glow-medium {
    0%, 100% { 
        filter: drop-shadow(0 0 10px rgba(251, 146, 60, 0.6));
    }
    50% { 
        filter: drop-shadow(0 0 18px rgba(251, 146, 60, 0.8));
    }
}

/* ========================================
   BATTERY HEAT EFFECT - Pin sạc/xả
   Charging: Green levels
   Discharging: Red levels
   ======================================== */

/* Base battery card styling */
.battery-heat-card {
    transition: all 0.5s ease-in-out;
}

/* CHARGING MODE - Green colors */
/* Level 0: < 1000W - Light green */
.battery-heat-card.battery-charging-0 {
    border-color: rgba(74, 222, 128, 0.4);
    background: rgba(30, 41, 59, 0.9);
}

.battery-heat-card.battery-charging-0 #battery-power-3d,
.battery-heat-card.battery-charging-0 .battery-label {
    color: #4ade80;
}

.battery-heat-card.battery-charging-0 .battery-fill-3d {
    background: linear-gradient(90deg, #4ade80, #86efac);
}

/* Level 1: 1000-2000W - Medium green */
.battery-heat-card.battery-charging-1 {
    border-color: rgba(34, 197, 94, 0.5);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.9) 0%, rgba(34, 197, 94, 0.15) 100%);
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.25);
}

.battery-heat-card.battery-charging-1 #battery-power-3d,
.battery-heat-card.battery-charging-1 .battery-label {
    color: #22c55e;
}

.battery-heat-card.battery-charging-1 .battery-fill-3d {
    background: linear-gradient(90deg, #22c55e, #4ade80);
    animation: battery-charge-pulse-slow 3s ease-in-out infinite;
}

.battery-heat-card.battery-charging-1 .battery-body-3d {
    box-shadow: inset 0 0 10px rgba(34, 197, 94, 0.3);
}

/* Level 2: 2000-3000W - Bright green */
.battery-heat-card.battery-charging-2 {
    border-color: rgba(22, 163, 74, 0.6);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.9) 0%, rgba(22, 163, 74, 0.2) 100%);
    box-shadow: 0 0 25px rgba(22, 163, 74, 0.35);
}

.battery-heat-card.battery-charging-2 #battery-power-3d,
.battery-heat-card.battery-charging-2 .battery-label {
    color: #16a34a;
}

.battery-heat-card.battery-charging-2 .battery-fill-3d {
    background: linear-gradient(90deg, #16a34a, #22c55e);
    animation: battery-charge-pulse-medium 2s ease-in-out infinite;
}

.battery-heat-card.battery-charging-2 .battery-body-3d {
    box-shadow: inset 0 0 15px rgba(22, 163, 74, 0.4);
}

/* Level 3: > 3000W - Intense green */
.battery-heat-card.battery-charging-3 {
    border-color: rgba(21, 128, 61, 0.7);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.85) 0%, rgba(21, 128, 61, 0.3) 100%);
    box-shadow: 0 0 35px rgba(21, 128, 61, 0.45), 0 0 50px rgba(21, 128, 61, 0.15);
}

.battery-heat-card.battery-charging-3 #battery-power-3d,
.battery-heat-card.battery-charging-3 .battery-label {
    color: #15803d;
    animation: text-glow-green 1.5s ease-in-out infinite alternate;
}

.battery-heat-card.battery-charging-3 .battery-fill-3d {
    background: linear-gradient(90deg, #15803d, #16a34a, #22c55e);
    animation: battery-charge-pulse-fast 1.5s ease-in-out infinite;
}

.battery-heat-card.battery-charging-3 .battery-body-3d {
    box-shadow: inset 0 0 20px rgba(21, 128, 61, 0.5);
    animation: battery-glow-green 1.5s ease-in-out infinite;
}

/* DISCHARGING MODE - Red colors */
/* Level 0: < 1000W - Light red */
.battery-heat-card.battery-discharging-0 {
    border-color: rgba(252, 165, 165, 0.4);
    background: rgba(30, 41, 59, 0.9);
}

.battery-heat-card.battery-discharging-0 #battery-power-3d,
.battery-heat-card.battery-discharging-0 .battery-label {
    color: #fca5a5;
}

.battery-heat-card.battery-discharging-0 .battery-fill-3d {
    background: linear-gradient(90deg, #fca5a5, #f87171);
}

/* Level 1: 1000-2000W - Medium red */
.battery-heat-card.battery-discharging-1 {
    border-color: rgba(248, 113, 113, 0.5);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.9) 0%, rgba(248, 113, 113, 0.15) 100%);
    box-shadow: 0 0 20px rgba(248, 113, 113, 0.25);
}

.battery-heat-card.battery-discharging-1 #battery-power-3d,
.battery-heat-card.battery-discharging-1 .battery-label {
    color: #f87171;
}

.battery-heat-card.battery-discharging-1 .battery-fill-3d {
    background: linear-gradient(90deg, #f87171, #ef4444);
    animation: battery-discharge-pulse-slow 3s ease-in-out infinite;
}

.battery-heat-card.battery-discharging-1 .battery-body-3d {
    box-shadow: inset 0 0 10px rgba(248, 113, 113, 0.3);
}

/* Level 2: 2000-3000W - Bright red */
.battery-heat-card.battery-discharging-2 {
    border-color: rgba(239, 68, 68, 0.6);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.9) 0%, rgba(239, 68, 68, 0.2) 100%);
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.35);
}

.battery-heat-card.battery-discharging-2 #battery-power-3d,
.battery-heat-card.battery-discharging-2 .battery-label {
    color: #ef4444;
}

.battery-heat-card.battery-discharging-2 .battery-fill-3d {
    background: linear-gradient(90deg, #ef4444, #dc2626);
    animation: battery-discharge-pulse-medium 2s ease-in-out infinite;
}

.battery-heat-card.battery-discharging-2 .battery-body-3d {
    box-shadow: inset 0 0 15px rgba(239, 68, 68, 0.4);
}

/* Level 3: > 3000W - Intense red */
.battery-heat-card.battery-discharging-3 {
    border-color: rgba(220, 38, 38, 0.7);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.85) 0%, rgba(220, 38, 38, 0.3) 100%);
    box-shadow: 0 0 35px rgba(220, 38, 38, 0.45), 0 0 50px rgba(220, 38, 38, 0.15);
}

.battery-heat-card.battery-discharging-3 #battery-power-3d,
.battery-heat-card.battery-discharging-3 .battery-label {
    color: #dc2626;
    animation: text-glow-red 1s ease-in-out infinite alternate;
}

.battery-heat-card.battery-discharging-3 .battery-fill-3d {
    background: linear-gradient(90deg, #dc2626, #b91c1c, #991b1b);
    animation: battery-discharge-pulse-fast 1s ease-in-out infinite;
}

.battery-heat-card.battery-discharging-3 .battery-body-3d {
    box-shadow: inset 0 0 20px rgba(220, 38, 38, 0.5);
    animation: battery-glow-red 1s ease-in-out infinite;
}

/* IDLE MODE - No charging/discharging */
.battery-heat-card.battery-idle {
    border-color: rgba(148, 163, 184, 0.3);
    background: rgba(30, 41, 59, 0.9);
}

.battery-heat-card.battery-idle #battery-power-3d,
.battery-heat-card.battery-idle .battery-label {
    color: #94a3b8;
}

.battery-heat-card.battery-idle .battery-fill-3d {
    background: linear-gradient(90deg, #64748b, #94a3b8);
}

/* Battery animations */
@keyframes battery-charge-pulse-slow {
    0%, 100% { 
        opacity: 0.85;
        box-shadow: 0 0 5px rgba(34, 197, 94, 0.3);
    }
    50% { 
        opacity: 1;
        box-shadow: 0 0 15px rgba(34, 197, 94, 0.5);
    }
}

@keyframes battery-charge-pulse-medium {
    0%, 100% { 
        opacity: 0.85;
        box-shadow: 0 0 8px rgba(22, 163, 74, 0.4);
    }
    50% { 
        opacity: 1;
        box-shadow: 0 0 20px rgba(22, 163, 74, 0.6);
    }
}

@keyframes battery-charge-pulse-fast {
    0%, 100% { 
        opacity: 0.85;
        box-shadow: 0 0 10px rgba(21, 128, 61, 0.5);
    }
    50% { 
        opacity: 1;
        box-shadow: 0 0 25px rgba(21, 128, 61, 0.7);
    }
}

@keyframes battery-discharge-pulse-slow {
    0%, 100% { 
        opacity: 0.85;
        box-shadow: 0 0 5px rgba(248, 113, 113, 0.3);
    }
    50% { 
        opacity: 1;
        box-shadow: 0 0 15px rgba(248, 113, 113, 0.5);
    }
}

@keyframes battery-discharge-pulse-medium {
    0%, 100% { 
        opacity: 0.85;
        box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
    }
    50% { 
        opacity: 1;
        box-shadow: 0 0 20px rgba(239, 68, 68, 0.6);
    }
}

@keyframes battery-discharge-pulse-fast {
    0%, 100% { 
        opacity: 0.85;
        box-shadow: 0 0 10px rgba(220, 38, 38, 0.5);
    }
    50% { 
        opacity: 1;
        box-shadow: 0 0 25px rgba(220, 38, 38, 0.7);
    }
}

@keyframes battery-glow-green {
    0%, 100% { 
        box-shadow: inset 0 0 15px rgba(21, 128, 61, 0.4);
    }
    50% { 
        box-shadow: inset 0 0 25px rgba(21, 128, 61, 0.6);
    }
}

@keyframes battery-glow-red {
    0%, 100% { 
        box-shadow: inset 0 0 15px rgba(220, 38, 38, 0.4);
    }
    50% { 
        box-shadow: inset 0 0 25px rgba(220, 38, 38, 0.6);
    }
}

@keyframes text-glow-green {
    0% { text-shadow: 0 0 5px rgba(21, 128, 61, 0.5); }
    100% { text-shadow: 0 0 15px rgba(21, 128, 61, 0.8), 0 0 25px rgba(21, 128, 61, 0.4); }
}

/* Respect reduced motion for all heat effects */
@media (prefers-reduced-motion: reduce) {
    .essential-heat-card,
    .essential-heat-card #essential-icon-3d,
    .essential-heat-card #essential-power-3d,
    .battery-heat-card,
    .battery-heat-card .battery-fill-3d,
    .battery-heat-card .battery-body-3d,
    .battery-heat-card #battery-power-3d {
        animation: none !important;
    }
}
