/* ═══════════════════════════════════════════
   layout.css — App shell, sidebar, topbar
═══════════════════════════════════════════ */

/* ── App shell ── */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--blue);
  border-right: none;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: width .22s cubic-bezier(.4,0,.2,1);
}

/* ── Sidebar toggle button ── */
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  width: 24px; height: 24px;
  background: rgba(255,255,255,.15);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #fff;
  flex-shrink: 0;
  transition: background .15s;
}
.sidebar-toggle:hover { background: rgba(255,255,255,.28); }
.sidebar-toggle .toggle-icon-expand { display: none; }
.sidebar-toggle .toggle-icon-collapse { display: block; }

/* ── Collapsed state ── */
.sidebar.collapsed { width: 48px; }

.sidebar.collapsed .nav-label { display: none; }

.sidebar.collapsed .sidebar-logo {
  justify-content: center;
  padding: 0;
}
.sidebar.collapsed .logo-icon { margin: 0 auto; }
.sidebar.collapsed .sidebar-toggle .toggle-icon-collapse { display: none; }
.sidebar.collapsed .sidebar-toggle .toggle-icon-expand  { display: block; }
.sidebar.collapsed .sidebar-toggle { margin-left: 0; }

.sidebar.collapsed .sidebar-nav { padding: 6px 4px 16px; }

.sidebar.collapsed .nav-section-label { display: none; }

.sidebar.collapsed .nav-section-items {
  padding: 0;
  max-height: 1000px; /* always visible in collapsed mode */
  opacity: 1;
}
.sidebar.collapsed .nav-section-items.collapsed {
  max-height: 1000px;
  opacity: 1;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 0;
  width: 36px;
  margin: 1px auto;
}
.sidebar.collapsed .nav-item svg { opacity: 0.75; }
.sidebar.collapsed .nav-item:hover svg,
.sidebar.collapsed .nav-item.active svg { opacity: 1; }

.sidebar.collapsed .nav-badge { display: none; }

/* Collapsed: version + refresh icon stacked vertically */
.sidebar.collapsed #version-strip {
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 0 0 12px;
  gap: 6px;
}
.sidebar.collapsed #appVersion {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  letter-spacing: 0.08em;
}
.sidebar.collapsed #version-strip button {
  padding: 4px;
  justify-content: center;
}
.sidebar.collapsed .refresh-label { display: none; }
.sidebar.collapsed .sidebar-footer {
  justify-content: center;
  padding: 10px 6px;
}
.sidebar.collapsed .user-avatar { margin: 0 auto; }
.sidebar.collapsed .user-info  { display: none; }
.sidebar.collapsed .sidebar-logout { display: none; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  height: var(--header-h);
  border-bottom: 1px solid rgba(255,255,255,.15);
  flex-shrink: 0;
}
.logo-icon {
  width: 28px; height: 28px;
  background: rgba(255,255,255,.2);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}
.logo-text { font-size: 14px; font-weight: 800; color: #fff; letter-spacing: -0.5px; }
.logo-text span { color: rgba(255,255,255,.75); }

/* ── Arena picker ── */
.sidebar-arena {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,.15);
  flex-shrink: 0;
}
.arena-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,.55);
  margin-bottom: 4px;
}

/* ── Nav ── */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 6px 6px 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.2) transparent;
}

.nav-section-group { margin-bottom: 0; }

