/* Everstorage Dashboard Styles - Based on Design System */

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

:root {
    /* Design System Colors */
    --primary-bg: #FFFFFF;
    --primary-text: #000000;
    --accent-color: #FF6B35;
    --card-bg: #F5F5DC;
    --button-secondary: #E5E5E5;
    --border-color: #000000;
    --sparkle-colors: #FF6B35, #00FF7F, #FF1493, #00CED1;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --heading-weight: 800;
    --subheading-weight: 600;
    --body-weight: 400;
    
    /* Spacing (8px base unit) */
    --spacing-xs: 8px;
    --spacing-sm: 16px;
    --spacing-md: 32px;
    --spacing-lg: 48px;
    --spacing-xl: 64px;
    --spacing-xxl: 96px;
}

body {
    font-family: var(--font-family);
    background-color: var(--primary-bg);
    color: var(--primary-text);
    line-height: 1.5;
    font-weight: var(--body-weight);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
}

/* Header Styles */
.header {
    padding: var(--spacing-sm) 0;
    border-bottom: 3px solid var(--border-color);
    margin-bottom: var(--spacing-xl);
}

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

.logo h1 {
    font-size: 24px;
    font-weight: var(--heading-weight);
    color: var(--accent-color);
}

.header-stats {
    display: flex;
    gap: var(--spacing-md);
}

.stat-item {
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--button-secondary);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-weight: 500;
    font-size: 14px;
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: var(--spacing-xxl);
    position: relative;
}

.sparkles {
    font-size: 32px;
    margin-bottom: var(--spacing-sm);
    color: var(--accent-color);
}

.hero-title {
    font-size: 56px;
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: var(--spacing-sm);
    color: var(--primary-text);
}

.hero-subtitle {
    font-size: 20px;
    font-weight: var(--subheading-weight);
    color: var(--primary-text);
    margin-bottom: var(--spacing-lg);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    margin-top: var(--spacing-lg);
}

/* Primary Card */
.primary-card {
    background: var(--card-bg);
    border: 4px solid var(--border-color);
    border-radius: 16px;
    padding: var(--spacing-lg);
    margin: var(--spacing-lg) auto;
    max-width: 800px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.card-header h2 {
    font-size: 24px;
    font-weight: var(--subheading-weight);
}

.status-indicator {
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.status-indicator.active {
    background: #00FF7F;
    color: var(--primary-text);
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.metric {
    text-align: center;
    padding: var(--spacing-sm);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--primary-bg);
}

.metric-value {
    font-size: 32px;
    font-weight: var(--heading-weight);
    color: var(--accent-color);
    margin-bottom: var(--spacing-xs);
}

.metric-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--primary-text);
}

/* Buttons */
.control-buttons {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 3px 3px 0px var(--border-color);
    transition: all 0.1s ease;
}

.btn-primary:hover {
    transform: translate(1px, 1px);
    box-shadow: 2px 2px 0px var(--border-color);
}

.btn-primary:active {
    transform: translate(3px, 3px);
    box-shadow: none;
}

.btn-secondary {
    background: var(--button-secondary);
    color: var(--primary-text);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 3px 3px 0px var(--border-color);
    transition: all 0.1s ease;
}

.btn-secondary:hover {
    background: #D5D5D5;
    transform: translate(1px, 1px);
    box-shadow: 2px 2px 0px var(--border-color);
}

.btn-secondary:active {
    transform: translate(3px, 3px);
    box-shadow: none;
}

/* Shared orange button style for action buttons */
.btn-action {
    background: var(--accent-color);
    color: white;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 3px 3px 0px var(--border-color);
    transition: all 0.1s ease;
}

.btn-action:hover {
    transform: translate(1px, 1px);
    box-shadow: 2px 2px 0px var(--border-color);
}

.btn-action:active {
    transform: translate(3px, 3px);
    box-shadow: none;
}

