@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap");

:root {
  --background-color: rgb(20, 20, 20);
  --foreground-color: rgb(250, 250, 250);
  --secondary-foreground: rgb(200, 200, 200);
  --secondary-background: rgb(40, 40, 40);
  --secondary-background-darker: rgb(35, 35, 35);
  --spotify-green: #1DB954;
  --spotify-green-darker: #15813b;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--background-color);
  color: var(--foreground-color);
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: auto;
  width: 90vw;
  height: fit-content;
  padding: 3rem;
  position: relative;
  display: block;
}

#popup-container {
  left: 0;
  top: 0;
  display: flex;
  justify-content: center;
  position: fixed;
  padding: 30px;
  z-index: 3000;
  width: 100vw;
  height: 100vh;
  opacity: 1;
  background-color: var(--background-color);

  #popup-wrapper {
    margin: auto;
    display: block;
    width: fit-content;
    height: fit-content;

    #loading {
      text-align: center;
      margin: 30px;
      padding: 10px 20px;
      display: none;
    }
  }

  #popup-icon {
    margin: auto;
    width: 40vw;
    height: 20vw;
  }

  #popup-icon img {
    width: 40vw;
    height: 20vw;
    opacity: 0.5;
    position: absolute;
  }

  #popup-field {
    margin: auto;
    width: fit-content;
  }

  #popup-file-label:hover {
    border-color: white;
    background-color: var(--background-color);
    color: var(--foreground-color);
    filter: drop-shadow(4px 6px 4px rgba(255, 255, 255, 0.3));
  }

  #popup-file-label {
    border: 2px solid var(--foreground-color);
    border-radius: 5px;
    color: var(--background-color);
    background-color: var(--foreground-color);
    font-weight: 700;
    font-size: 10pt;
    display: block;
    padding: 8px 16px;
    margin: auto auto;
    width: min-content;
    cursor: pointer;
    transition: color 300ms, background-color 300ms, border 300ms, filter 300ms;
  }

  #popup-file {
    display: none;
  }

  #popup-progress-container {
    display: flex;
    justify-content: space-evenly;
    flex-wrap: wrap;
  }

  #popup-progress-label {
    text-align: center;
    width: fit-content;
    display: block;
    margin: auto;
    padding: 30px 10px 10px 10px;
  }

  #popup-progress {
    accent-color: var(--foreground-color);
    display: block;
    margin: auto;
  }
}

#profile {
  display: flex;
  justify-content: space-evenly;
  margin: 4rem 0;

  #profile-left {
    max-width: 200px;
    max-height: 200px;
    width: 20vw;
    height: 20vw;
    position: relative;
    overflow: hidden;
    border-radius: 50%;
    background-color: var(--foreground-color);
    margin: auto 40px;
    vertical-align: center;

    img {
      width: 100%;
    }
  }

  #profile-right {
    width: 50%;

    #name {
      font-size: 36pt;
      line-height: 1.7;
    }

    #lifespan {
      font-size: 16pt;
      line-height: 1.3;
      color: var(--secondary-foreground)
    }

    #file-label:hover {
      border-color: white;
      background-color: var(--background-color);
      color: var(--foreground-color);
      filter: drop-shadow(4px 6px 4px rgba(255, 255, 255, 0.3));
    }

    #file-label {
      border: 2px solid var(--foreground-color);
      border-radius: 5px;
      color: var(--background-color);
      background-color: var(--foreground-color);
      font-weight: 700;
      font-size: 10pt;
      display: inline-block;
      padding: 8px 16px;
      margin: 20px 20px 20px 0;
      cursor: pointer;
      transition: color 300ms, background-color 300ms, border 300ms, filter 300ms;
    }

    input[type="file"] {
      display: none;
    }

    a {
      text-decoration: none;
      border-bottom: 1px solid var(--foreground-color);
      transition: font-weight 300ms;
    }

    a:hover {
      cursor: pointer;
      font-weight: 700;
    }

    #progress-container {
      display: flex;
      justify-content: space-evenly;
      flex-wrap: wrap;
    }

    #progress-label {
      text-align: center;
      width: fit-content;
      display: block;
      margin: auto;
      padding: 10px;
    }

    #progress {
      accent-color: var(--foreground-color);
      display: block;
      margin: auto;
    }
  }
}

