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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

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

/* Header */
header {
    margin-bottom: 30px;
}

header h1 {
    font-size: 28px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.update-time {
    font-size: 14px;
    color: #666;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 60px 20px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e0e0e0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading p {
    color: #666;
    font-size: 16px;
}

/* Error State */
.error {
    background-color: #fee;
    border: 1px solid #fcc;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    color: #c33;
}

/* Dashboard */
.dashboard {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Heat Map Section */
.heatmap-section {
    margin-bottom: 40px;
}

.heatmap-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

.heatmap {
    width: 100%;
    border-collapse: separate;
    border-spacing: 2px;
    font-size: 13px;
}

.heatmap th {
    background-color: #f8f9fa;
    padding: 8px 4px;
    font-weight: 600;
    color: #555;
    text-align: center;
    font-size: 11px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.heatmap .date-header {
    text-align: left;
    padding-left: 12px;
    min-width: 100px;
}

.heatmap .hour-header {
    min-width: 32px;
    width: 32px;
}

.heatmap .total-header {
    text-align: right;
    padding-right: 12px;
    min-width: 80px;
    background-color: #f0f0f0;
}

.heatmap td {
    padding: 0;
    text-align: center;
    position: relative;
}

.heatmap .date-cell {
    text-align: left;
    padding: 12px;
    font-weight: 500;
    color: #333;
    background-color: #fafafa;
    white-space: nowrap;
}

.heatmap .energy-cell {
    width: 32px;
    height: 32px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #e0e0e0;
}

.heatmap .energy-cell:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 5;
    border-color: #333;
}

.heatmap .total-cell {
    text-align: right;
    padding: 12px;
    font-weight: 700;
    color: #1a1a1a;
    background-color: #f8f9fa;
}

/* Blue gradient color scale - dark blue (low) to white (high) */
.energy-level-0 { background-color: #172554; } /* Dark blue for no production */
.energy-level-1 { background-color: #1e3a8a; }
.energy-level-2 { background-color: #1e40af; }
.energy-level-3 { background-color: #1d4ed8; }
.energy-level-4 { background-color: #2563eb; }
.energy-level-5 { background-color: #3b82f6; }
.energy-level-6 { background-color: #60a5fa; }
.energy-level-7 { background-color: #93c5fd; }
.energy-level-8 { background-color: #bfdbfe; }
.energy-level-9 { background-color: #e0f2fe; }
.energy-level-10 { background-color: #f8fafc; } /* Very light for highest production */

/* Legend */
.legend {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.legend-title {
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.legend-gradient {
    flex: 1;
    max-width: 400px;
}

.legend-bar {
    height: 20px;
    background: linear-gradient(to right,
        #172554 0%,
        #1e3a8a 10%,
        #1e40af 20%,
        #1d4ed8 30%,
        #2563eb 40%,
        #3b82f6 50%,
        #60a5fa 60%,
        #93c5fd 70%,
        #bfdbfe 80%,
        #e0f2fe 90%,
        #f8fafc 100%
    );
    border-radius: 4px;
    margin-bottom: 5px;
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
}

/* Chart Section */
.chart-section {
    margin-top: 40px;
}

.chart-section h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 20px;
}

.daily-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: 8px;
    height: 250px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    position: relative;
}

.chart-bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    position: relative;
}

.bar-value {
    position: absolute;
    top: 0;
    font-size: 11px;
    font-weight: 600;
    color: #333;
}

.bar-container {
    width: 100%;
    height: calc(100% - 35px);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    position: relative;
}

.bar-fill {
    width: 100%;
    background: linear-gradient(to top, #2563eb, #3b82f6);
    border-radius: 4px 4px 0 0;
    transition: all 0.3s;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.bar-fill:hover {
    background: linear-gradient(to top, #1d4ed8, #2563eb);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.bar-label {
    position: absolute;
    bottom: -25px;
    font-size: 11px;
    color: #666;
    text-align: center;
    white-space: nowrap;
}

/* Tooltip */
.tooltip {
    position: fixed;
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tooltip-date {
    font-weight: 600;
    margin-bottom: 4px;
}

.tooltip-value {
    color: #93c5fd;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .heatmap-container {
        overflow-x: scroll;
    }

    .legend {
        flex-direction: column;
        align-items: flex-start;
    }

    .legend-gradient {
        width: 100%;
        max-width: none;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .dashboard {
        padding: 20px 15px;
    }

    header h1 {
        font-size: 22px;
    }

    .heatmap th,
    .heatmap td {
        font-size: 11px;
    }
}
