/* ============================================================
   SIDEBAR.CSS — Professional Resizable Sidebar v3
   PARS Design System
   Desktop: resizable 200–360px | Tablet: 72px icon-only | Mobile: drawer
   ============================================================ */

/* ── CSS Variables ──────────────────────────────────────────── */
:root {
  --sb-width: 260px;
  --sb-collapsed: 72px;
  --sb-mobile-width: min(280px, 85vw);
  --sb-bg: #0D1926;
  --sb-border: rgba(255, 255, 255, 0.07);
  --sb-text: rgba(255, 255, 255, 0.55);
  --sb-text-hover: #ffffff;
  --sb-accent: #D4AF37;
  --sb-accent-bg: rgba(212, 175, 55, 0.10);
  --sb-hover-bg: rgba(255, 255, 255, 0.05);
  --sb-active-border: 3px solid #D4AF37;
  --sb-transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --sb-item-height: 40px;
  --topbar-height: 60px;
}

/* ── Skip Link ──────────────────────────────────────────────── */
.skip-to-content {
  position: absolute;
  top: -999px;
  left: 16px;
  padding: 8px 16px;
  background: var(--sb-accent);
  color: #0D1926;
  font-size: 13px;
  font-weight: 600;
  border-radius: 0 0 6px 6px;
  z-index: 99999;
  text-decoration: none;
}
.skip-to-content:focus { top: 0; }

/* ── Layout Shell ───────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Base Sidebar ───────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  height: 100dvh;
  width: var(--sb-width);
  background: var(--sb-bg);
  display: flex;
  flex-direction: column;
  z-index: 900;
  overflow: hidden;
  flex-shrink: 0;
  transition: transform var(--sb-transition);
  will-change: transform;
  border-right: 1px solid var(--sb-border);
}

/* ── Resize Handle (Desktop only) ───────────────────────────── */
.sidebar-resize-handle {
  position: absolute;
  top: 0;
  right: -2px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-resize-handle::after {
  content: '';
  width: 4px;
  height: 100%;
  background: transparent;
  border-radius: 2px;
  transition: background 0.15s, width 0.15s;
}
.sidebar-resize-handle:hover::after,
.sidebar-resize-handle.dragging::after {
  background: var(--sb-accent);
  width: 4px;
  opacity: 0.7;
}

/* ── Sidebar Header ─────────────────────────────────────────── */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--sb-border);
  flex-shrink: 0;
  min-height: 68px;
  overflow: hidden;
}
.sidebar-header .sb-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}
.sidebar-header .sb-brand {
  font-family: var(--font-head, 'Poppins', sans-serif);
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  opacity: 1;
  transition: opacity var(--sb-transition), width var(--sb-transition);
}

/* ── Navigation Scroll Area ─────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 0;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

/* ── Section Divider ────────────────────────────────────────── */
.sidebar-divider {
  height: 1px;
  background: var(--sb-border);
  margin: 6px 16px;
  flex-shrink: 0;
}
.sidebar-section-label {
  font-size: 10px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.25);
  padding: 10px 20px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.02em;
  opacity: 1;
  transition: opacity var(--sb-transition);
}

/* ── Nav Item ───────────────────────────────────────────────── */
.sidebar-nav a,
.sidebar-nav button.sb-nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  height: var(--sb-item-height);
  margin: 1px 8px;
  color: var(--sb-text);
  text-decoration: none;
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 13.5px;
  font-weight: 400;
  border-left: 3px solid transparent;
  border-radius: 6px;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  background: transparent;
  border-top: none;
  border-right: none;
  border-bottom: none;
  width: calc(100% - 16px);
  text-align: left;
  transition:
    color 0.15s ease,
    background 0.15s ease,
    border-left-color 0.15s ease;
  position: relative;
  outline: none;
}
.sidebar-nav a:hover,
.sidebar-nav button.sb-nav-btn:hover {
  color: var(--sb-text-hover);
  background: var(--sb-hover-bg);
}
.sidebar-nav a:focus-visible,
.sidebar-nav button.sb-nav-btn:focus-visible {
  outline: 2px solid var(--sb-accent);
  outline-offset: -2px;
}
.sidebar-nav a.active,
.sidebar-nav a[aria-current="page"],
.sidebar-nav button.sb-nav-btn.active {
  color: #ffffff;
  font-weight: 500;
  background: var(--sb-accent-bg);
  border-left-color: var(--sb-accent);
}
/* No glows, no box-shadow, no white borders on active */
.sidebar-nav a.active:focus-visible,
.sidebar-nav button.sb-nav-btn.active:focus-visible {
  outline: 2px solid var(--sb-accent);
  outline-offset: -2px;
}

