.bfsg-video .mejs__controls {
  background: var(--rg-videoPlayer-backgroundColor, #4c4c4c);
  flex-wrap: wrap;
  height: 88px;
}

.bfsg-video .mejs__time-rail {
  width: calc(100% - 140px);
}

.bfsg-video .mejs__playpause-button {
  margin-right: auto;
}

.bfsg-video .mejs__time {
  font-size: 1.125rem;
}

/* Disabled see https://getraenkeundmehr.atlassian.net/browse/CMS-2573
.bfsg-video .mejs__captions-layer.mejs__layer {
  bottom: 55px;
}
*/

.bfsg-video .mejs__captions-text,
.bfsg-video .mejs__captions-text * {
  background: hsla(0, 0%, 8%, 0.5);
  -webkit-box-shadow: 0.3125rem 0 0 hsla(0, 0%, 8%, 0.5),
    -0.3125rem 0 0 hsla(0, 0%, 8%, 0.5);
  box-shadow: 0.3125rem 0 0 hsla(0, 0%, 8%, 0.5),
    -0.3125rem 0 0 hsla(0, 0%, 8%, 0.5);
  padding: 0;
  white-space: pre-wrap;
}

.bfsg-video .mejs__layers .mejs__captions-layer {
  font-weight: 600;
  font-size: 20px;
  line-height: 26px;
  max-height: 100%;
  max-width: 100%;
}

/* Custom Control Buttons */
.bfsg-video .mejs__button > button:focus {
  box-sizing: border-box;
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  border: 1px solid white;
  -webkit-box-shadow: 0 0 0 2px #fff;
  box-shadow: 0 0 0 2px #fff;
  outline: 1px dotted #999;
}

.bfsg-video .mejs__button > button {
  margin: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
}

.bfsg-video .mejs__button > button::before {
  box-sizing: border-box;
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  position: absolute;
  content: "";
  width: 35px;
  height: 35px;
}

.bfsg-video .mejs__button {
  width: 44px;
  height: 44px;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.bfsg-video
  .mejs__button.mejs__captions-button
  .mejs__captions-selector.mejs__offscreen {
  display: none;
}

/* CUSTOM Postitions TODO: Should be removed after proper Icons in MediaElement Version > 7 */

.bfsg-video button {
  background: none !important;
  background-image: none !important;
  opacity: 1;
}

.mejs__play > button:before {
  background-image: url("custom_icons/Play.svg");
  background-image: url("bfsg-videoplayer-icons/play.svg");
}

.mejs__pause > button:before {
  background-image: url("custom_icons/Pause.svg");
  background-image: url("bfsg-videoplayer-icons/pause.svg");
}

.mejs__mute > button:before {
  background-image: url("custom_icons/Laut.svg");
  background-image: url("bfsg-videoplayer-icons/laut.svg");
}

.mejs__unmute > button:before {
  background-image: url("custom_icons/Mute.svg");
  background-image: url("bfsg-videoplayer-icons/mute.svg");
}

.mejs__fullscreen-button > button:before {
  background-image: url("custom_icons/gross.svg");
  background-image: url("bfsg-videoplayer-icons/gross.svg");
}

.mejs__fullscreen-button.mejs__unfullscreen > button:before {
  background-image: url("custom_icons/klein.svg");
  background-image: url("bfsg-videoplayer-icons/klein.svg");
}

.mejs__replay > button:before {
  background-image: url("custom_icons/Restart.svg");
  background-image: url("bfsg-videoplayer-icons/restart.svg");
}

.mejs__captions-button > button:before {
  background-image: url("custom_icons/CC.svg");
  background-image: url("bfsg-videoplayer-icons/cc.svg");
}

.mejs__captions-button.mejs__captions-enabled > button:before {
  background-image: url("custom_icons/CC-inv.svg");
  background-image: url("bfsg-videoplayer-icons/cc-inv.svg");
}

.mejs__audio-description-button > button:before {
  background-image: url("custom_icons/AD.svg");
  background-image: url("bfsg-videoplayer-icons/ad.svg");
}

.mejs__audio-description-button.audio-description-on > button:before {
  background-image: url("custom_icons/AD-inv.svg");
  background-image: url("bfsg-videoplayer-icons/ad-inv.svg");
}

/* ADAPTIONS */

.bfsg-video {
  margin-bottom: 1rem;
  position: relative;
}

.bfsg-video .mejs__container {
  margin-bottom: 88px;
  min-width: unset !important;
}

.bfsg-video .mejs__container .mejs__controls {
  bottom: -88px;
}

.bfsg-video .mejs__fullscreen .mejs__container .mejs__controls {
  bottom: 0;
}

.bfsg-video .mejs__container-fullscreen video {
  object-fit: contain !important;
  padding-bottom: 88px;
}

.bfsg-video .mejs__container-fullscreen .mejs__overlay {
  padding-bottom: 88px;
}

.bfsg-video .mejs__overlay-button {
  position: relative;
}

.bfsg-video .mejs__overlay-button:focus,
.bfsg-video .mejs__overlay-button:focus-visible {
  outline: none;
}

.bfsg-video .mejs__overlay-button:focus-visible::before {
  content: "";
  position: absolute;
  left: -4px;
  top: -4px;
  right: -4px;
  bottom: -4px;
  display: block;
  border: 2px solid #fff;
  border-radius: 100%;
  outline: 2px solid #000;
}

.bfsg-video .mejs__button > button:focus {
  border: none;
  box-shadow: none;
  outline: none;
}

.bfsg-video .mejs__button > button:focus-visible {
  border: 2px solid #fff;
  outline: 2px solid #000;
}

.bfsg-video .mejs__time-slider:focus-visible {
  border: 2px solid #fff;
  outline: 2px solid #000;
}

.bfsg-video .mejs__volume-slider:focus-visible {
  border: 2px solid #fff;
  outline: 2px solid #000;
}

.bfsg-video .mejs__button.mejs__fullscreen-button {
  overflow: visible !important;
}

.bfsg-video .mejs__inner:not(.mejs__container-fullscreen *) {
  aspect-ratio: 16 / 9;
}

.bfsg-video:has(.mejs__container.mejs__video:focus-visible)::before {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  bottom: 2px;
  left: 2px;
  border: 2px solid #fff;
  outline: 2px solid #000;
  z-index: 4;
  pointer-events: none;
}
