/* 📊 Driver Performance Analysis - World-Class Styling (Matching Modal Theme) */

.driver-performance-analysis {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 0;
    margin-top: 0.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.1);
}

/* Performance Metrics Grid */
.performance-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.performance-metric-card {
    background: white;
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.06);
    position: relative;
    overflow: visible;
}

.performance-metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    transition: width 0.3s ease;
}

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

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

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

.performance-metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

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

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
}

.metric-icon.efficiency {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.metric-icon.safety {
    background: linear-gradient(135deg, #10b981, #059669);
}

.metric-icon.punctuality {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.metric-icon.fuel {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.metric-content {
    flex: 1;
}

.metric-content h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.metric-trend {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

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

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

.metric-trend i {
    font-size: 0.75rem;
}

/* Performance Chart Section */
.performance-chart-section {
    background: white;
    border-radius: 0;
    padding: 1.5rem;
    margin: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

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

.chart-header h4 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
}

.chart-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #64748b;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.driver-performance-chart-container {
    position: relative;
    height: 250px;
    margin-top: 1rem;
}

/* AI-Powered Insights */
.performance-insights {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-radius: 0;
    padding: 1.5rem;
    margin: 0;
    border-bottom: 1px solid rgba(59, 130, 246, 0.15);
    border-top: 1px solid rgba(59, 130, 246, 0.15);
}

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

.insights-header i {
    font-size: 1.5rem;
    color: #0284c7;
}

.insights-header h4 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #0c4a6e;
}

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

.insight-item {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
}

.insight-item:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.insight-item i {
    font-size: 1.25rem;
    margin-top: 0.125rem;
    flex-shrink: 0;
}

.insight-item.positive i {
    color: #10b981;
}

.insight-item.warning i {
    color: #f59e0b;
}

.insight-item.info i {
    color: #3b82f6;
}

.insight-item span {
    flex: 1;
    color: #475569;
    line-height: 1.6;
    font-size: 0.9375rem;
}

/* Performance Benchmarking */
.performance-benchmarking {
    background: white;
    border-radius: 0 0 12px 12px;
    padding: 1.5rem;
    box-shadow: none;
}

.performance-benchmarking h4 {
    margin: 0 0 1.5rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.benchmark-bars {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 1rem;
}

.benchmark-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.benchmark-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #64748b;
}

.benchmark-bar-container {
    position: relative;
    height: 32px;
    background: #f1f5f9;
    border-radius: 8px;
    overflow: hidden;
}

.benchmark-bar {
    position: absolute;
    height: 100%;
    border-radius: 8px;
    transition: width 0.6s ease;
}

.benchmark-bar.driver {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    z-index: 2;
}

.benchmark-bar.average {
    background: #94a3b8;
    z-index: 1;
}

.benchmark-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e293b;
}

.benchmark-legend {
    display: flex;
    gap: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
    font-size: 0.875rem;
    color: #64748b;
}

.benchmark-legend span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-square {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.legend-square.driver {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.legend-square.average {
    background: #94a3b8;
    opacity: 0.6;
}

/* Responsive Design */
@media (max-width: 768px) {
    .performance-metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .driver-performance-chart-container {
        height: 200px;
    }
    
    .benchmark-legend {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Subtle one-time entrance - no repeat to avoid UI distraction */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.performance-metrics-grid .performance-metric-card {
    animation: slideInUp 0.35s ease forwards;
}

.performance-metrics-grid .performance-metric-card:nth-child(1) { animation-delay: 0.05s; }
.performance-metrics-grid .performance-metric-card:nth-child(2) { animation-delay: 0.1s; }
.performance-metrics-grid .performance-metric-card:nth-child(3) { animation-delay: 0.15s; }
.performance-metrics-grid .performance-metric-card:nth-child(4) { animation-delay: 0.2s; }