/* ── Section label — minimal floating label ── */
.nav-section-label {
  font-size: 9.5px;
  font-weight: 600;
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255,255,255,.5);
  padding: 16px 6px 4px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  background: transparent;
  border: none;
  border-radius: 6px;
  transition: color .15s, background .15s;
  position: relative;
}
/* Hide the icon inside section label — too noisy */
.nav-section-label span > svg { display: none; }
/* Animated chevron */
.nav-section-label::after {
  content: '';
  width: 13px;
  height: 13px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  flex-shrink: 0;
  transition: transform .22s cubic-bezier(.4,0,.2,1), opacity .15s;
  opacity: 0;
}
.nav-section-label:hover { color: #fff; background: rgba(255,255,255,.1); }
.nav-section-label:hover::after,
.nav-section-label.collapsed::after { opacity: 1; }
.nav-section-label.collapsed::after { transform: rotate(-90deg); }

/* Active section */
.nav-section-label.section-active {
  color: #fff;
  background: rgba(255,255,255,.15);
}
.nav-section-label.section-active::after { opacity: 1; }

/* All sections same muted style */
.nav-section-group:nth-child(1) .nav-section-label,
.nav-section-group:nth-child(2) .nav-section-label,
.nav-section-group:nth-child(3) .nav-section-label,
.nav-section-group:nth-child(4) .nav-section-label,
.nav-section-group:nth-child(5) .nav-section-label,
.nav-section-group:nth-child(6) .nav-section-label {
  background: transparent;
  color: rgba(255,255,255,.5);
}
.nav-section-group:nth-child(1) .nav-section-label.section-active,
.nav-section-group:nth-child(2) .nav-section-label.section-active,
.nav-section-group:nth-child(3) .nav-section-label.section-active,
.nav-section-group:nth-child(4) .nav-section-label.section-active,
.nav-section-group:nth-child(5) .nav-section-label.section-active,
.nav-section-group:nth-child(6) .nav-section-label.section-active {
  color: #fff;
  background: rgba(255,255,255,.15);
}

/* ── Items container ── */
.nav-section-items {
  overflow: hidden;
  transition: max-height .24s cubic-bezier(.4,0,.2,1), opacity .2s ease;
  max-height: 400px;
  opacity: 1;
  background: transparent;
  border: none;
  padding: 1px 0 3px;
}
.nav-section-items.collapsed {
  max-height: 0;
  opacity: 0;
  padding: 0;
}

/* ── Nav item ── */
.nav-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 8px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 400;
  color: rgba(255,255,255,.8);
  transition: background .12s ease, color .12s ease;
  position: relative;
  user-select: none;
}
.nav-item svg {
  flex-shrink: 0;
  opacity: 0.6;
  width: 13px !important;
  height: 13px !important;
  transition: opacity .12s;
}
.nav-item:hover  { background: rgba(255,255,255,.12); color: #fff; }
.nav-item:hover svg { opacity: 0.85; }
.nav-item.active { background: rgba(255,255,255,.2); color: #fff; font-weight: 600; }
.nav-item.active svg { opacity: 1; }
/* Sliding left accent bar for active item */
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 2.5px;
  height: 14px;
  background: #fff;
  border-radius: 0 2px 2px 0;
  animation: navBarSlide .18s cubic-bezier(.4,0,.2,1);
}
@keyframes navBarSlide {
  from { height: 0; opacity: 0; }
  to   { height: 14px; opacity: 1; }
}

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  background: rgba(255,255,255,.25);
  color: #fff;
  border-radius: 10px;
  padding: 0 6px;
  min-width: 18px;
  height: 16px;
  display: flex; align-items: center; justify-content: center;
}
.nav-badge.live { background: #10B981; }

/* ── Sidebar footer ── */
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,.15);
  flex-shrink: 0;
}
.user-avatar {
  width: 28px; height: 28px;
  background: rgba(255,255,255,.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 11px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10px; color: rgba(255,255,255,.6); }

/* ── Main column ── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ── Topbar ── */
.topbar {
  height: var(--header-h);
  background:
    repeating-linear-gradient(
      -45deg,
      transparent            0px, transparent            2px,
      rgba(255,255,255,.028) 2px, rgba(255,255,255,.028) 3px,
      transparent            3px, transparent            7px,
      rgba(255,255,255,.010) 7px, rgba(255,255,255,.010) 8px,
      transparent            8px, transparent           12px
    ),
    repeating-linear-gradient(
      45deg,
      transparent            0px, transparent            2px,
      rgba(255,255,255,.028) 2px, rgba(255,255,255,.028) 3px,
      transparent            3px, transparent            7px,
      rgba(255,255,255,.010) 7px, rgba(255,255,255,.010) 8px,
      transparent            8px, transparent           12px
    ),
    linear-gradient(180deg, #26282e 0%, #1c1e24 40%, #1a1c22 100%);
  border-bottom: 1px solid rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  flex-shrink: 0;
}
.topbar-title { font-size: 14px; font-weight: 700; color: #fff; letter-spacing: -0.3px; }
.topbar-sub   { font-size: 11px; color: rgba(255,255,255,.55); margin-top: 1px; }

.topbar-spacer { flex: 1; }

.topbar-search {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--radius);
  padding: 0 10px;
  height: 30px;
  width: 200px;
  transition: border-color .15s;
}
.topbar-search:focus-within { border-color: rgba(255,255,255,.4); }
.topbar-search .search-icon { font-size: 12px; color: rgba(255,255,255,.5); }
.topbar-search input {
  background: none;
  border: none;
  font-size: 12px;
  color: #fff;
  width: 100%;
}
.topbar-search input::placeholder { color: rgba(255,255,255,.4); }

/* ── Topbar icon buttons (override inline var() styles) ── */
.topbar button {
  border-color: rgba(255,255,255,.18) !important;
  background:   rgba(255,255,255,.08) !important;
  color:        rgba(255,255,255,.65) !important;
}
.topbar button:hover {
  border-color: rgba(255,255,255,.45) !important;
  color:        #fff !important;
}
/* Mail unread badge ring matches dark topbar */
#mailNavBadge { box-shadow: 0 0 0 2px #1c1e24 !important; }

/* ── Weather widget (override inline var() styles) ── */
#weatherWidget {
  border-color: rgba(255,255,255,.15) !important;
  background:   rgba(255,255,255,.08) !important;
}
#weatherTemp { color: #fff !important; }
#weatherCond { color: rgba(255,255,255,.6) !important; }
#weatherLoc,
#weatherTime { color: rgba(255,255,255,.5) !important; }

/* ── Content area ── */
main.content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}
.page { display: none; padding: 20px; }
.page.active { display: block; }

