/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

@namespace xul url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
@namespace url("http://www.w3.org/1999/xhtml");

video > xul|videocontrols,
audio > xul|videocontrols {
  writing-mode: horizontal-tb;
  width: 100%;
  height: 100%;
  display: inline-block;
  overflow: hidden;
}

.controlBar {
  --clickToPlay-width: 48px;
  --clickToPlay-height: var(--clickToPlay-width);
  --playButton-width: 30px;
  --playButton-height: var(--playButton-width);
  --scrubberStack-width: 64px;
  --muteButton-width: 30px;
  --volumeStack-width: 48px;
  --closedCaptionButton-width: 30px;
  --fullscreenButton-width: 30px;

  --positionDurationBox-width: 40px;
  --durationSpan-width: 40px;
  --positionDurationBox-width-long: 60px;
  --durationSpan-width-long: 60px;
}

.controlsContainer [hidden="true"],
.controlBar[hidden] {
  display: none;
}

.controlBar[size="hidden"] {
  display: none;
}

.controlsSpacer[hideCursor] {
  cursor: none;
}

.controlsContainer,
.progressContainer {
  position: relative;
  height: 100%;
}

.stackItem {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
}

.statusOverlay {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: rgb(80,80,80, .85);
}

.controlsOverlay {
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}

.controlsSpacerStack {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: center;
  align-items: center;
}

.controlBar {
  position: relative;
  display: flex;
  box-sizing: border-box;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  height: 40px;
  padding: 0 9px;
  background-color: rgba(26,26,26,.8);
}

.playButton,
.muteButton,
.closedCaptionButton,
.fullscreenButton {
  height: 100%;
  min-width: var(--playButton-width);
  min-height: var(--playButton-height);
  padding: 6px;
  border: 0;
  margin: 0;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-origin: content-box;
  background-clip: content-box;
  -moz-context-properties: fill;
  fill: #ffffff;
}

.playButton:hover,
.muteButton:hover,
.closedCaptionButton:hover,
.fullscreenButton:hover {
  fill: #48a0f7;
}

.playButton:hover:active,
.muteButton:hover:active,
.closedCaptionButton:hover:active,
.fullscreenButton:hover:active {
  fill: #2d89e6;
}