.btn-action:disabled {
    background: #CCCCCC;
    cursor: not-allowed;
    transform: none;
    box-shadow: 3px 3px 0px var(--border-color);
}

.header-buttons {
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
}

/* Metrics Section */
.metrics-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.metric-card {
    background: var(--card-bg);
    border: 3px solid var(--border-color);
    border-radius: 12px;
    padding: var(--spacing-md);
}

.metric-card h3 {
    font-size: 18px;
    font-weight: var(--subheading-weight);
    margin-bottom: var(--spacing-sm);
    color: var(--primary-text);
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

/* Battery Visual */
.battery-visual {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.battery-container {
    width: 60px;
    height: 100px;
    border: 3px solid var(--border-color);
    border-radius: 4px;
    position: relative;
    background: var(--primary-bg);
}

.battery-container::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px 3px 0 0;
}

.battery-level {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--accent-color);
    transition: height 0.3s ease;
    border-radius: 0 0 2px 2px;
}

.battery-percentage {
    font-size: 24px;
    font-weight: var(--heading-weight);
    color: var(--accent-color);
    line-height: 1.2;
    text-align: center;
}

/* Battery Animation Overlay */
.battery-animation-overlay {
    position: absolute;
    left: 0;
    right: 0;
    height: 8px;
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.battery-animation-overlay.charging {
    background: #00FF00;
    animation: battery-charging-blink 1.5s infinite;
}

.battery-animation-overlay.discharging {
    background: #FF6B35;
    animation: battery-discharging-blink 1s infinite;
}

/* Keyframe Animations */
@keyframes battery-charging-blink {
    0%, 50% { opacity: 0.8; }
    51%, 100% { opacity: 0.2; }
}

@keyframes battery-discharging-blink {
    0%, 30% { opacity: 0.9; }
    31%, 100% { opacity: 0.1; }
}

/* Detail Rows */
.detail-row {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-xs) 0;
    border-bottom: 1px solid #DDD;
    font-size: 14px;
}

.detail-row:last-child {
    border-bottom: none;
}

/* Gauges and Meters */
.solar-gauge, .consumption-meter, .financial-summary {
    text-align: center;
    padding: var(--spacing-sm);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--primary-bg);
}

.gauge-value, .meter-value, .savings-amount {
    font-size: 28px;
    font-weight: var(--heading-weight);
    color: var(--accent-color);
    margin-bottom: var(--spacing-xs);
}

.gauge-label, .meter-label, .savings-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--primary-text);
}

/* Grid System */
.grid-container {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
    align-items: start;
}

/* Grid Column Classes */
.grid-col-1 { grid-column: span 1; }
.grid-col-2 { grid-column: span 2; }
.grid-col-3 { grid-column: span 3; }
.grid-col-4 { grid-column: span 4; }
.grid-col-5 { grid-column: span 5; }
.grid-col-6 { grid-column: span 6; }
.grid-col-7 { grid-column: span 7; }
.grid-col-8 { grid-column: span 8; }
.grid-col-9 { grid-column: span 9; }
.grid-col-10 { grid-column: span 10; }
.grid-col-11 { grid-column: span 11; }
.grid-col-12 { grid-column: span 12; }

/* Widget Cards */
.widget-card {
    background: var(--card-bg);
    border: 3px solid var(--border-color);
    border-radius: 12px;
    padding: var(--spacing-md);
    height: fit-content;
}

.widget-card h3 {
    font-size: 18px;
    font-weight: var(--subheading-weight);
    margin-bottom: var(--spacing-sm);
    color: var(--primary-text);
}

.widget-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.widget-card .card-header h3 {
    margin-bottom: 0;
}

/* Shared Widget Components */

/* Common metric row pattern used across widgets */
.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 6px 0 0;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.metric-row:last-child {
    border-bottom: none;
}

.metric-label {
    font-weight: 500;
    color: var(--primary-text);
}

.metric-value {
    font-weight: 600;
    color: var(--accent-color);
    font-size: 14px;
}

