@import url("https://fonts.googleapis.com/css2?family=League+Spartan:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #020711;
  --bg-deep: #06111f;
  --surface: rgba(9, 22, 42, 0.78);
  --surface-strong: rgba(10, 26, 50, 0.94);
  --surface-soft: rgba(59, 130, 246, 0.06);
  --line: rgba(148, 197, 255, 0.16);
  --line-strong: rgba(148, 197, 255, 0.28);
  --heading: #f1f7ff;
  --text: #eaf2ff;
  --muted: #9cafc7;
  --muted-deep: #647488;
  --primary: #388df8;
  --primary-dark: #1d5fb8;
  --accent: #facc15;
  --danger: #ff7b7b;
  --success: #67e8f9;
  --glow: rgba(56, 189, 248, 0.22);
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "League Spartan", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 16% -10%, rgba(56, 141, 248, 0.2), transparent 32rem),
    radial-gradient(circle at 90% 8%, rgba(14, 165, 233, 0.1), transparent 28rem),
    linear-gradient(145deg, var(--bg) 0%, var(--bg-deep) 52%, #020711 100%);
  background-attachment: fixed;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: 0.32;
  background-image:
    linear-gradient(rgba(148, 197, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 197, 255, 0.045) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, black, transparent 90%);
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1480px, calc(100% - 40px));
  margin: 24px auto;
}

.topbar {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

.brand,
.search-panel,
.map-panel,
.details-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(12, 29, 55, 0.88), rgba(5, 16, 32, 0.74));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(18px);
}

.brand {
  position: relative;
  overflow: hidden;
  padding: 28px 30px;
}

.brand::after {
  position: absolute;
  top: -55px;
  right: -44px;
  width: 200px;
  height: 200px;
  border: 1px solid rgba(103, 232, 249, 0.1);
  border-radius: 50%;
  box-shadow: 0 0 0 34px rgba(56, 189, 248, 0.025), 0 0 0 68px rgba(56, 189, 248, 0.02);
  content: "";
}

