/*
 * 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/index';

.bpk-drawer {
  position: fixed;
  right: 0;
  display: flex;
  z-index: $bpk-zindex-drawer;
  width: 90%;
  max-width: 67 * $bpk-spacing-xs;
  height: 100%;
  flex-direction: column;
  transform: translate(100%);
  transition: transform $bpk-duration-sm ease;
  outline: 0;
  background: $bpk-color-white;
  overflow-y: scroll;

  @include bpk-box-shadow-xl;

  @include bpk-rtl {
    right: auto;
    left: 0;
    transform: translate(-100%);
  }

  @include bpk-breakpoint-mobile {
    width: 100%;
    max-width: 100%;
  }

  &--entering,
  &--entered {
    transform: translate(0);

    @include bpk-rtl {
      transform: translate(0);
    }
  }

  &--exiting {
    transition: transform $bpk-duration-xs ease;
  }

  &--exiting,
  &--exited {
    transform: translate(100%);

    @include bpk-rtl {
      transform: translate(-100%);
    }
  }

  &__header {
    display: flex;
    min-height: #{2 * $bpk-spacing-sm + $bpk-spacing-base}; // keep height the same if visually hidden title
    padding: $bpk-spacing-sm;
    justify-content: space-between;
    align-items: center;
    flex: 0 0;

    @include bpk-border-bottom-sm($bpk-color-sky-gray-tint-06);
  }

  &__heading {
    @include bpk-text;
    @include bpk-text--base;
    @include bpk-text--bold;

    &--visually-hidden {
      @include bpk-visually-hidden;
    }
  }

  &__close-button {
    float: right;

    @include bpk-rtl {
      float: left;
    }
  }

  &__content {
    height: 100%;
    padding: $bpk-spacing-sm;
    flex: 1 1 100%;
    overflow-y: auto;
  }
}