/* Special metric value colors */
.metric-value.forecast-value {
    color: #4CAF50;
}

.metric-value.savings-value {
    color: #2E7D32;
    font-weight: 700;
    font-size: 15px;
}

.metric-label.savings-label {
    font-weight: 600;
}

/* Common data section pattern with border and padding */
.data-section {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--primary-bg);
    padding: var(--spacing-sm);
}

/* Add margin between data sections in Live Data widget */
.system-status-widget .data-section {
    margin: 5px 0;
}

/* Remove margin from first data section */
.system-status-widget .data-section:first-of-type {
    margin-top: 0;
}

/* Common chart container pattern */
.chart-container {
    width: 100%;
    margin: var(--spacing-md) 0;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: #FAFAFA;
    position: relative;
}

.chart-container .no-data {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #666;
    font-style: italic;
    font-size: 14px;
}

/* Common navigation header pattern */
.nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
    gap: var(--spacing-sm);
}

.nav-header h3 {
    font-size: 16px;
    font-weight: var(--subheading-weight);
    margin: 0;
    text-align: center;
    flex: 1;
    min-width: 0;
}

/* System Status Widget */
.system-status-widget {
    display: flex;
    flex-direction: column;
}

.system-status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

/* Battery visual widget (merged with SOC chart) - compact container */
.battery-visual-widget {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-sm);
    border: 3px solid var(--border-color);
    border-radius: 12px;
    background: var(--primary-bg);
}

/* Battery section (left side) */
.battery-section {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    flex-shrink: 0;
}

/* Battery with percentage below */
.battery-with-percentage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

/* Battery container for Live Data widget (doubled size) */
.battery-visual-widget .battery-container {
    width: 30px;
    height: 50px;
    border: 3px solid var(--border-color);
    border-radius: 4px;
    position: relative;
    background: var(--primary-bg);
}

.battery-visual-widget .battery-container::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px 2px 0 0;
}

.battery-visual-widget .battery-percentage {
    font-size: 18px;
    font-weight: var(--heading-weight);
    color: var(--accent-color);
    text-align: center;
    line-height: 1.2;
}

/* Battery Power Chart */
.battery-power-chart {
    margin: var(--spacing-sm) 0;
    padding: var(--spacing-xs);
    background: var(--primary-bg);
    border: 2px solid var(--border-color);
    border-radius: 4px;
}

.battery-power-bar {
    position: relative;
}

.battery-power-scale {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 11px;
    color: var(--primary-text);
    font-weight: 500;
    text-align: center;
}

.scale-label {
    font-size: 10px;
    color: var(--primary-text);
    font-weight: 500;
    text-align: center;
}

/* Make chart titles bigger and center them */
.single-power-scale .scale-label.left,
.grid-power-scale .scale-label.center,
.battery-power-scale .scale-label.center {
    font-size: 14px;
    font-weight: 600;
}

/* Center the single power chart titles */
.single-power-scale .scale-label.left {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

/* Position the right label (max power) to the right */
.single-power-scale .scale-label.right {
    margin-left: auto;
}

.scale-label.center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.battery-power-track {
    height: 28px;
    background: var(--button-secondary);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
    border: 2px solid var(--border-color);
}

.battery-power-track::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border-color);
    z-index: 5;
    transform: translateX(-50%);
}

.battery-power-fill {
    height: 100%;
    background: var(--accent-color);
    border-radius: 2px;
    transition: all 0.3s ease;
    position: absolute;
    top: 0;
}

