/* ── FlightPlanner – Aviation Dark Theme ──────────────────────────────────── */
:root {
  --fp-bg:       #0d1117;
  --fp-card:     #161b22;
  --fp-border:   #30363d;
  --fp-text:     #c9d1d9;
  --fp-muted:    #8b949e;
  --fp-primary:  #58a6ff;
  --fp-success:  #3fb950;
  --fp-warning:  #d29922;
  --fp-danger:   #f85149;
}

body {
  background: var(--fp-bg);
  color: var(--fp-text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

/* ── Navbar ── */
.navbar {
  background: #010409 !important;
  border-bottom: 1px solid var(--fp-border) !important;
}
.navbar-brand {
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}

/* ── Cards ── */
.card {
  background: var(--fp-card);
  border: 1px solid var(--fp-border);
  border-radius: 8px;
}
.card-header {
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--fp-border);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.75rem 1rem;
}
.card-hover {
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
  text-decoration: none !important;
  color: var(--fp-text) !important;
}
.card-hover:hover {
  border-color: var(--fp-primary) !important;
  box-shadow: 0 0 0 1px var(--fp-primary);
}

/* ── Stat tiles ── */
.stat-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--fp-border);
  border-radius: 8px;
  padding: 12px 16px;
  height: 100%;
}
.stat-label {
  font-size: 0.7rem;
  color: var(--fp-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--fp-text);
  line-height: 1.2;
}
.stat-sub {
  font-size: 0.72rem;
  color: var(--fp-muted);
  margin-top: 2px;
}
.stat-warn  .stat-value { color: var(--fp-warning); }
.stat-danger .stat-value { color: var(--fp-danger);  }
.stat-ok    .stat-value { color: var(--fp-success);  }

/* ── METAR raw ── */
.metar-raw {
  font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
  font-size: 0.82rem;
  color: #e3b341;
  word-break: break-all;
  background: rgba(255,255,255,0.04);
  border-radius: 4px;
  padding: 8px 10px;
  border: 1px solid var(--fp-border);
}

