/* ─── Bottom Bar ──────────────────────────────────────────── */

.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-bar-height);
  z-index: 2000;
  background: var(--bg-bar);
  border-top: 1px solid var(--blue-border);
  display: flex;
  align-items: center;
  padding: 0 10px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Row 1: coord + scratchpad + search (flex:1, left side) */
.bottom-bar__row-1 {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* Row 2: control buttons + clock (compact, right side) */
.bottom-bar__row-2 {
  display: flex;
  align-items: center;
  gap: 2px;
}

.bottom-bar__left-controls {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.bottom-bar__coord {
  font-family: 'B612 Mono', ui-monospace, monospace;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  flex-grow: 0;
  width: 33ch;
  transition: color 0.15s;
}

.bottom-bar__coord:hover {
  color: var(--gold);
}

.bottom-bar__mid-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.bottom-bar__controls {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

/* Desktop UTC clock */
.bottom-bar__clock {
  font-family: 'B612 Mono', ui-monospace, monospace;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 6px;
}

/* Hide desktop clock on touch devices (clock is in top-bar overlay there) */
@media (pointer: coarse) {
  .bottom-bar__clock { display: none; }
}

/* Source status indicator — same visual weight as clock, desktop only */
.bottom-bar__source-status {
  font-family: 'B612 Mono', ui-monospace, monospace;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  flex-shrink: 0;
  padding: 0 12px 0 6px;
  cursor: default;
  user-select: none;
}

.bottom-bar__source-status--lim {
  color: var(--gold);
}

.bottom-bar__source-status--bad {
  color: #e63946;
}

@media (pointer: coarse) {
  .bottom-bar__source-status { display: none; }
}

/* ─── Control Buttons ─────────────────────────────────────── */

.bar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.bar-btn:hover,
.bar-btn.active {
  background: rgba(43, 58, 171, 0.35);
  color: var(--gold);
}

.bar-btn svg {
  pointer-events: none;
}

/* ─── Popup Menus ─────────────────────────────────────────── */

.popup-menu {
  position: fixed;
  bottom: var(--bottom-bar-height);
  z-index: 1999;
  background: var(--bg-bar);
  border: 1px solid var(--blue-border);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 6px 0;
  min-width: 190px;
  display: none;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.6);
}

.popup-menu.open {
  display: block;
}

.popup-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  font-family: 'B612 Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  user-select: none;
}

.popup-menu__item:hover {
  background: rgba(43, 58, 171, 0.25);
  color: var(--gold);
}

.popup-menu__item input[type="radio"],
.popup-menu__item input[type="checkbox"] {
  accent-color: var(--gold);
  cursor: pointer;
  margin: 0;
  flex-shrink: 0;
}

.popup-menu__item.active-layer {
  color: var(--gold);
}

.popup-menu__divider {
  height: 1px;
  background: var(--blue-border);
  margin: 4px 0;
}

/* ─── Scratchpad ──────────────────────────────────────────── */

.scratchpad {
  display: flex;
  align-items: center;
  gap: 2px;
}

.scratchpad__input {
  width: 148px; /* ~20 monospace chars */
  height: 26px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.8);
  font-family: 'B612 Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 0 8px;
  outline: none;
  transition: border-color 0.15s, color 0.15s;
}

.scratchpad__input::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

.scratchpad__input:focus {
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

/* Scratchpad icon buttons match input height */
.scratchpad .bar-btn {
  width: 26px;
  height: 26px;
}

/* ─── Point Search ────────────────────────────────────────── */

.pt-search {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-right: 4px;
}

.pt-search__input {
  width: 80px;
  height: 26px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.8);
  font-family: 'B612 Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 0 8px;
  outline: none;
  text-transform: uppercase;
  transition: border-color 0.15s, color 0.15s;
}

.pt-search__input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.pt-search__input:focus {
  border-color: var(--gold);
  color: #fff;
}

.pt-search__input--error {
  border-color: #e63946;
  color: #e63946;
  animation: pt-shake 0.25s ease;
}

.pt-search__go {
  font-family: 'B612 Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  width: auto;
  height: 26px;
  padding: 0 8px;
}

@keyframes pt-shake {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-3px); }
  75%       { transform: translateX(3px); }
}

/* ─── Measure Tool label (map overlay) ────────────────────── */

.mt-label {
  font-family: 'B612 Mono', ui-monospace, monospace;
  font-size: 11px;
  color: #f5a800;
  background: rgba(0, 0, 0, 0.6);
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 6px));
  display: inline-block;
}

/* ─── Airspace Menu Accordion ─────────────────────────────── */

.am-category-header {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 6px 14px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.45);
  font-family: 'B612 Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  text-align: left;
  transition: color 0.12s;
  user-select: none;
}

.am-category-header:hover {
  color: var(--gold);
}

.am-category-header--open {
  color: rgba(255, 255, 255, 0.65);
}

.am-chevron {
  flex-shrink: 0;
  transition: transform 0.18s ease;
  transform: rotate(-90deg);
}

.am-category-header--open .am-chevron {
  transform: rotate(0deg);
}

.am-category-body {
  display: none;
}

.am-category-body--open {
  display: block;
}

.am-category-body .popup-menu__item {
  padding-left: 28px;
}

/* ─── Brightness Popup ────────────────────────────────────── */

.popup-menu--brightness {
  min-width: unset;
  width: 44px;
  padding: 12px 0;
  display: none;
  align-items: center;
  justify-content: center;
}

.popup-menu--brightness.open {
  display: flex;
}

.brightness-slider-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
}

.brightness-slider-wrap input[type="range"] {
  -webkit-appearance: slider-vertical;
  appearance: slider-vertical;
  writing-mode: vertical-lr;
  direction: rtl;
  width: 4px;
  height: 100px;
  cursor: pointer;
  accent-color: var(--gold);
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
}

.brightness-val {
  font-family: 'B612 Mono', ui-monospace, monospace;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.45);
  min-width: 28px;
  text-align: center;
}

/* ─── Mobile two-row layout (≤640px) ──────────────────────── */

@media (max-width: 640px) {
  .bottom-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 5px 10px;
    gap: 4px;
    height: auto;
  }

  .bottom-bar__row-1,
  .bottom-bar__row-2 {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
  }

  .bottom-bar__row-2 {
    justify-content: space-around;
  }

  /* Hide scratchpad on mobile — too cluttered */
  .scratchpad { display: none; }

  /* left-controls grows to fill row-1, pushing search to the right */
  .bottom-bar__left-controls { flex: 1; min-width: 0; }
  .bottom-bar__coord { min-width: 50px; }

  /* Larger touch targets */
  .bar-btn { width: 44px; height: 44px; }

  .scratchpad__input { flex: 1; width: auto; height: 34px; font-size: 13px; }
  .pt-search__input  { width: 80px; height: 34px; font-size: 13px; }
  .pt-search__go     { height: 34px; }
  .scratchpad .bar-btn { width: 34px; height: 34px; }
}
