/* ========================================
   App Layout
======================================== */

#site-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;

  width: 260px;
  height: 100vh;
}

/* ========================================
   Site Sidebar
======================================== */

.site-sidebar {
  display: flex;
  flex-direction: column;

  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 1.25rem 0.875rem;

  background-color: #ffffff;
  border-right: 1px solid #e5e7eb;

  overflow: hidden;
}

/* ========================================
   Brand
======================================== */

.site-sidebar__brand {
  display: block;
  flex-shrink: 0;

  padding: 0.5rem 0.875rem 1.5rem;

  color: var(--primary-color, #009dc5);
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
}

/* ========================================
   Navigation
======================================== */

.site-sidebar__navigation {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.375rem;

  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;

  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

/* ========================================
   Navigation Links
======================================== */

.site-sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.875rem;

  flex-shrink: 0;
  width: 100%;
  min-height: 42px;
  padding: 0.625rem 0.875rem;

  color: var(--color-text, #374151);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;

  border-radius: 0.625rem;

  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

.site-sidebar__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  flex-shrink: 0;
  width: 1.5rem;

  font-size: 1.125rem;
  line-height: 1;
}

.site-sidebar__link:hover {
  background-color: #f3f4f6;
}

.site-sidebar__link--active {
  color: #2563eb;
  background-color: #e8f1ff;
  font-weight: 600;
}

.site-sidebar__link--active:hover {
  background-color: #dbeafe;
}

.site-sidebar__link:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* ========================================
   Sidebar Footer
======================================== */

.site-sidebar__footer {
  flex-shrink: 0;

  margin-top: 1rem;
  padding-top: 1rem;

  border-top: 1px solid #e5e7eb;
}

/* ========================================
   Statistics Button
======================================== */

.site-sidebar__statistics {
  display: flex;
  align-items: center;
  gap: 0.875rem;

  width: 100%;
  min-height: 44px;
  padding: 0.75rem 0.875rem;

  color: var(--color-text, #374151);
  background: transparent;
  border: none;
  border-radius: 0.625rem;

  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  text-align: left;

  cursor: pointer;

  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

.site-sidebar__statistics:hover {
  background-color: #f3f4f6;
}

.site-sidebar__statistics:focus-visible {
  outline: 2px solid var(--primary-color, #009dc5);
  outline-offset: 2px;
}

/* ========================================
   Mobile Toggle Button
======================================== */

.site-sidebar__toggle {
  display: none;
}

.site-sidebar__toggle span {
  display: block;

  width: 20px;
  height: 2px;

  background-color: var(--text-color-of-background, #374151);
  border-radius: 2px;

  transition:
    transform 0.25s ease,
    opacity 0.2s ease;
}

/* Hamburger wird zu X */

.site-sidebar__toggle--active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.site-sidebar__toggle--active span:nth-child(2) {
  opacity: 0;
}

.site-sidebar__toggle--active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ========================================
   Mobile Overlay
======================================== */

.site-sidebar__overlay {
  display: none;
}

/* ========================================
   Main Content Offset
======================================== */

body {
  padding-left: 260px;
}

/* ========================================
   Main Content Layout
======================================== */

body > .container {
  width: 100%;
  max-width: 1440px;
  margin-inline: auto;
}

/* ========================================
   Mobile Sidebar
======================================== */

@media (max-width: 768px) {
  /* Main Content */

  body {
    padding-left: 0;
  }

  /* Sidebar */

  #site-sidebar {
    width: 260px;
    max-width: 85vw;
    height: 100vh;
    height: 100dvh;
    z-index: 1000;

    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  #site-sidebar.site-sidebar--open {
    transform: translateX(0);
  }

  .site-sidebar {
    padding: 1rem 0.75rem;
    box-shadow: none;
  }

  /* Brand */

  .site-sidebar__brand {
    padding: 0.5rem 0.75rem 1.25rem 3.5rem;
  }

  /* Navigation */

  .site-sidebar__link,
  .site-sidebar__statistics {
    gap: 0.625rem;
    padding: 0.75rem;
    font-size: 0.875rem;
  }

  /* Hamburger Button */

  .site-sidebar__toggle {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1002;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;

    width: 42px;
    height: 42px;
    padding: 0;

    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;

    box-shadow: 0 4px 12px rgb(16 24 40 / 10%);
    cursor: pointer;
  }

  .site-sidebar__toggle:hover {
    background-color: #f0f9fc;
  }

  .site-sidebar__toggle:focus-visible {
    outline: 2px solid var(--primary-color, #009dc5);
    outline-offset: 3px;
  }

  /* Overlay */

  .site-sidebar__overlay {
    position: fixed;
    inset: 0;
    z-index: 999;

    display: block;
    background: rgb(15 23 42 / 40%);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transition:
      opacity 0.3s ease,
      visibility 0.3s ease;
  }

  .site-sidebar__overlay--visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
}