#settings {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-evenly;
  width: fit-content;
  margin: 1rem auto;
  position: sticky;
  top: 0;
  z-index: 1000;

  button {
    height: fit-content;
    display: inline-block;
    outline: none;
    border: 2px solid var(--foreground-color);
    color: var(--background-color);
    background-color: var(--foreground-color);
    font-weight: 700;
    font-size: 10pt;
    padding: 12px 16px;
    margin: 0;
    cursor: pointer;
    transition: color 300ms, background-color 300ms, border 300ms, filter 300ms;
  }

  button:hover {
    border-color: white;
    background-color: var(--background-color);
    color: var(--foreground-color);
    filter: drop-shadow(4px 6px 4px rgba(255, 255, 255, 0.3));
  }

  button.active {
    border-color: white;
    background-color: var(--background-color);
    color: var(--foreground-color);
    filter: drop-shadow(4px 6px 4px rgba(255, 255, 255, 0.3));
  }
}

#overall, #overview-stats {
  display: flex;
  justify-content: space-evenly;
  flex-wrap: wrap;
  width: 100%;

  div {
    padding: 2vw;
    display: block;

    span {
      font-size: 25pt;
      font-weight: bold;
      display: block;
    }
  }
}

#overall {
  padding: 20px;
}

#overview {
  margin-top: 5vh;
  margin-bottom: 5vh;
}

#favorites {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  width: 100%;

  #favorites-artists, #favorites-songs {
    @media only screen and (min-width: 1000px) {
      width: 45%;
    }
    @media only screen and (max-width: 1000px) {
      width: 100%;
    }
    min-width: 400px;

    #favorites-artists-header, #favorites-songs-header {
      font-size: 20pt;
      padding: 2vh 0;
    }

    #favorites-artists-content, #favorites-songs-content {
      #favorites-artists-table, #favorites-songs-table {
        font-size: 14pt;
        width: fit-content;
        border-collapse: collapse;

        tr {
          align-content: center;
          align-items: center;
          text-align: center;
          transition: opacity 300ms;
        }

        tr:has(td):hover {
          opacity: 0.7;
          cursor: pointer;
        }

        tr:nth-child(2n + 1) {
          background-color: var(--background-color);
        }

        tr:nth-child(2n) {
          background-color: var(--secondary-background);
        }

        th {
          border-bottom: 1px solid var(--foreground-color);
          padding: 10px;
        }

        td {
          padding: 20px 10px;
        }

        td:nth-child(1) {
          width: min-content;
        }

        td:nth-child(2) {
          width: fit-content;
          align-items: center;
          justify-content: center;
          display: flex;

          .img-div {
            max-width: 50px;
            max-height: 50px;
            display: block;
            border-radius: 50%;
            overflow-y: hidden;

            img {
              width: 100%;
            }
          }

          .text-div {
            display: block;
            padding-left: 25px;
            min-width: 200px;
            max-width: 400px;
            word-wrap: break-word;
            line-height: 1.5;
            text-align: left;

            .text-main {
              overflow: auto;
              max-height: 26px;
              font-size: 13pt;
              font-weight: 600;
            }

            .text-sub {
              font-size: 10pt;
              font-weight: 400;
              color: var(--secondary-foreground);
            }
          }
        }
      }
    }
  }
}