/* ── Nav Icon ───────────────────────────────────────────────── */
.sb-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sb-icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}
.sb-icon i {
  font-size: 15px;
  width: 18px;
  text-align: center;
  color: inherit;
}
.sidebar-nav a.active .sb-icon,
.sidebar-nav button.sb-nav-btn.active .sb-icon {
  color: var(--sb-accent);
}

/* ── Nav Label ──────────────────────────────────────────────── */
.sb-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--sb-transition), width var(--sb-transition);
}

/* ── Nav Badge ──────────────────────────────────────────────── */
.sb-badge {
  font-size: 10px;
  font-weight: 600;
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  padding: 1px 6px;
  border-radius: 10px;
  flex-shrink: 0;
  min-width: 18px;
  text-align: center;
  opacity: 1;
  transition: opacity var(--sb-transition);
}
.sb-badge.gold {
  background: rgba(212, 175, 55, 0.18);
  color: var(--sb-accent);
}

/* ── Sidebar Footer (User section) ─────────────────────────── */
.sidebar-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--sb-border);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
  overflow: hidden;
}
.sidebar-user:hover { background: var(--sb-hover-bg); }
.sidebar-user:focus-visible {
  outline: 2px solid var(--sb-accent);
  outline-offset: -2px;
}
.sb-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--sb-accent);
  color: #0D1926;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  font-family: var(--font-head, 'Poppins', sans-serif);
}
.sb-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.sb-user-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  opacity: 1;
  transition: opacity var(--sb-transition), width var(--sb-transition);
}
.sb-user-name {
  font-size: 13px;
  font-weight: 500;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.sb-user-role {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  margin-top: 1px;
}
.sb-signout-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.25);
  transition: color 0.15s;
  opacity: 1;
  transition: opacity var(--sb-transition);
}
.sidebar-user:hover .sb-signout-icon { color: #f87171; }

/* ── Main Content area ──────────────────────────────────────── */
.main-content,
.reviewer-main,
.dashboard-body-wrapper {
  margin-left: var(--sb-width);
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  transition: margin-left var(--sb-transition);
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 80;
}
.topbar__left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.topbar__right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

/* ── Hamburger / Mobile toggle ──────────────────────────────── */
.sb-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #475569;
  border-radius: 6px;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
  padding: 0;
}
.sb-hamburger:hover { background: #f1f5f9; color: #0f172a; }
.sb-hamburger:focus-visible {
  outline: 2px solid var(--sb-accent);
  outline-offset: 2px;
}

/* ── Sidebar Overlay ────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 28, 0.6);
  z-index: 899;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.sidebar-overlay.visible { display: block; }

/* ══════════════════════════════════════════════════════════════
   TABLET: 768px – 1023px — Icon-only collapsed sidebar
   ══════════════════════════════════════════════════════════════ */
@media (min-width: 768px) and (max-width: 1023px) {
  :root { --sb-width: var(--sb-collapsed); }

  .sidebar {
    width: var(--sb-collapsed) !important;
  }
  .sidebar-resize-handle { display: none; }

  .sidebar-header { padding: 20px; justify-content: center; }
  .sidebar-header .sb-brand { opacity: 0; width: 0; overflow: hidden; }

  .sidebar-section-label { opacity: 0; height: 0; padding: 0; overflow: hidden; }
  .sidebar-divider { margin: 6px 12px; }

  .sidebar-nav a,
  .sidebar-nav button.sb-nav-btn {
    justify-content: center;
    gap: 0;
    padding: 0;
    margin: 2px auto;
    width: 44px;
    height: 44px;
    border-left: 3px solid transparent;
    border-radius: 8px;
    position: relative;
  }
  .sidebar-nav a.active,
  .sidebar-nav button.sb-nav-btn.active {
    border-left: 3px solid var(--sb-accent);
    border-radius: 0 8px 8px 0;
    background: var(--sb-accent-bg);
  }
  .sb-label { opacity: 0; width: 0; overflow: hidden; }
  .sb-badge { opacity: 0; width: 0; overflow: hidden; }

  /* Tooltip on hover */
  .sidebar-nav a[data-tip]:hover::after,
  .sidebar-nav button.sb-nav-btn[data-tip]:hover::after {
    content: attr(data-tip);
    position: fixed;
    left: calc(var(--sb-collapsed) + 10px);
    background: #1e293b;
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.08);
  }

  .sidebar-user { padding: 14px; justify-content: center; }
  .sb-user-info { opacity: 0; width: 0; overflow: hidden; }
  .sb-signout-icon { opacity: 0; width: 0; overflow: hidden; }

  .main-content,
  .reviewer-main,
  .dashboard-body-wrapper {
    margin-left: var(--sb-collapsed) !important;
  }
}

