/**
 * RADEXEL Design System - Topbar Component
 *
 * Fixed top bar with logo, navigation breadcrumb, and user dropdown.
 * Height: var(--topbar-height) = 56px
 */

/* ==========================================================================
   Topbar Container
   ========================================================================== */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  height: var(--topbar-height);
  padding: 0 var(--space-5);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  z-index: var(--z-sticky);
  position: relative;
}


/* ==========================================================================
   Left Section (Logo + Nav)
   ========================================================================== */

.topbar__left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
}

/* Sidebar toggle button */
.topbar__sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition:
    background-color var(--duration-fast) var(--ease-default),
    color var(--duration-fast) var(--ease-default);
  flex-shrink: 0;
}

.topbar__sidebar-toggle:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

.topbar__sidebar-toggle svg {
  width: 20px;
  height: 20px;
}

/* Logo */
.topbar__logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  flex-shrink: 0;
}

.topbar__logo-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar__logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.topbar__logo-text {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--rdx-blue);
  letter-spacing: var(--letter-spacing-tight);
}

.topbar__logo-separator {
  width: 1px;
  height: 20px;
  background: var(--color-border);
  flex-shrink: 0;
}

/* Title / Breadcrumb */
.topbar__title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-left: var(--space-2);
  white-space: nowrap;
}


/* ==========================================================================
   Center Section (Optional)
   ========================================================================== */

.topbar__center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}


/* ==========================================================================
   Right Section (Actions + User)
   ========================================================================== */

.topbar__right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* Status indicator */
.topbar__status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  flex-shrink: 0;
}

.topbar__status--connected {
  background: var(--color-success-light);
  color: var(--color-success);
}

.topbar__status--disconnected {
  background: var(--color-danger-light);
  color: var(--color-danger);
}

.topbar__status--processing {
  background: var(--color-warning-light);
  color: var(--color-warning);
}

.topbar__status-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: currentColor;
}

.topbar__status--connected .topbar__status-dot {
  animation: pulse 2s var(--ease-default) infinite;
}

/* Theme toggle */
.topbar__theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition:
    background-color var(--duration-fast) var(--ease-default),
    color var(--duration-fast) var(--ease-default);
}

.topbar__theme-toggle:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

.topbar__theme-toggle svg {
  width: 18px;
  height: 18px;
}

/* Notification bell */
.topbar__notification {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition:
    background-color var(--duration-fast) var(--ease-default),
    color var(--duration-fast) var(--ease-default);
}

.topbar__notification:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

.topbar__notification svg {
  width: 18px;
  height: 18px;
}

.topbar__notification-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--color-danger);
  border-radius: var(--radius-full);
  border: 2px solid var(--color-surface);
}

/* User button */
.topbar__user-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  background: transparent;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--color-text);
  transition:
    background-color var(--duration-fast) var(--ease-default),
    border-color var(--duration-fast) var(--ease-default);
}

.topbar__user-btn:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-border);
}

.topbar__user-btn:focus-visible {
  outline: 2px solid var(--rdx-blue);
  outline-offset: 2px;
}

.topbar__user-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--rdx-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-inverse);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  flex-shrink: 0;
  overflow: hidden;
}

.topbar__user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.topbar__user-name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar__user-chevron {
  width: 14px;
  height: 14px;
  color: var(--color-text-muted);
  transition: transform var(--duration-fast) var(--ease-default);
}

.topbar__user-btn[aria-expanded="true"] .topbar__user-chevron {
  transform: rotate(180deg);
}
