/* Collapsible sidebar around the account pages (sidebar.js). Builds on styles.css (colours, wave
   background, user menu) and auth.css. Classes are sb- prefixed: the account page has its own .side. */

.sb-app { position: relative; z-index: 1; display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sb {
  position: sticky; top: 0;
  width: 256px; height: 100vh;
  flex-shrink: 0;
  display: flex; flex-direction: column;
  background: rgba(255, 255, 255, 0.55);
  border-right: 1px solid var(--glass-border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: width .3s cubic-bezier(.4, 0, .2, 1);
  z-index: 20;
}
.sb-app.collapsed .sb { width: 68px; }
.sb-instant .sb, .sb-instant .sb * { transition: none !important; } /* page load: no animation */

.sb-top { display: flex; align-items: center; gap: 10px; height: 64px; padding: 0 18px; overflow: hidden; }
.sb-top .brand-lockup { font-size: 20px; color: var(--navy); }

.sb-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 4px 12px; list-style: none; }
.sb-group { margin-bottom: 10px; list-style: none; }
.sb-label {
  height: 28px; padding: 8px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--navy-soft); white-space: nowrap;
  transition: opacity .2s;
}

.sb-item {
  position: relative;
  width: 100%; height: 40px;
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px;
  border: 0; border-radius: 12px;
  background: none;
  font: inherit; font-size: 14px; font-weight: 600; text-align: left; white-space: nowrap;
  color: var(--navy-soft);
  cursor: pointer;
  transition: color .2s, transform .3s cubic-bezier(.5, 1.5, .5, 1);
}
a.sb-item { text-decoration: none; }
.sb-item svg { width: 17px; height: 17px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sb-item .t { flex: 1; transition: opacity .2s; }
/* liquid glass on hover and the current tab */
.sb-item::before, .sb-item::after { content: ""; position: absolute; inset: 0; border-radius: 12px; opacity: 0; transition: opacity .25s; pointer-events: none; }
.sb-item::before { backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); filter: url(#sb-glass); }
.sb-item::after {
  background: rgba(255, 255, 255, 0.18);
  box-shadow: inset 1px 1px 1px rgba(255, 255, 255, .7), inset -1px -1px 1px rgba(255, 255, 255, .7), 0 4px 4px rgba(11, 31, 75, .06), 0 0 12px rgba(11, 31, 75, .05);
}
.sb-item > * { position: relative; z-index: 1; }
.sb-item:hover:not(:disabled) { color: var(--navy); transform: scale(1.01); }
.sb-item:active:not(:disabled) { transform: scale(.98); }
.sb-item:hover:not(:disabled)::before, .sb-item:hover:not(:disabled)::after, .sb-item.on::before, .sb-item.on::after { opacity: 1; }
.sb-item.on { color: var(--navy); }
.sb-item.on::after {
  background: rgba(255, 255, 255, 0.45);
  box-shadow: inset 3px 3px 3px rgba(255, 255, 255, .85), inset -3px -3px 3px rgba(255, 255, 255, .85), 0 4px 4px rgba(11, 31, 75, .1), 0 0 12px rgba(11, 31, 75, .08);
}
.sb-item:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(31, 111, 224, 0.3); }
.sb-item:disabled { cursor: default; opacity: .5; }
.sb-soon {
  font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(11, 31, 75, 0.07); color: var(--navy-soft);
  transition: opacity .2s;
}

/* ---------- Inside a server: Go back, then the server ---------- */
.sb-back { color: var(--navy-soft); }
.sb-server { display: flex; align-items: center; gap: 10px; margin: 2px 0 10px; padding: 8px 12px; min-height: 48px; border-radius: 14px; background: rgba(255, 255, 255, 0.6); border: 1px solid var(--glass-border); white-space: nowrap; overflow: hidden; }
.sb-server .srv-icon { width: 30px; height: 30px; border-radius: 9px; font-size: 11px; --c1: #38bdf8; --c2: #6366f1; }
.sb-server .t { font-size: 14px; font-weight: 800; color: var(--navy); overflow: hidden; text-overflow: ellipsis; transition: opacity .2s; }

/* ---------- Signed-in person at the bottom (user-menu.js) ---------- */
.sb-foot { padding: 12px; margin-left: 0; display: block; } /* undo the top nav's .nav-actions layout */
.sb-foot .user-menu { width: 100%; }
.sb-foot .um-button { width: 100%; padding: 4px 10px 4px 4px; border-radius: 14px; gap: 10px; text-align: left; overflow: hidden; }
.sb-foot .um-name { flex: 1; min-width: 0; display: grid; line-height: 1.25; white-space: nowrap; transition: opacity .2s; }
.sb-foot .um-name b { font-size: 14px; color: var(--navy); overflow: hidden; text-overflow: ellipsis; }
.sb-foot .um-name small { font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.sb-foot .um-list { top: auto; bottom: calc(100% + 10px); left: 0; right: auto; }
.sb-foot .um-chev { transform: rotate(180deg); }
.sb-foot .um-button[aria-expanded="true"] .um-chev { transform: none; }

/* click the edge to collapse */
.sb-rail { position: absolute; top: 0; bottom: 0; right: -8px; width: 16px; cursor: col-resize; }
.sb-rail::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: transparent; transition: background .2s; }
.sb-rail:hover::after { background: var(--sky-mid); }

/* ---------- Collapsed: icons only (desktop) ---------- */
@media (min-width: 768px) {
  .sb-app.collapsed .sb-top { padding: 0; justify-content: center; }
  .sb-app.collapsed .sb-top .brand-lockup span { display: none; } /* just the navy A; the rest returns on expand */
  .sb-app.collapsed .sb-top .brand-a { margin-right: 0; }
  .sb-app.collapsed .sb-label { opacity: 0; }
  .sb-app.collapsed .sb-item { padding: 0; justify-content: center; gap: 0; }
  .sb-app.collapsed .sb-item .t, .sb-app.collapsed .sb-soon { display: none; }
  .sb-app.collapsed .sb-server { padding: 8px 0; justify-content: center; background: none; border-color: transparent; }
  .sb-app.collapsed .sb-server .t { display: none; }
  .sb-app.collapsed .sb-foot { padding: 12px 10px; }
  .sb-app.collapsed .sb-foot .um-button { padding: 4px; justify-content: center; border-radius: 999px; }
  .sb-app.collapsed .sb-foot .um-name, .sb-app.collapsed .sb-foot .um-chev { display: none; }
}

/* ---------- Main ---------- */
.sb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sb-bar {
  position: sticky; top: 0; z-index: 5;
  height: 64px;
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  font-size: 15px; font-weight: 700;
}
.sb-tog {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 1px solid var(--glass-border); border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--navy-soft);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.sb-tog:hover { background: #fff; color: var(--navy); }
.sb-tog:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(31, 111, 224, 0.3); }
.sb-tog svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sb-bar-end { margin-left: auto; display: flex; align-items: center; gap: 8px; } /* e.g. the dashboard's server switcher */
.sb-bar-end .switch-menu { left: auto; right: 0; transform: none; } /* it sits at the right edge now */
.sb-sep { width: 1px; height: 20px; background: rgba(11, 31, 75, 0.15); }
.sb-main .auth { width: 100%; padding-top: 12px; }
.sb-close, .sb-scrim { display: none; }

/* ---------- Phones: the sidebar slides over the page ---------- */
@media (max-width: 767px) {
  .sb {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: 288px !important; max-width: 88vw; height: auto;
    background: #eaf4ff;
    transform: translateX(-100%);
    transition: transform .35s cubic-bezier(.4, 0, .2, 1);
    box-shadow: 0 0 40px rgba(11, 31, 75, 0.3);
  }
  .sb-app.mob .sb { transform: none; }
  .sb-close { display: grid; margin-left: auto; border: 0; background: none; }
  .sb-scrim { display: block; position: fixed; inset: 0; z-index: 19; background: rgba(11, 31, 75, 0.35); opacity: 0; pointer-events: none; transition: opacity .3s; }
  .sb-app.mob .sb-scrim { opacity: 1; pointer-events: auto; }
  .sb-rail { display: none; }
}

/* a server tool only Ascent staff can see while it's tested */
.sb-staff-tag { background: rgba(31, 111, 224, 0.12); color: var(--accent, #1f6fe0); }

/* the server owner's plan, beside the server's name */
.sb-server .t { flex: 1; min-width: 0; }
.sb-plan { flex: none; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .02em; }
.sb-plan[hidden] { display: none; }
.sb-plan[data-plan=basic] { background: rgba(11, 31, 75, 0.07); color: var(--navy-soft); }
.sb-plan[data-plan=pro] { background: rgba(31, 111, 224, 0.12); color: var(--accent, #1f6fe0); }
.sb-plan[data-plan=enterprise] { background: linear-gradient(90deg, rgba(245, 180, 40, 0.22), rgba(230, 140, 20, 0.22)); color: #9a5b00; }
.sb-app.collapsed .sb-plan { display: none; }
