/**
 * Tesla Dashboard - Modern Frontend Design
 * Premium glassmorphism with vibrant gradients
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
    /* Dark moderne */
    --bg-primary: #0a0713;
    --bg-secondary: #110b1a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-glass: rgba(255, 255, 255, 0.05);

    /* Gradients Tesla */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-tesla: linear-gradient(135deg, #3b82f6 0%, #2dd4bf 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
    --gradient-accent: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);

    /* Glass effects */
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);

    /* Text */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);

    /* Spacing */
    --radius: 20px;
    --radius-lg: 24px;
    --spacing: 24px;
}

/* ═══════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════ */

.tesla-frontend-dashboard {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    background-image:
        radial-gradient(at 0% 0%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
        radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.1) 0%, transparent 50%);
    min-height: 100vh;
    padding: clamp(20px, 5vw, 60px) clamp(16px, 4vw, 40px);
    color: var(--text-primary);
    position: relative;
    overflow-x: hidden;
}

.tesla-frontend-dashboard * {
    box-sizing: border-box;
}

/* Animated background glow */
.tesla-frontend-dashboard::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.03) 0%, transparent 50%);
    animation: rotate 30s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.tesla-frontend-dashboard>* {
    position: relative;
    z-index: 1;
}

/* ═══════════════════════════════════════════
   VEHICLE HEADER - Hero Style
   ═══════════════════════════════════════════ */

.tesla-vehicle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 40px;
    padding: 30px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    position: relative;
    overflow: hidden;
}

.tesla-vehicle-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-tesla);
}

.tesla-vehicle-header h2 {
    margin: 0;
    font-size: clamp(24px, 4vw, 36px);
    font-weight: 900;
    background: var(--gradient-tesla);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
}

/* ═══════════════════════════════════════════
   VEHICLE HEADER - Hero Style
   ═══════════════════════════════════════════ */

/* ═══════════════════════════════════════════
   VEHICLE HEADER - Hero Style
   ═══════════════════════════════════════════ */

.tesla-vehicle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    /* Allow wrap for small screens */
    gap: 20px;
    margin-bottom: 40px;
    padding: 30px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    position: relative;
    overflow: hidden;
}

.tesla-vehicle-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-tesla);
}

.vehicle-info {
    display: flex;
    flex-direction: column;
    /* Default: Stacked (Mobile) */
    align-items: flex-start;
    gap: 8px;
    flex: 1;
    /* Take available space */
}

/* Desktop: Row layout for info */
@media (min-width: 768px) {
    .vehicle-info {
        flex-direction: row;
        align-items: baseline;
        gap: 16px;
    }
}

.tesla-vehicle-header h2 {
    margin: 0;
    font-size: clamp(24px, 4vw, 36px);
    font-weight: 900;
    background: var(--gradient-tesla);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
    line-height: 1.2;
}

.vehicle-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
}

/* Base Location Style (Desktop) */
.header-location {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 10px;
    border-radius: 8px;
    line-height: 1;
}

.header-location .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile Overrides for Location */
@media (max-width: 767px) {
    .header-location {
        background: transparent;
        /* No border/bg */
        padding: 0;
        margin-left: 0 !important;
        display: block;
        /* Align with text */
        width: 100%;
        /* Force new line if needed or just flow */
        margin-top: 4px;
    }

    .header-location .dashicons {
        display: none;
        /* Hide icon */
    }
}

.vehicle-state {
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    /* Ensure it doesn't wrap awkwardly on desktop */
    white-space: nowrap;
}

/* ═══════════════════════════════════════════
   NAVIGATION TABS - Pills Modern
   ═══════════════════════════════════════════ */

.tesla-tabs-container {
    position: relative;
    margin-bottom: 40px;
    overflow: hidden;
    /* Contain effect */
    border-radius: var(--radius);
}

.tesla-tabs {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tesla-tabs::-webkit-scrollbar {
    display: none;
}

/* Mobile Scan Effect (Luminous light left->right) */
@media (max-width: 767px) {
    .tesla-tabs-container::after {
        content: '';
        position: absolute;
        bottom: 0px;
        left: 0;
        height: 2px;
        /* Thin line at bottom */
        width: 100%;
        background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.8), transparent);
        transform: translateX(-100%);
        animation: scan-light 3s ease-in-out infinite;
        pointer-events: none;
        z-index: 10;
    }

    @keyframes scan-light {
        0% {
            transform: translateX(-100%);
            opacity: 0;
        }

        20% {
            opacity: 1;
        }

        80% {
            opacity: 1;
        }

        100% {
            transform: translateX(100%);
            opacity: 0;
        }
    }
}

.tesla-tab {
    flex: 1 0 auto;
    /* Allow tabs to shrink but default to auto */
    min-width: 100px;
    /* Minimum width for touch targets */
    text-align: center;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    position: relative;
    border: 1px solid transparent;
}

.tesla-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
}

