:root {
  --sidebar-desktop-width: 42rem;
  --sidebar-tab-width: 36rem;
  --sidebar-mob-width: 30rem;
}

/* =====================================================
   Sidebar - Desktop (groesser als 1300px)
   position: sticky damit Toggle kein JS-Scroll braucht
   ===================================================== */

#sidebar {
  flex-grow: 0;
  flex-shrink: 0;
  transition: margin-right 0.5s ease, box-shadow 0.5s ease;
  background-color: #f5f5f5;
  box-shadow: -3px 0 3px -2px #0099ff;
  font-size: 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
  width: var(--sidebar-desktop-width);
}

#sidebar.inactive {
  box-shadow: none;
  margin-right: calc(-1 * var(--sidebar-desktop-width));
}

#sidebar h2 {
  font-size: 2.2rem;
}

/* =====================================================
   Sidebody - scrollbarer Inhaltsbereich
   ===================================================== */

#sidebar .sidebody {
  padding: 3.2rem;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Nur direkte Kinder von .sidebody bekommen Border */
#sidebar .sidebody > * {
  border-bottom: solid 2px rgba(210, 215, 217, 0.75);
  margin: 0 0 3rem 0;
  padding: 0 0 3rem 0;
}

#sidebar .sidebody > * > :last-child {
  margin-bottom: 0;
}

#sidebar .sidebody > *:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

/* =====================================================
   Toggle-Button
   ===================================================== */

#sidebar .toggle {
  text-decoration: none;
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0);
  border: 0;
  display: block;
  height: 11rem;
  left: -9rem;
  line-height: 11rem;
  outline: 0;
  overflow: hidden;
  position: absolute;
  text-align: center;
  white-space: nowrap;
  top: 0;
  width: 9rem;
  z-index: 10000;
}

#sidebar .toggle:before {
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  display: inline-block;
  font-style: normal;
  font-variant: normal;
  text-rendering: auto;
  line-height: 1;
  font-family: 'Font Awesome 7 Free';
  text-transform: none !important;
  font-weight: 900;
  content: '\f0c9';
  font-size: 3rem;
  height: inherit;
  left: 0;
  line-height: inherit;
  position: absolute;
  text-indent: 0;
  top: 0;
  width: inherit;
  z-index: 1;
}

#sidebar .toggle:after {
  background: rgba(245, 245, 245, 0.85);
  border-radius: 0.5rem;
  content: '';
  height: 5rem;
  width: 5rem;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 0;
}

/* =====================================================
   Menu Accordion
   ===================================================== */

#menu ul {
  color: #3d4449;
  font-weight: 400;
  letter-spacing: 0.15rem;
  list-style: none;
  margin-bottom: 0;
  padding: 0;
  text-transform: uppercase;
  -webkit-user-select: none;
  user-select: none;
}

#menu ul a,
#menu ul span {
  border-bottom: 0;
  color: #0094ff;
  cursor: pointer;
  display: block;
  font-size: 1.5rem;
  padding: 0.5em 0;
}

#menu ul a:hover,
#menu ul span:hover {
  color: #40fe2a;
}

#menu ul a.opener,
#menu ul span.opener {
  transition: color 0.2s ease-in-out;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

#menu ul a.opener:before,
#menu ul span.opener:before {
  display: inline-block;
  font-style: normal;
  font-variant: normal;
  text-rendering: auto;
  line-height: 1;
  text-transform: none !important;
  font-weight: 900;
  transition: color 0.2s ease-in-out, transform 0.2s ease-in-out;
  color: #0094ff;
  font-family: 'Font Awesome 7 Free';
  content: '\f107';
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  position: absolute;
  right: 0;
}

#menu ul a.opener:hover:before,
#menu ul span.opener:hover:before {
  color: #40fe2a;
}

#menu ul a.opener.active + ul,
#menu ul span.opener.active + ul {
  display: block;
}

#menu ul a.opener.active:before,
#menu ul span.opener.active:before {
  transform: rotate(-180deg);
}

#menu > ul > li {
  border-top: solid 1px rgba(210, 215, 217, 0.75);
  margin: 0.8rem 0 0 0;
  padding: 0.8rem 0 0 0;
}

#menu > ul > li > ul {
  color: #9fa3a6;
  display: none;
  margin: 0.8rem 0 2rem 0;
  padding-left: 1.5rem;
}

#menu > ul > li > ul a,
#menu > ul > li > ul span {
  font-size: 1.4rem;
}

#menu > ul > li > ul > li {
  margin: 0.2rem 0 0 0;
  padding: 0.2rem 0 0 0;
}

#menu > ul > li:first-child {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

/* =====================================================
   Media Queries
   ===================================================== */

/* Tablet: bis 1300px - Sidebar wird fixed overlay */
@media screen and (max-width: 1300px) {
  #sidebar {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: var(--sidebar-tab-width);
    box-shadow: -3px 0 3px -2px #0099ff;
    z-index: 10000;
  }

  #sidebar.inactive {
    box-shadow: none;
    margin-right: calc(-1 * var(--sidebar-tab-width));
  }

  #sidebar .sidebody {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  #sidebar .sidebody:after {
    content: '';
    display: block;
    height: 4em;
    width: 100%;
  }

  #sidebar .toggle {
    width: 8.6rem;
  }

  #sidebar .toggle:before {
    font-size: 2rem;
    margin-right: -0.8rem;
  }
}

/* Mobil: bis 730px */
@media screen and (max-width: 736px) {
  #sidebar {
    width: var(--sidebar-mob-width);
  }

  #sidebar.inactive {
    margin-right: calc(-1 * var(--sidebar-mob-width));
  }

  #sidebar .toggle {
    width: 11rem;
  }

  #sidebar .toggle:before {
    margin-right: -0.1rem;
    margin-top: -0.36rem;
    z-index: 1;
  }
}
