/* =========================================
   HQ CHROME — dark top bar + dark contextual left sidebar (epic 0035 §11).

   Top bar  (.navbar)      : [hamburger on phones] · logo · scope picker ·
                             profile/org menu
   Sidebar  (.hq-sidebar)  : page links for the current scope; collapsible
                             to icons; a slide-in drawer below 768px.
   Scope dropdown          : the league/season picker panel under the
                             top-bar trigger.
   ========================================= */

.navbar {
  height: var(--navbar-height);
  background: var(--navbar-bg);
  border-bottom: 1px solid var(--navbar-border);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 1.25rem;
  position: relative;
  z-index: 100;
  flex-shrink: 0;
}

/* ---- Logo ---- */
.navbar__logo {
  font-size: 1.143rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--grad-light);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  flex-shrink: 0;
}

/* ---- Hamburger (phones only) ---- */
.navbar__menu-btn { display: none; }

/* ---- Scope selector trigger ---- */
.navbar__scope {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  background: var(--white-a06);
  transition: background 0.15s;
  position: relative;
  flex-shrink: 0;
}
.navbar__scope:hover { background: var(--white-a12); }

.navbar__scope-text {
  font-size: 1rem;
  font-weight: 700;
  color: var(--white);
  white-space: nowrap;
}
.navbar__scope-chip {
  font-size: 0.643rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--navbar-chip-text);
  background: var(--navbar-chip-bg);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.navbar__scope-chevron {
  font-size: 0.7rem;
  color: var(--white-a40);
  margin-left: 2px;
}

/* ---- Right zone: combined profile / org dropdown ---- */
.navbar__right {
  display: flex;
  align-items: center;
  margin-left: auto;
  flex-shrink: 0;
}

.navbar__user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  position: relative;
  padding: 4px 6px 4px 10px;
  border-radius: var(--r-md);
  transition: background 0.15s;
}
.navbar__user:hover,
.navbar__user:focus-within { background: var(--white-a06); }

.navbar__user-org {
  font-size: 0.857rem;
  font-weight: 600;
  color: var(--white-a65);
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.navbar__avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--grad-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 0.857rem;
  font-weight: 700;
  flex-shrink: 0;
}

.navbar__chevron {
  font-size: 0.7rem;
  color: var(--white-a40);
}

.navbar__user:hover > .dropdown-menu,
.navbar__user:focus-within > .dropdown-menu {
  display: block;
}
.navbar__user-menu { min-width: 250px; }

/* =========================================
   SIDEBAR — dark, narrow, collapsible
   ========================================= */
.hq-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  transition: width 150ms ease-out;
}

.hq-sidebar__links {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.6rem 0 0.5rem;
  scrollbar-width: thin;
}

.hq-sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  height: 36px;
  padding: 0 0.6rem 0 calc(0.75rem - 3px);
  margin: 1px 0;
  border-left: 3px solid transparent;
  color: var(--sidebar-link);
  font-size: 0.857rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.hq-sidebar__link:hover {
  background: var(--sidebar-link-hover-bg);
  color: var(--sidebar-link-hover);
}
.hq-sidebar__link.is-active {
  background: var(--sidebar-link-active-bg);
  border-left-color: var(--sidebar-link-active);
  color: var(--sidebar-link-active);
  text-shadow: 0 0 10px rgba(236,254,255,0.35);
}
.hq-sidebar__link-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.12s;
}
.hq-sidebar__link-icon svg { width: 100%; height: 100%; }
.hq-sidebar__link:hover .hq-sidebar__link-icon { opacity: 0.9; }
.hq-sidebar__link.is-active .hq-sidebar__link-icon {
  opacity: 1;
  filter: drop-shadow(0 0 4px rgba(6,182,212,0.5));
}
.hq-sidebar__link-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Collapse toggle (desktop only) ---- */
.hq-sidebar__collapse {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  height: 40px;
  padding: 0 0.75rem;
  border: 0;
  border-top: 1px solid var(--sidebar-border);
  background: none;
  color: var(--sidebar-link);
  font: inherit;
  font-size: 0.786rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-align: left;
}
.hq-sidebar__collapse:hover {
  background: var(--sidebar-link-hover-bg);
  color: var(--sidebar-link-hover);
}
.hq-sidebar__collapse-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform 150ms ease-out;
}
.hq-sidebar__collapse-icon svg { width: 100%; height: 100%; }

/* ---- Collapsed: icons only ---- */
@media (min-width: 768px) {
  .hq-sidebar.is-collapsed { width: var(--sidebar-width-collapsed); }
  .hq-sidebar.is-collapsed .hq-sidebar__link-label { display: none; }
  .hq-sidebar.is-collapsed .hq-sidebar__link {
    justify-content: center;
    padding: 0;
    /* keep the 3px active rule visually centered: offset by the same width */
    padding-right: 3px;
  }
  .hq-sidebar.is-collapsed .hq-sidebar__collapse {
    justify-content: center;
    padding: 0;
  }
  .hq-sidebar.is-collapsed .hq-sidebar__collapse-icon { transform: rotate(180deg); }
}