.tesla-tab.active {
    background: var(--gradient-tesla);
    color: white;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Tab content centering */
.tesla-tab-content {
    max-width: 1600px;
    margin: 0 auto;
}

/* ═══════════════════════════════════════════
   GRID LAYOUT - Responsive
   ═══════════════════════════════════════════ */

/* Grid Logic */
.tesla-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .tesla-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .tesla-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Force 3 columns for the main dashboard specific grid if screen allows */
@media (min-width: 900px) {
    .dashboard-grid-3 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* Force 4 columns for large screens as requested */
@media (min-width: 1400px) {
    .dashboard-grid-4 {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}


/* Removed 3 and 4 column layouts to keep content centered */

/* ═══════════════════════════════════════════
   GLASS CARDS - Glassmorphism
   ═══════════════════════════════════════════ */

.tesla-widget {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.6s ease-out backwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tesla-widget:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

.tesla-widget-stats {
    grid-column: span 2;
}

.widget-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.widget-header h3 {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
}

.widget-badge {
    padding: 4px 12px;
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.widget-content {
    padding: 24px;
}

/* ═══════════════════════════════════════════
   BATTERY DISPLAY - Circular Gauge 3D
   ═══════════════════════════════════════════ */

.battery-display {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 30px 0;
    margin-bottom: 24px;
}

.battery-level {
    position: relative;
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: conic-gradient(from 0deg,
            #3b82f6 0%,
            #2dd4bf calc(var(--battery-pct, 50) * 3.6deg),
            rgba(255, 255, 255, 0.05) calc(var(--battery-pct, 50) * 3.6deg));
    box-shadow:
        0 0 40px rgba(59, 130, 246, 0.4),
        inset 0 0 20px rgba(0, 0, 0, 0.3);
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.battery-level::before {
    content: '';
    position: absolute;
    width: 130px;
    height: 130px;
    background: var(--bg-primary);
    border-radius: 50%;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

/* ═══════════════════════════════════════════
   BATTERY DISPLAY - Simplified Clean Design
   ═══════════════════════════════════════════ */

.battery-card {
    grid-column: span 1;
}

.battery-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 30px 20px !important;
}

.battery-gauge {
    position: relative;
    width: 140px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: conic-gradient(from 0deg,
            #3b82f6 0%,
            #2dd4bf calc(var(--battery-pct, 50) * 3.6deg),
            rgba(255, 255, 255, 0.05) calc(var(--battery-pct, 50) * 3.6deg));
    box-shadow:
        0 0 40px rgba(59, 130, 246, 0.4),
        inset 0 0 20px rgba(0, 0, 0, 0.3);
    animation: pulse 3s ease-in-out infinite;
}

.battery-gauge::before {
    content: '';
    position: absolute;
    width: 110px;
    height: 110px;
    background: var(--bg-primary);
    border-radius: 50%;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.battery-percentage {
    position: relative;
    z-index: 1;
    font-size: 36px;
    font-weight: 900;
    background: var(--gradient-tesla);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 8px rgba(59, 130, 246, 0.5));
}

.range-info {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.range-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}

.range-row:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.range-type {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.range-km {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
}

/* ═══════════════════════════════════════════
   STATUS & CHARGE COMPACT CARD
   ═══════════════════════════════════════════ */

.status-charge-card {
    grid-column: span 1;
}

.charge-status-compact {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    margin-bottom: 16px;
}

.charge-status-compact.charging {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(59, 130, 246, 0.15));
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.2);
    animation: glow 2s ease-in-out infinite;
}

.charge-icon {
    font-size: 20px;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.charge-text {
    flex: 1;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.charge-limit {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.status-compact {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.status-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.status-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}

.status-label:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.temp-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: 10px;
    border: 1px solid var(--glass-border);
}

.temp-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.temp-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}



.range-value {
    display: block;
    font-size: 32px;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1;
}

.range-item.predicted .range-value {
    background: var(--gradient-tesla);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}



/* ═══════════════════════════════════════════
   STATS CARDS - Premium Design
   ═══════════════════════════════════════════ */

.tesla-widget-stats {
    grid-column: 1 / -1;
    /* FULL WIDTH ON ALL SCREENS */
}

.stats-grid {
    display: grid;
    gap: 16px;
}

.stats-grid-large {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.stat-card {
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-tesla);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
}

.stat-value {
    font-size: 28px;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1;
    display: block;
}

.stat-unit {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: 4px;
}

.stat-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-top: 8px;
    font-weight: 600;
}

/* ═══════════════════════════════════════════
   CHARGE STATUS - Gradient Badge
   ═══════════════════════════════════════════ */

.charge-status {
    text-align: center;
    padding: 16px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
    border: 1px solid var(--glass-border);
    background: var(--bg-secondary);
}

.charge-status.charging {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(59, 130, 246, 0.2));
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.2);
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
    }

    50% {
        box-shadow: 0 0 40px rgba(16, 185, 129, 0.4);
    }
}

.charge-limit-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.limit-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.limit-value {
    font-size: 24px;
    font-weight: 900;
    background: var(--gradient-tesla);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ═══════════════════════════════════════════
   SYNC BUTTON - Gradient Animated
   ═══════════════════════════════════════════ */

.tesla-sync-section {
    text-align: center;
    margin-top: 40px;
    padding-top: 40px;
    border-top: 1px solid var(--glass-border);
}

.tesla-sync-button {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 32px;
    background: var(--gradient-tesla);
    color: white;
    border: none;
    border-radius: 16px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
    position: relative;
    overflow: hidden;
}

.tesla-sync-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.tesla-sync-button:hover::before {
    left: 100%;
}

.tesla-sync-button:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 12px 32px rgba(59, 130, 246, 0.5);
}

.tesla-sync-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.tesla-sync-button.syncing {
    background: var(--gradient-success);
    animation: pulse 1.5s ease-in-out infinite;
}

.sync-icon {
    font-size: 18px;
    display: inline-block;
}

.tesla-last-sync {
    margin-top: 16px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ═══════════════════════════════════════════
   TABLES - Modern Design
   ═══════════════════════════════════════════ */

.data-table-wrapper {
    overflow-x: auto;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.tesla-data-table {
    width: 100%;
    border-collapse: collapse;
}

.tesla-data-table thead {
    background: var(--bg-secondary);
}

.tesla-data-table th {
    padding: 16px 20px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--glass-border);
}

.tesla-data-table tbody tr {
    border-bottom: 1px solid var(--glass-border);
    transition: all 0.2s ease;
}

.tesla-data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.tesla-data-table td {
    padding: 16px 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.type-badge,
.consumption-badge {
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    display: inline-block;
}

.type-badge.home {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.type-badge.supercharger {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.type-badge.public {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.consumption-badge.good {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.consumption-badge.bad {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* ═══════════════════════════════════════════
   RESPONSIVE (Obsolète - voir fin du fichier)
   ═══════════════════════════════════════════ */

/* @media (max-width: 640px) { ... } REMOVED - Replaced by new responsive section at bottom */


/* ═══════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════ */

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.no-data {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ═══════════════════════════════════════════
   CHARGE CARDS COMPACT - Single Line Design
   ═══════════════════════════════════════════ */

.charges-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.charge-card-compact {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.charge-card-compact::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, #10b981, #3b82f6);
    border-radius: 3px 0 0 3px;
}

.charge-card-compact:hover {
    background: rgba(255, 255, 255, 0.03);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* Header Line */
.charge-header-line {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.charge-date {
    font-size: 16px;
    font-weight: 400;
    color: var(--text-primary);
    white-space: nowrap;
}

.charge-time {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    white-space: nowrap;
}

.charge-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    white-space: nowrap;
}

.charge-type-badge.supercharger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.2));
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.charge-type-badge.home {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.2));
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.charge-type-badge.public {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(37, 99, 235, 0.2));
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.charge-type-badge.destination {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(139, 92, 246, 0.2));
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.charge-type-badge.other {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
}

.charge-location {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
    flex: 1;
}

/* Stats Grid */
.charge-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
}

.charge-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px 8px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.charge-stat:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--glass-border);
}

.charge-stat.highlight {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(45, 212, 191, 0.1));
    border-color: rgba(16, 185, 129, 0.2);
}

.charge-stat.cost {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.1), rgba(202, 138, 4, 0.1));
    border-color: rgba(234, 179, 8, 0.2);
}

.charge-stat.battery {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
}

.charge-stat .stat-icon {
    font-size: 18px;
    margin-bottom: 6px;
}

.charge-stat .stat-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.charge-stat .stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 640px) {
    .charge-card-compact {
        padding: 14px;
    }

    .charge-header-line {
        gap: 12px;
    }

    .charge-stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .charge-stat .stat-value {
        font-size: 12px;
    }
}

/* ═══════════════════════════════════════════
   TRIP CARDS COMPACT - Single Line Design
   ═══════════════════════════════════════════ */

.trips-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.trip-card-compact {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.trip-card-compact::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--gradient-tesla);
    border-radius: 3px 0 0 3px;
}

