$dark-1: #272727;
$dark-2: #343338;
$border-1: 1px solid $dark-2;
$border-2: 1px solid $dark-1;
$accent: #a084e8;
$focus-outline: 1.3px solid $accent;
$background: #121212;

@font-face {
  font-family: "default";
  src: url("./manrope.ttf");
}

:root {
  color-scheme: dark;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "default", sans-serif;
}

:focus-visible {
  outline-offset: 5px;
  outline: $focus-outline;
  background: #a084e818 !important;
}

body {
  background: $background;

  &.no-scroll {
    height: 100vh;
    width: 100vw;
    overflow: hidden;
  }
}

a {
  cursor: pointer;
  color: $accent;
  text-decoration: none;

  &:hover {
    text-decoration: underline;
  }
}

button {
  background: transparent;
  border: none;
  cursor: pointer;
  user-select: none;
}

/* - Scrollbar - */

::-webkit-scrollbar {
  width: 0.7em;
  height: 0.7em;
}

::-webkit-scrollbar-track {
  background: $background;
  margin-block: 10px;
}

::-webkit-scrollbar-thumb {
  background: $dark-1;
  border-radius: 100vw;
  border: 3.8px solid $background;
}

/* - Nav Bar - */

nav {
  padding: 1rem;
  user-select: none;
  font-size: max(0.9vw, 15px);
  user-select: none;

  > div {
    width: 18rem;
    max-width: 100vw;
    display: flex;
  }

  button {
    font-size: max(0.9vw, 15px);
  }

  .dropdown {
    margin-left: auto;
    position: relative;

    > button:hover,
    &.active > button {
      color: $accent;
    }

    button.add {
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 0.5rem;

      span {
        color: $accent;
        font-size: 20px;
      }
    }

    ul {
      gap: 0.6rem;
      background: #201f25dc;
      backdrop-filter: blur(5px);
      border: $border-1;
      position: absolute;
      display: none;
      right: 0;
      padding: 1rem;
      margin-top: 1.5rem;
      border-radius: 8px;
      z-index: 999;
      list-style: none;
      max-width: calc(100vw - 4.5rem);
      display: none;
      width: 25rem;
      grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
      white-space: nowrap;
    }

    li button {
      border-radius: 5px;
      padding: 0.2rem 0.4rem;
      width: 100%;
      height: 100%;
      background: #2a29308a;
      border: $border-1;
      font-size: max(0.7vw, 13px);
    }

    li button.selected::after {
      content: " \00A0 \00A0 ●";
      color: $accent;
    }

    li button:hover {
      background: #2e2d368a;
      border-color: $accent;
    }
  }
}

/* - Divider - */

hr {
  margin: 1rem 0;
  border: none;
  width: 100%;
  height: 1.5px;
  border-radius: 3rem;
  background: #343338;
}

/* - Upload Field - */

#upload {
  margin: 5rem 0;
  margin-bottom: 6rem;
}

#upload > div {
  flex-direction: column;
  width: 80vw;
  max-width: 15rem;
  border-radius: 50%;
  aspect-ratio: 1/1;
  position: relative;
  background: #191919;
  transition: 500ms ease;
  z-index: 99;
  user-select: none;

  input {
    position: absolute;
    height: 100%;
    width: 100%;
    border-radius: 50%;
    z-index: 9;
    opacity: 0;
    cursor: pointer;
  }

  &::after {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    outline-offset: 1rem;
    outline: 0.3rem dashed $accent;
    z-index: -1;
    animation: rotate360 10s linear infinite;
  }

  &:hover {
    background: #a084e81b;
  }
}

/* - Dragging Mode - */

body.dragging {
  #upload > div {
    background: #a084e81b !important;
    transform: scale(1.05);
  }
}

/* - Card - */

