/* ========================================
   Sidebar Visual Styles
   ======================================== */
.sb-sidebar {
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ========================================
   Mobile Menu Toggle (Hamburger) + Close + Backdrop
   Hidden on desktop, shown on tablet/mobile
   ======================================== */
.sb-mobile-menu-toggle,
.sb-sidebar-close,
.sb-sidebar-backdrop {
  display: none;
}

.sb-sidebar-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sb-sidebar-header-inner {
  display: block;
  line-height: 0;
}

.sb-sidebar-logo-img {
  height: 32px !important;
  width: auto;
  max-width: 100% !important;
  object-fit: contain;
  display: block;
}

/* ========================================
   Navigation Menu
   ======================================== */
.sb-menu {
  flex: 1;
  padding: 0 0 12px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Hide premium-only sidebar items for basic plan users */
body.plan-basic .sb-menu-item[data-section="jobhelp-assistent"],
body.plan-basic .sb-menu-item[data-section="ugeplan"],
body.plan-basic .sb-menu-item[data-section="grammatik"],
body.plan-basic .sb-menu-item[data-section="sprog"],
body.plan-basic .sb-menu-item[data-section="teksthjaelper"] {
  display: none !important;
}

.sb-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin: 0 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 18px;
  font-weight: 400;
  color: rgb(107, 114, 128);
  text-decoration: none;
  cursor: pointer;
  transition: 0.15s;
  line-height: 24px;
}

.sb-menu-item:hover {
  background: rgba(0, 0, 0, 0.04);
  color: rgb(55, 65, 81);
}

.sb-menu-item.active {
  background: rgb(249, 250, 251);
  border-color: rgba(0, 0, 0, 0.06);
  font-weight: 600 !important;
  color: rgb(17, 24, 39) !important;
}

.sb-menu-item.active svg {
  stroke: rgb(17, 24, 39);
}

.sb-menu-item.sb-menu-item--featured {
  background: rgba(92, 155, 158, 0.08);
  margin: 0;
  border-radius: 0;
  border: none;
  border-top: 1px solid rgba(92, 155, 158, 0.12);
  border-bottom: 1px solid rgba(92, 155, 158, 0.12);
  padding: 12px 28px;
  color: rgb(55, 65, 81);
  font-weight: 500;
}

.sb-menu-item.sb-menu-item--featured:hover {
  background: rgba(92, 155, 158, 0.14);
}

.sb-menu-item.sb-menu-item--featured svg {
  stroke: rgb(107, 114, 128);
}

.sb-menu-item.sb-menu-item--featured+.sb-menu-item {
  margin-top: 8px;
}

.sb-menu-item svg {
  flex-shrink: 0;
  stroke: rgb(107, 114, 128);
  transition: stroke 0.15s ease;
}

.sb-menu-item:hover svg {
  stroke: rgb(55, 65, 81);
}

.sb-menu-item span {
  white-space: nowrap;
}

/* ========================================
   Sidebar Footer
   ======================================== */
.sb-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ========================================
   Profile Section
   ======================================== */
#newsidebar2025-profile-btn {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  gap: 12px;
  border-radius: 8px;
  background-color: transparent;
  color: #4b5563;
  font-size: 15px;
  line-height: 1.4;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-display: swap;
  will-change: background-color;
}

#newsidebar2025-profile-btn:hover {
  background-color: #f3f4f6;
}

#newsidebar2025-profile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgb(92, 155, 158) 0%, rgb(74, 133, 136) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 500;
  font-size: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}

#newsidebar2025-profile-avatar svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

#newsidebar2025-profile-label {
  flex: 1;
  text-align: left;
}

#newsidebar2025-chevron {
  width: 16px;
  height: 16px;
  color: #9ca3af;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  will-change: transform;
}

#newsidebar2025-chevron.open {
  transform: rotate(180deg);
}

#newsidebar2025-dropdown-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: none;
}

#newsidebar2025-dropdown-backdrop.active {
  display: block;
}

#newsidebar2025-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  margin-bottom: 8px;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  z-index: 1001;
  padding: 8px;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  will-change: opacity, transform, visibility;
}

#newsidebar2025-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.newsidebar2025-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #4b5563;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-display: swap;
}

.newsidebar2025-dropdown-item:hover {
  background-color: #f3f4f6;
  color: #111827;
}