#popup-artist-wrapper, #popup-song-wrapper {
  left: 0;
  top: 0;
  display: none;
  justify-content: center;
  align-items: center;
  position: fixed;
  padding: 30px;
  z-index: 1000;
  width: 100vw;
  height: 100vh;
  opacity: 1;
  backdrop-filter: blur(4px) brightness(40%);

  #popup-artist-panel, #popup-song-panel {
    display: flex;
    position: absolute;
    top: 1vw;
    width: calc(100% - 4vw);
    justify-content: space-between;
    justify-items: center;
    margin: 15px;
    height: 30px;
    z-index: 1000;

    div {
      transition: 300ms;
      width: fit-content;
      height: auto;
      border-radius: 50%;
      background-color: var(--background-color);

      img {
        width: 24px;
        height: auto;
        margin: 3px;
      }
    }

    div:hover {
      cursor: pointer;
      filter: invert(1);
    }

    #popup-artist-close-wrapper, #popup-song-close-wrapper {
      margin-left: auto;
    }
  }

  #popup-artist, #popup-song {
    background-color: var(--secondary-background-darker);
    border-radius: 10px;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.4));
    justify-content: space-evenly;
    display: flex;
    padding: 4vw 2vw;
    width: fit-content;
    flex-wrap: wrap;
    height: 100%;
    margin: auto auto;

    #popup-artist-left {
      @media only screen and (min-width: 530px) {
        width: 30%;
        height: 100%;
      }
      @media only screen and (max-width: 530px) {
        width: 80%;
        height: fit-content;
      }
      min-width: 150px;
      max-width: fit-content;

      #popup-artist-left-image-wrapper {
        @media only screen and (min-width: 530px) {
          width: 100px;
          height: 100px;
        }
        @media only screen and (max-width: 530px) {
          width: 75px;
          height: 75px;
        }
        display: block;
        border-radius: 50%;
        overflow: hidden;
        margin: 1vh auto;

        img {
          width: 100%;
        }
      }

      #popup-artist-left-text-block {
        padding: 1vh 2vw;

        #popup-artist-name {
          font-size: 14pt;
          font-weight: bold;
          text-align: center;
        }

        #popup-artist-stats {
          font-size: 10pt;
          font-weight: 400;
          max-width: fit-content;
          margin: 1vw auto 0 auto;
          color: var(--secondary-foreground);
        }
      }
    }

    #popup-artist-right {
      overflow-y: auto;
      @media only screen and (min-width: 530px) {
        width: 65%;
        height: 100%;
      }
      @media only screen and (max-width: 530px) {
        min-width: 80%;
        max-width: fit-content;
        margin: auto;
        max-height: calc(70% - 70px);
      }
      display: block;
      max-width: 500px;

      #popup-songs-table {
        font-size: 12pt;
        width: 100%;
        border-collapse: collapse;
        display: block;
        max-height: 100%;
        overflow-y: scroll;

        tr {
          align-content: center;
          align-items: center;
          text-align: center;
          transition: opacity 300ms;
        }

        tr:has(td):hover {
          opacity: 0.7;
          cursor: pointer;
        }

        tr:nth-child(2n + 1) {
          background-color: var(--secondary-background-darker);
        }

        tr:nth-child(2n) {
          background-color: var(--secondary-background);
        }

        th {
          border-bottom: 1px solid var(--foreground-color);
          padding: 10px;
        }

        td {
          padding: 10px 5px;
        }

        td:nth-child(1) {
          width: min-content;
        }

        td:nth-child(2) {
          width: fit-content;
          align-items: center;
          justify-content: center;
          display: flex;

          .img-div {
            @media only screen and (min-width: 530px) {
              width: 50px;
              height: 50px;
            }
            @media only screen and (max-width: 530px) {
              width: 40px;
              height: 40px;
            }
            display: block;
            border-radius: 50%;
            overflow-y: hidden;

            img {
              width: 100%;
              height: 100%;
            }
          }

          .text-div {
            display: block;
            padding-left: 25px;
            flex: 1;
            word-wrap: break-word;
            line-height: 1.5;
            text-align: left;

            .text-main {
              overflow: auto;
              max-height: 26px;
              font-size: 10pt;
              font-weight: 600;
            }

            .text-sub {
              font-size: 9pt;
              font-weight: 400;
              color: var(--secondary-foreground);
            }
          }
        }
      }
    }

    #popup-song-left {
      @media only screen and (min-width: 670px) {
        width: 30%;
        height: 100%;
      }
      @media only screen and (max-width: 670px) {
        width: 80%;
        height: fit-content;
      }
      min-width: 150px;
      max-width: fit-content;

      #popup-song-left-image-wrapper {
        @media only screen and (min-width: 670px) {
          width: 100px;
          height: 100px;
        }
        @media only screen and (max-width: 670px) {
          width: 75px;
          height: 75px;
        }
        display: block;
        border-radius: 50%;
        overflow: hidden;
        margin: 1vh auto;

        img {
          width: 100%;
        }
      }

      #popup-song-left-text-block {
        padding: 1vh 2vw;

        #popup-song-name {
          font-size: 14pt;
          font-weight: bold;
          text-align: center;
          word-break: break-word;
        }

        #popup-song-artists {
          font-size: 12pt;
          font-weight: 400;
          text-align: center;
          margin: 1vw auto 0 auto;
          color: var(--secondary-foreground);

          a {
            text-decoration: none;
            border-bottom: 1px solid;
            transition: 300ms;
          }

          a:hover {
            color: var(--foreground-color);
            cursor: pointer;
          }
        }

        #popup-song-stats {
          font-size: 10pt;
          font-weight: 400;
          max-width: fit-content;
          margin: 1vw auto 0 auto;
          color: var(--secondary-foreground);
        }
      }
    }

    #popup-song-right {
      overflow-y: auto;
      @media only screen and (min-width: 670px) {
        width: 65%;
        height: 100%;
      }
      @media only screen and (max-width: 670px) {
        min-width: 80%;
        max-width: fit-content;
        margin: auto;
        max-height: calc(70% - 70px);
      }
      display: block;
      max-width: 500px;

      #song-characteristics {
        display: flex;
        padding: 20px;
        justify-content: space-evenly;
        flex-wrap: wrap;
        width: 100%;
        backdrop-filter: brightness(1.5);
        border-radius: 1vw;

        .song-characteristics-section {
          width: 100%;
          display: flex;
          justify-content: space-evenly;

          div {
            padding: 2vw;
            display: block;
            width: fit-content;

            span {
              font-size: 17pt;
              font-weight: bold;
              display: block;
            }
          }
        }
      }
    }
  }
}

