@charset "utf-8";
@use "sass:math";
@use "../util";
@use "../base/choose";
@use "../base/colors";
@use "../base/icons";
@use "../base/lengths";
@use "../base/mixins";

aside {
  background-color: colors.$dark-green;
  color: colors.$nearly-white;
  width: lengths.$logo-left-distance;
  position: fixed;
  display: block;
  transition: all 0.3s ease-in-out;
  outline: none;
  font-size: 10pt;
  z-index: 100; // Needs to be behind alerts
  top: 0;
  left: 0;
  height: 100%;
  padding-top: 65px;

  > div {
    overflow-y: auto;
    overflow-x: visible;
    max-height: 100%;

    .fieldset-login {
      display: none;
    }
  }

  > * {
    opacity: 1;
  }

  &::after {
    @include mixins.icon-font;
    position: absolute;
    display: block;
    opacity: 0;
    cursor: pointer;
    right: 0;
    bottom: 0;
    // content: $fa-settings;
    // content: $fa-login;
    font-size: 16pt;
    width: 16pt;
    height: 17pt;
    padding: 6pt;
    background-color: colors.$dark-green;
    border-top-right-radius: lengths.$standard-border-radius;
    margin-right: -1 * math.div(lengths.$standard-margin, 2);
  }

  &.settings::after {
    content: icons.$fa-settings;
  }

  h2,
  legend {
    line-height: 2em;
    text-align: center;
    padding: 0;
    margin: 0;
    font: {
      size: 100%;
      weight: bold;
    }
  }

  /**
   * Navigation menu
   */
  ul.nav {
    list-style-type: none;
    margin: 0;
    font-size: 10pt;
    text-indent: 0;
    padding: 0;

    li {
      padding: 0;
      > a {
        padding: lengths.$item-padding;
        &:visited {
          @include choose.choose-item;
        }
      }

      &.folded {
        &.active > ul {
          display: block;
        }
        > ul {
          display: none;
          &.active {
            display: block !important;
          }
        }
      }

      &.active > a:link {
        @include choose.choose-active;
      }

      > a:link {
        @include choose.choose-item;
        display: block;

        border-right: {
          width: lengths.$border-size;
          style: solid;
        }

        &:hover {
          @include choose.choose-hover;
          transition: none;
        }
      }

      h3 {
        padding: 0;
        margin: 0;
        font: {
          weight: bold;
          size: 100%;
        }
      }

      > a {
        padding-left: 6pt;
      }

      li > a {
        padding-left: 18pt;
      }

      li li > a {
        padding-left: 36pt;
      }
    }
  }

  nav > ul > li > a {
    font-weight: bold;
  }

  fieldset {
    position: relative;
    border-width: 0;

    legend {
      display: none;
    }

    input[type="text"],
    input[type="password"] {
      @include mixins.input-field;
      width: 100%;
    }

    .login {
      display: none;
    }

    // search form
    > form > div {
      position: relative;
      width: 100%;
      margin-top: 4px;
      padding-right: lengths.$button-width;
    }

    > p {
      color: colors.$light-green;
    }

    > p.announcement {
      color: colors.$nearly-white;
      > time {
        display: block;
        font-size: 70%;
      }
    }

    hr {
      border: none;
      border-top: 2px solid colors.$ids-grey-2;
    }

    ul {
      display: block;
      font-size: 80%;
      text-align: right;
      padding: 0;
      margin-top: 0;

      > li {
        display: inline;
        &:first-child::after {
          content: " | ";
        }
      }
    }

    button {
      position: absolute;
      top: 0;
      right: 0;
      &::after {
        content: icons.$fa-login;
      }
    }
  }

  // Off aside
  &.off,
  &:not(:focus):not(.active) {
    margin-left: -1 * (lengths.$logo-left-distance - math.div(lengths.$standard-margin, 2));
    &::after {
      opacity: 1;
    }

    > * {
      opacity: 0;
      transition: {
        property: opacity;
        duration: 0.3s;
      }
    }
  }

  &.off::after {
    display: none;
  }

  &.invisible {
    display: none;
  }
}