/* ── CG Gauge ── */
.cg-gauge-wrap {
  position: relative;
  height: 36px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--fp-border);
  border-radius: 6px;
  overflow: hidden;
}
.cg-gauge-fill {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: white;
  transition: width 0.6s ease;
}
.cg-ok   { background: linear-gradient(90deg, #1a6b2c, #3fb950); }
.cg-warn { background: linear-gradient(90deg, #7a4800, #d29922); }
.cg-bad  { background: linear-gradient(90deg, #6b1a1a, #f85149); }
.cg-limits {
  position: absolute;
  top: 0; bottom: 0; left: 0; right: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  padding: 0 6px;
}
.cg-limit-label {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.55);
}

/* ── Weight gauge (Bootstrap progress styled) ── */
.weight-bar .progress {
  background: rgba(255,255,255,0.08);
  height: 20px;
  border-radius: 4px;
}

/* ── Tables ── */
.table-dark-fp {
  --bs-table-bg: transparent;
  --bs-table-striped-bg: rgba(255,255,255,0.03);
  --bs-table-border-color: var(--fp-border);
  color: var(--fp-text);
  font-size: 0.875rem;
}
.table-dark-fp thead th {
  color: var(--fp-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-color: var(--fp-border);
}

/* ── Badges ── */
.badge-ok   { background: rgba(63,185,80,0.2);  color: #3fb950; border: 1px solid #3fb950; }
.badge-warn { background: rgba(210,153,34,0.2); color: #d29922; border: 1px solid #d29922; }
.badge-bad  { background: rgba(248,81,73,0.2);  color: #f85149; border: 1px solid #f85149; }

/* ── Form controls override ── */
.form-control, .form-select {
  background: rgba(255,255,255,0.06);
  border-color: var(--fp-border);
  color: var(--fp-text);
}
.form-control:focus, .form-select:focus {
  background: rgba(255,255,255,0.08);
  border-color: var(--fp-primary);
  color: var(--fp-text);
  box-shadow: 0 0 0 3px rgba(88,166,255,0.2);
}
.form-control::placeholder { color: var(--fp-muted); }
.form-label { font-size: 0.82rem; color: var(--fp-muted); margin-bottom: 4px; }
.input-group-text {
  background: rgba(255,255,255,0.04);
  border-color: var(--fp-border);
  color: var(--fp-muted);
}

/* ── Buttons ── */
.btn-primary {
  background: var(--fp-primary);
  border-color: var(--fp-primary);
  color: #0d1117;
  font-weight: 600;
}
.btn-primary:hover {
  background: #79b8ff;
  border-color: #79b8ff;
  color: #0d1117;
}
.btn-outline-secondary {
  border-color: var(--fp-border);
  color: var(--fp-muted);
}
.btn-outline-secondary:hover {
  background: rgba(255,255,255,0.06);
  border-color: var(--fp-muted);
  color: var(--fp-text);
}

/* ── Section dividers ── */
.section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fp-muted);
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--fp-border);
  padding-bottom: 6px;
}

/* ── Footer ── */
footer {
  border-top: 1px solid var(--fp-border) !important;
  font-size: 0.75rem;
  color: var(--fp-muted);
  margin-top: 3rem;
  padding: 1rem 0;
  text-align: center;
}

/* ── Alerts ── */
.alert { font-size: 0.875rem; border-radius: 6px; }

/* ── Wind compass indicator ── */
.wind-arrow {
  display: inline-block;
  font-size: 1.4rem;
  transition: transform 0.5s ease;
}

/* ── Route leg card ── */
.leg-card {
  border-left: 3px solid var(--fp-primary);
  background: rgba(255,255,255,0.02);
  border-radius: 0 6px 6px 0;
  padding: 12px 16px;
  margin-bottom: 12px;
}

/* ── Print ── */
.print-only { display: none !important; }

@media print {
  @page {
    size: A4 portrait;
    margin: 10mm 11mm 12mm 11mm;
  }

  /* Full-width column when sibling is hidden in print */
  .col-print-12 { flex: 0 0 100% !important; max-width: 100% !important; }

  /* Hide UI chrome */
  nav, footer, .no-print { display: none !important; }
  .print-only { display: block !important; }

  /* White background, dark text */
  html, body {
    background: white !important;
    color: #111 !important;
    font-size: 10pt !important;
    font-family: 'Segoe UI', Arial, sans-serif !important;
  }

  /* Alert visibility — keep them for go/no-go */
  .alert {
    border: 1px solid #ccc !important;
    background: #f9f9f9 !important;
    color: #111 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .alert-success { border-color: #2d6a2d !important; background: #eaf5ea !important; }
  .alert-warning { border-color: #856404 !important; background: #fffbe6 !important; }
  .alert-danger  { border-color: #7f1d1d !important; background: #fef2f2 !important; }

  /* Cards */
  .card {
    border: 1px solid #ccc !important;
    background: white !important;
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 8pt !important;
    box-shadow: none !important;
  }
  .card-header {
    background: #f0f0f0 !important;
    color: #111 !important;
    border-bottom: 1px solid #ccc !important;
    padding: 3pt 7pt !important;
    font-size: 8.5pt !important;
    font-weight: 600 !important;
  }
  .card-body { padding: 4pt 7pt !important; }

  /* Stat cards */
  .stat-card {
    background: #f5f5f5 !important;
    border: 1px solid #ddd !important;
    padding: 3pt 5pt !important;
    border-radius: 2pt !important;
  }
  .stat-label { color: #555 !important; font-size: 6.5pt !important; }
  .stat-value { color: #111 !important; font-size: 10pt !important; }
  .stat-sub   { color: #666 !important; font-size: 6.5pt !important; }

  /* Colored stat cards */
  .stat-ok     { background: #eaf5ea !important; border-color: #2d6a2d !important; }
  .stat-danger { background: #fef2f2 !important; border-color: #9b1c1c !important; }
  .stat-warn   { background: #fffbe6 !important; border-color: #856404 !important; }

  /* Tables */
  .table-dark-fp, table {
    color: #111 !important;
    background: white !important;
  }
  table thead th {
    background: #f0f0f0 !important;
    color: #111 !important;
    border-color: #ccc !important;
  }
  table tbody tr { border-color: #ddd !important; }
  table td, table th { border-color: #ddd !important; font-size: 9pt !important; }

  /* METAR raw text */
  .metar-raw {
    background: #f5f5f5 !important;
    color: #222 !important;
    border: 1px solid #ddd !important;
    font-size: 8.5pt !important;
    font-family: 'Courier New', monospace !important;
  }

  /* Section titles */
  .section-title {
    color: #333 !important;
    border-bottom: 1pt solid #bbb !important;
    font-size: 7.5pt !important;
    font-weight: 700 !important;
    margin-top: 7pt !important;
    margin-bottom: 4pt !important;
    padding-bottom: 1pt !important;
    letter-spacing: 0.06em !important;
  }

  /* Page breaks */
  .page-break-before { page-break-before: always !important; }
  .page-break-after  { page-break-after:  always !important; }
  .avoid-break       { break-inside: avoid; page-break-inside: avoid; }

  /* CG envelope chart — keep colours */
  canvas {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Badge colours preserved */
  .badge {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    border: 1px solid #999 !important;
    color: #111 !important;
    font-size: 7pt !important;
  }
  .bg-success { background: #2d6a2d !important; color: white !important; }
  .bg-danger  { background: #9b1c1c !important; color: white !important; }
  .bg-warning { background: #856404 !important; color: white !important; }

  /* Cover page */
  .bp-cover {
    text-align: center;
    padding: 20pt 0;
    border-bottom: 2pt solid #333;
    margin-bottom: 12pt;
  }
  .bp-cover h1 { font-size: 20pt !important; color: #111 !important; }
  .bp-cover .route { font-size: 14pt !important; color: #333 !important; }

  /* Links → plain text */
  a { color: #111 !important; text-decoration: none !important; }

  /* Remove Bootstrap box-shadows, gradients */
  * { box-shadow: none !important; text-shadow: none !important; }

  /* CG gauge */
  .cg-gauge-wrap { background: #eee !important; }
  .cg-gauge-fill { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cg-ok  { background: #2d6a2d !important; color: white !important; }
  .cg-bad { background: #9b1c1c !important; color: white !important; }

  /* Progress bars */
  .progress { background: #ddd !important; }
  .progress-bar {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .bg-success.progress-bar { background: #2d6a2d !important; }
  .bg-danger.progress-bar  { background: #9b1c1c !important; }

  /* Routing section — always hidden in print (ICAO map is screen-only) */
  .routing-section { display: none !important; }
  #routeMap        { display: none !important; }

  /* Waypoint print table — hidden unless toggle enabled via JS class */
  #waypointPrintSection                    { display: none !important; }
  #waypointPrintSection.wp-print-enabled   { display: block !important; }

  .leaflet-control-container { display: none !important; }

  /* VAC charts — each on its own full-width page.
     Remove max-height so the chart fills the page vertically. */
  .vac-col {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
  .vac-img {
    max-height: none !important;
    width: 100% !important;
  }
}
