/* Solar PV Analytics - Modern Sidebar Design */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Color Palette */
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;

    /* Neutral Colors */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Text Colors */
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --text-white: #ffffff;

    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;

    /* Sidebar Colors */
    --sidebar-bg: #1f2937;
    --sidebar-text: #d1d5db;
    --sidebar-text-active: #ffffff;
    --sidebar-hover: #374151;

    /* Card Colors */
    --card-bg: #ffffff;
    --card-border: #e5e7eb;
    --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --card-shadow-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);

    /* Gradients */
    --danger-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --warning-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --primary-gradient: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    border-right: 1px solid var(--gray-700);
    transition: transform 0.3s ease;
}

.sidebar.collapsed {
    transform: translateX(-260px);
}

.sidebar-toggle {
    position: absolute;
    top: 20px;
    right: -15px;
    width: 30px;
    height: 30px;
    background: rgba(59, 130, 246, 0.9);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    z-index: 1001;
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background: rgba(59, 130, 246, 1);
    transform: scale(1.1);
}

.sidebar-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--gray-700);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-white);
}

.brand i {
    font-size: 24px;
    color: var(--primary-color);
}

.sidebar-content {
    flex: 1;
    padding: var(--spacing-lg);
    overflow-y: auto;
}

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

.section-header h6 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    margin: 0;
}

.btn-add {
    width: 24px;
    height: 24px;
    border: none;
    background: var(--primary-color);
    color: var(--text-white);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

/* Projects List */
.projects-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.loading-state {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: var(--spacing-md);
    color: var(--text-tertiary);
    font-size: 13px;
}

.project-item {
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.project-item:hover {
    background: var(--sidebar-hover);
}

.project-item.active {
    background: var(--primary-color);
    color: var(--text-white);
}

.project-item.active .project-name {
    color: var(--text-white);
}

.project-item.active .project-meta {
    color: rgba(255, 255, 255, 0.8);
}

.project-content {
    flex: 1;
}

.project-name {
    font-weight: 500;
    font-size: 14px;
    color: var(--sidebar-text-active);
    margin-bottom: 4px;
}

.project-meta {
    font-size: 12px;
    color: var(--text-tertiary);
}

.project-actions {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.project-item:hover .project-actions {
    opacity: 1;
}

.project-item.active .project-actions {
    opacity: 1;
}

.btn-delete {
    width: 24px;
    height: 24px;
    border: none;
    background: var(--danger-color);
    color: var(--text-white);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
}

.btn-delete:hover {
    background: #dc2626;
    transform: scale(1.05);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    min-height: 100vh;
    background: var(--bg-secondary);
    transition: margin-left 0.3s ease;
    width: calc(100vw - 280px);
    max-width: calc(100vw - 280px);
    overflow-x: hidden;
}

/* When sidebar is collapsed */
.sidebar.collapsed+.main-content {
    margin-left: 20px;
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
}

/* Ensure all content containers are responsive */
.project-content,
.welcome-screen,
.project-header,
.stats-grid,
.charts-grid {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Make cards responsive */
.card {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Responsive grid layouts */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    width: 100%;
}

/* Responsive tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.financial-table {
    width: 100%;
    min-width: 800px;
    /* Minimum width to maintain readability */
}

/* Welcome Screen */
.welcome-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--spacing-xl);
}

.welcome-content {
    text-align: center;
    max-width: 500px;
}

.welcome-icon {
    width: 80px;
    height: 80px;
    background: var(--primary-color);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--spacing-lg);
}

.welcome-icon i {
    font-size: 36px;
    color: var(--text-white);
}

.welcome-content h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

.welcome-content p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xl);
    line-height: 1.6;
}

.navbar-toggler:focus {
    box-shadow: none;
}

/* Modern Container */
.container {
    max-width: 1200px;
    padding: 0 24px;
}

/* Content Sections */
.content-section {
    animation: slideInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    margin-bottom: 48px;
}

.content-section.hidden {
    display: none;
}

/* Modern Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
    border-radius: var(--radius-xl);
    transition: all 0.2s ease;
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
}

.card-header {
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--card-border);
    padding: 20px 24px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 18px;
}

.card-body {
    padding: 24px;
}

.card-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
}

.card-title i {
    color: var(--primary-color);
}

/* Project View */
.project-view {
    padding: var(--spacing-xl);
    transition: opacity 0.3s ease-in-out;
}

.project-view.hidden {
    display: none;
}

.project-header {
    display: flex !important;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-xl);
    padding: 20px !important;
    background: #f8f9fa !important;
    border-radius: 8px !important;
    border: 2px solid #e9ecef !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.project-info h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.project-info p {
    font-size: 16px;
    color: var(--text-secondary);
    margin: 0;
}

