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

:root {
    --tesla-red: #E82127;
    --tesla-red-hover: #c61a1f;
    --tesla-black: #171A20;
    --tesla-dark: #222222;
    --bg-body: #F4F7FC;
    --surface: rgba(255, 255, 255, 0.75);
    --surface-solid: #FFFFFF;
    --text-dark: #0f172a;
    --text-grey: #64748B;
    --border-light: rgba(255, 255, 255, 0.6);
    --border-solid: #E2E8F0;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: #f8fafc;
    background-image: radial-gradient(at 0% 0%, hsla(210, 30%, 95%, 1) 0, transparent 50%),
                      radial-gradient(at 100% 0%, hsla(0, 0%, 100%, 1) 0, transparent 50%),
                      radial-gradient(at 100% 100%, hsla(210, 20%, 93%, 1) 0, transparent 50%),
                      radial-gradient(at 0% 100%, hsla(220, 30%, 96%, 1) 0, transparent 50%);
    background-attachment: fixed;
    color: var(--text-dark);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    color: var(--tesla-black);
    margin-top: 0;
    letter-spacing: -0.02em;
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glass);
}

/* Navbar Premium */
.navbar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    padding: 0 40px;
    display: flex;
    align-items: center;
    gap: 40px;
    height: 72px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar .logo {
    color: var(--tesla-red);
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: -0.5px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-nav {
    display: flex;
    gap: 32px;
    height: 100%;
}

.nav-item {
    color: var(--text-grey);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    position: relative;
    transition: var(--transition);
    padding: 0 4px;
}

.nav-item:hover {
    color: var(--tesla-black);
}

.nav-item.active {
    color: var(--tesla-black);
    font-weight: 600;
}

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--tesla-red);
    border-radius: 3px 3px 0 0;
}

.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 40px 32px;
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: var(--radius-full);
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--tesla-red);
    color: white;
    box-shadow: 0 4px 14px rgba(232, 33, 39, 0.25);
}

.btn-primary:hover {
    background: var(--tesla-red-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(232, 33, 39, 0.35);
}

.btn-secondary {
    background: white;
    color: var(--text-dark);
    border: 1px solid var(--border-solid);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.04);
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    text-align: left;
    padding: 16px 20px;
    font-weight: 600;
    color: var(--text-grey);
    border-bottom: 1px solid var(--border-solid);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

td {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

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

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Scrollbar Ã©lÃ©gante */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }


/* ===== TABLEAU DE BORD STYLES ===== */
/* ==========================================================================
   TABLEAU DE BORD PROFESSIONNEL - TESLA DELIVERY ADVISOR (DA)
   ========================================================================== */

.dashboard-container {
    padding: 0;
    max-width: 1480px;
    margin: 0 auto 40px auto;
    font-size: 0.95rem;
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* --------------------------------------------------------------------------
   HEADER & ACTIONS STRATÃ‰GIQUES
   -------------------------------------------------------------------------- */
.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-solid);
}

.dash-title-group h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--tesla-black);
    display: flex;
    align-items: center;
    gap: 12px;
}

.dash-title-group p {
    margin: 4px 0 0 0;
    color: var(--text-grey);
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.hub-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.hub-live-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
    animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.dash-actions-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-action-da {
    border: none;
    padding: 10px 18px;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}

.btn-action-da:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-action-da:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-affectation {
    background: var(--tesla-black);
    color: white;
}
.btn-affectation:hover {
    background: #000000;
}

.btn-livraison-auto {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-planning-link {
    background: white;
    color: var(--tesla-black);
    border: 1px solid var(--border-solid);
}
.btn-planning-link:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

/* --------------------------------------------------------------------------
   HERO KPI CARDS
   -------------------------------------------------------------------------- */
.kpi-hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.kpi-hero-card {
    background: var(--surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    box-shadow: var(--shadow-glass);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.kpi-hero-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.kpi-hero-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.kpi-hero-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-grey);
    margin: 0;
}

.kpi-hero-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

.kpi-hero-val {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--tesla-black);
    line-height: 1.1;
    margin: 0 0 6px 0;
    font-family: 'Outfit', sans-serif;
}

.kpi-hero-sub {
    font-size: 0.82rem;
    color: var(--text-grey);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.kpi-progress-bar {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: 10px;
}

.kpi-progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 1s ease-in-out;
}

/* --------------------------------------------------------------------------
   GRAPHIQUES STRATÃ‰GIQUES (CHART.JS)
   -------------------------------------------------------------------------- */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(460px, 1fr));
    gap: 22px;
    margin-bottom: 30px;
}

