@import "./header.css";

/* Shared by pages with and without Tailwind; keep drawer styles scoped. */
#sidebar {
  box-sizing: border-box;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  width: min(340px, calc(100vw - 32px));
  max-width: none;
  height: 100vh;
  height: 100dvh;
  padding: 0;
  overflow: hidden;
  color: #f8fafc;
  background: linear-gradient(160deg, #0b6f3e 0%, #0f766e 100%);
  border-right: 1px solid #ffffff26;
  border-radius: 0 24px 24px 0;
  box-shadow: none;
  visibility: hidden;
  transform: translateX(-100%);
  transition: transform .36s cubic-bezier(.22, 1, .36, 1), visibility 0s linear .36s;
}

#sidebar.active {
  visibility: visible;
  transition-delay: 0s;
  transform: translateX(0);
  box-shadow: 16px 0 64px #0f172a40;
}

#sidebar.is-dragging {
  visibility: visible;
  transition: none;
}

body.sidebar-open { overflow: hidden; }

#sidebarOverlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #0f172a80;
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .3s ease, visibility .3s;
}

#sidebarOverlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#sidebar .sidebar-header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(16px, env(safe-area-inset-top)) 20px 16px;
  color: inherit;
  background: #ffffff08;
  border-bottom: 1px solid #ffffff26;
}

#sidebar .sidebar-header > span { font-size: 18px; font-weight: 700; letter-spacing: -.02em; }

#sidebar .sidebar-close {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #ffffff26;
  border-radius: 14px;
  background: #ffffff14;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background .2s;
}

#sidebar .sidebar-close:hover { background: #ffffff29; }

#sidebar .sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  padding: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #ffffff59 transparent;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

#sidebar .sidebar-group { margin: 0 0 12px; padding: 0 0 12px; border-bottom: 1px solid #ffffff1f; }
#sidebar .sidebar-group:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
#sidebar .sidebar-group-title {
  margin: 0;
  padding: 10px 12px 8px;
  font-size: 11px;
  line-height: 1.5;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #ffffffb8;
  opacity: 1;
}

#sidebar .sidebar-nav ul { margin: 0; padding: 0; list-style: none; }
#sidebar .sidebar-nav li { margin: 4px 0; }
#sidebar .sidebar-nav a {
  box-sizing: border-box;
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: #f8fafc;
  background: transparent;
  text-decoration: none;
  font-size: 14px;
  line-height: 1.4;
  transition: background .2s, border-color .2s, transform .2s;
}

#sidebar .sidebar-nav a:hover { background: #ffffff14; border-color: #ffffff1f; transform: translateX(3px); }
#sidebar .sidebar-nav a[aria-current="page"] { color: #fff; background: #ffffff24; border-color: #ffffff40; box-shadow: inset 3px 0 #a7f3d0; }
#sidebar .sidebar-nav a:focus-visible,
#sidebar .sidebar-close:focus-visible { outline: 2px solid #a7f3d0; outline-offset: 2px; }

#sidebar .sidebar-nav a > .sidebar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  margin: 0;
  border-radius: 10px;
  background: #ffffff12;
  color: inherit;
  font-size: 15px;
}

#sidebar .sidebar-label { min-width: 0; flex: 1 1 auto; font-weight: 600; overflow-wrap: anywhere; }
#sidebar .sidebar-badge {
  flex: 0 0 auto;
  min-width: 22px;
  margin-left: auto;
  padding: 3px 6px;
  border-radius: 999px;
  color: #fff;
  background: #ef4444;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}
#sidebar .sidebar-badge[hidden] { display: none; }

#sidebar .sidebar-footer {
  flex: 0 0 auto;
  padding: 14px 20px max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid #ffffff26;
  background: #0000000d;
  color: #ffffffb8;
  font-size: 12px;
}
#sidebar .sidebar-version-label { font-weight: 700; margin-right: 4px; }

@media (prefers-reduced-motion: reduce) {
  #sidebar, #sidebarOverlay, #sidebar .sidebar-nav a, #sidebar .sidebar-close { transition: none; }
  #sidebar .sidebar-nav a:hover { transform: none; }
}
