:root {
  --sidebar-bg-color: #101828;
  --sidebar-border-color: #1d2939;
  --topbar-bg-color: #f2f4f7;
  --skeleton-bg-color: #344054;
  --skeleton-light-bg-color: #e4e7ec;
  --search-bg-color: #ffffff;
}

.initial-loading-screen {
  /* Display is set once indexedDB values are fetched to prevent UI flicker */
  display: none;
  grid-template-columns: 200px 1fr;
  height: 100vh;
  box-sizing: border-box;
  overflow: hidden;

  & * {
    box-sizing: border-box;
  }

  &.collapsed {
    grid-template-columns: 48px 1fr;

    .global-sidebar {
      section {
        .nav-header {
          > div:first-child {
            img {
              display: none;
            }
          }

          > div:nth-child(2) {
            > .skeleton.text {
              display: none;
            }

            > .skeleton:last-child {
              display: none;
            }
          }
        }

        .nav-items {
          li {
            padding-left: 0;
            padding-right: 0;
            justify-content: center;

            .skeleton.circle {
              margin-right: 0;
            }

            .skeleton:last-child {
              display: none;
            }
          }
        }
      }

      .nav-footer {
        .github {
          border-top: 1px solid var(--sidebar-border-color);
          padding: 12px 0 0 0;
          flex-direction: column;
          gap: 8px;

          img:first-child {
            display: none;
          }

          img:nth-child(2) {
            display: block;
          }

          div {
            img {
              display: none;
            }

            .skeleton.text {
              width: 31px;
              height: 20px;
            }
          }
        }

        .accounts {
          border-top: 0px;
          padding: 0 0 12px 0;
          flex-direction: column-reverse;
          height: auto;

          div:last-child {
            flex-direction: column;
            padding: 8px 0;
          }
        }
      }
    }
  }

  .global-sidebar {
    display: flex;
    flex-direction: column;
    background-color: var(--sidebar-bg-color);
    border-right: 1px solid var(--sidebar-border-color);
    justify-content: space-between;

    section {
      .nav-header {
        height: 96px;
        padding: 6px 0;

        > div:first-child {
          height: 36px;
          display: flex;
          justify-content: space-between;
          align-items: center;
          padding: 0 12px 0 16px;

          .skeleton {
            width: 16px;
            height: 16px;
          }

          img {
            width: 20px;
            height: 20px;
          }
        }

        > div:nth-child(2) {
          height: 48px;
          display: flex;
          align-items: center;

          .skeleton.circle {
            width: 32px;
            height: 32px;
            margin-left: 8px;
          }

          > .skeleton.text {
            width: 112px;
            height: 12px;
            margin-left: 8px;
            margin-right: 16px;
          }

          > .skeleton:last-child {
            width: 12px;
            height: 12px;
          }
        }
      }

      .nav-items {
        li {
          height: 36px;
          display: flex;
          align-items: center;
          padding-left: 12px;
          padding-right: 24px;

          .skeleton.circle {
            width: 24px;
            height: 24px;
            margin-right: 8px;
          }

          .skeleton:last-child {
            width: 132px;
            height: 12px;
          }
        }
      }
    }

    .nav-footer {
      .github {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 12px 12px 12px;
        border-top: 0px;

        > img:first-child {
          height: 24px;
          width: 84px;
        }

        img:nth-child(2) {
          display: none;
          width: 20px;
          height: 20px;
        }

        div {
          display: flex;
          gap: 4px;
          align-items: center;

          img {
            width: 12px;
            height: 12px;
          }

          .skeleton.text {
            width: 59px;
            height: 10px;
          }
        }
      }

      .accounts {
        border-top: 1px solid var(--sidebar-border-color);
        height: 53px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0 12px;

        .skeleton.circle {
          width: 32px;
          height: 32px;
        }

        div:last-child {
          display: flex;
          align-items: center;
          justify-content: center;
          gap: 8px;

          .skeleton.text {
            width: 32px;
            height: 26px;
          }
        }
      }
    }
  }

  .subapp {
    display: grid;
    grid-template-columns: 220px 1fr;
    grid-template-rows: 40px 1fr;
    grid-template-areas:
      "topbar topbar"
      "sidebar quote";

    .subapp-sidebar {
      display: flex;
      flex-direction: column;
      background-color: var(--sidebar-bg-color);
      grid-area: sidebar;
      gap: 12px;
      padding: 12px;

      .app-title {
        display: flex;
        align-items: center;
        height: 24px;
        justify-content: space-between;

        .skeleton.text {
          height: 14px;
          width: 130px;
        }

        .skeleton {
          width: 16px;
          height: 16px;
        }
      }

      .app-search {
        width: 100%;
        height: 36px;
      }

      .app-sub-menu {
        display: flex;
        gap: 8px;
        justify-content: space-between;
        align-items: center;
        height: 24px;
        margin: 6px 4px 6px 0;

        .skeleton.circle {
          width: 24px;
          height: 24px;
          flex-shrink: 0;
        }

        .skeleton.text {
          width: 100%;
          height: 14px;
        }
      }

      .nav-tree-title {
        height: 20px;
        width: 80px;
        display: flex;
        align-items: center;

        .skeleton.text {
          height: 12px;
        }
      }

      .nav-tree {
        display: flex;
        flex-direction: column;

        .nav-tree-item {
          display: flex;
          gap: 8px;
          align-items: center;
          justify-content: space-between;
          height: 24px;
          margin-right: 24px;

          .skeleton.circle {
            width: 16px;
            height: 16px;
            flex-shrink: 0;
          }

          .skeleton.text {
            height: 12px;
          }
        }
      }
    }

    .global-topbar {
      grid-area: topbar;
      background-color: var(--topbar-bg-color);
      display: flex;
      justify-content: space-between;

      .left {
        display: flex;
        gap: 1px;

        .search {
          display: flex;
          background-color: var(--search-bg-color);
          width: 288px;
          height: 39px;
          align-items: center;
          padding: 0 12px;
          justify-content: space-between;

          > div {
            display: flex;
            align-items: center;

            .skeleton.light.circle {
              width: 24px;
              height: 24px;
              margin-right: 8px;
            }

            .skeleton.light.text {
              width: 116px;
              height: 12px;
            }
          }

          .skeleton.light {
            width: 16px;
            height: 16px;
          }
        }

        .topbar-item {
          width: 180px;
          height: 34px;
          border-radius: 8px 8px 0 0;
          background-color: var(--search-bg-color);
          align-self: end;
          display: flex;
          align-items: center;
          padding: 0 12px;
          gap: 8px;

          .skeleton.light.circle {
            width: 16px;
            height: 16px;
          }

          .skeleton.light.text {
            width: 116px;
            height: 12px;
          }

          .skeleton.light {
            width: 12px;
            height: 12px;
          }
        }
      }

      .right {
        display: flex;
        gap: 16px;
        align-items: center;
        margin-right: 16px;

        .skeleton.light {
          width: 24px;
          height: 24px;
        }
      }
    }

    .quote {
      grid-area: quote;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 32px;
      height: 100%;
      justify-content: center;

      div {
        max-width: 640px;

        .text {
          margin-bottom: 12px;
          font-weight: 400;
          font-size: 28px;
          line-height: 36px;
          letter-spacing: -0.56px;
          text-align: center;
        }

        .quotee {
          font-weight: 400;
          font-size: 20px;
          line-height: 28px;
          letter-spacing: -0.56px;
          text-align: center;
        }
      }
    }
  }
}

.skeleton {
  background-color: var(--skeleton-bg-color);
  border-radius: 4px;
  animation: 2s ease-in-out 0.5s infinite normal none running pulsate;
  width: 100%;
  height: 100%;

  &.light {
    background-color: var(--skeleton-light-bg-color);
  }

  &.circle {
    border-radius: 50%;
  }

  .text {
    border-radius: 8px;
  }
}

@keyframes pulsate {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
  100% {
    opacity: 1;
  }
}
