/* ===== SHARED TOPBAR STYLES ===== */

/* Main topbar bar */
.topbar {
  background: #1a1a1a;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  position: sticky; top: 0; z-index: 100;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  padding: 0 16px; /* 整个顶栏留左右边距 */
}
/* Inner container: 左右撑满，两端对齐 */
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; /* 撑满整个顶栏，不再用 max-width */
  height: 44px;
  padding: 0; /* padding 由子元素各自的 logo/按钮控制 */
  gap: 0;
}

/* Left */
.topbar-left {
  display: flex; align-items: center;
  height: 100%; gap: 0;
  flex-shrink: 0;
}

.topbar-logo {
  font-size: 18px; font-weight: 700; color: #fff;
  letter-spacing: -0.5px;
  padding: 0 16px; height: 100%;
  display: flex; align-items: center;
  border-right: 1px solid rgba(255,255,255,0.2);
  white-space: nowrap; text-decoration: none;
  flex-shrink: 0;
}
.topbar-logo:visited { color: #fff; }
.topbar-logo:hover { background: rgba(255,255,255,0.08); color: #fff; }

.topbar-nav {
  display: flex; align-items: center;
  height: 100%; gap: 0;
}
.topbar-nav a,
.topbar-nav .nav-item {
  display: flex; align-items: center;
  height: 100%;
  color: rgba(255,255,255,0.85);
  font-size: 13px;
  padding: 0 14px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  position: relative;
}
.topbar-nav a:hover,
.topbar-nav .nav-item:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.topbar-nav a.active,
.topbar-nav .nav-item.active {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

/* Dropdown arrow */
.has-dropdown::after {
  content: '';
  display: inline-block;
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid rgba(255,255,255,0.6);
  margin-left: 5px; vertical-align: middle;
}
.has-dropdown:hover::after { border-top-color: #fff; }

/* Dropdown menus */
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%; left: 0;
  min-width: 160px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 200; overflow: hidden;
}
.has-dropdown:hover .dropdown-menu { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; font-size: 13px;
  color: var(--text-secondary); cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.dropdown-item:hover {
  background: var(--bg-alt);
  color: var(--accent);
}
.dropdown-item .ch-tag {
  font-size: 11px; color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0 4px; border-radius: 2px;
  font-family: monospace;
}
.dropdown-item .ch-tag.off {
  color: var(--text-tertiary);
  border-color: var(--border-strong);
}

/* Right */
.topbar-right {
  margin-left: auto;
  display: flex; align-items: center;
  height: 100%; gap: 0;
}

.tb-btn {
  display: flex; align-items: center;
  height: 30px; color: rgba(255,255,255,0.85);
  font-size: 12px; padding: 0 12px;
  border-radius: 2px; transition: all 0.15s;
  white-space: nowrap;
}
.tb-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }
.tb-btn.outline {
  border: 1px solid rgba(255,255,255,0.4); margin-left: 6px;
}
.tb-btn.filled {
  background: rgba(255,255,255,0.2); margin-left: 6px;
}

/* Live stats */
.live-stats {
  display: flex; align-items: center;
  height: 100%; padding: 0 12px;
  border-left: 1px solid rgba(255,255,255,0.2); gap: 0;
}
.stat-item {
  display: flex; align-items: center; gap: 4px;
  padding: 0 10px;
  border-right: 1px solid rgba(255,255,255,0.15);
  font-size: 11px; color: rgba(255,255,255,0.75);
  white-space: nowrap;
}
.stat-item:last-child { border-right: none; }
.stat-val { color: #fff; font-family: monospace; font-size: 12px; font-weight: 600; }

/* User menu */
.user-menu {
  display: flex; align-items: center;
  height: 100%; gap: 0;
  position: relative;
}
.user-avatar {
  width: 28px; height: 28px; border-radius: 2px;
  background: rgba(255,255,255,0.25);
  border: 1px solid rgba(255,255,255,0.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #fff; font-weight: 600;
  cursor: pointer; margin-left: 12px;
}
.user-name {
  font-size: 13px; color: rgba(255,255,255,0.9);
  margin-left: 8px; cursor: pointer;
  max-width: 100px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.user-name:hover { color: #fff; }
.user-dropdown {
  display: none;
  position: absolute; top: 100%; right: 0;
  min-width: 140px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 200; overflow: hidden;
}
.user-menu:hover .user-dropdown { display: block; }
.user-dd-item {
  display: block; padding: 8px 14px;
  font-size: 13px; color: var(--text-secondary);
  transition: background 0.1s, color 0.1s;
}
.user-dd-item:hover { background: var(--bg-alt); color: var(--accent); }

/* Theme toggle */
.tb-theme {
  display: flex; align-items: center;
  height: 30px; color: rgba(255,255,255,0.7);
  font-size: 11px; padding: 0 12px;
  cursor: pointer; border-left: 1px solid rgba(255,255,255,0.1);
}
.tb-theme:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9); }