.battery-power-fill.charging {
    background: linear-gradient(to left, #00FF7F, #90EE90);
    right: 50%;
}

.battery-power-fill.discharging {
    background: linear-gradient(to right, var(--accent-color), #FFB366);
    left: 50%;
}

.battery-power-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: 600;
    color: var(--primary-text);
    background: rgba(245, 245, 220, 0.5);
    padding: 2px 8px;
    border-radius: 2px;
    border: 1px solid var(--border-color);
    z-index: 10;
    white-space: nowrap;
}

/* Grid Power Chart */
.grid-power-chart {
    margin: var(--spacing-sm) 0;
    padding: var(--spacing-xs);
    background: var(--primary-bg);
    border: 2px solid var(--border-color);
    border-radius: 4px;
}

.grid-power-bar {
    position: relative;
}

.grid-power-scale {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 11px;
    color: var(--primary-text);
    font-weight: 500;
    text-align: center;
}

.grid-power-track {
    height: 28px;
    background: var(--button-secondary);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
    border: 2px solid var(--border-color);
}

.grid-power-track::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border-color);
    z-index: 5;
    transform: translateX(-50%);
}

.grid-power-fill {
    height: 100%;
    background: var(--accent-color);
    border-radius: 2px;
    transition: all 0.3s ease;
    position: absolute;
    top: 0;
}

.grid-power-fill.purchasing {
    background: linear-gradient(to left, #FF1493, #FFB6C1);
    right: 50%;
}

.grid-power-fill.selling {
    background: linear-gradient(to right, #00CED1, #B0E0E6);
    left: 50%;
}

.grid-power-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: 600;
    color: var(--primary-text);
    background: rgba(245, 245, 220, 0.5);
    padding: 2px 8px;
    border-radius: 2px;
    border: 1px solid var(--border-color);
    z-index: 10;
    white-space: nowrap;
}

/* Power chart labels */
.power-chart-label {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-text);
    margin-bottom: 4px;
    padding: 2px 4px;
    background: var(--primary-bg);
    border-radius: 2px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

/* Single Power Charts (Generation & Consumption) - now using data-section class */

.single-power-bar {
    position: relative;
}

.single-power-scale {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
    font-size: 11px;
    color: var(--primary-text);
    font-weight: 500;
    text-align: center;
    position: relative;
}

.single-power-track {
    height: 28px;
    background: var(--button-secondary);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
    border: 2px solid var(--border-color);
}

.single-power-fill {
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    transition: width 0.3s ease;
}

.generation-fill {
    background: linear-gradient(to right, #90EE90, #00FF7F);
}

.consumption-fill {
    background: linear-gradient(to right, #FFB366, var(--accent-color));
}

.single-power-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: 600;
    color: var(--primary-text);
    background: rgba(245, 245, 220, 0.5);
    padding: 2px 8px;
    border-radius: 2px;
    border: 1px solid var(--border-color);
    z-index: 10;
    white-space: nowrap;
}

/* SOC Chart (right side, inline with battery) - bigger chart */
.soc-chart-inline {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 50px;
    padding-top: 20px;
    margin-top: -20px;
}

.soc-bars-container {
    height: 80px;
    width: 100%;
    max-width: 320px;
}

.soc-bar {
    min-width: 3px;
    max-width: 8px;
}


/* Common Bar Container Styles */
.bars-container-base {
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 2px;
    padding: 4px;
    border: 2px solid #DDD;
    border-radius: 4px;
    background: #FAFAFA;
    overflow: visible;
    box-sizing: border-box;
    position: relative;
}

/* Common Bar Element Styles */
.bar-base {
    background: var(--accent-color);
    border-radius: 2px 2px 0 0;
    flex: 1;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    max-height: 100%;
}

.bar-base:hover {
    background: #E55A2B;
}

/* Common Tooltip Styles */
.bar-base:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-text);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    min-width: 100px;
    text-align: center;
}

/* Common Tooltip Arrow */
.bar-base:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid var(--primary-text);
    z-index: 1000;
}

/* Common Tooltip Edge Fixes - Left Side */
.bar-base:first-child:hover::after,
.bar-base:nth-child(2):hover::after,
.bar-base:nth-child(3):hover::after {
    left: 0;
    transform: translateX(0);
}

.bar-base:first-child:hover::before,
.bar-base:nth-child(2):hover::before,
.bar-base:nth-child(3):hover::before {
    left: 12px;
    transform: translateX(0);
}

