// Default variables
$select_font_size: 15px !default;
$select_font_size_small: 15px !default;

$select_input_border_radius: 0px !default;
$select_input_height: 50px !default;
$select_input_height_small: 36px !default;
$select_dropdown_padding: 20px !default;
$select_border_color: $heading_color !default;

$select_gray_dark: #444 !default;
$select_gray: #999 !default;
$select_gray_light: #e8e8e8 !default;
$select_gray_lighter: #f6f6f6 !default;
$select_primary_light: $select_gray !default;
$select_arrow_color: $select_gray !default;

// Luxury Style
$select_border_color_luxury: $primary_color;

// Style the dropdown
.nice-select {
  cursor: pointer;
  border-radius: $select_input_border_radius;
  padding-left: $select_dropdown_padding;
  font-size: $select_font_size;
  background-repeat: no-repeat;
  background-position-x: 96%;
  background-position-y: 50%;
  background-size: 15px;
  border: 1px solid $select_border_color;
  background-color: transparent;
  line-height: $select_input_height;
  height: $select_input_height;
  color: $heading_color;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' version='1.1' width='18' height='18' viewBox='0 0 288 448'%3E%3Cpath d='M268.75 184c0 2-1 4.25-2.5 5.75l-116.5 116.5c-1.5 1.5-3.75 2.5-5.75 2.5s-4.25-1-5.75-2.5l-116.5-116.5c-1.5-1.5-2.5-3.75-2.5-5.75s1-4.25 2.5-5.75l12.5-12.5c1.5-1.5 3.5-2.5 5.75-2.5 2 0 4.25 1 5.75 2.5l98.25 98.25 98.25-98.25c1.5-1.5 3.75-2.5 5.75-2.5s4.25 1 5.75 2.5l12.5 21.5c1.5 1.5 2.5 3.75 2.5 5.75z'/%3E%3C/svg%3E");
  padding-right: 30px;
  width: 100%;
  position: relative;
  @include transition(all 0.3s ease);
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  &:hover,
  &:active,
  &:focus {
    border-color: $primary_color;
    box-shadow: 0px 0px 13px 0px rgba(0, 0, 0, 0.11);
  }

  &.open {
    border-color: $primary_color;
    box-shadow: 0px 0px 13px 0px rgba(0, 0, 0, 0.11);
    .list {
      opacity: 1;
      pointer-events: auto;
      transform: perspective(300px) rotateX(0deg);
    }
  }
  &.disabled {
    border-color: $secondary_color, 2%;
    color: $select_gray;
    pointer-events: none;
    &:after {
      border-color: lighten($select_arrow_color, 20%);
    }
  }

  // Modifiers
  &.wide {
    width: 100%;
    .list {
      left: 0 !important;
      right: 0 !important;
    }
  }
  &.right {
    float: right;
    .list {
      left: auto;
      right: 0;
    }
  }
  &.small {
    font-size: $select_font_size_small;
    height: $select_input_height_small;
    line-height: $select_input_height_small - 2;
    &:after {
      height: 4px;
      width: 4px;
    }
    .option {
      line-height: $select_input_height_small - 2;
      min-height: $select_input_height_small - 2;
    }
  }

  // List and options
  .list {
    background-color: $secondary_color;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
    box-sizing: border-box;
    opacity: 0;
    overflow: hidden;
    padding: 5px 25px;
    pointer-events: none;
    position: absolute;
    top: 100%;
    left: 0;
    transform-origin: 50% 0;
    transform: perspective(300px) rotateX(-90deg);
    transition: all 0.3s ease;
    z-index: 999;
    width: 100%;
    min-width: 250px;
    margin-top: 5px;
    li {
      &:not(:last-child) {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
      }
    }
    &:hover .option:not(:hover) {
      background-color: transparent !important;
    }
  }
  .option {
    color: #FFF;
    font-size: 15px;
    font-weight: 400;
    line-height: 25px;
    list-style: none;
    outline: none;
    padding: 13px 0px 12px;
    text-align: left;
    transition: all 0.2s;
    &:hover,
    &.focus,
    &.selected {
      color: $primary_color;
    }
    &.disabled {
      text-decoration: line-through;
    }
  }
}

.pxl-luxury .nice-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' version='1.1' fill='%23FFFFFF' width='18' height='18' viewBox='0 0 288 448'%3E%3Cpath d='M268.75 184c0 2-1 4.25-2.5 5.75l-116.5 116.5c-1.5 1.5-3.75 2.5-5.75 2.5s-4.25-1-5.75-2.5l-116.5-116.5c-1.5-1.5-2.5-3.75-2.5-5.75s1-4.25 2.5-5.75l12.5-12.5c1.5-1.5 3.5-2.5 5.75-2.5 2 0 4.25 1 5.75 2.5l98.25 98.25 98.25-98.25c1.5-1.5 3.75-2.5 5.75-2.5s4.25 1 5.75 2.5l12.5 21.5c1.5 1.5 2.5 3.75 2.5 5.75z'/%3E%3C/svg%3E");
  border-color: $select_border_color_luxury;
}

.pxl-pizza .nice-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='16' width='16' viewBox='0 0 512 512'%3E%3Cpath d='M256 0a256 256 0 1 0 0 512A256 256 0 1 0 256 0zM376.9 294.6L269.8 394.5c-3.8 3.5-8.7 5.5-13.8 5.5s-10.1-2-13.8-5.5L135.1 294.6c-4.5-4.2-7.1-10.1-7.1-16.3c0-12.3 10-22.3 22.3-22.3l57.7 0 0-96c0-17.7 14.3-32 32-32l32 0c17.7 0 32 14.3 32 32l0 96 57.7 0c12.3 0 22.3 10 22.3 22.3c0 6.2-2.6 12.1-7.1 16.3z'/%3E%3C/svg%3E");
  background-position-x: calc(100% - 19px);
  .list {
    box-shadow: none;
    padding: 0;
    border: 1px solid $divider_color;
    li {
      &:not(:last-child) {
        border-bottom: 1px solid $divider_color;
      }
    }
  }
  .option {
    color: $heading_color;
    padding: 15px 25px;
    font-size: 17px;
    font-weight: 500;
    line-height: 20px;
    text-transform: uppercase;
    &:hover,
    &.focus,
    &.selected {
      color: #fff;
      background-color: $primary_color;
    }
  }
}

// Use display instead of opacity for IE <= 10
.no-csspointerevents .nice-select {
  .list {
    display: none;
  }
  &.open {
    .list {
      display: block;
    }
  }
}