/* ── Section header ── */
.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.section-title { font-size: 17px; font-weight: 700; color: var(--text); letter-spacing: -0.4px; }
.section-sub   { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 3px;
  width: fit-content;
  margin-bottom: 14px;
}
.tab {
  padding: 5px 14px;
  border-radius: calc(var(--radius-lg) - 2px);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  transition: all .12s;
  user-select: none;
}
.tab:hover  { color: var(--text); }
.tab.active { background: #26282e; color: #fff; font-weight: 600; box-shadow: none; }

/* ── Custom Arena Picker ── */
.arena-picker { position: relative; }
.arena-picker-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: var(--font);
  text-align: left;
}
.arena-picker-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.arena-picker-chevron { font-size: 9px; color: var(--text-4); flex-shrink: 0; }

.arena-picker-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: -14px;
  right: -14px;
  background: #fff;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  overflow: hidden;
  max-height: min(72vh, 620px);
  flex-direction: column;
}
.arena-picker-dropdown.open { display: flex; }

.arena-picker-search-wrap {
  padding: 8px 8px 6px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.arena-picker-search {
  width: 100%;
  height: 30px;
  padding: 0 9px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text);
  font-family: var(--font);
  transition: border-color .12s;
}
.arena-picker-search:focus { border-color: var(--blue); outline: none; }
.arena-picker-search::placeholder { color: var(--text-4); }

.arena-picker-list { overflow-y: auto; max-height: min(64vh, 540px); padding: 3px 0; }
.arena-picker-item {
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: background .1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.arena-picker-item:hover  { background: var(--bg-hover); color: var(--text); }
.arena-picker-item.active { background: var(--blue-lt); color: var(--blue); font-weight: 600; }
.arena-picker-empty { padding: 14px 12px; font-size: 12px; color: var(--text-4); text-align: center; }
.arena-picker-list::-webkit-scrollbar { width: 3px; }
.arena-picker-list::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }


/* ══════════════════════════════════════════════════════════


/* ══════════════════════════════════════════════════════════
   CARBON FIBRE SIDEBAR
   Dark charcoal base with interlocking 45/-45 deg CF weave.
══════════════════════════════════════════════════════════ */