/* Common Tooltip Edge Fixes - Right Side */
.bar-base:nth-last-child(1):hover::after,
.bar-base:nth-last-child(2):hover::after,
.bar-base:nth-last-child(3):hover::after {
    left: auto;
    right: 0;
    transform: translateX(0);
}

.bar-base:nth-last-child(1):hover::before,
.bar-base:nth-last-child(2):hover::before,
.bar-base:nth-last-child(3):hover::before {
    left: auto;
    right: 12px;
    transform: translateX(0);
}

/* system-metrics styling removed - now using shared data-section class */

/* Battery power specific color states */
.metric-value.charging {
    color: #00FF7F; /* Green for charging */
}

.metric-value.discharging {
    color: #FF1493; /* Pink for discharging */
}

.system-status-footer {
    margin-top: var(--spacing-md);
    text-align: center;
    opacity: 0.7;
}

.system-status-footer small {
    font-size: 12px;
    color: var(--primary-text);
}



/* Pricing Widget */

.pricing-chart {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--primary-bg);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.pricing-chart-header {
    text-align: center;
    margin-bottom: var(--spacing-md);
}

.pricing-chart-header h4 {
    font-size: 16px;
    font-weight: var(--subheading-weight);
    color: var(--primary-text);
    margin: 0;
}

.pricing-bars-container {
    height: 100px;
}

.pricing-bar {
    min-width: 6px;
    max-width: 12px;
}

.consumption-cost {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--primary-bg);
    padding: var(--spacing-md);
}

.cost-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
}

.cost-label {
    font-weight: 500;
    color: var(--primary-text);
}

.cost-value {
    font-weight: var(--heading-weight);
    color: var(--accent-color);
    font-size: 18px;
}


/* chart-header is now replaced by nav-header */

.nav-btn {
    background: var(--button-secondary);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    width: 40px;
    height: 40px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 2px 0px var(--border-color);
    transition: all 0.1s ease;
    flex-shrink: 0;
}

.nav-btn:hover:not(:disabled) {
    background: var(--accent-color);
    color: white;
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0px var(--border-color);
}

.nav-btn:active:not(:disabled) {
    transform: translate(2px, 2px);
    box-shadow: none;
}

.nav-btn:disabled {
    background: #F0F0F0;
    color: #CCC;
    cursor: not-allowed;
    box-shadow: 2px 2px 0px #DDD;
}

/* chartDateLabel styling is now handled by nav-header h3 */

/* Chart Mode Switcher Styles */
.chart-mode-switcher {
    display: flex;
    align-items: center;
    margin-left: var(--spacing-sm);
}

/* When switcher is in card-header, remove left margin */
.card-header .chart-mode-switcher {
    margin-left: 0;
}

.switcher-label {
    display: flex;
    align-items: end;
    gap: var(--spacing-xs);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--primary-text);
}

.switcher-label input[type="checkbox"] {
    display: none;
}

.switcher-slider {
    position: relative;
    width: 48px;
    height: 13px;
    background: var(--button-secondary);
    border: 2px solid var(--border-color);
    border-radius: 0;
    transition: all 0.2s ease;
    cursor: pointer;
    top: 50%;
    transform: translateY(-50%);
}

.switcher-slider::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -2px;
    width: 12px;
    height: 18px;
    background: var(--primary-bg);
    border-radius: 0;
    border: 2px solid var(--border-color);
    transition: all 0.2s ease;
    box-shadow: 2px 2px 0px var(--border-color);
}

.switcher-label input[type="checkbox"]:checked + .switcher-slider {
    background: var(--accent-color);
    border-color: var(--border-color);
}

.switcher-label input[type="checkbox"]:checked + .switcher-slider::before {
    transform: translateX(32px);
    background: var(--primary-bg);
    box-shadow: 2px 2px 0px var(--border-color);
}

.switcher-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--primary-text);
    user-select: none;
}

