.spinner {
  --color-highlight: 55, 132, 235;

  animation: spin 1.5s ease infinite;
  aspect-ratio: 1;
  border: 6px solid rgba(#FFF, 30%);
  border-radius: 100%;
  border-top-color: #FFF;
  display: inline-block;
  height: 100%;
  width: auto;

  &--light {
    border-width: 3px;
  }
}

.svg {
  align-items: center;
  display: flex;
  height: 100%;
  justify-content: center;
}

.user-action-indicator-container {
  align-items: center;
  animation: action-indicator-fade-out 0.55s ease;
  color: #FFF;
  display: flex;
  flex-direction: column;
  gap: 30px;
  height: 100%;
  inset: 0;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  user-select: none;
  width: 100%;
}

.user-action-indicator-text {
  align-items: center;
  background: rgba(0, 0, 0, 50%);
  border-radius: 5px;
  display: flex;
  font-size: 12px;
  font-weight: 600;
  justify-content: center;
  padding: 10px 15px;
  width: max-content;
}

.user-action-indicator {
  animation: action-indicator-icon-scale 0.5s ease;
  background: rgba(0, 0, 0, 50%);
  border-radius: 100%;
  height: 75px;
  width: 75px;
}

.user-action-indicator-icon {
  padding: 22px;

  svg {
    height: 100%;
    width: 100%;
  }
}


/* Seek Bar */

.seek-container {
  --progress-height: 3px;
  --progress-height-expanded: 16px;
  --progress-height-expanded-mobile: 12px;
  --color-seek-background: rgba(255, 255, 255, 40%);
  --color-seek-buffer: rgba(255, 255, 255, 30%);
  --color-seek-active: rgba(255, 255, 255, 50%);
  --color-seek-chapter-indicator: rgba(255, 255, 255, 40%);
  --color-seek-active-focused: #FFF;
  --color-thumbnail-text-background: #2F2F2F;
  --thumbnail-width: 350px;

  align-items: center;
  display: flex;
  height: calc(var(--progress-height-expanded) + 10px);
  position: relative;
  transition: height 0.25s ease, opacity 0.25s ease, border-radius 1.25s ease, filter 0.25s ease;
  transition-delay: 0.25s;
  width: 100%;

  * {
    transition: height 0.25s ease, width 0.25s ease, opacity 0.25s ease, border-radius 0.25s ease;
    transition-delay: 0.25s;
  }

  .thumbnail {
    animation: 0.25s fadein ease;
    bottom: 100%;
    color: transparent;
    display: flex;
    flex-direction: column;
    height: max-content;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    transition-delay: 0s;
    user-select: none;
    width: var(--thumbnail-width);

    &--visible {
      opacity: 1;
    }

    &--with-text {
      bottom: calc(100% + 50px);
    }

    &__time {
      background: rgba(0, 0, 0, 50%);
      border-radius: 15px;
      bottom: 8px;
      color: white;
      display: block;
      font-size: 14px;
      padding: 5px 10px;
      position: absolute;
      right: 8px;
      z-index: 1;
    }

    &__text {
      background-color: var(--color-thumbnail-text-background);
      border-radius: 20px;
      box-shadow: 0 0 10px rgba(0, 0, 0, 50%);
      color: white;
      font-size: 14px;
      font-weight: 600;
      margin-top: 5px;
      overflow: hidden;
      padding: 10px 15px;
      position: absolute;
      text-overflow: ellipsis;
      top: 100%;
      white-space: nowrap;
      width: 100%;
    }

    img {
      border: 1px solid rgba(255, 255, 255, 50%);
      border-radius: 20px;
      box-shadow: 0 0 10px black;
      height: auto;
      width: var(--thumbnail-width);
    }
  }

  &:hover,
  &:active,
  &:focus,
  &:focus-visible,
  &:has(:focus-visible) {
    transition-delay: unset;

    .seek-chapter-indicator {
      height: var(--progress-height-expanded);
      opacity: 1;
      transition-delay: 0.15s;
    }

    .seek-playhead,
    .seek-buffer,
    .seek-input {
      height: var(--progress-height-expanded);
      transition-delay: unset;
    }

    .seek-playhead {
      &::-webkit-progress-value {
        background-color: var(--color-seek-active-focused);
        transition-delay: unset;
      }

      &::-moz-progress-bar {
        background-color: var(--color-seek-active-focused);
        transition-delay: unset;
      }
    }

    ::-webkit-slider-thumb {
      height: var(--progress-height-expanded);
      transition-delay: unset;
    }

    ::-moz-range-thumb {
      height: var(--progress-height-expanded);
      transition-delay: unset;
    }
  }
}

.seek-chapter-indicator {
  border-right: 1px solid var(--color-seek-chapter-indicator);
  height: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  z-index: var(--layer-controls);
}

.seek-playhead,
.seek-buffer,
.seek-input {
  border-radius: 4px;
  height: var(--progress-height);
  left: 0;
  overflow: hidden;
  position: absolute;
  width: 100%;
}

.seek-playhead {
  background: transparent;
  pointer-events: none;

  &::-webkit-progress-bar {
    background: transparent;
  }

  &::-webkit-progress-value {
    background-color: var(--color-seek-active);
    transition: background-color 0.5s ease;
    transition-delay: 0.25s;
  }

  &::-moz-progress-bar {
    background-color: var(--color-seek-active);
    transition: background-color 0.5s ease;
    transition-delay: 0.25s;
  }
}

.seek-buffer {
  background: var(--color-seek-background);
  pointer-events: none;

  &::-webkit-progress-bar {
    background: transparent;
  }

  &::-webkit-progress-value {
    background-color: var(--color-seek-buffer);
  }

  &::-moz-progress-bar {
    background-color: var(--color-seek-buffer);
  }
}

.seek-input {
  appearance: none;
  cursor: pointer;
  width: 100%;
  z-index: 10000;

  &::-webkit-slider-runnable-track {
    background: transparent;
  }

  &::-webkit-slider-thumb {
    appearance: none;
    background-color: var(--color-seek-indicator);
    border: 0;
    border-radius: 5px;
    height: var(--progress-height);
    transition: height 0.25s ease, width 0.25s ease, opacity 0.25s ease, border-radius 0.25s ease;
    transition-delay: 0.25s;
    width: var(--progress-height);
  }

  &::-moz-range-track {
    background: transparent;
  }

  &::-moz-range-thumb {
    appearance: none;
    background-color: var(--color-seek-indicator);
    border: 0;
    border-radius: 5px;
    height: var(--progress-height);
    transition: height 0.25s ease, width 0.25s ease, opacity 0.25s ease, border-radius 0.25s ease;
    transition-delay: 0.25s;
    width: var(--progress-height);
  }
}

/* Volume */


.volume-controls {
  --color-volume-background: rgba(255, 255, 255, 20%);
  --color-volume-active: #fff;

  align-items: center;
  display: flex;
  height: 100%;

  &:hover,
  &:focus-visible,
  &:focus,
  &:active,
  &:has(:focus-visible),
  &:has(:focus),
  &:has(:active) {
    .volume-slider {
      margin-left: 5px !important;
      width: 80px;
    }
  }
}

.volume-slider {
  align-items: center;
  border-radius: 10px;
  display: flex;
  height: 10px;
  overflow: hidden;
  position: relative;
  transition: width 0.25s ease, margin 0.25s ease;
  width: 0;
}

.volume-input,
.volume-progress {
  height: 100%;
  left: 0;
  position: absolute;
  width: 100%;
}

.volume-progress {
  background: var(--color-volume-background);
  height: 3px;

  &::-webkit-progress-bar {
    background: transparent;
  }

  &::-webkit-progress-value {
    background-color: var(--color-volume-active);
  }

  &::-moz-progress-bar {
    background-color: var(--color-volume-active);
  }
}

.volume-input {
  appearance: none;
  cursor: pointer;
  height: 100%;
  width: 100%;

  &:focus-visible {
    border: 1px solid var(--color-highlight);
  }

  &::-webkit-slider-runnable-track {
    background: transparent;
  }

  &::-webkit-slider-thumb {
    appearance: none;
    background: transparent;
    border: 0;
    height: 0;
    width: 0;
  }

  &::-moz-range-track {
    background: transparent;
  }

  &::-moz-range-thumb {
    background: transparent;
    border: 0;
    height: 0;
    width: 0;
  }
}


/* Menus */

.menu {
  animation: 0.35s fadein ease;
  backdrop-filter: blur(10px);
  background: var(--color-menu-background);
  border-radius: 10px;
  bottom: calc(100% + 35px);
  box-shadow: 0 0 32px 0 rgba(0, 0, 0, 100%);
  color: var(--color-menu-text);
  display: grid;
  gap: 5px;

  /* stylelint-disable-next-line function-name-case */
  max-height: calc(var(--portal-height) - 100px);
  max-width: MIN(450px, CALC(var(--portal-width) * 0.8));
  min-width: 350px;
  overflow-y: auto;
  padding: 12px 8px;
  position: absolute;
  right: 0;
  width: max-content;

  .menu-option {
    /* Needs more specificity to override reset */
    text-align: left;
  }
}

.menu-option {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  display: flex;
  font-size: 16px;
  justify-content: space-between;
  min-height: 45px;
  padding: 8px 15px;
  transition: background-color 0.15s ease, color 0.15s ease;
  width: 100%;

  &.menu-option-back {
    color: var(--color-menu-text-secondary);
    justify-content: flex-start;
  }

  .menu-option-back-icon {
    align-items: center;
    display: flex;
    justify-content: center;
    margin-right: 10px;

    svg {
      height: 10px;
    }
  }

  &:hover,
  &:focus-visible,
  .focus-visible {
    background: var(--color-menu-button-focused);
    color: var(--color-menu-text);
    outline: 0!important;
  }

  &.menu-option-active {
    background: var(--color-menu-button-active);
  }
}

.menu-option-icon {
  align-items: center;
  display: flex;
  justify-content: center;
  padding-left: 30px;

  svg {
    height: 75%;
  }
}

.menu-header {
  color: var(--color-menu-text-header);
  font-weight: 500;
  pointer-events: none;
  user-select: none;
}

.verification-menu {
  color: var(--color-menu-text);
  padding: 10px 0 5px;

  &__group {
    display: flex;
    gap: 20px;
    padding: 10px 30px;
  }

  &__group-icon {
    height: 35px;
    width: 35px;

    &--cc {
      height: 30px;
      width: 30px;
    }

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

  &__group-text {
    display: grid;
    gap: 5px;
    width: 100%;
  }

  &__group-title,
  &__group-subtitle {
    align-items: center;
    display: flex;
    gap: 5px;
  }

  &__group-title {
    font-size: 16px;
  }

  &__group-subtitle {
    color: var(--color-menu-text-secondary);
    font-size: 12px;

    a {
      text-decoration: underline;
    }
  }

  &__loader {
    align-items: center;
    border-width: 3px;
    display: flex;
    height: 18px;
    width: 18px;
  }

  &__details {
    background: var(--color-menu-background-secondary);
    border-radius: 5px;
    display: grid;
    gap: 15px;
    padding: 20px 30px;
  }

  &__detail {
    align-items: center;
    display: flex;
    font-size: 16px;
    gap: 10px;
    min-height: 30px;
    overflow: hidden;
    position: relative;
    width: 100%;

    a {
      text-decoration: underline;
    }
  }

  &__detail-label {
    color: var(--color-menu-text-secondary);
    white-space: nowrap;
  }

  &__detail-value {
    max-width: 100%;
    overflow: hidden;
    padding-right: 40px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  &__detail-copy {
    color: var(--color-menu-text-secondary);
    height: 18px;
    position: absolute;
    right: 0;

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

  &__inline-icon {
    height: 100%;
    padding: 3px 0;

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

  &--details {
    max-width: MIN(800px, CALC(var(--portal-width) * 0.8));

    .verification-menu__group-icon {
      height: 45px;
      width: 45px;

      &--cc {
        height: 38px;
        width: 38px;
      }
    }

    .verification-menu__group-title {
      font-size: 18px;
    }

    .verification-menu__group-subtitle {
      font-size: 14px;
    }
  }
}

.dvr-toggle {
  --border-color: #a2a3a3;

  display: flex;
  height: 30px;
  position: relative;

  &__border {
    border: 2px solid var(--border-color);
    border-radius: 5px;
    height: 100%;
    inset: 0;
    opacity: 0.5;
    position: absolute;
    z-index: 0;
  }

  &__live,
  &__dvr {
    align-items: center;
    border-radius: 5px;
    color: var(--border-color);
    cursor: pointer!important;
    display: flex;
    font-size: 16px;
    font-weight: 500;
    height: 100%;
    justify-content: center;
    opacity: 0.5;
    transition: background-color 0.25s ease, color 0.25s ease, opacity 0.25s ease;
    width: 75px;
    z-index: 1;

    &--active {
      color: var(--color-text);
      opacity: 1;
    }
  }

  &__live {
    &--active {
      background-color: #ea3323;
    }
  }

  &__dvr {
    &--active {
      background-color: #4666ac;
    }
  }
}

/* Player size/orientation adjustments */

:global(.__eluvio-player--size-md),
:global(.__eluvio-player--size-sm) {
  .menu-option {
    font-size: 14px;
    min-height: unset;
    padding: 3px 10px;
  }

  .verification-menu {
    max-height: calc(0.5 * var(--portal-height))!important;
    overflow-y: auto;

    &__inline-icon,
    &__group-icon {
      height: 20px;
      width: 20px;

      &--cc {
        height: 20px;
        width: 20px;
      }
    }

    &__group {
      align-items: center;
    }

    &__group-text {
      padding-right: 10px;
      width: 100%;
    }

    &__details,
    &__group {
      padding-inline: 10px;
    }

    &__group-title {
      font-size: 12px;
    }

    &__group-subtitle {
      font-size: 10px;
    }

    &__detail {
      align-items: flex-start;
      flex-direction: column;
      justify-content: center;
    }

    &__detail-label,
    &__detail-value {
      font-size: 10px;
    }

    &__detail-copy {
      height: 15px;
    }
  }

  .dvr-toggle {
    height: 25px;

    &__border {
      border-width: 1px;
    }

    &__live,
    &__dvr {
      font-size: 10px;
      width: 40px;
    }
  }
}

:global(.__eluvio-player--size-md) {
  .seek-container {
    --thumbnail-width: 225px;
  }

  .thumbnail {
    &__text {
      font-size: 12px;
    }
  }
}

:global(.__eluvio-player--size-sm) {
  .volume-slider {
    display: none;
  }

  .menu {
    bottom: 40px;
    gap: 5px;
    max-height: calc(var(--portal-height) - 50px);
    max-width: min(600px, calc(var(--portal-width) - 30px));
    min-height: unset;
    min-width: min(600px, calc(var(--portal-width) - 30px));
    padding: 5px;
    right: 10px;
  }

  .menu-option {
    font-size: 10px;
    min-height: 20px;
    padding: 2px 10px;
  }

  .menu-option-icon {
    height: 20px;
  }

  .seek-container {
    --thumbnail-width: 150px;

    height: calc(var(--progress-height-expanded) + 5px);
    position: relative;

    &:hover,
    &:active,
    &:focus,
    &:focus-visible,
    &:has(:focus-visible) {
      .seek-playhead,
      .seek-buffer,
      .seek-input {
        border-radius: 10px;
        height: var(--progress-height-expanded-mobile);
      }

      ::-webkit-slider-thumb {
        border-radius: 100%;
        height: var(--progress-height-expanded-mobile);
        width: var(--progress-height-expanded-mobile);
      }

      ::-moz-range-thumb {
        border-radius: 100%;
        height: var(--progress-height-expanded-mobile);
        width: var(--progress-height-expanded-mobile);
      }
    }
  }

  .thumbnail {
    &__time {
      font-size: 12px;
    }

    &__text {
      font-size: 10px;
      padding: 7px 10px;
    }
  }
}

.copy-button {
  transition: color 0.75s ease;

  &--copied {
    color: #FFF;
    transition: color 0.15s ease;
  }
}


/* Animations */


@keyframes spin {
  to { transform: rotate(360deg); }
}

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

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


@keyframes action-indicator-fade-out {
  0% { opacity: 0; }
  5% { opacity: 0.8; }
  35% { opacity: 0.8; }
  100% { opacity: 0; }
}

@keyframes action-indicator-icon-scale {
  from { transform: scale(0.5); }
  to { transform: scale(1); }
}
