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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: #ffffff;
}

.container {
    max-width: 100%;
    padding: 16px;
    padding-bottom: 32px;
}

header {
    text-align: center;
    padding: 20px 0;
    margin-bottom: 20px;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(90deg, #00d2ff, #3a7bd5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* File Upload Section */
.file-upload {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    border: 2px dashed rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.file-upload:hover {
    border-color: #00d2ff;
    background: rgba(255, 255, 255, 0.15);
}

.upload-btn {
    display: inline-block;
    padding: 14px 28px;
    background: linear-gradient(135deg, #00d2ff, #3a7bd5);
    color: white;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 210, 255, 0.4);
}

.upload-btn:active {
    transform: translateY(0);
}

#csvFile {
    display: none;
}

.file-name {
    margin-top: 12px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.card {
    display: flex;
    align-items: center;
    padding: 16px;
    border-radius: 16px;
    backdrop-filter: blur(10px);
    transition: transform 0.2s ease;
}

.card:active {
    transform: scale(0.98);
}

.card.generation {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.2), rgba(255, 152, 0, 0.2));
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.card.selling {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.2), rgba(46, 125, 50, 0.2));
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.card.consumption {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.2), rgba(25, 118, 210, 0.2));
    border: 1px solid rgba(33, 150, 243, 0.3);
}

.card-icon {
    font-size: 2rem;
    margin-right: 16px;
}

.card-content {
    display: flex;
    flex-direction: column;
}

.card-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 4px;
}

.card-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.card-unit {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

/* View Tabs */
.view-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px;
}

.tab-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.tab-btn.active {
    background: linear-gradient(135deg, #00d2ff, #3a7bd5);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 210, 255, 0.3);
}

/* Filter Section */
.filter-section {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 120px;
}

.filter-section label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    white-space: nowrap;
}

.filter-section select {
    flex: 1;
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: #1a1a2e;
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 80px;
}

/* Chart Container */
.chart-container {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.chart-container h2 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: rgba(255, 255, 255, 0.9);
}

.chart-container canvas {
    max-height: 300px;
}

/* Data Table */
.data-table {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 16px;
    backdrop-filter: blur(10px);
}

.data-table h2 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: rgba(255, 255, 255, 0.9);
}

.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th, td {
    padding: 12px 8px;
    text-align: right;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

th {
    background: rgba(0, 210, 255, 0.2);
    font-weight: 600;
    position: sticky;
    top: 0;
}

th:first-child, td:first-child {
    text-align: left;
}

tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.05);
}

tr:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Responsive */
@media (min-width: 480px) {
    .summary-cards {
        grid-template-columns: repeat(3, 1fr);
    }

    .card {
        flex-direction: column;
        text-align: center;
    }

    .card-icon {
        margin-right: 0;
        margin-bottom: 8px;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 768px;
        margin: 0 auto;
        padding: 24px;
    }

    header h1 {
        font-size: 2rem;
    }

    .chart-container canvas {
        max-height: 400px;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* Loading spinner */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #00d2ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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