svg {
  text {
    font-family: "DM Sans", sans-serif;
    font-size: 10pt;
  }

  .label {
    backdrop-filter: blur(4px);
    background-color: var(--background-color);
  }
}

#overall-graphs, #genre-analysis, #popup-artist-graph, #popup-song-graph, #timeOfDay-graph, #dayOfWeek-graph, #calendar-graph {
  position: relative;

  #overall-graph-tooltip, #oneD-song-genre-force-tooltip, #popup-artist-graph-tooltip, #popup-song-graph-tooltip, #timeOfDay-tooltip, #dayOfWeek-tooltip, #calendar-tooltip {
    display: none;
    opacity: 0;
    background-color: var(--background-color);
    padding: 10px 15px;
    font-size: 10pt;
    z-index: 100;
    border: 1px solid var(--foreground-color);
    transition: 200ms;
    pointer-events: none;
  }

  #overall-graph-tooltip, #timeOfDay-tooltip, #dayOfWeek-tooltip {
    width: max-content;
  }

  #oneD-song-genre-force-tooltip, #popup-artist-graph-tooltip, #popup-song-graph-tooltip, #calendar-tooltip {
    max-width: 300px;
  }

  .preference-panel {
    padding: 10px 0;
    font-size: 12pt;
  }

  h2 {
    margin-top: 20px;
    margin-bottom: 15px;
  }

  label {
    font-weight: bold;
    margin-right: 5px;
  }

  select {
    font-family: "DM Sans", sans-serif;
    background: var(--background-color);
    color: var(--foreground-color);
    appearance: none;
    padding: 5px 10px;
    border: 1px solid var(--foreground-color);
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: 300ms;
    width: fit-content;
    text-align: center;
  }

  select:hover {
    background: var(--foreground-color);
    color: var(--background-color);
    cursor: pointer;
  }
}

#calendar-graph svg {
  padding-top: 15px;
}

#popup-artist-graph, #popup-song-graph {
  margin-bottom: 50px;
}

#genre-analysis, #timeAnalysisGroup {
  margin-bottom: 20px;
}

#genre-analysis svg {
  /* Make force graph vertical if width is too small */
  width: 100%;
  @media only screen and (min-width: 700px) {
    height: 70vh;
  }
  @media only screen and (max-width: 700px) {
    height: calc(100vw + 50vh);
  }
}

#timeAnalysisGroup {
  display: flex;
  @media only screen and (min-width: 900px) {
    flex-direction: row;
    #timeOfDay-graph, #dayOfWeek-graph {
      width: 50%;

      svg {
        width: 100%;
      }
    }
  }
  @media only screen and (max-width: 900px) {
    flex-direction: column;
    #timeOfDay-graph, #dayOfWeek-graph {
      width: 100%;
    }
  }
}

div label:not(:first-of-type) {
  margin-left: 2vw;
}

div label:nth-child(1) {
  margin-left: 0;
}