.trip-card-compact:hover {
    background: rgba(255, 255, 255, 0.03);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* Header Line: Date | Time | Route on same line */
.trip-header-line {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.trip-date {
    font-size: 16px;
    font-weight: 400;
    color: var(--text-primary);
    white-space: nowrap;
}

.trip-time {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    white-space: nowrap;
}

.trip-route-inline {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.trip-location {
    display: inline;
}

.trip-street {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
}

.trip-city {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}


.route-arrow {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0 4px;
}

/* Badge préconditionnement batterie */
.precond-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 12px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(234, 88, 12, 0.2));
    color: #fb923c;
    border: 1px solid rgba(249, 115, 22, 0.3);
    border-radius: 6px;
    white-space: nowrap;
}



/* Route */
.trip-route {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
}

.route-point {
    display: flex;
    align-items: center;
    gap: 12px;
}

.route-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.route-dot.start {
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.route-dot.end {
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.route-line-v {
    width: 2px;
    height: 16px;
    background: linear-gradient(180deg, #10b981, #ef4444);
    margin-left: 5px;
    border-radius: 1px;
}

.route-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Stats Grid */
.trip-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
}

.trip-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px 8px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.trip-stat:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--glass-border);
}

.trip-stat.highlight {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(45, 212, 191, 0.1));
    border-color: rgba(59, 130, 246, 0.2);
}

.trip-stat.battery {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
}

.trip-stat .stat-icon {
    font-size: 18px;
    margin-bottom: 6px;
}

