/* ============================================================
   TAF.CSS
   eIAWS — Enterprise Integrated Aviation Weather System
   I.M. Systems Group
   METAR | TAF switch and the TAF view (core/taf.js). Uses the tokens from variables.css.
   ============================================================ */

/* ---- METAR | TAF switch ---- */
.taf-seg {
  display: inline-flex;
  margin-left: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  overflow: hidden;
}

.taf-seg button {
  background: transparent;
  color: var(--text-secondary);
  border: 0;
  padding: var(--space-2) var(--space-4);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  cursor: pointer;
}

.taf-seg button.active {
  background: var(--color-accent-primary);
  color: #fff;
}

.taf-seg button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---- Mode: what shows in TAF mode ---- */
.split-left.taf-mode > .metrics-grid,
.split-left.taf-mode > #metarSection,
.split-left.taf-mode #flightCategoryBadge,
.split-left.taf-mode #weatherIconContainer {
  display: none !important;
}

.split-left:not(.taf-mode) #tafBadgeWrap,
.split-left:not(.taf-mode) #tafIconContainer {
  display: none;
}

.taf-badge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.taf-badge-time {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.taf-badge-note {
  font-size: var(--text-xs);
  color: #f59e0b;
}

/* ---- Raw TAF: groups in effect at the selected hour ---- */
.taf-seg-txt.on {
  background: rgba(2, 170, 252, 0.25);
  border-radius: 3px;
}

/* ---- Hour selector ---- */
.taf-hourbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.taf-hour-label {
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: 0;
}

.taf-strip-wrap {
  margin-top: var(--space-2);
  padding-right: 2.5em;          /* room for the last hour label */
}

.taf-strip {
  display: flex;
}

/* narrow screens: keep cells a usable size and scroll sideways instead */
@media (max-width: 700px) {
  .taf-strip-wrap { overflow-x: auto; overflow-y: hidden; }
  .taf-strip { min-width: 560px; }
}

.taf-cell {
  flex: 1;
  min-width: 0;
  display: block;
  padding: 0;
  background: none;
  border: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.taf-cell:focus-visible {
  outline: 2px solid var(--color-accent-primary);
  outline-offset: 1px;
}

.taf-bar {
  display: block;
  height: 18px;
  border-right: 1px solid var(--bg-panel);
  opacity: 0.8;
}

.taf-cell:hover .taf-bar,
.taf-cell.taf-sel .taf-bar {
  opacity: 1;
}

.taf-cell.taf-sel .taf-bar {
  outline: 2px solid var(--text-primary);
  outline-offset: -2px;
}

.taf-cell.taf-now .taf-bar {
  box-shadow: inset 0 -3px 0 rgba(255, 255, 255, 0.75);
}

/* thin bar under the hour when a TEMPO/PROB group is worse than the prevailing category */
.taf-tempo {
  display: block;
  height: 4px;
  border-right: 1px solid var(--bg-panel);
}

.taf-tick {
  display: block;
  height: 16px;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-muted);
  white-space: nowrap;
  text-align: left;
}

.taf-legend {
  display: none;
}

/* ---- Cards ---- */
.taf-ov.taf-active {
  color: #f59e0b;
}

.taf-cat {
  display: inline-block;
  padding: 1px var(--space-2);
  border-radius: var(--border-radius-pill);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: #fff;
  vertical-align: middle;
}

.taf-cat:empty {
  display: none;
}

.taf-chips {
  margin-top: var(--space-1);
}

.taf-chip {
  display: inline-block;
  padding: 1px var(--space-2);
  margin: var(--space-1) var(--space-1) 0 0;
  border-radius: var(--border-radius-pill);
  background: var(--bg-panel);
  color: var(--text-primary);
  font-size: var(--text-xs);
}

/* chart note: only while the chart above it is open */
.taf-chart-note {
  display: none;
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.chart-container.visible + .taf-chart-note {
  display: block;
}
