/*
 * The public flight-schedule page (0.6.66) — list of published schedules and
 * one schedule's flights table with its change log. Shown to everyone, so it
 * has to stand on its own (guests open it from a Telegram / SMS link, with no
 * sidebar) and sit well inside the panel for signed-in users. Loaded on the
 * 'flight-schedules' route only (includes/enqueue.php). Colours are design
 * tokens; the navy brand bar is fixed (it must match the Telegram image —
 * aerobook-design.css .aero-schedule-brand). The flights table is an LTR island
 * (English column labels, identical to the Telegram image).
 */

.aero-sched {
  max-width: 64rem;
  margin-inline: auto;
  padding: .5rem .25rem 1.5rem;
}

.aero-sched .aero-schedule-brand {
  min-height: 4.5rem;
  margin-block-end: 1.5rem;
  border-radius: 1.25rem;
  box-shadow: 0 10px 28px rgba(21, 41, 66, .2);
}

.aero-sched__loading,
.aero-sched__empty {
  padding: 2rem 1rem;
  border: 1px dashed var(--aero-line);
  border-radius: 1rem;
  background: var(--aero-surface);
  color: var(--aero-ink-muted);
  font-size: .92rem;
  text-align: center;
}

/* A whole day's schedule cancelled from admin/flight-schedule-manager.php (Dara,
   2026-09-26, migration 051) — red rectangle, white text, exactly as asked for,
   not a themed token: this is meant to read as unambiguous, not on-brand. */
.aero-sched-cancel-notice {
  padding: 1rem 1.25rem;
  border-radius: .75rem;
  background: #dc3545;
  color: #fff;
  font-weight: 700;
  text-align: center;
}

.aero-sched__loading::before {
  content: '';
  display: block;
  width: 1.5rem;
  height: 1.5rem;
  margin: 0 auto .75rem;
  border: 3px solid var(--aero-line);
  border-top-color: var(--aero-brand);
  border-radius: 50%;
  animation: aero-sched-spin .8s linear infinite;
}

@keyframes aero-sched-spin { to { transform: rotate(360deg); } }

.aero-sched__back { margin: 1rem 0 0; }

/* --- Published schedules ------------------------------------------------ */

.aero-sched-list__head h2 {
  margin: 0;
  color: var(--aero-ink);
  font-size: 1.15rem;
  font-weight: 700;
}

.aero-sched-list__head p {
  margin: .35rem 0 1.25rem;
  color: var(--aero-ink-muted);
  font-size: .85rem;
}

.aero-sched-list {
  display: grid;
  gap: .75rem;
}

.aero-sched-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--aero-line);
  border-radius: 1rem;
  background: var(--aero-surface);
  color: var(--aero-ink);
  text-decoration: none;
  transition: border-color var(--aero-transition), box-shadow var(--aero-transition), transform var(--aero-transition);
}

.aero-sched-item:hover {
  border-color: var(--aero-brand-300);
  box-shadow: var(--aero-shadow);
  color: var(--aero-ink);
  transform: translateY(-2px);
}

.aero-sched-item__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: .75rem;
  background: var(--aero-brand-100);
  color: var(--aero-brand-600);
}

.aero-sched-item__text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.aero-sched-item__text strong { font-size: .98rem; font-weight: 700; }
.aero-sched-item__text small { color: var(--aero-ink-muted); font-size: .72rem; letter-spacing: .06em; text-align: right; }

.aero-sched-item__chev { display: inline-flex; color: var(--aero-ink-muted); }
.aero-sched-item__chev svg { transform: scaleX(-1); }

.aero-sched-status {
  flex-shrink: 0;
  padding: .2rem .7rem;
  border: 1px solid color-mix(in srgb, var(--aero-success) 30%, var(--aero-surface));
  border-radius: 999px;
  background: color-mix(in srgb, var(--aero-success) 10%, var(--aero-surface));
  color: color-mix(in srgb, var(--aero-success) 70%, #000);
  font-size: .75rem;
  font-weight: 600;
}

.aero-sched-status--modified {
  border-color: color-mix(in srgb, var(--aero-info) 30%, var(--aero-surface));
  background: color-mix(in srgb, var(--aero-info) 10%, var(--aero-surface));
  color: color-mix(in srgb, var(--aero-info) 70%, #000);
}

/* --- One schedule ------------------------------------------------------- */

.aero-sched__body {
  text-align: left;
}

.aero-sched__meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  margin-block-end: 1.5rem;
  text-align: center;
}

.aero-sched__id {
  padding: .15rem .7rem;
  border-radius: 999px;
  background: var(--aero-wash);
  color: var(--aero-ink-muted);
  font-size: .75rem;
}

.aero-sched__date {
  color: var(--aero-ink);
  font-size: 1.1rem;
  font-weight: 700;
}

.aero-sched__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-block-end: 1rem;
}

