/* ═══════════════════════════════════════════════════════════════════════════════
   DASHBOARD PRO V6 - STYLES
   Design Light Premium - Vannes Express
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════════════
   LAYOUT DASHBOARD V6
   ═══════════════════════════════════════════════════════════════════════════════ */

.dashboard-v6 {
    min-height: 100vh;
}

/* Header V6 */
.main-header {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 20px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 16px;
    flex-wrap: wrap;
    box-sizing: border-box;
    width: 100%;
}

.header-left h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    margin: 0;
}

.header-left p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Health Score */
.health-score {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--success-bg) 0%, white 100%);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.health-score-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.health-score-circle::before {
    content: '';
    position: absolute;
    width: 38px;
    height: 38px;
    background: white;
    border-radius: 50%;
}

.health-score-value {
    position: relative;
    font-size: 14px;
    font-weight: 700;
    color: var(--success);
}

.health-score-text {
    text-align: left;
}

.health-score-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--success);
}

.health-score-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.header-left {
    flex: 1;
    min-width: 0;
}

/* Page Content */
.page-content {
    padding: 28px 32px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   ALERTES V6
   ═══════════════════════════════════════════════════════════════════════════════ */

.alerts-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.alert-item {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    border: 1px solid;
    transition: all 0.2s ease;
    cursor: pointer;
}

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

.alert-item.warning {
    background: var(--warning-bg);
    border-color: rgba(245, 158, 11, 0.3);
}

.alert-item.danger {
    background: var(--danger-bg);
    border-color: rgba(239, 68, 68, 0.3);
}

.alert-item.info {
    background: var(--info-bg);
    border-color: rgba(59, 130, 246, 0.3);
}

.alert-icon {
    font-size: 20px;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.alert-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.alert-action {
    font-size: 13px;
    font-weight: 600;
    color: var(--ve-marine);
    text-decoration: none;
    white-space: nowrap;
}

.alert-action:hover {
    text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   KPI CARDS V6
   ═══════════════════════════════════════════════════════════════════════════════ */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.kpi-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

.kpi-card:nth-child(1) { animation-delay: 0.1s; }
.kpi-card:nth-child(2) { animation-delay: 0.15s; }
.kpi-card:nth-child(3) { animation-delay: 0.2s; }
.kpi-card:nth-child(4) { animation-delay: 0.25s; }

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.kpi-card.kpi-blue::before { background: linear-gradient(90deg, var(--ve-cyan), var(--ve-marine)); }
.kpi-card.kpi-green::before { background: linear-gradient(90deg, var(--success), var(--success-light)); }
.kpi-card.kpi-orange::before { background: linear-gradient(90deg, var(--ve-orange), var(--ve-orange-light)); }
.kpi-card.kpi-purple::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }

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

.kpi-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.kpi-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.kpi-badge.positive {
    background: var(--success-bg);
    color: var(--success);
}

.kpi-badge.negative {
    background: var(--danger-bg);
    color: var(--danger);
}

.kpi-value {
    font-size: 34px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -1px;
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 4px;
    position: relative;
}

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

.kpi-comparison strong {
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   CHART SECTION V6
   ═══════════════════════════════════════════════════════════════════════════════ */

.chart-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 28px;
}

.card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(to bottom, white, var(--bg-tertiary));
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.card-title-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--ve-cyan), var(--ve-cyan-light));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.card-actions {
    display: flex;
    gap: 6px;
}

.card-btn {
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.card-btn.active {
    background: var(--ve-marine);
    color: white;
    border-color: var(--ve-marine);
}

.card-body {
    padding: 24px;
}

.chart-container {
    position: relative;
    height: 280px;
}

/* Stats Panel */
.stats-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease;
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

.stat-card:nth-child(1) { animation-delay: 0.3s; }
.stat-card:nth-child(2) { animation-delay: 0.35s; }
.stat-card:nth-child(3) { animation-delay: 0.4s; }
.stat-card:nth-child(4) { animation-delay: 0.45s; }

.stat-card:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.green { background: var(--success-bg); }
.stat-icon.orange { background: var(--warning-bg); }
.stat-icon.red { background: var(--danger-bg); }
.stat-icon.blue { background: var(--info-bg); }

.stat-content { flex: 1; }

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.stat-trend {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 8px;
}

.stat-trend.up {
    background: var(--success-bg);
    color: var(--success);
}

.stat-trend.down {
    background: var(--danger-bg);
    color: var(--danger);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   GANTT V6
   ═══════════════════════════════════════════════════════════════════════════════ */

.gantt-section {
    margin-bottom: 28px;
}

.gantt-date-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gantt-nav-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s ease;
}

.gantt-nav-btn:hover {
    background: var(--ve-marine);
    color: white;
    border-color: var(--ve-marine);
}

.gantt-current-date {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 220px;
    text-align: center;
}

.gantt-container {
    overflow: hidden;
}

.gantt-wrapper {
    display: flex;
    overflow-x: auto;
}

/* Colonne chauffeurs */
.gantt-drivers {
    flex-shrink: 0;
    width: 200px;
    background: var(--bg-tertiary);
    border-right: 1px solid var(--border-color);
}

.gantt-driver-header {
    height: 50px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}

.gantt-driver-row {
    height: 70px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.2s ease;
}

.gantt-driver-row:hover {
    background: var(--bg-primary);
}

.driver-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ve-cyan), var(--ve-cyan-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    color: var(--ve-marine);
    flex-shrink: 0;
}

.driver-info {
    min-width: 0;
}

