/* ========================================================= */
/*                UNITED FLEET LOOKUP – CORE STYLES          */
/* ========================================================= */

/* ========================================================= */
/*                      DESIGN TOKENS                        */
/* ========================================================= */

/* Brand tokens */
:root {
  --ua-blue: #005DAA;
  --ua-blue-light: #1A73E8;
  --ua-blue-dark: #002244;
  --ua-header-bg: #ffffff;
  --bg-page: radial-gradient(circle at center,
                rgba(255,255,255,0.93) 0%,
                rgba(248,249,252,0.88) 40%,
                rgba(242,244,248,0.82) 100%);
  --text-main: #0f172a;
  --text-muted: #6b7280;
  --card-bg: #ffffff;
  --card-shadow-soft: 0 4px 16px rgba(15,23,42,0.06);
  --border-subtle: rgba(148,163,184,0.3);
}

/* ========================================================= */
/*                     GLOBAL LAYOUT                         */
/* ========================================================= */

html,
body {
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', 'Source Sans Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-main);
  background: var(--bg-page);
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

/* Standard container for most pages */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

/* Wider container specifically for Fleet Overview pages */
.container-wide {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

/* ========================================================= */
/*                  UNITED-STYLE FLOATING HEADER             */
/* ========================================================= */

.ufl-header {
  background: var(--ua-header-bg);
  border-bottom: 1px solid rgba(15,23,42,0.06);
  box-shadow: 0 2px 8px rgba(15,23,42,0.06);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.ufl-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ufl-brand {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--ua-blue);
}

.ufl-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Tabs */
.ufl-nav .nav-tab {
  padding: 7px 14px;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 14px;
  text-decoration: none;
  transition: 0.18s ease;
  font-weight: 500;
  white-space: nowrap;
}

.ufl-nav .nav-tab:hover {
  background: #e2e8f0;
}

.ufl-nav .nav-tab.active {
  background: var(--ua-blue);
  border-color: var(--ua-blue);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(15,23,42,0.22);
}

/* Login button */
.ufl-nav .nav-login {
  padding: 7px 18px;
  border-radius: 999px;
  background: #2563eb;
  color: #ffffff !important;
  text-decoration: none;
  font-size: 14px;
  margin-left: 6px;
  transition: 0.18s ease;
  font-weight: 600;
  border: none;
  white-space: nowrap;
}

.ufl-nav .nav-login:hover {
  background: #1d4ed8;
}

/* Animated runway bar (header) */
.ufl-runway-bar {
  height: 5px;
  background: linear-gradient(
    to right,
    var(--ua-blue-dark),
    var(--ua-blue),
    var(--ua-blue-light),
    var(--ua-blue),
    var(--ua-blue-dark)
  );
  opacity: 0.45;
  position: relative;
  display: none; /* enable by adding class runway-active */
}

.ufl-runway-bar.runway-active {
  display: block;
}

.ufl-runway-bar.runway-active::after {
  content: "";
  position: absolute;
  top: 0;
  left: -150px;
  width: 130px;
  height: 100%;
  background: linear-gradient(
    to right,
    transparent 0%,
    rgba(255,255,255,0.90) 50%,
    transparent 100%
  );
  filter: blur(6px);
  animation: headerRunwaySlide 7s linear infinite;
}

@keyframes headerRunwaySlide {
  0%   { left: -160px; }
  100% { left: 100%; }
}

/* ========================================================= */
/*                       HERO STRIP                          */
/* ========================================================= */

.ufl-hero-strip {
  padding: 32px 16px 16px;
}

.ufl-hero-inner {
  max-width: 1000px;
  margin: 0 auto;
}

.ufl-hero-title {
  margin: 0 0 8px;
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--ua-blue-dark);
}

.ufl-hero-sub {
  margin: 0;
  font-size: 0.98rem;
  color: var(--text-muted);
}

/* Generic section shell */
.ufl-section {
  padding: 8px 16px 0;
}