.project-actions {
    display: flex !important;
    gap: 12px;
    flex-wrap: wrap;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Section Separator */
.section-separator {
    display: flex;
    align-items: center;
    margin: 40px 0 30px 0;
    gap: 20px;
}

.separator-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.separator-text {
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 15px;
    white-space: nowrap;
}

/* Key Metrics */
.key-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

/* Energy Summary Section (Full Width) */
.energy-summary-section {
    margin-bottom: 30px;
}

.full-width-card {
    width: 100%;
    max-width: none;
}



.summary-analysis-card .energy-source-chart,
.summary-analysis-card .energy-overview,
.summary-analysis-card .excess-energy {
    text-align: left;
}

.summary-analysis-card .energy-overview-row,
.summary-analysis-card .excess-grid,
.summary-analysis-card .excess-status {
    justify-content: flex-start;
    text-align: left;
}

/* Key Metrics inside Summary Card */
.key-metrics-inline {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.summary-analysis-card .key-metrics-inline .key-metric-card {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.summary-analysis-card .key-metrics-inline .key-metric-value,
.summary-analysis-card .key-metrics-inline .key-metric-label {
    color: #212529 !important;
}

.summary-analysis-card .section-title {
    color: #212529;
    margin-bottom: 20px;
    font-size: 1.25rem;
    font-weight: 600;
    text-align: left;
}

.summary-analysis-card .stat-content {
    color: #212529;
    text-align: left;
}

/* Chart and Data Layout (Three/Four Sections) */
.chart-data-layout {
    display: flex;
    flex-wrap: wrap;
    /* Allow wrapping for better responsiveness */
    gap: 15px;
    align-items: stretch;
    margin-top: 20px;
    min-height: 350px;
    padding: 0;
}

.chart-section {
    flex: 1;
    min-width: 250px;
    /* Ensure cards don't get too narrow */
    display: flex;
    flex-direction: column;
}

.financial-section {
    flex: 1;
    min-width: 250px;
    /* Ensure cards don't get too narrow */
    display: flex;
    flex-direction: column;
}

.battery-section {
    flex: 1;
    min-width: 250px;
    /* Ensure cards don't get too narrow */
    display: flex;
    flex-direction: column;
}

/* Financial metrics grid layout when expanded */
.financial-metrics-expanded {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    grid-template-rows: auto auto !important;
    gap: 15px !important;
    height: 100% !important;
    align-content: center !important;
}

/* Ensure financial metric items in expanded layout take full space */
.financial-metrics-expanded .financial-metric-item {
    height: auto !important;
    min-height: 80px !important;
    align-items: center !important;
}

/* Only show visible financial metric items in expanded layout */
.financial-metrics-expanded .financial-metric-item:not([style*="display: none"]) {
    display: flex !important;
}

/* Ensure hidden items stay hidden even in expanded layout */
.financial-metrics-expanded .financial-metric-item[style*="display: none"] {
    display: none !important;
}

/* Three/Four Section Cards - Equal Styling */
.energy-distribution-card,
.utilization-card,
.financial-metrics-card,
.battery-metrics-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 350px;
    transition: all 0.3s ease;
}

/* Hover effect for energy distribution card */
.energy-distribution-card:hover {
    box-shadow: 0 8px 16px rgba(16, 185, 129, 0.12);
    transform: translateY(-2px);
}

/* Card Titles */
.energy-distribution-card .card-title,
.financial-metrics-card .card-title,
.battery-metrics-card .card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

/* Special icon styling for energy distribution card */
.energy-distribution-card .card-title i {
    color: #10b981;
    font-size: 1.3rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Energy Source Chart in Distribution Card */
.energy-distribution-card .energy-distribution-chart-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    /* Ensure full width for centering */
    min-height: 200px;
    position: relative;
    padding: 10px;
    /* Reduced padding to allow more space */
}

.energy-distribution-card .energy-distribution-chart-container canvas {
    max-width: 100%;
    max-height: 100%;
    margin: 0 auto;
    /* Explicitly center */
    display: block;
    filter: drop-shadow(0 4px 12px rgba(16, 185, 129, 0.15));
    transition: all 0.3s ease;
}

.energy-distribution-card .energy-distribution-chart-container canvas:hover {
    filter: drop-shadow(0 6px 16px rgba(16, 185, 129, 0.25));
    transform: scale(1.02);
}

/* Hover effect for utilization card */
.utilization-card:hover {
    box-shadow: 0 8px 16px rgba(16, 185, 129, 0.12);
    transform: translateY(-2px);
}

/* Card Titles including Utilization */
.utilization-card .card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

/* Special icon styling for utilization card */
.utilization-card .card-title i {
    color: #10b981;
    font-size: 1.3rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Utilization Chart Container */
.utilization-card .utilization-chart {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    /* Ensure full width */
    min-height: 200px;
    position: relative;
    padding: 10px;
    /* Reduced padding */
}

.utilization-card .utilization-chart canvas {
    max-width: 100%;
    max-height: 100%;
    margin: 0 auto;
    /* Explicitly center */
    display: block;
    filter: drop-shadow(0 4px 12px rgba(16, 185, 129, 0.15));
    transition: all 0.3s ease;
}

.utilization-card .utilization-chart canvas:hover {
    filter: drop-shadow(0 6px 16px rgba(16, 185, 129, 0.25));
    transform: scale(1.02);
}



.placeholder-text {
    font-size: 0.9rem;
    margin: 0;
    opacity: 0.7;
}

/* Legacy data-section for backward compatibility */
.data-section {
    flex: 0 0 66.667%;
    min-width: 0;
}

.summary-analysis-card .energy-source-chart {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 280px;
    width: 100%;
    max-width: 280px;
}

.summary-analysis-card .energy-source-chart canvas {
    max-width: 100%;
    max-height: 100%;
}

/* Financial Metrics in Summary */
.financial-metrics {
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
    justify-content: center;
}

.financial-metric-item {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.2s ease;
    min-height: 60px;
}

.financial-metric-item:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.financial-metric-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}

.financial-metric-content {
    flex: 1;
    text-align: left;
}

.financial-metric-value {
    font-size: 18px;
    font-weight: 700;
    color: #212529;
    line-height: 1.2;
    margin-bottom: 2px;
}

.financial-metric-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Loan metric specific styling */
.loan-metric .financial-metric-label {
    font-size: 11px;
    line-height: 1.2;
    text-transform: none;
}

/* Battery Metrics Styling - Match Financial Metrics */
.battery-metrics {
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
    justify-content: center;
}

.battery-metric-item {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.2s ease;
    min-height: 60px;
}

.battery-metric-item:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.battery-metric-icon {
    width: 40px;
    height: 40px;
    background: #2563eb;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}

.battery-metric-content {
    flex: 1;
    text-align: left;
}

.battery-metric-value {
    font-size: 18px;
    font-weight: 700;
    color: #212529;
    line-height: 1.2;
    margin-bottom: 2px;
}

.battery-metric-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Consumption Analysis Card Styling */
.consumption-analysis-card .section-title {
    color: #212529;
    margin-bottom: 20px;
    font-size: 1.25rem;
    font-weight: 600;
    text-align: left;
}

.consumption-analysis-card .stat-content {
    color: #212529;
    text-align: left;
}

.consumption-analysis-card .energy-overview-row,
.consumption-analysis-card .energy-overview,
.consumption-analysis-card .table-title {
    text-align: left;
}

/* Production Analysis Card Styling */
.production-analysis-card .section-title {
    color: #212529;
    margin-bottom: 20px;
    font-size: 1.25rem;
    font-weight: 600;
    text-align: left;
}

.production-analysis-card .stat-content {
    color: #212529;
    text-align: left;
}

.production-analysis-card .costs-section,
.production-analysis-card .financing-section,
.production-analysis-card .energy-overview,
.production-analysis-card .table-title {
    text-align: left;
}





/* Project Tabs Styling */
.project-tabs-container {
    margin-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.project-tabs {
    border-bottom: none;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px 12px 0 0;
    padding: 0 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.project-tabs .nav-link {
    border: none;
    border-radius: 8px 8px 0 0;
    color: #6b7280;
    font-weight: 600;
    padding: 15px 25px;
    margin-right: 5px;
    transition: all 0.2s ease;
    background: transparent;
}

.project-tabs .nav-link:hover {
    color: #064f20;
    background: rgba(6, 79, 32, 0.05);
    border-color: transparent;
}

.project-tabs .nav-link.active {
    color: #064f20;
    background: rgba(6, 79, 32, 0.1);
    border-color: transparent;
    border-bottom: 3px solid #064f20;
}

.project-tabs .nav-link i {
    margin-right: 8px;
}

/* Tab Content Styling */
.tab-content {
    background: transparent;
    padding: 0;
}

.tab-pane {
    min-height: 400px;
}

/* Ensure calculator tab has no extra padding (it gets padding from project-view) */
#calculator-content .stats-grid {
    padding-left: 0;
    padding-right: 0;
    margin-left: 0;
    margin-right: 0;
}

/* Simulation tab needs proper spacing - use padding instead of margin to avoid overflow */
#simulation-content {
    padding-left: var(--spacing-xl);
    padding-right: var(--spacing-xl);
}

#simulation-content .stats-grid {
    margin-left: 0;
    margin-right: 0;
}

/* Override project-view padding for tab content to ensure consistency */
.project-view .tab-content {
    margin: 0 calc(-1 * var(--spacing-xl));
    padding: 0 var(--spacing-xl);
}

.simulation-placeholder {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(6, 79, 32, 0.15);
    border-radius: 12px;
    margin: 20px 0;
    padding: 40px;
}

.simulation-placeholder .fa-cogs {
    color: #6b7280;
}

/* Simulation Controls Styling */
.simulation-controls {
    margin: 30px 0;
    padding: 20px 0;
}

.simulation-controls .btn {
    min-width: 200px;
    font-weight: 600;
    padding: 12px 30px;
    font-size: 1.1rem;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.simulation-controls .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.simulation-controls .btn:disabled {
    transform: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Simulation Results Charts Styling */
.simulation-results {
    margin-top: 30px;
}

.chart-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(6, 79, 32, 0.15);
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
}

.chart-header {
    padding: 20px 20px 0 20px;
    border-bottom: 1px solid rgba(6, 79, 32, 0.1);
}

.chart-title {
    color: #212529;
    margin-bottom: 20px;
    font-size: 1.25rem;
    font-weight: 600;
}

.chart-tabs {
    border-bottom: none;
    margin-bottom: 0;
}

.chart-tabs .nav-link {
    border: none;
    border-radius: 8px 8px 0 0;
    color: #6b7280;
    font-weight: 600;
    padding: 10px 20px;
    margin-right: 5px;
    transition: all 0.2s ease;
    background: transparent;
}

.chart-tabs .nav-link:hover {
    color: #064f20;
    background: rgba(6, 79, 32, 0.05);
    border-color: transparent;
}

.chart-tabs .nav-link.active {
    color: #064f20;
    background: rgba(6, 79, 32, 0.1);
    border-color: transparent;
    border-bottom: 3px solid #064f20;
}

.chart-content {
    padding: 20px;
}

.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
}

/* Report Button Styling */
#reportBtn {
    background-color: #17a2b8 !important;
    border-color: #17a2b8 !important;
    color: white !important;
    transition: all 0.2s ease;
}

#reportBtn:hover {
    background-color: #138496 !important;
    border-color: #117a8b !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(23, 162, 184, 0.3);
}

#reportBtn:disabled {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
    transform: none;
    box-shadow: none;
}

/* Print styles for PDF generation */
@media print {

    .sidebar,
    .project-actions,
    .simulation-section,
    .section-separator {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    .stat-card {
        break-inside: avoid;
        margin-bottom: 20px;
    }

    .chart-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .financial-table-container {
        break-inside: avoid;
    }
}


border: 2px dashed rgba(0, 0, 0, 0.1);
border-radius: 15px;
margin: 20px 0;
}

.placeholder-content {
    text-align: center;
    color: #6b7280;
}

.placeholder-icon {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 15px;
    opacity: 0.7;
}

.placeholder-text {
    font-size: 16px;
    font-weight: 500;
    margin: 0;
    opacity: 0.8;
}

.key-metric-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.key-metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.key-metric-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

/* Specific icon colors for each metric */
.key-metric-card:nth-child(1) .key-metric-icon {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    /* Red for consumption */
}

.key-metric-card:nth-child(2) .key-metric-icon {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    /* Orange for cost */
}

.key-metric-card:nth-child(3) .key-metric-icon {
    background: linear-gradient(135deg, #10b981, #059669);
    /* Green for production */
}

.key-metric-card:nth-child(4) .key-metric-icon {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    /* Purple for savings */
}



.key-metric-content {
    flex: 1;
}

.key-metric-value {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 4px;
}

.key-metric-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--card-shadow);
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
}

