.container {
  align-items: center;
  bottom: 0;
  display: flex;
  height: 100%;
  justify-content: center;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  width: 100%;

  --layer-gradient: 1;
  --layer-title: 2;
  --layer-controls: 3;
  --layer-menu: 5;

  --color-text: #FFF;
  --color-text-secondary: #DDD;
  --color-text-highlight: #5e9ff3;

  --color-button: #FFF;

  --color-menu-background: rgba(0, 0, 0, 75%);
  --color-menu-background-secondary: #000;
  --color-menu-button-active: rgba(255, 255, 255, 10%);
  --color-menu-button-focused: rgba(255, 255, 255, 15%);
  --color-menu-text: #EEE;
  --color-menu-text-secondary: #AEAEAE;
  --color-menu-text-header: #FFF;

  --content-image-size: 125px;

  :global(.focus-visible) {
    outline: 1px solid var(--color-highlight) !important;
  }

  &--default-controls {
    pointer-events: none;
    user-select: none;
  }

  &:global(.menu-active) {
    .bottom-controls-container {
      z-index: var(--layer-menu);
    }
  }
}

.autohide {
  cursor: none;

  &:not(:has(:focus-visible)) {
    .info-container,
    .bottom-controls-container--autohide,
    .floating-volume-toggle {
      opacity: 0;
      pointer-events: none;
      user-select: none;
    }
  }
}

.icon-button {
  align-items: center;
  color: var(--color-button);
  display: flex;
  height: 30px;
  padding: 4px;
  transition: color 0.15s ease;
  width: 30px;

  svg {
    height: 100%;
    max-width: 100%;
    width: auto;
  }

  &-active {
    color: var(--color-text-highlight);

    * {
      color: var(--color-text-highlight);
    }
  }

  &--no-padding {
    padding: 0;
  }

  &:disabled {
    opacity: 0.5;
  }
}

google-cast-launcher {
  --disconnected-color: var(--color-button)!important;
  --connected-color: var(--color-text-highlight)!important;

  animation: 0.5s fadein ease!important;
  cursor: pointer;
  height: 30px!important;
  width: 30px!important;

  * {
    transition: color 0.15s ease;
  }
}

/* Content Info */

.info-container {
  background: linear-gradient(rgba(0, 0, 0, 70%), rgba(0, 0, 0, 40%) 70%, rgba(0, 0, 0, 15%) 90%, transparent);
  color: #fff;
  display: flex;
  gap: 30px;
  line-height: 1.5em;
  overflow-wrap: break-word;
  padding: 25px 100px 50px 15px;
  position: absolute;
  top: 0;
  transition: opacity 0.5s ease;
  user-select: none;
  width: 100%;
  word-break: break-word;
  word-wrap: break-word;
  z-index: var(--layer-title);
}

.info-image-container {
  border-radius: 5px;
  height: var(--content-image-size);
  min-height: var(--content-image-size);
  min-width: var(--content-image-size);
  overflow: hidden;
  width: var(--content-image-size);
}

.info-image {
  height: 100%;
  object-fit: cover;
  object-position: center;
  width: 100%;
}

.info-text {
  align-content: start;
  display: grid;
  flex-grow: 1;
  gap: 3px;
  height: 100%;
  max-width: 1000px;
}

.info-headers {
  color: var(--color-text-secondary);
  display: flex;
  flex-wrap: wrap;
  font-size: 14px;
  font-weight: 600;
  gap: 20px;
  margin-bottom: 5px;
}

.info-description {
  color: var(--color-text);
  font-size: 18px;
  margin-top: 10px;
}

.info-title {
  font-size: 24px;
  font-weight: 600;
}

.info-subtitle {
  color: var(--color-text-secondary);
  font-size: 20px;
  font-weight: 400;
  margin-top: 8px;
}


/* Controls */

.center-play-button {
  height: 100px;
  margin-bottom: 30px;
  transition: opacity 0.5s ease;
  width: 100px;
  z-index: var(--layer-controls);

  &--hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    user-select: none;
  }
}

.seek {
  margin-bottom: 3px;

  /* Increased specificity to ensure variables are overriden */
  &.seek {
    --color-seek-active-focused: var(--color-highlight);
    --color-seek-active: var(--color-highlight);
    --color-seek-indicator: white;
  }
}

.bottom-controls-container {
  bottom: 0;
  max-width: 100%;
  padding: 0 5px 5px;
  position: absolute;
  transition: opacity 0.5s ease;
  width: 100%;
  z-index: var(--layer-controls);
}

.bottom-controls-gradient {
  background: linear-gradient(transparent, rgba(0,0,0,100%));
  bottom: 0;
  height: 150%;
  left: 0;
  opacity: 0.5;
  pointer-events: none;
  position: absolute;
  right: 0;
  user-select: none;
  z-index: var(--layer-gradient);
}

