/* ═══════════════════════════════════════════
   PREMIUM TOPBAR — Redesigned Header
   ═══════════════════════════════════════════ */

/* ─── Topbar Container ─── */
.topbar {
  height: 56px;
  background: rgba(11, 13, 19, 0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: var(--z-sticky);
  position: sticky;
  top: 0;
  gap: 16px;
}

/* ─── Left Section ─── */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  min-width: 0;
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.breadcrumb-app {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.breadcrumb-chevron {
  color: var(--text-muted);
  opacity: 0.5;
  flex-shrink: 0;
}

.breadcrumb-current {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* ─── Center Search ─── */
.topbar-center {
  flex: 1;
  max-width: 480px;
  min-width: 120px;
}

.topbar-search {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.topbar-search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.2s;
}

.topbar-search-input {
  width: 100%;
  height: 36px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 0 40px 0 36px;
  font-size: 0.8rem;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.topbar-search-input::placeholder {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.topbar-search-input:hover {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
}

.topbar-search-input:focus {
  border-color: var(--primary);
  background: rgba(14, 165, 233, 0.06);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.topbar-search-input:focus + .topbar-search-kbd {
  opacity: 0;
}

.topbar-search:focus-within .topbar-search-icon {
  color: var(--primary);
}

.topbar-search-kbd {
  position: absolute;
  right: 10px;
  font-size: 0.65rem;
  font-family: inherit;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  padding: 2px 6px;
  pointer-events: none;
  transition: opacity 0.2s;
  line-height: 1.2;
}

/* ─── Right Section ─── */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.topbar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: white;
  flex-shrink: 0;
  margin-right: 4px;
}

/* ─── Icon-only Action Buttons ─── */
.topbar-action-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  flex-shrink: 0;
}

.topbar-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.topbar-action-btn:active {
  transform: translateY(0);
  background: rgba(255, 255, 255, 0.05);
}

/* Sign out button — subtle red hint on hover */
.topbar-signout-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
}

/* ─── Divider ─── */
.topbar-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.08);
  margin: 0 6px;
  flex-shrink: 0;
}

/* ─── API Keys Button — Accent CTA ─── */
.topbar-api-btn {
  height: 32px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.25);
  flex-shrink: 0;
  white-space: nowrap;
}

.topbar-api-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(14, 165, 233, 0.35);
  filter: brightness(1.1);
}

.topbar-api-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(14, 165, 233, 0.2);
}

/* ─── Mobile Menu Button ─── */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.mobile-menu-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.mobile-menu-btn svg {
  width: 18px;
  height: 18px;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex;
  }
  
  .topbar-center {
    display: none;
  }
  
  .topbar-api-btn span {
    display: none;
  }
  
  .topbar-api-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
  }
  
  .topbar {
    padding: 0 12px;
  }
  
  .breadcrumb-app {
    display: none;
  }
  
  .breadcrumb-chevron {
    display: none;
  }
}

@media (max-width: 480px) {
  .topbar-divider {
    display: none;
  }
  
  .topbar-actions {
    gap: 0;
  }
}

/* ─── Light Theme Overrides ─── */
[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.8);
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .topbar-search-input {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
  color: var(--text-primary);
}

[data-theme="light"] .topbar-search-input:hover {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .topbar-action-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .topbar-search-kbd {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .topbar-divider {
  background: rgba(0, 0, 0, 0.08);
}

/* ─── Premium User Account Dropdown ─── */
.user-dropdown-container {
  position: relative;
  display: inline-block;
  margin-right: 8px;
}

.user-menu-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 4px 12px 4px 4px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.user-menu-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.user-menu-chip:active {
  transform: translateY(0);
}

.chip-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.75rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.chip-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip-chevron {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.user-dropdown-container.active .chip-chevron {
  transform: rotate(180deg);
}

/* Dropdown Menu Panel */
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  background: rgba(15, 18, 28, 0.95);
  backdrop-filter: blur(25px) saturate(200%);
  -webkit-backdrop-filter: blur(25px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.02);
  padding: 12px 0;
  display: none;
  flex-direction: column;
  z-index: 1000;
  opacity: 0;
  transform: translateY(-10px) scale(0.95);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.user-dropdown-container.active .user-dropdown {
  display: flex;
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* User Info Section inside Dropdown */
.dropdown-user-header {
  padding: 8px 16px 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 8px;
}

.dropdown-user-email {
  font-size: 0.72rem;
  color: var(--text-muted);
  word-break: break-all;
  margin-top: 2px;
}

.dropdown-user-plan {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.2);
  border-radius: 4px;
  padding: 2px 6px;
  margin-top: 6px;
}

/* Groups */
.dropdown-group-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  padding: 8px 16px 4px 16px;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.dropdown-item svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.dropdown-item:hover svg {
  color: var(--primary);
}

.dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 8px 0;
}

/* Sign out item */
.dropdown-signout {
  color: #ef4444;
}

.dropdown-signout:hover {
  background: rgba(239, 68, 68, 0.08);
  color: #f87171;
}

.dropdown-signout svg {
  color: #f87171;
}

/* Light Mode Overrides */
[data-theme="light"] .user-menu-chip {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .user-menu-chip:hover {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .chip-name {
  color: var(--text-primary);
}

[data-theme="light"] .user-dropdown {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .dropdown-user-header {
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .dropdown-divider {
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .dropdown-item:hover {
  background: rgba(0, 0, 0, 0.03);
}


