//
// Color Select
// --------------------------------------------------

.color-select {
  &-popover {
    width: $grid-unit-y * 21;
    margin: -$popover-padding;
    padding: $grid-unit-y * 3;
  }

  &-btn {
    $size: $grid-unit-y * 5;

    min-width: $size;
    width: $size;
    height: $size;
    border-radius: $input-border-radius;
    display: inline-block;
    vertical-align: bottom;
    cursor: pointer;
    background-color: $color-white;

    @include themes-border(input-border, $width: 2px);

    @each $name, $color in $map-harmony-colors {
      &-#{$name} {
        border: 2px solid $color-grey-rgba-08;
        background-color: $color;
      }
    }

    &-disabled {
      cursor: default;
    }

    &-filled {
      border: 2px solid $color-grey-rgba-08;
    }
  }

  &-group {
    margin-bottom: -$padding-small-vertical;
  }

  &-header {
    display: flex;
    align-items: center;
    margin-bottom: $grid-unit-y * 2;
  }

  &-arrow {
    font-size: $font-size-base;

    a {
      @include themes(color, color-text-dark);

      &:hover,
      &:focus {
        color: $brand-primary;
      }
    }
  }

  &-title {
    margin-bottom: 0;
    line-height: $grid-unit-y * 3;
    flex: 1;
    text-align: center;
    font-weight: $font-weight-bold;
  }

  &-colors {
    margin-right: -$padding-small-vertical;

    &-item {
      $size: $grid-unit-y * 3;

      width: $size;
      height: $size;
      border-radius: $border-radius-base;
      margin-right: $padding-small-vertical;
      margin-bottom: $padding-small-vertical;
      display: inline-block;
      vertical-align: bottom;
      cursor: pointer;
      border: 2px solid $color-grey-rgba-08;
      background-color: $color-white;
    }

    @each $name, $color in $map-harmony-colors {
      &-#{$name} {
        background-color: $color;
      }
    }

    /*
    * I am using this to dynamically pull the brand elements from the
    * ui
    */
    @each $name, $color in $map-brand-colors {
      &-#{$name} {
        background-color: $color;
      }
    }
  }

  &-dots {
    margin: $grid-unit-y * 2 auto 0;
    text-align: center;

    .color-select-dot {
      $size: $grid-unit-y;

      width: $size;
      height: $size;
      border-radius: ceil($size * 0.5);
      display: inline-block;

      @include themes(background-color, carousel-indicator-bg);

      &:hover,
      &:focus,
      &.active {
        background-color: $brand-primary;
      }

      &:not(:last-child) {
        margin-right: $grid-unit-y;
      }
    }
  }

  // Variations

  &-inactive {
    .color-select-btn {
      cursor: default;
    }
  }

  // Small size

  &-sm {
    .color-select-btn {
      $size: $grid-unit-y * 4;

      min-width: $size;
      width: $size;
      height: $size;
    }
  }
}
