/* ==========================================================================
   Foundation Chrome: Busy Indicator, Persistent Banners (Sync Error / Demo Data) & Focus Rings
   ========================================================================== */

/* Thin progress bar under the sticky header while an RPC is in flight (showBusy_/hideBusy_).
   Uses position: fixed + opacity so toggling busy state never triggers document-flow layout shifts. */
.busy-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 65;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem;
  height: 0;
  overflow: visible;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease;
}

.busy-indicator.active {
  opacity: 1;
  visibility: visible;
}

.busy-indicator-bar {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent 0%, var(--accent-primary) 45%, var(--accent-primary) 55%, transparent 100%);
  background-size: 40% 100%;
  animation: busy-indicator-slide 1.1s linear infinite;
}

.busy-indicator-text {
  position: absolute;
  top: 6px;
  right: 1rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  pointer-events: none;
}

@keyframes busy-indicator-slide {
  from { background-position: -40% 0; }
  to { background-position: 140% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .busy-indicator-bar {
    animation: none;
    background: var(--accent-primary);
    background-size: 100% 100%;
  }
}

/* Full-width persistent banners rendered by showBanner_() */
.app-banner {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.55rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-align: center;
  cursor: pointer;
}

.app-banner-text {
  line-height: 1.35;
}

.app-banner-action {
  flex-shrink: 0;
  min-height: 32px;
}

.app-banner-danger {
  background: var(--status-danger);
  color: #ffffff;
}

.app-banner-danger .app-banner-action {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.55);
  color: #ffffff;
}

.app-banner-demo {
  background: #f59e0b;
  color: #1f1300;
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}

.app-banner-demo .app-banner-action {
  background: rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 0, 0, 0.35);
  color: #1f1300;
}

/* Keyboard focus is always visible (modals trap focus, so the ring must be obvious) */
.modal-dialog:focus {
  outline: none;
}

.modal-dialog :focus-visible,
.app-banner-action:focus-visible,
.toast-action-btn:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}
