/* ============================================
   Header & Navigation
   ============================================ */
header {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-secondary);
  position: relative;
  z-index: 10;
  border-bottom: 1px solid var(--border-color);
}

/* ---- Row 1: Nav ---- */
.nav-row {
  display: flex;
  align-items: center;
  height: var(--nav-height);
  padding: 0 16px;
  border-bottom: 1px solid var(--border-color);
}

/* ---- Row 2: View-specific toolbar ---- */
.toolbar-row {
  min-height: 0;
  overflow: hidden;
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition-fast);
}

/* When a sub-toolbar is visible, show the row */
.toolbar-row:has(.sub-toolbar:not(.hide)) {
  border-bottom-color: var(--border-color);
}

/* ---- Logo ---- */
.nav-logo {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  cursor: pointer;
  padding: 0 16px 0 0;
  flex-shrink: 0;
  letter-spacing: -0.3px;
  user-select: none;
  transition: opacity var(--transition-fast);
}
.nav-logo:hover { opacity: 0.85; }
.nav-logo .logo-accent {
  color: var(--gold);
  text-shadow: 0 0 12px rgba(240, 185, 11, 0.35);
}

/* ---- Nav Tabs ---- */
.nav-tabs {
  display: flex;
  align-items: center;
  height: 100%;
  flex-shrink: 0;
}

.nav-tab {
  position: relative;
  padding: 0 18px;
  height: 100%;
  display: flex;
  align-items: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  gap: 4px;
}
.nav-tab:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.02);
}
.nav-tab.active {
  color: var(--text-primary);
}
.nav-tab::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 18px;
  right: 18px;
  height: 2px;
  background: var(--gold);
  border-radius: 1px 1px 0 0;
  transform: scaleX(0);
  transition: transform var(--transition-normal);
}
.nav-tab.active::after {
  transform: scaleX(1);
}

.nav-tab .badge {
  position: absolute;
  top: 8px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
}
.nav-tab .badge.info {
  background: var(--gold);
  box-shadow: 0 0 6px var(--gold-glow);
}

/* ---- Sub Toolbar (view-specific controls) ---- */
.sub-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  height: 48px;
  min-width: 0;
}

.sub-toolbar.hide { display: none; }

/* ---- Header Right ---- */
.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
  flex-shrink: 0;
  gap: 8px;
  height: 100%;
  z-index: 10;
}

/* ---- Toolbar (Drawing tools) ---- */
/* #toolbar styles moved to chart.css — now positioned vertically on chart left side */

.tool-item {
  width: 38px;
  height: 38px;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), opacity var(--transition-fast), box-shadow var(--transition-fast);
  padding: 4px;
  border-radius: var(--radius-sm);
  user-select: none;
  opacity: 0.65;
}

.tool-item:hover {
  opacity: 1;
  background: var(--bg-hover);
}
.tool-item.active {
  background: var(--bg-hover) !important;
  opacity: 1;
  box-shadow: inset 0 0 0 1px var(--gold-dim);
}
.tool-item:active {
  transform: scale(0.92);
  transition: transform 0.1s ease;
}
.tool-item#showHistoryGraphics { margin-bottom: 4px; opacity: 0.85; }
.tool-item#showHistoryGraphics:hover { opacity: 1; }

#eye.show { display: inline-block; }
#eye.hide { display: none; }
#eyeClose.show { display: inline-block; }
#eyeClose.hide { display: none; }

/* ---- Responsive Nav ---- */
@media (max-width: 768px) {
  .nav-row { padding: 0 8px; }
  .nav-logo { font-size: 14px; padding: 0 8px 0 0; }
  .nav-tab { padding: 0 10px; font-size: 14px; }
  .sub-toolbar { padding: 0 8px; }
}

@media (max-width: 480px) {
  .nav-logo .logo-full { display: none; }
  .nav-logo .logo-short { display: inline; }
  .nav-tab { padding: 0 7px; font-size: 13px; }
  .nav-tab .tab-text-long { display: none; }
  .nav-tab .tab-text-short { display: inline; }
  .tool-item { width: 34px; height: 34px; }
}

@media (min-width: 481px) {
  .nav-logo .logo-short { display: none; }
  .nav-tab .tab-text-short { display: none; }
}
