@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=Syne:wght@600;700;800&display=swap');

/* ════════════════════════════════════════════════════════════════════
   THEME TOKENS — tweak these to retune the whole sidebar at once
   ════════════════════════════════════════════════════════════════════ */
:root {
  --sb-accent:        #c4b5fd;            /* lavender — text glows, dots   */
  --sb-accent-strong: #a78bfa;            /* stronger violet — active ring */
  --sb-accent-glow:   rgba(167,139,250,0.45);
  --sb-glass:         rgba(255,255,255,0.06);
  --sb-glass-hover:   rgba(255,255,255,0.10);
  --sb-glass-active:  rgba(255,255,255,0.13);
  --sb-border:        rgba(255,255,255,0.08);
  --sb-ease:          cubic-bezier(0.16, 1, 0.3, 1);
}

/* ════════════════════════════════════════════════════════════════════
   SIDEBAR SHELL — deep royal purple with a top glow for depth
   ════════════════════════════════════════════════════════════════════ */
.sidebar {
  width: 264px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(130% 80% at 50% -12%, #4a1486 0%, transparent 58%),
    radial-gradient(90% 60% at 110% 108%, rgba(167,139,250,0.16) 0%, transparent 60%),
    linear-gradient(180deg, #240a48 0%, #180634 52%, #0d0220 100%);
  color: #ffffff;
  position: sticky;
  top: 0;
  font-family: 'DM Sans', sans-serif;
  box-shadow:
    inset -1px 0 0 rgba(255,255,255,0.04),
    6px 0 40px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  border-right: 1px solid var(--sb-border);
}

/* subtle vertical sheen overlay for a glassy, lit feel */
.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(255,255,255,0.05) 0%, transparent 22%);
  pointer-events: none;
}

/* ── Logo ── */
.logo {
  display: flex;
  align-items: center;
  gap: 0;
  border-bottom: 1px solid var(--sb-border);
  background: transparent;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  padding: 0;
  width: 100%;
}

.logoImgWrap {
  width: 100%;
  height: 64px;                                     /* 👈 THIS ONE — match navbar */
  margin: 0;
  overflow: hidden;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  flex-shrink: 0;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  box-sizing: border-box;
}

.logoImg {
  max-width: 100%;
  max-height: 100%;
  width: 100%;               /* 👈 CHANGED: was 'auto' — now fills width */
  height: 100%;              /* 👈 CHANGED: was 'auto' — now fills height */
  object-fit: contain;
  display: block;
}

.logoFallback {
  font-family: 'Syne', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
}

.logoText {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.logoTitle {
  font-family: 'Syne', sans-serif;
  font-size: 0.84rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  letter-spacing: 0.3px;
}

.logoSub {
  font-size: 0.68rem;
  font-weight: 400;
  color: rgba(255,255,255,0.6);
  line-height: 1.4;
}

/* ── Section label ── */
.sectionLabel {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.30);
  padding: 14px 14px 4px;
  font-family: 'Syne', sans-serif;
}

/* ── Scrollable nav ── */
.nav {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
  z-index: 1;
}

.nav::-webkit-scrollbar        { width: 4px; }
.nav::-webkit-scrollbar-track  { background: transparent; }
.nav::-webkit-scrollbar-thumb  { background: rgba(255,255,255,0.14); border-radius: 4px; }

/* ── Parent link ── */
.link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  font-size: 0.92rem;
  font-weight: 600;
  color: rgba(255,255,255,0.86);
  cursor: pointer;
  border-radius: 11px;
  transition: background 0.2s var(--sb-ease), color 0.2s var(--sb-ease),
              transform 0.18s var(--sb-ease), box-shadow 0.2s var(--sb-ease);
  border: 1px solid transparent;
  letter-spacing: 0.2px;
  user-select: none;
  width: 100%;
  background: transparent;
  font-family: inherit;
  text-align: left;
  position: relative;
}

.linkInner {
  display: flex;
  align-items: center;
  gap: 11px;
}

.iconWrap {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--sb-glass);
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s var(--sb-ease), box-shadow 0.2s var(--sb-ease),
              border-color 0.2s var(--sb-ease);
}

.link:hover .iconWrap {
  background: var(--sb-glass-hover);
  border-color: rgba(255,255,255,0.12);
}

.arrow {
  transition: transform 0.28s var(--sb-ease);
  opacity: 0.45;
  flex-shrink: 0;
}

.arrowOpen {
  transform: rotate(90deg);
  opacity: 0.9;
}

.link:hover {
  background: var(--sb-glass);
  color: #fff;
  border-color: rgba(255,255,255,0.08);
  transform: translateX(3px);
}