.driver-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.driver-vehicle {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Timeline */
.gantt-timeline {
    flex: 1;
    min-width: 800px;
}

.gantt-hours {
    height: 50px;
    display: flex;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}

.gantt-hour {
    flex: 1;
    min-width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    border-right: 1px solid var(--border-light);
    position: relative;
}

.gantt-hour.now::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: var(--ve-orange);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--ve-orange);
}

.gantt-rows {
    position: relative;
}

.gantt-row {
    height: 70px;
    display: flex;
    border-bottom: 1px solid var(--border-light);
    position: relative;
}

.gantt-cell {
    flex: 1;
    min-width: 60px;
    border-right: 1px solid var(--border-light);
    position: relative;
}

.gantt-cell.current-hour {
    background: rgba(245, 166, 35, 0.08);
}

/* Ligne verticale heure actuelle */
.gantt-now-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--ve-orange);
    z-index: 10;
    box-shadow: 0 0 8px var(--ve-orange);
}

.gantt-now-line::before {
    content: 'Maintenant';
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    font-weight: 600;
    color: var(--ve-orange);
    white-space: nowrap;
    background: white;
    padding: 2px 8px;
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
}

/* Mission sur le Gantt */
.gantt-mission {
    position: absolute;
    top: 10px;
    height: 50px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 5;
    overflow: hidden;
}

.gantt-mission:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
    z-index: 20;
}

.gantt-mission.planifie {
    background: linear-gradient(135deg, var(--ve-cyan), var(--ve-cyan-light));
    color: var(--ve-marine-dark);
}

.gantt-mission.en-cours {
    background: linear-gradient(135deg, var(--ve-orange), var(--ve-orange-light));
    color: white;
    animation: pulse-mission 2s ease-in-out infinite;
}

.gantt-mission.termine {
    background: linear-gradient(135deg, var(--success), var(--success-light));
    color: white;
}

.gantt-mission.annule {
    background: var(--border-color);
    color: var(--text-muted);
}

@keyframes pulse-mission {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 166, 35, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(245, 166, 35, 0); }
}

.mission-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.mission-content {
    flex: 1;
    min-width: 0;
}

.mission-route {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mission-time {
    font-size: 11px;
    opacity: 0.9;
    font-family: 'JetBrains Mono', monospace;
}

/* Légende Gantt */
.gantt-legend {
    display: flex;
    gap: 20px;
    padding: 16px 24px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-light);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 4px;
}

.legend-color.planifie { background: var(--ve-cyan); }
.legend-color.en-cours { background: var(--ve-orange); }
.legend-color.termine { background: var(--success); }

/* ═══════════════════════════════════════════════════════════════════════════════
   BOTTOM SECTION V6
   ═══════════════════════════════════════════════════════════════════════════════ */

.bottom-section {
    display: grid;
    grid-template-columns: 1fr 1fr 380px;
    gap: 24px;
}

/* Top Chauffeurs */
.top-drivers {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.top-driver-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.top-driver-item:hover {
    background: var(--bg-primary);
    transform: translateX(4px);
}

.top-driver-rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}

.top-driver-rank.gold {
    background: linear-gradient(135deg, #ffd700, #ffb700);
    color: #7a5900;
}

.top-driver-rank.silver {
    background: linear-gradient(135deg, #e0e0e0, #c0c0c0);
    color: #505050;
}

.top-driver-rank.bronze {
    background: linear-gradient(135deg, #cd7f32, #b87333);
    color: white;
}

.top-driver-info {
    flex: 1;
}

.top-driver-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.top-driver-stats {
    font-size: 12px;
    color: var(--text-muted);
}

.top-driver-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--ve-marine);
    font-family: 'JetBrains Mono', monospace;
}

/* Factures */
.invoices-list {
    display: flex;
    flex-direction: column;
}

.invoice-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.2s ease;
    cursor: pointer;
}

.invoice-item:last-child {
    border-bottom: none;
}

.invoice-item:hover {
    background: var(--bg-tertiary);
}

.invoice-status-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.invoice-status-icon.payee { background: var(--success-bg); }
.invoice-status-icon.attente { background: var(--warning-bg); }
.invoice-status-icon.retard { background: var(--danger-bg); }

.invoice-info {
    flex: 1;
    min-width: 0;
}

.invoice-number {
    font-size: 13px;
    font-weight: 600;
    color: var(--ve-marine);
    font-family: 'JetBrains Mono', monospace;
}

.invoice-client {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.invoice-amount {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

/* Fleet Map */
#fleet-map {
    height: 280px;
    min-height: 280px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.fleet-marker {
    background: var(--bg-secondary);
    border-radius: 50%;
    border: 3px solid var(--ve-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.fleet-marker.en-mission {
    border-color: var(--ve-orange);
}

.marker-content {
    font-size: 18px;
}

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

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

/* ═══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1400px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .chart-section { grid-template-columns: 1fr; }
    .bottom-section { grid-template-columns: 1fr 1fr; }
    .bottom-section > .card:last-child { grid-column: span 2; }
}

@media (max-width: 1024px) {
    .health-score { display: none; }
    .alerts-bar { flex-direction: column; }
    .bottom-section { grid-template-columns: 1fr; }
    .bottom-section > .card:last-child { grid-column: span 1; }
}

@media (max-width: 768px) {
    .main-header { flex-direction: column; gap: 16px; padding: 16px 20px; }
    .page-content { padding: 20px; }
    .kpi-grid { grid-template-columns: 1fr; }
    .gantt-drivers { width: 140px; }
}
