///////////////////////////////////////
////////
///////     UTILITIES - BORDERS
//////
/////////////////////////////////////

@import "../../settings/includes/borders";
@import "../../settings/includes/colors";

@mixin border-width-classes() {
  @each $width in $border-width-options {
    .u-border-width-#{$width} {
      border-width: #{$width}px;
    }

    @each $direction in $border-direction-options {
      .u-border-#{$direction}-width-#{$width} {
        border-#{$direction}-width: #{$width}px;
      }
    }
  }
}

@mixin border-style-classes() {
  @each $style in $border-style-options {
    .u-border-style-#{$style} {
      border-style: $style;
    }

    @each $directions in $border-direction-options {
      .u-border-#{$directions}-style-#{$style} {
        border-#{$directions}-style: $style;
      }
    }
  }
}

@mixin border-color-classes() {
  @each $key, $color in $colorsMerged {
    .u-border-color-#{to-lower-case(#{$key})} {
      border-color: $color;
    }

    @each $direction in $border-direction-options {
      .u-border-#{$direction}-color-#{to-lower-case(#{$key})} {
        border-#{$direction}-color: $color;
      }
    }
  }
}

@mixin create-border-color-scale-classes() {
  @each $color, $palette in $border-color-scales {
    @each $key, $hexValue in $palette {
      .u-border-color-#{$color}-#{$key} {
        border-color: $hexValue;
      }
    }
  }
}

@mixin border-radius-classes() {
  @for $i from 0 through 4 {
    .u-border-radius-#{$i} {
      border-radius: #{$i}px;
    }

    @each $radius in $border-radius-options {
      .u-border-#{$radius}-radius-#{$i} {
        border-#{$radius}-radius: #{$i}px;
      }
    }
  }
}

@mixin border-classes() {
  @each $width in $border-width-options {
    @each $style in $border-style-options {
      @each $colorKey, $colorValue in $colorsMerged {
        .u-border-#{$width}-#{$style}-#{to-lower-case($colorKey)} {
          border: #{$width}px $style $colorValue;
        }
      }

      @each $colorName, $palette in $border-color-scales {
        @each $scale, $hexValue in $palette {
          .u-border-#{$width}-#{$style}-#{$colorName}-#{$scale} {
            border: #{$width}px $style $hexValue;
          }
        }
      }
    }
  }
}

@mixin create-border-classes() {
  .u-border-none {
    border: none;
  }

  .u-border-hidden {
    border: hidden;
  }

  .u-border-inherit {
    border: inherit;
  }

  .u-border-initial {
    border: initial;
  }

  @include border-classes();

  @include border-width-classes();

  @include border-style-classes();

  @include border-color-classes();

  @include create-border-color-scale-classes();

  @include border-radius-classes();
}

@include create-border-classes();
