// ============================================================================
// Header Bar — Top App Bar
// Per CUB-27 spec breakpoints:
//   Compact  (0–599px):  SmallTopAppBar — 56px height, compact title, hidden labels
//   Medium   (600–1023px): Medium top bar — 64px height
//   Expanded (≥1024px):  MediumTopAppBar — 64px height, full actions
// ============================================================================

.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--cc-header-height-compact); // Compact by default (mobile-first)
  padding: 0 var(--cc-section-padding-compact);
  background-color: var(--cc-surface-container-high);
  border-bottom: 1px solid var(--cc-outline);
  z-index: 20;
}

.header-bar__title {
  font-size: 20px;
  font-weight: 500;
  color: var(--cc-on-surface);
  margin: 0;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-bar__actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-bar__action-btn {
  color: var(--cc-on-surface-variant) !important;
  min-width: 48px;
  min-height: 48px;

  &:hover {
    color: var(--cc-on-surface) !important;
  }
}

.header-bar__live-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  background-color: var(--status-error);
  vertical-align: middle;

  &--connected {
    background-color: var(--status-active);
    animation: pulse-active 2s ease-in-out infinite;
  }
}

.header-bar__live-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--cc-on-surface-variant);
  vertical-align: middle;
}

// ---------------------------------------------------------------------------
// Compact (0–599px): SmallTopAppBar — hide live label, tighter spacing
// ---------------------------------------------------------------------------
@media (max-width: 599px) {
  .header-bar__live-label {
    display: none; // Space saving on compact — dot alone is enough
  }

  .header-bar__actions {
    gap: 0;
  }
}

// ---------------------------------------------------------------------------
// Medium (600–1023px): Medium top bar
// ---------------------------------------------------------------------------
@media (min-width: 600px) and (max-width: 1023px) {
  .header-bar {
    height: var(--cc-header-height);
    padding: 0 var(--cc-section-padding);
  }

  .header-bar__title {
    font-size: 24px;
  }

  .header-bar__actions {
    gap: 4px;
  }
}

// ---------------------------------------------------------------------------
// Expanded (≥1024px): Full top bar
// ---------------------------------------------------------------------------
@media (min-width: 1024px) {
  .header-bar {
    height: var(--cc-header-height);
    padding: 0 var(--cc-section-padding);
  }

  .header-bar__title {
    font-size: 28px;
    font-weight: 400;
  }

  .header-bar__actions {
    gap: 8px;
  }
}

// ---------------------------------------------------------------------------
// Accessibility: Reduced Motion
// ---------------------------------------------------------------------------
@media (prefers-reduced-motion: reduce) {
  .header-bar__live-dot--connected {
    animation: none;
  }
}