/* Monthly Chart Page Styles */

/* Solar Simulation button loading state */
#battery-sim-btn.battery-sim-loading {
    opacity: 0.7;
    pointer-events: none;
    cursor: not-allowed;
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-color: #ffc107;
}

#solar-sim-pdf-btn.solar-sim-pdf-loading {
    opacity: 0.7;
    pointer-events: none;
    cursor: not-allowed;
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-color: #ffc107;
}

#solar-sim-pdf-btn.solar-sim-pdf-loading .action-icon i {
    animation: spin 1s linear infinite;
    color: #856404;
}

#solar-sim-pdf-btn.solar-sim-pdf-loading .action-label {
    color: #856404;
}

#solar-sim-pdf-btn:disabled,
#solar-sim-pdf-btn[disabled] {
    opacity: 0.7;
    pointer-events: none;
    cursor: not-allowed;
}

#battery-sim-btn.battery-sim-loading .action-icon i {
    animation: spin 1s linear infinite;
    color: #856404;
}

#battery-sim-btn.battery-sim-loading .action-label {
    color: #856404;
}

/* Also apply to disabled state (belt and suspenders) */
#battery-sim-btn:disabled,
#battery-sim-btn[disabled] {
    opacity: 0.7;
    pointer-events: none;
    cursor: not-allowed;
}

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

/* Chart Controls Section - styled like Quick Actions */
.chart-controls {
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.chart-controls-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.chart-controls-header h5 {
    color: #0c5460;
    font-weight: 600;
}

.chart-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.chart-action-item {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
    border-radius: 12px;
    padding: 1.5rem 1rem;
    text-align: center;
    text-decoration: none;
    color: #495057;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100px;
}

.chart-action-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #007bff;
    color: #007bff;
    text-decoration: none;
}

.chart-action-item .action-icon {
    font-size: 1.8rem;
    margin-bottom: 0.75rem;
    color: #6c757d;
    transition: color 0.3s ease;
}

.chart-action-item:hover .action-icon {
    color: #007bff;
}

.chart-action-item .action-label {
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.3;
}

/* Different colors for each action */
.chart-action-item:nth-child(1):hover {
    border-color: #28a745;
    color: #28a745;
}

.chart-action-item:nth-child(1):hover .action-icon {
    color: #28a745;
}

.chart-action-item:nth-child(2):hover {
    border-color: #17a2b8;
    color: #17a2b8;
}

.chart-action-item:nth-child(2):hover .action-icon {
    color: #17a2b8;
}

.chart-action-item:nth-child(3):hover {
    border-color: #ffc107;
    color: #ffc107;
}

.chart-action-item:nth-child(3):hover .action-icon {
    color: #ffc107;
}

.chart-action-item:nth-child(4):hover {
    border-color: #dc3545;
    color: #dc3545;
}

.chart-action-item:nth-child(4):hover .action-icon {
    color: #dc3545;
}

/* Desktop view - ensure 6 items in one row */
@media (min-width: 992px) {
    .chart-actions-grid {        
        max-width: 800px;
    }
}

/* Tablet view - ensure proper centering and sizing */
@media (min-width: 769px) and (max-width: 991px) {
    .chart-controls {
        padding: 1.75rem 1rem;
        margin: 0 auto 2rem auto;
        max-width: 100%;
        overflow: hidden;
    }
    
    .chart-actions-grid {        
        gap: 0.75rem;
        max-width: 720px;
        margin: 0 auto;
        padding: 0 1rem;
        box-sizing: border-box;
    }
    
    .chart-action-item {
        min-height: 90px;
        padding: 1.25rem 0.75rem;
        max-width: 180px;
        margin: 0 auto;
    }
    
    .chart-action-item .action-icon {
        font-size: 1.6rem;
        margin-bottom: 0.6rem;
    }
    
    .chart-action-item .action-label {
        font-size: 0.85rem;
        line-height: 1.2;
    }
}

