/* =========================================================
   PilotMetrics - Pro cards
   The Pro cards on the free pages (Flights, Pace, Progress, Experience) and the Logbook.
   Only classes of their own: nothing here restyles the page around them.
   ========================================================= */

.pace-hero-card {
  background: linear-gradient(135deg, rgba(19, 28, 46, 0.95), rgba(23, 35, 58, 0.95));
  border: 1px solid rgba(139, 92, 246, 0.3);
  position: relative;
  overflow: hidden;
}

.pace-hero-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--purple), var(--cyan), var(--green));
}

.pace-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 14px;
}

@media (max-width: 768px) {
  .pace-metric-grid { grid-template-columns: repeat(2, 1fr); }
}

.pace-stat-box {
  background: #0f172a;
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
}

.pace-stat-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.pace-stat-val {
  font-size: 18px;
  font-weight: 900;
  color: #fff;
}

.pace-stat-sub {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}

.progress-track {
  width: 100%;
  height: 12px;
  background: #0f172a;
  border: 1px solid var(--line-light);
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  margin: 10px 0 4px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--cyan));
  border-radius: 20px;
  transition: width 0.5s ease-out;
}

.pace-badge-chip {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
}

.v-optimal { background: var(--green-light); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.v-moderate { background: var(--amber-light); color: #facc15; border: 1px solid rgba(245,158,11,0.3); }
.v-lethargic { background: var(--danger-light); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }

/* Aircraft Experience: one tile per aircraft type */
.ac-subhead {
  margin: 12px 0 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.ac-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.ac-type {
  min-width: 0;
  padding: 10px 12px;
  background: #0f172a;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}

/* One line, so every tile's hours line up; the full name shows on hover */
.ac-type-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 800;
  color: var(--cyan);
}

.ac-type.unknown .ac-type-name {
  color: var(--muted);
}

.ac-type-hours {
  margin: 2px 0 6px;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
}

.ac-type-meta {
  display: grid;
  gap: 1px;
  font-size: 11px;
  color: var(--muted);
}

.ac-type-empty {
  grid-column: 1 / -1;
  padding: 12px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.ac-diversity {
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}

.ac-diversity b {
  color: #fff;
}

/* Instructor hours over time: stacked monthly columns */
.inst-story {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

.inst-story:empty {
  display: none;
}

.inst-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-bottom: 6px;
}

.inst-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #cbd5e1;
}

.inst-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: 0 0 auto;
}

.inst-chart {
  position: relative;
  width: 100%;
}

.inst-chart svg {
  display: block;
}

.inst-grid {
  stroke: var(--line);
  stroke-width: 1;
}

.inst-grid.base {
  stroke: var(--line-light);
}

.inst-tick {
  font-size: 10px;
  fill: var(--muted);
  font-variant-numeric: tabular-nums;
}

.inst-hit {
  fill: transparent;
  cursor: default;
}

.inst-hit.active {
  fill: rgba(255, 255, 255, 0.04);
}

.inst-tooltip {
  position: absolute;
  top: 0;
  z-index: 5;
  min-width: 150px;
  padding: 8px 10px;
  background: var(--card);
  border: 1px solid var(--line-light);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  font-size: 11px;
  color: #cbd5e1;
}

.inst-tooltip[hidden] {
  display: none;
}

.inst-tip-head {
  margin-bottom: 4px;
  font-weight: 700;
  color: #fff;
}

.inst-tip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 1px 0;
}

.inst-tip-row b {
  margin-left: auto;
  padding-left: 12px;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.inst-tip-row.total {
  margin-top: 3px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.inst-chart-empty {
  padding: 24px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.inst-table {
  margin-top: 8px;
}

.inst-table summary {
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.inst-table table {
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

/* Monthly Training Scorecard */
.sc-group td {
  padding-top: 12px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.sc-better { color: var(--green); }
.sc-worse { color: var(--danger); }
.sc-same { color: var(--muted); }

.sc-summary {
  margin: 10px 0 0;
  padding: 10px 12px;
  background: #0f172a;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

.sc-summary:empty {
  display: none;
}

/* What Changed?: before / after the biggest change in training frequency */
.wc-badge {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: var(--line);
  color: #fff;
}

.wc-headline {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
}

.wc-sub {
  margin: 0 0 12px;
  font-size: 11px;
  color: var(--muted);
}

.wc-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.wc-compare.single {
  grid-template-columns: 1fr;
}

.wc-period {
  padding: 10px 12px;
  background: #0f172a;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}

.wc-period-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.wc-figures {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.wc-figures b {
  display: block;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}

.wc-figures span {
  font-size: 10px;
  color: var(--muted);
}

.wc-explain {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: #0f172a;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  color: #cbd5e1;
}

.wc-explain p {
  margin: 0 0 4px;
}

.wc-explain p:first-child {
  font-weight: 700;
  color: #fff;
}

.wc-explain ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.wc-explain h3 {
  margin: 8px 0 0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.wc-mean {
  stroke: #f8fafc;
  stroke-width: 2;
  stroke-dasharray: 5 4;
}

.wc-mean-label {
  font-size: 10px;
  font-weight: 700;
  fill: #f8fafc;
  paint-order: stroke;
  stroke: var(--card);
  stroke-width: 3px;
}

/* Weekly breakdown: scrolls inside a capped height, the header stays put */
#whatChangedDetails .table-wrapper {
  max-height: 320px;
  overflow-y: auto;
}

#whatChangedTable thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.wc-note {
  margin: 6px 0 0;
  font-size: 10px;
  color: var(--muted);
}

.wc-note:empty {
  display: none;
}

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

/* ---------------------------------------------------------
   Pro cards on free pages, locked without Pro
   --------------------------------------------------------- */
.pro-section { position: relative; }

.pro-locked-section { min-height: 180px; overflow: hidden; }
.pro-locked-section > :not(.pro-lock) { filter: blur(3px); opacity: 0.35; pointer-events: none; user-select: none; }

.pro-lock {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  text-align: center;
  background: linear-gradient(180deg, rgba(19, 28, 46, 0.2), rgba(19, 28, 46, 0.75));
}

.pro-lock b { font-size: 14px; color: #fff; }
.pro-lock-desc { max-width: 420px; font-size: 11px; color: #cbd5e1; }

.pro-section-head {
  grid-column: span 12;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 -4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--purple);
}

.pro-section-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.4), transparent);
}

/* ---------------------------------------------------------
   Course minimums / requirements (Progress page and Logbook)
   --------------------------------------------------------- */
.req-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }

.req-row {
  padding: 10px 12px;
  background: #0f172a;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}

.req-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: #cbd5e1; }
.req-head b { color: #fff; white-space: nowrap; }

.req-bar { display: flex; height: 8px; margin: 8px 0 6px; border-radius: 4px; background: var(--line); overflow: hidden; }
.req-flown { background: var(--blue); }
.req-planned { background: repeating-linear-gradient(135deg, rgba(59, 130, 246, 0.55) 0 4px, rgba(59, 130, 246, 0.25) 4px 8px); }
.req-row.met .req-flown { background: var(--green); }
.req-row.short .req-planned { background: repeating-linear-gradient(135deg, rgba(245, 158, 11, 0.6) 0 4px, rgba(245, 158, 11, 0.25) 4px 8px); }

.req-foot { display: flex; justify-content: space-between; gap: 10px; font-size: 10px; color: var(--muted); }
.req-status { font-weight: 800; }
.req-row.met .req-status { color: #34d399; }
.req-row.planned .req-status { color: #60a5fa; }
.req-row.short .req-status { color: #fbbf24; }
.req-row.tight .req-status { color: #fcd34d; }

/* ---------------------------------------------------------
   Flights: log panel tabs and the log's logbook tags
   --------------------------------------------------------- */
/* A tab strip on an underline: the selected tab is lifted and joins the form below it */
.log-tabs {
  display: flex;
  gap: 2px;
  margin: -4px -16px 14px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line-light);
}
.log-tabs button {
  position: relative;
  flex: 0 0 auto;
  gap: 6px;
  margin-bottom: -1px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  box-shadow: none;
}
.log-tabs button:hover { background: rgba(255, 255, 255, 0.04); color: #fff; box-shadow: none; }
.log-tabs button.active {
  background: var(--card);
  color: #fff;
  border-color: var(--line-light);
  /* Covers the strip's underline, so the tab and the form read as one */
  box-shadow: 0 1px 0 var(--card);
}
.log-tabs button.active::before {
  content: "";
  position: absolute;
  top: -1px; left: -1px; right: -1px;
  height: 3px;
  border-radius: 8px 8px 0 0;
  background: var(--blue);
}
.log-tabs button.is-locked { opacity: 0.75; }
.log-tabs button.is-locked::after { content: "🔒"; font-size: 10px; }

/* The log card's full-width phone buttons (dashboard.css) don't apply to its tabs */
@media (max-width: 768px) {
  .log-entry-card .log-tabs button { width: auto !important; }
}

@media (max-width: 600px) {
  .log-tabs { margin: -4px -12px 14px; padding: 0 8px; }
  .log-tabs button { padding: 8px 10px; font-size: 12px; }
}

.log-more { margin-top: 2px; }
.log-more summary { cursor: pointer; font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.log-more .controls { margin-top: 8px; }
.field small { font-size: 10px; color: var(--muted); }

.log-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.log-tags span {
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  color: #cbd5e1;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.25);
  white-space: nowrap;
}

/* ---------------------------------------------------------
   Pace: Consistency card and gap recovery
   --------------------------------------------------------- */
.cons-scores { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.cons-score { padding: 10px 12px; background: #0f172a; border: 1px solid var(--line); border-radius: 8px; }
.cons-score b { display: block; font-size: 22px; font-weight: 900; color: #fff; }
.cons-score span { font-size: 10px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.cons-score small { display: block; margin-top: 4px; font-size: 10px; color: var(--muted); }

.cons-factors { display: grid; gap: 8px; }
.cons-factor-head { display: flex; justify-content: space-between; font-size: 11px; color: #cbd5e1; margin-bottom: 3px; }
.cons-factor-head b { color: #fff; }

.kv-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 11px; }
.kv-list li { display: flex; justify-content: space-between; gap: 10px; color: #cbd5e1; }
.kv-list li b { color: #fff; text-align: right; }

@media (max-width: 600px) {
  .cons-scores { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------
   Logbook
   --------------------------------------------------------- */
.lb-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.lb-tile { padding: 10px 12px; background: #0f172a; border: 1px solid var(--line); border-radius: 8px; font-variant-numeric: tabular-nums; }
.lb-tile b { display: block; font-size: 20px; font-weight: 800; color: #fff; }
.lb-tile span { font-size: 10px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.lb-tile small { display: block; margin-top: 4px; font-size: 10px; color: var(--muted); line-height: 1.4; }

.lb-verdict { margin: 0 0 12px; padding: 10px 12px; border-radius: 8px; font-size: 12px; background: #0f172a; border: 1px solid var(--line); color: #cbd5e1; }
.lb-verdict b { color: #fff; }
.lb-verdict.good { border-color: rgba(16, 185, 129, 0.4); }
.lb-verdict.warn { border-color: rgba(245, 158, 11, 0.5); }

.lb-table td, .lb-table th { white-space: nowrap; font-variant-numeric: tabular-nums; }
.lb-table td.num, .lb-table th.num { text-align: right; }
.lb-table tfoot td { font-weight: 800; color: #fff; border-top: 2px solid var(--line-light); }
/* The table scrolls inside its card: the column names and totals stay in view */
.lb-table thead th { position: sticky; top: 0; z-index: 1; }
.lb-table tfoot td { position: sticky; bottom: 0; z-index: 1; background: #0f172a; }
.lb-table .src-lesson { color: #a5b4fc; }
.lb-table .src-entered { color: #fcd34d; }
.lb-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: 10px; color: var(--muted); }
.lb-legend .src-lesson { color: #a5b4fc; }
.lb-legend .src-entered { color: #fcd34d; }

.lb-req-table td { vertical-align: top; font-variant-numeric: tabular-nums; }
.lb-req-table td.num, .lb-req-table th.num { text-align: right; white-space: nowrap; }
.lb-req-table small { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; }
.lb-status { display: inline-block; padding: 2px 7px; border-radius: 10px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.lb-status.met { background: var(--green-light); color: #34d399; }
.lb-status.planned { background: var(--blue-light); color: #60a5fa; }
.lb-status.short { background: var(--amber-light); color: #fbbf24; }
.lb-status.tight { background: rgba(250, 204, 21, 0.1); color: #fde68a; }
.lb-status.todo, .lb-status.info { background: #1e293b; color: var(--muted); }
.lb-status.check { background: var(--purple-light); color: #c4b5fd; }
/* Training Drift (Progress): how the projected completion date has moved, and why */
.drift-headline { margin: 0 0 10px; font-size: 14px; line-height: 1.55; color: var(--text); }
.drift-later { color: var(--amber); }
.drift-earlier { color: var(--green); }
.drift-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 18px; margin-top: 14px; }
.drift-subhead { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.drift-cause { margin-bottom: 10px; }
.drift-cause-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; font-size: 12px; margin-bottom: 4px; }
.drift-cause-head small { display: block; font-size: 10px; color: var(--muted); margin-top: 1px; }
.drift-cause-head > b { white-space: nowrap; }
.drift-grid td small { color: var(--muted); }

@media (max-width: 768px) {
  .drift-grid { grid-template-columns: minmax(0, 1fr); }
}
