@import '@helsenorge/designsystem-react/scss/palette';

.mol_dropdown {
  padding: 0.25rem;
  display: inline-block;
  position: relative;

  &--full-width {
    width: 100%;
  }

  &__container {
    height: 0;
    overflow: hidden;
    visibility: hidden;
  }

  &__content {
    opacity: 0;
    width: calc(100% - 8px);
    position: relative;
    z-index: 9999;
    background: $white;
    padding: 0.5rem 1.25rem 1.25rem;
    box-shadow:
      0 0 0 4px $neutral700,
      0 2px 4px 2px rgb(0 0 0 / 25%);
    word-break: break-all;

    &::before {
      content: '';
      position: absolute;
      top: -8px;
      left: 0;
      right: 0;
      width: 100%;
      height: 8px;
      background: $white;
    }

    &.mol_dropdown__content--focused::before,
    &.mol_dropdown__content--open::before {
      background: $blueberry50;
    }
  }

  &--open {
    .mol_dropdown__container {
      visibility: visible;
    }

    .mol_dropdown__content {
      opacity: 1;
      transition: opacity 150ms ease;
      position: absolute;
    }
  }

  &__button {
    display: flex;
    align-items: center;
    width: auto;
    border-width: 0;
    color: $black;
    background-color: $white;
    padding: 0.75rem 1.25rem;
    font-weight: 400;
    text-align: left;
    position: relative;
    font-size: 18px;
    box-shadow: 0 0 0 2px $neutral200;
    cursor: pointer;

    &--full-width {
      width: 100%;
    }

    &:hover,
    &:focus {
      box-shadow: 0 0 0 4px $neutral400;
    }

    &:focus,
    &--selected,
    &--selected:hover,
    &--selected:focus {
      box-shadow:
        0 0 0 4px $neutral700,
        0 2px 8px 5px rgb(0 0 0 / 25%);
      background-color: $blueberry50;
      outline: none;
    }

    &-text {
      display: inline-block;
      margin-right: 1.25rem;
    }

    &-arrow {
      position: absolute;
      height: 100%;
      top: 0;
      right: 0.5rem;
      vertical-align: middle;
      color: $blueberry700;
      transform: scale(0.65);

      &--down {
        margin-top: 0.1rem;
      }
    }
  }

  .mol_datepicker {
    width: auto;
  }
}
