/* Media controls */
#media-controls {
  height: 60px;
  background-color: #222;
  text-align: center;
  display: flex;
  position: relative;
}
.light #media-controls {
  background-color: #1b1b1b;
}
#main-controls {
  display: inline-block;
  margin: auto;
  height: 100%;
}
#secondary-controls {
  display: inline-block;
  height: 100%;
  position: relative;
}
#volume-control {
  float: left;
  height: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  overflow: hidden;
  position: relative;
  padding-right: 10px;
}

/* Media control buttons */
.media-control {
  height: 100%;
  width: 60px;
  border: none;
  background: none;
  padding: 0;
  text-align: center;
  vertical-align: top;
  float: left;
  cursor: pointer;
  position: relative;
}
.media-control:not(:disabled):hover,
.media-control:focus,
.media-control.checked {
  background-color: rgba(255,255,255,0.05);
}
.disabled #main-controls, .disabled #speed-btn {
  opacity: 0.6;
  pointer-events: none;
}
/* This is used to show the icon */
.media-control::after {
  content: "";
  width: 28px;
  height: 28px;
  display: inline-block;
  fill: white;
  margin-top: 4px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  filter: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg"><filter id="a"><feComposite in="FillPaint" in2="SourceGraphic" operator="in"/></filter></svg>#a');
}
.media-control.checked::after {
  fill: var(--theme-highlight-color);
}

#loop.loop-one::before {
  content: "1";
  display: inline-block;
  background: var(--theme-highlight-color);
  color: var(--theme-contrast-color);
  border-radius: 100%;
  width: 1.5em;
  height: 1.5em;
  line-height: 1.5em;
  text-align: center;
  position: absolute;
  right: 1em;
  z-index: 99;
  box-shadow: inset 0 0 0 1px #222;
}
@supports ((-webkit-mask: url(../img/pause.svg)) or (mask-image: url(../img/pause.svg))) {  
  .media-control::after {
    background-color: white;
    background-image: none !important;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: cover;
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: cover;
    filter: none;
  }
  .media-control.checked::after {
    background-color: var(--theme-highlight-color);
  }
  #play-pause::after {
    -webkit-mask-image: url(../img/pause.svg);
    mask-image: url(../img/pause.svg);
  }
  #play-pause.paused::after {
    -webkit-mask-image: url(../img/play.svg);
    mask-image: url(../img/play.svg);
  }
  #stop::after {
    -webkit-mask-image: url(../img/stop.svg);
    mask-image: url(../img/stop.svg);
  }
  #previous-btn::after {
    -webkit-mask-image: url(../img/previous-song.svg);
    mask-image: url(../img/previous-song.svg);
  }
  #next-btn::after {
    -webkit-mask-image: url(../img/next-song.svg);
    mask-image: url(../img/next-song.svg);
  }
  #loop::after {
    -webkit-mask-image: url(../img/loop.svg);
    mask-image: url(../img/loop.svg);
  }
  #shuffle::after {
    -webkit-mask-image: url(../img/shuffle.svg);
    mask-image: url(../img/shuffle.svg);
  }
  #speed-btn::after {
    -webkit-mask-image: url(../img/clock.svg);
    mask-image: url(../img/clock.svg);
  }
  #settings-btn::after {
    -webkit-mask-image: url(../img/settings.svg);
    mask-image: url(../img/settings.svg);
  }
  #equalizer-btn::after {
    -webkit-mask-image: url(../img/equalizer.svg);
  }
}
/* Icons */
#play-pause::after {
  background-image: url(../img/pause.svg);
}
#play-pause.paused::after {
  background-image: url(../img/play.svg)
}
#stop::after {
  background-image: url(../img/stop.svg)
}
#previous-btn::after {
  background-image: url(../img/previous-song.svg);
}
#next-btn::after {
  background-image: url(../img/next-song.svg);
}
#loop::after {
  background-image: url(../img/loop.svg)
}
#shuffle::after {
  background-image: url(../img/shuffle.svg)
}
#speed-btn,
#equalizer-btn {
  position: relative;
}
#equalizer-btn::after {
  background-image: url(../img/equalizer.svg);
}
#speed-btn::after {
  background-image:  url(../img/clock.svg);
}
.menu {
  position: absolute;
  transition: all .3s;
  left: 0
  vertical-align: middle;
  border-radius: 2px;
  background: black;
  z-index: 4000;
  color: black;
  filter: invert(1);
  background-color: #f1f1f1;
  box-shadow: 0 0 3px #ccc;
}

.menu::after{
  content:"";
  position: absolute;
  left: 20px;
  top: 100%;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 10px 10px 0 10px;
  border-color: #f1f1f1 transparent transparent transparent;
}

