/* Base styles */
:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-solar: #fbbf24;
    --accent-battery: #22c55e;
    --accent-grid: #3b82f6;
    --accent-home: #f97316;
    --accent-negative: #ef4444;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

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

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* Hero / Landing page */
.hero {
    text-align: center;
    padding: 60px 20px;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.hero .subtitle {
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin-bottom: 40px;
}

.card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 40px;
    max-width: 500px;
    margin: 0 auto;
}

.card h2 {
    margin-bottom: 20px;
}

.card ul {
    text-align: left;
    list-style: none;
    margin: 20px 0;
}

.card ul li {
    padding: 8px 0;
    color: var(--text-secondary);
}

.card ul li::before {
    content: "✓ ";
    color: var(--accent-battery);
}

.footer-note {
    margin-top: 40px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Dashboard header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.dashboard-header h1 {
    font-size: 1.8rem;
}

/* Status bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 0.9rem;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-indicator::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-solar);
    animation: pulse 2s infinite;
}

.status-indicator.connected::before {
    background: var(--accent-battery);
    animation: none;
}

.status-indicator.error::before {
    background: var(--accent-negative);
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

.energy-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    border: 2px solid transparent;
    transition: border-color 0.3s;
}

.energy-card.solar { border-color: var(--accent-solar); }
.energy-card.battery { border-color: var(--accent-battery); }
.energy-card.grid { border-color: var(--accent-grid); }
.energy-card.home { border-color: var(--accent-home); }

.card-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.energy-card.solar .card-icon { color: var(--accent-solar); }
.energy-card.battery .card-icon { color: var(--accent-battery); }
.energy-card.grid .card-icon { color: var(--accent-grid); }
.energy-card.home .card-icon { color: var(--accent-home); }

.card-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

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

.card-secondary {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

/* Energy flow diagram */
.energy-flow {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 30px;
}

.flow-diagram {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.flow-source, .flow-center, .flow-destinations {
    text-align: center;
}

.flow-source, .flow-dest {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 12px;
    min-width: 100px;
}

.flow-destinations {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.solar-source {
    border: 2px solid var(--accent-solar);
}

.flow-battery {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 50%;
    border: 3px solid var(--accent-battery);
}

.home-dest {
    border: 2px solid var(--accent-home);
}

.grid-dest {
    border: 2px solid var(--accent-grid);
}

/* Responsive */
@media (max-width: 600px) {
    .hero h1 {
        font-size: 1.8rem;
    }

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

    .card-value {
        font-size: 1.4rem;
    }
}
