@import "../../styles/variables.scss";
@import "../common/typography/text.mixins.scss";

:host {
  display: block;
  position: relative;
  width: 100%;
  max-width: 800px;
  min-width: 180px;
  cursor: pointer;

  &:focus .novo-select-trigger {
    border-bottom: 1px solid $positive;
    i {
      color: rgba(0, 0, 0, 0.73);
    }
  }

  &:focus {
    outline: none;
  }

  .novo-select-trigger {
    @include novo-body-text();
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: transparent;
    border: none;
    border-bottom: 1px solid lighten($dark, 45%);
    color: var(--text-main, $dark);
    height: 2.05rem;
    position: relative;
    text-align: left;
    text-shadow: none;
    z-index: z(default);
    cursor: pointer;
    text-transform: none;
    padding: 0 $spacing-md 0 $spacing-sm;
    margin-bottom: -1px;
    -webkit-appearance: none;

    &.empty {
      color: #a9a9a9;
    }
    &:hover {
      border-bottom: 1px solid lighten($dark, 15%);
    }

    .novo-select-placeholder {
      color: var(--form-placeholder);
    }

    i {
      font-size: 0.8em;
      color: $dark;
      position: absolute;
      right: 0px;
    }
  }
  &[disabled],
  &.novo-select-disabled {
    pointer-events: none;
    div[type="button"] {
      color: $grey;
    }
    i {
      color: $grey !important;
    }
    .novo-select-trigger {
      color: $grey !important;
      border-bottom: 1px dashed $grey !important;

      &:hover {
        color: $grey !important;
        border-bottom: 1px dashed $grey !important;
      }
    }
  }
}

.novo-select-list {
  &.active {
    z-index: z(overlay);
    max-height: 219px;
    min-width: 200px;
    width: 100%;
    max-width: 800px;
    width: inherit;
    overflow: auto;
    opacity: 1;
  }
  background-color: var(--background-bright);
  cursor: default;
  list-style: none;
  overflow: auto;
  margin: 0;
  padding: 0;
  width: 100%;
  box-shadow: 0 -1px 3px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
  font-size: 1rem;
  z-index: z(below);
  opacity: 0;

  .select-item {
    height: 35px;
  }
}

.select-header {
  button {
    text-transform: uppercase;
    &.header {
      color: $positive;
      position: relative;
      text-align: left;
      cursor: pointer;
      height: 3rem;
      margin: 0;
      padding: 0.5rem 1.6rem 0 0;
      box-sizing: border-box;
      border: none;
      display: block;
      align-items: center;
      justify-content: space-between;
      font-size: 1rem;
      &:focus,
      &:hover {
        color: darken($light, 55%);
      }
      i {
        color: $positive;
        padding-right: 10px;
      }
      span {
        text-align: left;
      }
    }
  }
  div.active {
    width: 100%;
    float: right;
    padding: 5px;
    footer {
      float: right;
    }
    button {
      display: inline-block;
      border: none;
      float: left;
      width: auto;
      font-weight: 500;
      font-size: 0.8rem;
      color: #acacac;
      &:hover {
        color: darken(#acacac, 15%);
      }
    }
    button.primary {
      color: $positive;
      &:hover {
        color: darken($positive, 15%);
      }
    }
    input {
      display: flex;
      justify-content: space-between;
      align-items: center;
      background-color: transparent;
      border: none;
      border-bottom: 1px solid rgba(0, 0, 0, 0.12);
      color: rgba(0, 0, 0, 0.73);
      height: 2.05rem;
      position: relative;
      text-align: left;
      text-shadow: none;
      width: 100%;
      z-index: z(default);
      cursor: pointer;
      text-transform: none;
      padding-top: 10px;
      font-size: 1rem;
      &.empty {
        color: #a9a9a9;
      }
      &:focus {
        outline: none;
      }
      &:hover {
        border-bottom: 1px solid $positive;
      }
      &.invalid {
        border-bottom: 1px solid #da4453;
      }
    }
  }
}
