* { 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; }

#notifyBtn {
  margin: 12px 18px;
  background: #6ee7b7;
  color: #0b0e14;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
#notifyBtn:disabled {
  background: #232733;
  color: #8b92a3;
  cursor: default;
}

#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-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;
}
