/* ========== Top app bar ==========
   Replaces the old GSAP card-nav. Filters and Trip Planner are always visible,
   so both panels are one tap away instead of two clicks behind an animation. */

.app-bar-container {
  position: fixed;
  top: var(--nav-top);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 800px;
  z-index: var(--z-nav);
}

.app-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--nav-height);
  padding: 0 10px 0 16px;
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow-raised);
}

.app-bar-logo {
  height: 28px;
  width: auto;
  flex-shrink: 0;
}

.app-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* ---------- Bar buttons ---------- */
.bar-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap-target);
  padding: 0 14px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.bar-btn:hover {
  background: rgba(0, 119, 190, 0.06);
  border-color: rgba(0, 119, 190, 0.35);
}

.bar-btn:focus-visible {
  outline: 2px solid var(--brand-2);
  outline-offset: 2px;
}

/* The button reflects its panel's state, so there is one source of truth. */
.bar-btn[aria-expanded="true"] {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  border-color: transparent;
  color: #fff;
}

.bar-btn-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Amber dot: some filters are narrowing the results */
.bar-btn-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 0 2px #fff;
}

.bar-btn[aria-expanded="true"] .bar-btn-dot {
  box-shadow: 0 0 0 2px var(--brand);
}

/* Numeric badge: how many stops are in the trip */
.bar-btn-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}

.bar-btn[aria-expanded="true"] .bar-btn-badge {
  background: #fff;
  color: var(--brand);
}

/* Author `display` beats the UA [hidden] rule, so restore it explicitly. */
.bar-btn-badge[hidden] {
  display: none;
}

/* ---------- Location counter ---------- */
.location-counter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 119, 190, 0.2);
}

.location-counter-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.location-counter.pulse {
  animation: counter-pulse 0.5s ease;
}

@keyframes counter-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12); }
}

/* ---------- Narrow screens: icon-only buttons ---------- */
@media (max-width: 560px) {
  .app-bar {
    gap: 8px;
    padding: 0 8px 0 12px;
  }

  .bar-btn-text {
    /* Icon-only, but keep the label for screen readers */
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .bar-btn {
    width: var(--tap-target);
    padding: 0;
  }

  .bar-btn-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    box-shadow: 0 0 0 2px #fff;
  }
}

/* Three icon-only buttons plus the logo and the counter overflow a 320px bar.
   The counter is the one to drop: the Explore panel already says "Showing N of
   M", so nothing is lost that is not said better elsewhere. */
@media (max-width: 430px) {
  .location-counter {
    display: none;
  }
}

@media (max-width: 380px) {
  .location-counter {
    padding: 6px 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .location-counter.pulse { animation: none; }
}
