@listenbrainz-blue: #353070;
@primary-color: @listenbrainz-blue;
@love-color: #c62828;
@hate-color: #353070;
@dark-color: #053b47;
@brainzplayer-height: 60px;
@brainzplayer-padding: 0px;
@cover-art-size: @brainzplayer-height - @brainzplayer-padding*2;
@big-cover-art-size: 500px;
@progress-bar-height: 4px;
@progress-bar-hover-height: 8px;
@white-background: #fff;
// Recommended minimum size required by Youtube
@youtube-player-height: 200px;
@youtube-player-width: 350px;
@youtube-drag-handle-size: 30px;
@youtube-resize-transition: height 0.25s ease-out;

#brainz-player {
  position: fixed;
  bottom: 0;
  right: 0;
  width: calc(100% - @sidenav-width);
  @media (max-width: @offscreen-sidenav-breakpoint) {
    width: 100%;
  }
  height: @brainzplayer-height;
  background: @white-background;
  display: flex;
  box-shadow: 0px -4px 12px fade(black, 20%);

  padding: @brainzplayer-padding;
  border-top: 1px solid @gray-light;
  z-index: 110;

  > * {
    flex: 1;
  }

  .content {
    display: flex;
    overflow: hidden;
    .cover-art {
      min-width: @brainzplayer-height;
      height: 100%;
      flex: 0;
      margin-right: 1em;
      // Show big preview of the cover art when hovering over it
      &:hover
        > *:not(.hidden):not(.no-album-art):not(.youtube-wrapper):not(.soundcloud) {
        // 80% of screen width max, capped at the width in pixel of big-cover-art-size
        height: min(80vw, @big-cover-art-size);
        width: min(80vw, @big-cover-art-size);
        bottom: @brainzplayer-height + @progress-bar-height;
        max-height: calc(100vh - @brainzplayer-height - @progress-bar-height);
      }

      > * {
        height: @cover-art-size;
        width: @cover-art-size;
        position: absolute;
        // transition: height, width 0.4s;
        bottom: 0;
      }

      img {
        height: inherit;
        width: inherit;
        max-height: inherit;
        object-fit: cover;
      }

      // Youtube iframe and wrapper
      .youtube-wrapper {
        position: absolute;
        bottom: @brainzplayer-height + 10px;
        right: 10px;
        height: @youtube-player-height + @youtube-drag-handle-size;
        width: @youtube-player-width;
        max-width: calc(100vw - 20px);
        z-index: 4;
        text-align: right; // to align the move and reduce buttons
        transition: @youtube-resize-transition;

        &.reduced {
          height: @youtube-drag-handle-size;
          .youtube-player {
            height: 0;
          }
        }

        .youtube-player {
          height: @youtube-player-height;
          border-radius: 8px;
          border-top-right-radius: 0; // intersection with the square drag handle
          overflow: hidden;
          transition: @youtube-resize-transition;
          > * {
            height: inherit;
          }
        }

        .youtube-drag-handle,
        .youtube-reduce-button {
          height: @youtube-drag-handle-size;
          display: inline-block;
          background: fadeout(black, 50%);
          color: @white;
        }
        .youtube-drag-handle {
          cursor: grab;
          &:active {
            cursor: grabbing;
          }
        }
      }
    }
  }

  .controls {
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    color: @primary-color;
    font-size: 1.2em;
    flex-grow: 0;

    .play {
      padding: 0 0.7em;
    }
    > * {
      transition: all 0.5s ease;
      background: none;
      &:hover {
        color: darken(@primary-color, 10%);
      }
      &.disabled {
        color: #8d8d8d;
        pointer-events: none;
      }
    }
  }

  .currently-playing {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.3em;
    overflow: hidden;
    min-width: 160px;

    .track-name,
    .artist-name {
      text-transform: uppercase;
      font-weight: 400;
      margin: 0;
    }

    .track-name {
      font-size: 1.2em;
      letter-spacing: 2px;
      color: @dark-color;
    }

    .artist-name {
      font-size: 0.8em;
      letter-spacing: 1.5px;
      color: lighten(@dark-color, 15%);
      margin: 5px 0;
    }

    .ellipsis {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .ellipsis-2-lines {
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
      text-overflow: ellipsis;
    }
  }

  .elapsed {
    display: flex;
    flex-direction: row;
    flex-grow: 0;
    align-items: center;
    padding: 1rem;
  }

  .actions {
    align-self: center;
    align-items: center;
    justify-content: flex-end;
    display: flex;

    /* Icons */
    > * {
      stroke-width: 40px;
      font-size: 1.3em;
      margin: 0 0.7em;
      max-width: 1em;
      cursor: pointer;
      color: #8d8d8d;
      &:hover {
        color: #46433a;
      }
      &.disabled {
        pointer-events: none;
        stroke: #dedede !important;
        color: #dedede !important;
      }
      &.music-service-icon {
        max-width: 1.5em;
        > svg {
          // Youtube forces us to follow their branding guidelines to the letter,
          // so we need to force a minimum height of 20px for the icon path inside the svg
          // [poo emoji]
          min-height: 26.7px;
          vertical-align: middle;
        }
      }
    }

    .love,
    .hate {
      color: transparent;
      stroke: #8d8d8d;
    }

    .love {
      &:hover {
        stroke: @love-color;
      }
      &.loved {
        stroke: transparent;
        color: @love-color;
      }
    }

    .hate {
      &:hover {
        stroke: @hate-color;
      }
      &.hated {
        stroke: transparent;
        color: @hate-color;
      }
    }

    .fa-ellipsis-vertical {
      //Thin down ellipsis icon
      stroke: @white-background;
    }
  }

  /** Progress **/
  .progress {
    position: absolute;
    height: @progress-bar-height;
    top: -@progress-bar-height;
    margin-bottom: 0;
    left: 0;
    width: 100%;
    cursor: pointer;
    z-index: 5;
    transition: height, 0.2s;

    .progress-bar {
      height: 100%;
      background-color: @primary-color;
      border-right: 2px solid @dark-color;
    }
    &:hover {
      height: @progress-bar-hover-height;
      top: -@progress-bar-hover-height;
    }

    .progress-tooltip {
      background: @primary-color;
      margin-top: -4px;
      border-radius: 24px;
      font-size: 1em;
      padding: 6px 12px;
    }
    & > ::after {
      border-color: transparent;
    }
  }

  .no-album-art {
    height: 100%;
    background-image: url(../img/logo_big.svg);
    background-repeat: no-repeat;
    background-position: center top;
    background-color: aliceblue;
    opacity: 0.3;
  }

  .dropup-content {
    // A lot of these styles are copied part from Bootstrap
    // and part from ListenBrainz (ListenCard).
    // We copy them so that we don't have to rely on them for a standalone package
    &.open {
      display: block;
    }
    display: none;
    position: absolute;
    min-width: 140px;
    box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.175);
    z-index: 6;
    border-radius: 4px;
    padding: 10px 0px;
    width: 260px;
    color: #46433a;

    //From Bootstrap styles
    top: auto;
    bottom: 100%;
    right: 0;
    margin-bottom: 2px;
    list-style: none; // In case the elements are <li> items inside a <ul>
    font-size: 14px;
    background-color: @white-background;
    border: 1px solid @gray-light; // IE8 fallback
    border: 1px solid rgba(0, 0, 0, 0.15);
    background-clip: padding-box;

    // Links within the dropdown menu
    > a,
    > button {
      display: block; // necessary for <a> tags
      width: 100%;
      background: none;
      color: inherit;
      border: none;
      padding: 5px 20px;
      font: inherit;
      cursor: pointer;
      outline: inherit;
      text-align: left;

      &:hover {
        color: @white-background;
        background-color: @orange;
      }
    }
  }
}

.queue {
  position: fixed;
  padding: 1em;
  bottom: -100%;
  transition: bottom 1s ease-in-out;
  width: 100%;
  max-width: 550px;
  height: min(500px, 100vh ~"-" @brainzplayer-height);
  background-color: #f8f8f8;
  border-top: 1px solid #ccc;
  box-shadow: -6px -1px 10px rgba(0, 0, 0, 0.2);
  overflow-y: auto;
  z-index: 109;
  right: 0;
  &.show {
    bottom: @brainzplayer-height;
  }

  .hide-queue {
    position: absolute;
    width: 2.5em;
    top: 0;
    right: 0.5em;
    padding: 0.3em 0.5em;
    border-radius: 5px;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    background: #dadada;
    margin-top: 0;
  }

  .queue-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #ccc;
  }

  .queue-item-card .main-content .drag-handle {
    align-items: center;
    cursor: move;
    flex: 0;
    display: block;
    align-self: center;
    min-width: 3em;
  }

  .queue-headers {
    font-size: 16px;
    margin-top: 4px;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #ccc;

    h4 {
      font-size: 18px;
      margin: 0;
      padding: 10px;
      padding-left: 0;
      width: 100%;
    }

    .queue-buttons {
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
  }
}