/* Project Details in Header */
.project-details {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.project-detail-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.project-detail-label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

.project-detail-value {
    font-size: 13px;
    color: #374151;
    font-weight: 600;
}

/* Consumption card specific styling */
.consumption-card .stat-content {
    width: 100%;
}

.consumption-card .stat-label {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

/* Energy Source Chart */
.energy-source-chart {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 15px 0;
    height: 180px;
    max-width: 100%;
}

.summary-card .stat-content {
    width: 100%;
    text-align: center;
}

.summary-card .stat-label {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

/* Ensure energy overview and other sections are visible */
.summary-card .energy-overview {
    margin-top: 20px;
}

.summary-card .excess-energy {
    margin-top: 20px;
}

/* Production Card Sections */
.production-card .costs-section,
.production-card .financing-section {
    margin-bottom: 25px;
}

.production-card .costs-section:last-child,
.production-card .financing-section:last-child {
    margin-bottom: 0;
}

.production-card .table-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 15px;
    padding-bottom: 8px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--spacing-md);
}

.stat-icon i {
    font-size: 20px;
    color: var(--text-white);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.2;
}

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

/* Charts Section */
.charts-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-xl);
}

.chart-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--card-border);
    background: var(--bg-tertiary);
}

.chart-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.chart-controls {
    display: flex;
    gap: 12px;
}

/* Insights Summary */
.insights-summary {
    padding: var(--spacing-lg);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(16, 185, 129, 0.05) 100%);
    border-bottom: 1px solid var(--card-border);
}

.insights-summary .summary-text {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    font-weight: 500;
}

.insights-summary .summary-text i {
    color: var(--primary-color);
    font-size: 16px;
}

.chart-block {
    --chart-height: 380px;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.chart-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    padding: 0 var(--spacing-lg);
    flex-wrap: wrap;
}

.chart-legend {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: 0 var(--spacing-lg) var(--spacing-sm);
    font-size: 13px;
    color: var(--text-secondary);
}

.chart-legend .legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.chart-legend .legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    display: inline-block;
}

.chart-legend .swatch-typical {
    background: rgba(16, 185, 129, 0.7);
    border: 1px solid rgba(16, 185, 129, 1);
}

.chart-legend .swatch-outlier {
    background: rgba(239, 68, 68, 0.7);
    border: 1px solid rgba(239, 68, 68, 1);
}

.heatmap-toolbar {
    align-items: center;
}

.heatmap-mode-btn.active,
.monthly-season-btn.active {
    color: #ffffff;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-secondary);
}

.heatmap-legend .legend-label {
    font-weight: 600;
    color: var(--text-primary);
}

.heatmap-legend .legend-gradient {
    width: 140px;
    height: 12px;
    border-radius: 999px;
    background: linear-gradient(90deg, #3B82F6 0%, #FBBF24 50%, #F97316 100%);
    box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.15);
}

.heatmap-legend .legend-value {
    min-width: 42px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.heatmap-legend .legend-mid {
    font-weight: 600;
}

.heatmap-legend .legend-unit {
    font-weight: 600;
    color: var(--text-primary);
}

.monthly-toolbar .form-check {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.monthly-toolbar .form-check-input {
    cursor: pointer;
}

.monthly-toolbar .form-check-label {
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
}

.chart-toolbar .text-muted {
    color: var(--text-tertiary) !important;
}

.chart-block .chart-container {
    padding: var(--spacing-lg);
    height: var(--chart-height);
    width: 100%;
    position: relative;
}

.chart-block .chart-container canvas {
    width: 100% !important;
    height: 100% !important;
    max-height: none;
}

.chart-block.chart-height-sm {
    --chart-height: 320px;
}

.chart-block.chart-height-md {
    --chart-height: 360px;
}

.chart-block.chart-height-lg {
    --chart-height: 420px;
}

.chart-block.chart-height-xl {
    --chart-height: 480px;
}

.chart-block.chart-height-xxl {
    --chart-height: 540px;
}

/* Seasonal Comparison 2x2 Grid */
.seasonal-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding: var(--spacing-lg);
}

.seasonal-chart-cell {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    border: 1px solid var(--card-border);
}

.seasonal-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    text-align: center;
}

.seasonal-chart-cell canvas {
    height: 180px !important;
    width: 100% !important;
}

.seasonal-legend {
    padding: 0 var(--spacing-lg) var(--spacing-lg);
}

.seasonal-legend .legend-item {
    font-size: 13px;
    color: var(--text-secondary);
}

.seasonal-legend .legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

@media (max-width: 767px) {
    .seasonal-grid {
        grid-template-columns: 1fr;
    }

    .seasonal-chart-cell canvas {
        height: 150px !important;
    }
}

.chart-container {
    padding: var(--spacing-lg);
    height: 400px;
    position: relative;
}

.chart-container canvas {
    max-height: 100%;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: var(--spacing-xl);
    color: var(--text-secondary);
}

.loading-state i {
    animation: spin 1s linear infinite;
}

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

    to {
        transform: rotate(360deg);
    }
}

/* Responsive Design */

/* Large Desktop (1920px+) */
@media (min-width: 1920px) {
    .key-metrics {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        gap: 2rem;
    }

    .charts-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2.5rem;
    }

    .financial-table {
        min-width: 1000px;
    }

    .financial-table th {
        font-size: 0.85rem;
        padding: 10px 6px;
        min-width: 60px;
        max-width: 100px;
    }

    .financial-table td {
        font-size: 0.8rem;
        padding: 8px 6px;
        min-width: 60px;
        max-width: 100px;
    }
}

/* Standard Desktop (1200px - 1919px) */
@media (min-width: 1200px) and (max-width: 1919px) {
    .key-metrics {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 1.5rem;
    }

    .charts-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .financial-table {
        min-width: 900px;
    }

    .financial-table th {
        font-size: 0.75rem;
        padding: 8px 4px;
        min-width: 50px;
        max-width: 80px;
    }

    .financial-table td {
        font-size: 0.7rem;
        padding: 6px 4px;
        min-width: 50px;
        max-width: 80px;
    }
}

/* Small Desktop/Large Tablet (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    .key-metrics {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }

    .key-metrics-inline {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.25rem;
    }

    .financial-table {
        min-width: 700px;
    }
}

/* Tablet (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .main-content {
        margin-left: 0;
        width: 100vw;
        max-width: 100vw;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .key-metrics {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .key-metrics-inline {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

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

    .financial-table {
        min-width: 600px;
    }

    .chart-data-layout {
        gap: 15px;
        min-height: 300px;
    }

    .summary-analysis-card .energy-source-chart {
        height: 230px;
        max-width: 230px;
    }

    .financial-metric-item {
        padding: 12px;
        min-height: 55px;
    }

    /* Tablet responsive for expanded financial metrics */
    .financial-metrics-expanded {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
    }

    .financial-section-expanded {
        flex: 2 !important;
    }

    .financial-metric-icon {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }

    .financial-metric-value {
        font-size: 16px;
    }

    .battery-metric-item {
        padding: 12px;
        min-height: 55px;
    }

    .battery-metric-icon {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }

    .battery-metric-value {
        font-size: 16px;
    }
}

/* Mobile (max-width: 767px) */
@media (max-width: 767px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        width: 100vw;
        max-width: 100vw;
    }

    .project-header {
        flex-direction: column;
        gap: var(--spacing-md);
        align-items: stretch;
    }

    .key-metrics {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }

    .key-metrics-inline {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .key-metric-card {
        padding: 15px;
        gap: 10px;
    }

    .section-separator {
        margin: 30px 0 20px 0;
        gap: 15px;
    }

    .separator-text {
        font-size: 0.75rem;
        padding: 0 10px;
    }

    .chart-data-layout {
        flex-direction: column;
        gap: 20px;
        align-items: center;
        min-height: auto;
    }

    .chart-section,
    .financial-section,
    .battery-section {
        flex: none;
        width: 100%;
    }

    .energy-distribution-card,
    .financial-metrics-card,
    .battery-metrics-card {
        min-height: 250px;
    }

    .chart-section {
        justify-content: center;
    }

    /* Legacy data-section for backward compatibility */
    .data-section {
        flex: none;
        width: 100%;
    }

    .summary-analysis-card .energy-source-chart {
        height: 200px;
        max-width: 200px;
    }

    .energy-distribution-card .energy-source-chart {
        min-height: 200px;
    }

    .financial-metrics {
        gap: 10px;
    }

    /* Mobile responsive for expanded financial metrics */
    .financial-metrics-expanded {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto !important;
        gap: 10px !important;
    }

    .financial-section-expanded {
        flex: none !important;
        width: 100% !important;
    }

    .financial-metric-item {
        padding: 10px;
        min-height: 50px;
        gap: 10px;
    }

    .financial-metric-icon {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .financial-metric-value {
        font-size: 14px;
    }

    .financial-metric-label {
        font-size: 10px;
    }

    .battery-metrics {
        gap: 10px;
    }

    .battery-metric-item {
        padding: 10px;
        min-height: 50px;
        gap: 10px;
    }

    .battery-metric-icon {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .battery-metric-value {
        font-size: 14px;
    }

    .battery-metric-label {
        font-size: 10px;
    }

    .key-metric-icon {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .key-metric-value {
        font-size: 16px;
    }

    .key-metric-label {
        font-size: 10px;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: var(--spacing-md);
    }

    .project-view {
        padding: var(--spacing-md);
    }

    .welcome-content h1 {
        font-size: 24px;
    }

    .welcome-content {
        padding: var(--spacing-md);
    }
}

/* Modern Buttons */
.btn {
    font-weight: 500;
    padding: 12px 20px;
    border-radius: var(--radius-lg);
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--text-white);
    box-shadow: var(--card-shadow);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--card-shadow-hover);
    color: var(--text-white);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}

.btn-secondary:hover {
    background: var(--gray-200);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}

.btn-secondary:hover {
    background: var(--gray-200);
    transform: translateY(-1px);
    color: var(--text-primary);
}

.btn-success {
    background: var(--success-gradient);
    color: var(--text-white);
}

.btn-warning {
    background: var(--warning-gradient);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--danger-gradient);
    color: var(--text-white) !important;
    border: none;
}

