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

$bgcolor: $cherry100;
$background: linear-gradient(0deg, transparent, transparent 50%, $bgcolor 50%, $bgcolor 50%);
$background-transition: background-position 0.3s ease-out;

/* VALIDATION */
.mol_validation {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  position: relative;
  transition: $background-transition;
  background: $background;
  background-size: 0;
  background-position: 0 100%;
  word-break: normal;

  fieldset {
    border: 0;
    margin: 0;
    padding: 0;
    position: relative;
    min-width: inherit;
  }

  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: -0.75rem;
    width: 0.75rem;
    height: 100%;
    background: $background;
    transition: $background-transition;
    background-size: 0;
    background-position: 0 100%;

    //Box shadow må ligge over :before / :after bakgrunnen
  }

  &::after {
    content: '';
    position: absolute;
    top: 0;
    left: calc(-1rem + 1px);
    height: 100%;
    transition: transform 0.3s ease-out 0s;
    transform: scaleY(0);
    transform-origin: top;
    border-left: 4px solid $cherry600;
  }

  &--active {
    background-size: 100% 200%;
    padding: 0 1rem 1rem 0;
    background-position: 0 0;

    &::before {
      background-size: 100% 200%;
      background-position: 0 0;
    }

    &::after {
      transform: scaleY(1);
    }
  }

  &__errortext {
    padding-top: 0;
    padding-bottom: 0;
    font-size: 1.125rem;
    line-height: 1.2rem;
    font-weight: 600;
    color: $cherry600;

    &--invalid {
      padding-top: 1rem;
      padding-bottom: 1rem;
    }
  }

  &__formerrortext {
    color: $cherry600;
    font-weight: 600;
    padding: 1rem 0;
  }
}