.trip-stat .stat-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.trip-stat .stat-value.good {
    color: #10b981;
}

.trip-stat .stat-value.bad {
    color: #ef4444;
}

.trip-stat .stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 640px) {
    .trip-card-full {
        padding: 16px;
    }

    .trip-stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .trip-stat .stat-value {
        font-size: 13px;
    }
}

/* ═══════════════════════════════════════════
   TRIP MODAL (kept for backwards compatibility)
   ═══════════════════════════════════════════ */

.tesla-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;

    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.tesla-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
}

.tesla-modal-content {
    position: relative;
    z-index: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.modal-title {
    margin: 0 0 24px 0;
    font-size: 20px;
    font-weight: 800;
    background: var(--gradient-tesla);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Modal Route */
.modal-route {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
    position: relative;
}

.route-point {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

.route-icon {
    font-size: 16px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.route-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.route-line {
    width: 2px;
    height: 30px;
    background: linear-gradient(180deg, #10b981, #ef4444);
    margin-left: 7px;
    border-radius: 1px;
}

/* Modal Stats Grid */
.modal-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.modal-stat {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    border: 1px solid var(--glass-border);
    transition: all 0.2s ease;
}

.modal-stat:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}

.modal-stat.highlight {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(45, 212, 191, 0.15));
    border-color: rgba(59, 130, 246, 0.3);
}

.modal-stat .stat-icon {
    font-size: 20px;
    display: block;
    margin-bottom: 8px;
}

.modal-stat .stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
    margin-top: 0;
}

.modal-stat .stat-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-stat .stat-value.large {
    font-size: 20px;
    font-weight: 800;
}

.modal-stat .stat-value.good {
    color: #10b981;
}

.modal-stat .stat-value.bad {
    color: #ef4444;
}

/* Battery Section */
.modal-battery-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--glass-border);
}

.modal-battery-section h4 {
    margin: 0 0 16px 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
}

.battery-comparison {
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 16px;
}

.battery-start,
.battery-end,
.battery-used {
    text-align: center;
}

.battery-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.battery-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
}

.battery-arrow {
    font-size: 18px;
    color: var(--text-muted);
}

/* Responsive Modal */
@media (max-width: 480px) {
    .tesla-modal-content {
        padding: 20px;
        margin: 10px;
    }

    .modal-stats-grid {
        grid-template-columns: 1fr;
    }

    .battery-comparison {
        flex-wrap: wrap;
    }
}

/* ═══════════════════════════════════════════
   STATISTICS HERO CARD
   ═══════════════════════════════════════════ */

.stats-hero-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Background glow effect */
.stats-hero-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(34, 197, 94, 0.1) 0%, transparent 70%);
    filter: blur(40px);
    z-index: 0;
}

.hero-icon {
    width: 60px;
    height: 60px;
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    z-index: 1;
}

.hero-content {
    flex: 1;
    z-index: 1;
}

.hero-label {
    display: block;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.hero-value {
    display: block;
    font-size: 32px;
    font-weight: 800;
    color: #22c55e;
    margin-bottom: 12px;
}

.hero-progress-container {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    position: relative;
    margin-bottom: 10px;
    overflow: hidden;
}

.hero-progress-bar {
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 4px;
}

.hero-progress-bar.elec {
    background: #22c55e;
    z-index: 2;
}

.hero-progress-bar.gas {
    background: rgba(239, 68, 68, 0.3);
    z-index: 1;
}

.hero-legend {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-secondary);
}

.hero-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hero-legend .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.hero-legend .dot.elec {
    background: #22c55e;
}

.hero-legend .dot.gas {
    background: #ef4444;
}

.hero-badge {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    font-weight: 800;
    font-size: 16px;
    padding: 8px 16px;
    border-radius: 12px;
    z-index: 1;
}

/* ═══════════════════════════════════════════
   EMPTY STATES
   ═══════════════════════════════════════════ */

.empty-state-stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px dashed var(--glass-border);
}

.empty-icon {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-text strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.empty-text span {
    color: var(--text-muted);
    font-size: 13px;
}

/* Fix Chart Container Height */
.chart-container {
    height: 250px;
    width: 100%;
    position: relative;
}

.chart-container.temp-chart {
    height: 200px;
}

/* Responsive Stats */
@media (max-width: 640px) {
    .stats-hero-card {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }

    .hero-progress-container {
        width: 100%;
    }

    .hero-legend {
        justify-content: center;
    }
}

/* ═══════════════════════════════════════════
   PREMIUM SAVINGS DASHBOARD
   ═══════════════════════════════════════════ */

.premium-savings-dashboard {
    background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.03), transparent 70%),
        linear-gradient(135deg, rgba(20, 20, 20, 0.8), rgba(10, 10, 10, 0.95));
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 32px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* Dynamic Glow */
.premium-savings-dashboard::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-color) 0%, transparent 60%);
    opacity: 0.08;
    filter: blur(60px);
    z-index: 0;
    pointer-events: none;
}

.savings-content,
.savings-main,
.savings-breakdown {
    position: relative;
    z-index: 1;
}