/* ══════════════════════════════════════════════════════════════
   MOBILE: below 768px — Off-canvas drawer
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  :root { --sb-width: var(--sb-mobile-width); }

  .sidebar {
    transform: translateX(-100%);
    width: var(--sb-mobile-width) !important;
    z-index: 9999;
    box-shadow: none;
  }
  .sidebar.drawer-open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0, 0, 0, 0.45);
  }
  .sidebar-resize-handle { display: none; }

  .main-content,
  .reviewer-main,
  .dashboard-body-wrapper {
    margin-left: 0 !important;
    width: 100%;
  }

  .sb-hamburger { display: flex; }
}

/* ══════════════════════════════════════════════════════════════
   DESKTOP: 1024px and above
   ══════════════════════════════════════════════════════════════ */
@media (min-width: 1024px) {
  .sb-hamburger { display: none; }
  .sidebar-overlay { display: none !important; }
}

/* ── Body scroll lock ───────────────────────────────────────── */
body.sb-locked {
  overflow: hidden;
  touch-action: none;
}

/* ── Reviewer layout compat ─────────────────────────────────── */
.reviewer-layout,
.dashboard-layout {
  display: flex;
  min-height: 100vh;
}
.reviewer-sidebar { all: unset; }

/* =========================================================================
   CANONICAL INSTITUTIONAL DARK SIDEBAR & TOPBAR LOGOUT SYSTEM
   ========================================================================= */
.sidebar {
  width: 250px !important;
  background: #0B132B !important;
  border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
  display: flex !important;
  flex-direction: column !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  height: 100vh !important;
  height: 100dvh !important;
  z-index: 1000 !important;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15) !important;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.sidebar__header {
  padding: 18px 20px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.sidebar__brand-link {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  text-decoration: none !important;
}

.sidebar__logo-box {
  width: 38px !important;
  height: 38px !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  background: #ffffff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
  flex-shrink: 0 !important;
}

.sidebar__logo-img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  display: block !important;
}

.sidebar__brand-info {
  display: flex !important;
  flex-direction: column !important;
  line-height: 1.25 !important;
}

.sidebar__brand-name {
  font-family: 'Poppins', sans-serif !important;
  font-size: 16px !important;
  font-weight: 800 !important;
  color: #FFFFFF !important;
  letter-spacing: 0.04em !important;
}

.sidebar__brand-role {
  font-size: 11px !important;
  font-weight: 600 !important;
  color: #D4AF37 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.06em !important;
}

.sidebar__nav {
  padding: 16px 0 !important;
  flex-grow: 1 !important;
  overflow-y: auto !important;
}

.sidebar__section {
  margin-bottom: 14px !important;
}

.sidebar__section-title {
  display: block !important;
  padding: 8px 22px 6px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.08em !important;
  color: #64748B !important;
}

.sidebar__nav-item {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 9px 16px !important;
  margin: 3px 12px !important;
  border-radius: 8px !important;
  color: #94A3B8 !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  transition: all 0.2s ease !important;
}

.sidebar__nav-item:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #FFFFFF !important;
  transform: translateX(2px) !important;
}

.sidebar__nav-item:hover i {
  color: #D4AF37 !important;
}

.sidebar__nav-item--active,
.sidebar__nav-item.active {
  background: rgba(212, 175, 55, 0.12) !important;
  color: #F59E0B !important;
  font-weight: 600 !important;
  border-left: 3px solid #D97706 !important;
}

.sidebar__nav-item--active i,
.sidebar__nav-item.active i {
  color: #F59E0B !important;
}

.sidebar__nav-item-left {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
}

.sidebar__nav-item i {
  font-size: 15px !important;
  width: 20px !important;
  text-align: center !important;
  color: inherit !important;
}

.sidebar__footer {
  padding: 16px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  margin-top: auto !important;
}

.sidebar__logout {
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  padding: 10px 16px !important;
  border-radius: 8px !important;
  background: rgba(239, 68, 68, 0.08) !important;
  color: #F87171 !important;
  border: 1px solid rgba(239, 68, 68, 0.2) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

.sidebar__logout:hover {
  background: rgba(239, 68, 68, 0.18) !important;
  color: #EF4444 !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
}

/* Topbar Logout Button */
.topbar__logout-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  padding: 7px 14px !important;
  background: #FEF2F2 !important;
  color: #DC2626 !important;
  border: 1px solid #FECACA !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  font-family: inherit !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  text-decoration: none !important;
  flex-shrink: 0 !important;
}

.topbar__logout-btn:hover {
  background: #DC2626 !important;
  color: #FFFFFF !important;
  border-color: #DC2626 !important;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25) !important;
  transform: translateY(-1px) !important;
}

.topbar__logout-btn svg {
  stroke: currentColor !important;
  flex-shrink: 0 !important;
}

/* Mobile Drawer support */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%) !important;
  }
  .sidebar.active,
  .sidebar.open,
  .sidebar.drawer-open {
    transform: translateX(0) !important;
  }
  .sidebar-overlay.active,
  .sidebar-overlay.open,
  .sidebar-overlay.visible {
    display: block !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
}

