@use '../../../css/_config/_mixins';
@use '../../../css/_config/_vars';

.wrap {
  display: grid;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto 1fr;
  height: 100px;
  padding: 9px 22px 10px;
  background: var(--color-secondary-background);
  border-top: 1px solid var(--color-secondary-border);
  text-align: center;

  @media (min-width: 1024px) {
    padding: 9px 24px 10px;
  }

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

// CURRENTLY PLAYING

.leftSection {
}

.nowPlaying {
  display: flex;
  align-items: center;
  text-align: left;
}

.cover,
.coverArtwork,
.coverLink {
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  margin-right: 10px;
  border-radius: 6px;

  @media (min-width: 880px) {
    width: 56px;
    height: 56px;
    margin-right: 12px;
  }
  @media (min-width: 1024px) {
    width: 68px;
    height: 68px;
    margin-right: 15px;
  }
}

.cover {
  background: var(--color-secondary-hover);
  background-image: vars.$thumbnail;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  outline: 1px solid var(--color-opacity-01);

  &Placeholder {
    outline: 1px solid var(--color-opacity-015);
  }
}

.coverArtwork,
.coverLink {
  position: absolute;
  overflow: hidden;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;

  @include mixins.focus-self-outline;

  img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

.coverLink {
  &:hover {
    outline: 1px solid var(--color-opacity-02);
  }
}

.text {
  width: calc(100% - 60px);

  @media (min-width: 1024px) {
    width: calc(100% - 75px);
  }
}

.title {
  overflow: hidden;
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;

  @media (min-width: 1024px) {
    font-size: 13px;
  }
}

.artist {
  display: block;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-opacity-07);

  @media (min-width: 1024px) {
    font-size: 12px;
  }

  a {
    @include mixins.focus-self-underline;
  }
}

// PRIMARY CONTROLS

.primaryControls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 40vw;
  min-width: 320px;
  max-width: 566px;

  @media (min-width: 1024px) {
    gap: 10px;
  }

  &.fullPageMode {
    width: auto;

    @media (max-width: 1023px) {
      justify-content: flex-start;
    }
  }
}

button.expand,
button.forward,
button.pause,
button.play,
button.queue,
button.repeat,
button.rewind,
button.shuffle,
button.volume,
span.settings,
.offline {
  display: block;
  position: relative;
  width: 44px;
  height: 44px;
  padding: 8px;
  // margin: 0 5px;
  background: none;
  border: none;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;

  @include mixins.focus-self-outline;

  &:disabled {
    opacity: 0.5;
    cursor: default;
  }

  &:not(:disabled):hover {
    background: var(--color-secondary-hover);

    .fullPageMode & {
      background: var(--color-secondary-background);
    }
  }
}

span.settings {
  @include mixins.focus-child-outline;
}

button.rewind {
  padding: 8px 9px 8px 7px;
}

button.forward {
  padding: 8px 7px 8px 9px;
}

button.shuffle,
button.repeat,
span.settings {
  padding: 9px;
}

button.play,
button.pause {
  margin: 0 6px;
  background: var(--color-core) !important;
  color: var(--color-secondary-background);

  .fullPageMode & {
    color: var(--color-primary-background);
  }

  &:disabled {
    background: var(--color-text) !important;
    opacity: 0.3;
  }
}

button.play {
  padding: 10px 8px 10px 12px;
}

button.pause {
  padding: 11px;
}

button.volume {
  margin-right: 2px;
}

button.expand {
  padding: 12px;
}

button.queue {
  padding: 11px;
  margin-right: 0;
}

button.active {
  color: var(--color-core);
}

.offline {
  width: 36px;
  height: 36px;
  padding: 6px;
  margin-left: 4px;
  background: var(--color-text) !important;
  color: var(--color-secondary-background) !important;
  cursor: default;
}

.loading {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;

  background-image: url(../../../images/loading-black.gif);
  background-image: url(../../../images/loading-black.png);
  background-size: 24px 24px;
  background-position: center;
  background-repeat: no-repeat;
}

// SCRUBBER

.scrubber {
  display: flex;
  align-items: center;
  margin: 4px auto -6px;
}

.scrubSlider {
  width: 100%;
}

.scrubLeft,
.scrubRight {
  min-width: 35px;
  padding-bottom: 1px;
  font-size: 10px;
  line-height: 1;
  color: var(--color-opacity-07);
}
.scrubLeft {
  margin-right: 8px;
  text-align: right;
}
.scrubRight {
  margin-left: 8px;
  text-align: left;
}

// SECONDARY CONTROLS

.rightSection {
  margin: 0 0 0 auto;
}

.secondaryControls {
  display: flex;
  align-items: center;

  // &.fullPageMode {
  //   opacity: 0.4;

  //   &:hover,
  //   &:focus-within {
  //     opacity: 1;
  //   }
  // }
}

.secondaryButtons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;

  // @media (min-width: 1024px) {
  //   gap: 10px;
  // }

  .volSlider + & {
    margin-left: 6px;
  }
}

.volSlider {
  width: 100px;

  @media (min-width: 1024px) {
    width: 120px;
  }
}
