/**
 * IronRoute Analytics - Dashboard Styles
 * 
 * Custom styles beyond Tailwind CSS.
 * Most styling is handled by Tailwind utility classes in templates.
 */

/* Material Symbols base styling */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    vertical-align: middle;
    line-height: 1;
}

/* Loading spinner animation */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Date input styling improvements */
input[type="date"] {
    color-scheme: light;
    font-variant-numeric: tabular-nums;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 0.5;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

input[type="date"]:hover::-webkit-calendar-picker-indicator,
input[type="date"]:focus::-webkit-calendar-picker-indicator {
    opacity: 0.8;
}

input[type="date"]::-webkit-datetime-edit-fields-wrapper {
    padding: 0;
}

/* Empty date inputs show placeholder styling */
input[type="date"]:not(:focus):invalid,
input[type="date"]:not([value]):not(:focus) {
    color: #9ca3af;
}

/* Period button hover enhancement */
.period-btn {
    white-space: nowrap;
}

.period-btn:not(.bg-primary-600):hover {
    background-color: rgba(255, 255, 255, 0.7);
}

/* Grade badge colors (matching JS gradeClass function) */
.grade-excellent {
    background-color: rgb(220, 252, 231);  /* bg-green-100 */
    color: rgb(22, 101, 52);               /* text-green-800 */
}

.grade-good {
    background-color: rgb(219, 234, 254);  /* bg-blue-100 */
    color: rgb(30, 64, 175);               /* text-blue-800 */
}

.grade-fair {
    background-color: rgb(254, 249, 195);  /* bg-yellow-100 */
    color: rgb(133, 77, 14);               /* text-yellow-800 */
}

.grade-poor {
    background-color: rgb(254, 226, 226);  /* bg-red-100 */
    color: rgb(153, 27, 27);               /* text-red-800 */
}

/* Table hover effects */
table tbody tr:hover {
    background-color: rgb(249, 250, 251);  /* bg-gray-50 */
}

/* Card hover effects */
.card-hover:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

/* Chart container responsive sizing */
.chart-container {
    position: relative;
    width: 100%;
    min-height: 250px;
}

/* Responsive table */
@media (max-width: 768px) {
    .table-responsive {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Custom scrollbar for tables */
.overflow-x-auto::-webkit-scrollbar {
    height: 6px;
}

.overflow-x-auto::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.overflow-x-auto::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.overflow-x-auto::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Mini bar tooltip styles */
.mini-bar {
    position: relative;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.mini-bar:hover {
    transform: scaleY(1.15);
    opacity: 0.85;
}

.mini-bar::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background: #ffffff;
    color: #1e293b;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    z-index: 50;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.mini-bar::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #ffffff;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 50;
}

.mini-bar:hover::after,
.mini-bar:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) scale(1);
}

.mini-bar:hover::before {
    transform: translateX(-50%);
}

/* Progress bar tooltip styles */
.progress-bar-container {
    position: relative;
}

.progress-bar-fill {
    cursor: pointer;
}

.progress-bar-fill::after {
    content: attr(data-tooltip);
    position: absolute;
    top: -32px;
    left: var(--tooltip-position, 50%);
    transform: translateX(-50%) scale(0.9);
    background: #ffffff;
    color: #1e293b;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    z-index: 50;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.progress-bar-fill::before {
    content: '';
    position: absolute;
    top: -8px;
    left: var(--tooltip-position, 50%);
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #ffffff;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 50;
}

.progress-bar-fill:hover::after,
.progress-bar-fill:hover::before {
    opacity: 1;
    visibility: visible;
}

.progress-bar-fill:hover::after {
    transform: translateX(-50%) scale(1);
}

/* ========================================
   TRENDS DASHBOARD - Phase 2 Enhancements
   ======================================== */

/* Trends Layout - Grid with Sidebar */
.trends-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    min-height: calc(100vh - 200px);
    gap: 24px;
}

.trends-sidebar {
    position: sticky;
    top: 24px;
    height: fit-content;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.trends-main {
    min-width: 0; /* Prevent grid blowout */
}

/* Navigation Pills */
.trends-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: white;
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

.nav-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    text-decoration: none;
    border-radius: 8px;
    transition: all 200ms ease;
    cursor: pointer;
}

.nav-pill:hover {
    background: #f1f5f9;
    color: #334155;
}