.month-selector {
    background: white;
    border-radius: 15px;
    padding: 1rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.month-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.month-dropdown {
    min-width: 150px;
}

/* Simplified Month Selector inside Chart Container */
.month-selector-simple {
    margin-bottom: 1rem;
    padding: 1rem;
}

.month-selector-simple.legend-style {
    background: #e7f3ff !important;
    border: 1px solid #b3d9ff !important;
    border-radius: 10px !important;
    color: #0c5460 !important;
}

.month-selector-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.1rem;
    font-weight: 500;
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
}

.month-selector-dropdowns {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.month-selector-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 150px;
}

.month-selector-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #0c5460;
}

.current-month-text {
    font-size: 1.3rem;
    font-weight: 700;
    color: #0c5460;
    margin-right: 1rem;
}

.month-dropdown-simple {
    min-width: 100px;
    max-width: 150px;
    font-size: 1rem;
    border: 1px solid #b3d9ff;
    border-radius: 8px;
    background: white;
    color: #0c5460;
}

.month-dropdown-simple:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.month-description {
    margin-top: 0.75rem;
    font-size: 1rem;
    color: #0c5460;
    opacity: 0.8;
    font-style: italic;
    text-align: center;
}

.chart-container {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.stats-container {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.cost-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.cost-item {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.cost-item:hover {
    border-color: #007bff;
    transform: translateY(-2px);
}

.cost-item.total {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    font-weight: bold;
}

.cost-item.total:hover {
    border-color: #fff;
}

.cost-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #007bff;
    display: block;
    margin-bottom: 0.5rem;
}

.cost-item.total .cost-value {
    color: white;
}

.cost-label {
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 500;
}

.cost-item.total .cost-label {
    color: rgba(255, 255, 255, 0.9);
}

.stat-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: #007bff;
    transform: translateY(-2px);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #007bff;
    display: block;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 500;
}

.stat-hint {
    font-size: 0.75rem;
    color: #6c757d;
    opacity: 0.8;
    font-style: italic;
    display: block;
    margin-top: 0.25rem;
}

.stat-unit {
    font-size: 1rem;
    color: #28a745;
    font-weight: normal;
}

.navigation-bar {
    padding: 1rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.navigation-bar.legend-style {
    background: #e7f3ff !important;
    border: 1px solid #b3d9ff !important;
    border-radius: 10px !important;
    color: #0c5460 !important;
}

.nav-btn {
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    text-decoration: none;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-content {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.error-container {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    color: #721c24;
}

.legend-info {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 10px;
    padding: 1rem;
    margin-top: 1rem;
}

/* Legend Style Class - Apply to multiple elements for consistency */
.legend-style {
    background: #e7f3ff !important;
    border: 1px solid #b3d9ff !important;
    border-radius: 10px !important;
    color: #0c5460 !important;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    margin: 0.5rem 1rem 0.5rem 0;
}

.legend-color {
    width: 20px;
    height: 4px;
    margin-right: 0.5rem;
    border-radius: 2px;
}

/* Day Buttons Section - REMOVED DUPLICATE */

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.day-buttons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 0.5rem;
    max-width: 100%;
}

.day-button {
    background: linear-gradient(135deg, #e9ecef 0%, #d6d9dc 100%);
    border: 2px solid #adb5bd;
    border-radius: 8px;
    padding: 0.75rem 0.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #495057;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.day-button:hover {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,123,255,0.3);
}

.day-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,123,255,0.3);
}

.day-button.loading {
    pointer-events: none;
    opacity: 0.7;
}

.day-button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #fff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.day-number {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.day-consumption {
    font-size: 0.75rem;
    opacity: 0.8;
    font-weight: normal;
}

.day-button:hover .day-consumption {
    opacity: 1;
}

/* Responsive design for day buttons */
@media (max-width: 768px) {
    .day-buttons-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.25rem;
    }
    
    .day-button {
        padding: 0.5rem 0.25rem;
        min-height: 50px;
        font-size: 0.85rem;
    }
    
    .day-number {
        font-size: 1rem;
        margin-bottom: 0.1rem;
    }
    
    .day-consumption {
        font-size: 0.65rem;
    }
}

