/* FEAT-365 — Fuel Efficiency page + shared receipt modal */

/* ── Page layout ──────────────────────────────────────────────────────────── */
.fe-page { padding: 16px; max-width: 1400px; }

.fe-header { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.fe-page-title { margin: 0; font-size: 1.25rem; font-weight: 700; }

/* Fleet tiles */
.fe-fleet-tiles { display: flex; gap: 12px; flex-wrap: wrap; }
.fe-fleet-tile { background: var(--card-bg, #1e2028); border-radius: 8px; padding: 10px 16px;
                 display: flex; align-items: center; gap: 8px; min-width: 160px; }
.fe-tile-label { font-size: 0.78rem; color: var(--text-muted, #8899aa); }
.fe-tile-value { font-size: 1.1rem; font-weight: 600; }

/* Filter bar */
.fe-filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
                  margin-bottom: 12px; }
.fe-filter-item { display: flex; flex-direction: column; gap: 4px; }
.fe-filter-label { font-size: 0.78rem; color: var(--text-muted, #8899aa); }
.fe-filter-dd { min-width: 150px; }
.fe-apply-btn { padding: 6px 18px; background: #0d6efd; color: #fff; border: none;
                border-radius: 6px; cursor: pointer; font-weight: 600; align-self: flex-end; }
.fe-apply-btn:hover { background: #0b5ed7; }

/* Tabs — override Dash defaults for dark/light readability */
.fe-tab {
    background: var(--card-bg, #1e2028) !important;
    color: var(--text-muted, #8899aa) !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: 2px solid transparent !important;
    padding: 8px 16px !important;
}
.fe-tab:hover {
    color: var(--text, #e0e6ef) !important;
    background: rgba(255,255,255,.05) !important;
}
.fe-tabs .tab--selected, .fe-tab-selected {
    background: var(--card-bg, #1e2028) !important;
    color: var(--text, #e0e6ef) !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: 2px solid #0d6efd !important;
    font-weight: 600 !important;
}
body[data-theme="light"] .fe-tab {
    background: #fff !important;
    color: var(--text-muted, #6c757d) !important;
}
body[data-theme="light"] .fe-tab:hover { background: #f8f9fa !important; }
body[data-theme="light"] .fe-tab-selected,
body[data-theme="light"] .fe-tabs .tab--selected {
    background: #fff !important;
    color: var(--text, #212529) !important;
}
.fe-tab-body { padding: 12px 0; overflow-x: auto; }

/* Table */
.fe-table { width: 100%; border-collapse: collapse; }
.fe-table td, .fe-table th { padding: 6px 10px; font-size: 0.85rem; }

/* Band pill */
.fuel-band-pill { display: inline-block; }

/* Drill banner */
.fe-drill-banner { margin-bottom: 8px; }
.fe-drill-banner-content { display: flex; align-items: center; gap: 10px; padding: 6px 12px;
                             background: rgba(13,110,253,.12); border-radius: 6px;
                             font-size: 0.85rem; }
.fe-drill-btn { font-size: 0.78rem; padding: 2px 8px; background: transparent;
                border: 1px solid #0d6efd; color: #0d6efd; border-radius: 4px; cursor: pointer; }
.fe-drill-btn:hover { background: rgba(13,110,253,.15); }
.fe-drill-clear-btn { font-size: 0.78rem; padding: 2px 8px; background: transparent;
                       border: 1px solid #dc3545; color: #dc3545; border-radius: 4px; cursor: pointer; }
.fe-drill-clear-btn:hover { background: rgba(220,53,69,.15); }

/* Export bar */
.tk-export-bar { display: flex; gap: 8px; margin-bottom: 8px; }

/* Rules tab */
.fe-rules-wrap { display: flex; flex-direction: column; gap: 16px; }
.fe-rule-key   { font-family: monospace; font-size: 0.82rem; }
.fe-rule-value { font-weight: 600; }
.fe-rule-edit-form { background: var(--card-bg, #1e2028); padding: 14px; border-radius: 8px; }
.fe-rule-edit-heading { margin: 0 0 4px; }
.fe-rule-edit-note    { font-size: 0.82rem; color: var(--text-muted, #8899aa); margin-bottom: 10px; }
.fe-save-ok  { color: #198754; font-size: 0.85rem; margin-left: 8px; }
.fe-save-err { color: #dc3545; font-size: 0.85rem; margin-left: 8px; }

/* Driver detail overlay */
.fe-driver-overlay {
    position: fixed; inset: 0; z-index: 3000;
    background: rgba(0,0,0,.6);
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.fe-driver-dialog {
    background: var(--card-bg, #1e2028);
    border-radius: 10px;
    width: 100%; max-width: 900px;
    max-height: 92vh;
    display: flex; flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
}
.fe-driver-dialog-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border, #2a2d35);
    flex-shrink: 0;
}
.fe-driver-dialog-title { font-size: 1rem; font-weight: 600; }
.fe-driver-dialog-body { padding: 12px 16px; overflow-y: auto; flex: 1; }
.fe-driver-plate-bar { padding: 8px 16px; flex-shrink: 0; border-bottom: 1px solid var(--border, #2a2d35); }
body[data-theme="light"] .fe-driver-dialog { background: #fff; }
body[data-theme="light"] .fe-driver-dialog-header { border-color: #dee2e6; }
body[data-theme="light"] .fe-driver-plate-bar { border-color: #dee2e6; }

/* Search bars */
.fe-search-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.fe-search-input {
    flex: 1; min-width: 180px; max-width: 340px;
    padding: 5px 10px; border-radius: 6px; font-size: 0.85rem;
    border: 1px solid var(--border, #3a3d45);
    background: var(--input-bg, #2a2d35); color: var(--text, #e0e6ef);
}
body[data-theme="light"] .fe-search-input {
    background: #fff; color: #212529; border-color: #ced4da;
}
.fe-search-btn {
    padding: 5px 14px; font-size: 0.85rem; font-weight: 600;
    background: #0d6efd; color: #fff; border: none; border-radius: 6px; cursor: pointer;
}
.fe-search-btn:hover { background: #0b5ed7; }
.fe-search-clear-btn {
    padding: 5px 12px; font-size: 0.85rem;
    background: transparent; border: 1px solid #6c757d; color: #6c757d;
    border-radius: 6px; cursor: pointer;
}
.fe-search-clear-btn:hover { background: rgba(108,117,125,.15); }

/* Gaps note */
.fe-gaps-note { font-size: 0.82rem; color: var(--text-muted, #8899aa); margin-bottom: 8px; }

/* Action pills */
.fuel-action-counsel { background: #dc3545; color: #fff; padding: 2px 8px;
                        border-radius: 10px; font-size: 0.78rem; font-weight: 600; }
.fuel-action-watch   { background: #fd7e14; color: #fff; padding: 2px 8px;
                        border-radius: 10px; font-size: 0.78rem; font-weight: 600; }

/* Empty / error states */
.fe-empty-state { padding: 32px; text-align: center; color: var(--text-muted, #8899aa); }
.fe-error-state { padding: 16px; color: #dc3545; background: rgba(220,53,69,.08);
                   border-radius: 6px; }

/* ── Receipt modal ────────────────────────────────────────────────────────── */
.fuel-receipt-overlay {
    position: fixed; inset: 0; z-index: 3000;
    background: rgba(0,0,0,.6);
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.fuel-receipt-dialog {
    background: var(--card-bg, #1e2028);
    border-radius: 10px;
    width: 100%; max-width: 640px;
    max-height: 90vh;
    display: flex; flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
}
.fuel-receipt-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border, #2a2d35);
}
.fuel-receipt-title-text { font-size: 1rem; font-weight: 600; }
.fuel-receipt-close-btn {
    background: transparent; border: none; cursor: pointer;
    color: var(--text-muted, #8899aa); font-size: 1.1rem; padding: 4px 8px;
    border-radius: 4px;
}
.fuel-receipt-close-btn:hover { background: rgba(255,255,255,.1); }
.fuel-receipt-body { padding: 16px; overflow-y: auto; flex: 1; }
.fuel-receipt-content { display: flex; flex-direction: column; gap: 16px; }
.fuel-receipt-img-label { font-size: 0.82rem; color: var(--text-muted, #8899aa);
                            margin: 0 0 6px; }
.fuel-receipt-img { width: 100%; max-width: 100%; border-radius: 6px; display: block; }
.fuel-receipt-img-error { padding: 12px; background: rgba(220,53,69,.1); color: #dc3545;
                            border-radius: 6px; font-size: 0.85rem; }
.fuel-receipt-footer { padding: 10px 16px;
                         border-top: 1px solid var(--border, #2a2d35); }
.fe-receipt-footer-links { display: flex; gap: 12px; flex-wrap: wrap; }
.fuel-receipt-dl-link { font-size: 0.85rem; color: #0d6efd; text-decoration: none; }
.fuel-receipt-dl-link:hover { text-decoration: underline; }

/* View receipt button (in tables) */
.fuel-receipt-view-btn {
    font-size: 0.76rem; padding: 2px 8px;
    background: transparent; border: 1px solid #0d6efd; color: #0d6efd;
    border-radius: 4px; cursor: pointer; white-space: nowrap;
    margin: 1px;
}
.fuel-receipt-view-btn:hover { background: rgba(13,110,253,.15); }

/* Light theme overrides */
body[data-theme="light"] .fe-fleet-tile { background: #f8f9fa; }
body[data-theme="light"] .fe-rule-edit-form { background: #f8f9fa; }
body[data-theme="light"] .fuel-receipt-dialog { background: #fff; }
body[data-theme="light"] .fuel-receipt-header { border-color: #dee2e6; }
body[data-theme="light"] .fuel-receipt-footer { border-color: #dee2e6; }

/* Bands legend (Rules tab) */
.fe-bands-legend {
    background: var(--card-bg, #1e2028);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 14px;
}
.fe-legend-rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.fe-legend-row  { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fe-legend-meaning { font-size: 0.82rem; color: var(--text, #e0e6ef); }
.fe-legend-note { font-size: 0.78rem; color: var(--text-muted, #8899aa); margin: 0; }
body[data-theme="light"] .fe-bands-legend { background: #f8f9fa; }
body[data-theme="light"] .fe-legend-meaning { color: var(--text, #212529); }

/* "What do the bands mean?" header link */
.fe-what-bands-btn {
    font-size: 0.78rem; padding: 2px 10px;
    background: transparent; border: 1px solid #0d6efd; color: #0d6efd;
    border-radius: 12px; cursor: pointer; white-space: nowrap;
}
.fe-what-bands-btn:hover { background: rgba(13,110,253,.12); }

/* Active drill banner — prominent */
.fe-drill-banner-active {
    background: rgba(13,110,253,.22) !important;
    border: 1px solid rgba(13,110,253,.4);
    font-weight: 600;
}

/* ── Route benchmarks section (FEAT-366) ─────────────────────────────────── */
.fe-bench-divider { margin: 20px 0 12px; border: none; border-top: 1px solid var(--border, #2a2d35); }
body[data-theme="light"] .fe-bench-divider { border-color: #dee2e6; }
.fe-bench-heading { margin: 0 0 8px; font-size: 0.95rem; font-weight: 700; }
.fe-bench-header-line { font-size: 0.82rem; color: var(--text-muted, #8899aa); margin-bottom: 8px; }
.fe-bench-actions { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.fe-bench-generate-btn {
    padding: 6px 18px; background: #198754; color: #fff;
    border: none; border-radius: 6px; cursor: pointer; font-weight: 600;
}
.fe-bench-generate-btn:hover:not(:disabled) { background: #157347; }
.fe-bench-generate-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.fe-bench-generate-msg { font-size: 0.85rem; }
.fe-bench-save-msg { font-size: 0.82rem; margin-bottom: 6px; min-height: 1.2em; }
.fe-bench-section-wrap { overflow-x: auto; }
.fe-bench-manual-cell { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.fe-bench-manual-input {
    width: 70px; padding: 3px 6px; font-size: 0.82rem;
    border-radius: 4px; border: 1px solid var(--border, #3a3d45);
    background: var(--input-bg, #2a2d35); color: var(--text, #e0e6ef);
}
body[data-theme="light"] .fe-bench-manual-input { background: #fff; color: #212529; border-color: #ced4da; }
.fe-bench-save-btn {
    font-size: 0.78rem; padding: 2px 8px;
    background: #0d6efd; color: #fff; border: none; border-radius: 4px; cursor: pointer;
}
.fe-bench-save-btn:hover { background: #0b5ed7; }
.fe-bench-clear-btn {
    font-size: 0.78rem; padding: 2px 8px;
    background: transparent; border: 1px solid #6c757d; color: #6c757d;
    border-radius: 4px; cursor: pointer;
}
.fe-bench-clear-btn:hover { background: rgba(108,117,125,.15); }

/* Source pill — shared between Rules benchmarks table and Routes tab */
.fe-source-pill { display: inline-block; }

/* FEAT-367: Fill source pills (Bus-days Source column) */
.fe-fill-source-pill { display: inline-block; }

/* FEAT-367: Source filter bar on Bus-days tab */
.fe-fills-source-bar { margin-bottom: 6px; }

/* Routes tab legend */
.fe-routes-legend { margin-bottom: 6px; }
.fe-routes-legend-text { font-size: 0.82rem; color: var(--text-muted, #8899aa); margin: 0; }

/* 390px responsive */
@media (max-width: 390px) {
    .fe-filter-bar    { flex-direction: column; }
    .fe-fleet-tiles   { flex-direction: column; }
    .fe-tab-body      { padding: 8px 0; }
    .fe-tab           { padding: 6px 8px !important; font-size: 0.78rem !important; }
    .fuel-receipt-dialog { max-height: 95vh; }
    .fe-legend-rows   { gap: 8px; }
    .fe-legend-row    { gap: 6px; }
    .fe-driver-dialog { max-height: 95vh; }
    .fe-search-input  { min-width: 140px; max-width: 100%; }
    .fe-search-bar    { flex-direction: row; }
    .fe-bench-generate-btn { width: 100%; }
    .fe-bench-section-wrap { overflow-x: auto; }
    .fe-bench-manual-cell  { flex-direction: column; }
}

/* FEAT-367: in-house tank rows have no station receipt by design */
.fe-muted { color: #8a93a0; font-style: italic; }
