* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  background: #0b0e14;
  color: #eceef2;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  overflow: hidden;
}

#app {
  display: grid;
  grid-template-columns: 360px 1fr;
  grid-template-rows: 100vh;
  grid-template-rows: 100dvh;
  height: 100vh;
  height: 100dvh;
}

#sidebar {
  background: #10131a;
  border-right: 1px solid #232733;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#sidebarToggle,
#sidebarClose,
#sidebarBackdrop {
  display: none;
}

/* Mobile / narrow screens: the map takes the full viewport, and the
   aircraft list becomes a slide-in panel instead of a fixed column --
   a fixed 360px sidebar would eat nearly the whole screen on a phone. */
@media (max-width: 760px) {
  #app {
    grid-template-columns: 1fr;
  }

  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    height: 100dvh;
    width: min(340px, 86vw);
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 8px 0 24px rgba(0,0,0,0.5);
  }

  #sidebar.open {
    transform: translateX(0);
  }

  #sidebarBackdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 35;
  }

  #sidebarBackdrop.open {
    display: block;
  }

  #sidebarToggle {
    display: flex;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 45;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 10px;
    background: #171a21e6;
    color: #eceef2;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.45);
    -webkit-tap-highlight-color: transparent;
  }

  #sidebarHeader {
    position: relative;
  }

  #sidebarClose {
    display: flex;
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: #232733;
    color: #eceef2;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
  }

  #mapControls {
    bottom: 20px;
  }
}

#sidebarHeader {
  padding: 16px 18px 12px;
  border-bottom: 1px solid #232733;
}

#sidebarHeader h1 {
  font-size: 17px;
  margin: 0 0 2px;
  letter-spacing: -0.01em;
}

#sidebarHeader .sub {
  font-size: 12px;
  color: #8b92a3;
}

#statusRow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 12px;
  color: #8b92a3;
  border-bottom: 1px solid #232733;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f87171;
  flex-shrink: 0;
}
.dot.ok { background: #6ee7b7; }

#notifyRow {
  margin: 12px 18px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notify-label {
  font-size: 13.5px;
  font-weight: 600;
}

.toggle-switch {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: #232733;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s ease;
  flex-shrink: 0;
}
.toggle-switch[aria-checked="true"] {
  background: #6ee7b7;
}
.toggle-switch:disabled {
  opacity: 0.5;
  cursor: default;
}

.toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #eceef2;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.toggle-switch[aria-checked="true"] .toggle-knob {
  transform: translateX(20px);
  background: #0b0e14;
}

#notifyStatus {
  margin: 0 18px 4px;
  font-size: 11.5px;
  color: #8b92a3;
  min-height: 14px;
}

#notifyFilterRow {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 18px 0;
  font-size: 11.5px;
  color: #8b92a3;
}

#notifyFilterRow label {
  white-space: nowrap;
}

#notifyAirportInput {
  flex: 1;
  min-width: 0;
  background: #171a21;
  border: 1px solid #232733;
  border-radius: 8px;
  padding: 6px 8px;
  color: #eceef2;
  font-size: 12px;
  text-transform: uppercase;
  outline: none;
}
#notifyAirportInput:focus { border-color: #60a5fa; }

#notifyFilterSaveBtn {
  background: #232733;
  color: #eceef2;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
#notifyFilterSaveBtn:hover { background: #2c3140; }

#notifyChips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 18px 0;
}
#notifyChips:empty { margin: 0; }

.notify-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #16362a;
  border: 1px solid #6ee7b7;
  color: #6ee7b7;
  border-radius: 999px;
  padding: 5px 6px 5px 11px;
  font-size: 12px;
  font-weight: 700;
}

.notify-chip .chip-remove {
  background: none;
  border: none;
  color: #6ee7b7;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 50%;
}
.notify-chip .chip-remove:hover {
  background: #6ee7b733;
}

#trackedRow {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 18px 0;
  font-size: 11.5px;
  color: #8b92a3;
}
#trackedRow label { white-space: nowrap; }

#trackedTailInput {
  flex: 1;
  min-width: 0;
  background: #171a21;
  border: 1px solid #232733;
  border-radius: 8px;
  padding: 6px 8px;
  color: #eceef2;
  font-size: 12px;
  text-transform: uppercase;
  outline: none;
}
#trackedTailInput:focus { border-color: #60a5fa; }
#trackedTailInput::placeholder { text-transform: none; }

#trackedTailAddBtn {
  background: #232733;
  color: #eceef2;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
#trackedTailAddBtn:hover { background: #2c3140; }

#trackedList {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 18px 4px;
}

