/* AirHauler 2 staging theme on top of Tabler (Bootstrap 5).
   Dark "cockpit" palette by default; light theme via the toggle. */
:root {
  --ah2-amber: #f5a524;
  --ah2-cyan: #22d3ee;
  --ah2-green: #22c55e;
  --ah2-mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
  --tblr-font-sans-serif: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
[data-bs-theme="dark"] {
  --tblr-body-bg: #0b1220;
  --tblr-bg-surface: #111a2e;
  --tblr-bg-surface-secondary: #0f1729;
  --tblr-bg-surface-tertiary: #16213a;
  --tblr-border-color: #1f2b47;
  --tblr-border-color-translucent: rgba(148, 163, 184, .14);
  --tblr-body-color: #dbe4f3;
  --tblr-secondary-color: #93a3bd;
  --tblr-secondary: #93a3bd;
  --tblr-primary: #22d3ee;
  --tblr-primary-rgb: 34, 211, 238;
  --tblr-link-color: #67e8f9;
  --tblr-link-color-rgb: 103, 232, 249;
  --tblr-link-hover-color: #a5f3fc;
  --ah2-grid: rgba(148, 163, 184, .12);
  --ah2-chart-text: #93a3bd;
}
[data-bs-theme="light"] {
  --tblr-primary: #0369a1;
  --tblr-primary-rgb: 3, 105, 161;
  --tblr-link-color: #0369a1;
  --tblr-link-color-rgb: 3, 105, 161;
  --ah2-grid: rgba(15, 23, 42, .08);
  --ah2-chart-text: #475569;
}
body { font-feature-settings: "tnum" 1; }
.skip-link { position: absolute; left: 1rem; top: .5rem; z-index: 2000; }
.mono, .icao, .num { font-family: var(--ah2-mono); font-variant-numeric: tabular-nums; }
.icao { letter-spacing: .04em; font-weight: 600; }
.text-amber { color: var(--ah2-amber) !important; }
.text-cyan { color: var(--ah2-cyan) !important; }
.text-live { color: var(--ah2-green) !important; }

/* Navbar */
.ah2-navbar { background: var(--tblr-bg-surface); border-bottom: 1px solid var(--tblr-border-color); }
.ah2-navbar .nav-link { font-weight: 500; }
@media (min-width: 992px) { .ah2-navbar .nav-link { white-space: nowrap; } }
@media (min-width: 992px) and (max-width: 1199.98px) { .ah2-navbar .nav-link { padding-left: .45rem; padding-right: .45rem; font-size: .8125rem; } .ah2-navbar .navbar-brand { margin-right: .5rem !important; } .ah2-navbar .ah2-logo { height: 26px; } }
.ah2-navbar .nav-item.active .nav-link { color: var(--tblr-primary); box-shadow: inset 0 -2px 0 var(--tblr-primary); }
[data-bs-theme="light"] .ah2-logo { filter: none; }
.theme-toggle .icon-sun { display: none; }
[data-bs-theme="dark"] .theme-toggle .icon-sun { display: inline; }
[data-bs-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Hero */
.hero {
  position: relative; overflow: hidden; border-bottom: 1px solid var(--tblr-border-color);
  background:
    radial-gradient(1200px 400px at 80% -10%, rgba(34, 211, 238, .18), transparent 60%),
    radial-gradient(800px 300px at 10% 110%, rgba(245, 165, 36, .12), transparent 60%),
    var(--tblr-bg-surface-secondary);
}
.hero::after { /* subtle chart-grid */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(var(--ah2-grid) 1px, transparent 1px), linear-gradient(90deg, var(--ah2-grid) 1px, transparent 1px);
  background-size: 48px 48px; mask-image: linear-gradient(to bottom, transparent, #000 30%, #000 70%, transparent);
}
.hero > .container-xl { position: relative; z-index: 1; }
.hero h1 { font-size: clamp(1.9rem, 4.5vw, 3.1rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.hero .lead { font-size: clamp(1rem, 2vw, 1.25rem); color: var(--tblr-secondary-color); max-width: 42rem; }
.sim-badges .badge { font-weight: 600; }

/* Live stats strip */
.stat-card .stat-value { font-family: var(--ah2-mono); font-size: 1.75rem; font-weight: 700; line-height: 1.1; }
.stat-card .stat-label { text-transform: uppercase; letter-spacing: .06em; font-size: .7rem; color: var(--tblr-secondary-color); font-weight: 600; }
.stat-card .stat-icon { color: var(--tblr-primary); opacity: .85; }
.live-dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: var(--ah2-green); box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); animation: pulse 2s infinite; vertical-align: middle; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.6); } 70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* Maps */
.map-wrap { position: relative; }
#liveMap, #jobsMap, #miniMap { width: 100%; background: #0b1220; border-radius: var(--tblr-border-radius); }
#liveMap { height: calc(100vh - 210px); min-height: 420px; }
#jobsMap { height: 460px; }
#miniMap { height: 320px; }
@media (max-width: 575.98px) { #liveMap { height: 60vh; min-height: 340px; } #jobsMap { height: 320px; } }
.leaflet-container { font-family: var(--tblr-font-sans-serif); }
[data-bs-theme="light"] .leaflet-container { background: #e5e7eb; }
.plane-icon { background: none; border: 0; }
.plane-icon svg { filter: drop-shadow(0 0 2px rgba(0,0,0,.8)); transition: transform .3s; }
.leaflet-popup-content { margin: 10px 12px; font-size: .85rem; }
.leaflet-popup-content .pop-title { font-weight: 700; font-size: .95rem; }
.leaflet-popup-content dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0 0; }
.leaflet-popup-content dt { color: #64748b; font-weight: 500; }
.leaflet-popup-content dd { margin: 0; font-family: var(--ah2-mono); }
[data-bs-theme="dark"] .leaflet-popup-content-wrapper, [data-bs-theme="dark"] .leaflet-popup-tip { background: #111a2e; color: #dbe4f3; border: 1px solid #1f2b47; }
[data-bs-theme="dark"] .leaflet-control-attribution { background: rgba(11,18,32,.8) !important; color: #93a3bd; }
[data-bs-theme="dark"] .leaflet-control-attribution a { color: #67e8f9; }
[data-bs-theme="dark"] .leaflet-bar a { background: #111a2e; color: #dbe4f3; border-color: #1f2b47; }

/* Tables */
.table-ah2 thead th { position: sticky; top: 0; z-index: 1; background: var(--tblr-bg-surface-tertiary); }
.sort-btn { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.sort-btn[aria-sort="ascending"]::after { content: " ▲"; font-size: .7em; }
.sort-btn[aria-sort="descending"]::after { content: " ▼"; font-size: .7em; }
@media (max-width: 767.98px) {
  /* Stack table rows as cards on phones */
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { border: 1px solid var(--tblr-border-color); border-radius: var(--tblr-border-radius); margin-bottom: .6rem; padding: .35rem .6rem; background: var(--tblr-bg-surface); }
  .table-stack td { border: 0 !important; padding: .2rem 0 !important; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  .table-stack td::before { content: attr(data-label); font-weight: 600; color: var(--tblr-secondary-color); text-align: left; }
  .table-stack td.td-main { font-size: 1rem; font-weight: 600; text-align: left; }
  .table-stack td.td-main::before { content: none; }
}
.rank-badge { display: inline-flex; width: 1.8rem; height: 1.8rem; align-items: center; justify-content: center; border-radius: 50%; font-weight: 700; font-family: var(--ah2-mono); background: var(--tblr-bg-surface-tertiary); }
.rank-1 { background: rgba(245,165,36,.2); color: var(--ah2-amber); }
.rank-2 { background: rgba(203,213,225,.18); }
.rank-3 { background: rgba(180,83,9,.2); color: #f59e0b; }
.chart-box { position: relative; height: 320px; }
.chart-box.sm { height: 240px; }
.empty-state { padding: 2rem 1rem; text-align: center; color: var(--tblr-secondary-color); }
.page-header .page-title { font-weight: 700; }
[data-bs-theme="light"] .theme-outline { color: var(--tblr-body-color); border-color: var(--tblr-border-color); }
[data-bs-theme="light"] .theme-outline:hover { background: var(--tblr-bg-surface-tertiary); }

/* OSM fallback basemap: darken the standard tiles in the dark theme. */
[data-bs-theme="dark"] .ah2-osm { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.85) saturate(.4); }

/* VA profile */
.va-logo { height: 64px; width: auto; max-width: 220px; object-fit: contain; border-radius: var(--tblr-border-radius); background: #fff; padding: 4px; }
.va-logo-fallback { background: transparent; }
#vaMap { width: 100%; height: 380px; border-radius: var(--tblr-border-radius); background: #0b1220; }
.fleet-scroll { max-height: 380px; overflow-y: auto; }
@media (max-width: 575.98px) { #vaMap { height: 300px; } }