/* active parent — glass fill + glowing inset accent bar (radius-safe) */
.linkActive {
  background: linear-gradient(100deg, rgba(167,139,250,0.20) 0%, var(--sb-glass-active) 70%);
  color: #fff;
  border-color: rgba(167,139,250,0.28);
  font-weight: 600;
  box-shadow:
    inset 3px 0 0 var(--sb-accent-strong),
    0 4px 16px rgba(74, 0, 128, 0.30);
}

.linkActive .iconWrap {
  background: rgba(167,139,250,0.28);
  border-color: rgba(167,139,250,0.4);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.15),
    0 0 12px var(--sb-accent-glow);
}

/* ── Submenu ── */
.submenu {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.34s cubic-bezier(.2,.9,.2,1);
}

.submenuOpen {
  max-height: 600px;
}

.subList {
  padding: 4px 0 4px 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-left: 16px;
  border-left: 1px solid rgba(167,139,250,0.28);
}

.subLink {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 0.86rem;
  font-weight: 500;
  color: rgba(255,255,255,0.78);
  border-radius: 8px;
  transition: background 0.16s var(--sb-ease), color 0.16s var(--sb-ease),
              transform 0.16s var(--sb-ease);
  cursor: pointer;
  position: relative;
  letter-spacing: 0.15px;
}

.subDot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  flex-shrink: 0;
  transition: background 0.16s var(--sb-ease), box-shadow 0.16s var(--sb-ease);
}

.subLink:hover {
  background: var(--sb-glass);
  color: #fff;
  transform: translateX(3px);
}

.subLink:hover .subDot {
  background: var(--sb-accent);
}

.subLinkActive {
  background: rgba(167,139,250,0.16);
  color: #f3e8ff;
  font-weight: 600;
  letter-spacing: 0.15px;
  box-shadow: inset 2px 0 0 var(--sb-accent-strong);
}

.subLinkActive .subDot {
  background: var(--sb-accent);
  box-shadow: 0 0 7px var(--sb-accent-glow);
}

/* ── Badge ── */
.badge {
  font-size: 0.6rem;
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  color: #fff;
  padding: 1px 6px;
  border-radius: 20px;
  font-weight: 700;
  margin-left: auto;
  letter-spacing: 0.2px;
  box-shadow: 0 2px 6px rgba(225, 29, 72, 0.4);
}

/* ── Footer ── */
.footer {
  padding: 14px 16px;
  border-top: 1px solid var(--sb-border);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(10, 2, 24, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sb-accent-strong), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(167,139,250,0.40), 0 4px 12px rgba(124, 58, 237, 0.35);
}

.footerText {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.footerName {
  font-size: 0.84rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.footerRole {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.58);
}

.logoutBtn {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.4);
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
}

.logoutBtn:hover { color: #fff; background: rgba(255,255,255,0.08); }

/* ════════════════════════════
   ANIMATIONS
════════════════════════════ */

/* ── Sidebar entrance ── */
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-24px); }
  to   { opacity: 1; transform: translateX(0); }
}

.sidebar {
  animation: slideInLeft 0.45s var(--sb-ease) both;
}

/* ── Logo fade down ── */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.logo {
  animation: fadeDown 0.45s var(--sb-ease) 0.1s both;
}

/* ── Nav items stagger in ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.nav > div:nth-child(1)  { animation: fadeInUp 0.35s ease 0.15s both; }
.nav > div:nth-child(2)  { animation: fadeInUp 0.35s ease 0.20s both; }
.nav > div:nth-child(3)  { animation: fadeInUp 0.35s ease 0.25s both; }
.nav > div:nth-child(4)  { animation: fadeInUp 0.35s ease 0.30s both; }
.nav > div:nth-child(5)  { animation: fadeInUp 0.35s ease 0.35s both; }
.nav > div:nth-child(6)  { animation: fadeInUp 0.35s ease 0.40s both; }
.nav > div:nth-child(7)  { animation: fadeInUp 0.35s ease 0.45s both; }
.nav > div:nth-child(8)  { animation: fadeInUp 0.35s ease 0.50s both; }

/* ── Footer fade up ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.footer {
  animation: fadeUp 0.4s var(--sb-ease) 0.55s both;
}

/* ── Icon wrap pulse on hover ── */
@keyframes iconPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.link:hover .iconWrap {
  animation: iconPop 0.3s ease;
}

/* ── Active link glow pulse ── */
@keyframes glowPulse {
  0%   { box-shadow: inset 3px 0 0 var(--sb-accent-strong), 0 0 0px var(--sb-accent-glow); }
  50%  { box-shadow: inset 3px 0 0 var(--sb-accent-strong), 0 0 18px var(--sb-accent-glow); }
  100% { box-shadow: inset 3px 0 0 var(--sb-accent-strong), 0 0 0px var(--sb-accent-glow); }
}

