@primary: #08949b;
@secondary: #0d696e;
@controlsHeight: 60px;
@love: #c62828;
@hate: @blue;
@player-min-height: 320px;
@card-shadow-color: #c0c0c0;
@listen-small-break: @screen-sm;
@cover-art-thumbnail-size: 66px;
@listen-card-margin-bottom: 7px;

#dashboard {
  .side-column > *:not(:last-child) {
    margin-bottom: 15px;
  }
}

.webSocket-box {
  max-height: 420px;
  min-height: 150px;
  position: relative;
  overflow: hidden;
  border-bottom-style: inset;
  .read-more {
    position: absolute;
    bottom: 0;
    width: 100%;
    text-align: center;
    padding: 100px 0 20px;
    background-image: linear-gradient(to bottom, transparent, #fff 80%);
  }
}

.card {
  background: white;
  border: 1px solid rgb(238, 238, 238);
  box-sizing: border-box;
  box-shadow: fade(@card-shadow-color, 10%) 0px 1px 1px,
    fade(@card-shadow-color, 15%) 0px 2px 2px,
    fade(@card-shadow-color, 20%) 0px 4px 4px;
  border-radius: 8px;
  height: 100%;
}
.listen-card {
  &.card {
    height: initial;
  }
  margin-bottom: @listen-card-margin-bottom;
  a:focus,
  a:hover {
    text-decoration: underline;
  }

  &.playing-now {
    background-color: rgba(255, 252, 202, 0.3) !important ;
  }

  &.current-listen {
    background-color: rgba(217, 237, 247, 0.3) !important ;
  }

  > * {
    padding: 10px;
    @media (min-width: @screen-phone) {
      padding: 15px;
    }
  }

  /** Special styles for compact size cards (i.e. charts etc.) **/
  &.compact {
    margin: 0;
    margin-bottom: 3px;
    > * {
      padding: 10px;
    }
    .main-content {
      .right-section {
        flex: 0;
        .listen-controls {
          flex-grow: 0;
          margin: unset;
        }
      }
      .listen-thumbnail {
        padding: 0;
        margin: -10px;
        margin-right: 10px;
        width: 56px;
        min-width: 56px;
        height: 56px;
        .not-mapped,
        .add-cover-art,
        .cover-art-fallback {
          min-width: 56px;
        }
        .add-cover-art > * {
          height: auto;
        }
      }
    }
  }
  .additional-content {
    border-top: 1px solid @gray-light;
    width: 100%;
    .review {
      font-style: italic;
    }
    .sent-to {
      padding-bottom: 10px;
    }
  }
  &.has-additional-content .main-content .listen-thumbnail img {
    border-bottom-left-radius: 0;
  }

  .main-content {
    display: flex;
    flex-wrap: wrap;

    > div {
      display: flex;
      flex: 1;
      justify-content: center;
    }

    .listen-thumbnail {
      flex: 0;
      padding: 0;
      margin: -10px;
      margin-right: 1em;
      width: @cover-art-thumbnail-size;
      min-width: @cover-art-thumbnail-size;
      > *:not(.track-position) {
        height: 100%;
        width: inherit;
        aspect-ratio: 1/1;
      }
      > .track-position {
        padding-left: 1.5em;
        padding-right: 0.5em;
      }
      .add-cover-art,
      .not-mapped,
      .cover-art-fallback {
        background-color: @gray-lighter;
        min-width: @cover-art-thumbnail-size;
        height: inherit;
        display: flex;
        align-items: center;
        color: #cbcbcb;
        justify-content: center;
        > * {
          font-size: @cover-art-thumbnail-size / 2;
          max-width: @cover-art-thumbnail-size / 2;
          aspect-ratio: unset;
          border-radius: unset;
          height: auto;
        }
      }
      img {
        height: inherit;
        width: inherit;
        object-fit: cover;
        border-radius: 7px 0 0 7px;
      }
      @media (min-width: @screen-phone) {
        margin: -15px;
        margin-right: 1em;
      }
      @media (min-width: @listen-small-break) {
        margin: -15px;
        margin-right: 1em;
      }
      &:not(:first-child) img {
        // If there is an element before the image, remove the rounded corners
        border-radius: 0;
      }
    }

    .listen-time {
      font-style: italic;
      font-size: 80%;
      &:extend(.text-muted);
      white-space: nowrap;
      text-align: end;
    }
    .username-and-timestamp {
      flex-direction: column;
      justify-content: center;
      padding-right: 1em;
      align-items: flex-end;
    }

    .listen-details {
      flex-direction: column;
      line-height: 1.3em;
      overflow: hidden;

      .username-and-timestamp {
        padding-right: initial;
      }
    }

    .title-duration {
      display: flex;
      flex-direction: row;
      align-items: center;
      > *:not(:first-child) {
        margin-left: 0.5rem;
      }
    }

    .right-section {
      flex-wrap: wrap-reverse;
      justify-content: flex-end;
      align-items: center;
      padding: 0;

      @media (max-width: @screen-phone) {
        flex: 0;
      }

      .listen-controls {
        margin-left: 1.5em;
      }
      > *:not(.dropdown-menu) {
        min-width: 1.5em;
        display: flex;
      }
    }

    .listen-controls {
      flex-wrap: nowrap;
      justify-content: space-around;
      position: relative; // This is need for dropdown menu positioning
      margin-left: auto; // align flexbox item at flex-end
      color: #8d8d8d;

      > button,
      > .btn {
        align-self: center;
        stroke-width: 40px;
        font-size: 18px;
        margin: 0 6px;
        width: 1em;
        padding: 0;
        &:hover {
          color: #46433a;
        }
      }

      a {
        word-break: break-word;
      }

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

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

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

      .dropdown-menu {
        min-width: 140px;
        border-radius: 4px;
        padding: 10px 0px;
        width: 260px;

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

          &:hover {
            color: #ffffff;
            background-color: @orange;
          }
        }
      }

      .badge {
        flex-shrink: 0;
        align-self: center;
      }
    }
    .recommendation-controls {
      flex: 0 140px;

      &.open .dropdown-menu {
        display: flex;
        justify-content: space-around;

        > * {
          flex: 1;
          text-align: center;
        }
      }

      .btn {
        font-size: 1em;
        color: @blue;
        background-color: white;

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

      .hate {
        color: #c62828;
      }

      .dislike {
        color: #f5873d;
      }

      .like {
        color: #b0e111;
      }

      .love {
        color: #32cd32;
      }

      .recommendation-icon {
        > span {
          stroke-width: 40px;
          font-size: 18px;
          flex: 1;
          text-align: center;
          margin: 0 0.4em;
        }

        &:hover .off,
        &.selected .off,
        & .on {
          display: none;
        }

        &:hover .on,
        &.selected .on {
          display: inline;
        }
      }
    }

    .listen-controls > .icon-only {
      color: #8d8d8d;
      width: 2em;
      min-width: 2em;
      margin-left: 0;
      margin-right: 0.5em;
      padding: 0;
    }
    .play-button {
      color: #8d8d8d;
      &.playing {
        color: @orange;
      }
    }
  }

  &.deleted {
    animation: deleted-animation 0.6s ease-in-out forwards;
    transform-origin: center;
  }

  @keyframes deleted-animation {
    0% {
      opacity: 1;
      transform: rotateX(0) scale(1);
    }

    40% {
      opacity: 0.3;
      transform: rotateX(40deg) scale(0.8);
    }

    100% {
      margin-top: -40px;
      margin-bottom: -28px;
      transform: rotateX(90deg) scale(0.8, 0.4);
    }
  }
}

.input-group-flex {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  width: 100%;
  > *:not(.form-control) {
    width: auto;
    line-height: 1.4;
  }
  > .form-control {
    flex: 1 1 120px;
  }
  > .input-group-btn {
    flex: 1;
    display: flex;
    > .btn {
      flex: 1 1 auto;
    }
  }
}

.input-group > .input-group-btn > .btn {
  margin-top: 0px;
  margin-bottom: 0px;
}

#listen-count-card {
  padding: 15px 50px;
  text-align: center;

  font-size: 24px;

  hr {
    margin: 8px 0 16px 0;
    border-top: 1px solid @gray-light;
  }
}