.nav-pill.active {
    background: linear-gradient(135deg, #0f58a8 0%, #1e6fc9 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(15, 88, 168, 0.25);
}

.nav-pill.active:hover {
    background: linear-gradient(135deg, #0d4a8c 0%, #1862b4 100%);
    color: white;
}

/* Sidebar KPI Cards */
.sidebar-kpis {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kpi-card {
    background: white;
    border-radius: 10px;
    padding: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    transition: all 200ms ease;
}

.kpi-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.kpi-card-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    margin-bottom: 4px;
}

.kpi-card-value {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}

.kpi-card-value .partial-indicator {
    font-size: 10px;
    font-weight: 500;
    color: #94a3b8;
    margin-left: 4px;
}

/* Tab Panels */
.tab-panel {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 200ms ease-out, transform 200ms ease-out;
    display: none;
}

.tab-panel.active {
    opacity: 1;
    transform: translateY(0);
    display: block;
}

/* Comparison Banner */
.comparison-banner {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #93c5fd;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    transform: translateY(-8px);
    opacity: 0;
    transition: opacity 250ms ease-out, transform 250ms ease-out;
}

.comparison-banner.visible {
    transform: translateY(0);
    opacity: 1;
}

.comparison-banner.hidden {
    display: none;
}

.comparison-banner .compare-icon {
    font-size: 24px;
}

.comparison-banner .compare-title {
    font-weight: 600;
    color: #1e40af;
}

.comparison-banner .compare-subtitle {
    font-size: 13px;
    color: #3b82f6;
}

/* Comparison delta colors */
.comparison-banner .text-green-600 {
    color: #16a34a;
}

.comparison-banner .text-red-600 {
    color: #dc2626;
}

.comparison-banner .text-gray-500 {
    color: #6b7280;
}

.comparison-banner .text-gray-300 {
    color: #d1d5db;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    cursor: pointer;
    transition: all 150ms ease;
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

/* Summary Panel (Legacy) */
.summary-panel {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

.summary-panel-title {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.summary-item {
    text-align: center;
    padding: 12px;
    background: #f8fafc;
    border-radius: 10px;
}

.summary-item-label {
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 4px;
}

.summary-item-value {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}

.summary-item-range {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}

/* ========================================
   Enhanced Summary Panel - Rich KPI Cards
   ======================================== */

.summary-panel-enhanced {
    background: white;
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    border: 1px solid #e2e8f0;
}

.summary-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.summary-panel-enhanced .summary-panel-title {
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.summary-panel-enhanced .summary-panel-title .material-icons {
    font-size: 22px;
    color: #6366f1;
}

.summary-panel-subtitle {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
}

.summary-grid-enhanced {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

@media (max-width: 1200px) {
    .summary-grid-enhanced {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .summary-grid-enhanced {
        grid-template-columns: 1fr;
    }
}

/* KPI Card Base */
.summary-kpi-card {
    position: relative;
    padding: 18px 20px;
    border-radius: 16px;
    background: linear-gradient(135deg, #fafbff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.summary-kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 16px 16px 0 0;
    opacity: 0.9;
}

.summary-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border-color: transparent;
}

/* Color Variants */
.summary-kpi-card[data-color="indigo"]::before {
    background: linear-gradient(90deg, #6366f1, #818cf8);
}
.summary-kpi-card[data-color="indigo"] .summary-kpi-icon {
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    color: #4f46e5;
}

.summary-kpi-card[data-color="emerald"]::before {
    background: linear-gradient(90deg, #10b981, #34d399);
}
.summary-kpi-card[data-color="emerald"] .summary-kpi-icon {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    color: #059669;
}

.summary-kpi-card[data-color="amber"]::before {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}
.summary-kpi-card[data-color="amber"] .summary-kpi-icon {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    color: #d97706;
}

.summary-kpi-card[data-color="rose"]::before {
    background: linear-gradient(90deg, #f43f5e, #fb7185);
}
.summary-kpi-card[data-color="rose"] .summary-kpi-icon {
    background: linear-gradient(135deg, #fff1f2, #ffe4e6);
    color: #e11d48;
}

/* KPI Card Header */
.summary-kpi-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

.summary-kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.summary-kpi-icon .material-icons {
    font-size: 20px;
}

/* Trend Indicator */
.summary-kpi-trend {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    opacity: 0;
    transform: translateY(-4px);
    transition: all 0.3s ease;
}

.summary-kpi-trend.visible {
    opacity: 1;
    transform: translateY(0);
}

.summary-kpi-trend.up {
    background: #dcfce7;
    color: #16a34a;
}

.summary-kpi-trend.down {
    background: #fee2e2;
    color: #dc2626;
}

.summary-kpi-trend.neutral {
    background: #f1f5f9;
    color: #64748b;
}

.summary-kpi-trend .material-icons {
    font-size: 14px;
}

/* KPI Value */
.summary-kpi-value {
    font-size: 32px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
}

.summary-kpi-label {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 12px;
}

/* Sparkline Container */
.summary-kpi-sparkline {
    height: 32px;
    display: flex;
    align-items: flex-end;
    gap: 2px;
    margin-bottom: 8px;
}

.sparkline-bar {
    flex: 1;
    border-radius: 2px;
    min-height: 4px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.sparkline-bar:hover {
    filter: brightness(0.9);
    transform: scaleY(1.1);
    transform-origin: bottom;
}

/* Distribution Visualization */
.summary-kpi-distribution {
    margin: 8px 0;
}

.distribution-track {
    position: relative;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: visible;
    margin-bottom: 6px;
}

.distribution-range {
    position: absolute;
    height: 100%;
    border-radius: 4px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.summary-kpi-card[data-color="emerald"] .distribution-range {
    background: linear-gradient(90deg, #6ee7b7 0%, #34d399 50%, #10b981 100%);
}

.summary-kpi-card[data-color="amber"] .distribution-range {
    background: linear-gradient(90deg, #fde68a 0%, #fbbf24 50%, #f59e0b 100%);
}

.distribution-median {
    position: absolute;
    width: 12px;
    height: 12px;
    background: white;
    border: 3px solid #0f172a;
    border-radius: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
    cursor: pointer;
}

.distribution-median:hover {
    transform: translate(-50%, -50%) scale(1.3);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}

/* Distribution Tooltip - Light Theme */
.summary-kpi-distribution {
    position: relative;
    overflow: visible;
}

.distribution-track {
    overflow: visible;
}

.distribution-tooltip {
    position: fixed;
    background: white;
    color: #1e293b;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 12px;
    line-height: 1.5;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    z-index: 9999;
    width: 220px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
    text-align: left;
}

.distribution-tooltip.visible {
    opacity: 1;
    visibility: visible;
}

.distribution-tooltip-value {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    display: block;
    margin-bottom: 2px;
}

.distribution-tooltip-label {
    color: #64748b;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    display: block;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}

.distribution-tooltip-explanation {
    color: #475569;
    font-size: 12px;
    line-height: 1.5;
}

.distribution-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
}

.distribution-min,
.distribution-max {
    transition: color 0.3s ease;
}

/* ============================================
   Typical Workload Card - Distribution Density Strip
   ============================================ */
.workload-card {
    --workload-accent: #10b981;
    --workload-accent-light: #d1fae5;
    --workload-accent-gradient: linear-gradient(90deg, #10b981, #34d399);
}

.workload-card::before {
    background: var(--workload-accent-gradient) !important;
}

.workload-card[data-spread="tight"] {
    --workload-accent: #10b981;
    --workload-accent-light: #d1fae5;
    --workload-accent-gradient: linear-gradient(90deg, #10b981, #34d399);
}

.workload-card[data-spread="moderate"] {
    --workload-accent: #3b82f6;
    --workload-accent-light: #dbeafe;
    --workload-accent-gradient: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.workload-card[data-spread="wide"] {
    --workload-accent: #f59e0b;
    --workload-accent-light: #fef3c7;
    --workload-accent-gradient: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.workload-card[data-spread="very-wide"] {
    --workload-accent: #ef4444;
    --workload-accent-light: #fee2e2;
    --workload-accent-gradient: linear-gradient(90deg, #ef4444, #f87171);
}

.workload-card .workload-icon {
    background: var(--workload-accent-light);
    color: var(--workload-accent);
}

/* Spread Badge */
.workload-spread-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    transition: all 0.3s ease;
}

.workload-card[data-spread="tight"] .workload-spread-badge {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    color: #059669;
    box-shadow: 0 1px 3px rgba(16, 185, 129, 0.2);
}

.workload-card[data-spread="moderate"] .workload-spread-badge {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: #2563eb;
    box-shadow: 0 1px 3px rgba(59, 130, 246, 0.2);
}

.workload-card[data-spread="wide"] .workload-spread-badge {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    color: #d97706;
    box-shadow: 0 1px 3px rgba(245, 158, 11, 0.2);
}

.workload-card[data-spread="very-wide"] .workload-spread-badge {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    color: #dc2626;
    box-shadow: 0 1px 3px rgba(239, 68, 68, 0.2);
}

/* Strip Container */
.workload-strip-container {
    margin: 10px 0 4px 0;
}

.workload-strip-track {
    position: relative;
    height: 10px;
    background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
    border-radius: 5px;
    overflow: visible;
}

/* Concentration Zone - where most trucks fall */
.workload-concentration-zone {
    position: absolute;
    height: 100%;
    border-radius: 5px;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.workload-card[data-spread="tight"] .workload-concentration-zone {
    background: linear-gradient(90deg, 
        rgba(16, 185, 129, 0.25) 0%, 
        rgba(16, 185, 129, 0.6) 50%, 
        rgba(16, 185, 129, 0.25) 100%);
    box-shadow: inset 0 1px 2px rgba(16, 185, 129, 0.3);
}

.workload-card[data-spread="moderate"] .workload-concentration-zone {
    background: linear-gradient(90deg, 
        rgba(59, 130, 246, 0.2) 0%, 
        rgba(59, 130, 246, 0.5) 50%, 
        rgba(59, 130, 246, 0.2) 100%);
    box-shadow: inset 0 1px 2px rgba(59, 130, 246, 0.3);
}

.workload-card[data-spread="wide"] .workload-concentration-zone {
    background: linear-gradient(90deg, 
        rgba(245, 158, 11, 0.2) 0%, 
        rgba(245, 158, 11, 0.45) 50%, 
        rgba(245, 158, 11, 0.2) 100%);
    box-shadow: inset 0 1px 2px rgba(245, 158, 11, 0.3);
}

.workload-card[data-spread="very-wide"] .workload-concentration-zone {
    background: linear-gradient(90deg, 
        rgba(239, 68, 68, 0.15) 0%, 
        rgba(239, 68, 68, 0.4) 50%, 
        rgba(239, 68, 68, 0.15) 100%);
    box-shadow: inset 0 1px 2px rgba(239, 68, 68, 0.3);
}

/* Quartile Tick Marks */
.workload-tick {
    position: absolute;
    width: 2px;
    height: 14px;
    top: -2px;
    background: rgba(100, 116, 139, 0.4);
    border-radius: 1px;
    transform: translateX(-50%);
    transition: left 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Diamond Indicator */
.workload-indicator-diamond {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    color: #0f172a;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    transition: left 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 3;
    cursor: pointer;
}

.workload-indicator-diamond:hover {
    transform: translate(-50%, -50%) scale(1.3);
}

.workload-indicator-diamond svg {
    display: block;
}

/* Strip Labels */
.workload-strip-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    font-weight: 600;
    color: #94a3b8;
    margin-top: 4px;
}

.workload-min-label,
.workload-max-label {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    min-width: 20px;
}

.workload-min-label {
    text-align: left;
}

.workload-max-label {
    text-align: right;
}

/* ============================================
   Typical Route Time Card - Distribution Density Strip
   ============================================ */
.routetime-card {
    --routetime-accent: #f59e0b;
    --routetime-accent-light: #fef3c7;
    --routetime-accent-gradient: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.routetime-card::before {
    background: var(--routetime-accent-gradient) !important;
}

.routetime-card[data-spread="tight"] {
    --routetime-accent: #10b981;
    --routetime-accent-light: #d1fae5;
    --routetime-accent-gradient: linear-gradient(90deg, #10b981, #34d399);
}

.routetime-card[data-spread="moderate"] {
    --routetime-accent: #3b82f6;
    --routetime-accent-light: #dbeafe;
    --routetime-accent-gradient: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.routetime-card[data-spread="wide"] {
    --routetime-accent: #f59e0b;
    --routetime-accent-light: #fef3c7;
    --routetime-accent-gradient: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.routetime-card[data-spread="very-wide"] {
    --routetime-accent: #ef4444;
    --routetime-accent-light: #fee2e2;
    --routetime-accent-gradient: linear-gradient(90deg, #ef4444, #f87171);
}

.routetime-card .routetime-icon {
    background: var(--routetime-accent-light);
    color: var(--routetime-accent);
}

/* Route Time Spread Badge */
.routetime-spread-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    transition: all 0.3s ease;
}

.routetime-card[data-spread="tight"] .routetime-spread-badge {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    color: #059669;
    box-shadow: 0 1px 3px rgba(16, 185, 129, 0.2);
}

.routetime-card[data-spread="moderate"] .routetime-spread-badge {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: #2563eb;
    box-shadow: 0 1px 3px rgba(59, 130, 246, 0.2);
}

.routetime-card[data-spread="wide"] .routetime-spread-badge {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    color: #d97706;
    box-shadow: 0 1px 3px rgba(245, 158, 11, 0.2);
}

.routetime-card[data-spread="very-wide"] .routetime-spread-badge {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    color: #dc2626;
    box-shadow: 0 1px 3px rgba(239, 68, 68, 0.2);
}

/* Route Time Strip Container */
.routetime-strip-container {
    margin: 10px 0 4px 0;
}

.routetime-strip-track {
    position: relative;
    height: 10px;
    background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
    border-radius: 5px;
    overflow: visible;
}

/* Route Time Concentration Zone */
.routetime-concentration-zone {
    position: absolute;
    height: 100%;
    border-radius: 5px;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.routetime-card[data-spread="tight"] .routetime-concentration-zone {
    background: linear-gradient(90deg, 
        rgba(16, 185, 129, 0.25) 0%, 
        rgba(16, 185, 129, 0.6) 50%, 
        rgba(16, 185, 129, 0.25) 100%);
    box-shadow: inset 0 1px 2px rgba(16, 185, 129, 0.3);
}

.routetime-card[data-spread="moderate"] .routetime-concentration-zone {
    background: linear-gradient(90deg, 
        rgba(59, 130, 246, 0.2) 0%, 
        rgba(59, 130, 246, 0.5) 50%, 
        rgba(59, 130, 246, 0.2) 100%);
    box-shadow: inset 0 1px 2px rgba(59, 130, 246, 0.3);
}

.routetime-card[data-spread="wide"] .routetime-concentration-zone {
    background: linear-gradient(90deg, 
        rgba(245, 158, 11, 0.2) 0%, 
        rgba(245, 158, 11, 0.45) 50%, 
        rgba(245, 158, 11, 0.2) 100%);
    box-shadow: inset 0 1px 2px rgba(245, 158, 11, 0.3);
}

.routetime-card[data-spread="very-wide"] .routetime-concentration-zone {
    background: linear-gradient(90deg, 
        rgba(239, 68, 68, 0.15) 0%, 
        rgba(239, 68, 68, 0.4) 50%, 
        rgba(239, 68, 68, 0.15) 100%);
    box-shadow: inset 0 1px 2px rgba(239, 68, 68, 0.3);
}

/* Route Time Quartile Tick Marks */
.routetime-tick {
    position: absolute;
    width: 2px;
    height: 14px;
    top: -2px;
    background: rgba(100, 116, 139, 0.4);
    border-radius: 1px;
    transform: translateX(-50%);
    transition: left 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Route Time Diamond Indicator */
.routetime-indicator-diamond {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    color: #0f172a;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    transition: left 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 3;
    cursor: pointer;
}

.routetime-indicator-diamond:hover {
    transform: translate(-50%, -50%) scale(1.3);
}

.routetime-indicator-diamond svg {
    display: block;
}

/* Route Time Strip Labels */
.routetime-strip-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    font-weight: 600;
    color: #94a3b8;
    margin-top: 4px;
}

.routetime-min-label,
.routetime-max-label {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    min-width: 32px;
}

.routetime-min-label {
    text-align: left;
}

.routetime-max-label {
    text-align: right;
}

/* ============================================
   WORKLOAD TOOLTIP STYLES
   ============================================ */
.workload-tooltip {
    position: fixed;
    background: white;
    border-radius: 12px;
    padding: 0;
    min-width: 180px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-100%);
    transition: opacity 0.15s ease, visibility 0.15s ease;
    overflow: hidden;
}

.workload-tooltip.visible {
    opacity: 1;
    visibility: visible;
}

.workload-tooltip-header {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: white;
    padding: 12px 14px;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.workload-tooltip-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

.workload-tooltip-unit {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
}

.workload-tooltip-body {
    padding: 10px 14px;
}

.workload-tooltip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.workload-tooltip-row:not(:last-child) {
    border-bottom: 1px solid #f1f5f9;
}

.workload-tooltip-label {
    font-size: 11px;
    color: #64748b;
    font-weight: 500;
}

.workload-tooltip-data {
    font-size: 12px;
    color: #0f172a;
    font-weight: 600;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
}

.workload-tooltip-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.workload-tooltip-badge[data-spread="tight"] {
    background: #d1fae5;
    color: #059669;
}

.workload-tooltip-badge[data-spread="moderate"] {
    background: #dbeafe;
    color: #2563eb;
}

.workload-tooltip-badge[data-spread="wide"] {
    background: #fef3c7;
    color: #d97706;
}

.workload-tooltip-badge[data-spread="varied"] {
    background: #fee2e2;
    color: #dc2626;
}

.workload-tooltip-footer {
    font-size: 10px;
    color: #94a3b8;
    padding-top: 8px;
    margin-top: 4px;
    border-top: 1px dashed #e2e8f0;
    text-align: center;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
}

/* Line Chart for Solver Time */
.summary-kpi-histogram {
    height: 44px;
    margin: 8px 0;
    position: relative;
}

.solver-line-chart {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.solver-line-path {
    fill: none;
    stroke: url(#solverGradient);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.solver-line-area {
    fill: url(#solverAreaGradient);
    opacity: 0.3;
}

.solver-line-point {
    fill: white;
    stroke: #f43f5e;
    stroke-width: 2;
    cursor: pointer;
    transition: all 0.2s ease;
    r: 3;
}

.solver-line-point:hover {
    r: 5;
    stroke-width: 3;
    filter: drop-shadow(0 2px 4px rgba(244, 63, 94, 0.4));
}

.solver-tooltip {
    position: absolute;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 11px;
    line-height: 1.5;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: all 0.2s ease;
    z-index: 20;
    max-width: 180px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.solver-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.solver-tooltip-value {
    font-size: 14px;
    font-weight: 700;
    color: #fda4af;
    display: block;
    margin-bottom: 4px;
}

.solver-tooltip-label {
    color: #94a3b8;
    font-size: 10px;
    display: block;
    margin-bottom: 2px;
}

.solver-tooltip-explanation {
    color: #e2e8f0;
    font-size: 11px;
}

/* KPI Meta Text */
.summary-kpi-meta {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
}

/* Enhanced Insight Callout */
.summary-panel-enhanced .insight-callout {
    margin-top: 20px;
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
    border: 1px solid #fde047;
    border-radius: 12px;
    padding: 14px 16px;
}

.summary-panel-enhanced .insight-text {
    font-size: 13px;
    color: #854d0e;
    line-height: 1.5;
}

.summary-panel-enhanced .insight-icon .material-icons {
    color: #ca8a04;
}

/* Insight Callouts */
.insight-callout {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: #fefce8;
    border: 1px solid #fef08a;
    border-radius: 8px;
    margin-top: 16px;
}

.insight-icon {
    font-size: 16px;
}

.insight-text {
    font-size: 13px;
    color: #854d0e;
    line-height: 1.5;
}

/* Tablet: Narrower sidebar (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .trends-layout {
        grid-template-columns: 160px 1fr;
        gap: 16px;
    }
    
    .nav-pill {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .kpi-card {
        padding: 12px;
    }
    
    .kpi-card-value {
        font-size: 18px;
    }
}

/* Mobile: Bottom navigation (<768px) */
@media (max-width: 767px) {
    .trends-layout {
        grid-template-columns: 1fr;
    }
    
    .trends-sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        max-height: none;
        height: auto;
        background: white;
        border-top: 1px solid #e2e8f0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
        padding: 8px;
        z-index: 100;
        gap: 0;
    }
    
    .trends-nav {
        flex-direction: row;
        justify-content: space-around;
        padding: 0;
        background: transparent;
        box-shadow: none;
        border: none;
        gap: 0;
    }
    
    .nav-pill {
        flex-direction: column;
        padding: 8px 4px;
        font-size: 11px;
        gap: 4px;
        text-align: center;
        flex: 1;
        min-width: 0;
    }
    
    .nav-pill .nav-emoji {
        font-size: 18px;
    }
    
    .nav-pill .nav-text {
        display: none;
    }
    
    .sidebar-kpis {
        display: none;
    }
    
    .trends-main {
        padding-bottom: 80px;
    }
    
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========================================
   BALANCE TAB - Phase 3 Enhancements
   ======================================== */

/* Balance Badge Cards */
.balance-badges {
    margin-bottom: 24px;
}

.badge-card {
    transition: all 200ms ease;
}

.badge-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* Status Dots */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.status-good {
    background-color: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

.status-dot.status-warning {
    background-color: #f59e0b;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}

.status-dot.status-bad {
    background-color: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

.status-dot.status-unknown {
    background-color: #9ca3af;
}

/* Trend Indicators for Cost Badges */
.trend-indicator {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 200ms ease;
}

.trend-indicator.cost-up {
    color: #ef4444;  /* Red - cost increasing is bad */
    background-color: rgba(239, 68, 68, 0.1);
}

.trend-indicator.cost-down {
    color: #10b981;  /* Green - cost decreasing is good */
    background-color: rgba(16, 185, 129, 0.1);
}

.trend-indicator.cost-stable {
    color: #64748b;
    background-color: rgba(100, 116, 139, 0.1);
}

/* Cost-specific badge card styles */
.cost-badges .badge-card {
    transition: all 200ms ease;
}

.cost-badges .badge-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

/* Chart Card for Balance Tab */
.chart-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    transition: all 200ms ease;
}

.chart-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.chart-card-header {
    padding: 16px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
}

.chart-card-legend {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: #64748b;
}

.chart-card-body {
    padding: 16px;
}

/* Balance chart specific styles */
.balance-chart-container {
    position: relative;
    min-height: 280px;
}

/* Legend indicator dots */
.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.legend-line {
    width: 20px;
    height: 3px;
    border-radius: 2px;
    display: inline-block;
}

/* ========================================
   PHASE 6: Statistical Insights
   ======================================== */

/* Summary Statistics Section */
.stats-section {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: 12px;
    transition: max-height 0.2s ease-out;
}

.stats-section.collapsed .stats-content {
    display: none;
}

.stats-section.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.collapse-icon {
    transition: transform 0.2s ease;
    display: inline-block;
}

.stat-card {
    background: white;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    transition: all 200ms ease;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.stat-label {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

/* Range Gauge Visualization */
.range-gauge {
    margin: 0.75rem 0 0.25rem;
}

.range-gauge-labels {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 6px;
    position: relative;
    min-height: 1.75rem;
}

.range-gauge-min {
    font-size: 0.875rem;
    font-weight: 600;
    color: #0ea5e9;
    text-align: left;
}

.range-gauge-typical {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.125rem;
    font-weight: 700;
    color: #1e293b;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.range-gauge-max {
    font-size: 0.875rem;
    font-weight: 600;
    color: #f97316;
    text-align: right;
}

.range-gauge-track {
    position: relative;
    height: 8px;
    background: linear-gradient(90deg, 
        #e0f2fe 0%, 
        #f1f5f9 50%, 
        #ffedd5 100%
    );
    border-radius: 4px;
    overflow: visible;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

.range-gauge-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, 
        #0ea5e9 0%, 
        #6366f1 50%, 
        #f97316 100%
    );
    border-radius: 4px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.85;
}

.range-gauge-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.range-gauge-marker-dot {
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: 2.5px solid white;
    border-radius: 50%;
    box-shadow: 
        0 2px 6px rgba(99, 102, 241, 0.4),
        0 0 0 2px rgba(99, 102, 241, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover .range-gauge-marker-dot {
    transform: scale(1.15);
    box-shadow: 
        0 3px 10px rgba(99, 102, 241, 0.5),
        0 0 0 3px rgba(99, 102, 241, 0.2);
}

.range-gauge-ticks {
    position: relative;
    height: 4px;
    margin-top: 2px;
}

.range-gauge-tick {
    position: absolute;
    width: 1px;
    height: 4px;
    background: #cbd5e1;
}

.range-gauge-tick-min {
    left: 0;
    background: #0ea5e9;
}

.range-gauge-tick-max {
    right: 0;
    background: #f97316;
}

/* Legacy stat-range support (if still used elsewhere) */
.stat-range {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.stat-min { color: #0ea5e9; }
.stat-typical { color: #1e293b; font-weight: 700; }
.stat-max { color: #f97316; }
.stat-sep { color: #cbd5e1; font-weight: 300; }

.stat-insight {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #64748b;
}

.stat-insight.warning {
    color: #d97706;
    font-weight: 500;
}

.stat-insight.info {
    color: #0369a1;
    font-weight: 500;
}

/* Outlier badges */
.outlier-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 50%;
    font-size: 0.625rem;
    cursor: help;
    margin-left: 4px;
    transition: all 150ms ease;
}

.outlier-badge:hover {
    background: #fde68a;
    transform: scale(1.1);
}

/* Outlier point on charts */
.outlier-point {
    stroke: #ef4444 !important;
    stroke-width: 3px !important;
}

/* Insufficient data warning */
.insufficient-data-banner {
    background: #fefce8;
    border: 1px solid #fde047;
    border-radius: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: #854d0e;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.insufficient-data-banner .icon {
    font-size: 1rem;
}

/* Trend indicator enhanced styling */
.trend-with-threshold {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
}

.trend-with-threshold.up-good {
    color: #16a34a;
    background: rgba(22, 163, 74, 0.1);
}

.trend-with-threshold.up-bad {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.1);
}

.trend-with-threshold.down-good {
    color: #16a34a;
    background: rgba(22, 163, 74, 0.1);
}

.trend-with-threshold.down-bad {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.1);
}

.trend-with-threshold.stable {
    color: #64748b;
    background: rgba(100, 116, 139, 0.1);
}

.trend-with-threshold.insufficient {
    color: #94a3b8;
    background: transparent;
    font-weight: 400;
}

.trend-with-threshold .arrow {
    font-size: 14px;
}

/* Sample size indicator */
.sample-size {
    font-size: 0.65rem;
    color: #94a3b8;
    margin-left: 4px;
}

/* ========================================
   Phase 7: Enhanced Interactivity Styles
   ======================================== */

/* Chart container cursor styles */
.chart-container canvas,
.chart-card canvas,
.balance-chart-container canvas {
    cursor: crosshair;
    transition: cursor 0.1s ease;
}

/* KPI card hover state (shows individual run values) */
.kpi-card-hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(139, 92, 246, 0.08));
    border-color: rgba(59, 130, 246, 0.3);
    animation: kpi-pulse 0.3s ease-out;
}

@keyframes kpi-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Run indicator for hovered KPI cards */
.kpi-card-run-indicator {
    font-size: 0.65rem;
    color: #6366f1;
    font-weight: 500;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Selected comparison run style (ring/outline) */
.chart-point-selected {
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.3);
}

/* Enhanced tooltip styling */
.chartjs-tooltip {
    backdrop-filter: blur(4px);
}

/* Comparison run highlight on charts */
[data-comparison-selected="true"] {
    filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.6));
}

/* ========================================
   Phase 8: Correlation Analysis (Scatter Plots)
   ======================================== */

/* Correlation Introduction Card */
.correlation-intro {
    transition: all 200ms ease;
}

.correlation-intro:hover {
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

/* Correlation Section Headers */
.correlation-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
}

.correlation-section-title .section-icon {
    font-size: 20px;
}

.correlation-section-title .section-subtitle {
    font-size: 13px;
    font-weight: 400;
    color: #64748b;
    margin-left: auto;
}

/* Scatter Plot Grid */
.scatter-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

@media (max-width: 1024px) {
    .scatter-grid {
        grid-template-columns: 1fr;
    }
}

/* Scatter Chart Card */
.scatter-chart-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    transition: all 200ms ease;
}

.scatter-chart-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.scatter-chart-card--insufficient {
    opacity: 0.7;
}

.scatter-chart-card--insufficient:hover {
    transform: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Scatter Chart Header */
.scatter-chart-header {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.scatter-chart-header h5 {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    margin: 0;
}

/* Correlation Display Badge */
.correlation-display {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
}

.correlation-display .corr-value {
    font-family: 'Monaco', 'Consolas', monospace;
    padding: 2px 8px;
    border-radius: 6px;
    background: #f1f5f9;
}

.correlation-display .corr-label {
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Correlation Badge Colors */
.correlation-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.correlation-strong-pos,
.corr-strong-positive {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.correlation-strong-neg,
.corr-strong-negative {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.correlation-moderate,
.corr-moderate-positive,
.corr-moderate-negative {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.correlation-weak,
.corr-weak-positive,
.corr-weak-negative,
.corr-none {
    background: rgba(100, 116, 139, 0.15);
    color: #64748b;
}

/* Scatter Chart Body */
.scatter-chart-body {
    padding: 16px;
    min-height: 220px;
    position: relative;
}

.scatter-chart-body canvas {
    cursor: crosshair;
}

/* Scatter Chart Insight */
.scatter-chart-insight {
    padding: 12px 16px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    font-size: 12px;
    color: #475569;
    line-height: 1.5;
    min-height: 44px;
}

.scatter-chart-insight:empty {
    display: none;
}

/* Insufficient Data Message */
.insufficient-data-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: #94a3b8;
}

.insufficient-data-message .icon {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.6;
}

.insufficient-data-message p {
    margin: 0;
    font-size: 13px;
}

.insufficient-data-message .text-sm {
    font-size: 11px;
    margin-top: 4px;
}

/* Scatter Point Colors by Section */
.scatter-quality-drivers canvas {
    --scatter-point-color: #8b5cf6;
}

.scatter-balance canvas {
    --scatter-point-color: #3b82f6;
}

.scatter-fleet canvas {
    --scatter-point-color: #10b981;
}

.scatter-costs canvas {
    --scatter-point-color: #f59e0b;
}

.scatter-solver canvas {
    --scatter-point-color: #ef4444;
}

/* ========================================
   Route Distribution Charts (Run Detail)
   ======================================== */

/* Distribution summary cards */
.distribution-card {
    transition: all 200ms ease;
}

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

/* Gini coefficient badge styling */
.gini-badge {
    font-family: 'Monaco', 'Consolas', 'SF Mono', monospace;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 999px;
    transition: all 200ms ease;
}

.gini-badge.gini-good {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.gini-badge.gini-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.gini-badge.gini-bad {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

/* Gini badge hover state */
.gini-badge-tooltip {
    transition: all 0.15s ease;
}

.gini-badge-tooltip:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Gini tooltip popup (JavaScript-controlled) */
.gini-tooltip-popup {
    position: fixed;
    z-index: 9999;
    width: 280px;
    padding: 14px 16px;
    background: #ffffff;
    color: #1e293b;
    font-family: system-ui, -apple-system, sans-serif;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08);
    pointer-events: none;
    animation: tooltipFadeIn 0.15s ease-out;
}

.gini-tooltip-popup.hidden {
    display: none;
}

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

.gini-tooltip-title {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

.gini-tooltip-desc {
    font-size: 12px;
    font-weight: 400;
    color: #475569;
    line-height: 1.5;
    margin-bottom: 12px;
}

.gini-tooltip-scale {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid #e2e8f0;
}

.gini-tooltip-scale .scale-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #64748b;
}

.gini-tooltip-scale .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.gini-tooltip-scale .dot.good {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

.gini-tooltip-scale .dot.fair {
    background: #f59e0b;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}

.gini-tooltip-scale .dot.poor {
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

/* Gini gauge mini-chart */
.gini-gauge {
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.gini-gauge:hover {
    transform: scale(1.15);
}

.gini-gauge .gauge-bg {
    opacity: 0.4;
}

.gini-gauge .gauge-fill {
    transition: stroke-dasharray 0.4s ease-out, stroke 0.3s ease;
    transform-origin: center;
}

/* Distribution chart containers */
#distribution-charts-section .h-48 {
    min-height: 192px;
}

/* Chart bar hover enhancement */
#distribution-charts-section canvas {
    cursor: pointer;
}

/* Responsive adjustments for distribution charts */
@media (max-width: 1024px) {
    #distribution-charts-section .grid-cols-2 {
        grid-template-columns: 1fr;
    }
}

/* Animation for chart loading */
@keyframes chartFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#distribution-charts-section .bg-gray-50\/50 {
    animation: chartFadeIn 0.4s ease-out forwards;
}

#distribution-charts-section .bg-gray-50\/50:nth-child(1) { animation-delay: 0ms; }
#distribution-charts-section .bg-gray-50\/50:nth-child(2) { animation-delay: 100ms; }
#distribution-charts-section .bg-gray-50\/50:nth-child(3) { animation-delay: 200ms; }
#distribution-charts-section .bg-gray-50\/50:nth-child(4) { animation-delay: 300ms; }

/* ========================================
   RUN DETAIL - Enhanced Quality & Task Charts
   ======================================== */

/* Quality Metric Items */
.quality-metric-item {
    padding: 8px 10px;
    border-radius: 8px;
    background: linear-gradient(135deg, #fafafa 0%, #f8fafc 100%);
    border: 1px solid transparent;
    transition: all 200ms ease;
}

.quality-metric-item:hover {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-color: rgba(100, 116, 139, 0.1);
    transform: translateX(2px);
}

/* Task Type Row */
.task-type-row {
    border: 1px solid transparent;
    transition: all 150ms ease;
}

.task-type-row:hover {
    border-color: rgba(100, 116, 139, 0.1);
    background: #f8fafc;
}

/* Mini Workload Bars in Route Table */
.workload-mini-chart {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.workload-bar-container {
    display: flex;
    align-items: center;
    gap: 6px;
}

.workload-bar-track {
    flex: 1;
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
}

.workload-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.workload-bar-fill.tasks {
    background: linear-gradient(90deg, #0f58a8 0%, #1e6fc9 100%);
}

.workload-bar-fill.time {
    background: linear-gradient(90deg, #7c3aed 0%, #8b5cf6 100%);
}

.workload-indicator {
    font-size: 9px;
    font-weight: 600;
    width: 12px;
    text-align: center;
}

.workload-indicator.above { color: #0f58a8; }
.workload-indicator.below { color: #94a3b8; }

/* Quality Insight Box */
#quality-insight {
    animation: slideInFade 0.4s ease-out forwards;
}

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

/* Enhanced Route Table Hover */
#routes-table tr {
    transition: all 150ms ease;
}

#routes-table tr:hover {
    background: linear-gradient(90deg, rgba(15, 88, 168, 0.02) 0%, rgba(139, 92, 246, 0.02) 100%);
}

#routes-table tr:hover td:first-child {
    color: #0f58a8;
}

/* Workload Tooltip Popup */
.workload-tooltip-popup {
    position: fixed;
    z-index: 9999;
    width: 320px;
    background: #ffffff;
    color: #1e293b;
    font-family: system-ui, -apple-system, sans-serif;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08);
    pointer-events: none;
    animation: workloadTooltipFadeIn 0.15s ease-out;
    overflow: hidden;
}

.workload-tooltip-popup.hidden {
    display: none;
}

@keyframes workloadTooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-8px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.workload-tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.workload-tooltip-title {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
}

.workload-tooltip-title .route-num {
    color: #2563eb;
}

.workload-tooltip-balance {
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 6px;
}

.workload-tooltip-balance.balanced {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

.workload-tooltip-balance.slight {
    background: rgba(250, 204, 21, 0.15);
    color: #ca8a04;
}

.workload-tooltip-balance.imbalanced {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.workload-tooltip-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: #e2e8f0;
}

.workload-tooltip-metric {
    padding: 10px 12px;
    background: #ffffff;
}

.workload-tooltip-metric .metric-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.workload-tooltip-metric .metric-icon {
    font-size: 16px;
    color: #64748b;
}

.workload-tooltip-metric .metric-icon.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}

.workload-tooltip-metric .metric-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
}

.workload-tooltip-metric .metric-values {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 2px;
}

.workload-tooltip-metric .metric-value {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
}

.workload-tooltip-metric .metric-delta {
    font-size: 10px;
    font-weight: 500;
}

.workload-tooltip-metric .metric-delta.positive {
    color: #dc2626;
}

.workload-tooltip-metric .metric-delta.negative {
    color: #16a34a;
}

.workload-tooltip-metric .metric-delta.neutral {
    color: #64748b;
}

.workload-tooltip-metric .metric-context {
    font-size: 10px;
    color: #94a3b8;
}

.workload-tooltip-footer {
    padding: 8px 14px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.workload-tooltip-trigger {
    cursor: help;
}

/* Task Type Completion Badges */
.completion-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 600;
}

.completion-badge.complete {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.completion-badge.partial {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.completion-badge.low {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

/* Responsive adjustments for quality breakdown */
@media (max-width: 640px) {
    .quality-metric-item {
        padding: 6px 8px;
    }
    
    .quality-metric-item p {
        display: none;
    }
}

/* Print styles */
@media print {
    nav, footer, .no-print {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .shadow {
        box-shadow: none !important;
        border: 1px solid #e5e7eb;
    }
    
    .trends-sidebar {
        display: none;
    }
    
    .trends-layout {
        grid-template-columns: 1fr;
    }
    
    .scatter-chart-card {
        break-inside: avoid;
    }
    
    .quality-metric-item {
        background: #f8fafc;
        border: 1px solid #e5e7eb;
    }
    
    #quality-insight {
        border: 1px solid #e5e7eb;
    }
}

