:root {
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 64px;
}

body {
  margin: 0;
  background: var(--bg, var(--yapper-background, linear-gradient(180deg,#031127 0%,#07284b 45%,#0d3e76 100%)));
  font-family: 'Plus Jakarta Sans', sans-serif;
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Sidebar shell ── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100%;
  background: #0b0f1a;
  border-right: 1px solid rgba(99,179,237,0.08);
  display: flex;
  flex-direction: column;
  transition: width 0.22s cubic-bezier(.4,0,.2,1);
  z-index: 1000;
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

/* ── Header ── */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 14px;
  border-bottom: 1px solid rgba(99,179,237,0.06);
  min-height: 64px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #e2eeff;
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-logo img {
  height: 30px;
  border-radius: 8px;
  flex-shrink: 0;
}

.sidebar-logo span {
  display: inline-block;
  transition: opacity 0.15s, width 0.22s, max-width 0.22s;
}

.sidebar.collapsed .sidebar-logo span {
  opacity: 0;
  width: 0;
  max-width: 0;
  overflow: hidden;
}

/* hide mobile toggle on desktop — only shown inside the @media block below */
.mobile-sidebar-toggle {
  display: none !important;
}

.sidebar-toggle {
  background: none;
  border: none;
  font-size: 18px;
  color: #6b8aad;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  flex-shrink: 0;
  transition: color 0.2s, background 0.2s;
}

.sidebar-toggle:hover {
  color: #63b3ed;
  background: rgba(99,179,237,0.08);
}

/* ── Nav ── */
.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  color: #6b8aad;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
  border-left: 2px solid transparent;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.nav-link:hover {
  background: rgba(99,179,237,0.07);
  color: #a8caee;
  border-left-color: rgba(99,179,237,0.3);
}

.nav-link.active {
  background: rgba(99,179,237,0.1);
  color: #63b3ed;
  border-left-color: #63b3ed;
}

.nav-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.nav-text {
  display: inline-block;
  transition: opacity 0.15s, width 0.22s, max-width 0.22s;
  overflow: hidden;
}

/* collapsed: adjust header and nav so the logo is fully visible */
.sidebar.collapsed .sidebar-header {
  padding: 18px 8px;
}

.sidebar.collapsed .sidebar-logo {
  gap: 0;
}

.sidebar.collapsed .sidebar-logo span {
  display: none;
}

.sidebar.collapsed .nav-link {
  padding: 11px 0;
  justify-content: center;
  border-left-color: transparent !important;
}

.sidebar.collapsed .nav-link.active {
  background: rgba(99,179,237,0.1);
  color: #63b3ed;
}

.sidebar.collapsed .nav-text {
  opacity: 0;
  width: 0;
}

/* ── Footer ── */
.sidebar-footer {
  padding: 14px;
  border-top: 1px solid rgba(99,179,237,0.06);
  font-size: 0.78rem;
  overflow: hidden;
}

.user-area-sidebar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  white-space: nowrap;
  overflow: hidden;
}

.user-area-sidebar img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(99,179,237,0.2);
}

.user-area-sidebar span {
  color: #a8caee;
  font-weight: 600;
  font-size: 0.85rem;
}

.user-area-sidebar a {
  color: #fc8181;
  text-decoration: none;
  font-size: 0.8rem;
}

.sidebar-links-bottom {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.sidebar-links-bottom a {
  color: #4a6580;
  text-decoration: none;
  transition: color 0.2s;
}

.sidebar-links-bottom a:hover {
  color: #63b3ed;
}

.social-proof img {
  max-width: 100%;
  border-radius: 6px;
  opacity: 0.8;
}

/* hide footer text when collapsed */
.sidebar.collapsed .sidebar-footer .user-area-sidebar span,
.sidebar.collapsed .sidebar-footer .user-area-sidebar a,
.sidebar.collapsed .sidebar-links-bottom,
.sidebar.collapsed .social-proof {
  display: none;
}

.sidebar.collapsed .user-area-sidebar {
  justify-content: center;
  margin-bottom: 0;
}

/* ── Content wrapper ── */
.content-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 28px 32px;
  transition: margin-left 0.22s cubic-bezier(.4,0,.2,1);
  min-width: 0;
}

body.sidebar-collapsed .content-wrapper {
  margin-left: var(--sidebar-collapsed-width);
}

/* ── Mobile / Off-canvas sidebar ── */
@media (max-width: 860px) {
  /* hide sidebar off-screen by default, reveal with body.mobile-sidebar-open */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 84vw;
    max-width: 360px;
    height: 100vh;
    transform: translateX(-110%);
    transition: transform 0.28s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    z-index: 1200;
    background: #071229;
    overflow-y: auto;
  }

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

  /* overlay behind the sidebar when open */
  .mobile-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2,6,23,0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
    z-index: 1100;
  }

  .mobile-sidebar-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 14px;
    background: rgba(12,24,48,0.92);
    color: #e8f7ff;
    box-shadow: 0 16px 32px rgba(0,0,0,0.35);
    z-index: 1300;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    display: inline-flex;
  }

  body.mobile-sidebar-open .mobile-sidebar-toggle {
    left: calc(84vw + 18px);
  }

  body.mobile-sidebar-open .mobile-sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-nav {
    display: block;
    padding: 8px 12px;
  }

  .nav-link { padding: 10px 14px; border-left: none; border-radius: 8px; display:flex; }

  .content-wrapper { margin-left: 0 !important; padding: 16px !important; }

  /* keep footer compact but still available inside the off-canvas panel */
  .sidebar-footer { display: block; padding-bottom: 28px; }
}