@media (max-width: 576px) {
    .day-buttons-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .day-button {
        padding: 0.4rem 0.2rem;
        min-height: 45px;
        font-size: 0.8rem;
    }
    
    .day-number {
        font-size: 0.9rem;
    }
    
    .day-consumption {
        font-size: 0.6rem;
    }
}

/* General responsive design */
/* Day Buttons Section */
.day-buttons-section {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 10px;
    margin-top: 1rem;
    transition: all 0.3s ease;
}

.day-buttons-header {
    background: #d1ecf1;
    border-bottom: 1px solid #b3d9ff;
    color: #0c5460;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.day-buttons-header * {
    color: #0c5460 !important;
}

.day-buttons-content {
    padding: 1rem;
    background: #e7f3ff;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: 100px;
}

.day-buttons-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 0.5rem;
    max-width: 100%;
    min-height: 60px;
    visibility: visible !important;
}

.day-button {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6 !important;
    border-radius: 8px;
    padding: 0.75rem 0.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #495057;
    min-height: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    width: 100%;
    font-size: 0.9rem;
}

.day-button:hover {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,123,255,0.3);
}

.day-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,123,255,0.3);
}

.day-button.loading {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    cursor: not-allowed;
}

.day-button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.day-button.weekend {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #212529;
    border-color: #ffc107;
}

