.pageProfileSearch {
  align-content: center;
  height: 100%;
  display: grid;
  .search {
    justify-self: center;
    max-width: 400px;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    font-size: 1.25rem;
    .title {
      font-size: 1.25em;
      grid-column: span 2;
      color: var(--sub-color);
    }
    .button {
      height: auto;
    }
  }
}

.pageProfile {
  align-content: center;
  height: 100%;
  display: grid;
  .content {
    display: grid; //stupid fix for stupid safari
  }
  .preloader {
    position: absolute;
    z-index: 1;
    font-size: 3rem;
    background: var(--bg-color);
    border-radius: 100%;
    padding: 1rem;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: var(--main-color);
  }
  .error {
    position: absolute;
    z-index: 1;
    font-size: 2rem;
    background: var(--bg-color);
    border-radius: var(--roundness);
    padding: 2rem;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: var(--error-color);
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    align-items: baseline;
    .message {
      display: inline;
    }
  }
  .lbOptOutReminder {
    grid-column: span 2;
    text-align: center;
    color: var(--sub-color);
    font-size: 0.8em;
  }
}

.profile {
  display: grid;
  gap: 2rem;
  // grid-template-columns:  auto;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "info info"
    "leaderboards leaderboards"
    "pbsTime pbsWords";

  .pbsWords {
    grid-area: pbsWords;
    display: grid;
    gap: 1rem;
  }

  .pbsTime {
    grid-area: pbsTime;
    display: grid;
    gap: 1rem;
  }

  .pbsWords,
  .pbsTime,
  .details,
  .leaderboardsPositions {
    // user-select: none;
    background: var(--sub-alt-color);
    padding: 1rem;
    border-radius: var(--roundness);
    align-content: center;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    position: relative;

    .buttonGroup {
      position: absolute;

      height: 100%;
      right: 0;
      top: 0;
      width: 2rem;
      display: grid;

      button:first-child {
        border-top-right-radius: var(--roundness);
      }
      button:last-child {
        border-bottom-right-radius: var(--roundness);
      }
      button {
        background: transparent;
        align-items: center;
        align-content: center;
        display: grid;
        height: 100%;
        color: var(--sub-color);
        border-radius: 0;
        &:hover {
          color: var(--bg-color);
          background-color: var(--text-color);
        }
      }
    }
    .editProfileButton {
      font-size: 0.9rem;
    }
  }

  .leaderboardsPositions {
    grid-area: leaderboards;
    display: grid;
    gap: 1rem;
    align-items: center;
    grid-template-areas: "title t15 t60";
    grid-template-columns: unset;
    justify-items: center;
    .title {
      color: var(--sub-color);
      text-align: center;
      grid-area: title;
    }
    .group {
      display: grid;
      column-gap: 1rem;
      grid-template-columns: auto 1fr;
      grid-template-areas: "testType pos" "topPercentage pos";
      align-items: center;
      .testType {
        grid-area: testType;
        color: var(--sub-color);
      }
      .pos {
        grid-area: pos;
        font-size: 2rem;
      }
      .topPercentage {
        color: var(--sub-color);
        grid-area: topPercentage;
        font-size: 0.75rem;
        text-align: right;
      }
      &.t15 {
        grid-area: t15;
      }
      &.t60 {
        grid-area: t60;
      }
    }
  }

  .pbsWords,
  .pbsTime {
    .group {
      justify-self: center;
      display: grid;
      gap: 0.25rem;
      grid-template-areas: "center";
      .quick,
      .fullTest {
        grid-area: center;
      }
      .quick {
        display: grid;
        gap: 0.25rem;
        justify-self: center;
        justify-items: center;
        .test,
        .wpm,
        .acc {
          display: grid;
        }
        .test {
          color: var(--sub-color);
          align-content: end;
          font-size: 0.8em;
          line-height: 100%;
        }
        .wpm {
          font-size: 2.5em;
          line-height: 100%;
          align-content: center;
        }
        .acc {
          font-size: 1.5em;
          line-height: 100%;
          // justify-self: end;
          opacity: 0.75;
        }
      }

      .fullTest {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.25rem;
        background: var(--sub-alt-color);
        z-index: 1;
        opacity: 0;
        transition: 0.125s;
        justify-items: center;
        font-size: 0.8em;
        &:hover {
          opacity: 1;
        }
        div:first-child,
        div:last-child {
          // grid-column: span 2;
          color: var(--sub-color);
          text-align: center;
        }
        // div:nth-child(3),
        // div:nth-child(5) {
        //   justify-self: end;
        // }
      }
    }
  }

  .details {
    // grid-template-columns: 1fr 2fr;
    grid-area: info;
    display: grid;
    gap: 1rem 1rem;
    background: var(--sub-alt-color);
    padding: 1rem;
    border-radius: var(--roundness);
    align-content: center;
    padding-right: 3rem;

    // grid-template-columns: 15rem auto 15rem auto 2fr auto auto;

    grid-auto-flow: column;

    &.none {
      grid-template-areas: "avAndName sep1 typingStats ";
      grid-template-columns: 17.5rem auto 1fr;
      .typingStats {
        grid-template-columns: 1fr 1fr 1fr;
        align-self: center;
        align-items: center;
        .value {
          font-size: 2rem;
          line-height: 2rem;
        }
      }
    }

    &.bioAndKey {
      grid-template-areas: "avAndName sep1 typingStats sep2 bioAndKey";
      grid-template-columns: 17.5rem auto 1fr auto 2fr;
      .typingStats {
        .value {
          font-size: 1.5rem;
          line-height: 1.5rem;
        }
      }
    }

    &.soc {
      grid-template-areas: "avAndName sep1 typingStats sep3 socials";
      grid-template-columns: 17.5rem auto 1fr auto auto;
      .typingStats {
        grid-template-columns: 1fr 1fr 1fr;
        align-self: center;
        align-items: center;
        .value {
          font-size: 2rem;
          line-height: 2rem;
        }
      }
    }

    &.both {
      grid-template-areas: "avAndName sep1 typingStats sep2 bioAndKey sep3 socials";
      grid-template-columns: 17.5rem auto 1fr auto 2fr auto auto;
      .typingStats {
        .value {
          font-size: 1.5rem;
          line-height: 1.5rem;
        }
      }
      .bio,
      .keyboard {
        font-size: 0.75rem;
      }
    }

    .avatarAndName {
      grid-area: avAndName;
    }
    .sep1 {
      grid-area: sep1;
    }
    .typingStats {
      grid-area: typingStats;
    }
    .sep2 {
      grid-area: sep2;
    }
    .bioAndKeyboard {
      grid-area: bioAndKey;
      word-break: break-word;
    }
    .sep3 {
      grid-area: sep3;
    }
    .socials {
      grid-area: socials;
    }

    .avatarAndName {
      width: 100%;
      display: grid;
      grid-template-columns: 5rem 1fr;
      gap: 1rem;
      align-items: center;
      align-self: center;
      .avatars {
        display: grid;
        font-size: 5rem;
        line-height: 5rem;
        height: 5rem;
        .placeholderAvatar {
          // font-size: 5rem;
          // line-height: 6rem;
          margin-left: 0.1rem;
          color: var(--sub-color);
        }
        .avatar {
          height: auto;
          aspect-ratio: 1/1;
          width: 100%;
        }
        div {
          grid-row: 1/2;
          grid-column: 1/2;
        }
      }
      .user {
        display: flex;
        flex-wrap: wrap;
        font-size: 1rem;
        // line-height: 100%;
        width: max-content;
        gap: 0.35rem;
        .userFlags {
          display: flex;
          flex-wrap: wrap;
          gap: 0.35rem;
          // font-size: 0.75em;
          color: var(--sub-color);
          place-items: center left;
        }
      }
      .badge {
        width: max-content;
        font-size: 0.7em;
      }
      .allBadges {
        display: flex;
        flex-wrap: wrap;
        // font-size: 0.7em;
        .badge {
          margin-right: 0.35rem;
        }
      }
      .joined {
        color: var(--sub-color);
        font-size: 0.7em;
        line-height: 0.7rem;
      }
      .streak {
        color: var(--sub-color);
        font-size: 0.7em;
        line-height: 0.7rem;
      }
      .badge,
      .joined,
      .streak {
        margin-top: 0.35rem;
      }
      .levelAndBar {
        grid-column: span 2;
        display: grid;
        grid-template-columns: auto 1fr auto;
        gap: 1rem;
        align-items: center;
        .level,
        .xp {
          line-height: 0;
        }
        .xpBar {
          pointer-events: auto;
          height: 0.5rem;
          bottom: 0rem;
          width: 100%;
          left: 0;
          background: var(--bg-color);
          border-radius: var(--roundness);
          .bar {
            left: 0;
            width: 50%;
            height: 100%;
            background: var(--main-color);
            border-radius: var(--roundness);
          }
        }
        .xp {
          justify-self: end;
          color: var(--sub-color);
          font-size: 0.75rem;
        }
      }
    }
    .socials {
      display: grid;
      justify-content: end;
      .title {
        display: none;
      }
      .value {
        display: grid;
        gap: 0.25rem;
        width: max-content;
        align-items: center;
        height: 100%;
        a {
          color: var(--text-color);
          &:hover {
            color: var(--main-color);
          }
        }
      }
    }
    .typingStats {
      display: grid;
      gap: 0.5rem;
      align-content: space-around;
      align-self: stretch;
      grid-auto-flow: column;
      width: 100%;
      height: 100%; //dumb safari fix
    }
    .bioAndKeyboard {
      display: grid;
      gap: 1rem;
      align-content: space-around;
      align-self: stretch;
      grid-auto-flow: column;
    }
    .bio .value,
    .keyboard .value {
      white-space: pre-line;
    }
    .typingStats.vertical,
    .bioAndKeyboard.vertical {
      grid-auto-flow: row;
    }
    .separator {
      width: 0.5rem;
      height: auto;
      background: var(--bg-color);
      border-radius: var(--roundness);
    }
    .big {
      .value {
        font-size: 1.5rem;
        line-height: 1.3rem;
      }
    }
    .socials {
      .value {
        margin-top: 0.05rem;
        .textButton {
          padding: 0.1em;
        }
      }
    }
    .title {
      font-size: 0.8rem;
      color: var(--sub-color);
    }
  }
  .personalBestTables {
    grid-area: pbs;
  }
}
