/*!
 * Copyright 2024 ByOmakase, LLC (https://byomakase.org)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
@font-face {
  font-family: 'Lato';
  src: url('../assets/fonts/Lato/Lato-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Nunito Sans';
  src: url('../assets/fonts/Nunito_Sans/NunitoSans-VariableFont_YTLC,opsz,wdth,wght.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

$colors: (#fff #ffe500 #00ffd7 #0fe000 #ff00fe #e30013 #002dbc) (#002dbc #353535 #ff00fe #676767 #00ffd7 #353535 #fff) (#006261 #fff #00196b #676767 #8d8d8d #353535 #000);

.omakase-player {
  display: block;

  .d-none {
    display: none;
  }

  .d-block {
    display: block;
  }

  .float-start {
    float: left !important;
  }

  .float-end {
    float: right !important;
  }

  .omakase-player-wrapper {
    display: grid;
    position: relative;
    width: 700px;
    aspect-ratio: 16/9;
    container-type: inline-size;

    &.omakase-player-wrapper-compact {
      height: var(--compact-player-height, 250px);

      .omakase-video {
        opacity: 0;
      }
    }

    media-theme {
      container-type: inline-size;
    }

    &.omakase-player-wrapper-stamp {
      width: 100%;
      height: 100%;
      min-width: 160px;
      min-height: 90px;
      background-color: black;

      media-theme {
        display: contents;
        height: 100%;
        width: 100%;
      }
    }
    &.omakase-player-wrapper-audio {
      .omakase-background-image {
        display: none !important;
      }
    }

    &.omakase-player-wrapper-stamp,
    &.omakase-player-wrapper-audio {
      .omakase-video::cue {
        opacity: 0;
      }
    }

    .omakase-video {
      display: block;
      width: 100%;
      opacity: 100%;

      &.omakase-video-fill {
        object-fit: cover;
      }
    }

    .omakase-background-image {
      position: absolute;
      width: 100%;
      height: 100%;
      top: 0;
      left: 0;
      background-color: #000;
      background-image: url(/images/background-small.svg);
      background-position: bottom;
      background-size: 100%;
      background-repeat: no-repeat;

      @container (min-width: 600px) {
        background-image: url(/images/background-large.svg);

        .omakase-background-logo {
          width: 27.5%;
          aspect-ratio: 551 / 81;
          position: absolute;
          top: 5%;
          left: 5%;
          background-image: url(/images/background-logo.svg);
          background-position: top;
          background-size: 100%;
          background-repeat: no-repeat;
        }
      }
    }

    .omakase-detached-background {
      position: absolute;
      width: 100%;
      height: 100%;
      top: 0;
      left: 0;
      //background-color: #0827F5;
      background-color: #000000;
    }

    .omakase-section-bottom-right {
      position: absolute;
      right: 20px;
      bottom: 20px;
      width: 30px;
      vertical-align: bottom;

      .omakase-button-attach {
        background-color: transparent;
        background-image: url(/images/attach.svg);
        background-repeat: no-repeat;
        background-size: contain;
        background-position: center;
        border: 0;
        padding: 0;

        width: 25px;
        height: 25px;
        margin: 0 0 20px 0;
      }

      .omakase-button-fullscreen {
        background-color: transparent;
        background-image: url(/images/fullscreen.svg);
        background-repeat: no-repeat;
        background-size: contain;
        background-position: center;
        border: 0;
        padding: 0;

        width: 25px;
        height: 25px;
        margin: 0 0 0 0;
      }
    }

    .omakase-player-alerts {
      position: absolute;
      top: 26px;
      left: 20px;
      z-index: 100;

      .omakase-alert {
        display: flex;
        width: 400px;
        min-height: 44px;
        background-color: rgba(#3a3d4b, 0.7);
        border: 1px #3a3d4b;
        border-radius: 5px;
        padding: 10px;
        margin-bottom: 10px;
        position: relative;

        .omakase-alert-icon {
          width: 24px;
          height: 24px;
          flex-shrink: 0;
          background-repeat: no-repeat;

          &.icon-close {
            background-image: url(/images/alert-close.svg);
            cursor: pointer;
          }

          &.icon-warning {
            background-image: url(/images/alert-warning.svg);
          }

          &.icon-info {
            background-image: url(/images/alert-info.svg);
          }

          &.icon-error {
            background-image: url(/images/alert-error.svg);
          }
        }

        &.warning {
          color: #fdf5ad;
        }

        &.info {
          color: #cacfea;
        }

        &.error {
          color: #ff0000;
        }

        &.alert-stack {
          position: absolute;

          .icon-close {
            display: none;
          }

          .alert-text,
          .omakase-alert-icon {
            filter: blur(2px);
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
          }
        }

        &.alert-hide {
          display: none;
        }

        .alert-text {
          flex-grow: 1;
          padding: 0 5px;
        }

        .alert-close {
          cursor: pointer;
        }
      }
    }
  }
}

.omakase-timeline-overlay {
  position: absolute;
  z-index: 100;

  .omakase-timeline-timecode {
    position: absolute;
    padding-left: 10px;
    padding-top: 10px;
    overflow: hidden;

    .omakase-timecode-edit {
      input {
        padding: 0 5px;
        width: 100px;
        border-radius: 5px;
        border: 1px solid #5db7e8;

        &:disabled {
          background-color: #ccc;
        }

        &.omakase-timecode-edit-input-invalid {
          border: 1px solid #fa6664;
        }
      }
    }
  }
}

omakase-audio-router {
  font-size: 12px;
  font-weight: 400;

  .omakase-router-container {
    border: 1px solid #c2e9ff;
    border-radius: 3px;
    display: inline-block;
    background: #e9f7ff;

    &.size-small {
      font-size: 11px;
      .omakase-router-table {
        td {
          padding: 0 5px;
        }
      }
      .omakase-router-toggle {
        width: 14px;
        height: 14px;
        .omakase-router-toggle-inner {
          width: 6px;
          height: 6px;
        }
      }
    }
    &.size-medium {
      font-size: 12px;
      .omakase-router-table {
        td {
          padding: 2px 7px;
        }
      }
      .omakase-router-toggle {
        width: 16px;
        height: 16px;
        .omakase-router-toggle-inner {
          width: 8px;
          height: 8px;
        }
      }
    }
    &.size-large {
      font-size: 13px;
      .omakase-router-table {
        td {
          padding: 5px 9px;
        }
        tbody tr {
          &:first-child td {
            padding-top: 20px;
          }
          &:last-child td {
            padding-bottom: 20px;
          }
        }
        thead th {
          padding-top: 15px;
          padding-bottom: 10px;
        }
      }
      .omakase-router-toggle {
        width: 20px;
        height: 20px;
        .omakase-router-toggle-inner {
          width: 12px;
          height: 12px;
        }
      }
    }
    .omakase-router-table {
      border-collapse: collapse;
      width: 100%;

      tbody {
        border-top: 1px solid #c2e9ff;

        tr {
          &:first-child {
            td {
              padding-top: 10px;
            }
          }
          &:last-child {
            td {
              padding-bottom: 10px;
            }
          }
        }
      }

      th,
      td {
        text-align: center;
        padding: 5px;

        &.align-left {
          text-align: left;
        }

        &.align-right {
          text-align: right;
        }

        &:first-child {
          padding-left: 10px;
          min-width: 80px;
        }
        &:last-child {
          padding-right: 10px;
        }

        &.router-visualization-label {
          max-width: 200px;
          text-overflow: ellipsis;
          overflow: hidden;
          white-space: nowrap;
        }
      }

      th {
        font-weight: normal;

        &:last-child {
          width: 60px;
        }
      }

      td {
        .omakase-router-icon {
          display: none;
        }
      }

      &.omakase-router-multiple {
        td {
          .omakase-router-icon {
            display: inline-block;
          }
        }
      }
    }
    .omakase-router-toggle {
      width: 16px;
      height: 16px;
      border: 1px solid #009ceb;
      border-radius: 50%;
      border: 1px solid #009ceb;
      display: inline-block;
      cursor: pointer;
      position: relative;
      box-sizing: content-box;

      &:not(.active) {
        .omakase-router-toggle-inner {
          display: none;
        }
      }

      .omakase-router-toggle-inner {
        position: absolute;
        left: 4px;
        top: 4px;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background-color: #009ceb;
      }
    }

    .omakase-router-icon {
      width: 20px;
      height: 20px;
      display: inline-block;
      cursor: pointer;
      background-repeat: no-repeat;
      background-position: center;
      vertical-align: middle;

      &.icon-deselect-all {
        background-image: url(/images/audio-deselect-all.svg);
        background-size: 100%;
        margin-right: 5px;
      }

      &.icon-reset-all {
        background-image: url(/images/audio-reset-all.svg);
        background-size: 100%;
      }

      &.icon-deselect {
        background-image: url(/images/audio-deselect.svg);
        margin-right: 5px;
      }

      &.icon-reset {
        background-image: url(/images/audio-reset.svg);
      }

      &.icon-outputs-few {
        background-image: url(/images/audio-outputs-few.svg);
      }

      &.icon-outputs-many {
        background-image: url(/images/audio-outputs-many.svg);
      }
    }
  }
}

omakase-dropdown {
  position: absolute;
  color: white;
  font-size: 13px;
  bottom: 25px;
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 3px;

  .omakase-dropdown-close {
    position: absolute;
    width: 11px;
    height: 11px;
    top: 9px;
    right: 9px;
    cursor: pointer;
    background-image: url(/images/media-chrome-close.svg);
  }

  omakase-dropdown-list {
    display: inline-block;
    vertical-align: top;

    &[type='default'] {
      omakase-dropdown-option {
        &.active {
          background-color: white;
          color: black;
        }

        &:hover:not(.active) {
          background-color: rgba(0, 0, 0, 0.7);
        }

        .omakase-dropdown-option-icon {
          display: none;
        }
      }
    }

    &[type='radio'] {
      omakase-dropdown-option {
        .omakase-dropdown-option-icon {
          background-image: url(/images/media-chrome-radio-off.svg);
        }

        &.active .omakase-dropdown-option-icon {
          background-image: url(/images/media-chrome-radio-on.svg);
        }
      }
    }

    &[type='checkbox'] {
      omakase-dropdown-option {
        .omakase-dropdown-option-icon {
          background-image: url(/images/media-chrome-checkbox-off.svg);
        }

        &.active .omakase-dropdown-option-icon {
          background-image: url(/images/media-chrome-checkbox-on.svg);
        }
      }
    }

    &.align-left {
      .omakase-dropdown-title,
      omakase-dropdown-option {
        text-align: left;
        padding-left: 20px;
        padding-right: 10px;
      }
    }

    &:not(.align-left) {
      text-align: center;
    }

    &:first-child .omakase-dropdown-title {
      border-top-left-radius: 3px;
    }

    &:last-child .omakase-dropdown-title,
    &:has(+ .d-none) .omakase-dropdown-title {
      border-top-right-radius: 3px;
    }
  }

  .omakase-dropdown-title {
    line-height: 20px;
    background-color: black;
    padding: 5px;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .omakase-dropdown-container {
    padding: 5px 0;

    omakase-dropdown-option {
      display: block;
      line-height: 25px;
      cursor: pointer;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;

      .omakase-dropdown-option-icon {
        width: 12px;
        height: 12px;
        display: inline-block;
        background-repeat: no-repeat;
        background-size: cover;
        margin-right: 5px;
        margin-bottom: 3px;
        vertical-align: middle;
      }
    }
  }
}

omakase-dropdown-toggle {
  line-height: var(--icon-size-default);
  font-size: calc(var(--icon-size-default) * 0.75);
  cursor: pointer;
}