.ufl-section-inner {
  max-width: 1000px;
  margin: 0 auto;
}

/* ========================================================= */
/*                        SEARCH CARD                        */
/* ========================================================= */

.search-card {
  background: var(--card-bg);
  border-radius: 14px;
  box-shadow: var(--card-shadow-soft);
  padding: 18px 18px 16px;
  border: 1px solid rgba(148,163,184,0.25);
}

.search-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.search-label {
  font-size: 0.88rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
}

/* search hint text */
.search-hint {
  margin: 8px 0 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.search-hint span {
  font-family: "SF Mono", ui-monospace, Menlo, Monaco, "Courier New", monospace;
  font-size: 0.84rem;
}

/* SEARCH BOX (re-style existing classes) */
.search-box-container {
  padding: 0;
}

.search-box {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 4px 0 4px;
  overflow-x: auto;
  width: 100%;
}

/* ===== Prevent "Search by:" from wrapping when all selects are visible ===== */
.search-box {
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
}

.search-box label {
  font-weight: 500;
  font-size: 0.95rem;
  color: #0f172a;
  white-space: nowrap;
}

.search-box select,
.search-box input {
  padding: 8px 10px;
  font-size: 0.95rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  min-width: 140px;
}

.search-box select:focus,
.search-box input:focus {
  outline: none;
  border-color: var(--ua-blue);
  box-shadow: 0 0 0 1px rgba(37,99,235,0.25);
  background: #ffffff;
}

.search-box button {
  padding: 9px 18px;
  font-size: 0.95rem;
  border-radius: 999px;
  border: none;
  background: #2563eb;
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(37,99,235,0.35);
}

.search-box button:hover {
  background: #1d4ed8;
}

/* Remove aggressive focus reset from previous version */
.search-box input,
.search-box select {
  -webkit-tap-highlight-color: transparent;
}

/* Mobile search handling */
@media (max-width: 600px) {
  .fleet-search-box {
    display: block !important;
    width: 100% !important;
  }

  .fleet-search-box label {
    display: block;
    width: 100%;
    margin-bottom: 6px;
  }

  .fleet-search-box select,
  .fleet-search-box input,
  .fleet-search-box button {
    width: 100% !important;
    max-width: 100% !important;
    display: block;
    box-sizing: border-box;
    margin-bottom: 10px;
  }

  .search-box {
    overflow-x: visible;
  }
}

/* ========================================================= */
/*                      RESULT CARDS                         */
/* ========================================================= */

.message {
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.result-card {
  margin-top: 24px;
  background: var(--card-bg);
  border-radius: 14px;
  box-shadow: var(--card-shadow-soft);
  padding: 18px 20px 18px;
  border: 1px solid var(--border-subtle);
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(226,232,240,0.9);
  padding-bottom: 8px;
}

.result-header h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.result-header span {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px 12px;
  font-size: 0.9rem;
}

.result-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  font-weight: 600;
  color: #1f2937;
}

.field-value {
  color: #0f172a;
}

/* Responsive grid tweaks */
@media (max-width: 600px) {
  .result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 400px) {
  .result-grid {
    grid-template-columns: 1fr;
  }
}

/* ========================================================= */
/*                     DASHBOARD / CHARTS                    */
/* ========================================================= */

.dashboard {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 32px;
  justify-content: center;
}

.chart-wrapper {
  flex: 1 1 300px;
  max-width: 45%;
}

.chart-wrapper canvas {
  display: block;
  margin: 0 auto;
  max-width: 320px;
  max-height: 320px;
  width: 100% !important;
  height: 100% !important;
}

/* Responsive charts */
@media (max-width: 800px) {
  .chart-wrapper {
    max-width: 100%;
  }
}

/* ========================================================= */
/*            LIVERY TRACKING SIDE-BY-SIDE LAYOUT            */
/* ========================================================= */

.livery-flex-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: nowrap;
}

.livery-left {
  flex: 1;
  min-width: 260px;
}