.chart-card {
    background: var(--surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    box-shadow: var(--shadow-glass);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.chart-card:hover {
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.07);
}

.chart-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-solid);
}

.chart-title-area h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-title-area p {
    margin: 3px 0 0 0;
    font-size: 0.82rem;
    color: var(--text-grey);
}

.chart-chip {
    font-size: 0.78rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: #f1f5f9;
    color: #475569;
}

.chart-container-box {
    position: relative;
    width: 100%;
    height: 270px;
}

/* --------------------------------------------------------------------------
   SECTIONS INFÃ‰RIEURES (AGENDA, SPEC DU HUB, LIVE FEED)
   -------------------------------------------------------------------------- */
.bottom-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 22px;
}

@media (max-width: 1080px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    .bottom-grid {
        grid-template-columns: 1fr;
    }
}

.dash-panel {
    background: var(--surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    box-shadow: var(--shadow-glass);
    transition: var(--transition);
}

.dash-panel-title {
    margin: 0 0 16px 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-solid);
}

/* Cartes Prochaines Livraisons */
.livraisons-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.livraison-item-card {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--border-solid);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.livraison-item-card:hover {
    background: #ffffff;
    border-color: #cbd5e1;
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.liv-client-name {
    font-weight: 700;
    color: var(--tesla-black);
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.liv-meta {
    font-size: 0.82rem;
    color: var(--text-grey);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.liv-vin-chip {
    font-family: monospace;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    color: #334155;
    font-size: 0.75rem;
}

.liv-date-badge {
    text-align: right;
}

.liv-date-val {
    font-weight: 700;
    color: #0f172a;
    font-size: 0.92rem;
}

.liv-statut-pill {
    display: inline-block;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-top: 4px;
}

/* Feed CRM Live */
.feed-stream {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 480px;
    overflow-y: auto;
}

.feed-event-card {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.65);
    border-left: 4px solid var(--tesla-black);
    font-size: 0.88rem;
    transition: var(--transition);
}

.feed-event-card:hover {
    background: #ffffff;
    transform: translateX(3px);
}

.feed-evt-time {
    font-size: 0.75rem;
    color: var(--text-grey);
    font-weight: 600;
}

/* Hub Specs Cards */
.hub-specs-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.hub-spec-box {
    background: rgba(248, 250, 252, 0.8);
    border: 1px solid var(--border-solid);
    border-radius: var(--radius-md);
    padding: 12px;
    text-align: center;
}

.hub-spec-val {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--tesla-black);
    font-family: 'Outfit', sans-serif;
}

.hub-spec-lbl {
    font-size: 0.72rem;
    color: var(--text-grey);
    text-transform: uppercase;
    font-weight: 700;
    margin-top: 3px;
}


/* ===== COMMANDES & TIMELINE STYLES ===== */
/* Barre d'action : affectation automatique */
.barre-actions { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 20px 24px 0 24px; padding: 16px 24px; background: var(--surface); backdrop-filter: blur(16px); border-radius: var(--radius-lg); box-shadow: var(--shadow-glass); border-left: 4px solid var(--tesla-red); border-top: 1px solid var(--border-light); border-right: 1px solid var(--border-light); border-bottom: 1px solid var(--border-light); }
.barre-actions-info { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; color: var(--text-grey); }
.barre-actions-info strong { color: var(--text-dark); font-size: 1rem; font-family: 'Outfit', sans-serif;}
.btn-auto { background: var(--tesla-red); color: #ffffff; border: none; padding: 14px 24px; border-radius: var(--radius-full); font-weight: 600; font-size: 0.95rem; cursor: pointer; transition: var(--transition); white-space: nowrap; box-shadow: 0 4px 14px rgba(232, 33, 39, 0.3); }
.btn-auto:hover:not(:disabled) { background: var(--tesla-red-hover); box-shadow: 0 6px 20px rgba(232,33,39,0.4); transform: translateY(-2px); }
.btn-auto:disabled { background: #cbd5e1; cursor: not-allowed; box-shadow: none; transform: none; }

/* Structure globale */
.dashboard-split { display: flex; gap: 24px; padding: 24px; height: calc(100vh - 180px); }

/* Colonnes */
.colonne { flex: 1; background: var(--surface); backdrop-filter: blur(16px); padding: 24px; border-radius: var(--radius-lg); box-shadow: var(--shadow-glass); overflow-y: auto; border: 1px solid var(--border-light); border-top: 4px solid transparent; transition: var(--transition); }
.colonne.active-col { border-top-color: var(--tesla-red); background: rgba(255,255,255,0.85); box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.1); }

/* Titres des colonnes */
.col-title { margin-top: 0; border-bottom: 1px solid var(--border-solid); padding-bottom: 16px; margin-bottom: 24px; text-transform: uppercase; letter-spacing: 0.05em; font-size: 1rem; color: var(--text-dark); font-family: 'Outfit', sans-serif; font-weight: 600; }

/* Cartes interactives (VÃ©hicules et Clients) */
.carte-item { background: white; padding: 20px; border-radius: var(--radius-md); border: 1px solid var(--border-solid); margin-bottom: 16px; cursor: pointer; transition: var(--transition); position: relative; box-shadow: var(--shadow-sm); }
.carte-item:hover { border-color: var(--tesla-red); box-shadow: 0 8px 24px rgba(232,33,39,0.12); transform: translateY(-3px); }
.carte-item.selected { border-color: var(--tesla-red); background: #fffcfc; border-left: 4px solid var(--tesla-red); }

/* Badges et Textes */
.badge-count { position: absolute; top: 20px; right: 20px; color: white; border-radius: var(--radius-full); padding: 6px 14px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em; }
.masque { display: none; }
.msg-attente { color: var(--text-grey); font-style: italic; text-align: center; margin-top: 60px; font-size: 1rem; }

/* Frise chronologique de planification */
.timeline-container { max-height: 400px; overflow-y: auto; border: 1px solid var(--border-solid); border-radius: var(--radius-md); padding: 20px; background: white; margin-bottom: 24px; scroll-behavior: smooth; box-shadow: inset 0 2px 4px rgba(0,0,0,0.02); }
.timeline-container::-webkit-scrollbar { width: 6px; }
.timeline-container::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

.jour-bloc { margin-bottom: 24px; }
.jour-bloc:last-child { margin-bottom: 0; }
.jour-label { font-weight: 700; font-size: 0.9rem; text-transform: capitalize; color: var(--text-dark); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px dashed var(--border-solid); font-family: 'Outfit', sans-serif;}

.creneaux-jour { display: flex; flex-wrap: wrap; gap: 10px; }
.creneau-pill { border: 1px solid var(--border-solid); background: #f8fafc; border-radius: var(--radius-full); padding: 10px 16px; font-weight: 600; font-size: 0.9rem; cursor: pointer; transition: var(--transition); color: var(--text-dark); }
.creneau-pill:hover { border-color: var(--tesla-red); transform: translateY(-2px); box-shadow: 0 4px 8px rgba(232,33,39,0.1); }
.creneau-pill.selected { background: var(--tesla-red); color: white; border-color: var(--tesla-red); box-shadow: 0 6px 16px rgba(232,33,39,0.25); transform: translateY(-2px); }

