:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --accent: #3498db;
    --solar: #ff9f43;
    --grid: #95a5a6;
    --home: #2ecc71;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    margin-bottom: 30px;
}

header h1 {
    margin: 0;
    font-weight: 600;
}

#last-updated {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.card h3 {
    margin-top: 0;
    font-size: 0.9em;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-grow: 1;
    /* Allow header to grow/push value down if needed, or just let value margin-top: auto handle it */
}

.card .value {
    font-size: 1.8em;
    font-weight: bold;
    margin-top: auto;
    /* Push value to the bottom */
}

.chart-container {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.chart-container h2 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2em;
}

/* Tooltip Container */
.tooltip-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    background-color: var(--text-secondary);
    color: var(--card-bg);
    border-radius: 50%;
    text-align: center;
    line-height: 16px;
    font-size: 12px;
    font-weight: bold;
    cursor: help;
    position: relative;
    vertical-align: middle;
    flex-shrink: 0;
    /* Prevent squishing */
}

/* Tooltip Text */
.tooltip-icon:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    opacity: 0;
    animation: fadeIn 0.3s forwards;
    pointer-events: none;
    text-transform: none;
    font-weight: normal;
    min-width: 150px;
    text-align: center;
}

/* Arrow */
.tooltip-icon:hover::before {
    content: '';
    position: absolute;
    bottom: 110%;
    /* Slightly overlapping text */
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Card Header Layout to accommodate icon */
.card h3 {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* Keep label left, icon next to it */
}

/* ROI Payback Progress */
.roi-section {
    margin-top: 2rem;
    padding: 1.5rem;
}

.roi-progress-wrapper {
    margin-top: 1rem;
}

.roi-progress-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.roi-progress-percent {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0.38rem 0.62rem;
    border: 1px solid rgba(255, 159, 67, 0.25);
    border-radius: 999px;
    background: rgba(255, 159, 67, 0.08);
    color: var(--text-secondary);
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

#roi-progress-text {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: -0.02em;
}

#roi-progress-total {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.roi-progress-bar {
    width: 100%;
    height: 48px;
    box-sizing: border-box;
    padding: 4px;
    background: linear-gradient(180deg, #292d34, #22252b);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    position: relative;
    overflow: hidden;
    margin-bottom: 1rem;
    display: flex;
    gap: 3px;
    box-shadow:
        inset 0 2px 5px rgba(0, 0, 0, 0.45),
        0 5px 16px rgba(0, 0, 0, 0.18);
}

.roi-progress-segment {
    height: 100%;
    width: 0%;
    transition: width 1s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    white-space: nowrap;
    font-size: 0.68rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    border-radius: 9px;
    overflow: hidden;
    isolation: isolate;
}

.roi-progress-segment::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.24), transparent 48%);
    pointer-events: none;
}

.roi-energy-segment {
    background: linear-gradient(135deg, #ffad4d, #e56f13);
    box-shadow: 0 0 14px rgba(229, 111, 19, 0.22);
}

.roi-rec-segment {
    background: linear-gradient(135deg, #c084fc, #8b5cf6);
    box-shadow: 3px 0 15px rgba(139, 92, 246, 0.3);
}

.roi-segment-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.08;
    letter-spacing: 0.01em;
}

.roi-segment-label strong {
    font-size: 0.7rem;
}

.roi-rec-segment .roi-segment-label {
    position: absolute;
    left: 50%;
    z-index: 1;
    transform: translateX(-50%);
    font-size: 0.53rem;
}

.roi-rec-segment .roi-segment-label strong {
    font-size: 0.56rem;
}

.roi-payoff-card {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-top: 0.15rem;
    padding: 0.7rem 0.85rem;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
}

#roi-payoff-estimate {
    color: #f0f0f0;
    font-size: 0.82rem;
    font-weight: 600;
}

#roi-payoff-basis {
    color: var(--text-secondary);
    font-size: 0.67rem;
}

/* Split Section Layout */
.split-section {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 30px;
    align-items: stretch;
}

.split-section .chart-container {
    margin-bottom: 0;
    /* Fix double gap issue */
}

@media (max-width: 768px) {
    .split-section {
        flex-direction: column;
    }

}

/* ROI Section Override for Split Layout */
/* We target it when inside split-section if needed, or just adjust globally */
.roi-section {
    margin-top: 0;
    /* Remove top margin */
    padding: 1.5rem;
    flex: 1;
    /* Take equal width */
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Vertically center content */
}

/* Small Stats Grid */
.stats-grid-small {
    background-color: var(--card-bg);
    padding: 1.5rem;
    /* Match roi-section padding */
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    flex: 1;
    /* Take equal width */
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-around;
}

.stats-grid-small .stat-item {
    text-align: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    /* Slightly lighter background for contrast */
    border-radius: 8px;
    flex: 1;
    min-width: 120px;
}

.stats-grid-small .stat-item {
    text-align: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    flex: 1;
    min-width: 120px;
}

.stats-grid-small .stat-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stats-grid-small .stat-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--solar);
    /* Use solar color for best solar stats */
}

.stats-grid-small .stat-sub {
    display: block;
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.5rem;
}
