/*
 * 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-accordion {
  &__title {
    @include bpk-border-bottom-sm($bpk-color-sky-gray-tint-06);
  }

  &__toggle-button {
    width: 100%;
    padding: $bpk-spacing-xs 0;
    border: 0;
    background-color: transparent;
    text-align: left;
    cursor: pointer;
    appearance: none;

    @include bpk-themeable-property(
      color,
      --bpk-accordion-color,
      $bpk-color-sky-blue-shade-03
    );

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

    @include bpk-hover {
      @include bpk-themeable-property(
        color,
        --bpk-accordion-hover-color,
        $bpk-color-sky-blue-shade-03
      );
    }

    &:active {
      @include bpk-themeable-property(
        color,
        --bpk-accordion-active-color,
        $bpk-color-sky-blue-shade-03
      );
    }
  }

  &__flex-container {
    display: inline-flex;
    width: 100%;
    flex-direction: row;
  }

  &__title-text {
    display: inline-block;
    flex-grow: 1;
  }

  &__icon-wrapper {
    display: inline-block;
  }

  &__leading-icon {
    @include bpk-margin-trailing($bpk-spacing-xs, true);
  }

  &__item-expand-icon {
    @include bpk-themeable-property(
      fill,
      --bpk-accordion-color,
      $bpk-color-sky-blue-shade-03
    );

    @include bpk-hover {
      @include bpk-themeable-property(
        fill,
        --bpk-accordion-hover-color,
        $bpk-color-sky-blue-shade-03
      );
    }

    &:active {
      @include bpk-themeable-property(
        fill,
        --bpk-accordion-active-color,
        $bpk-color-sky-blue-shade-03
      );
    }

    &--flipped {
      transform: scaleY(-1);
    }
  }

  &__content-container {
    margin: 0;
    padding: $bpk-spacing-xs 0;
  }
}