/* Main Amount Section */
.savings-main {
    text-align: center;
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.savings-subtitle {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}

.savings-big-number {
    display: inline-flex;
    align-items: flex-start;
    line-height: 1;
    margin-bottom: 12px;
}

.savings-big-number .currency {
    font-size: 32px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 12px;
    margin-right: 4px;
}

.savings-big-number .amount {
    font-size: 72px;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 30%, var(--text-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -2px;
}

.savings-percent-badge {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 14px;
    color: var(--accent-color);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Breakdown Grid */
.savings-breakdown {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    padding: 20px 24px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.breakdown-item {
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-circle {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: rgba(255, 255, 255, 0.05);
}

.breakdown-item.elec .icon-circle {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.breakdown-item.gas .icon-circle {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.breakdown-info {
    display: flex;
    flex-direction: column;
}

.breakdown-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.breakdown-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.breakdown-sub {
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.7;
}

.breakdown-vs {
    font-size: 12px;
    font-weight: 800;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 10px;
    border-radius: 8px;
    text-transform: uppercase;
}

/* Responsive Premium Stats */
@media (max-width: 640px) {
    .savings-breakdown {
        flex-direction: column;
        gap: 20px;
        align-items: stretch;
    }

    .breakdown-vs {
        align-self: center;
        padding: 4px 12px;
    }

    .savings-big-number .amount {
        font-size: 56px;
    }
}

/* Full Width Utility */
.tesla-grid .span-full {
    grid-column: 1 / -1 !important;
    width: 100%;
    box-sizing: border-box;
}

/* ════════════ CIRCULAR GAUGE (RESTORED) ════════════ */
.circular-gauge {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto;
}

.circular-chart {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    max-height: 100%;
}

.circle-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 2.5;
}

.circle {
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    animation: progress 1s ease-out forwards;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

.gauge-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.gauge-text .percent {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.gauge-text .km {
    font-size: 13px;
    color: var(--text-muted);
}

.gauge-text .power {
    font-size: 18px;
    font-weight: 600;
    color: #22c55e;
}

.gauge-text .limit-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.gauge-text .limit-val {
    font-size: 24px;
    color: var(--text-secondary);
}

@keyframes progress {
    0% {
        stroke-dasharray: 0, 100;
    }
}

/* Centered Content Helper */
.centered-content {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 180px;
}

@media (min-width: 900px) {
    .stats-dashboard-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    /* Row 1: Trends (2/3) + Savings (1/3) */
    .widget-trends {
        grid-column: span 2;
    }

    .widget-savings {
        grid-column: span 1;
    }

    /* Row 2: Efficiency (1/3) + Badges (2/3) */
    .widget-efficiency {
        grid-column: span 1;
    }

    .widget-badges {
        grid-column: span 2;
    }
}

.chart-container {
    height: 300px;
    /* Slight increase for better visibility */
}

/* ════════════ BADGE TOOLTIPS ════════════ */
.badge-item {
    position: relative;
}

/* Tooltip Body */
[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 10, 11, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e4e4e7;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.4;
    width: max-content;
    max-width: 260px;
    white-space: normal;
    text-align: center;
    z-index: 100;
    margin-bottom: 8px;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    animation: tooltipFade 0.2s ease-out;
}

/* Tooltip Arrow */
[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(10, 10, 11, 0.95);
    margin-bottom: -4px;
    z-index: 100;
}

@keyframes tooltipFade {
    from {
        opacity: 0;
        transform: translate(-50%, 5px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* ════════════ STATS GRID (FIX) ════════════ */
.stats-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, 1fr);
    /* Default mobile/tablet: 2x2 */
}

@media (min-width: 1024px) {
    .stats-grid.stats-grid-large {
        grid-template-columns: repeat(4, 1fr);
        /* Desktop: 1 Line */
    }
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 16px 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-unit {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Smart Sleep Badge */
.vehicle-state.smart-asleep {
    background: rgba(147, 51, 234, 0.15);
    /* Purple tint for Smart Sleep */
    color: #a855f7;
    border: 1px solid rgba(147, 51, 234, 0.3);
}

/* ═══════════════════════════════════════════
   MOBILE RESPONSIVE - TABLET (768px)
   ═══════════════════════════════════════════ */

@media (max-width: 768px) {

    /* Base container */
    .tesla-frontend-dashboard {
        padding: 16px 12px;
    }

    /* Header véhicule */
    .tesla-vehicle-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
        gap: 16px;
    }

    .tesla-vehicle-header h2 {
        font-size: 22px;
    }

    .vehicle-meta {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Tabs - scroll horizontal */
    .tesla-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 8px;
        gap: 6px;
    }

    .tesla-tabs::-webkit-scrollbar {
        display: none;
    }

    .tesla-tab {
        flex-shrink: 0;
        padding: 10px 14px;
        font-size: 13px;
        white-space: nowrap;
    }

    /* Batterie principale */
    .battery-level {
        width: 100px;
        height: 100px;
    }

    .battery-pct {
        font-size: 32px;
    }

    /* Grille statuts - 2 colonnes */
    .status-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .status-card {
        padding: 14px;
    }

    .status-value {
        font-size: 18px;
    }

    /* Trip Header - vertical */
    .trip-header-line {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .trip-route-inline {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        width: 100%;
    }

    .route-arrow {
        display: none;
    }

    .trip-location::before {
        content: '→ ';
        color: var(--text-muted);
    }

    .trip-location:first-child::before {
        content: '📍 ';
    }

    /* Trip Stats Grid - 3 colonnes */
    .trip-stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .trip-stat {
        padding: 10px 6px;
    }

    .trip-stat .stat-value {
        font-size: 13px;
    }

    .trip-stat .stat-label {
        font-size: 9px;
    }

    /* Charge Stats Grid */
    .charge-stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .charge-stat {
        padding: 10px 6px;
    }

    /* Stats overview */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-value {
        font-size: 20px;
    }

    /* Modals - presque fullscreen */
    .tesla-modal-content {
        max-width: 95%;
        padding: 20px;
        margin: 10px;
        max-height: 85vh;
    }

    .modal-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    /* Santé batterie - texte wrap */
    .status-item,
    .status-label,
    .status-value,
    .info-item,
    .info-label,
    .info-value {
        white-space: normal;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .status-label,
    .info-label {
        font-size: 11px;
    }

    .status-value,
    .info-value {
        font-size: 13px;
    }

    /* Statistiques - centrage */
    .stats-row,
    .stats-header,
    .summary-row {
        justify-content: center;
        text-align: center;
    }

    .stats-grid {
        justify-items: center;
    }
}

/* ═══════════════════════════════════════════
   MOBILE RESPONSIVE - PHONE (480px)
   ═══════════════════════════════════════════ */

@media (max-width: 480px) {

    /* Base */
    .tesla-frontend-dashboard {
        padding: 12px 8px;
    }

    /* Header */
    .tesla-vehicle-header {
        padding: 16px;
        margin-bottom: 20px;
    }

    .tesla-vehicle-header h2 {
        font-size: 18px;
    }

    .vehicle-meta span {
        font-size: 11px;
    }

    /* Tabs - plus petits */
    .tesla-tab {
        padding: 8px 12px;
        font-size: 12px;
    }

    /* Batterie */
    .battery-level {
        width: 90px;
        height: 90px;
    }

    .battery-pct {
        font-size: 28px;
    }

    /* Grille statuts - 1 colonne sur très petit écran */
    .status-grid {
        grid-template-columns: 1fr;
    }

    /* Trip Cards - COMPACT pour voir plusieurs */
    .trip-card-compact,
    .charge-card-compact {
        padding: 10px 12px;
    }

    .trip-header-line {
        margin-bottom: 8px;
        gap: 8px;
    }

    .trip-stats-grid,
    .charge-stats-grid {
        gap: 4px;
    }

    .trip-stat,
    .charge-stat {
        padding: 6px 4px;
    }

    .trip-date,
    .charge-date {
        font-size: 14px;
    }

    .trip-time,
    .charge-time {
        font-size: 11px;
    }

    /* Adresses */
    .trip-street {
        font-size: 11px;
    }

    .trip-city {
        font-size: 14px;
    }

    /* Trip Stats - 2 colonnes pour petits écrans */
    .trip-stats-grid,
    .charge-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .trip-stat .stat-icon,
    .charge-stat .stat-icon {
        font-size: 16px;
    }

    .trip-stat .stat-value,
    .charge-stat .stat-value {
        font-size: 12px;
    }

    .trip-stat .stat-label,
    .charge-stat .stat-label {
        font-size: 8px;
    }

    /* Stats overview */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-value {
        font-size: 18px;
    }

    .stat-label {
        font-size: 10px;
    }

    /* Modal - fullscreen */
    .tesla-modal {
        padding: 8px;
    }

    .tesla-modal-content {
        max-width: 100%;
        max-height: 90vh;
        border-radius: 16px;
        padding: 16px;
    }

    .modal-title {
        font-size: 18px;
    }

    .modal-stats-grid {
        grid-template-columns: 1fr;
    }

    /* Section headers */
    .dashboard-section h3,
    .tesla-section-title {
        font-size: 16px;
    }

    /* Buttons */
    .tesla-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* ═══════════════════════════════════════════
   TOUCH IMPROVEMENTS
   ═══════════════════════════════════════════ */

@media (hover: none) and (pointer: coarse) {

    /* Plus grand touch targets */
    .tesla-tab {
        min-height: 44px;
    }

    .trip-card-compact,
    .charge-card-compact {
        cursor: default;
    }

    /* Remove hover effects on touch */
    .trip-card-compact:hover,
    .charge-card-compact:hover,
    .status-card:hover {
        transform: none;
        box-shadow: none;
    }
}

/* ═══════════════════════════════════════════
   FIXED RESPONSIVE STYLES (Enforced)
   ═══════════════════════════════════════════ */

@media (max-width: 768px) {

    /* Base container - Force padding */
    .tesla-frontend-dashboard {
        padding: 10px 8px !important;
    }

    /* Header véhicule */
    .tesla-frontend-dashboard .tesla-vehicle-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 16px !important;
        gap: 12px !important;
    }

    .tesla-frontend-dashboard .tesla-vehicle-header h2 {
        font-size: 20px !important;
    }

    /* Tabs - scroll horizontal forcé */
    .tesla-frontend-dashboard .tesla-tabs {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 8px 4px !important;
        gap: 8px !important;
        justify-content: flex-start !important;
    }

    .tesla-frontend-dashboard .tesla-tab {
        flex: 0 0 auto !important;
        /* Ne pas écraser */
        padding: 10px 16px !important;
        font-size: 13px !important;
        white-space: nowrap !important;
    }

    /* Grille statuts - 2 colonnes forcées */
    .tesla-frontend-dashboard .status-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    /* Trip & Charge Cards - COMPACT */
    .tesla-frontend-dashboard .trip-card-compact,
    .tesla-frontend-dashboard .charge-card-compact {
        padding: 10px !important;
        margin-bottom: 8px !important;
    }

    /* Header ligne (Date | Heure) */
    .tesla-frontend-dashboard .trip-header-line,
    .tesla-frontend-dashboard .charge-header-line {
        flex-wrap: wrap !important;
        gap: 6px !important;
        margin-bottom: 8px !important;
    }

    .tesla-frontend-dashboard .trip-date,
    .tesla-frontend-dashboard .charge-date {
        font-size: 13px !important;
        font-weight: 700 !important;
    }

    .tesla-frontend-dashboard .trip-time,
    .tesla-frontend-dashboard .charge-time {
        font-size: 11px !important;
    }

    /* Route sur nouvelle ligne pour clarté */
    .tesla-frontend-dashboard .trip-route-inline {
        width: 100% !important;
        margin-top: 4px !important;
        padding-top: 4px !important;
        border-top: 1px dashed var(--glass-border) !important;
    }

    .tesla-frontend-dashboard .trip-location {
        font-size: 11px !important;
        white-space: normal !important;
        /* Permettre le retour à la ligne */
    }

    /* Grille stats interne (conso, durée, etc) - COMPACTE */
    .tesla-frontend-dashboard .trip-stats-grid,
    .tesla-frontend-dashboard .charge-stats-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 4px !important;
    }

    .tesla-frontend-dashboard .trip-stat,
    .tesla-frontend-dashboard .charge-stat {
        padding: 6px 2px !important;
        text-align: center !important;
    }

    .tesla-frontend-dashboard .trip-stat .stat-label,
    .tesla-frontend-dashboard .charge-stat .stat-label {
        font-size: 9px !important;
    }

    .tesla-frontend-dashboard .trip-stat .stat-value,
    .tesla-frontend-dashboard .charge-stat .stat-value {
        font-size: 12px !important;
    }

    /* Santé batterie - CORRECTIF TEXTE COUPÉ */
    .tesla-frontend-dashboard .health-main,
    .tesla-frontend-dashboard .health-stats,
    .tesla-frontend-dashboard .health-stat,
    .tesla-frontend-dashboard .status-item,
    .tesla-frontend-dashboard .info-item {
        width: 100% !important;
        white-space: normal !important;
    }

    .tesla-frontend-dashboard .status-label,
    .tesla-frontend-dashboard .info-label,
    .tesla-frontend-dashboard .health-label {
        white-space: normal !important;
        overflow-wrap: break-word !important;
        word-break: break-word !important;
        font-size: 11px !important;
        line-height: 1.2 !important;
    }

    /* Statistiques - CENTRAGE FORCÉ */
    .tesla-frontend-dashboard .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        /* Surcharge stats.css */
        justify-items: center !important;
        text-align: center !important;
    }

    .tesla-frontend-dashboard .stat-card {
        align-items: center !important;
        text-align: center !important;
        width: 100% !important;
    }
}

@media (max-width: 480px) {
    .tesla-frontend-dashboard {
        padding: 12px 6px !important;
    }

    /* Encore plus compact */
    .tesla-frontend-dashboard .trip-stats-grid,
    .tesla-frontend-dashboard .charge-stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        /* 2 colonnes sur petit écran */
    }

    .tesla-frontend-dashboard .status-grid {
        grid-template-columns: 1fr !important;
        /* 1 colonne si très petit */
    }

    /* Modals fullscreen */
    .tesla-frontend-dashboard .tesla-modal-content {
        width: 100% !important;
        height: 100% !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        padding: 16px !important;
        margin: 0 !important;
    }
}/ *    "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   
       S H A R E D   C I R C U L A R   G A U G E   ( B a t t e r y   &   H e a l t h )  
        "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "   "    * /  
  
 . c i r c u l a r - g a u g e   {  
         p o s i t i o n :   r e l a t i v e ;  
         w i d t h :   1 4 0 p x ;  
         h e i g h t :   1 4 0 p x ;  
         d i s p l a y :   f l e x ;  
         a l i g n - i t e m s :   c e n t e r ;  
         j u s t i f y - c o n t e n t :   c e n t e r ;  
         m a r g i n :   0   a u t o   1 0 p x   a u t o ;  
 }  
  
 . c i r c u l a r - c h a r t   {  
         d i s p l a y :   b l o c k ;  
         m a r g i n :   0   a u t o ;  
         m a x - w i d t h :   1 0 0 % ;  
         m a x - h e i g h t :   1 0 0 % ;  
         t r a n s f o r m :   r o t a t e ( 0 d e g ) ;  
         / *   S t a r t   a t   t o p   i f   n e e d e d   * /  
 }  
  
 . c i r c l e - b g   {  
         f i l l :   n o n e ;  
         s t r o k e :   r g b a ( 2 5 5 ,   2 5 5 ,   2 5 5 ,   0 . 0 5 ) ;  
         / *   D a r k   t r a c k   * /  
         s t r o k e - w i d t h :   2 . 5 ;  
 }  
  
 . c i r c l e   {  
         f i l l :   n o n e ;  
         s t r o k e - w i d t h :   2 . 5 ;  
         s t r o k e - l i n e c a p :   r o u n d ;  
         a n i m a t i o n :   p r o g r e s s   1 s   e a s e - o u t   f o r w a r d s ;  
         t r a n s f o r m - o r i g i n :   c e n t e r ;  
         t r a n s f o r m :   r o t a t e ( - 9 0 d e g ) ;  
         / *   S t a r t   f r o m   t o p   * /  
 }  
  
 @ k e y f r a m e s   p r o g r e s s   {  
         0 %   {  
                 s t r o k e - d a s h a r r a y :   0 ,   1 0 0 ;  
         }  
 }  
  
 . g a u g e - t e x t   {  
         p o s i t i o n :   a b s o l u t e ;  
         t o p :   5 0 % ;  
         l e f t :   5 0 % ;  
         t r a n s f o r m :   t r a n s l a t e ( - 5 0 % ,   - 5 0 % ) ;  
         t e x t - a l i g n :   c e n t e r ;  
         d i s p l a y :   f l e x ;  
         f l e x - d i r e c t i o n :   c o l u m n ;  
         a l i g n - i t e m s :   c e n t e r ;  
         j u s t i f y - c o n t e n t :   c e n t e r ;  
 }  
  
 . g a u g e - t e x t   . p e r c e n t   {  
         f o n t - s i z e :   3 2 p x ;  
         f o n t - w e i g h t :   9 0 0 ;  
         c o l o r :   v a r ( - - t e x t - p r i m a r y ) ;  
         l i n e - h e i g h t :   1 ;  
 }  
  
 / *   S p e c i f i c   c o l o r s   h a n d l e d   b y   i n l i n e   s t y l e s   o r   u t i l i t y   c l a s s e s   * /  
 
/* --- CHARGING STATS --- */
.stats-grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card-modern {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: transform 0.2s, background 0.2s;
}

.stat-card-modern:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.stat-card-modern .icon {
    font-size: 28px;
    margin-bottom: 12px;
    opacity: 0.9;
}

.stat-card-modern .value {
    font-size: 26px;
    font-weight: 700;
    color: #fff;
    line-height: 1.1;
    margin-bottom: 4px;
}

.stat-card-modern .value small {
    font-size: 14px;
    color: #a1a1aa;
    font-weight: 400;
    margin-left: 2px;
}

.stat-card-modern .label {
    font-size: 13px;
    color: #a1a1aa;
    font-weight: 500;
}

.chart-container-doughnut {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 15px;
}


/* --- CHARGING STATS LAYOUT --- */
.charging-stats-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: stretch;
}

.stats-grid-4 {
    flex: 1 1 350px; /* min width 350px, grow */
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Force 2x2 grid */
    gap: 15px;
    margin-bottom: 0 !important;
}

@media (min-width: 1200px) {
    .stats-grid-4 {
        grid-template-columns: repeat(4, 1fr); /* 4x1 on wide screens */
    }
}

.chart-container-doughnut {
    flex: 0 0 220px; /* Fixed width for chart */
    height: auto;
    min-height: 100%;
    margin-top: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .charging-stats-wrapper {
        flex-direction: column;
    }
    .stats-grid-4 {
        flex: none;
        width: 100%;
    }
    .chart-container-doughnut {
        flex: none;
        width: 100%;
        height: 250px;
    }
}


/* --- UI REFINEMENTS --- */
.tesla-widget.widget-charging-stats {
    margin-bottom: 40px !important;
}

.stat-card-modern {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: 110px;
}

.stat-card-modern .icon {
    margin-bottom: 8px;
}

.stat-card-modern .value {
    font-size: 24px;
}


/* --- DRIVING STATS LAYOUT (Mirror of Charging) --- */
.driving-stats-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: stretch;
}

@media (max-width: 768px) {
    .driving-stats-wrapper {
        flex-direction: column;
    }
}


/* --- 5-COLUMN GRID FOR TRIPS --- */
.stats-grid-5 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    width: 100%;
}

@media (min-width: 768px) {
    .stats-grid-5 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1200px) {
    .stats-grid-5 {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Mini Stats Grid (Driving Details) */
.stats-mini-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; }
.mini-stat { background: rgba(255, 255, 255, 0.03); border-radius: 12px; padding: 15px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.mini-stat .label { font-size: 0.75rem; color: #a1a1aa; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 5px; }
.mini-stat .value { font-size: 1.5rem; font-weight: 700; color: #fff; }
.mini-stat .value small { font-size: 0.9rem; font-weight: 400; color: #71717a; margin-left: 2px; }
