/*
 * Backpack - Skyscanner's Design System
 *
 * Copyright 2016-2021 Skyscanner Ltd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

@import '~bpk-mixins';

$bpk-spacing-v2: true;

.bpk-rating {
  display: flex;

  &--vertical {
    flex-direction: column;
  }

  &__component {
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    color: $bpk-color-white;
  }

  &--base-rating {
    display: flex;
    width: bpk-spacing-lg() * 2;
    height: bpk-spacing-lg() * 2;
  }

  &--lg-rating {
    display: flex;
    width: bpk-spacing-xxl() + (bpk-spacing-sm() * 5);
    height: bpk-spacing-xxl() + (bpk-spacing-sm() * 5);
  }

  &--sm-rating {
    display: flex;
    width: bpk-spacing-sm() * 9;
    height: bpk-spacing-sm() * 9;
  }

  &--sm-pill {
    width: bpk-spacing-sm() * 9;
    height: bpk-spacing-xl() - (bpk-spacing-sm() / 2);
    border-radius: $bpk-border-radius-pill;
  }

  &--base-pill {
    width: bpk-spacing-lg() * 2;
    height: bpk-spacing-sm() * 9;
    border-radius: $bpk-border-radius-pill;
  }

  &--lg-pill {
    width: (bpk-spacing-xl() * 2) + (bpk-spacing-sm() / 2);
    height: bpk-spacing-xxl() + (bpk-spacing-sm() / 2);
    border-radius: $bpk-border-radius-pill-lg;
  }

  &__text-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;

    &--horizontal {
      // We could use `padding-inline-start: $bpk-spacing-sm` here, but it's unsupported in IE
      padding-left: bpk-spacing-sm() * 3;

      @include bpk-rtl {
        padding-right: bpk-spacing-sm() * 3;
      }
    }

    &--vertical {
      padding-top: bpk-spacing-sm() + ($bpk-one-pixel-rem * 2);
    }
  }

  &__text {
    &--horizontal {
      // We could use `text-align: start` here, but it's unsupported in IE
      text-align: left;

      @include bpk-rtl {
        text-align: right;
      }
    }

    &--vertical {
      align-self: center;
      text-align: center;
    }
  }

  &--high-rating {
    align-self: center;
    color: $bpk-color-sky-gray;

    @include bpk-themeable-property(
      color,
      --bpk-rating-high-text-color,
      $bpk-color-sky-gray
    );
    @include bpk-themeable-property(
      background-color,
      --bpk-rating-high-color,
      $bpk-color-glencoe
    );
  }

  &--medium-rating {
    align-self: center;

    @include bpk-themeable-property(
      color,
      --bpk-rating-medium-text-color,
      $bpk-color-sky-gray
    );
    @include bpk-themeable-property(
      background-color,
      --bpk-rating-medium-color,
      $bpk-color-erfoud
    );
  }

  &--low-rating {
    align-self: center;

    @include bpk-themeable-property(
      background-color,
      --bpk-rating-low-color,
      $bpk-color-panjin
    );
  }
}