.playButton {
  background-image: url(chrome://global/skin/media/pauseButton.svg);
}
.playButton[paused] {
  background-image: url(chrome://global/skin/media/playButton.svg);
}

.muteButton {
  background-image: url(chrome://global/skin/media/audioUnmutedButton.svg);
}
.muteButton[muted] {
  background-image: url(chrome://global/skin/media/audioMutedButton.svg);
}
.muteButton[noAudio],
.muteButton[noAudio]:hover,
.muteButton[noAudio]:hover:active {
  background-image: url(chrome://global/skin/media/audioNoAudioButton.svg);
  fill: white;
}
.muteButton[noAudio] + .volumeStack {
  display: none;
}

.closedCaptionButton {
  background-image: url(chrome://global/skin/media/closedCaptionButton-cc-off.svg);
}
.closedCaptionButton[enabled] {
  background-image: url(chrome://global/skin/media/closedCaptionButton-cc-on.svg);
}

.fullscreenButton {
  background-image: url(chrome://global/skin/media/fullscreenEnterButton.svg);
}
.fullscreenButton[fullscreened] {
  background-image: url(chrome://global/skin/media/fullscreenExitButton.svg);
}

.controlBarSpacer {
  flex-grow: 1;
}

.volumeControl::-moz-range-thumb,
.scrubber::-moz-range-thumb {
  height: 13px;
  width: 13px;
  border: none;
  border-radius: 50%;
  background-color: #ffffff;
  filter: drop-shadow(0px 0px 2px rgba(0,0,0,0.65));
}

.volumeControl::-moz-focus-outer,
.scrubber::-moz-focus-outer {
  border: 0;
}

.progressBackgroundBar {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.progressStack {
  position: relative;
  width: 100%;
  height: 5px;
}

.scrubberStack {
  /* minus margin to get basis of required width */
  min-width: calc(var(--scrubberStack-width) - 18px);
  flex-basis: calc(var(--scrubberStack-width) - 18px);
  flex-grow: 2;
  flex-shrink: 0;
  margin: 0 9px;
}

.volumeStack {
  max-width: 60px;
  min-width: var(--volumeStack-width);
  flex-grow: 1;
  flex-shrink: 0;
  margin-right: 6px;
  margin-left: 4px;
}

.bufferBar,
.progressBar,
.scrubber,
.volumeBackground,
.volumeControl {
  bottom: 0;
  left: 0;
  position: absolute;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 2.5px;
  margin: 0;
  background: none;
  background-color: transparent;
}

.bufferBar,
.volumeBackground {
  background-color: rgba(0,0,0,0.7);
}

.bufferBar::-moz-progress-bar,
.progressBar::-moz-progress-bar,
.volumeBackground::-moz-meter-bar {
  height: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 2.5px;
  background: none;
}

.scrubber:hover::-moz-range-thumb,
.volumeControl:hover::-moz-range-thumb {
  background-color: #48a0f7;
}

.scrubber:active::-moz-range-thumb,
.volumeControl:active::-moz-range-thumb {
  background-color: #2d89e6;
}

.scrubber::-moz-range-track,
.scrubber::-moz-range-progress {
  background-color: transparent;
}

.volumeControl::-moz-range-progress,
.volumeControl::-moz-range-track {
  height: 5px;
  border-radius: 2.5px;
}

.volumeControl::-moz-range-progress {
  background-color: #ffffff;
}

.volumeControl::-moz-range-track {
  background-color: rgba(0,0,0,0.7);
}


.bufferBar::-moz-progress-bar {
  background-color: rgba(255,255,255,0.3);
  border-radius: 2.5px;
}

.progressBar::-moz-progress-bar {
  background-color: #00b6f0;
}

.textTrackList {
  position: absolute;
  right: 5px;
  bottom: 45px;
  max-width: 80%;
  border: 1px solid #000000;
  border-radius: 2.5px;
  padding: 5px 0;
  vertical-align: middle;
  font-size: 12px;
  background-color: #000000;
  opacity: 0.7;
}

.textTrackList > .textTrackItem {
  display: block;
  width: 100%;
  height: 30px;
  padding: 2px 10px;
  border: none;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  color: #ffffff;
  background-color: transparent;
}

.textTrackList > .textTrackItem:hover {
  background-color: #444444;
}

.textTrackList > .textTrackItem[on] {
  color: #48a0f7;
}

.positionLabel,
.durationLabel {
  display: none;
}

.positionDurationBox {
  text-align: center;
  padding-inline-start: 1px;
  padding-inline-end: 9px;
  white-space: nowrap;
  font: message-box;
  font-size: 13px;
  font-size-adjust: 0.55;
  color: #ffffff;
}

%ifdef XP_MACOSX
.positionDurationBox {
  font-size-adjust: unset;
  font-family: "Helvetica Neue", "Helvetica", sans-serif;
}
%endif

.duration {
  display: inline-block;
  white-space: pre;
  color: #929292;
}

.statusIcon {
  width: 36px;
  height: 36px;
  margin-bottom: 20px;
}

.statusIcon[type="throbber"] {
  background: url(chrome://global/skin/media/throbber.png) no-repeat center;
}

.statusIcon[type="throbber"][stalled] {
  background: url(chrome://global/skin/media/stalled.png) no-repeat center;
}

.statusIcon[type="error"] {
  min-width: 70px;
  min-height: 60px;
  background: url(chrome://global/skin/media/error.png) no-repeat center;
  background-size: contain;
}

/* Overlay Play button */
.clickToPlay {
  min-width: var(--clickToPlay-width);
  min-height: var(--clickToPlay-height);
  border-radius: 50%;
  background-image: url(chrome://global/skin/media/playButton.svg);
  background-repeat: no-repeat;
  background-position: 54% 50%;
  background-size: 40% 40%;
  background-color: #1a1a1a;
  -moz-context-properties: fill;
  fill: #ffffff;
  opacity: 0.8;
  position: relative;
  top: 20px;
}

.controlsSpacerStack:hover > .clickToPlay,
.clickToPlay:hover {
  opacity: 0.55;
}

.controlsSpacerStack:hover > .clickToPlay[fadeout] {
  opacity: 0;
}

.controlBar[fullscreen-unavailable] .fullscreenButton {
  display: none;
}

/* CSS Transitions */
.clickToPlay {
  transition-property: transform, opacity;
  transition-duration: 400ms, 400ms;
}

.controlsSpacer[fadeout] {
  opacity: 0;
}

.clickToPlay[fadeout] {
  transform: scale(3);
  opacity: 0;
}

.clickToPlay[fadeout][immediate] {
  transition-property: opacity, background-size;
  transition-duration: 0s, 0s;
}
.controlBar:not([immediate]) {
  transition-property: opacity;
  transition-duration: 200ms;
}
.controlBar[fadeout] {
  opacity: 0;
}
.volumeStack:not([immediate]) {
  transition-property: opacity, margin-top;
  transition-duration: 200ms, 200ms;
}
.statusOverlay:not([immediate]) {
  transition-property: opacity;
  transition-duration: 300ms;
  transition-delay: 750ms;
}
.statusOverlay[fadeout],
.statusOverlay[error] + .controlsOverlay > .controlsSpacerStack {
  opacity: 0;
}

/* Error description formatting */
.errorLabel {
  padding: 0 10px;
  text-align: center;
  font: message-box;
  font-size: 14px;
  color: #ffffff;
}

.errorLabel {
  display: none;
}

[error="errorAborted"]         > [anonid="errorAborted"],
[error="errorNetwork"]         > [anonid="errorNetwork"],
[error="errorDecode"]          > [anonid="errorDecode"],
[error="errorSrcNotSupported"] > [anonid="errorSrcNotSupported"],
[error="errorNoSource"]        > [anonid="errorNoSource"],
[error="errorGeneric"]         > [anonid="errorGeneric"] {
  display: inline;
}

%ifdef XP_WIN
@media (-moz-windows-default-theme: 0) {
  .controlsSpacer,
  .clickToPlay {
    background-color: transparent;
  }
}
%endif