.btn-danger:hover {
    background: var(--danger-hover);
    color: var(--text-white) !important;
    transform: translateY(-1px);
}

.btn-sm {
    padding: calc(var(--spacing-xs) * 0.75) var(--spacing-sm);
    font-size: 0.875rem;
}

.btn-lg {
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: 1.125rem;
}

/* Cards */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-title {
    color: var(--text-primary);
    font-weight: 600;
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table th {
    border-top: none;
    font-weight: 600;
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
}

.table td {
    vertical-align: middle;
}

/* Buttons */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Forms */
.form-control,
.form-select {
    border-radius: var(--border-radius);
    border: 1px solid #dee2e6;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Financing dropdown specific styling */
#financingType {
    background-color: #ffffff !important;
    color: #212529 !important;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 12px 16px;
    font-weight: 500;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 12px;
    appearance: none;
    cursor: pointer;
}

#financingType:hover {
    border-color: #0d6efd;
}

#financingType:focus {
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25) !important;
    outline: none;
}

#financingType option {
    background-color: #ffffff;
    color: #212529;
    padding: 8px;
}

.form-label {
    font-weight: 500;
    color: #212529 !important;
    margin-bottom: 0.5rem;
}

.form-check-label {
    color: #212529 !important;
    font-weight: 500;
}

.fw-bold {
    color: #212529 !important;
}

.mb-3 {
    color: #212529 !important;
}

/* Modal specific text fixes */
.modal .form-label,
.modal .form-check-label,
.modal .fw-bold,
.modal .mb-3,
.modal h5,
.modal h6 {
    color: #212529 !important;
}

/* Button visibility fixes */
.btn-success {
    background-color: #198754 !important;
    border-color: #198754 !important;
    color: #ffffff !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.btn-primary {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    color: #ffffff !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* PV System Card Styling */
.pv-card {
    min-height: 200px;
}

.pv-details {
    margin-top: 12px;
    font-size: 12px;
}

.pv-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    padding: 2px 0;
}

.pv-detail-label {
    color: #6b7280;
    font-weight: 500;
    font-size: 11px;
}

.pv-detail-value {
    color: #374151;
    font-weight: 600;
    font-size: 11px;
}



/* Alerts */
.alert {
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
}

.alert-dismissible .btn-close {
    padding: 0.75rem 1rem;
}

/* Progress bars */
.progress {
    height: 0.5rem;
    border-radius: var(--border-radius);
}

.progress-bar {
    border-radius: var(--border-radius);
}

/* Badges */
.badge {
    font-weight: 500;
}

/* Charts */
.chart-container {
    position: relative;
    height: 400px;
    margin: 1rem 0;
}

.chart-small {
    height: 250px;
}

/* Statistics Cards */
.stat-card {
    background: rgba(255, 255, 255, 0.8);
    color: #1f2937;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #111827;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

/* Consumption Card - Subtle red theme */
.consumption-card {
    background: rgba(220, 38, 38, 0.05);
    border-left: 4px solid #dc2626;
}

/* Production Card - Subtle green theme */
.production-card {
    background: rgba(16, 185, 129, 0.05);
    border-left: 4px solid #10b981;
}

/* Card metadata styling */
.stat-meta {
    margin-top: 0.75rem;
    font-size: 0.75rem;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.meta-label {
    font-weight: 500;
    color: #6b7280;
}

.meta-value {
    font-weight: 600;
    color: #374151;
}

/* Energy cost styling */
#yearlyEnergyCostDisplay {
    color: #dc2626;
    font-weight: 700;
}

#monthlyEnergyCostDisplay {
    color: #dc2626;
    font-weight: 700;
}

/* PV Production card savings styling - Green theme */
#pvYearlySavings {
    color: #10b981;
    font-weight: 700;
}

#pvMonthlySavings {
    color: #10b981;
    font-weight: 700;
}

/* Financial Analysis Section */
.financial-analysis-section {
    margin: 2rem 0;
}

.stat-card.financial-analysis-card {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 2px solid rgba(0, 0, 0, 0.25) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    border-radius: 20px !important;
}

.stat-card.summary-analysis-card {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 2px solid rgba(0, 0, 0, 0.25) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    border-radius: 20px !important;
}

.stat-card.consumption-analysis-card {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 2px solid rgba(0, 0, 0, 0.25) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    border-radius: 20px !important;
}

.stat-card.production-analysis-card {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 2px solid rgba(0, 0, 0, 0.25) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    border-radius: 20px !important;
}

/* Compact input section layout */
.input-section-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
    align-items: stretch;
}

.input-section {
    --input-accent: #0d6efd;
    --input-bg: #f7f9ff;
    --input-border: rgba(13, 110, 253, 0.18);
    --icon-bg: rgba(13, 110, 253, 0.12);
    --chip-bg: rgba(13, 110, 253, 0.12);
    --chip-text: #0b5ed7;
    border-radius: 16px;
    padding: 1.1rem 1.25rem;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: 100%;
}

.input-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.12);
}

.input-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.input-section-title {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.input-section-icon {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: var(--icon-bg);
    color: var(--input-accent) !important;
}

.input-section-texts {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.input-section-name {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
}

.input-section-subtitle {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(15, 23, 42, 0.55);
}

.input-section-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.input-section-chip {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    font-weight: 600;
    background: var(--chip-bg);
    color: var(--chip-text);
    border: 1px solid transparent;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.chip-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(15, 23, 42, 0.6);
}

.chip-value {
    font-size: 0.9rem;
    color: var(--input-accent);
}

.input-section-edit {
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.5rem;
}

.input-section-edit:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.input-section-body {
    margin-top: 0.75rem;
}

.input-metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem 1rem;
}

.input-metric {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
    min-height: 70px;
}

.metric-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(15, 23, 42, 0.58);
}

.metric-value {
    font-size: 0.98rem;
    font-weight: 600;
    color: #0f172a;
}

.input-section-note {
    margin: 0.75rem 0 0;
    font-size: 0.85rem;
    color: rgba(15, 23, 42, 0.65);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-section.accent-energy,
.input-section.accent-pv,
.input-section.accent-battery,
.input-section.accent-matrix,
.input-section.accent-cost {
    --input-accent: #0d6efd;
    --input-bg: #f5f8ff;
    --input-border: rgba(13, 110, 253, 0.18);
    --icon-bg: rgba(13, 110, 253, 0.14);
    --chip-bg: rgba(13, 110, 253, 0.12);
    --chip-text: #0b5ed7;
}

.text-purple {
    color: #6f42c1 !important;
}

@media (max-width: 992px) {
    .input-section-group {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    }

    .input-section {
        padding: 1rem;
    }

    .input-section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .input-section-actions {
        width: 100%;
        justify-content: space-between;
    }

    .input-section-chip {
        order: 2;
    }

    .input-section-edit {
        order: 1;
        padding-left: 0;
    }
}

@media (max-width: 576px) {
    .input-section-group {
        grid-template-columns: 1fr;
    }

    .input-metric-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .input-section-chip {
        width: 100%;
        justify-content: space-between;
    }
}

.financial-table-container {
    margin: 1.5rem 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 130, 246, 0.5) transparent;
}

.financial-table-container::-webkit-scrollbar {
    height: 8px;
}

.financial-table-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.financial-table-container::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.5);
    border-radius: 4px;
}

.financial-table-container::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.7);
}

.financial-table-container .table-responsive {
    min-width: 100%;
    overflow-x: auto;
}

