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

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

:root {
    --bg-primary: #181e2c;
    --bg-secondary: #1f2638;
    --bg-card: #1f2638;
    --accent-solar: #f59e0b;
    --accent-battery: #10b981;
    --accent-grid: #3b82f6;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border: rgba(255, 255, 255, 0.07);
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    background-image:
        radial-gradient(ellipse 80% 50% at 0% 0%, rgba(59,130,246,0.06) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(16,185,129,0.05) 0%, transparent 60%);
    padding: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
}

header {
    margin-bottom: 1rem;
    animation: fadeInDown 0.6s ease-out;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.header-text {
    flex: 1;
}

.logo {
    height: 55px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-solar), var(--accent-battery));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 300;
}

.status-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    animation: fadeIn 0.6s ease-out 0.2s both;
}

.status-item {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
}

.status-item:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.status-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.status-icon.connected {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.1));
    color: var(--accent-battery);
}

.status-icon.time {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.1));
    color: var(--accent-grid);
}

.status-content h3 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 0.25rem;
}

.status-content p {
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Ligne 1 : Consommation (gauche) | Production Solaire (droite) */
.grid-top {
    grid-template-columns: 1fr 1fr;
}

/* Ligne 2 : Maison + Voiture (gauche) | Batterie (droite) */
.grid-bottom-new {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
}

.left-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.left-stack .card {
    flex: 1;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.2rem 1.5rem;
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out both;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--card-accent), transparent);
    opacity: 0.5;
}

.card-consumption {
    --card-accent: var(--accent-grid);
    animation-delay: 0.1s;
}

.card-solar {
    --card-accent: var(--accent-solar);
    animation-delay: 0.2s;
}

.card-house {
    --card-accent: #a855f7;
    animation-delay: 0.3s;
}

.card-car {
    --card-accent: #f97316;
    animation-delay: 0.35s;
}

/* ── Voiture non branchée ── */
.car-disconnected {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    gap: 0.5rem;
    flex: 1;
}

.car-disconnected-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px dashed rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.2);
    margin-bottom: 0.4rem;
}

.car-disconnected-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 0.03em;
}

.car-disconnected-sub {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.18);
}

.card-battery {
    --card-accent: var(--accent-battery);
    animation-delay: 0.4s;
}

/* ══ JAUGE CIRCULAIRE BATTERIE ══ */
.battery-gauge-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.4rem 0 0.3rem;
    flex: 1;
}

.battery-gauge-svg {
    width: 100%;
    max-width: 220px;
    height: auto;
    filter: drop-shadow(0 0 24px rgba(16, 185, 129, 0.3));
}

.gauge-track {
    transition: stroke 0.3s;
}

.gauge-fill {
    transition: stroke-dashoffset 1s ease-out, stroke 0.3s ease;
}

.gauge-soc-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.9rem;
    font-weight: 700;
    fill: var(--text-primary);
}

.gauge-power-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    fill: var(--accent-battery);
}

.gauge-label-text {
    font-family: 'Outfit', sans-serif;
    font-size: 0.65rem;
    font-weight: 500;
    fill: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.house-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.battery-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
    margin-top: 0.6rem;
}

.data-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 0.65rem 0.8rem;
}

.data-item-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.data-item-value {
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.card-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
}

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

.metric-value {
    font-size: 2.2rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 0.3rem;
    color: var(--card-accent);
    display: inline-block;
}

.metric-unit-inline {
    font-size: 2.2rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--card-accent);
}

.metric-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.progress-bar {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    height: 12px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--card-accent), rgba(255, 255, 255, 0.6));
    transition: width 1s ease-out;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

.metric-unit {
    font-size: 1.5rem;
    font-weight: 400;
    opacity: 0.7;
}

.metric-label-unit {
    display: none;
}

.status-item-small {
    flex: 0 0 auto;
    min-width: 160px;
    max-width: 180px;
}

/* ── Météo ── */
.weather-item {
    flex: 0 0 auto;
    min-width: 160px;
    max-width: 200px;
}

.weather-icon-wrap {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(245, 158, 11, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.weather-emoji {
    font-size: 1.4rem;
    line-height: 1;
}

.weather-item .status-content h3 {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 2px;
}

.weather-item #weatherTemp {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.global-toggle-btn {
    background: none;
    border: none;
    color: var(--accent-grid);
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: opacity 0.2s;
    text-align: left;
}

.global-toggle-btn:hover {
    opacity: 0.7;
}

.toggle-icon {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(99, 102, 241, 0.1));
    color: #818cf8;
}

.card-details {
    overflow: hidden;
    max-height: 600px;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    opacity: 1;
}

.card-details.hidden {
    max-height: 0;
    opacity: 0;
}

.card-header-power {
    margin-left: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.simple-phase-list {
    margin-top: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.simple-phase-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.simple-phase-row:hover {
    background: rgba(255, 255, 255, 0.08);
}

.phase-table {
    margin-top: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.phase-row {
    display: grid;
    grid-template-columns: 2rem 1fr 1fr 1fr;
    gap: 0.5rem;
    align-items: center;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
}

.phase-row:not(.phase-header) {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: background 0.2s;
}

.phase-row:not(.phase-header):hover {
    background: rgba(255, 255, 255, 0.08);
}

.phase-header {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    padding-left: 0.8rem;
    letter-spacing: 0.04em;
}

.phase-label {
    font-weight: 600;
    color: var(--card-accent);
    font-size: 0.85rem;
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

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

/* Responsive */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

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

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .logo {
        height: 60px;
        align-self: center;
    }
    
    .status-bar {
        flex-direction: column;
    }
    
    .grid-top {
        grid-template-columns: 1fr;
    }

    .grid-bottom-new {
        grid-template-columns: 1fr;
    }
    
    .metric-value {
        font-size: 2.5rem;
    }
}

/* ══ NAV (dashboard) ══ */
.main-nav {
    position: sticky; top: 0; z-index: 100;
    background: rgba(24,30,44,0.95);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255,255,255,0.07);
    padding: 0;
    display: flex; align-items: center;
    height: 52px;
    margin-bottom: 0;
}
.nav-inner {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    height: 100%;
}
.nav-logo { display:flex; align-items:center; gap:.75rem; text-decoration:none; margin-right:2.5rem; }
.nav-logo-img { height:44px; width:auto; object-fit:contain; }
.nav-logo-text { font-size:1.1rem; font-weight:700; background:linear-gradient(135deg,#f59e0b,#10b981); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
.nav-links { display:flex; align-items:stretch; height:100%; }
.nav-link { display:flex; align-items:center; gap:.5rem; padding:0 1.25rem; text-decoration:none; color:#94a3b8; font-family:Outfit,sans-serif; font-size:.9rem; font-weight:500; border-bottom:2px solid transparent; transition:all .2s; }
.nav-link:hover { color:#f8fafc; }
.nav-link.active { color:#3b82f6; border-bottom-color:#3b82f6; }
body { padding-top: 0 !important; }
.container { }