.newsidebar2025-dropdown-item svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  flex-shrink: 0;
}

.newsidebar2025-dropdown-separator {
  margin: 8px 12px;
  height: 1px;
  background: linear-gradient(to right, transparent, #e5e7eb, transparent);
}

.newsidebar2025-dropdown-item.logout {
  color: rgb(92, 155, 158);
}

.newsidebar2025-dropdown-item.logout:hover {
  background-color: rgba(92, 155, 158, 0.05);
  color: rgb(92, 155, 158);
}

.newsidebar2025-dropdown-item.logout svg {
  color: rgb(92, 155, 158);
  stroke: rgb(92, 155, 158);
  opacity: 1;
}

.sb-user-profile {
  position: relative;
  flex: 1;
  min-width: 0;
}

/* ========================================
   Language Switcher
   ======================================== */
.sb-language-switcher {
  position: relative;
  flex-shrink: 0;
}

.sb-language-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  cursor: pointer;
  transition: 0.15s;
}

.sb-language-toggle:hover {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.1);
}

.sb-language-toggle svg {
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

.sb-language-dropdown {
  position: fixed;
  top: var(--sb-language-dropdown-top, auto);
  left: var(--sb-language-dropdown-left, auto);
  margin-bottom: 0;
  padding: 8px;
  min-width: 140px;
  background: rgb(255, 255, 255);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  box-shadow: rgba(0, 0, 0, 0.12) 0px 8px 24px, rgba(0, 0, 0, 0.06) 0px 4px 12px;
  z-index: 1000;
}

.sb-language-dropdown[hidden] {
  display: none;
}

.sb-language-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  color: rgb(107, 114, 128);
  cursor: pointer;
  transition: 0.15s;
}

.sb-language-btn:last-child {
  margin-bottom: 0;
}

.sb-language-btn:hover {
  background: rgb(249, 250, 251);
  border-color: rgba(0, 0, 0, 0.06);
  color: rgb(17, 24, 39);
}

.sb-language-btn.active {
  background: rgb(249, 250, 251);
  border: 1px solid rgba(0, 0, 0, 0.06);
  font-weight: 600;
  color: rgb(17, 24, 39);
}

.sb-language-btn svg,
.sb-language-btn img {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sb-language-flag {
  flex-shrink: 0;
  border-radius: 4px;
}

/* ========================================
   Responsive — Off-canvas drawer for tablet & mobile
   Breakpoint: <=1024px (covers phones and most tablets)
   ======================================== */
@media (max-width: 1024px) {

  /* Sidebar becomes a fixed, off-canvas drawer */
  .sb-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    width: 280px;
    max-width: 85vw;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
    border-right: 1px solid #e5e7eb;
  }

  .sb-sidebar.open {
    transform: translateX(0);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
  }

  /* Hamburger toggle button — fixed top-left */
  .sb-mobile-menu-toggle {
    position: fixed;
    top: 14px;
    left: 14px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    color: #4b5563;
    cursor: pointer;
    z-index: 998;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 0;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
  }

  .sb-mobile-menu-toggle:hover,
  .sb-mobile-menu-toggle:focus-visible {
    background: #f9fafb;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    outline: none;
  }

  .sb-mobile-menu-toggle svg {
    display: block;
  }

  /* Close button inside the drawer */
  .sb-sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: background-color 0.15s ease, color 0.15s ease;
  }

  .sb-sidebar-close:hover,
  .sb-sidebar-close:focus-visible {
    background: #f3f4f6;
    color: #111827;
    outline: none;
  }

  /* Backdrop behind the open drawer */
  .sb-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.45);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  .sb-sidebar-backdrop.active {
    opacity: 1;
    visibility: visible;
  }

  /* Prevent body scroll when drawer is open */
  body.sb-drawer-open {
    overflow: hidden;
  }

  /* Language dropdown: keep it inside the drawer */
  .sb-language-dropdown {
    position: absolute;
    top: auto;
    left: auto;
    bottom: 100%;
    right: 0;
    margin-bottom: 8px;
  }
}

@media (max-width: 640px) {
  .sb-mobile-menu-toggle {
    top: 12px;
    left: 12px;
    width: 42px;
    height: 42px;
  }
}