/* ═══════════════════════════════════════════════════════════════════
   NOTAM CENTRAL — MAIN STYLESHEET
   Cockpit dark, monospaced data, radar-cyan accent
   ═══════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0A0E17;
  --surface:   #111827;
  --panel:     #1C2333;
  --border:    #253047;
  --border2:   #1e2d44;
  --text:      #E8EDF5;
  --text-dim:  #6B7A99;
  --text-mid:  #9BAAC4;
  --cyan:      #00B4D8;
  --cyan-dim:  rgba(0,180,216,0.12);
  --amber:     #F0A500;
  --amber-dim: rgba(240,165,0,0.12);
  --red:       #E84545;
  --red-dim:   rgba(232,69,69,0.12);
  --green:     #27C98F;
  --green-dim: rgba(39,201,143,0.12);
  --mono:      'JetBrains Mono', monospace;
  --sans:      'Inter', system-ui, sans-serif;
  --radius:    4px;
  --radius-lg: 8px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ─── HEADER ─────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.brand-icon { color: var(--cyan); font-size: 16px; }
.brand-name { color: var(--text); }
.brand-accent { color: var(--cyan); }
.header-nav { display: flex; align-items: center; gap: 16px; }
.nav-badge {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 2px;
  letter-spacing: 0.05em;
}
.nav-admin, .nav-link {
  font-size: 12px;
  font-weight: 500;
  color: var(--cyan);
  text-decoration: none;
  letter-spacing: 0.04em;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background 0.15s, border-color 0.15s;
}
.nav-admin:hover, .nav-link:hover {
  background: var(--cyan-dim);
  border-color: var(--cyan);
}

/* ─── LAYOUT ──────────────────────────────────────────────────────── */
.layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 20px;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  align-items: start;
}

/* ─── FILTERS ─────────────────────────────────────────────────────── */
.filters {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: sticky;
  top: 72px;
}
.filters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.filters-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}
.filter-group {
  margin-bottom: 18px;
}
.filter-group-label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.chip {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
  font-family: var(--sans);
  padding: 4px 9px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.12s;
  line-height: 1;
}
.chip:hover { border-color: var(--cyan); color: var(--cyan); }
.chip.active {
  background: var(--cyan-dim);
  border-color: var(--cyan);
  color: var(--cyan);
}
.filter-select {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-family: var(--sans);
  padding: 7px 10px;
  border-radius: var(--radius);
  appearance: none;
  cursor: pointer;
  outline: none;
  transition: border-color 0.12s;
}
.filter-select:focus { border-color: var(--cyan); }
.range-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.range-input-group { flex: 1; }
.range-sep { color: var(--text-dim); font-size: 11px; }
.range-lbl {
  display: block;
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 4px;
  letter-spacing: 0.04em;
}
.range-input, .date-input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-family: var(--mono);
  padding: 6px 8px;
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.12s;
}
.range-input:focus, .date-input:focus { border-color: var(--cyan); }
.date-row { display: flex; flex-direction: column; gap: 8px; }
.date-input-group {}
.apply-btn {
  width: 100%;
  background: var(--cyan);
  color: #0A0E17;
  border: none;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: 0.06em;
  padding: 9px;
  border-radius: var(--radius);
  cursor: pointer;
  text-transform: uppercase;
  transition: opacity 0.12s;
}
.apply-btn:hover { opacity: 0.85; }
.clear-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius);
  transition: color 0.12s;
}
.clear-btn:hover { color: var(--red); }

/* ─── CONTENT AREA ────────────────────────────────────────────────── */
.content-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.search-wrap {
  flex: 1;
  position: relative;
}
.search-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-family: var(--sans);
  padding: 8px 36px 8px 12px;
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.12s;
}
.search-input::placeholder { color: var(--text-dim); }
.search-input:focus { border-color: var(--cyan); }
.search-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 16px;
  pointer-events: none;
}
.sort-wrap { flex-shrink: 0; width: 160px; }
.filter-toggle {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
}

