/* Left-hand menu shared by the staff console, client portal and candidate portal.
   Layout only — colours, type and spacing come from tokens.css. */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex: none;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.5rem 0.9rem 1.1rem;
  background: var(--bg-raised);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 30;
}

.sidebar-brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  padding: 0 0.75rem;
}

.sidebar-brand span { color: var(--accent); }

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 0.15rem; }

/* A collapsible section: its heading is a button. A section is open when it holds
   the current page, or once clicked — and stays open until clicked again, so any
   number of sections can be open at once. A faint line divides each section from
   the one above it. */
.sidebar-group {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
}

.sidebar-group-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.45rem 0.75rem;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.sidebar-group-label::after {
  content: "\25BE";
  font-size: 0.9em;
  transform: rotate(-90deg);
  transition: transform 0.15s ease;
}

.sidebar-group-label:hover { color: var(--text); }

.sidebar-group-items { display: none; flex-direction: column; gap: 0.15rem; margin-top: 0.15rem; }

.sidebar-group.is-open .sidebar-group-items { display: flex; }
.sidebar-group.is-open .sidebar-group-label::after { transform: none; }

/* options nested under a heading are indented beneath it */
.sidebar-group-items .sidebar-link { padding-left: 1.6rem; }

.sidebar-link {
  display: block;
  padding: 0.42rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-decoration: none;
}

.sidebar-link:hover { color: var(--text); background: var(--bg-sunken); }

.sidebar-link.is-active {
  color: var(--text);
  font-weight: 600;
  background: color-mix(in srgb, var(--accent-teal) 16%, transparent);
}

.sidebar-user {
  padding: 0.9rem 0.75rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.sidebar-user strong { display: block; color: var(--text); font-weight: 600; overflow-wrap: anywhere; }

.sidebar-logout {
  margin-top: 0.3rem;
  padding: 0;
  font-family: inherit;
  font-size: 0.78rem;
  color: var(--accent-teal);
  background: none;
  border: none;
  cursor: pointer;
}

.sidebar-logout:hover { text-decoration: underline; }

.app-main { flex: 1; min-width: 0; }

.mobile-bar { display: none; }

@media (max-width: 860px) {
  .app-shell { display: block; }

  .mobile-bar {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.8rem 1rem;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border);
  }

  .sidebar-toggle {
    font-size: 1.25rem;
    line-height: 1;
    padding: 0.3rem 0.6rem;
    color: var(--text);
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    transform: translateX(-100%);
    transition: transform 0.18s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
  }

  body.sidebar-open .sidebar { transform: translateX(0); }

  body.sidebar-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 20;
  }
}