.table-title {
    color: #374151;
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.financial-table {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 0;
}

.financial-table th {
    background: rgba(99, 102, 241, 0.1);
    color: #374151;
    font-weight: 600;
    font-size: 0.75rem;
    text-align: center;
    padding: 8px 4px;
    border: none;
    min-width: 50px;
    max-width: 80px;
}

.financial-table td {
    text-align: center;
    padding: 6px 4px;
    font-weight: 500;
    color: #374151;
    font-size: 0.7rem;
    min-width: 50px;
    max-width: 80px;
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.financial-table .row-label {
    background: rgba(16, 185, 129, 0.1);
    font-weight: 600;
    text-align: left;
    padding-left: 16px;
}

.financial-table .summary-col {
    background: rgba(16, 185, 129, 0.15);
    font-weight: 700;
}

/* Financing Section Styles */
.financing-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.loan-details {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.loan-details .form-text {
    color: rgba(27, 25, 25, 0.7);
    font-size: 0.875rem;
}

.loan-details .form-label {
    color: #374151;
    font-weight: 500;
}

.loan-details .form-control {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #374151 !important;
}

.loan-details .form-control:focus {
    background: rgb(255, 255, 255);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
    color: #374151 !important;
}

.loan-details .form-control::placeholder {
    color: rgba(55, 65, 81, 0.6) !important;
}

/* Cash Flow Row Styling */
.cash-flow-row {
    border-top: 2px solid rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.05);
}

.cash-flow-row .row-label {
    background: rgba(16, 185, 129, 0.15);
    font-weight: 700;
    color: #065f46;
}

.cash-flow-row td {
    font-weight: 600;
    color: #065f46;
}

.cash-flow-row .summary-value {
    background: rgba(16, 185, 129, 0.2);
    font-weight: 700;
    color: #065f46;
}

/* Energy Cost Row Styling */
.cost-row {
    border-top: 2px solid rgba(220, 38, 38, 0.3);
    background: rgba(220, 38, 38, 0.05);
}

.cost-row .row-label {
    background: rgba(220, 38, 38, 0.15);
    font-weight: 700;
    color: #991b1b;
}

.cost-row td {
    font-weight: 600;
    color: #991b1b;
}

.cost-row .summary-value {
    background: rgba(220, 38, 38, 0.2);
    font-weight: 700;
    color: #991b1b;
}

/* Cumulative Cash Flow Row Styling */
.cumulative-cash-flow-row {
    border-top: 2px solid rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.05);
}

.cumulative-cash-flow-row .row-label {
    background: rgba(16, 185, 129, 0.15);
    font-weight: 700;
    color: #065f46;
}

.cumulative-cash-flow-row td {
    font-weight: 600;
    color: #065f46;
}

.cumulative-cash-flow-row .summary-value {
    background: rgba(16, 185, 129, 0.2);
    font-weight: 700;
    color: #065f46;
}

.financial-table .summary-value {
    background: rgba(16, 185, 129, 0.15);
    font-weight: 700;
    color: #059669;
}

.financial-table .summary-row td {
    background: rgba(99, 102, 241, 0.1);
    font-weight: 700;
    color: #374151;
    border-top: 2px solid rgba(99, 102, 241, 0.3);
}

.financial-table .ellipsis-col {
    background: rgba(156, 163, 175, 0.1);
    color: #6b7280;
    font-weight: 600;
    font-size: 1.2rem;
    width: 40px;
    min-width: 40px;
    text-align: center;
}

/* Responsive table adjustments */
.financial-table th,
.financial-table td {
    padding: 8px 4px;
    font-size: 0.75rem;
    min-width: 60px;
    max-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.financial-table .row-label {
    min-width: 120px;
    max-width: 140px;
    padding-left: 12px;
    font-size: 0.8rem;
}

.financial-table .summary-col,
.financial-table .summary-value {
    min-width: 90px;
    max-width: 120px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: visible;
    text-overflow: unset;
}

.financial-table .ellipsis-col {
    min-width: 30px;
    max-width: 30px;
    padding: 8px 2px;
}

@media (max-width: 1200px) {

    .financial-table th,
    .financial-table td {
        padding: 6px 2px;
        font-size: 0.7rem;
        min-width: 50px;
        max-width: 65px;
    }

    .financial-table .row-label {
        min-width: 100px;
        max-width: 120px;
        font-size: 0.75rem;
    }

    .table-title {
        font-size: 0.95rem;
    }
}

@media (max-width: 768px) {

    .financial-table th,
    .financial-table td {
        padding: 4px 1px;
        font-size: 0.65rem;
        min-width: 40px;
        max-width: 50px;
    }

    .financial-table .row-label {
        min-width: 80px;
        max-width: 100px;
        font-size: 0.7rem;
        padding-left: 8px;
    }

    .table-title {
        font-size: 0.9rem;
    }

    .financial-table .ellipsis-col {
        min-width: 25px;
        max-width: 25px;
    }
}

/* Summary card styling */
.summary-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.summary-card .stat-icon {
    background: linear-gradient(135deg, #6366f1, #a855f7);
}

.summary-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #111827;
    line-height: 1.2;
}

/* Energy Overview Section */
.energy-overview {
    margin: 16px 0;
    padding: 12px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.energy-overview-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 6px 0;
}

.energy-overview-label {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

.energy-overview-value {
    font-size: 16px;
    font-weight: 700;
}

.energy-overview-value.production {
    color: #f59e0b;
}

.energy-overview-value.total-consumption {
    color: #dc2626;
}

.energy-overview-value.consumption {
    color: #059669;
}

/* Monthly Breakdown Section */
.monthly-breakdown {
    margin: 16px 0;
    padding: 12px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.breakdown-header {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
    text-align: center;
}

.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.breakdown-item {
    text-align: center;
    padding: 8px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 6px;
}

.breakdown-value {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 4px;
}

.breakdown-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

/* Excess Energy Section */
.excess-energy {
    margin: 16px 0;
    padding: 12px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.excess-header {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
    text-align: center;
}

.excess-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.excess-item {
    text-align: center;
    padding: 8px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 6px;
}

.excess-value {
    font-size: 16px;
    font-weight: 700;
    color: #f59e0b;
    margin-bottom: 4px;
}

.excess-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

.excess-status,
.excess-earnings {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 8px 0;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 4px;
}

.excess-status-label,
.excess-earnings-label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

.excess-status-value {
    font-size: 13px;
    font-weight: 600;
    color: #dc2626;
}

.excess-earnings-value {
    font-size: 13px;
    font-weight: 700;
    color: #3b82f6;
}

/* Main savings display */
#yearlySavingsDisplay {
    color: #059669;
    font-weight: 800;
    font-size: 1.1em;
}

/* Legacy styling for compatibility */
#selfConsumedDisplay {
    color: #059669;
    font-weight: 700;
}

#excessEnergyDisplay {
    color: #f59e0b;
    font-weight: 700;
}

#feedinEarningsDisplay {
    color: #3b82f6;
    font-weight: 700;
}

/* Monthly Summary Grid - Responsive Design */
.monthly-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

/* Responsive breakpoints for monthly summary */
@media (max-width: 768px) {
    .monthly-summary-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    .monthly-summary-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
}

.monthly-summary-item {
    text-align: center;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

@media (max-width: 480px) {
    .monthly-summary-item {
        padding: 0.5rem;
        min-height: 70px;
    }
}

.monthly-summary-item .icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    display: block;
}

@media (max-width: 480px) {
    .monthly-summary-item .icon {
        font-size: 1.25rem;
        margin-bottom: 0.25rem;
    }
}

.monthly-summary-item .value {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

@media (max-width: 480px) {
    .monthly-summary-item .value {
        font-size: 1rem;
    }
}

.monthly-summary-item .label {
    font-size: 0.85rem;
    opacity: 0.8;
}

@media (max-width: 480px) {
    .monthly-summary-item .label {
        font-size: 0.75rem;
    }
}

#totalBenefit {
    color: #059669;
    font-weight: 800;
    font-size: 1.1em;
}

/* Monthly Summary */
.monthly-summary,
.yearly-summary {
    display: flex;
    gap: 1rem;
    margin: 1rem 0;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
}

.summary-item {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
}

.summary-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

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

.consumption-icon {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.production-icon {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

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

.self-consumption-icon {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.excess-icon {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
}

.battery-icon {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
}

.lost-energy-icon {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.summary-content {
    flex: 1;
}

.summary-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.summary-label {
    font-size: 0.75rem;
    color: #1f2937;
    font-weight: 500;
}

/* Responsive monthly and yearly summary */
@media (max-width: 1200px) {

    .monthly-summary,
    .yearly-summary {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
}

@media (max-width: 768px) {

    .monthly-summary,
    .yearly-summary {
        flex-direction: column;
        gap: 0.5rem;
    }

    .summary-item {
        padding: 0.5rem;
    }

    .summary-value {
        font-size: 1rem;
    }
}

/* File Upload */
.file-upload-area {
    border: 2px dashed #dee2e6;
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    transition: border-color 0.3s ease;
    cursor: pointer;
}

.file-upload-area:hover {
    border-color: var(--primary-color);
}

.file-upload-area.dragover {
    border-color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.05);
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .btn {
        font-size: 0.875rem;
    }

    .chart-container {
        height: 300px;
    }

    .stat-card {
        padding: 1rem;
        text-align: center;
    }

    .stat-card .stat-value {
        font-size: 1.25rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #ffffff;
    }

    .card {
        background-color: #2d2d2d;
        color: #ffffff;
    }

    .table {
        color: #ffffff;
    }

    .table th {
        background-color: #3d3d3d;
        color: #ffffff;
    }

    .form-control,
    .form-select:not(#financingType) {
        background-color: #000000;
        border-color: #495057;
        color: #ffffff;
    }

    .form-control:focus,
    .form-select:not(#financingType):focus {
        background-color: #2d2d2d;
        border-color: var(--primary-color);
        color: #ffffff;
    }

    /* Override dark theme for summary analysis card */
    .stat-card.summary-analysis-card {
        background: rgba(255, 255, 255, 0.1) !important;
        border: 2px solid rgba(6, 79, 32, 0.35) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        color: #212529 !important;
    }

    .summary-analysis-card .section-title,
    .summary-analysis-card .stat-content,
    .summary-analysis-card .energy-overview-label,
    .summary-analysis-card .energy-overview-value,
    .summary-analysis-card .excess-header,
    .summary-analysis-card .excess-label,
    .summary-analysis-card .excess-value,
    .summary-analysis-card .excess-status-label,
    .summary-analysis-card .excess-status-value {
        color: #212529 !important;
    }

    /* Override dark theme for consumption analysis card */
    .stat-card.consumption-analysis-card {
        background: rgba(255, 255, 255, 0.1) !important;
        border: 2px solid rgba(21, 18, 18, 0.35) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        color: #212529 !important;
    }

    .consumption-analysis-card .section-title,
    .consumption-analysis-card .stat-content,
    .consumption-analysis-card .energy-overview-label,
    .consumption-analysis-card .energy-overview-value,
    .consumption-analysis-card .table-title {
        color: #212529 !important;
    }

    /* Override dark theme for production analysis card */
    .stat-card.production-analysis-card {
        background: rgba(255, 255, 255, 0.1) !important;
        border: 2px solid rgba(21, 18, 18, 0.35) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        color: #212529 !important;
    }

    .production-analysis-card .section-title,
    .production-analysis-card .stat-content,
    .production-analysis-card .energy-overview-label,
    .production-analysis-card .energy-overview-value,
    .production-analysis-card .table-title {
        color: #212529 !important;
    }

    /* Override dark theme for financial analysis card */
    .stat-card.financial-analysis-card {
        background: rgba(255, 255, 255, 0.1) !important;
        border: 2px solid rgba(6, 79, 32, 0.35) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        color: #212529 !important;
    }

    .financial-analysis-card .section-title,
    .financial-analysis-card .stat-content,
    .financial-analysis-card .energy-overview-label,
    .financial-analysis-card .energy-overview-value,
    .financial-analysis-card .table-title {
        color: #212529 !important;
    }



    /* Dark theme separator styling */
    .separator-text {
        color: #9ca3af !important;
    }

    .separator-line {
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent) !important;
    }
}

/* Utility Classes */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cursor-pointer {
    cursor: pointer;
}

.border-dashed {
    border-style: dashed !important;
}

.bg-gradient {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

.slide-up {
    animation: slideUp 0.3s ease-in-out;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Modern Tables */
.table {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    margin-bottom: 0;
}

.table th {
    background: var(--gray-50);
    border: none;
    font-weight: 600;
    color: var(--text-primary);
    padding: 16px;
}

.table td {
    border: none;
    padding: 16px;
    color: var(--text-secondary);
    vertical-align: middle;
}

.table tbody tr {
    border-bottom: 1px solid var(--card-border);
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background: var(--gray-50);
}

/* Modern Stats Cards */
.stats-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-xl);
    padding: 32px 24px;
    text-align: center;
    transition: all 0.2s ease;
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
}

.stats-value {
    font-size: 48px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
    line-height: 1.1;
}

.stats-label {
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 13px;
}

/* Hero Section */
.hero-section {
    text-align: center;
    padding: 48px 0 64px 0;
    margin-bottom: 32px;
}

.hero-content {
    max-width: 600px;
    margin: 0 auto;
}

.hero-title {
    font-size: 48px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    line-height: 1.1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.hero-title i {
    color: var(--primary-color);
    font-size: 44px;
}

.hero-subtitle {
    font-size: 20px;
    color: var(--text-secondary);
    font-weight: 400;
    line-height: 1.4;
    margin: 0;
}

/* Action Cards */
.action-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-xl);
    padding: 48px 32px;
    text-align: center;
    transition: all 0.2s ease;
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.action-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
}

.action-card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.action-icon {
    width: 80px;
    height: 80px;
    background: var(--primary-color);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    color: white;
    font-size: 32px;
}

.action-icon.upload-icon {
    background: var(--success-color);
}

.action-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.action-description {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 32px;
    flex: 1;
}

/* Project Cards */
.project-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-xl);
    padding: 24px;
    transition: all 0.2s ease;
    box-shadow: var(--card-shadow);
    cursor: pointer;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
    border-color: var(--primary-color);
}

.project-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.project-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-white);
    font-size: 20px;
    margin-right: 16px;
    flex-shrink: 0;
}