.day-button.weekend:hover {
    background: linear-gradient(135deg, #e0a800 0%, #d39e00 100%);
    color: white;
}

.day-button.today {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border-color: #28a745;
    font-weight: bold;
}

.day-button.today:hover {
    background: linear-gradient(135deg, #218838 0%, #1e7e34 100%);
}

/* Off-grid day highlighting */
.day-button.off-grid {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border-color: #28a745;
}

.day-button.off-grid:hover {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,123,255,0.3);
}

/* Ripple effect for day buttons */
.day-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.day-button:active::before {
    width: 300px;
    height: 300px;
}

.day-number {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
    line-height: 1;
}

.day-consumption {
    font-size: 0.75rem;
    opacity: 0.8;
    font-weight: normal;
    line-height: 1;
}

.day-button:hover .day-consumption {
    opacity: 1;
}

@media (max-width: 768px) {
    .navigation-bar {
        flex-direction: column;
        gap: 1rem;
    }

    .chart-controls {
        padding: 1.5rem;
    }
    
    .chart-actions-grid {
        grid-template-columns: repeat(1, 1fr);
        gap: 0.75rem;
    }
    
    .chart-action-item {
        min-height: 80px;
        padding: 1rem 0.75rem;
    }
    
    .chart-action-item .action-icon {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .chart-action-item .action-label {
        font-size: 0.85rem;
    }

    .stats-section {
        grid-template-columns: 1fr;
    }

    .cost-breakdown {
        grid-template-columns: repeat(2, 1fr);
    }

    .month-selector-content {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .month-selector-dropdowns {
        flex-direction: column;
        width: 100%;
    }

    .month-selector-group {
        width: 100%;
    }

    .current-month-text {
        font-size: 1.2rem;
    }

    .month-dropdown-simple {
        min-width: 100%;
    }

    .month-description {
        font-size: 0.9rem;
    }

    .day-buttons-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 0.5rem;
    }

    .day-button {
        min-height: 60px;
        padding: 0.5rem;
    }
}

@media (max-width: 576px) {
    .chart-controls-header h5 {
        font-size: 1.1rem;
    }
    
    .chart-actions-grid {
        grid-template-columns: 1fr;
        max-width: 100%;
    }
}

/* Ripple effect for day buttons */
.day-button {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    transform: scale(0);
    animation: ripple-animation 0.6s linear;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Consumption Analysis Container */
.analysis-consumption {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 2px solid #e3f2fd;
    transition: all 0.3s ease;
}

.analysis-header {
    text-align: left;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.analysis-header h4 {
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.analysis-header .lead {
    color: #6c757d;
    font-size: 1.1rem;
    margin-bottom: 0;
}

/* Analysis Header Close Button */
.analysis-header .btn {
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.analysis-header .btn:hover {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
    transform: scale(1.1);
}

/* Responsive adjustments for close button */
@media (max-width: 768px) {
    .analysis-header .d-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .analysis-header .btn {
        align-self: flex-end;
        margin-top: -2rem;
    }
}

/* Daily Chart Container */
.analysis-chart-container {
    background: transparent;
    border: none;
    padding: 0;
    margin-bottom: 2rem;
}

.chart-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.chart-header h5 {
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.daily-chart-wrapper {
    position: relative;
    height: 400px;
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.daily-consumption-chart {
    width: 100%;
    height: 100%;
}

/* Chart Legend */
.chart-legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #495057;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Analysis Metrics Row */
.analysis-metrics-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.metrics-container {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #dee2e6;
}

.metrics-container h5 {
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 1rem;
    text-align: center;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
}

.metrics-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.metric-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.metric-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #007bff;
}

.metric-label {
    font-weight: 500;
    color: #495057;
    font-size: 0.9rem;
}

.metric-value {
    font-weight: 600;
    font-size: 1.1rem;
    color: #2c3e50;
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}

.metric-unit {
    font-size: 0.8rem;
    color: #6c757d;
    font-weight: 400;
}

/* Different colors for metric types */
.metric-item.consumption {
    border-left: 4px solid #28a745;
}

.metric-item.consumption:hover {
    border-color: #28a745;
}

.metric-item.efficiency {
    border-left: 4px solid #17a2b8;
}

.metric-item.efficiency:hover {
    border-color: #17a2b8;
}

.metric-item.peak {
    background-color: #ffc107;
    color: #212529;
    border: 1px solid #ffc107;
}

.metric-item.edge {
    background-color: #ffc107;
    color: #212529;
    border: 1px solid #ffc107;
}

.metric-item.peak:hover {
    background-color: #e0a800;
    border-color: #e0a800;
    color: #212529;
}

.metric-item.off-peak {
    background-color: #28a745;
    color: white;
    border: 1px solid #28a745;
}

.metric-item.off-peak:hover {
    background-color: #1e7e34;
    border-color: #1e7e34;
    color: white;
}

.metric-item.simple {
    background-color: #2E86C1;
    color: white;
    border: 1px solid #2E86C1;
}

.metric-item.simple:hover {
    background-color: #2471A3;
    border-color: #2471A3;
    color: white;
}

.metric-item.full {
    background-color: #007bff;
    color: white;
    border: 1px solid #007bff;
}

.metric-item.full:hover {
    background-color: #0056b3;
    border-color: #0056b3;
    color: white;
}

.metric-item.fixed {
    border-left: 4px solid #6c757d;
}

.metric-item.fixed:hover {
    border-color: #6c757d;
}

.metric-item.tax {
    border-left: 4px solid #dc3545;
}

.metric-item.tax:hover {
    border-color: #dc3545;
}

.metric-item.total-cost {    
    color: white;
    border-left: 4px solid #007bff;
    font-weight: 600;
}

.metric-item.total-cost:hover {    
    border-color: #0056b3;
    color: white;
}

.metric-item.energy {
    border-left: 4px solid #20c997;
}

.metric-item.energy:hover {
    border-color: #20c997;
}

.metric-item.extra {
    border-left: 4px solid #007bff;
}

.metric-item.extra:hover {
    border-color: #007bff;
}

.metric-item.ratio-metric {    
    color: white;
    border-left: 4px solid #6f42c1;
    font-weight: 500;
}

.metric-item.ratio-metric:hover {    
    border-color: #5a32a3;
    color: white;
}

.metric-item.injection {
    background-color: #dc3545;
    color: white;
    border: 1px solid #dc3545;
}

.metric-item.injection:hover {
    background-color: #c82333;
    border-color: #c82333;
    color: white;
}

.metric-item.injection-total {
    background-color: #dc3545;
    color: white;
    border: 1px solid #dc3545;
    font-weight: 600;
}

.metric-item.injection-total .metric-label {
    color: white !important;
}

.metric-item.injection-total .metric-value {
    color: white !important;
}

.metric-item.injection-total .metric-unit {
    color: rgba(255, 255, 255, 0.8) !important;
}

.metric-item.injection-total:hover {
    background-color: #c82333;
    border-color: #c82333;
    color: white;
}

.metric-item.injection-total:hover .metric-label {
    color: white !important;
}

.metric-item.injection-total:hover .metric-value {
    color: white !important;
}

.metric-item.injection-total:hover .metric-unit {
    color: rgba(255, 255, 255, 0.8) !important;
}

.metric-item.injection-metric {
    border-left: 4px solid #dc3545;
}

.metric-item.injection-metric:hover {
    border-color: #dc3545;
}

/* Schedule Comparison Styles */
.metric-item.comparison-positive {
    background-color: #28a745;
    color: white;
    border: 1px solid #28a745;
    font-weight: 500;
}

.metric-item.comparison-positive:hover {
    background-color: #218838;
    border-color: #218838;
}

.metric-item.comparison-negative {
    background-color: #dc3545;
    color: white;
    border: 1px solid #dc3545;
    font-weight: 500;
}

.metric-item.comparison-negative:hover {
    background-color: #c82333;
    border-color: #c82333;
}

.schedule-type-link {
    color: #007bff;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border-bottom: 1px dotted #007bff;
    transition: all 0.2s ease;
}

.schedule-type-link:hover {
    color: #0056b3;
    border-bottom-color: #0056b3;
    text-decoration: none;
}

.total-highlight {
    font-weight: 700;
    font-size: 1.2rem;
}

/* Clickable Cost Day Styling */
.cost-day-clickable {
    transition: all 0.3s ease;
    position: relative;
}

.cost-day-clickable:hover {
    background-color: #007bff ;
    color: white !important;
    border-color: #007bff ;
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 123, 255, 0.4);
}

.cost-day-clickable:hover .metric-label,
.cost-day-clickable:hover .metric-value,
.cost-day-clickable:hover .metric-unit {
    color: white !important;
}

.cost-day-clickable::after {
    content: "🔍";
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cost-day-clickable:hover::after {
    opacity: 1;
}

.cost-day-clickable:active {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 123, 255, 0.3);
}

/* Chart Loading Indicator */
.chart-loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    background: rgba(248, 249, 250, 0.9);
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

.chart-loading-indicator .spinner-border {
    width: 3rem;
    height: 3rem;
    margin-bottom: 1rem;
}

.chart-loading-indicator p {
    margin: 0;
    font-size: 0.9rem;
    color: #6c757d;
}

/* Responsive Design */
@media (max-width: 992px) {
    .analysis-metrics-row {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .chart-legend {
        gap: 1rem;
    }
    
    .daily-chart-wrapper {
        height: 350px;
        padding: 0.75rem;
    }
}

@media (max-width: 768px) {
    .analysis-consumption {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .analysis-chart-container {
        padding: 1rem;
    }
    
    .daily-chart-wrapper {
        height: 300px;
        padding: 0.5rem;
    }
    
    .metrics-container {
        padding: 1rem;
    }
    
    .metric-item {
        padding: 0.75rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .metric-value {
        font-size: 1rem;
    }
    
    .chart-legend {
        justify-content: space-around;
        gap: 0.5rem;
    }
    
    .legend-item {
        font-size: 0.8rem;
    }
}

@media (max-width: 576px) {
    .analysis-consumption {
        padding: 1rem;
    }
    
    .analysis-header .lead {
        font-size: 1rem;
    }
    
    .daily-chart-wrapper {
        height: 250px;
    }
    
    .chart-legend {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
}

/* Ensure chart controls work well within site-wrapper */
@media (min-width: 1300px) {
    .chart-controls {
        margin: 0 auto 2rem auto;
        max-width: 100%;
    }
}

/* Injection Income and Real Monthly Cost Styles */
.metric-item.injection-income {
    border-left: 4px solid #28a745;
    background-color: rgba(40, 167, 69, 0.1);
}

.metric-item.injection-income .metric-label {
    color: #28a745;
    font-weight: 600;
}

.metric-value.injection-positive {
    color: #28a745 !important;
    font-weight: 700;
    font-size: 1.1em;
}

.metric-item.real-monthly-cost {
    border-left: 4px solid #007bff;
    background-color: rgba(0, 123, 255, 0.1);
}

.metric-item.real-monthly-cost .metric-label {
    color: #007bff;
    font-weight: 600;
}

.metric-value.real-cost-highlight {
    color: #007bff !important;
    font-weight: 700;
    font-size: 1.2em;
    border: 2px solid #007bff;
    padding: 0.5rem;
    border-radius: 0.375rem;
    background-color: rgba(0, 123, 255, 0.05);
}

.metric-value.real-cost-no-outline {
    color: #007bff !important;
    font-weight: 700;
    font-size: 1.2em;
    padding: 0.5rem;
    border-radius: 0.375rem;
    background-color: rgba(0, 123, 255, 0.05);
}

/* Solar Simulation Modal Content Styles */
#simulate-battery-content .sb-section { margin-bottom: 10px; }
#simulate-battery-content .sb-title { font-weight: 600; margin-bottom: 2px; }
#simulate-battery-content .sb-body { white-space: pre-wrap; }
.sb-raw { background: #f7f7f7; padding: 8px; border-radius: 4px; }
.simulate-battery-canvas-wrap { position: relative; width: 100%; height: 400px; max-height: 60vh; }
#simulate-battery-chart,
#simulate-battery-yearly-chart { width: 100% !important; height: 100% !important; max-height: 100% !important; }
.simulate-battery-yearly-summary { margin-top: 10px; color: #555; text-align: center; font-weight: 700; }

/* Solar Simulation shared styling (modal + standalone) */
#solar-settings-modal .modal-title,
#simulate-battery-modal .modal-title,
#simulate-battery-title-text,
#simulate-battery-capacity,
#simulate-battery-period {
    color: #fff;
}

#simulate-battery-capacity,
#simulate-battery-period {
    opacity: 0.8;
}

.solar-settings-summary {
    background: var(--bs-light);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.9rem;
}

.solar-settings-summary .badge {
    font-size: 0.8rem;
}

.solar-standalone-only {
    display: none;
}

body.solar-sim-standalone .solar-standalone-only {
    display: block;
}

body.solar-sim-standalone .solar-non-standalone-only {
    display: none !important;
}

.solar-sim-quick-actions .quick-actions h3 {
    text-align: center;
}

#solar-metrics-toggle-btn.is-active {
    border-color: #f1c40f;
    color: #f1c40f;
}

#solar-metrics-toggle-btn.is-active .action-icon {
    color: #f1c40f;
}

#solar-consumption-toggle-btn.is-active {
    border-color: #1f77b4;
    color: #1f77b4;
}

#solar-consumption-toggle-btn.is-active .action-icon {
    color: #1f77b4;
}

.solar-saved-sims-group {
    margin-bottom: 1rem;
}

.solar-saved-sims-header {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.solar-saved-sims-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.75rem;
}

.solar-saved-sim-card {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    padding: 0.75rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.solar-saved-sim-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.solar-saved-sim-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

#solar-sim-standalone-results {
    border: 1px solid rgba(0, 0, 0, 0.1);
}

#solar-sim-standalone-empty {
    color: #6c757d;
}