/* ---- Drawer backdrop (phones only) ---- */
.hq-sidebar-backdrop { display: none; }

/* =========================================
   SCOPE DROPDOWN — the league/season picker panel
   ========================================= */
.scope-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  min-width: 520px;
  max-height: 480px;
  z-index: 200;
  flex-direction: column;
  cursor: default;
}
/* hover bridge across the 8px gap under the trigger */
.scope-dropdown::before {
  content: "";
  position: absolute;
  top: -10px; left: 0; right: 0;
  height: 10px;
}

.navbar__scope:hover .scope-dropdown,
.navbar__scope:focus-within .scope-dropdown {
  display: flex;
}

.scope-dropdown__header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.scope-dropdown__search {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  font-size: 0.857rem;
  color: var(--ink);
  outline: none;
  background: var(--bg);
  font-family: inherit;
}
.scope-dropdown__search:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
.scope-dropdown__search::placeholder { color: var(--ink-3); }

.scope-dropdown__toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.786rem;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.scope-dropdown__toggle input { accent-color: var(--accent); }

.scope-dropdown__body {
  overflow-y: auto;
  flex: 1;
}

.scope-dropdown__league-group {
  display: grid;
  grid-template-columns: 160px 1fr;
  border-bottom: 1px solid var(--line);
}
.scope-dropdown__league-group:last-of-type { border-bottom: none; }

.scope-dropdown__league-name {
  padding: 10px 14px;
  border-right: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  font-size: 0.857rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.6;
  cursor: pointer;
}
.scope-dropdown__league-name:hover { background: var(--bg); color: var(--accent); }
.scope-dropdown__league-name.is-active { color: var(--accent); }

.scope-dropdown__seasons { padding: 6px 0; }

.scope-dropdown__season-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 14px;
  text-decoration: none;
  transition: background 0.1s;
  gap: 0.75rem;
}
.scope-dropdown__season-link:hover { background: var(--bg); }
.scope-dropdown__season-link.is-active { background: var(--accent-light); }

.scope-dropdown__season-name {
  font-size: 0.857rem;
  font-weight: 500;
  color: var(--ink);
}
.scope-dropdown__season-link.is-active .scope-dropdown__season-name {
  font-weight: 700;
  color: var(--accent);
}

.scope-dropdown__create-link {
  display: block;
  padding: 5px 14px;
  font-size: 0.786rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.scope-dropdown__create-link:hover { text-decoration: underline; }

.scope-dropdown__footer {
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.scope-dropdown__footer .scope-dropdown__create-link {
  padding: 4px 0;
  font-size: 0.857rem;
}

.scope-dropdown__empty-state {
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--ink-3);
}
.scope-dropdown__empty-state p {
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

/* Small status pill variant for inline use in the dropdown */
.status-pill--sm {
  font-size: 0.65rem;
  padding: 1px 6px;
}

/* =========================================
   PHONES — sidebar becomes a drawer, scope picker goes full-width
   ========================================= */
@media (max-width: 767px) {
  .navbar { padding: 0 0.75rem; gap: 0.5rem; }

  .navbar__menu-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    margin-left: -6px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
  }
  .navbar__menu-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--white-a65);
    border-radius: 1px;
  }

  .navbar__scope {
    flex: 1;
    min-width: 0;
    padding: 5px 8px;
    position: static; /* the panel anchors to the bar, not the trigger */
  }
  .navbar__scope-text {
    font-size: 0.93rem;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }
  .navbar__scope-chip { display: none; }

  .scope-dropdown {
    top: calc(100% + 4px);
    left: 0.75rem;
    right: 0.75rem;
    min-width: 0;
    max-height: calc(100vh - var(--navbar-height) - 2rem);
  }
  .scope-dropdown::before { display: none; }
  .scope-dropdown__league-group { grid-template-columns: 1fr; }
  .scope-dropdown__league-name { border-right: none; border-bottom: 1px solid var(--line-2); }

  .navbar__user-org { display: none; }
  .navbar__user-menu { min-width: 240px; }

  .hq-sidebar {
    position: fixed;
    z-index: 300;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(260px, 80vw);
    transform: translateX(-100%);
    transition: transform 200ms ease-out;
    box-shadow: none;
  }
  .hq-sidebar.is-open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,0.35);
  }
  .hq-sidebar__link {
    height: 44px;
    font-size: 1rem;
  }
  .hq-sidebar__collapse { display: none; }

  .hq-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 299;
    background: rgba(0,0,0,0.35);
  }
  .hq-sidebar-backdrop.is-open { display: block; }
}