#compatibility-card {
  padding: 15px 50px;
  text-align: center;
  font-size: 16px;
  position: relative;

  > .info-icon {
    color: gray;
    position: absolute;
    right: 0.75em;
    top: 0.5em;
    > a {
      color: grey;
    }
  }

  hr {
    margin: 8px 0 16px 0;
    border-top: 1px solid @gray-light;
  }

  > .similarity-score {
    display: flex;
    > .progress {
      height: 15px;
      width: 300px;
      margin: 10px 5px 10px 0;
    }
    > p {
      margin: 10px 0 0 0;
    }
  }
}

#navigation.pager {
  display: flex;
  flex-wrap: wrap;
  & > .feed-button-and-date-time-picker {
    flex: 1;
    order: 0;
    display: flex;
    align-items: center;
    justify-content: center;

    @media (max-width: @screen-phone) {
      // on phones, put the datepicker below the arrow nav
      order: 1;
      margin-top: 10px;
    }
  }
}

.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;
}

#spacer {
  margin-top: 54px;
}

.empty-listens {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: @orange;

  .empty-text {
    text-align: center;
    margin: 4px 0px 0px;
    color: @asphalt;
  }

  .empty-action {
    margin-top: 12px;
    padding: 0px 8em;
    text-align: center;
    color: @asphalt;
  }

  @media (max-width: @screen-sm) {
    .empty-action {
      padding: 0px 6em;
    }
  }

  @media (max-width: @screen-xs) {
    .empty-action {
      padding: 0px 3em;
    }
  }
}

.add-listen-btn {
  margin-left: auto;
  position: relative;
  align-self: center;
}

.listen-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  line-height: 1.5em;
  h2,
  h3,
  h4,
  h5,
  h6 {
    margin: 0;
  }
  &.pills {
    justify-content: initial;
    .pill {
      margin-bottom: 0;
    }
  }
}

.user-charts-pill {
  color: unset !important;
  text-decoration: unset !important;
}