.tracked-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #171a21;
  border-left: 3px solid #4b5563;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
}
.tracked-card.urgency-red { border-left-color: #b91c1c; }
.tracked-card.urgency-yellow { border-left-color: #b45309; }
.tracked-card.urgency-green { border-left-color: #047857; }
.tracked-card.urgency-blue { border-left-color: #1d4ed8; }

.tracked-card .tc-tail {
  font-weight: 700;
  flex-shrink: 0;
}
.tracked-card .tc-status {
  flex: 1;
  color: #8b92a3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tracked-card .tc-remove {
  background: none;
  border: none;
  color: #8b92a3;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  flex-shrink: 0;
}
.tracked-card .tc-remove:hover { color: #f87171; }

#sidebarFooter {
  padding: 12px 18px 16px;
  border-top: 1px solid #232733;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  font-size: 12px;
  color: #8b92a3;
  flex-shrink: 0;
}

#sidebarFooter a {
  color: #60a5fa;
  text-decoration: none;
  font-weight: 600;
}
#sidebarFooter a:hover { text-decoration: underline; }

#searchForm {
  display: flex;
  gap: 6px;
  margin: 4px 18px 0;
}

#searchInput,
#listFilterInput {
  flex: 1;
  background: #171a21;
  border: 1px solid #232733;
  border-radius: 8px;
  padding: 8px 10px;
  color: #eceef2;
  font-size: 12.5px;
  outline: none;
  min-width: 0;
}
#searchInput:focus,
#listFilterInput:focus,
#sortSelect:focus,
#typeSelect:focus {
  border-color: #60a5fa;
}

#searchForm button {
  background: #60a5fa;
  color: #0b0e14;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

#searchResult {
  margin: 0 18px;
}

#searchResult:empty { display: none; }

.search-card {
  background: #171a21;
  border: 1px solid #60a5fa;
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 8px;
  font-size: 12.5px;
}
.search-card .sr-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.search-card .sr-ident { font-weight: 700; font-size: 14px; }
.search-card .sr-close {
  background: none;
  border: none;
  color: #8b92a3;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 4px;
}
.search-card .sr-meta { color: #8b92a3; }
.search-card .sr-meta b { color: #eceef2; font-weight: 600; }
.search-empty {
  color: #8b92a3;
  font-size: 12.5px;
  padding: 8px 0 0;
}

#filterBar {
  display: flex;
  gap: 6px;
  margin: 12px 18px 4px;
  flex-wrap: wrap;
}

#sortSelect,
#typeSelect {
  background: #171a21;
  border: 1px solid #232733;
  border-radius: 8px;
  padding: 7px 8px;
  color: #eceef2;
  font-size: 12px;
  outline: none;
}

#listFilterInput,
#destFilterInput {
  flex-basis: 100%;
  margin-top: 2px;
  text-transform: uppercase;
}
#destFilterInput::placeholder {
  text-transform: none;
}

#aircraftList {
  overflow-y: auto;
  flex: 1;
  padding: 4px 10px 18px;
}

.ac-card {
  background: #171a21;
  border: 1px solid #232733;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 6px 0;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.ac-card:hover { border-color: #3a4152; }
.ac-card.selected { border-color: #60a5fa; }

.ac-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.ac-ident {
  font-weight: 700;
  font-size: 14px;
}

.ac-callsign {
  font-weight: 500;
  font-size: 12px;
  color: #8b92a3;
}

.ac-phase {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 7px;
  border-radius: 999px;
  background: #232733;
  color: #8b92a3;
  white-space: nowrap;
}
.ac-phase.hot { background: #fbbf24; color: #0b0e14; }
.ac-phase.final { background: #f87171; color: #0b0e14; }

.ac-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px 10px;
  font-size: 11.5px;
  color: #8b92a3;
}
.ac-meta b { color: #eceef2; font-weight: 600; }

.empty-hint {
  color: #8b92a3;
  font-size: 13px;
  text-align: center;
  padding: 30px 10px;
}

#cesiumContainer {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Keep attribution visible (required by the basemap provider) but
   unobtrusive, matching the dark UI. */
.cesium-viewer-bottom {
  font-size: 10px;
  opacity: 0.7;
}
.cesium-credit-expand-link { display: none !important; }

#mapControls {
  position: fixed;
  right: 16px;
  bottom: 28px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.45);
}

#mapControls button {
  width: 42px;
  height: 42px;
  border: none;
  background: #171a21e6;
  color: #eceef2;
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

#mapControls button:hover,
#mapControls button:active {
  background: #232733;
}

#recenterBtn {
  font-size: 17px;
  border-top: 1px solid #0b0e14;
}

/* Aircraft detail panel (click any aircraft on the map or in the list) */

#detailBackdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 60;
}
#detailBackdrop.open { display: block; }

#detailPanel {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 61;
  width: min(420px, 92vw);
  max-height: 86vh;
  overflow-y: auto;
  background: #10131a;
  border: 1px solid #232733;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
#detailPanel.open { display: block; }

#detailClose {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: #0b0e14cc;
  color: #eceef2;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

#detailBody { padding: 0 0 18px; }

.dp-photo {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
  background: #171a21;
  border-radius: 14px 14px 0 0;
}

.dp-header {
  padding: 16px 18px 10px;
}

