@use "../../../../assets/variables.scss" as vars;

@mixin focused() {
  outline: 0 none;
  outline-offset: 0;
  transition: box-shadow 0.2s;
  box-shadow: 0 0 0 0.1rem var(--p-primary-400);
}

@mixin focused-inset() {
  outline: 0 none;
  outline-offset: 0;
  transition: box-shadow 0.2s;
  box-shadow: inset 0 0 0 0.1rem var(--p-primary-400);
}

//#region TOPBAR

.layout-topbar {
  position: fixed;
  z-index: 1000;
  top: 88px;
  left: 18px;
}

.layout-menu-button {
  background-color: var(--p-surface-900);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  border: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  position: relative;
  cursor: pointer;
  transition: background-color 0.2s;

  &:hover {
    color: var(--p-primary-400);
    background-color: var(--p-surface-800);
  }

  &:focus {
    @include focused();
  }

  i {
  }
}

.gray-separator {
  border-top: 1px solid var(--p-surface-700);
  width: 100%;
}

//#endregion

//#region LAYOUT

.layout-wrapper {
  .layout-main-container {
    max-width: 1100px;
    margin: auto;
  }

  .layout-sidebar {
    transform: translateX(-200%);
    left: 0;
    top: 0;
    height: 100%;
    z-index: 1003;
  }

  &.layout-mobile-active {
    .layout-sidebar {
      transform: translateX(0);
    }
  }
}

.layout-main-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: space-between;
  padding-top: 3.5rem;
  transition: margin-left 0.2s;
}

.layout-main {
  flex: 1 1 auto;
  overflow-y: auto;
}

//#endregion

//#region SIDEBAR

.layout-sidebar {
  position: fixed;
  width: 300px;
  height: calc(100% - 9rem);
  overflow-y: auto;
  user-select: none;
  top: 7.75rem;
  left: 18px;
  background-color: var(--p-surface-950);
  box-shadow: 0 0 1px 1px var(--p-surface-700) !important;
  border-radius: var(--p-content-border-radius);
  padding: 1rem;
  box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.02), 0px 0px 2px rgba(0, 0, 0, 0.05),
    0px 1px 4px rgba(0, 0, 0, 0.08);
}

.with-transition {
  transition: transform 0.2s, left 0.2s;
}

::ng-deep {
  .layout-menu {
    margin: 0;
    padding: 0;
    list-style-type: none;

    .layout-root-menuitem {
      > a {
        display: none;
      }
    }

    a {
      user-select: none;

      &.active-menuitem {
        > .layout-submenu-toggler {
          transform: rotate(-180deg);
        }
      }
    }

    li.active-menuitem {
      > a {
        .layout-submenu-toggler {
          transform: rotate(-180deg);
        }
      }
    }

    ul {
        margin: 0;
        padding: 0;
        list-style-type: none;

        a {
            display: flex;
            align-items: center;
            position: relative;
            outline: 0 none;
            color: var(--p-text-color);
            cursor: pointer;
            padding: .75rem 1rem;
            border-radius: 12px;
            transition: background-color 100, box-shadow 100;
            text-decoration: none;

            .layout-menuitem-icon {
                margin-right: .5rem;
            }

        .layout-submenu-toggler {
          font-size: 75%;
          margin-left: auto;
          transition: transform 100;
        }

        &.active-route {
          font-weight: 700;
          color: var(--p-primary-500);
        }

        &:hover {
          background-color: var(--p-surface-800);
        }

        &:focus {
          @include focused-inset();
        }
      }

      ul {
        overflow: hidden;
        border-radius: 12px;

        li {
          a {
            margin-left: 1rem;
          }

          li {
            a {
              margin-left: 2rem;
            }

            li {
              a {
                margin-left: 2.5rem;
              }

              li {
                a {
                  margin-left: 3rem;
                }

                li {
                  a {
                    margin-left: 3.5rem;
                  }

                  li {
                    a {
                      margin-left: 4rem;
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }

  .layout-menuitem {
    user-select: none;
    display: flex;
    align-items: center;
    position: relative;
    outline: 0 none;
    color: var(--p-text-color);
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: var(--p-content-border-radius);
    transition: background-color 0.2s, box-shadow 0.2s;

    .layout-menuitem-icon {
      margin-right: 0.5rem;
    }

    &.active-route {
      font-weight: 700;
      color: var(--p-primary-400);
    }

    &:hover {
      background-color: var(--p-surface-800);
    }

    &:focus {
      @include focused-inset();
    }
  }
}

//#endregion

//#region Docs Pages

.section-wrapper {
  display: flex;
  gap: 18px;
  flex-direction: column;
  margin-bottom: 18px;
}

.wrapper {
  display: flex;
  flex-direction: column;
  padding: 18px;
  border: 1px solid var(--p-content-border-color);
  border-radius: var(--p-content-border-radius);
}

.explanation-card {
  overflow: auto;
  width: 100%;
  padding: 9px;
}

.index-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 16px;

  .index {
    font-size: 2rem;
    color: var(--p-secondary-color);
  }
}

@media (max-width: vars.$md) {
  .index-title {
    font-size: 1.5rem;

    .index {
      font-size: 1.5rem;
    }
  }
}

::ng-deep {
  h1 {
    margin-bottom: 30px;
  }
  h2 {
    margin-bottom: 12px;
  }
  h3 {
    margin-bottom: 9px;
  }
  h4 {
    margin-bottom: 7px;
  }

  .video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 */
    padding-top: 25px;
    height: 0;
  }

  .video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }

  .margin-bottom-0 {
    margin-bottom: 0px !important;
  }
}

.example-wrapper {
  padding: 18px;
  font-size: 0.875rem;
  border: 1px solid var(--p-content-border-color);
  border-radius: var(--p-content-border-radius);
  line-height: 1.5;
  overflow: auto;

  .title {
    font-size: 1.2rem;
  }
}

.code-snippet-wrapper {
  width: 100%;
  position: relative;
}

.copy-button-wrapper {
  position: absolute;
  top: 6px;
  right: 6px;
}

pre {
  margin: 0 !important;
}

code {
  padding: 0 !important;
  background-color: transparent !important;
}

.sidebar-close-btn-wrapper {
  display: flex;
}

.sidebar-close-btn {
  width: 30px !important;
  height: 30px !important;
  margin-left: auto;
  margin-bottom: 8px;

  i {
    font-size: 0.9rem !important;
  }
}

@media (max-width: 1730px) {
  .sidebar-close-btn {
    display: none;
  }
}

//#endregion