.card {
  background: #201f25;
  border: $border-1;
  border-radius: 8px;

  ul {
    list-style: none;
  }

  li {
    display: flex;
    align-items: center;
    padding: 0.3rem 0.6rem;
    max-width: calc(100vw - 2rem);
    width: max(18vw, 18rem);
    border-bottom: $border-1;
  }

  li:last-child {
    border-bottom: none;
  }

  .t {
    color: $accent;
    user-select: none;
    overflow-x: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .c {
    color: #fff;
    padding: 0.4rem;
    border-radius: 5px;
    font-size: 14px;
    overflow-x: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* - Loader - */

.loader {
  display: none;

  h1 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
  }

  > div {
    width: 50px;
    height: 40px;
  }

  > div > div {
    background-color: #fff;
    height: 100%;
    width: 6px;
    display: inline-block;
    -webkit-animation: 1.2s ease-in-out infinite stretch;
    animation: 1.2s ease-in-out infinite stretch;
  }

  > div .rect2 {
    -webkit-animation-delay: -1.1s;
    animation-delay: -1.1s;
  }

  > div .rect3 {
    -webkit-animation-delay: -1s;
    animation-delay: -1s;
  }

  > div .rect4 {
    -webkit-animation-delay: -0.9s;
    animation-delay: -0.9s;
  }

  > div .rect5 {
    -webkit-animation-delay: -0.8s;
    animation-delay: -0.8s;
  }
}

/* - Accordin - */

.accordin button {
  padding: max(0.6vw, 0.6rem);
  background: #201f25;
  border-radius: 5px;
  border: $border-1;
  max-width: calc(100vw - 2rem);
  width: max(18vw, 18rem);
  margin: 0;
  position: relative;

  &::before {
    content: "⬇️";
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translate(0, -50%);
    filter: brightness(0.5) sepia(1) hue-rotate(180deg);
  }
}

.accordin:first-child > button {
  margin-top: 0.7rem;
}

.accordin.active button {
  border-bottom-left-radius: 0 !important;
  border-bottom-right-radius: 0 !important;

  &::before {
    content: "⬆️" !important;
  }
}

.accordin .content {
  display: block;
  padding: max(1vw, 0.6rem);
  width: max(18vw, 18rem);
  background: #201f2577;
  border-radius: 5px;
  border: $border-1;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.accordin.api-docs .content {
  display: none;
}

/* - Utility Classes - */

.flex-1 {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* - Footer - */

footer div {
  user-select: none;
  max-width: calc(100vw - 2rem);
  width: 18rem;
  border: $border-1;
  background: #201f25;
  border-radius: 6px;
  color: #747378;
  font-weight: 700;
  font-size: 13px;
  text-align: center;
  margin: 2rem 0;

  button {
    color: #747378;
    font-size: 13px;
    font-weight: 700;
    width: 100%;
    padding: 0.5rem;
    border-bottom: $border-1;
    transition: 300ms ease;
  }

  button:hover {
    color: $accent;
  }

  p {
    padding: 0.5rem;
  }
}

/* - Overlay - */

.overlay {
  border-top-right-radius: 9px;
  background: #4f3bff;
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  clip-path: circle(0 at 50% 50%);
  transition: 1s ease;
  backdrop-filter: blur(5px);
}

.overlay.active {
  background: #00000029;
  clip-path: circle(100%);
}

/* - Popup - */

.popup {
  display: none;
  position: fixed;
  top: 50%;
  min-width: 18rem;
  max-width: calc(100% - 2rem);
  left: 50%;
  background: #181818;
  z-index: 99999;
  overflow-x: hidden;
  border: $border-2;
  border-radius: 5px;
  transform: translate(-50%, -50%);

  header {
    display: flex;
    align-items: center;
    padding: 0.7rem 0.9rem;
    border-bottom: $border-2;
    user-select: none;

    button {
      padding: 0.7rem 0.5rem 0.8rem 0.5rem;
    }
  }

  .content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0.7rem;

    button {
      width: 100%;
      min-height: 2.2rem;
      font-size: 14px;
      border-radius: 5px;
      background: $accent;
    }

    input {
      padding: 0.5rem;
      font-size: 14px;
      border-radius: 5px;
      outline: none;
      background: $background;
      border: $border-2;
    }

    input:hover,
    input:focus {
      border-color: $accent;
    }
  }

  &.active {
    display: block !important;
  }
}

/* - Logs - */

.modal header button,
.popup header button {
  margin-left: auto;
  transition: 200ms ease;
  font-size: 1rem;
  border: $border-2;
  border-radius: 5px;
  line-height: 0;
  padding: 0.9rem 0.7rem 1rem 0.7rem;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: monospace, "default";
}

.modal header button:hover,
.popup header button:hover {
  background: $accent;
  border-color: $accent;
}

.modal {
  display: none;
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
  background: $background;
  z-index: 99999;
  overflow-x: hidden;

  header {
    display: flex;
    align-items: center;
    padding: 1rem 1.3rem;
    border-bottom: $border-2;
    height: 4rem;
  }

  .content {
    display: flex;
    align-items: stretch;
    flex-wrap: wrap;
    position: relative;
    width: 100vw;

    > div:last-child h3 {
      border-left: $border-2 !important;
    }

    > div {
      flex-basis: 50%;
      font-size: 14px;
      overflow-y: scroll;
      height: calc(100vh - 4rem);

      h3 {
        padding: 1rem;
        position: absolute;
        top: 0;
        width: 100%;
        background: $background;
        border-bottom: $border-2;
      }

      div {
        height: 100%;
        padding: 1rem;
        border-bottom: $border-2;
        font-family: monospace, "default";
        line-height: 1.5;
        margin-top: 3rem;

        .none {
          display: flex;
          justify-content: center;
          align-items: center;
          user-select: none;
          height: 100%;
          opacity: 0.1;
          font-size: 2rem;
        }

        span {
          color: $accent;
          font-family: monospace, "default";
        }
      }
    }

    .left {
      border-right: $border-2;
    }

    @media (max-width: 600px) {
      > div {
        flex-basis: 100%;
      }

      .left {
        border-right: none;
      }
    }
  }
}

/* - History - */

section.history {
  position: absolute;
  top: 1rem;
  right: 2.5rem;
  padding-bottom: 2rem;
  flex-direction: column;
  margin-bottom: 2rem;

  .title {
    display: flex;
    align-items: center;
    max-width: calc(100vw - 2rem);
    width: 18rem;
    margin-bottom: 0.7rem;
  }

  .title button {
    margin-left: auto;
    height: max-content;
    font-weight: 600;
    font-size: 14px;
    color: #f31559;
  }

  .title h2 {
    margin-bottom: 0.7rem;
    user-select: none;
  }

  #history {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  #history .none {
    max-width: calc(100vw - 2rem);
    width: 18rem;
    border-radius: 8px;
    height: 10rem;
    border: $border-1;
    background: #201f25;
  }

  #history .none p {
    opacity: 0.3;
    user-select: none;
    font-size: 1rem;
  }
}

/* - API - */

#api {
  position: absolute;
  flex-direction: column;
  top: 1rem;
  left: 2.5rem;
  padding-bottom: 2rem;

  h2 {
    margin-bottom: 0.7rem !important;
    user-select: none;
  }

  .api-docs button {
    border-radius: 5px;
  }

  button {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  > div p:not(.code) {
    margin: 1.1rem 0 0.6rem 0;
    font-size: max(0.9vw, 14px);
    font-weight: 500;
  }

  > div p:first-child {
    margin-top: 0;
  }

  > div {
    max-width: calc(100vw - 2rem);
    width: 18rem;
  }
}

/* - Code Block - */

.code {
  background: #201f25;
  border: $border-1;
  border-radius: 5px;
  white-space: nowrap;
  font-size: max(0.8vw, 13px);
  padding: max(0.5vw, 0.3rem) max(1vw, 0.6rem);
  overflow-x: auto;
}

.code::-webkit-scrollbar-track {
  background: #201f25;
  margin-inline: 5px;
}

.code::-webkit-scrollbar-thumb {
  background: #353535;
  border: 3.8px solid #201f25;
}

/* - Latest Card - */

#latest {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* - Mobile Device - */

@media (max-width: 1080px) {
  #api {
    button {
      border-bottom-right-radius: 5px;
      border-bottom-left-radius: 5px;
    }

    .accordin .content {
      display: none;
    }
  }

  section.history {
    margin-top: 2.5rem;
  }

  #api,
  section.history {
    position: static;
    padding-bottom: 0;
  }

  .latest .card {
    margin-bottom: 2rem;
    margin-top: -3.5rem;
  }
}

/* - Keyframes - */

@keyframes rotate360 {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@-webkit-keyframes stretch {
  0%,
  100%,
  40% {
    -webkit-transform: scaleY(0.4);
  }
  20% {
    -webkit-transform: scaleY(1);
  }
}

@keyframes stretch {
  0%,
  100%,
  40% {
    transform: scaleY(0.4);
    -webkit-transform: scaleY(0.4);
  }
  20% {
    transform: scaleY(1);
    -webkit-transform: scaleY(1);
  }
}
