/*
    This file is part of FreeTube.

    FreeTube is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    FreeTube is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with FreeTube.  If not, see <http://www.gnu.org/licenses/>.
*/

/*
* Credit goes to pavelvaravko for making this css.
* https://codepen.io/pavelvaravko/pen/qjojOr
*/

/* select starting stylings ------------------------------ */
.select {
  position: relative;
  inline-size: 200px;
  margin-block-start: 30px;
}

.select-text {
  position: relative;
  font-family: inherit;
  background-color: var(--search-bar-color);
  color: var(--primary-text-color);
  inline-size: 100%;
  block-size: 45px;
  padding-inline-start: 1rem;
  font-size: 16px;
  border-radius: 5px;
  border: 0;
}

.select option {
  color: var(--secondary-text-color);
  background-color: var(--card-bg-color);
}

/* stylelint-disable-next-line a11y/no-outline-none */
.select-text:focus {
  outline: none;
}

/* Use custom arrow */
.select .select-text {
  appearance: none;
  text-overflow: ellipsis;
  padding-inline-end: 1.5rem;
}

.iconSelect {
  position: absolute;
  inset-block-start: 10px;
  inset-inline-end: 10px;

  /* Styling the down arrow */
  padding: 0;
  content: '';
  border-inline-start: 6px solid transparent;
  border-inline-end: 6px solid transparent;
  pointer-events: none;
  color: var(--tertiary-text-color);
}

.disabled,
.disabled + .iconSelect {
  opacity: 0.4;
  cursor: not-allowed;
}

.selectTooltip {
  position: absolute;
  inset-block-start: -22px;
  inset-inline-end: 13px;
}


/* LABEL ======================================= */
.select-label {
  font-size: 18px;
  font-weight: normal;
  position: absolute;
  display: flex;
  column-gap: 6px;
  inset-inline-start: 0;
  inset-block-start: 10px;
  transition: 0.2s ease all;
  color: var(--tertiary-text-color);
}

.select-icon {
  inline-size: 14px;
  block-size: 14px;
}

/* active state */
.select-text:focus ~ .select-label,
.select-text:valid ~ .select-label {
  color: var(--accent-color);
  inset-block-start: -20px;
  transition: 0.2s ease all;
  font-size: 14px;
}

/* BOTTOM BARS ================================= */
.select-bar {
  position: relative;
  display: block;
}

.select-bar::before,
.select-bar::after {
  content: '';
  block-size: 2px;
  inline-size: 0;
  inset-block-end: 1px;
  position: absolute;
  background: var(--accent-color);
  transition: 0.2s ease all;
}

.select-bar::before {
  inset-inline-start: 50%;
}

.select-bar::after {
  inset-inline-end: 50%;
}

/* active state */
.select-text:focus ~ .select-bar::before,
.select-text:focus ~ .select-bar::after {
  inline-size: 50%;
}

/* HIGHLIGHTER ================================== */
.select-highlight {
  position: absolute;
  block-size: 60%;
  inline-size: 100px;
  inset-block-start: 25%;
  inset-inline-start: 0;
  pointer-events: none;
  opacity: 0.5;
}

@media only screen and (width <= 800px) {
  .select {
    inline-size: 100%;
  }
}