.linkActive {
  animation: glowPulse 2.8s ease-in-out infinite;
}

/* ── Active sub dot heartbeat ── */
@keyframes dotPulse {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%       { transform: scale(1.5); opacity: 0.7; }
}

.subLinkActive .subDot {
  animation: dotPulse 2s ease-in-out infinite;
}

/* ── Submenu items slide in when opening ── */
@keyframes subSlideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

.submenuOpen .subLink:nth-child(1) { animation: subSlideIn 0.2s ease 0.05s both; }
.submenuOpen .subLink:nth-child(2) { animation: subSlideIn 0.2s ease 0.10s both; }
.submenuOpen .subLink:nth-child(3) { animation: subSlideIn 0.2s ease 0.15s both; }
.submenuOpen .subLink:nth-child(4) { animation: subSlideIn 0.2s ease 0.20s both; }
.submenuOpen .subLink:nth-child(5) { animation: subSlideIn 0.2s ease 0.25s both; }

/* ── Avatar ring grow on hover ── */
@keyframes ringRotate {
  from { box-shadow: 0 0 0 2px rgba(167,139,250,0.40), 0 4px 12px rgba(124,58,237,0.35); }
  to   { box-shadow: 0 0 0 3px rgba(167,139,250,0.85), 0 6px 16px rgba(124,58,237,0.5); }
}

.footer:hover .avatar {
  animation: ringRotate 0.3s ease forwards;
}

/* ── Logout button tilt on hover ── */
@keyframes spinOnce {
  from { transform: rotate(0deg); }
  to   { transform: rotate(-20deg); }
}

.logoutBtn:hover {
  animation: spinOnce 0.25s ease forwards;
  color: #fff;
}

/* ── Scrollbar thumb fade in ── */
.nav::-webkit-scrollbar-thumb {
  transition: background 0.3s ease;
}

.nav:hover::-webkit-scrollbar-thumb {
  background: var(--sb-accent-glow);
}

/* ════════════════════════════════════════════════════════════════════
   MOBILE RESPONSIVENESS
   ════════════════════════════════════════════════════════════════════ */

/* ── Hamburger toggle button (mobile only) ── */
.menuToggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 1100;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(135deg, #9b1de9 0%, #7904c2 100%);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.20),
    0 4px 18px rgba(123, 4, 194, 0.40), 0 1px 3px rgba(0,0,0,0.15);
  transition: transform 0.2s var(--sb-ease), box-shadow 0.2s var(--sb-ease);
}

.menuToggle:hover {
  transform: scale(1.05);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.25),
    0 6px 24px rgba(123, 4, 194, 0.50);
}

.menuToggle:active {
  transform: scale(0.95);
}

.menuToggle svg {
  width: 22px;
  height: 22px;
}

/* ── Hamburger lines (animated to X when open) ── */
.menuLine {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  margin: 2.5px 0;
  transition: transform 0.3s ease, opacity 0.2s ease;
}

.menuToggleOpen .menuLine:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.menuToggleOpen .menuLine:nth-child(2) {
  opacity: 0;
}
.menuToggleOpen .menuLine:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── Backdrop overlay ── */
.backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13, 2, 32, 0.60);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 1090;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.backdropOpen {
  opacity: 1;
  pointer-events: auto;
}

/* ── Mobile breakpoint (≤ 1024px = tablet & phone) ── */
@media (max-width: 1024px) {
  .menuToggle {
    display: flex;
  }

  .backdrop {
    display: block;
  }

  .sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    z-index: 1095;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 8px 0 48px rgba(0, 0, 0, 0.5);
    animation: none !important;
  }

  .sidebarOpen {
    transform: translateX(0) !important;
  }

  .link:hover,
  .subLink:hover {
    transform: none;
  }
}

/* ── Phone breakpoint (≤ 480px) — narrower drawer ── */
@media (max-width: 480px) {
  .sidebar {
    width: 86vw;
    max-width: 300px;
  }

  .logoImgWrap {
    width: 100%;
  }

  .menuToggle {
    top: 10px;
    left: 10px;
    width: 42px;
    height: 42px;
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .sidebar, .logo, .footer,
  .nav > div,
  .linkActive,
  .subLinkActive .subDot,
  .submenuOpen .subLink { animation: none !important; }
  .link:hover, .subLink:hover { transform: none !important; }
}

/* ── Body scroll lock when drawer is open (applied via JS) ── */
:global(body.qrs-no-scroll) {
  overflow: hidden;
}