/* ═══════════════════════════════════════════════════════════════
   STRATOS TACTICAL — Layout: Sidebar + Content Grid
═══════════════════════════════════════════════════════════════ */

/* ── SIDEBAR ────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sticky);
  transition: width var(--transition-med);
  overflow: hidden;
}

/* Subtle scanline effect on sidebar */
.sidebar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.08) 2px,
    rgba(0,0,0,0.08) 4px
  );
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}

.sidebar > * { position: relative; z-index: 1; }

/* ── Brand / Header ── */
.sidebar-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-dim);
  min-height: 58px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  overflow: hidden;
  white-space: nowrap;
  width: 100%;
}

.brand-icon {
  width: 36px; height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-bright);
  background: var(--bg-surface-2);
  position: relative;
}

/* Corner accent on brand icon */
.brand-icon::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px;
  width: 6px; height: 6px;
  border-top: 1px solid var(--amber);
  border-left: 1px solid var(--amber);
}

.brand-text { overflow: hidden; }

.brand-name {
  font-family: var(--font-display);
  font-size: 0.864rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--amber);
  display: block;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-version {
  font-family: var(--font-mono);
  font-size: 0.648rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-ter);
  display: block;
}

/* ── Nav ── */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-2) 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-bright) transparent;
}

.nav-section {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-dim);
}
.nav-section:last-child { border-bottom: none; }

.nav-section-title {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.648rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-ter);
  padding: var(--space-2) var(--space-5) 3px;
  white-space: nowrap;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 5px var(--space-5);
  font-family: var(--font-body);
  font-size: 0.648rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-sec);
  text-decoration: none;
  transition: all var(--transition-fast);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  line-height: 1.4;
  min-height: 26px;
}

.nav-item svg, .nav-item i {
  width: 12px; height: 12px;
  flex-shrink: 0;
  opacity: 0.4;
  transition: opacity var(--transition-fast);
}

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(12, 111, 255, 0.04);
}
.nav-item:hover svg, .nav-item:hover i { opacity: 0.7; }

.nav-item.active {
  color: var(--amber);
  background: var(--amber-dim);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--amber);
}
.nav-item.active svg, .nav-item.active i { opacity: 1; }

/* Non-clickable sidebar entry — used to show role-locked sub-pages
   (e.g. Users tab for employers). Kept visible so employers know the
   surface exists but a click does nothing. */
.nav-item.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.nav-item.disabled:hover {
  background: none;
  color: var(--text-sec);
}
.nav-item.disabled .lock-indicator {
  margin-left: auto;
  width: 10px; height: 10px;
  opacity: 0.7;
}

/* ── Sidebar Footer ── */
.sidebar-footer {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border-dim);
  flex-shrink: 0;
}

/* ── Sidebar Theme Toggle (footer-pinned) ────────────────────
   Two tactical squares (sun/moon) side-by-side. The active theme
   button reads its state from <html data-theme> via CSS attribute
   selectors — no server-side "current theme" branching needed. */
.sidebar-theme-toggle {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-dim);
  flex-shrink: 0;
}
.sidebar-theme-toggle .theme-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px 0;
  background: transparent;
  border: 1px solid var(--border-med);
  color: var(--text-sec);
  cursor: pointer;
  transition: color var(--transition-fast),
              background var(--transition-fast),
              border-color var(--transition-fast);
}
.sidebar-theme-toggle .theme-btn + .theme-btn { border-left: none; }
.sidebar-theme-toggle .theme-btn svg,
.sidebar-theme-toggle .theme-btn i {
  width: 13px; height: 13px;
  opacity: 0.75;
  transition: opacity var(--transition-fast);
}
.sidebar-theme-toggle .theme-btn:hover {
  color: var(--amber);
  border-color: var(--amber);
  background: var(--amber-glow);
}
.sidebar-theme-toggle .theme-btn:hover svg,
.sidebar-theme-toggle .theme-btn:hover i { opacity: 1; }
[data-theme="light"] .sidebar-theme-toggle .theme-btn[data-theme-set="light"],
[data-theme="dark"]  .sidebar-theme-toggle .theme-btn[data-theme-set="dark"] {
  color: var(--amber);
  border-color: var(--amber);
  background: var(--amber-dim);
}
[data-theme="light"] .sidebar-theme-toggle .theme-btn[data-theme-set="light"] svg,
[data-theme="light"] .sidebar-theme-toggle .theme-btn[data-theme-set="light"] i,
[data-theme="dark"]  .sidebar-theme-toggle .theme-btn[data-theme-set="dark"]  svg,
[data-theme="dark"]  .sidebar-theme-toggle .theme-btn[data-theme-set="dark"]  i {
  opacity: 1;
}

