/* The Pre-Flight page (scripts/preflight.js) */

.pf-search-card { margin-bottom: 14px; }
.pf-search { display: flex; gap: 8px; align-items: stretch; }
.pf-search .pm-search { flex: 1; min-width: 0; }
.pf-search input[type=text] { width: 100%; font-size: 15px; padding: 10px 12px; }
.pf-search button { flex: 0 0 auto; }
.pf-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.pf-chips:empty { display: none; }
.pf-chips-label { font-size: 12px; color: var(--muted); font-weight: 700; margin-right: 2px; }
.pf-chip {
  background: var(--inset); border: 1px solid var(--line-light); color: var(--text); border-radius: 999px;
  padding: 4px 10px; font-size: 12px; font-weight: 700; cursor: pointer; letter-spacing: .03em;
}
.pf-chip:hover { border-color: var(--blue); }
.pf-chip.active { background: var(--blue-light); border-color: var(--blue); color: #bfdbfe; }
.pf-disclaimer { margin: 10px 0 0; font-size: 12px; color: var(--muted); }

.pf-empty { min-height: 90px; text-align: center; padding: 12px; font-style: normal; }
.pf-h3 { font-size: 12px; color: var(--muted); margin: 16px 0 8px; font-weight: 800; }
.pf-note { font-size: 12px; color: var(--muted); margin: 8px 0 0; line-height: 1.5; }
.pf-note-warn { color: #fcd34d; background: var(--amber-light); border: 1px solid rgba(245, 158, 11, 0.3); border-radius: 8px; padding: 7px 10px; margin: 0 0 10px; }
.pf-sources { font-size: 12px; color: var(--muted); margin: 16px 2px 0; line-height: 1.6; }
.pf-sources a { color: #93c5fd; }
.pf-small-figure { font-size: 12px !important; line-height: 1.35 !important; }
.pf-tiles .stat small { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
.pf-tiles { margin-bottom: 4px; }
/* The weather tiles three to a row on every screen but a phone's (the shared narrower grids
   would leave each span-4 tile alone on its row on tablets) */
#pfMetar .pf-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#pfMetar .pf-tiles > .stat { grid-column: auto; }

/* The airport */
.pf-airport { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; }
.pf-airport-title { margin-bottom: 12px; }
.pf-airport-title b { display: block; font-size: 18px; color: #fff; }
.pf-airport-title span { font-size: 12px; color: var(--muted); }
.pf-freqs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr)); gap: 4px; }
.pf-freq { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; min-width: 0; }
.pf-freq b { display: block; font-size: 14px; color: #fff; font-variant-numeric: tabular-nums; }
.pf-freq span { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 12px; }
.pf-links a { color: #93c5fd; text-decoration: none; }
.pf-links a:hover { text-decoration: underline; }
.pf-map { height: 170px; border-radius: 10px; border: 1px solid var(--line); background: var(--inset); overflow: hidden; z-index: 0; }
/* Two columns of nearby airports */
.pf-nearby { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 6px; }
.pf-nearby-item {
  display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 0 6px; align-items: baseline; text-align: left;
  background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 3px 6px; color: var(--text); cursor: pointer; min-width: 0;
}
.pf-nearby-item small { grid-column: 2; }
.pf-nearby-item:hover { background: var(--inset); border-color: var(--line-light); }
.pf-nearby-item b { font-size: 12px; }
.pf-nearby-item span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-nearby-item small { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Flight categories */
.wx-cat { display: inline-block; font-size: 12px; font-weight: 800; padding: 1px 5px; border-radius: 4px; margin-right: 4px; letter-spacing: .03em; }
.wx-cat.VFR, .pf-cat.VFR { background: rgba(34, 197, 94, 0.15); color: #86efac; }
.wx-cat.MVFR, .pf-cat.MVFR { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
.wx-cat.IFR, .pf-cat.IFR { background: rgba(239, 68, 68, 0.15); color: var(--alert-urgent); }
.wx-cat.LIFR, .pf-cat.LIFR { background: rgba(217, 70, 239, 0.15); color: #f0abfc; }
.pf-cat-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.pf-cat { font-size: 13px; font-weight: 800; padding: 3px 10px; border-radius: 6px; letter-spacing: .04em; }
.pf-cat-desc { font-size: 12px; color: var(--muted); }

/* A report, group by group */
.pf-raw {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.9;
  background: #0b1222; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; word-break: break-word;
}
.pf-raw-lines > div + div { padding-left: 14px; }
.pf-tok { border-radius: 4px; padding: 1px 3px; cursor: default; transition: background .15s; }
.pf-tok.hl, .pf-explain li.hl { background: rgba(255, 255, 255, 0.1); }
.k-wind { color: #7dd3fc; }
.k-vis, .k-rvr { color: #86efac; }
.k-wx { color: var(--alert-urgent); }
.k-cloud { color: var(--text-soft); }
.k-temp { color: #fdba74; }
.k-pressure { color: #fde68a; }
.k-change, .k-trend { color: var(--text-soft); }
.k-windshear { color: var(--danger-text); }
.k-time, .k-station { color: var(--text-soft); }
.k-remark, .k-other, .k-runway { color: var(--muted); }
/* The groups' meanings in as many columns as fit (two in the Current Weather card on a laptop) */
.pf-explain { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 0 12px; }
.pf-explain li { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 8px; padding: 3px 6px; border-radius: 6px; align-items: baseline; min-width: 0; }
/* A TAF change group starts a new row, across every column */
.pf-explain li.pf-explain-break { grid-column: 1 / -1; margin-top: 6px; border-top: 1px dashed var(--line-light); border-radius: 0; padding-top: 6px; }
.pf-explain code { overflow: hidden; text-overflow: ellipsis; }
.pf-explain code { font-size: 12px; font-weight: 700; white-space: nowrap; }
.pf-explain span { font-size: 12px; color: var(--text); line-height: 1.45; }
.pf-explain i { color: var(--muted); }
.pf-details { margin-top: 12px; font-size: 12px; }
.pf-details summary { cursor: pointer; color: var(--muted); font-weight: 700; }
.pf-older { margin-top: 8px; }
.pf-older small { display: block; color: var(--muted); margin-bottom: 2px; }
.pf-older code { font-size: 12px; word-break: break-word; color: var(--text-soft); }

/* The TAF's periods */
.pf-taf-periods { display: flex; flex-direction: column; gap: 4px; }
.pf-period {
  display: grid; grid-template-columns: 290px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  background: none; border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px;
}
.pf-period.live { border-color: var(--blue); }
.pf-period-temp { margin-left: 18px; background: #0d1426; }
/* Local and UTC times on one line */
.pf-period-time b { font-size: 12px; color: #fff; font-variant-numeric: tabular-nums; }
.pf-period-time small { font-size: 12px; color: var(--muted); margin-left: 6px; white-space: nowrap; }
.pf-period .pf-use-wind { padding: 3px 8px; font-size: 12px; }
.pf-period-body { font-size: 12px; line-height: 1.5; }
.pf-change { display: inline-block; font-size: 12px; font-weight: 800; color: var(--text-soft); margin-right: 6px; }

/* Runways and wind */
.pf-seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line-light); border-radius: 8px; overflow: hidden; margin-bottom: 10px; max-width: 100%; }
.pf-seg button {
  background: transparent; color: var(--muted); border: 0; border-radius: 0; padding: 6px 12px; font-weight: 700; cursor: pointer; box-shadow: none;
}
.pf-seg button + button { border-left: 1px solid var(--line-light); }
.pf-seg button.active { background: var(--blue-light); color: #bfdbfe; }
.pf-seg button:disabled { opacity: .45; cursor: not-allowed; }
.pf-tabs { display: flex; flex-wrap: wrap; }
.pf-tabs button { flex: 1 1 auto; }
.pf-form { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-form .field { min-width: 90px; }
.pf-form .pf-field-wide { flex: 2 1 180px; }
.pf-form input, .pf-form select { width: 100%; box-sizing: border-box; }
.pf-inline { display: flex; gap: 4px; }
.pf-inline input { flex: 1; min-width: 0; }
.pf-inline select { width: auto; flex: 0 0 auto; }
/* The diagram beside the wind, not above the runways */
.pf-wind-top { display: flex; align-items: center; gap: 12px; margin: 4px 0 8px; }
.pf-wind-top .pf-diagram { flex: 0 0 140px; width: 140px; margin: 0; }
.pf-wind-text { flex: 1; min-width: 0; }
.pf-wind-line { display: flex; align-items: center; gap: 10px; margin: 0; }
.pf-wind-line b { display: block; font-size: 15px; color: #fff; }
.pf-wind-line small { font-size: 12px; color: var(--muted); }
.pf-wind-arrow { color: #7dd3fc; flex: 0 0 auto; }
.pf-wind-calm { font-size: 20px; width: 28px; text-align: center; }
.pf-diagram { display: block; width: 100%; max-width: 230px; margin: 4px auto 8px; }
.pf-dia-ring { fill: none; stroke: var(--line-light); stroke-dasharray: 2 4; }
/* Sizes in the diagram's own units (240 across), drawn at 110 to 140 px */
.pf-dia-n { fill: var(--muted); font-size: 16px; font-weight: 800; }
.pf-dia-rwy { stroke: #64748b; stroke-width: 12; stroke-linecap: butt; }
.pf-dia-label { fill: var(--text-soft); font-size: 20px; font-weight: 800; }
.pf-dia-label.best { fill: #86efac; }
.pf-dia-wind { stroke: #7dd3fc; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.pf-runways { display: flex; flex-direction: column; gap: 8px; }
.pf-runway { background: var(--inset); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.pf-runway-added { border-style: dashed; }
.pf-runway-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.pf-runway-head b { font-size: 13px; color: #fff; }
.pf-runway-head span { font-size: 12px; color: var(--muted); flex: 1; min-width: 0; }
.pf-end { display: grid; grid-template-columns: 74px 104px minmax(0, 1fr); gap: 8px; align-items: center; padding: 5px 0; border-top: 1px solid var(--line); }
.pf-end.best .pf-end-id b { color: #86efac; }
.pf-end-id b { font-size: 15px; color: #fff; display: block; }
.pf-end-id small { font-size: 12px; color: #86efac; font-weight: 800; }
.pf-hdg { display: flex; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.pf-hdg input { width: 58px; padding: 4px 6px; font-variant-numeric: tabular-nums; }
.pf-end-comp { display: flex; flex-direction: column; gap: 2px; font-size: 12px; min-width: 0; }
.pf-end-declared { grid-column: 1 / -1; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: -3px; }
.pf-comp { display: flex; flex-wrap: wrap; gap: 4px 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pf-comp-gust { font-weight: 600; color: var(--muted); font-size: 12px; }
.pf-head { color: #86efac; }
.pf-tail { color: var(--alert-urgent); }
.pf-cross { color: #fde68a; }
.pf-comp-gust .pf-head, .pf-comp-gust .pf-tail, .pf-comp-gust .pf-cross { opacity: .85; }
.pf-comp-none { color: var(--muted); }
.pf-link-btn { background: none; border: 0; color: #93c5fd; padding: 0 2px; font-size: 12px; cursor: pointer; box-shadow: none; text-decoration: underline; }
.pf-add-rwy { display: flex; gap: 6px; margin-top: 10px; }
.pf-add-rwy input { flex: 1; min-width: 0; }

/* Results of a sum */
/* Results two (or more) to a row */
.pf-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: 6px; margin-top: 10px; }
.pf-result {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: baseline; align-content: start;
  background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
}
.pf-result span { font-size: 12px; color: var(--muted); font-weight: 700; }
.pf-result b { font-size: 15px; color: #fff; text-align: right; font-variant-numeric: tabular-nums; }
.pf-result small { grid-column: 1 / -1; font-size: 12px; color: var(--muted); line-height: 1.4; }

/* The sun */
.pf-sun-table { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.pf-sun-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 76px; gap: 10px; align-items: baseline; padding: 5px 10px; background: none; border: 1px solid var(--line); border-radius: 8px; }
.pf-sun-row span { font-size: 12px; font-weight: 700; }
.pf-sun-row span small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.pf-sun-row b { font-size: 15px; color: #fff; font-variant-numeric: tabular-nums; }
.pf-sun-row > small { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }


@media (max-width: 900px) {
  .pf-airport { grid-template-columns: minmax(0, 1fr); }
}
/* An iPad on its side, with the sidebar: side by side, the nearby names were cut off */
@media (min-width: 901px) and (max-width: 1100px) {
  .pf-airport { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 600px) {
  .pf-search button#pfSearchBtn { padding-left: 12px; padding-right: 12px; }
  /* Time and "Use this wind" on one line, the forecast under them */
  .pf-period { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; padding: 5px 8px; }
  .pf-period-body { grid-column: 1 / -1; grid-row: 2; }
  .pf-period-time small { display: block; margin-left: 0; }
  .pf-freqs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pf-freq b { font-size: 13px; }
  .pf-wind-top .pf-diagram { flex-basis: 110px; width: 110px; }
  .pf-period-temp { margin-left: 10px; }
  .pf-period .pf-use-wind { grid-column: 2; grid-row: 1; justify-self: end; }
  .pf-end { grid-template-columns: 56px minmax(0, 1fr); }
  .pf-end-comp { grid-column: 1 / -1; }
  .pf-explain li { grid-template-columns: minmax(0, 1fr); gap: 0; }
  #pfMetar .pf-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pf-form .field { flex: 1 1 calc(50% - 8px); }
}

/* NOTAMs (scripts/notams.js): Airport & Weather's card and the Briefing page's */
.nt-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); align-items: start; gap: 8px; }
.nt-item { border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: none; min-width: 0; }
.nt-item.nt-later { border-style: dashed; }
.nt-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 4px; font-size: 13px; }
.nt-head span { color: var(--muted); font-size: 12px; }
.nt-head .nt-subject { color: var(--cyan); font-weight: 700; }
.nt-head .nt-when { color: var(--amber); font-weight: 700; }
.nt-text { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.nt-item small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.45; }
.nt-area .nt-list { margin-top: 8px; }
.nt-stale-list { margin-top: 8px; }
.nt-stale-list .nt-list { margin-top: 8px; }
.nt-item.nt-stale { opacity: .6; }
.nt-item[hidden] { display: none; }
.nt-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 8px; }
.nt-pager span { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.nt-none { color: var(--muted); font-size: 12px; text-align: center; margin: 4px 0 8px; }
/* The NOTAMs' map (PMNotams.drawMap): dark tiles as the Flight Map's, popups in the site's colours */
.nt-map { height: 600px; border-radius: 10px; border: 1px solid var(--line); background: #0b1220; overflow: hidden; z-index: 0; }
.nt-map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.85) saturate(0.6); }
.nt-map .leaflet-control-attribution { background: rgba(11, 15, 25, 0.75); color: var(--muted); }
.nt-map .leaflet-control-attribution a { color: #93c5fd; }
.nt-map .leaflet-bar a { background: var(--card); color: #fff; border-bottom-color: var(--line-light); }
.nt-map .leaflet-popup-content-wrapper, .nt-map .leaflet-popup-tip { background: var(--card); color: var(--text); border: 1px solid var(--line-light); }
.nt-map .leaflet-popup-content { margin: 10px 14px; font-size: 12px; line-height: 1.5; }
.nt-map .leaflet-popup-close-button { color: var(--muted); }
.nt-map .nt-map-label { background: rgba(11, 15, 25, .85); color: #fff; border: 1px solid var(--line-light); font-weight: 800; font-size: 12px; padding: 1px 5px; box-shadow: none; }
.nt-map .nt-map-label::before { display: none; }
.nt-pop-item + .nt-pop-item { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.nt-pop-item b { color: #fff; }
.nt-pop .nt-pop-item > b::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; background: var(--nt-c); box-shadow: 0 0 0 2px #fff; }
.nt-pop-item > span { color: var(--muted); font-size: 12px; }
.nt-pop-item .nt-text { margin-top: 3px; }
.nt-pop-item small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.nt-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.nt-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.nt-legend i.nt-legend-line { width: 16px; height: 0; border-radius: 0; border-top: 2px solid var(--muted); vertical-align: 3px; }
.nt-legend i.nt-legend-dashed { border-top-style: dashed; }
.nt-pop-note { margin: 6px 0 0; color: var(--muted); font-size: 12px; font-style: italic; }
/* (clear of the popup's close button, 24px in the top right corner) */
.nt-pop-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 14px 8px 0; padding-bottom: 6px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1; background: var(--card); }
.nt-pop-nav span { color: var(--muted); font-size: 12px; font-weight: 700; }
.nt-pop-nav button { background: var(--card); color: #fff; border: 1px solid var(--line-light); border-radius: 6px; width: 30px; height: 26px; font-size: 16px; line-height: 1; cursor: pointer; padding: 0; }
.nt-pop-nav button:disabled { opacity: .35; cursor: default; }
.nt-map .leaflet-interactive { cursor: pointer; }
.nt-map path.leaflet-interactive:focus { outline: none; }
.nt-map-status { background: rgba(11, 15, 25, .85); color: #fff; border: 1px solid var(--line-light); border-radius: 6px; padding: 3px 8px; font-size: 12px; font-weight: 700; }
.nt-map-status[hidden] { display: none; }
/* An airfield's badge (its own NOTAMs): its code and how many, above a dot on the airfield */
.nt-ad { width: 0; height: 0; }
.nt-ad em { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--nt-c); border: 1px solid #fff; }
.nt-ad span {
  position: absolute; left: 0; top: 0; transform: translate(-50%, calc(-100% - 8px)); display: inline-flex; align-items: center; gap: 5px;
  white-space: nowrap; background: rgba(11, 15, 25, .92); color: #fff; border: 2px solid var(--nt-c); border-radius: 999px;
  padding: 2px 3px 2px 8px; font-size: 12px; line-height: 16px; cursor: pointer;
}
.nt-ad span b { font-weight: 800; letter-spacing: .02em; }
.nt-ad span i { font-style: normal; font-weight: 800; background: var(--nt-c); color: var(--bg); border-radius: 999px; min-width: 18px; padding: 0 5px; text-align: center; }
.nt-ad:hover span, .nt-ad.nt-ad-lit span { box-shadow: 0 0 0 3px var(--nt-c), 0 2px 8px rgba(0, 0, 0, .5); }
/* While the popup shows a NOTAM, the other airfields fade with the other areas */
.nt-lit .nt-ad:not(.nt-ad-lit) { opacity: .35; }
.nt-ad-empty span { padding-right: 8px; cursor: default; }
.nt-ad-empty em { display: none; }
.nt-legend i.nt-legend-ad { width: auto; height: auto; border-radius: 999px; background: #38bdf8; color: var(--bg); font-style: normal; font-weight: 800; font-size: 12px; padding: 0 6px; }
@media (max-width: 640px) {
  .nt-map { height: 340px; }
  .nt-map .leaflet-popup-content { margin: 8px 10px; }
  .nt-map .nt-popup .nt-text { font-size: 12px; }
  .nt-pop-nav button { width: 36px; height: 32px; }
}