.livery-chart-right {
  flex: 1;
  max-width: 380px;
  min-width: 320px;
  position: relative;
  aspect-ratio: 1 / 1;
}

.livery-chart-right canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
}

@media (max-width: 700px) {
  .livery-flex-wrap {
    flex-direction: column;
    align-items: center;
  }

  .livery-chart-right {
    max-width: 280px;
    min-width: 280px;
    aspect-ratio: 1 / 1;
  }
}

/* ========================================================= */
/*                           TABLES                          */
/* ========================================================= */

.breakdown {
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: #374151;
  background: var(--card-bg);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 2px 8px rgba(15,23,42,0.04);
  border: 1px solid rgba(226,232,240,0.9);
}

.breakdown-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  margin-bottom: 2px;
}

.breakdown-total {
  font-weight: 600;
  margin-bottom: 6px;
}

.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 4px;
}

.breakdown-table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
  padding: 4px 0 6px;
  border-bottom: 1px solid #e5e7eb;
}

.breakdown-table tbody tr:nth-child(even) {
  background: #f9fafb;
}

.breakdown-table th,
.breakdown-table td {
  padding: 4px 0;
  font-size: 0.85rem;
}

.breakdown-table th.numeric,
.breakdown-table td.numeric {
  text-align: right;
  white-space: nowrap;
}

/* Left-align first column */
.breakdown-table th:first-child,
.breakdown-table td:first-child {
  text-align: left;
  padding-left: 0;
}

.breakdown-muted td {
  color: #6b7280;
}

.painted-type-table {
  margin-top: 16px;
}

/* TOTAL row */
.breakdown-total-row {
  background: #f9fafb;
  border-top: 2px solid #d1d5db;
}

.breakdown-total-row td {
  font-weight: 600;
  padding-top: 8px;
}

/* ========================================================= */
/* Collapsible Aircraft Family Styling (global)              */
/* ========================================================= */

.fleet-family {
  margin-bottom: 24px;
  border-radius: 10px;
  background: var(--card-bg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  padding: 0;
  border: 1px solid rgba(226,232,240,0.9);
}

.family-toggle {
  width: 100%;
  background: #f9fafb;
  border: none;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: #0033A0;
}

.family-toggle:hover {
  background: #f3f4f6;
}

.family-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s ease;
  padding: 0 16px;
}

.fleet-family.open .family-content {
  max-height: 2000px;
  padding-bottom: 16px;
}

/* Shared chevron icon for all collapsibles */
.chevron {
  font-size: 18px;
  color: #1f2937;
  transition: transform .25s ease;
}

.fleet-family.open .chevron {
  transform: rotate(180deg);
}

/* ========================================================= */
/*      FLEET OVERVIEW – LAYOUT & PLANESPOTTERS-STYLE TABLE  */
/* ========================================================= */

/* Two-column layout: summary left, table right */
.fleet-overview-layout {
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  gap: 24px;
  align-items: flex-start;
}

.fleet-summary-panel {
  position: sticky;
  top: 90px; /* sits just under header */
  height: fit-content;
}

.fleet-table-panel {
  overflow-x: auto;
  padding-bottom: 16px;
}

@media (max-width: 900px) {
  .fleet-overview-layout {
    grid-template-columns: 1fr;
  }

  .fleet-summary-panel {
    position: static;
  }
}

/* Summary card tweaks (left column) */
.analytics-card {
  background: var(--card-bg);
  border-radius: 14px;
  box-shadow: var(--card-shadow-soft);
  border: 1px solid var(--border-subtle);
  padding: 24px;
  margin-top: 24px;
}

/* Slightly stronger title inside analytics cards only */
.analytics-card .breakdown-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* summary tables inside analytics cards */
.analytics-card .breakdown-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.analytics-card .breakdown-table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: #9ca3af;
  padding: 4px 0 6px;
  border-bottom: 1px solid #e5e7eb;
}

.analytics-card .breakdown-table tbody tr:nth-child(even) {
  background: #f9fafb;
}