.eyebrow,
.toolbar-label {
  margin: 0 0 8px;
  color: #67e8f9;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.brand h1,
.map-toolbar h2,
.details-heading h2,
.flight-summary h3,
.popup-card h3 {
  margin: 0;
  color: var(--heading);
  font-weight: 700;
  letter-spacing: -0.025em;
}

.brand h1 {
  position: relative;
  z-index: 1;
  font-size: clamp(2.2rem, 4.6vw, 4.1rem);
  line-height: 0.95;
  text-shadow: 0 0 30px rgba(56, 189, 248, 0.14);
}

.subtitle {
  position: relative;
  z-index: 1;
  max-width: 54ch;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.45;
}

.search-panel {
  justify-content: center;
  padding: 24px;
}

.search-label {
  display: block;
  margin-bottom: 12px;
  color: var(--heading);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  color: var(--text);
  background: rgba(2, 7, 17, 0.72);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input[type="text"]::placeholder {
  color: var(--muted-deep);
}

input[type="text"]:focus {
  border-color: rgba(56, 189, 248, 0.72);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.13), 0 0 22px rgba(56, 189, 248, 0.1);
}

button {
  padding: 13px 18px;
  border: 1px solid rgba(103, 232, 249, 0.22);
  border-radius: 10px;
  color: #f8fbff;
  background: linear-gradient(135deg, #2378dc, #164d9b);
  box-shadow: 0 10px 22px rgba(2, 14, 34, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

button:hover {
  border-color: rgba(103, 232, 249, 0.62);
  box-shadow: 0 10px 26px rgba(0, 106, 255, 0.3), 0 0 20px var(--glow);
  transform: translateY(-1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.search-feedback {
  min-height: 1.2em;
  margin: 10px 2px 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.9fr);
  gap: 18px;
}

.map-panel {
  padding: 18px;
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.map-toolbar h2 {
  font-size: 1.58rem;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mode-badge,
.hero-chip {
  display: inline-flex;
  width: fit-content;
  border: 1px solid rgba(103, 232, 249, 0.2);
  border-radius: 999px;
  color: #a5f3fc;
  background: rgba(56, 189, 248, 0.09);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.mode-badge {
  padding: 8px 11px;
}

.map-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: #071525;
  box-shadow: 0 0 32px rgba(56, 189, 248, 0.1);
}

#map {
  width: 100%;
  height: min(72vh, 760px);
  background: #071525;
}

.leaflet-tile-pane {
  filter: saturate(0.68) brightness(0.68) contrast(1.08) hue-rotate(2deg);
}

.map-overlay {
  position: absolute;
  inset: 16px;
  z-index: 600;
  display: grid;
  place-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--heading);
  background: rgba(2, 7, 17, 0.78);
  text-align: center;
  backdrop-filter: blur(8px);
}

.map-overlay.hidden {
  display: none;
}

.details-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.details-card {
  padding: 22px;
}

.details-heading h2 {
  font-size: 1.66rem;
}

.flight-info {
  margin-top: 16px;
}

.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  padding: 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--muted);
  background: var(--surface-soft);
  text-align: center;
}

.flight-summary {
  display: grid;
  gap: 15px;
}

.hero-chip {
  padding: 6px 10px;
}

.flight-summary h3 {
  font-size: 2rem;
}

.flight-brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
}

.airline-logo {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(241, 247, 255, 0.92);
  object-fit: contain;
}

.airline-logo-fallback {
  display: grid;
  place-items: center;
  color: var(--primary-dark);
  font-weight: 800;
}

.summary-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
}

.flight-photo {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(2, 7, 17, 0.62);
}

.flight-photo img {
  display: block;
  width: 100%;
  height: 210px;
  background: #071525;
  object-fit: cover;
  opacity: 0.9;
}

.photo-note {
  margin: 0;
  padding: 10px 14px;
  color: var(--muted);
  font-size: 0.84rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metric-card,
.status-list li {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.055);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.metric-card {
  padding: 13px;
}

.metric-card span,
.status-list span {
  color: var(--muted);
}

.metric-card span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-card strong {
  color: var(--heading);
  font-size: 1.08rem;
}

.status-list {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.status-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 13px;
}

.status-list strong {
  color: var(--heading);
  font-size: 0.95rem;
}

.popup-card {
  min-width: 220px;
}

.popup-card h3 {
  font-size: 1.3rem;
}

.popup-card p {
  margin: 4px 0;
  color: var(--muted);
}

.popup-status {
  margin-top: 10px;
  color: #67e8f9;
  font-weight: 700;
  text-transform: capitalize;
}

.plane-marker {
  display: flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 5px rgba(250, 204, 21, 0.62));
}

.plane-marker svg {
  width: 100%;
  height: 100%;
}

.plane-marker path {
  fill: var(--accent);
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 0.6;
}

.leaflet-control-zoom a,
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  border-color: var(--line) !important;
  color: var(--text) !important;
  background: var(--surface-strong) !important;
}

.leaflet-control-zoom {
  border: 1px solid var(--line) !important;
  box-shadow: var(--shadow) !important;
}

.leaflet-control-zoom a {
  border-bottom-color: var(--line) !important;
}

.leaflet-popup-content-wrapper {
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow), 0 0 24px rgba(56, 189, 248, 0.12);
}

.leaflet-container a.leaflet-popup-close-button {
  color: var(--muted) !important;
}

.leaflet-control-attribution {
  color: var(--muted) !important;
  background: rgba(2, 7, 17, 0.74) !important;
}

.leaflet-control-attribution a {
  color: #67e8f9 !important;
}

.muted {
  color: var(--muted);
}

.danger {
  color: var(--danger) !important;
}

.success {
  color: var(--success) !important;
}

@media (max-width: 1080px) {
  .topbar,
  .content-grid {
    grid-template-columns: 1fr;
  }

  #map {
    height: 60vh;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 1480px);
    margin: 10px auto 20px;
  }

  .search-row,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .map-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-actions {
    justify-content: space-between;
  }

  #map {
    height: 54vh;
  }
}