.aero-sched__bar h3 {
  margin: 0;
  color: var(--aero-ink);
  font-size: 1.05rem;
  font-weight: 700;
}

.aero-sched-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  color: var(--aero-ink-muted);
  font-size: .8rem;
}

.aero-sched-legend li { display: inline-flex; align-items: center; gap: .4rem; }

.aero-sched-legend__swatch {
  display: inline-block;
  width: .8rem;
  height: .8rem;
  border: 1px solid var(--aero-line);
  border-radius: 3px;
}

.aero-sched-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--aero-line);
  border-radius: 1rem;
  background: var(--aero-surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .04);
}

.aero-sched-table {
  width: 100%;
  min-width: 46rem;
  border-collapse: collapse;
  font-size: .88rem;
}

.aero-sched-table thead th {
  padding: .8rem 1rem;
  background: #152942;
  color: #E2E8F0;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-align: center;
  white-space: nowrap;
}

.aero-sched-table tbody td {
  padding: .85rem 1rem;
  border-block-start: 1px solid var(--aero-line);
  color: var(--aero-ink);
  text-align: center;
  vertical-align: middle;
}

.aero-sched-table tbody tr:first-child td { border-block-start: 0; }
.aero-sched-table tbody tr:nth-child(even) { background-color: color-mix(in srgb, var(--aero-wash) 55%, transparent); }
.aero-sched-table tbody tr:hover td { background-color: color-mix(in srgb, var(--aero-brand) 5%, transparent); }
.aero-sched-table__time { font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: .03em; }

/* A flight of a finished day that was settled as not flown (0.6.178): the row stays, muted, with a badge — no reason shown. */
.aero-sched-table__row--cancelled td { color: var(--aero-ink-muted); }
.aero-sched-flight-badge {
  display: inline-block;
  margin-inline-start: .5rem;
  padding: .1rem .6rem;
  border-radius: 999px;
  background: var(--aero-danger);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
}

/* On a phone the table becomes one card per flight, each cell labelled. */
@media (max-width: 767.98px) {
  .aero-sched-table-wrap { overflow: visible; border: 0; background: transparent; box-shadow: none; }
  .aero-sched-table { min-width: 0; display: block; }
  .aero-sched-table thead { display: none; }
  .aero-sched-table tbody { display: grid; gap: .85rem; }

  .aero-sched-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .6rem 1rem;
    padding: 1rem;
    border: 1px solid var(--aero-line);
    border-radius: 1rem;
    background-color: var(--aero-surface);
    box-shadow: var(--aero-shadow-sm);
  }

  .aero-sched-table tbody tr:nth-child(even),
  .aero-sched-table tbody tr:hover td { background-color: var(--aero-surface); }

  .aero-sched-table tbody td {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    padding: 0;
    border: 0;
    text-align: left;
    overflow-wrap: anywhere;
  }

  .aero-sched-table tbody td::before {
    content: attr(data-label);
    color: var(--aero-ink-muted);
    font-size: .68rem;
    font-weight: 500;
    letter-spacing: .05em;
    text-transform: uppercase;
  }

  /* The time leads the card, full width. */
  .aero-sched-table tbody td.aero-sched-table__time {
    order: -1;
    grid-column: 1 / -1;
    padding-block-end: .6rem;
    border-block-end: 1px solid var(--aero-line);
    font-size: 1.4rem;
  }
}

/* --- Change log (staff only) -------------------------------------------- */

.aero-sched-log {
  margin-block-start: 1.75rem;
  border: 1px solid var(--aero-line);
  border-radius: 1rem;
  background: var(--aero-surface);
  overflow: hidden;
}

.aero-sched-log h3 {
  margin: 0;
  padding: .9rem 1.25rem;
  border-block-end: 1px solid var(--aero-line);
  background: var(--aero-wash);
  color: var(--aero-ink);
  font-size: .95rem;
  font-weight: 700;
}

.aero-sched-log ol { margin: 0; padding: 0; list-style: none; }

.aero-sched-log li {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: .5rem;
  padding: .85rem 1.25rem;
  border-block-start: 1px solid var(--aero-line);
  color: var(--aero-ink);
  font-size: .88rem;
}

.aero-sched-log li:first-child { border-block-start: 0; }

.aero-sched-log__num,
.aero-sched-log__date {
  flex-shrink: 0;
  padding: .1rem .6rem;
  border-radius: 999px;
  font-size: .72rem;
  white-space: nowrap;
}

.aero-sched-log__num { background: var(--aero-brand-100); color: var(--aero-brand-700); font-weight: 600; }
.aero-sched-log__date { border: 1px solid var(--aero-line); background: var(--aero-surface); color: var(--aero-ink-muted); }
.aero-sched-log__text { flex: 1 1 14rem; }

@media (prefers-reduced-motion: reduce) {
  .aero-sched__loading::before { animation: none; }
  .aero-sched-item { transition: none; }
}
