/* =========================================================
   PilotMetrics - Fleet (admin-fleet.html and school-fleet.html, scripts/fleet.js)
   Builds on instructor.css (stats, tables). Not on admin.css: School Fleet is a school page
   ========================================================= */

.flt-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.flt-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.flt-filters select { width: auto; }
.flt-scroll { max-height: 520px; overflow-y: auto; }
.flt-scroll thead th { position: sticky; top: 0; z-index: 1; }
.flt-table td { vertical-align: top; }

/* Service and maintenance statuses */
.flt-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  border: 1px solid var(--line);
  color: var(--muted);
}
.flt-badge.good { background: var(--green-light); color: var(--green-text); border-color: rgba(16, 185, 129, 0.35); }
.flt-badge.warn { background: var(--amber-light); color: var(--alert-soon); border-color: rgba(245, 158, 11, 0.4); }
.flt-badge.bad { background: var(--danger-light); color: var(--danger-text); border-color: rgba(239, 68, 68, 0.45); }
.flt-badge.pro { color: var(--text-soft); border-color: rgba(167, 139, 250, 0.45); }

.flt-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.flt-bar select { width: auto; }
.flt-tabs { display: flex; gap: 6px; }
.flt-tabs [aria-selected="true"] { background: var(--cyan-light); color: #fff; border-color: var(--cyan); }
.flt-dates { display: flex; gap: 6px; align-items: center; color: var(--muted); }
.flt-dates input { width: auto; }
.flt-dates.hidden { display: none; }
.flt-check { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text-soft); cursor: pointer; }
.flt-check input { width: 16px; height: 16px; }
.flt-harvest { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.flt-harvest small { color: var(--muted); font-size: 12px; }
.flt-note { margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.flt-note.warn { color: var(--alert-soon); }
.flt-note.bad { color: var(--danger-text); }
body.flt-loading :is(#adminContent, #schoolContent) > section:not(:first-child) { opacity: 0.55; transition: opacity 0.15s ease; }

.flt-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }
.flt-meter { height: 8px; min-width: 90px; border-radius: 4px; background: var(--line); overflow: hidden; }
.flt-meter span { display: block; height: 100%; border-radius: 4px; background: var(--green); }
.flt-meter.warn span { background: var(--amber); }
.flt-meter.bad span { background: var(--danger); }

.flt-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.flt-chart { margin: 0; min-width: 0; }
.flt-chart figcaption { margin-bottom: 6px; font-size: 12px; font-weight: 700; color: #e2e8f0; }
.flt-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.flt-grid { stroke: var(--line); stroke-width: 1; }
.flt-axis { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.flt-hit { fill: transparent; cursor: crosshair; }
.flt-hit:hover { fill: rgba(148, 163, 184, 0.06); }
.flt-cross { stroke: var(--line-light); stroke-width: 1; }
.flt-cross.hidden { display: none; }
.flt-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--text-soft); }
.flt-table-view { margin-top: 12px; }
.flt-table-view summary { cursor: pointer; font-size: 12px; font-weight: 700; color: var(--cyan); }
.flt-tip {
  position: fixed; z-index: 50; min-width: 150px; padding: 8px 10px; border-radius: 8px; pointer-events: none;
  background: var(--inset); border: 1px solid var(--line-light); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45); font-size: 12px; color: var(--text-soft);
}
.flt-tip.hidden { display: none; }
.flt-tip b { display: block; margin-bottom: 4px; color: #fff; }
.flt-tip div { display: flex; align-items: center; }
.flt-tip span { margin-left: auto; padding-left: 12px; color: #fff; font-variant-numeric: tabular-nums; }
.flt-tip-total { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); }

.flt-hbars { display: flex; flex-direction: column; gap: 8px; }
.flt-hbar { display: grid; grid-template-columns: 130px minmax(0, 1fr) 80px; gap: 10px; align-items: center; font-size: 12px; }
.flt-hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-soft); }
.flt-hbar-track { height: 10px; }
.flt-hbar-track span { display: block; height: 100%; border-radius: 0 4px 4px 0; background: #3987e5; }
.flt-hbar-value { text-align: right; color: #fff; font-variant-numeric: tabular-nums; }
.flt-hbar-value small { color: var(--muted); }
.flt-own { margin-top: 12px; font-size: 12px; color: var(--text-soft); }
.flt-own p { margin: 4px 0; }
.flt-sortable th[data-sort] { cursor: pointer; user-select: none; }
.flt-sortable th[data-dir="asc"]::after { content: ' ▲'; }
.flt-sortable th[data-dir="desc"]::after { content: ' ▼'; }

@media (max-width: 900px) {
  .flt-charts { grid-template-columns: 1fr; }
  .flt-harvest { margin-left: 0; }
  .flt-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .flt-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flt-filters { width: 100%; }
  .flt-filters select { flex: 1 1 auto; }
  /* instructor.css hides the students table's 5th and 6th columns on phones; keep every fleet column */
  .ins-table.flt-table th:nth-child(n), .ins-table.flt-table td:nth-child(n) { display: table-cell; }
}

/* By base: the base chosen above, and each base's hours as a bar stacked by type */
.flt-table tr.flt-chosen td, .flt-heat tr.flt-chosen td { background: rgba(57, 135, 229, 0.08); }
.flt-stack { display: flex; gap: 2px; height: 8px; min-width: 120px; border-radius: 4px; overflow: hidden; }
.flt-stack span { display: block; height: 100%; }

/* Hour by hour: a heatmap table, one shade of blue for aircraft in the air */
.flt-heat { width: 100%; border-collapse: separate; border-spacing: 2px; font-size: 12px; font-variant-numeric: tabular-nums; }
.flt-heat th { padding: 4px 2px; font-weight: 700; color: var(--muted); text-align: center; }
.flt-heat th:first-child, .flt-heat td:first-child { text-align: left; padding-right: 10px; white-space: nowrap; color: var(--text-soft); }
.flt-heat td.num, .flt-heat th.num { text-align: right; padding-left: 8px; color: var(--muted); }
.flt-hcell { min-width: 30px; height: 30px; padding: 0 2px; border-radius: 4px; background: rgba(148, 163, 184, 0.05); text-align: center; color: var(--muted); cursor: crosshair; }
.flt-hcell.strong { color: #fff; font-weight: 700; }
.flt-heat-all td { border-top: 1px solid var(--line); }
.flt-heat-all td:first-child { padding-top: 8px; }