.chart-content {
    min-height: 200px;
}


.no-data {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    color: #666;
    font-style: italic;
}

.chart-total {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-text);
}

.chart-total span:last-child {
    color: var(--accent-color);
}

/* Daily Data Widget - only unique styles */
.daily-data-navigation {
    margin-bottom: var(--spacing-md);
}

.daily-data-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

/* Widget-specific layouts - inheriting from shared chart-container */
.hourly-chart,
.trading-chart {
    width: 100%;
}

/* Footer */
.footer {
    border-top: 3px solid var(--border-color);
    padding: var(--spacing-md) 0;
    margin-top: var(--spacing-xl);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.footer-info {
    display: flex;
    gap: var(--spacing-md);
}

.footer-links {
    display: flex;
    gap: var(--spacing-sm);
}

.footer-links a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-title {
        font-size: 36px;
    }
    
    .hero-subtitle {
        font-size: 16px;
    }
    
    .hero-actions {
        flex-direction: column;
        gap: var(--spacing-sm);
        align-items: center;
    }
    
    .hero-actions .btn-action {
        width: 200px;
    }
    
    .header-content {
        flex-direction: column;
        gap: var(--spacing-sm);
        text-align: center;
    }
    
    .header-stats {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .metrics-section {
        grid-template-columns: 1fr;
    }
    
    .control-buttons {
        flex-direction: column;
    }
    
    .footer-content {
        flex-direction: column;
        gap: var(--spacing-sm);
        text-align: center;
    }
    
    .primary-card {
        padding: var(--spacing-md);
    }
    
}

@media (max-width: 480px) {
    .container {
        padding: 0 var(--spacing-xs);
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .hero-title {
        font-size: 28px;
    }
    
    .primary-card {
        padding: var(--spacing-sm);
    }
    
    
    /* Grid responsive - mobile stacks all widgets */
    .grid-container {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }
    
    .grid-col-1, .grid-col-2, .grid-col-3, .grid-col-4,
    .grid-col-5, .grid-col-6, .grid-col-7, .grid-col-8,
    .grid-col-9, .grid-col-10, .grid-col-11, .grid-col-12 {
        grid-column: span 1;
    }
    
    .widget-card {
        padding: var(--spacing-sm);
        margin: 0 -var(--spacing-xs);
    }
    
    .battery-soc-value {
        font-size: 36px;
    }
    
    
    .hourly-chart-container {
        height: 250px;
        padding: var(--spacing-xs);
    }
    
    .chart-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    #chartDateLabel {
        font-size: 16px;
        text-align: center;
        flex: 1;
        margin: 0 var(--spacing-xs);
    }
}

@media (max-width: 768px) and (min-width: 481px) {
    /* Tablet - 2 widgets per row for 4-column spans */
    .grid-container {
        grid-template-columns: repeat(8, 1fr);
    }
    
    .grid-col-4 { grid-column: span 4; }
    .grid-col-8 { grid-column: span 8; }
}

/* Actions Widget Styles */
.actions-widget {
    height: fit-content;
}

.actions-content {
    padding: var(--spacing-sm) 0;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    align-items: center;
}

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

.action-buttons .btn-action {
    font-size: 18px;
    font-weight: var(--subheading-weight);
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: center;
}

.last-run-info {
    font-size: 14px;
    color: #666;
    text-align: center;
    font-weight: 400;
}

/* Cron Info Styles */
.cron-info-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.cron-info-item {
    padding: var(--spacing-sm);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
}

.cron-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xs);
}

.cron-info-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--primary-text);
}

.cron-info-schedule {
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.cron-info-description {
    font-size: 12px;
    color: #666;
    margin-bottom: var(--spacing-xs);
}

.cron-info-last-run {
    font-size: 11px;
    color: #888;
    display: flex;
    align-items: center;
    gap: 4px;
}

.cron-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #28a745;
    display: inline-block;
}

