//
// Copyright 2017 Google Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions://
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.//
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

@import "@material/animation/functions";
@import "@material/elevation/mixins";
@import "@material/theme/mixins";
@import "@material/rtl/mixins";
@import "@material/typography/mixins";
@import "@material/typography/variables";

// postcss-bem-linter: define dialog

.mdc-dialog {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  visibility: hidden;
  z-index: 5;
}

.mdc-dialog__backdrop {
  @include mdc-theme-prop(background-color, text-primary-on-light);

  position: fixed;
  top: 0;
  left: 0;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  opacity: 0;
  z-index: -1;
}

.mdc-dialog__surface {
  @include mdc-elevation(24);
  @include mdc-theme-prop(background-color, background);

  display: inline-flex;
  flex-direction: column;
  width: calc(100% - 30px);
  min-width: 640px;
  max-width: 865px;
  transform: translateY(150px) scale(.8);
  border-radius: 2px;
  opacity: 0;

  @include mdc-rtl(".mdc-dialog") {
    text-align: right;
  }
}

.mdc-dialog__header {
  display: flex;
  align-items: center;
  padding: 24px 24px 0;

  @include mdc-rtl(".mdc-dialog") {
    text-align: right;
  }
}

.mdc-dialog__header__empty {
  padding: 0;
}

.mdc-dialog__header__title {
  @include mdc-typography(headline6);

  flex: 1;
  margin: 0;
}

.mdc-dialog__body {
  @include mdc-theme-prop(color, text-secondary-on-light);
  @include mdc-typography(body1);

  margin-top: 20px;
  padding: 0 24px 24px;
}

.mdc-dialog__body--scrollable {
  max-height: 195px;
  border-top: 1px solid rgba(0, 0, 0, .1);
  border-bottom: 1px solid rgba(0, 0, 0, .1);
  overflow-x: auto;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
}

.mdc-dialog__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  padding: 8px;
}

.mdc-dialog__footer__button {
  @include mdc-rtl-reflexive-box(margin, right, 8px);

  &:last-child {
    @include mdc-rtl-reflexive-box(margin, right, 0);
  }
}

.mdc-dialog__action:not(:disabled) {
  @include mdc-theme-prop(color, secondary);
}

// TODO: Replace with breakpoint variable
@media (max-width: 640px) {
  .mdc-dialog {
    min-width: 280px;
  }

  .mdc-dialog__surface {
    min-width: 280px;
  }

  .mdc-dialog__body {
    line-height: 24px;
  }
}

.mdc-dialog--animating {
  visibility: visible;

  .mdc-dialog__backdrop {
    transition: mdc-animation-enter(opacity, 120ms);
  }

  .mdc-dialog__surface {
    transition: mdc-animation-enter(opacity, 120ms), mdc-animation-enter(transform, 120ms);
  }
}

.mdc-dialog--open {
  visibility: visible;

  .mdc-dialog__backdrop {
    opacity: .3;
  }

  .mdc-dialog__surface {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

// postcss-bem-linter: end

.mdc-dialog-scroll-lock {
  overflow: hidden;
}