.project-info {
    flex: 1;
}

.project-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.project-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.project-stats {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--card-border);
}

.project-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
}

.project-stat:last-child {
    margin-bottom: 0;
}

.project-stat-label {
    color: var(--text-secondary);
}

.project-stat-value {
    color: var(--text-primary);
    font-weight: 500;
}



.loading-projects {
    text-align: center;
    padding: 48px 0;
    color: var(--text-secondary);
}

.empty-projects {
    text-align: center;
    padding: 64px 32px;
    color: var(--text-secondary);
}

.empty-projects i {
    font-size: 48px;
    color: var(--text-tertiary);
    margin-bottom: 16px;
}

.empty-projects h3 {
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-projects p {
    color: var(--text-secondary);
}

/* Modern Charts Container */
.chart-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 24px 32px 40px 32px;
    /* Extra bottom padding for x-axis labels */
    box-shadow: var(--card-shadow);
    position: relative;
    height: 400px;
}

/* Chart Placeholder Styles */
.chart-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 300px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.03) 0%, rgba(99, 102, 241, 0.03) 100%);
    border: 2px dashed var(--card-border);
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
}

.chart-placeholder::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 50%, rgba(59, 130, 246, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(99, 102, 241, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    text-align: center;
    z-index: 1;
    padding: 20px;
}

.placeholder-icon {
    font-size: 48px;
    color: var(--primary-color, #3b82f6);
    opacity: 0.6;
    animation: float 3s ease-in-out infinite;
}

.placeholder-text {
    font-size: 15px;
    color: var(--text-secondary, #6b7280);
    margin: 0;
    font-weight: 500;
    line-height: 1.5;
    max-width: 280px;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-8px);
    }
}

/* Responsive Charts Layout */
.weekday-weekend-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.battery-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 30px;
}

/* Mobile responsiveness for charts */
@media (max-width: 768px) {
    .weekday-weekend-charts {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-top: 15px;
    }

    .battery-charts {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-top: 20px;
    }

    .chart-container {
        height: 300px;
        padding: 16px 20px 32px 20px;
        /* Extra bottom padding for x-axis labels */
        margin: 0.5rem 0;
    }

    .matrix-chart-container {
        height: 450px;
        /* Smaller but still readable on mobile */
        padding: 16px 20px 32px 20px;
        margin: 0.5rem 0;
    }

    .chart-container h4 {
        font-size: 14px;
        margin-bottom: 10px;
        text-align: center;
    }

    .chart-placeholder {
        min-height: 250px;
    }

    .placeholder-icon {
        font-size: 36px;
    }

    .placeholder-text {
        font-size: 13px;
        max-width: 240px;
    }

    /* Ensure charts are responsive on mobile */
    .chart-container canvas {
        max-width: 100%;
        height: auto;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .weekday-weekend-charts {
        gap: 10px;
        margin-top: 10px;
    }

    .battery-charts {
        gap: 10px;
        margin-top: 15px;
    }

    .chart-container {
        height: 250px;
        padding: 12px 16px 28px 16px;
        /* Extra bottom padding for x-axis labels */
        margin: 0.25rem 0;
    }

    .matrix-chart-container {
        height: 400px;
        /* Smaller on very small screens */
        padding: 12px 16px 28px 16px;
        margin: 0.25rem 0;
    }

    .chart-container h4 {
        font-size: 13px;
        margin-bottom: 8px;
    }
}

/* Tablet responsiveness */
@media (max-width: 1024px) and (min-width: 769px) {
    .weekday-weekend-charts {
        gap: 15px;
    }

    .battery-charts {
        gap: 15px;
    }

    .chart-container {
        height: 350px;
        padding: 18px 24px 36px 24px;
        /* Extra bottom padding for x-axis labels */
    }

    .matrix-chart-container {
        height: 550px;
        /* Good size for tablets */
        padding: 18px 24px 36px 24px;
    }

    .chart-container h4 {
        font-size: 15px;
    }
}

/* Large screens */
@media (min-width: 1400px) {
    .weekday-weekend-charts {
        gap: 30px;
        margin-top: 30px;
    }

    .battery-charts {
        gap: 30px;
        margin-top: 40px;
    }

    .chart-container {
        height: 450px;
        padding: 28px 36px 48px 36px;
        /* Extra bottom padding for x-axis labels */
    }

    .matrix-chart-container {
        height: 700px;
        /* Maximum height for large screens */
        padding: 28px 36px 48px 36px;
    }
}

/* Ensure charts maintain aspect ratio and responsiveness */
.chart-container canvas {
    position: relative;
    max-width: 100%;
    height: auto;
}

/* Matrix Chart Container - Larger height for heatmap readability */
.matrix-chart-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--card-shadow);
    position: relative;
    height: 600px;
    /* Increased back to 600px for better chart visibility */
    margin: 1rem 0;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    /* Prevent content overflow */
    display: flex;
    flex-direction: column;
}