.controls {
  align-items: center;
  color: #fff;
  display: flex;
  gap: 12px;
  height: 50px;
  padding: 6px 10px 12px;
  position: relative;
  z-index: var(--layer-controls);

  .play-pause-button {
    padding: 0;
  }
}

.time {
  align-items: center;
  display: flex;
  font-size: 14px;
  gap: 10px;
  min-width: 100px;
  user-select: none;
  white-space: nowrap;
}

.live-indicator {
  background: #F00;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 600;
  padding: 3px 10px;
  text-transform: uppercase;
  transition: opacity 0.25s ease, background 0.15s ease, color 0.15s ease;
  user-select: none;

  &--faded {
    background: #333;
    opacity: 0.75;
  }

  &:hover {
    opacity: 1;
  }
}

.collection-button-container {
  align-items: center;
  display: flex;
  height: 100%;

  &:hover,
  &:focus-visible,
  &:has(:focus-visible) {
    .collection-button-text {
      margin-left: 5px !important;
      max-width: 200px;
      transition: width 0.25s ease, margin 0.25s ease;
      width: 200px;
    }
  }

  &:hover {
    .collection-button-text {
      transition-delay: 0.5s;
    }
  }

  &--loading {
    .collection-button-text {
      display: none;
    }
  }

  .icon-button {
    padding: 8px;
  }
}

.collection-button-text {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: width 0.25s ease, margin 0.25s ease;
  white-space: nowrap;
  width: 0;
}

.spacer {
  flex-grow: 1;
}

.floating-volume-toggle {
  bottom: 20px;
  height: 30px;
  position: absolute;
  right: 30px;
  transition: opacity 0.5s ease;
  width: 30px;

  &.floating-volume-toggle {
    button {
      height: 100%;
      width: 100%;
    }
  }
}

.watermark {
  height: auto;
  pointer-events: none;
  position: absolute;
  right: 20px;
  top: 20px;
  user-select: none;
  width: 70px;
  z-index: var(--layer-title);
}

.content-verified-badge,
.content-verification-menu-button {
  animation: 0.5s fadein ease;
}

.content-verified-badge {
  background: rgba(157, 157, 157, 40%);
  border-radius: 3px;
  font-size: 14px;
  font-weight: 500;
  padding: 3px 6px;
  user-select: none;
}

/* Menus */

.menu-control-container {
  position: relative;
  z-index: var(--layer-menu);

  .icon-button {
    border: 1px solid transparent;
    padding: 0;
    transition: background-color 0.25s ease, color 0.25s ease;

    &-active,
    &:focus-visible {
      filter: drop-shadow(0 0 3px rgba(255, 255, 255, 50%));
    }
  }
}

/* Player size modifications */

:global(.__eluvio-player--size-md) {
  .container {
    --content-image-size: 90px;
  }

  .time {
    font-size: 12px;
  }

  .center-play-button {
    height: 75px;
    width: 75px;
  }

  .info-container {
    gap: 20px;
    padding-top: 15px;
  }

  .info-title {
    font-size: 18px;
  }

  .info-subtitle {
    font-size: 14px;
  }

  .info-description {
    font-size: 14px;
  }
}

:global(.__eluvio-player--size-sm) {
  .container {
    --content-image-size: 65px;
  }

  .icon-button {
    height: 18px;
    min-width: 18px;
    width: 18px;
  }

  .controls {
    gap: 8px;
    height: max-content;
    padding: 0 5px 5px;
  }

  .center-play-button {
    height: 50px;
    margin-bottom: 15px;
    width: 50px;
  }

  /* Position menus relative to whole player */
  .menu-control-container {
    position: unset;
  }

  .menu {
    bottom: 65px;
    max-width: calc(100% - 30px);
    right: 15px;
  }

  .live-indicator {
    font-size: 10px;
    padding: 1px 5px;
  }

  .info-container {
    padding: 10px 20px 20px 10px;

    * {
      line-height: 1.8em;
      margin: 0;
    }
  }

  .error-message {
    &__message {
      font-size: 11px;
    }

    &__copy-debug-button {
      display: none;
    }
  }

  .info-text {
    gap: 0;
  }

  .info-headers {
    font-size: 10px;
  }

  .info-title {
    font-size: 11px;
  }

  .info-subtitle {
    font-size: 10px;
  }

  .info-description {
    font-size: 9px;
  }

  .time {
    font-size: 10px;
    font-weight: 800;
    min-width: max-content;
  }

  .collection-button-text {
    display: none;
  }

  .watermark {
    right: 10px;
    top: 10px;
    width: 50px;
  }

  .content-verified-badge {
    display: none;
  }
}

/* Animations */

@keyframes fadein {
  from { opacity: 0; }
  to { opacity: 1; }
}
