/** @license
 * Shaka Player
 * Copyright 2016 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */

/* The overflow menu and all settings submenus.  These appear on top of all
 * other controls (Z axis) when the overflow button is clicked. */
.shaka-overflow-menu,
.shaka-settings-menu {
  /* It's okay to add a vertical scroll if there are too many items, but
   * horizontal scrolling is not allowed. */
  overflow-x: hidden;
  overflow-y: auto;

  /* Don't wrap text to the next line. */
  white-space: nowrap;

  /* Styles for the menu itself. */
  background: white;
  box-shadow: 0 1px 9px 0 rgba(0 0 0 / 40%);
  border-radius: 2px;
  max-height: 250px;
  min-width: 180px;

  /* The menus fade out with the other controls. */
  .show-when-controls-shown();

  /* When displayed as a flex container, elements inside will flow in a
   * vertical column. */
  display: flex;
  flex-direction: column;

  /* Where the menu appears. */
  position: absolute;
  z-index: 2;
  right: 15px;
  bottom: 30px;

  /* The buttons inside the menu. */
  button {
    font-size: 14px;
    background: transparent;
    color: black;
    border: none;
    min-height: 30px;
    padding: 3.5px 6px;

    /* The button itself is a flex container, with children center-aligned. */
    display: flex;
    align-items: center;

    /* When hovered, the button's background is highlighted. */
    &:hover {
      background: rgb(224 224 224);
    }

    /* The button is clickable, showing cursor pointer */
    cursor: pointer;

    /* The label inside button is also showing cursor pointer  */
    label {
      cursor: pointer;
    }

    .shaka-keyboard-navigation &:focus {
      background: rgb(224 224 224);
    }
  }

  /* These are the elements which contain the material design icons.
   * TODO: Pull MD icon details out of JS. */
  i {
    /* TODO(b/116651454): eliminate hard-coded offsets */
    padding-left: 10px;
    padding-right: 10px;
  }

  /* If the seekbar is missing, this is positioned lower.
   * TODO: Solve with flex layout instead? */
  &.shaka-low-position {
    /* TODO(b/116651454): eliminate hard-coded offsets */
    bottom: 15px;
  }
}

/* The span elements inside the top-level overflow menu contain single lines
 * of text, which are the button name and the current selection.  For example,
 * a captions button might have "Captions" in one span (the button name), and
 * "Farsi" in another (the current selection).
 * These are displayed inside a .shaka-overflow-button-label grouping, to the
 * right of MD icons. */
.shaka-overflow-menu span {
  text-align: left;
}

/* This contains span elements with single lines of text, and appears to the
 * right of MD icons. */
.shaka-overflow-button-label {
  position: relative;

  /* This is a flex container, whose children flow vertically. */
  display: flex;
  flex-direction: column;
}

/* This is the specific span element which shows the current selection from some
 * submenu.  For example, it would contain the currently-selected subtitle
 * language, the currently-selected resolution, etc. */
.shaka-current-selection-span {
  /* This is dimmer than the other span, which is the name of the submenu. */
  color: rgba(0 0 0 / 54%);
}

/* The submenus have somewhat different margins inside them. */
.shaka-settings-menu {
  span {
    /* TODO(b/116651454): eliminate hard-coded offsets */
    margin-left: 54px;
  }
}

/* This is a button within each submenu that takes you back to the main overflow
 * menu. */
.shaka-back-to-overflow-button {
  /* The label inside the button, which says something like "back". */
  span {
    /* TODO(b/116651454): eliminate hard-coded offsets */
    margin-left: 0;
  }

  /* The MD icon for the "back" arrow. */
  i {
    /* TODO(b/116651454): eliminate hard-coded offsets */
    padding-right: 20px;
  }
}

/* The menu item for resolutions which contains "auto". */
.shaka-auto-span {
  /* TODO(b/116651454): eliminate hard-coded offsets */
  left: 17px;
}