.sys-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.648rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-ter);
}

/* ── MAIN CONTENT ────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-med);
  position: relative;

  /* Compact scale: shrink everything outside the sidebar so it fits a
     1366×768 laptop screen without scrollbars. Variables are inherited by
     the whole subtree; the sidebar (outside this element) keeps the
     original sizes. Modal overlay also picks these up — desired. */
  --fs-xxs:  0.55rem;
  --fs-xs:   0.62rem;
  --fs-sm:   0.74rem;
  --fs-base: 0.85rem;
  --fs-md:   0.92rem;
  --fs-lg:   1.12rem;
  --fs-xl:   1.32rem;
  --fs-2xl:  1.70rem;

  --space-1:   3px;
  --space-2:   6px;
  --space-3:   9px;
  --space-4:  12px;
  --space-5:  15px;
  --space-6:  18px;
  --space-8:  22px;
  --space-10: 28px;
  --space-12: 34px;
  --space-16: 44px;

  --input-min-height: 30px;
}

/* ── Page Content ── */
.page-content {
  flex: 1;
  padding: var(--space-8);
  width: 100%;
  max-width: var(--content-max);
}
.page-content.p-0 {
  padding: 0;
  max-width: none;
}

/* ── Standard Page Header ── */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border-dim);
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(1.0rem, 2.2vw, 1.7rem);
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--amber);
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.page-title::before {
  content: '';
  width: 22px; height: 1px;
  background: var(--amber);
  opacity: 0.5;
}

.page-subtitle {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-ter);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: var(--space-1);
}

/* ── Sidebar Collapse (Desktop) ─────────────────────────────
   Toggle-driven full-hide of the sidebar. Two vertically-centered
   tab-style buttons on the viewport edges — the collapse tab clings
   to the sidebar's right edge, the expand tab pins to the left edge
   of the viewport. Only one is visible at a time (mutually exclusive
   via body.sidebar-collapsed, whose state is persisted in localStorage
   and applied before first paint to avoid flash). */
.sidebar-edge-tab {
  appearance: none;
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 20px; height: 44px;
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.14);
  color: var(--text-sec);
  cursor: pointer;
  padding: 0; margin: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: calc(var(--z-sticky) + 1);
  transition: left var(--transition-med),
              color var(--transition-fast),
              border-color var(--transition-fast),
              background var(--transition-fast);
}
.sidebar-edge-tab:hover {
  color: var(--amber);
  border-color: var(--amber);
  background: rgba(245, 158, 11, 0.10);
}
.sidebar-edge-tab svg { width: 12px; height: 12px; }

/* Collapse tab — flush against the sidebar's right border. Hidden
   when collapsed (moves off-screen with the sidebar visually, but
   also gated via display:none to keep it out of tab order). */
.sidebar-edge-tab--collapse {
  left: calc(var(--sidebar-width) - 1px);
  border-left: none;
}
body.sidebar-collapsed .sidebar-edge-tab--collapse { display: none; }

/* Expand tab — pinned to the viewport's left edge; hidden by default,
   shown when the sidebar is collapsed. Mirrored border-radius so it
   reads as the "handle" pulling the sidebar back in. */
.sidebar-edge-tab--expand {
  left: 0;
  border-left: none;
  display: none;
}
body.sidebar-collapsed .sidebar-edge-tab--expand { display: flex; }

body.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
}
body.sidebar-collapsed .main-content {
  margin-left: 0;
}

/* ── Mobile Sidebar Overlay ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: calc(var(--z-sticky) - 1);
  backdrop-filter: blur(3px);
}
.sidebar-overlay.show { display: block; }

/* ── Mobile Toggle Button ── */
.sidebar-toggle-mobile-floating {
  display: none;
  position: fixed;
  bottom: var(--space-6);
  left: var(--space-4);
  z-index: var(--z-overlay);
  width: 38px; height: 38px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-bright);
  color: var(--text-sec);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.sidebar-toggle-mobile-floating:hover {
  border-color: var(--amber);
  color: var(--amber);
}

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-med);
    z-index: var(--z-overlay);
    width: var(--sidebar-width);
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .sidebar-toggle-mobile-floating { display: flex; }
  .page-content { padding: var(--space-5); }
}

@media (max-width: 640px) {
  .page-content { padding: var(--space-4); }
}