/* Mobile responsiveness for Actions widget */
@media (max-width: 768px) {
    .action-buttons {
        gap: var(--spacing-xs);
    }
    
    .action-buttons .btn-action {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: 16px;
    }
}

/* AI Recommendation Widget Styles */
.ai-recommendation-widget {
    height: auto;
}

.ai-recommendation-content {
    padding: var(--spacing-sm);
}

/* AI Heatmap Styles */
.ai-heatmap-container {
    margin-bottom: var(--spacing-md);
    padding: 8px var(--spacing-sm);
}

.ai-heatmap-chart {
    width: 100%;
    height: 40px;
    position: relative;
}

.ai-heatmap-chart .no-data {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    font-style: italic;
}

/* Initial State */
.ai-initial-state {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.ai-instruction-box {
    background: white;
    border: 2px solid #000;
    border-radius: 8px;
    padding: var(--spacing-md);
    text-align: center;
}

.ai-instruction-box .ai-icon {
    font-size: 48px;
    margin-bottom: var(--spacing-sm);
}

.ai-instruction-box p {
    margin: 0;
    font-size: 16px;
    color: var(--primary-text);
}

.ai-features-box {
    background: white;
    border: 2px solid #000;
    border-radius: 8px;
    padding: var(--spacing-md);
}

.ai-features-box .feature-item {
    padding: var(--spacing-xs) 0;
    font-size: 14px;
    color: var(--primary-text);
}

.ai-features-box .feature-item:last-child {
    padding-bottom: 0;
}

/* Loading State */
.ai-loading-state {
    text-align: center;
    padding: var(--spacing-md);
}

.ai-spinner {
    font-size: 32px;
    margin-bottom: var(--spacing-sm);
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading-steps {
    margin-top: var(--spacing-md);
    text-align: left;
}

.step-item {
    padding: var(--spacing-xs) 0;
    font-size: 12px;
    color: #888;
}

/* Recommendation Result */
.ai-recommendation-result {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.recommendation-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--primary-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
}

.recommendation-header .ai-icon {
    font-size: 32px;
    margin: 0;
}

.header-text {
    flex: 1;
}

.header-text h4 {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: var(--subheading-weight);
}

.timestamp {
    font-size: 12px;
    color: #666;
    margin: 0 0 8px 0;
}

.current-soc {
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
}

.current-soc .label {
    font-size: 14px;
    font-weight: 500;
    color: var(--primary-text);
}

.current-soc .value {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-color);
}

/* Power Amount Display */
.power-amount {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-color);
    background: rgba(255, 107, 53, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
}

/* Target SOC Display */
.target-soc {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-color);
    background: rgba(0, 137, 123, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
}

.power-reasoning {
    background: rgba(255, 107, 53, 0.05);
    border: 1px solid rgba(255, 107, 53, 0.2);
    border-radius: 6px;
    padding: var(--spacing-xs);
    margin-top: var(--spacing-xs);
}

.power-reasoning strong {
    color: var(--accent-color);
}

/* Recommendation Table */
.recommendation-table {
    background: var(--primary-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: var(--spacing-sm);
}

.recommendation-table h5 {
    margin: 0 0 var(--spacing-sm) 0;
    font-weight: var(--subheading-weight);
}

.table-container {
    border: 2px solid var(--border-color);
    border-radius: 6px;
}

.ai-schedule-table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
    font-size: 12px;
}

.ai-schedule-table th {
    background: var(--card-bg);
    padding: var(--spacing-xs);
    text-align: left;
    font-weight: var(--subheading-weight);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
}

.ai-schedule-table td {
    padding: var(--spacing-xs);
    border-bottom: 1px solid #eee;
}

.ai-schedule-table .action-charge {
    background: #e8f5e8;
    color: #2e7d32;
    font-weight: 500;
}

.ai-schedule-table .action-discharge {
    background: #ffe8e8;
    color: #d32f2f;
    font-weight: 500;
}

.ai-schedule-table .action-idle {
    background: #f5f5f5;
    color: #666;
}

.ai-schedule-table .price-cost {
    background: #ffe8e8;
    color: #d32f2f;
    font-weight: 500;
}

.ai-schedule-table .price-revenue {
    background: #e8f5e8;
    color: #2e7d32;
    font-weight: 500;
}

/* SOC Estimation Indicators */
.ai-schedule-table .soc-estimated {
    font-style: italic;
    color: #666;
    background: #f8f9fa;
}

.ai-schedule-table .soc-estimated::after {
    content: ' (calc)';
    font-size: 10px;
    color: #999;
}

.ai-schedule-table .soc-warning {
    background: #fff3cd;
    color: #856404;
    border-left: 3px solid #ffc107;
}

.ai-schedule-table .soc-warning::before {
    content: '⚠️ ';
    font-size: 12px;
}

/* Estimated SOC Column Styling */
.ai-schedule-table td:nth-child(8) {
    background: #e8f5e8;
    color: #2e7d32;
    font-weight: 500;
    border-left: 2px solid #4caf50;
}

/* AI-provided estimated SOC styling */
.ai-schedule-table .soc-ai-provided {
    background: #e8f5e8;
    color: #2e7d32;
    font-weight: 500;
}

/* Recommendation Summary */
.recommendation-summary {
    background: var(--primary-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: var(--spacing-sm);
}

.recommendation-summary h5 {
    margin: 0 0 var(--spacing-sm) 0;
    font-weight: var(--subheading-weight);
}

.summary-content {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    padding: var(--spacing-sm);
    font-size: 14px;
    line-height: 1.5;
}

/* Error State */
.ai-error-state {
    text-align: center;
    padding: var(--spacing-md);
}

.error-icon {
    font-size: 48px;
    margin-bottom: var(--spacing-sm);
}

.error-message {
    color: #d32f2f;
    margin-bottom: var(--spacing-md);
    font-weight: 500;
}

.btn-retry {
    background: var(--accent-color);
    color: white;
    border: 2px solid var(--border-color);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-retry:hover {
    background: #e55a2b;
}

/* Mathematical Optimization Details Section */
.optimization-details {
    margin-top: var(--spacing-sm);
    padding: var(--spacing-sm);
    background-color: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
}

.optimization-info h5 {
    margin-bottom: var(--spacing-xs);
    font-weight: var(--subheading-weight);
    color: var(--primary-text);
}

.optimization-stats {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.optimization-stats .stat-item {
    display: flex;
    flex-direction: column;
    padding: var(--spacing-xs);
    background-color: var(--primary-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    min-width: 120px;
}

.optimization-stats .stat-label {
    font-size: 0.8em;
    color: #666;
    margin-bottom: 2px;
}

.optimization-stats .stat-value {
    font-weight: var(--subheading-weight);
    color: var(--primary-text);
}

/* Mobile Responsiveness for AI Widget */
@media (max-width: 768px) {
    .ai-recommendation-widget {
        height: auto;
        min-height: 300px;
    }
    
    .ai-schedule-table {
        font-size: 11px;
    }
    
    .ai-schedule-table th,
    .ai-schedule-table td {
        padding: 4px;
    }
    
    .recommendation-header {
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-xs);
    }
    
    .summary-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
}

/* Actions History Widget Styles */
.actions-history-widget {
    height: auto;
}

.actions-history-heatmap {
    /* Same styling as pricing widget */
}

.actions-history-heatmap-content {
    /* Matches pricing-heatmap-content styling */
}

.actions-history-heatmap-container {
    /* Matches pricing-heatmap-container styling */
}

.actions-history-heatmap-container .no-data {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    font-style: italic;
    font-size: 14px;
}

/* Mobile responsiveness for Actions History widget */
@media (max-width: 768px) {
    .actions-history-widget {
        height: auto;
    }
    
    .actions-history-heatmap-container {
        height: 300px !important;
    }
}