/* 🎨 Driver Performance Analysis UI Improvements - Matching Modal Theme */

/* Override base styles to match modal dark theme */
.driver-performance-analysis {
    background: linear-gradient(145deg, 
        rgba(15, 23, 42, 0.6) 0%, 
        rgba(30, 41, 59, 0.5) 100%) !important;
    border-radius: 16px !important;
    padding: 0 !important;
    margin-top: 1.5rem !important;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(0, 212, 255, 0.2) !important;
    overflow: visible !important;
}

/* Performance Metrics Grid - Dark Theme */
.performance-metrics-grid {
    background: linear-gradient(135deg, 
        rgba(15, 23, 42, 0.8) 0%, 
        rgba(30, 41, 59, 0.6) 100%) !important;
    border-bottom: 1px solid rgba(0, 212, 255, 0.15) !important;
    padding: 1.5rem !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 1.25rem !important;
}

/* Single empty-state hint below cards (world-class: one message, clearly tied to scorecards) */
.performance-metrics-empty-hint {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 0.875rem 1.25rem;
    margin: 0 1.5rem 1.25rem;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.12) 0%, rgba(2, 132, 199, 0.08) 100%);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #cbd5e1;
    letter-spacing: 0.02em;
}
.performance-metrics-empty-hint.is-visible {
    display: flex !important;
}
.performance-metrics-empty-hint i {
    color: #00d4ff;
    font-size: 1.125rem;
    opacity: 0.95;
    flex-shrink: 0;
}

/* Performance Metric Cards - World-class glass cards */
.performance-metric-card {
    background: linear-gradient(160deg, 
        rgba(30, 41, 59, 0.92) 0%, 
        rgba(15, 23, 42, 0.98) 100%) !important;
    border-radius: 14px !important;
    padding: 1.5rem 1.125rem !important;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 1px 0 rgba(255, 255, 255, 0.06) inset !important;
    border: 1px solid rgba(0, 212, 255, 0.18) !important;
    position: relative;
    overflow: visible !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    min-height: 172px !important;
    justify-content: flex-start !important;
    gap: 0 !important;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease !important;
}

/* Empty state: slightly softer card, elegant placeholder value */
.metrics-empty-state .performance-metric-card {
    min-height: 160px !important;
}
.metrics-empty-state .performance-metric-card .metric-value {
    font-size: 2.25rem !important;
    font-weight: 300 !important;
    color: rgba(241, 245, 249, 0.45) !important;
    letter-spacing: 0.08em !important;
}
.metrics-empty-state .performance-metric-card .metric-content h4 {
    color: #94a3b8 !important;
    font-size: 0.6875rem !important;
    letter-spacing: 0.08em !important;
}

.performance-metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #00d4ff, #0284c7) !important;
    border-radius: 12px 0 0 12px;
    transition: all 0.3s ease;
}