/* ── CF background ── */
.sidebar {
  background:
    repeating-linear-gradient(
      -45deg,
      transparent            0px, transparent            2px,
      rgba(255,255,255,.028) 2px, rgba(255,255,255,.028) 3px,
      transparent            3px, transparent            7px,
      rgba(255,255,255,.010) 7px, rgba(255,255,255,.010) 8px,
      transparent            8px, transparent           12px
    ),
    repeating-linear-gradient(
      45deg,
      transparent            0px, transparent            2px,
      rgba(255,255,255,.028) 2px, rgba(255,255,255,.028) 3px,
      transparent            3px, transparent            7px,
      rgba(255,255,255,.010) 7px, rgba(255,255,255,.010) 8px,
      transparent            8px, transparent           12px
    ),
    linear-gradient(180deg, #26282e 0%, #1c1e24 40%, #1a1c22 100%);
  border-right: 1px solid rgba(255,255,255,.07);
}

/* ── Logo bar ── */
.sidebar-logo               { border-bottom: 1px solid rgba(255,255,255,.08); }
.logo-icon                  { background: rgba(255,255,255,.12); color: #fff; }
.logo-text                  { color: #fff; }
.logo-text span             { color: rgba(255,255,255,.6); }

/* ── Arena area ── */
.sidebar-arena              { border-bottom: 1px solid rgba(255,255,255,.08); }
.arena-label                { color: rgba(255,255,255,.45); }

/* ── Scrollbar ── */
.sidebar-nav                { scrollbar-color: rgba(255,255,255,.15) transparent; }

/* ── Section labels ── */
.nav-section-label          { color: rgba(255,255,255,.45); }
.nav-section-label::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
.nav-section-label:hover          { color: #fff; background: rgba(255,255,255,.08); }
.nav-section-label.section-active { color: #fff; background: rgba(255,255,255,.1);  }
.nav-section-group:nth-child(1) .nav-section-label,
.nav-section-group:nth-child(2) .nav-section-label,
.nav-section-group:nth-child(3) .nav-section-label,
.nav-section-group:nth-child(4) .nav-section-label,
.nav-section-group:nth-child(5) .nav-section-label,
.nav-section-group:nth-child(6) .nav-section-label { color: rgba(255,255,255,.45); }
.nav-section-group:nth-child(1) .nav-section-label.section-active,
.nav-section-group:nth-child(2) .nav-section-label.section-active,
.nav-section-group:nth-child(3) .nav-section-label.section-active,
.nav-section-group:nth-child(4) .nav-section-label.section-active,
.nav-section-group:nth-child(5) .nav-section-label.section-active,
.nav-section-group:nth-child(6) .nav-section-label.section-active { color: #fff; background: rgba(255,255,255,.1); }

/* ── Nav items ── */
.nav-item            { color: rgba(255,255,255,.75); }
.nav-item svg        { opacity: 0.6; }
.nav-item:hover      { background: rgba(255,255,255,.1);  color: #fff; }
.nav-item:hover svg  { opacity: 0.85; }
.nav-item.active     { background: rgba(255,255,255,.15); color: #fff; font-weight: 600; }
.nav-item.active svg { opacity: 1; }
.nav-item.active::before { background: #fff; }

/* ── Badges ── */
.nav-badge           { background: rgba(255,255,255,.18); color: #fff; }
.nav-badge.live      { background: #10B981; color: #fff; }

/* ── Toggle ── */
.sidebar-toggle       { color: rgba(255,255,255,.55); }
.sidebar-toggle:hover { background: rgba(255,255,255,.1); }

/* ── Footer ── */
.sidebar-footer { border-top: 1px solid rgba(255,255,255,.08); }
.user-avatar    { background: rgba(255,255,255,.12); color: #fff; }
.user-name      { color: #fff; }
.user-role      { color: rgba(255,255,255,.5); }

/* ── Dark mode — keep slate, just tighten borders ── */
:root.dark .sidebar        { background: #1e293b !important; border-right-color: #334155 !important; }
:root.dark .sidebar-logo   { border-bottom-color: #334155 !important; }
:root.dark .sidebar-arena  { border-bottom-color: #334155 !important; }
:root.dark .sidebar-footer { border-top-color:    #334155 !important; }

/* ── Arena picker text — white on CF dark background ── */
.arena-picker-label   { color: #fff; }
.arena-picker-chevron { color: rgba(255,255,255,.45); }