#equalizer-panel {
  padding: 10px 0;
}
#equalizer-panel input{
  -webkit-appearance: slider-vertical;
  filter: invert(1);
}
#equalizer-panel input::-moz-range-track {
  background: rgba(255,255,255,.05);
  border-radius: 2px;
}
#equalizer-panel input::-moz-range-thumb {
  border: none;
  background: white;
}
#equalizer-panel .container {
  display: flex;
  align-items: stretch;
}
#equalizer-panel .container .scale {
  width: 4ch;
  align-items: flex-end;
}
#equalizer-panel .container .scale::after {
  content: " ";
  height: 1em;
  display: inline-block;
  text-align: right;
  
}
#equalizer-panel .container div {
  display: inline-flex;
  flex-direction: column;
  width: 35px;
  text-align: center;
  align-items: center;
  vertical-align: top;
}
#equalizer-panel .container div.flex {
  flex-grow: 1;
}
@supports (-webkit-appearance: slider-vertical) {
  #equalizer-panel .container div {
    align-items: stretch !important;
  }
}
#equalizer-panel label {
  font-size: 13px;
}
#speed-menu {
  width: 100px;
}
#speed-menu > select {
  -moz-appearance: none;
  width: 100%;
  border: none;
  text-align: center;
  background: none;
  font: inherit;
  overflow: hidden;
  border-radius: 2px;
}
#speed-menu > select option {
  padding: 2px 0;
  -moz-appearance: none;
}

#speed-menu > select option:hover {
  background: rgba(0, 0, 0, 0.2);
  color: rgba(255, 255, 255, 0.5);
}

#speed-menu > select:focus > option:checked {
  filter: invert(1);
}
.media-control.checked + .menu {
  bottom: 100%;
  opacity:1;
}
.media-control:not(.checked) + .menu {
  transform: scale(0);
  bottom: -100%;
  opacity: 0;
  z-index: 0;
  visibility: hidden;
  pointer-events: none;
}
#settings-btn::after {
  background-image: url(../img/settings.svg);
}

/* Volume control */
#volume-icon {
  position: relative;
  min-width: 20px;
  width: 20px;
  height: 20px;
  margin: 0 15px;
  margin-left: 5px;
  display: inline-block;
  background-size: cover;
  background-image: url(../img/volume_up.svg);
  -webkit-filter: invert(1);
  filter: invert(1);
}
#volume-control:not(:hover) #volume-icon::after {
  opacity: 0;
}
#volume-icon:not(.mute)[title]::after {
  content: attr(title);
  position: absolute;
  top: -10px;
  margin-left: 4px;
  background-color: var(--theme-highlight-color);
  color: var(--theme-contrast-color);
  filter: invert(1);
  font-size: 0.5em;
  padding: 1px;
  border-radius: 2px;
  transition: opacity 0.3s;
}
#volume-icon.half {
  background-image: url(../img/volume_down.svg);
}
#volume-icon.mute {
  background-image: url(../img/volume_mute.svg);
}
#volume-range {
  -webkit-appearance: none;
  -moz-appearance: none;
  flex: 1;
  min-width: none;
  cursor: pointer;
  height: 3px;
  margin: 0;
  transition: transform 0.2s;
  max-width: 120px !important;
}
#volume-range::-webkit-slider-runnable-track {
  background-color: var(--theme-highlight-color);
  height: 3px;
}
#volume-range::-moz-range-track {
  -moz-appearance: none;
  border: none;
  background: white;
  border-radius: 5px;
  height: 3px;
}
input[type=range]::-moz-range-thumb {
  background: var(--theme-highlight-color) !important;
  border-radius: 50%;
  height: 16px;
  width: 16px;
  border: none;
}
input[type=range]:focus::-moz-range-thumb {
  box-shadow: 0 0 0 8px rgba(255,255,255,0.1);
}
input[type=range]::-moz-range-progress {
  background-color: var(--theme-highlight-color);
  height: 3px;
  width: 1em;
}
#volume-range::-webkit-slider-track {
  -webkit-appearance: none;
  border: none;
  background: white;
  border-radius: 5px;
  height: 3px;
}
#volume-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  background: var(--theme-highlight-color);
  border-radius: 50%;
  height: 16px;
  width: 16px;
  border: none;
  transform: translateY(-50%);
}
input[type=range]:focus::-webkit-slider-thumb {
  border-radius: 100%;
  box-shadow: 0 0 0 10px rgba(255,255,255,0.1);
}
/* "Progress bar" for media */
#progress-bar {
  height: 5px;
  background: #121212;
  cursor: pointer;
}
#progress {
  background: var(--theme-highlight-color);
  height: 100%;
  width: 0;
  display: inline-block;
  vertical-align: top;
}
#tooltip {
  background: var(--theme-highlight-color);
  color: var(--theme-contrast-color);
  display: inline-block;
  position: absolute;
  font-size: 10px;
  padding: 2px;
  margin-top: -5px;
  margin-left: -35px;
  box-sizing: border-box;
  min-width: 35px;
  text-align: center;
  border-radius: 1px;
  z-index: 9;
  opacity: 0;
  transition: all 0.3s;
}
body:hover #tooltip {
  opacity: 1;
}