.performance-metric-card:nth-child(2)::before {
    background: linear-gradient(180deg, #10b981, #059669) !important;
}

.performance-metric-card:nth-child(3)::before {
    background: linear-gradient(180deg, #f59e0b, #d97706) !important;
}

.performance-metric-card:nth-child(4)::before {
    background: linear-gradient(180deg, #8b5cf6, #7c3aed) !important;
}

.performance-metric-card:hover {
    transform: translateY(-3px) !important;
    box-shadow: 
        0 8px 24px rgba(0, 212, 255, 0.3),
        0 4px 12px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(0, 212, 255, 0.4) !important;
}

.performance-metric-card:hover::before {
    width: 100%;
    opacity: 0.08;
}

/* Metric Content - Light text on dark background */
.metric-content {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: 100% !important;
    gap: 0.5rem !important;
}

.metric-content h4 {
    color: #94a3b8 !important;
    text-transform: uppercase;
    letter-spacing: 0.08em !important;
    font-size: 0.6875rem !important;
    font-weight: 600 !important;
    margin: 0 !important;
    line-height: 1.3 !important;
    min-height: 1.25em !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
}

.metric-value {
    color: #f1f5f9 !important;
    font-size: 2rem !important;
    font-weight: 700 !important;
    text-shadow: 0 2px 12px rgba(0, 212, 255, 0.25);
    margin: 0.5rem 0 0.35rem !important;
    line-height: 1 !important;
    letter-spacing: 0.02em !important;
}

.metric-trend {
    color: #cbd5e1 !important;
    font-size: 0.75rem !important;
    margin: 0 !important;
    padding: 0.35rem 0.25rem 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.25rem !important;
    min-height: 1.5em !important;
    text-align: center !important;
    flex-wrap: wrap !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    line-height: 1.35 !important;
}

.metric-trend.positive {
    color: #10b981 !important;
}

.metric-trend.negative {
    color: #ef4444 !important;
}

/* Metric Icons - World-class pill with soft glow */
.metric-icon {
    background: linear-gradient(145deg, #0284c7 0%, #0369a1 100%) !important;
    box-shadow: 
        0 4px 14px rgba(2, 132, 199, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
    width: 48px !important;
    height: 48px !important;
    border-radius: 14px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.35rem !important;
    flex-shrink: 0 !important;
    margin-bottom: 0.75rem !important;
}

.metric-icon.safety {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    box-shadow: 
        0 4px 12px rgba(16, 185, 129, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

.metric-icon.punctuality {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    box-shadow: 
        0 4px 12px rgba(245, 158, 11, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

.metric-icon.fuel {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed) !important;
    box-shadow: 
        0 4px 12px rgba(139, 92, 246, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

/* Performance Chart Section - Dark theme */
.performance-chart-section {
    background: linear-gradient(145deg, 
        rgba(15, 23, 42, 0.7) 0%, 
        rgba(30, 41, 59, 0.5) 100%) !important;
    border-bottom: 1px solid rgba(0, 212, 255, 0.15) !important;
    padding: 1.5rem !important;
}

.performance-chart-section .chart-header {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.75rem !important;
    margin-bottom: 1rem !important;
}

.chart-header h4 {
    color: #f1f5f9 !important;
    font-size: 1.125rem !important;
    font-weight: 600 !important;
    margin: 0 !important;
    text-shadow: 0 2px 8px rgba(0, 212, 255, 0.2);
}

.chart-header-right {
    display: flex !important;
    align-items: center !important;
    gap: 1rem !important;
    flex-wrap: wrap !important;
}

.chart-summary-accuracy {
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    color: #94a3b8 !important;
    white-space: nowrap !important;
    padding: 0.25rem 0.5rem !important;
    min-height: 1.5rem !important;
    line-height: 1.5 !important;
}

.chart-legend {
    color: #cbd5e1 !important;
    display: flex !important;
    align-items: center !important;
    flex-shrink: 0 !important;
}

.legend-item {
    color: #cbd5e1 !important;
    font-size: 0.875rem !important;
    white-space: nowrap !important;
}

.legend-dot {
    box-shadow: 0 0 8px currentColor;
}

/* Canvas container - explicit size so Performance Trends chart always renders */
.driver-performance-chart-container {
    position: relative;
    width: 100%;
    height: 250px;
    min-height: 220px;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid rgba(0, 212, 255, 0.1);
}


/* AI Insights - Blue theme matching modal */
.performance-insights {
    background: linear-gradient(135deg, 
        rgba(0, 84, 199, 0.15) 0%, 
        rgba(0, 212, 255, 0.1) 100%) !important;
    border-top: 1px solid rgba(0, 212, 255, 0.2) !important;
    border-bottom: 1px solid rgba(0, 212, 255, 0.2) !important;
    padding: 1.5rem !important;
}

.insights-header i {
    color: #00d4ff !important;
    text-shadow: 0 0 12px rgba(0, 212, 255, 0.6);
}

.insights-header h4 {
    color: #f1f5f9 !important;
    text-shadow: 0 2px 8px rgba(0, 212, 255, 0.2);
}

.insight-item {
    background: linear-gradient(145deg, 
        rgba(30, 41, 59, 0.7) 0%, 
        rgba(15, 23, 42, 0.8) 100%) !important;
    border: 1px solid rgba(0, 212, 255, 0.15) !important;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.03) !important;
}

.insight-item:hover {
    box-shadow: 
        0 4px 16px rgba(0, 212, 255, 0.2),
        0 2px 8px rgba(0, 0, 0, 0.4) !important;
    border-color: rgba(0, 212, 255, 0.3) !important;
}

.insight-item span {
    color: #e2e8f0 !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    line-height: 1.5 !important;
    flex: 1 !important;
    min-width: 0 !important;
}

.performance-insights .insights-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.75rem !important;
}

.performance-insights .insight-item {
    display: flex !important;
    align-items: flex-start !important;
    gap: 0.75rem !important;
    padding: 1rem !important;
    min-height: 3rem !important;
}

.insight-item.positive i {
    color: #10b981 !important;
    text-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.insight-item.warning i {
    color: #f59e0b !important;
    text-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

.insight-item.info i {
    color: #00d4ff !important;
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.6);
}

/* Performance Benchmarking - Dark theme */
.performance-benchmarking {
    background: linear-gradient(145deg, 
        rgba(15, 23, 42, 0.7) 0%, 
        rgba(30, 41, 59, 0.5) 100%) !important;
    border-radius: 0 0 16px 16px !important;
    padding: 1.5rem !important;
}

.performance-benchmarking h4 {
    color: #f1f5f9 !important;
    text-shadow: 0 2px 8px rgba(0, 212, 255, 0.2);
}

.performance-benchmarking h4 i {
    color: #00d4ff !important;
}

.benchmark-label {
    color: #94a3b8 !important;
    font-weight: 600 !important;
}

.benchmark-bar-container {
    background: rgba(15, 23, 42, 0.8) !important;
    border: 1px solid rgba(0, 212, 255, 0.1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.benchmark-bar.driver {
    background: linear-gradient(90deg, #00d4ff, #0284c7) !important;
    box-shadow: 
        0 0 12px rgba(0, 212, 255, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

.benchmark-bar.average {
    background: rgba(148, 163, 184, 0.4) !important;
}

.benchmark-item {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
    min-width: 0 !important;
}

.benchmark-value {
    color: #f1f5f9 !important;
    font-weight: 600 !important;
    font-size: 0.875rem !important;
    line-height: 1.4 !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    min-height: 1.5em !important;
}

.benchmark-bar-container {
    min-height: 32px !important;
    flex-shrink: 0 !important;
}

.benchmark-bar.driver {
    min-width: 0 !important;
}

.benchmark-legend {
    border-top: 1px solid rgba(0, 212, 255, 0.2) !important;
    color: #cbd5e1 !important;
}

.legend-square.driver {
    background: linear-gradient(135deg, #00d4ff, #0284c7) !important;
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
}

.legend-square.average {
    background: rgba(148, 163, 184, 0.4) !important;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .performance-metrics-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.875rem !important;
    }
}

@media (max-width: 768px) {
    .performance-metrics-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
        padding: 1rem !important;
    }
    
    .performance-metric-card {
        padding: 1rem 0.75rem !important;
        min-height: 150px !important;
    }
    
    .metric-value {
        font-size: 1.625rem !important;
    }
    
    .metric-content h4 {
        font-size: 0.7rem !important;
        min-height: 2.5em !important;
    }
    
    .metric-icon {
        width: 44px !important;
        height: 44px !important;
        font-size: 1.25rem !important;
    }
}

@media (max-width: 480px) {
    .performance-metrics-grid {
        grid-template-columns: 1fr !important;
        padding: 1rem !important;
    }
    
    .performance-chart-section {
        padding: 1rem !important;
    }
    
    .performance-chart-section .chart-header {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    
    .driver-performance-chart-container {
        height: 220px !important;
        min-height: 200px !important;
    }
    
    .performance-benchmarking {
        padding: 1rem !important;
    }
    
    .benchmark-legend {
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }
}

/* Section container: prevent overflow and ensure spacing in modal */
#driverDetailsModal .driver-performance-analysis {
    margin-top: 1rem !important;
    margin-bottom: 0 !important;
}

#driverDetailsModal .driver-performance-analysis .performance-metrics-grid {
    min-width: 0 !important;
}

/* No infinite animation - reduces distraction; hover state is enough */
