:root {
  --chip-bg: rgba(13,110,253,.12);
  --chip-border: rgba(13,110,253,.35);
}
body.dark-mode {
  --chip-bg: rgba(99,179,237,.18);
  --chip-border: rgba(99,179,237,.5);
}

/* Base chip style */
.chip, .airline-chip {
  display: inline-block;
  padding: .25rem .6rem;
  border-radius: 999px;
  background: var(--chip-bg, #f3f4f6);
  border: 1px solid var(--chip-border, #d1d5db);
  font-size: .8rem;
  margin: 2px;
  white-space: nowrap;
  line-height: 1.2;
  transition: all 0.25s ease-in-out;
  color: #111827 !important;         /* ✅ override blue links */
  text-decoration: none !important;  /* ✅ remove underline */
  cursor: pointer;
}

/* Links behave like normal chips */
a.chip, a.airline-chip {
  color: inherit !important;       /* prevent default link blue/purple */
  text-decoration: none !important;
  cursor: pointer !important;
}

/* Hover (light mode) */
.chip:hover, .airline-chip:hover {
  background-color: #0d6efd !important;
  color: #fff !important;
  border-color: #0d6efd !important;
  transform: scale(1.08);
  box-shadow: 0 3px 6px rgba(0,0,0,.2);
}

/* Hover (dark mode) */
body.dark-mode .chip:hover,
body.dark-mode .airline-chip:hover {
  background-color: #63b3ed !important;
  color: #121212 !important;
  border-color: #63b3ed !important;
  transform: scale(1.08);
  box-shadow: 0 3px 6px rgba(0,0,0,.5);
}

/* Airline cell wrapper */
.airline-cell {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  max-width: 100%;
  white-space: normal;
  align-items: center;
}
#airports-table td.airline-cell {
  vertical-align: top;
}

.navbar-brand { font-weight: 700; }
.card { border-radius: .8rem; }
.table thead th { vertical-align: middle; }

/* Loading overlay */
#loadingOverlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  color: #fff;
}

/* ✅ DataTables export buttons (light + dark) */
.dataTables_wrapper .dt-buttons .btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 38px !important;
  width: 120px !important;          /* fixed same width */
  max-width: 120px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;

  font-size: 0.9rem !important;
  line-height: 1.2 !important;
  background-color: #0d6efd !important;
  border-color: #0d6efd !important;
  color: #fff !important;
  border-radius: 50px !important;
  padding: .45rem 0 !important;
  font-weight: 500;
  margin: 0 .25rem .25rem 0 !important;
  transition: all .2s ease-in-out;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.dataTables_wrapper .dt-buttons .btn:hover {
  background-color: #0b5ed7 !important;
  border-color: #0b5ed7 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0,0,0,.2);
}

/* Buttons container */
/* DataTables export buttons container (light + dark) */
.dataTables_wrapper .dt-buttons {
  display: flex !important;
  flex-wrap: nowrap !important;   /* stay in one row */
  gap: 0.25rem;
}

body[dir="rtl"] .dataTables_wrapper .dt-buttons {
  display: flex !important;
  flex-direction: row-reverse !important;
  justify-content: flex-end !important;
  gap: 0.5rem;
}

/* Table container */
#airports-table {
  border-radius: 0.75rem;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
}
body.dark-mode #airports-table {
  background: #1e1e1e;
  box-shadow: 0 2px 8px rgba(0,0,0,.6);
}

/* Table header */
#airports-table thead {
  background: #0d6efd;
  color: #fff;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}
body.dark-mode #airports-table thead { background: #0b5ed7; }
#airports-table thead th {
  border: none !important;
  padding: 12px 14px;
  font-size: 0.85rem;
}

/* Rows */
#airports-table tbody tr { transition: background .15s ease-in-out; }
#airports-table tbody tr:hover { background: rgba(13,110,253,.08); }
body.dark-mode #airports-table tbody tr:hover { background: rgba(99,179,237,.15); }

#airports-table td {
  padding: 10px 14px;
  vertical-align: middle;
  border-color: #e9ecef !important;
}
body.dark-mode #airports-table td { border-color: #2c2c2c !important; }

/* Footer */
footer .hover-opacity:hover { opacity: 0.7; }
body.dark-mode footer { background: #1e1e1e; color: #ccc; }
body.dark-mode footer a { color: #bbb !important; }
.dark-bg-dark { background: #121212 !important; }

/* RTL tweaks */
body[dir="rtl"] .dataTables_filter { text-align: right !important; }
body[dir="rtl"] .dataTables_filter label {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
}
body[dir="rtl"] .dataTables_filter input {
  margin-left: 0 !important;
  margin-right: .5rem !important;
  direction: rtl;
  text-align: right;
}
body[dir="rtl"] .dataTables_wrapper .dt-buttons .btn { order: unset !important; }
body[dir="rtl"] .navbar .d-flex { margin-left: 10rem; }

/* Modal map fix */
#mapModal .modal-body { overflow: hidden; padding: 0; }
#mapModal #map-frame { display: block; width: 100%; height: 100%; border: none; }

/* Headings dark mode */
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode .page-title,
body.dark-mode .header-title,
body.dark-mode .card-header,
body.dark-mode .card-title,
body.dark-mode .navbar-brand {
  color: #e5e5e5 !important;
}
body.dark-mode h1,
body.dark-mode .page-title { color: #63b3ed !important; }

/* Responsive brand title */
#brand-title {
  font-weight: 700;
  font-size: 1.25rem;  /* default desktop size */
  white-space: nowrap;
}

@media (max-width: 768px) {
  #brand-title {
    font-size: 1rem;       /* smaller font on mobile */
    max-width: 200px;      /* limit width */
    overflow: hidden;      /* cut if too long */
    text-overflow: ellipsis;
    display: inline-block;
    vertical-align: middle;
  }
}
/* Closed state ► */
td.dtr-control:before {
  background-image: none !important;   /* remove DataTables default */
  content: "\25B6" !important;         /* ► unicode */
  color: #0d6efd !important;           /* Bootstrap blue */
  font-size: 1rem !important;
  font-weight: bold !important;
  display: inline-block !important;
  margin-right: 6px !important;
  vertical-align: middle !important;
}

/* Open state ▼ */
tr.parent td.dtr-control:before {
  background-image: none !important;
  content: "\25BC" !important;         /* ▼ unicode */
  color: #0d6efd !important;
}