/* ─── NOTAM CARDS ─────────────────────────────────────────────────── */
.notam-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.notam-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
  border-left: 3px solid transparent;
}
.notam-card:hover {
  border-color: var(--cyan);
  border-left-color: var(--cyan);
  background: #141d2e;
}
.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.card-id {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.04em;
}
.card-status {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 3px 7px;
  border-radius: 2px;
}
.card-status.operational {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(39,201,143,0.25);
}
.card-status.cancelled {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(232,69,69,0.25);
}
.card-location {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 5px;
}
.card-desc {
  font-size: 12px;
  color: var(--text-mid);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 10px;
}
.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.meta-tag {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 2px;
  letter-spacing: 0.04em;
}
.meta-tag.issuer-country { color: var(--cyan); border-color: rgba(0,180,216,0.3); }
.meta-tag.issuer-state { color: var(--amber); border-color: rgba(240,165,0,0.3); }
.meta-tag.issuer-private { color: #A78BFA; border-color: rgba(167,139,250,0.3); }
.meta-alt {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  margin-left: auto;
}
.meta-dates {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ─── LOADING / EMPTY ─────────────────────────────────────────────── */
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px;
  color: var(--text-dim);
  font-size: 13px;
}
.loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 64px 20px;
  color: var(--text-dim);
  text-align: center;
}
.empty-icon { font-size: 32px; opacity: 0.4; }
.hidden { display: none !important; }

/* ─── MAP SECTION ─────────────────────────────────────────────────── */
.map-section {
  max-width: 1400px;
  margin: 0 auto 40px;
  padding: 0 20px;
}
.map-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.map-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}
.map-sub {
  font-size: 12px;
  color: var(--text-dim);
  flex: 1;
}
.map-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--text-dim);
}
.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.legend-dot.operational { background: var(--cyan); }
.legend-dot.cancelled   { background: #555; }
#map {
  height: 380px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--panel);
  overflow: hidden;
}

/* ─── LEAFLET OVERRIDES ───────────────────────────────────────────── */
.leaflet-container { background: #0a0e17; }
.notam-tooltip-wrap .leaflet-tooltip {
  background: var(--panel) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  border-radius: var(--radius) !important;
  padding: 0 !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5) !important;
}
.notam-tooltip-wrap .leaflet-tooltip::before { display: none; }
.map-tooltip {
  padding: 8px 12px;
  min-width: 160px;
  font-family: var(--sans);
  font-size: 12px;
}
.map-tooltip strong {
  display: block;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--cyan);
  margin-bottom: 2px;
}
.map-tooltip .tt-status {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-top: 4px;
}
.map-tooltip .tt-status.operational { color: var(--green); }
.map-tooltip .tt-status.cancelled   { color: var(--red); }

/* ─── DRAWER ──────────────────────────────────────────────────────── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.drawer-overlay.visible { opacity: 1; pointer-events: auto; }
.notam-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 201;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
  overflow-y: auto;
}
.notam-drawer.open { transform: translateX(0); }
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
}
.drawer-id {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.04em;
}
.drawer-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: color 0.12s;
}
.drawer-close:hover { color: var(--text); }
.drawer-body { padding: 20px; }
.drawer-field {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 9px 0;
  border-bottom: 1px solid var(--border2);
  gap: 12px;
}
.drawer-field span:first-child {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
  padding-top: 1px;
}
.drawer-field span:last-child {
  font-size: 12px;
  text-align: right;
}
.drawer-description {
  margin-top: 16px;
}
.drawer-desc-label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.drawer-description p {
  font-size: 13px;
  color: var(--text-mid);
  line-height: 1.6;
}
.drawer-raw {
  margin-top: 16px;
}
.drawer-raw span {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.drawer-raw pre {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text-mid);
  white-space: pre-wrap;
  word-break: break-all;
}
.drawer-coords {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}

/* ─── RESPONSIVE ──────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 16px;
    gap: 0;
  }
  .filters {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 0.25s;
    border-radius: 0;
    overflow-y: auto;
    padding-top: 56px;
    border: none;
    border-right: 1px solid var(--border);
  }
  .filters.open { transform: translateX(0); }
  .filter-toggle { display: flex; align-items: center; gap: 6px; }
  .map-section { padding: 0 16px; }
  .notam-drawer { width: 100%; border-left: none; border-top: 1px solid var(--border); height: 85%; top: auto; bottom: 0; transform: translateY(100%); }
  .notam-drawer.open { transform: translateY(0); }
}

@media (max-width: 600px) {
  .content-header { flex-wrap: wrap; }
  .search-wrap { flex: 1 1 100%; }
  .sort-wrap { flex: 1; }
  .filter-toggle { flex: 0; }
  .meta-dates { display: none; }
  #map { height: 280px; }
  .header-inner { padding: 0 14px; }
  .brand-name { font-size: 13px; }
}
