body.no-animation {
  #sidebar {
    border-right: solid 1px rgba(0, 0, 0, 0.2);
  }
}

.page-replacement~#sidebar {
  opacity: 0;
}

#sidebar {
  z-index: 109;
  position: fixed;
  left: 0;
  top: 0;
  width: 70vw;
  max-width: 350px;
  height: 100vh;
  display: flex;
  background-color: rgb(153, 153, 255);
  background-color: var(--primary-color);
  color: rgb(255, 255, 255);
  color: var(--primary-text-color);
  overflow: hidden;
  box-sizing: border-box;

  &+.mask {
    z-index: 108;
  }

  &.phone {
    transition: transform 300ms ease;
    transform: translate(-100%, 0);
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.07);

    .resize-bar {
      pointer-events: none;
    }
  }

  &.tab {
    max-width: 250px;
  }

  &.show {
    transform: translate(0, 0);
    animation: show-sidebar 300ms ease 1;
  }

  .resize-bar {
    height: 100vh;
    width: 5px;
    margin-left: -2.5px;
    z-index: 110;
  }

  .apps {
    width: 45px;
    min-width: 45px;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 10px 0;
    display: flex;
    flex-direction: column;
    position: relative;

    .app-icons-container {
      flex: 1;
      overflow-y: auto;
      padding: 10px 0;
    }

    .user-icon-container {
      position: sticky;
      bottom: 0;
      width: 100%;
      padding: 10px 0;
      display: flex;
      justify-content: center;
      border-top: 1px solid var(--border-color);

      .avatar {
        display: block;
        height: 35px;
        width: 35px;
        border-radius: 50%;
        object-fit: cover;
        object-position: center;
      }

      .icon {
        height: 40px;
        width: 40px;
        color: currentColor;
        font-size: 1.6em;
        border-radius: 12px;
        opacity: 0.5;
        transition: all 0.2s ease;
        margin: 0 auto;
        cursor: pointer;

        &.active {
          opacity: 1;
        }
      }
    }

    .icon {
      height: 35px;
      width: 35px;
      color: currentColor;
      font-size: 1em;
      border-radius: 12px;
      opacity: 0.5;
      transition: all 0.2s ease;
      margin: 0 auto;

      &.active {
        opacity: 1;
      }
    }
  }

  .container {
    overflow: hidden;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;

    &.files {
      overflow-x: auto;
    }

    >.list {
      width: 100%;
      max-width: 100%;
      max-height: 100%;

      &.hidden {
        max-height: 30px !important;
        min-height: 30px !important;
        overflow: hidden !important;
      }

      .tile {
        &:not(:first-child) {
          background-color: inherit;
        }

        &.notice {
          &::before {
            content: "\2022";
            color: rgb(212, 250, 150);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1em;
          }
        }
      }

      .icon {
        height: 30px;
        width: 30px;
        color: currentColor;
        font-size: 1em;
      }

      >ul {
        overflow: auto;
        width: 100%;
        max-width: 100%;
        max-height: calc(100% - 30px);
        height: calc(100% - 30px);

        .tile:active {
          >*:nth-child(2) {
            color: rgb(255, 215, 0);
          }
        }

        li {
          >*:nth-child(2) {
            color: currentColor;
          }

          &.active {
            >*:nth-child(2) {
              color: rgb(255, 215, 0);
            }
          }
        }
      }
    }

    .tile {
      user-select: none;
    }
  }

  textarea {
    padding: 5px !important;
    box-sizing: border-box;
  }

  textarea,
  input {
    color: rgb(255, 255, 255);
    color: var(--primary-text-color);
    border: solid 1px color-mix(in srgb, var(--border-color) 70%, transparent);
    border-radius: 8px;
    height: 30px;
    width: 90%;
    padding: 0 12px;
    text-indent: 0;
    margin-bottom: 12px;
    background: transparent;
    transition: all 0.2s ease;

    &:focus {
      border-color: var(--border-color) !important;
      background: color-mix(in srgb, var(--secondary-color) 10%, transparent);
      box-shadow: 0 0 0 2px var(---box-shadow-color);
    }

    &::placeholder {
      opacity: 0.5;
    }
  }

  .box {
    border: solid 1px rgb(255, 255, 255);
    border: solid 1px var(--primary-text-color);

    &::after {
      background-color: rgb(255, 255, 255);
      background-color: var(--primary-text-color);
    }
  }

  .header {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    flex-direction: column;

    .title {
      display: flex;
      width: 100%;
      height: 30px;
      align-items: center;
      justify-content: center;
      font-weight: 600;
    }
  }
}

.user-menu {
  position: absolute;
  bottom: 55px;
  left: 30px;
  width: 200px;
  background-color: var(--popup-background-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  display: none;
  z-index: 1000;
  overflow: hidden;

  &.active {
    display: block;
  }

  .user-menu-header {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);

    .user-menu-name {
      font-weight: 500;
      margin-bottom: 4px;

      .badge {
        display: inline-flex;
        align-items: center;
        background-color: color-mix(in srgb,
            var(--error-text-color) 20%,
            transparent);
        color: var(--error-text-color);
        padding: 2px 6px;
        border-radius: 4px;
        font-size: 12px;
        font-weight: 500;
        margin-left: 8px;
      }
    }

    .user-menu-email {
      font-size: 12px;
      color: color-mix(in srgb, var(--popup-text-color) 70%, transparent);
    }
  }

  .user-menu-item {
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;

    &:hover {
      background-color: var(--active-icon-color);
    }
  }

  .user-menu-separator {
    height: 1px;
    background-color: var(--border-color);
    margin: 4px 0;
  }
}