.matrix-chart-container canvas {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    width: 100% !important;
    height: 100% !important;
    /* Force full height */
}



/* Ensure chart card inside matrix container is properly sized */
.matrix-chart-container .chart-card {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.matrix-chart-container .chart-header {
    flex-shrink: 0;
    /* Don't shrink header */
    margin-bottom: 1rem;
}

.matrix-chart-container .tab-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    /* Allow flex shrinking */
}

/* Legacy matrix chart container - disabled for new design */
.matrix-chart-container .tab-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    /* Allow flex shrinking */
}

.matrix-chart-container .tab-pane.active {
    display: flex !important;
    /* Override Bootstrap's display: block */
}

/* Disable legacy styles for battery matrix section */
.battery-matrix-section .matrix-chart-container .tab-pane,
.battery-matrix-section .matrix-chart-container .tab-pane.active {
    flex: none !important;
    display: block !important;
    overflow: visible !important;
    min-height: auto !important;
}

/* Matrix summary section */
.matrix-summary {
    flex-shrink: 0;
    /* Don't shrink the summary */
    margin-bottom: 1rem !important;
}

.matrix-summary .card-body {
    padding: 1rem !important;
    /* Reduce padding to save space */
}



/* Matrix chart content containers within tab panes */
.matrix-chart-content {
    flex: 1;
    position: relative;
    min-height: 450px;
    /* Increased minimum height */
    height: 100%;
    display: block;
    /* Change from flex to block for better Chart.js compatibility */
    overflow: hidden;
}

.matrix-chart-content canvas {
    position: relative !important;
    width: 100% !important;
    height: 450px !important;
    /* Fixed height for consistent rendering */
    min-height: 450px;
    /* Increased minimum height */
    max-height: 450px;
}

/* Responsive adjustments for matrix charts */
@media (max-width: 1200px) {
    .matrix-chart-container {
        height: 450px;
    }

    .matrix-chart-container .matrix-chart-container {
        min-height: 300px;
        max-height: 350px;
    }
}

@media (max-width: 768px) {
    .matrix-chart-container {
        height: 400px;
        padding: 12px;
    }

    .matrix-chart-container .matrix-chart-container {
        min-height: 250px;
        max-height: 300px;
    }
}

/* Additional responsive adjustments for the main dashboard */
@media (max-width: 768px) {
    .dashboard-container {
        padding: 10px;
    }

    .card {
        margin-bottom: 15px;
    }

    .row {
        margin: 0 -5px;
    }

    .col-md-6,
    .col-lg-4,
    .col-lg-6 {
        padding: 0 5px;
        margin-bottom: 10px;
    }
}









/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--card-border);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Modern File Upload */
.file-upload-area {
    background: var(--card-bg);
    border: 2px dashed var(--card-border);
    border-radius: var(--radius-lg);
    padding: 48px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.file-upload-area:hover {
    background: var(--gray-50);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.file-upload-area.dragover {
    background: var(--gray-50);
    border-color: var(--primary-color);
    transform: scale(1.02);
}

/* Modern Progress */
.progress {
    background: var(--gray-200);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
    height: 12px;
}

.progress-bar {
    background: var(--primary-gradient);
    transition: width 0.3s ease;
    border-radius: var(--radius-md);
}

/* Enhanced Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .hero-section {
        padding: 32px 0 48px 0;
    }

    .hero-title {
        font-size: 36px;
        flex-direction: column;
        gap: 12px;
    }

    .hero-title i {
        font-size: 32px;
    }

    .hero-subtitle {
        font-size: 18px;
    }

    .action-card {
        padding: 32px 24px;
        margin-bottom: 16px;
    }

    .action-icon {
        width: 64px;
        height: 64px;
        font-size: 24px;
        margin-bottom: 20px;
    }

    .action-title {
        font-size: 20px;
    }

    .stats-value {
        font-size: 36px;
    }

    .chart-container {
        height: 300px;
        padding: 16px;
    }

    .navbar-nav .nav-link {
        margin: 4px 0;
    }

    .file-upload-area {
        padding: 24px;
    }

    .table-responsive {
        font-size: 14px;
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 18px;
    }

    .hero-title {
        font-size: 28px;
    }

    .hero-subtitle {
        font-size: 16px;
    }

    .stats-value {
        font-size: 28px;
    }

    .action-card {
        padding: 24px 16px;
    }

    .action-title {
        font-size: 18px;
    }

    .action-description {
        font-size: 14px;
    }

    .card-header {
        padding: 16px 20px;
        font-size: 16px;
    }

    .card-body {
        padding: 20px;
    }
}

/* Weight Control Styling - High specificity to override Bootstrap */
.weight-controls .form-range {
    height: 6px !important;
    background: #000000 !important;
    border-radius: 3px !important;
    outline: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    border: none !important;
}

/* Webkit browsers (Chrome, Safari, Edge) */
.weight-controls .form-range::-webkit-slider-track {
    height: 6px !important;
    background: #000000 !important;
    border-radius: 3px !important;
    border: none !important;
    -webkit-appearance: none !important;
}

.weight-controls .form-range::-webkit-slider-thumb {
    -webkit-appearance: none !important;
    appearance: none !important;
    background: var(--primary-color) !important;
    border: 2px solid #fff !important;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .1) !important;
    width: 18px !important;
    height: 18px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    margin-top: -6px !important;
}

/* Firefox */
.weight-controls .form-range::-moz-range-track {
    height: 6px !important;
    background: #000000 !important;
    border-radius: 3px !important;
    border: none !important;
}

.weight-controls .form-range::-moz-range-thumb {
    background: var(--primary-color) !important;
    border: 2px solid #fff !important;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .1) !important;
    width: 18px !important;
    height: 18px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

/* Additional fallback for stubborn browsers */
.weight-controls input[type="range"] {
    background: #000000 !important;
    height: 6px !important;
}

.weight-controls input[type="range"]::-webkit-slider-runnable-track {
    background: #000000 !important;
    height: 6px !important;
    border-radius: 3px !important;
}

.weight-value {
    min-width: 45px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--primary-color);
}

.weight-controls label {
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.weight-controls .btn {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.weight-controls .btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--card-shadow-hover);
}

/* Matrix Table Styles */
.matrix-table-wrapper {
    margin: 20px 0;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.matrix-title {
    padding: 15px 20px;
    margin: 0;
    background: linear-gradient(135deg, #6f42c1 0%, #5a32a3 100%);
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.matrix-scroll-container {
    overflow: auto;
    max-height: 600px;
    max-width: 100%;
}

.matrix-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
}

.matrix-table th,
.matrix-table td {
    border: 1px solid #e5e7eb;
    text-align: center;
    vertical-align: middle;
    position: relative;
}

.matrix-corner {
    background: #f8fafc;
    color: #374151;
    font-weight: 600;
    padding: 12px 8px;
    font-size: 0.8rem;
    min-width: 120px;
    position: sticky;
    left: 0;
    z-index: 3;
}

.matrix-header {
    background: #f1f5f9;
    color: #475569;
    font-weight: 600;
    padding: 10px 6px;
    font-size: 0.8rem;
    min-width: 70px;
    white-space: nowrap;
}

.matrix-row-header {
    background: #f8fafc;
    color: #374151;
    font-weight: 600;
    padding: 8px 10px;
    font-size: 0.8rem;
    min-width: 80px;
    position: sticky;
    left: 0;
    z-index: 2;
    white-space: nowrap;
}

.matrix-cell {
    padding: 8px 4px;
    font-weight: 500;
    font-size: 0.8rem;
    min-width: 60px;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.2;
}

.matrix-cell:hover {
    transform: scale(1.05);
    z-index: 1;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    border: 2px solid #3b82f6;
}

.matrix-optimal {
    position: relative;
    animation: pulse-optimal 2s infinite;
}

@keyframes pulse-optimal {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.7);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(255, 107, 53, 0);
    }
}

.optimal-marker {
    animation: star-glow 1.5s ease-in-out infinite alternate;
}

@keyframes star-glow {
    from {
        text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
    }

    to {
        text-shadow: 0 0 8px #ff6b35, 1px 1px 1px rgba(0, 0, 0, 0.5);
    }
}

/* Responsive matrix table */
@media (max-width: 768px) {
    .matrix-table {
        font-size: 0.75rem;
    }

    .matrix-cell {
        padding: 6px 3px;
        min-width: 50px;
    }

    .matrix-header,
    .matrix-row-header {
        padding: 6px 4px;
        font-size: 0.7rem;
    }
}

/* ========================================
   BATTERY MATRIX SECTION - REDESIGNED
   ======================================== */

/* Override existing matrix styles with new design */
.battery-matrix-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%) !important;
    border-radius: 16px !important;
    padding: 24px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    margin: 1rem 0 !important;
    height: auto !important;
    overflow: visible !important;
    display: block !important;
}