.analytics-card .breakdown-table td,
.analytics-card .breakdown-table th {
  padding: 6px 4px;
  font-size: 0.85rem;
}

.analytics-card .numeric {
  text-align: right;
}

/* TOTAL row */
.analytics-card .breakdown-total-row {
  background: #f9fafb;
  border-top: 2px solid #d1d5db;
}

.analytics-card .breakdown-total-row td {
  font-weight: 700;
  padding-top: 8px;
}

/* -------- Fleet overview main table (right column) -------- */

.fleet-table-wrapper {
  margin-top: 8px;
  border-radius: 10px;
  border: 1px solid rgba(226,232,240,0.9);
  overflow: hidden;
}

.fleet-table {
  width: 100%;
  border-collapse: collapse;
}

.fleet-table thead th {
  background: #f8fafc;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: #6b7280;
  padding: 8px 8px;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

.fleet-table tbody td {
  padding: 8px 8px;
  font-size: 0.9rem;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

.fleet-parent-row {
  background: #f1f5f9;
  font-weight: 700;
  cursor: pointer;
}

.fleet-parent-row:hover {
  background: #e2e8f0;
}

.fleet-child-row {
  background: #ffffff;
}

.fleet-child-row:nth-child(even) {
  background: #f9fafb;
}

.numeric-cell {
  text-align: right;
}

.fleet-type-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fleet-toggle-icon {
  display: inline-flex;
  width: 18px;
  justify-content: center;
  font-weight: 700;
}

.fleet-child-hidden {
  display: none;
}

/* ========================================================= */
/* FLEET OVERVIEW – MODAL (kept for future use)              */
/* ========================================================= */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 80px;
  z-index: 1200;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  padding: 24px;
  border-radius: 14px;
  width: 520px;
  max-width: 90%;
  max-height: 80%;
  overflow-y: auto;
  box-shadow: 0 12px 30px rgba(15,23,42,0.35);
}

.modal-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid #e5e7eb;
}

.modal-row:last-child {
  border-bottom: none;
}

.modal-label {
  font-weight: 600;
  color: #374151;
}

.modal-value {
  color: #0f172a;
  margin-left: 12px;
  text-align: right;
}

/* ========================================================= */
/*                          FOOTER                           */
/* ========================================================= */

footer {
  margin-top: auto;
  text-align: center;
  opacity: 0.65;
  font-size: 0.8rem;
  color: #9ca3af;
  padding: 14px 16px 20px;
}

/* ========================================================= */
/*                    ABOUT SECTION REFINEMENT               */
/* ========================================================= */

.ufl-about {
  margin-top: 2rem;
}

.ufl-about-card {
  background: #ffffff;
  border-radius: 14px;
  padding: 28px 32px;
  max-width: 960px;
  margin: 0 auto;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.06),
    0 1px 3px rgba(0, 0, 0, 0.04);
}

.ufl-about-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.ufl-about-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.ufl-about-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: #2b5fd9;
}

.ufl-about-card p {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #3a3a3a;
  margin: 10px 0;
}

.ufl-about-disclaimer {
  font-size: 0.8rem;
  color: #777;
  margin-top: 14px;
}

/* Last updated notice */
.last-updated {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: #6b7280;
  text-align: center;
}

/* ------------------------------------------------------------
   Donate Modal
------------------------------------------------------------ */

.donate-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 20, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

/* Ensure hidden attribute always wins */
.donate-overlay[hidden] {
  display: none !important;
}

.donate-modal {
  max-width: 420px;
  width: calc(100% - 32px);
  padding: 26px 28px 28px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.92);
  position: relative;
  animation: donateFadeIn 0.35s ease-out;
}

.donate-modal h2 {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 600;
}

.donate-modal p {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.75);
}

.donate-button {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 999px;
  background: #3aa0ff;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.donate-button:hover {
  filter: brightness(1.05);
}

.donate-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.65);
  font-size: 22px;
  cursor: pointer;
}

.donate-close:hover {
  color: #fff;
}

@keyframes donateFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}