.dp-tail {
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dp-callsign {
  font-size: 14px;
  font-weight: 500;
  color: #8b92a3;
}

.dp-type {
  color: #8b92a3;
  font-size: 13px;
  margin-top: 2px;
}

.dp-phase-badge {
  margin-top: 8px;
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 999px;
  background: #232733;
  color: #8b92a3;
}
.dp-phase-badge.hot { background: #fbbf24; color: #0b0e14; }
.dp-phase-badge.final { background: #f87171; color: #0b0e14; }

.dp-section {
  padding: 12px 18px;
  border-top: 1px solid #232733;
}

.dp-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8b92a3;
  margin-bottom: 8px;
}

.dp-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 12px;
  font-size: 13px;
}
.dp-grid div { color: #8b92a3; }
.dp-grid b { color: #eceef2; font-weight: 600; display: block; font-size: 14px; }

.dp-route {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dp-route-airport {
  flex: 1;
  min-width: 0;
}
.dp-route-code {
  font-size: 16px;
  font-weight: 700;
}
.dp-route-name {
  font-size: 11.5px;
  color: #8b92a3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dp-route-arrow {
  color: #60a5fa;
  font-size: 18px;
  flex-shrink: 0;
}

.dp-loading, .dp-empty {
  color: #8b92a3;
  font-size: 12.5px;
}

.dp-progress {
  margin-top: 14px;
}

.dp-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #8b92a3;
  margin-bottom: 6px;
}

.dp-progress-track {
  position: relative;
  height: 4px;
  border-radius: 999px;
  background: #232733;
}

.dp-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 999px;
  background: #60a5fa;
}

.dp-progress-dot {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 13px;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6));
}

/* Feedback FAB (always accessible, not just from the splash) */

#feedbackFab {
  position: fixed;
  right: 16px;
  bottom: 190px;
  z-index: 25;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: #171a21e6;
  color: #eceef2;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.45);
}
#feedbackFab:hover { background: #232733; }

@media (max-width: 760px) {
  #feedbackFab { bottom: 150px; }
}

/* Splash / welcome screen */

#splashBackdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 70;
}
#splashBackdrop.open { display: block; }

#splashModal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 71;
  width: min(480px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
  background: #10131a;
  border: 1px solid #232733;
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.65);
}
#splashModal.open { display: block; }

#splashArt {
  height: 150px;
  overflow: hidden;
  border-radius: 16px 16px 0 0;
}
#splashArt svg {
  width: 100%;
  height: 100%;
  display: block;
}

#splashContent {
  padding: 20px 24px 26px;
}

#splashTitle {
  margin: 0;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.01em;
  background: linear-gradient(90deg, #6ee7b7, #60a5fa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

#splashWip {
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: #fbbf24;
}

#splashIntro, #splashIntro2, #splashIntro3 {
  font-size: 13.5px;
  line-height: 1.55;
  color: #c7cbd6;
  margin: 14px 0 0;
}

#splashActions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

#splashContinueBtn {
  flex: 1;
  background: #6ee7b7;
  color: #0b0e14;
  border: none;
  border-radius: 10px;
  padding: 12px 14px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

#splashFeedbackBtn {
  flex: 1;
  background: #232733;
  color: #eceef2;
  border: none;
  border-radius: 10px;
  padding: 12px 14px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
#splashFeedbackBtn:hover { background: #2c3140; }

#splashThanks {
  margin-top: 14px;
  font-size: 12.5px;
  color: #8b92a3;
  font-style: italic;
}

/* Feedback modal */

#feedbackBackdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 80;
}
#feedbackBackdrop.open { display: block; }

#feedbackModal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 81;
  width: min(380px, 90vw);
  background: #10131a;
  border: 1px solid #232733;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  padding: 22px 22px 20px;
}
#feedbackModal.open { display: block; }

#feedbackModal h2 {
  margin: 0;
  font-size: 17px;
}

.feedback-sub {
  margin: 4px 0 16px;
  font-size: 12.5px;
  color: #8b92a3;
}

#feedbackClose {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: #232733;
  color: #eceef2;
  font-size: 17px;
  cursor: pointer;
}

#feedbackForm {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#feedbackMessage, #feedbackEmail {
  background: #171a21;
  border: 1px solid #232733;
  border-radius: 10px;
  padding: 10px 12px;
  color: #eceef2;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  resize: vertical;
}
#feedbackMessage:focus, #feedbackEmail:focus { border-color: #60a5fa; }

#feedbackSubmitBtn {
  background: #60a5fa;
  color: #0b0e14;
  border: none;
  border-radius: 10px;
  padding: 11px 14px;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
}
#feedbackSubmitBtn:disabled { opacity: 0.6; cursor: default; }

#feedbackResult {
  margin-top: 10px;
  font-size: 12.5px;
  color: #8b92a3;
}
#feedbackResult.success { color: #6ee7b7; }
#feedbackResult.error { color: #f87171; }