.matrix-wrapper {
    width: 100%;
    max-width: 100%;
}

/* Matrix Header */
.matrix-header {
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.matrix-legend {
    display: flex;
    align-items: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

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

/* Matrix Navigation */
.matrix-nav-container {
    background: #ffffff;
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #e9ecef;
    margin-bottom: 16px;
}

.matrix-nav {
    margin: 0;
    gap: 4px;
    flex-wrap: wrap;
    border: none !important;
}

.matrix-nav .nav-link {
    border-radius: 8px !important;
    padding: 10px 16px !important;
    font-weight: 500 !important;
    color: #6c757d !important;
    background: transparent !important;
    border: none !important;
    transition: all 0.2s ease !important;
    white-space: nowrap;
    font-size: 0.9rem;
}

.matrix-nav .nav-link:hover {
    background: #f8f9fa !important;
    color: #495057 !important;
    transform: translateY(-1px);
}

.matrix-nav .nav-link.active {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%) !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3) !important;
}

.matrix-nav .nav-link i {
    font-size: 0.85rem;
}

/* Matrix Content Area */
.matrix-content-area {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
    position: relative;
}

.matrix-content-area .tab-content {
    position: relative;
    min-height: 500px;
    overflow: hidden;
}

/* Optimization Controls */
.optimization-controls {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
}

.optimal-result-card,
.weight-controls-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #e9ecef;
    overflow: hidden;
}

.optimal-result-card .card-header,
.weight-controls-card .card-header {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 12px 16px;
    border: none;
    font-weight: 600;
}

.weight-controls-card .card-header {
    background: linear-gradient(135deg, #007bff 0%, #6610f2 100%);
}

.optimal-result-card .card-body,
.weight-controls-card .card-body {
    padding: 20px;
}

/* Optimal Display */
.optimal-display {
    font-size: 1.8rem;
    font-weight: 700;
    color: #28a745;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.optimal-display .separator {
    color: #6c757d;
    margin: 0 8px;
    font-weight: 400;
}

.optimal-metrics {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.optimal-metrics .metric {
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 500;
}

/* Weight Controls */
.weight-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.weight-item {
    font-size: 0.9rem;
    color: #495057;
}

.weight-sliders {
    border-top: 1px solid #e9ecef;
    padding-top: 16px;
}

.slider-group {
    margin-bottom: 16px;
}

.slider-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: #495057;
    margin-bottom: 8px;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.slider-container .form-range {
    flex: 1;
}

.slider-value {
    font-weight: 600;
    color: #007bff;
    min-width: 45px;
    text-align: center;
    font-size: 0.9rem;
}

.total-weight {
    text-align: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #495057;
    margin-bottom: 16px;
}

/* Matrix Chart Container - New Design */
.battery-matrix-section .matrix-chart-container {
    padding: 24px !important;
    background: #ffffff !important;
    position: relative !important;
    height: 500px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    border: none !important;
    margin: 0 !important;
}

.battery-matrix-section .matrix-chart-container canvas {
    width: 100% !important;
    height: 450px !important;
    max-width: 100% !important;
    max-height: 450px !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
}

/* Tab Panes - Fixed Bootstrap Override */
.battery-matrix-section .tab-content {
    position: relative;
    min-height: 500px;
    overflow: hidden;
}

/* Hide all tab panes by default */
.battery-matrix-section .tab-pane {
    display: none !important;
    opacity: 0;
    transition: opacity 0.15s linear;
    width: 100%;
    height: auto;
    min-height: 500px;
}

/* Show only the active tab pane */
.battery-matrix-section .tab-pane.active.show {
    display: block !important;
    opacity: 1;
    position: relative;
}

/* Ensure fade transition works */
.battery-matrix-section .tab-pane.fade {
    transition: opacity 0.15s linear;
}

.battery-matrix-section .tab-pane.fade:not(.show) {
    opacity: 0;
}

.battery-matrix-section .tab-pane.fade.show {
    opacity: 1;
}

/* Debug styles - can be removed in production */
.battery-matrix-section .tab-pane.active {
    border-left: 3px solid #007bff;
}

.battery-matrix-section .tab-pane:not(.active) {
    border-left: 3px solid transparent;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .matrix-nav .nav-link {
        padding: 8px 12px !important;
        font-size: 0.85rem !important;
    }

    .optimal-display {
        font-size: 1.5rem;
    }

    .battery-matrix-section .matrix-chart-container {
        height: 450px !important;
    }

    .battery-matrix-section .matrix-chart-container canvas {
        height: 400px !important;
        max-height: 400px !important;
    }
}

@media (max-width: 768px) {
    .battery-matrix-section {
        padding: 16px !important;
        border-radius: 12px !important;
    }

    .matrix-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .matrix-legend {
        align-self: flex-start;
    }

    .matrix-nav {
        justify-content: flex-start;
    }

    .matrix-nav .nav-link {
        padding: 8px 10px !important;
        font-size: 0.8rem !important;
    }

    .optimization-controls {
        padding: 16px;
    }

    .optimal-display {
        font-size: 1.3rem;
    }

    .optimal-metrics {
        flex-direction: column;
        gap: 8px;
    }

    .weight-display {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .battery-matrix-section .matrix-chart-container {
        height: 400px !important;
        padding: 16px !important;
    }

    .battery-matrix-section .matrix-chart-container canvas {
        height: 350px !important;
        max-height: 350px !important;
    }
}

@media (max-width: 576px) {
    .section-title {
        font-size: 1.25rem;
    }

    .matrix-nav .nav-link {
        padding: 6px 8px !important;
        font-size: 0.75rem !important;
    }

    .matrix-nav .nav-link i {
        display: none;
    }

    .optimal-display {
        font-size: 1.1rem;
    }

    .battery-matrix-section .matrix-chart-container {
        height: 350px !important;
        padding: 12px !important;
    }

    .battery-matrix-section .matrix-chart-container canvas {
        height: 300px !important;
        max-height: 300px !important;
    }
}

/* ========================================
   SIMULATION CONTROL BUTTONS
   ======================================== */

.simulation-controls {
    margin-bottom: 2rem;
}

.simulation-button-card .card {
    border: 2px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.simulation-button-card .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 123, 255, 0.3);
}

.simulation-button-card .card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
}

.simulation-button-card .card-text {
    font-size: 0.875rem;
    line-height: 1.5;
    min-height: 40px;
}

.simulation-button-card .btn {
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.simulation-button-card .btn:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.simulation-button-card .btn-primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border: none;
}

.simulation-button-card .btn-success {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    border: none;
}

@media (max-width: 768px) {
    .simulation-button-card .card-title {
        font-size: 1rem;
    }

    .simulation-button-card .card-text {
        font-size: 0.8rem;
        min-height: auto;
    }

    .simulation-button-card .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
}

/* Loading state for simulation buttons */
.simulation-button-card .btn.btn-loading {
    position: relative;
    cursor: wait;
}

.simulation-button-card .btn.btn-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.2) 50%,
            transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* Spinner animation enhancement */
.simulation-button-card .btn .fa-spinner {
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Fix for PV summary text colors */
#totalStringCount,
#totalPeakPower,
#totalInverterCapacity {
    color: var(--text-primary) !important;
}

/* Ensure parent h4 elements also have correct color */
.bg-light h4 {
    color: var(--text-primary) !important;
}

/* ========================================
   PARETO FRONTIER DISPLAY
   ======================================== */

.pareto-frontier-section {
    animation: fadeIn 0.5s ease-in;
}

.pareto-frontier-section .card {
    background: #ffffff !important;
}

.pareto-frontier-section .card-body {
    background: #ffffff !important;
}

.pareto-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
    background: #ffffff;
}

.pareto-item {
    background: #fff !important;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.75rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.pareto-item:hover {
    border-color: #fbbf24;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.2);
    transform: translateY(-2px);
}

.pareto-item.is-weighted-optimal {
    border-color: #10b981;
    background: #f0fdf4;
}

.pareto-item-size {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.pareto-item-metrics {
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1.4;
}

.pareto-item-metric {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.pareto-item-metric-label {
    font-weight: 500;
}

.pareto-item-metric-value {
    font-weight: 600;
    color: #374151;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .pareto-list {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

/* ============================================
   PROJECT LOADING OVERLAY
   ============================================ */

.project-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.project-loading-overlay.show {
    display: flex;
    opacity: 1;
}

.project-loading-overlay .loading-content {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    min-width: 300px;
}

.project-loading-overlay .loading-content h4 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.project-loading-overlay .loading-content p {
    color: var(--text-secondary);
    margin-bottom: 0;
    font-size: 0.9rem;
}

.project-loading-overlay .spinner-border {
    border-width: 0.3rem;
}