@import "../../themes/mixins.scss";

// Modals: Common Styles
// --------------------------------------------------

:host {
  /**
   * @prop --background: Background of the modal content
   *
   * @prop --border-color: Border color of the modal content
   * @prop --border-radius: Border radius of the modal content
   * @prop --border-width: Border width of the modal content
   * @prop --border-style: Border style of the modal content
   *
   * @prop --min-width: Minimum width of the modal
   * @prop --width: Width of the modal
   * @prop --max-width: Maximum width of the modal
   *
   * @prop --min-height: Minimum height of the modal
   * @prop --height: Height of the modal
   * @prop --max-height: Maximum height of the modal
   *
   * @prop --backdrop-opacity: Opacity of the backdrop
   */
  --width: 100%;
  --min-width: auto;
  --max-width: auto;
  --height: 100%;
  --min-height: auto;
  --max-height: auto;
  --overflow: hidden;
  --border-width: 0;
  --border-style: none;
  --border-color: transparent;
  --box-shadow: none;

  @include position(0, 0, 0, 0);

  display: flex;
  position: absolute;

  align-items: center;
  justify-content: center;

  outline: none;

  contain: strict;
}

.modal-wrapper,
ion-backdrop {
  pointer-events: auto;
}

:host(.overlay-hidden) {
  display: none;
}

.modal-wrapper,
.modal-shadow {
  @include border-radius(var(--border-radius));

  width: var(--width);
  min-width: var(--min-width);
  max-width: var(--max-width);

  height: var(--height);
  min-height: var(--min-height);
  max-height: var(--max-height);

  border-width: var(--border-width);
  border-style: var(--border-style);
  border-color: var(--border-color);

  background: var(--background);

  box-shadow: var(--box-shadow);
  overflow: var(--overflow);
  z-index: 10;
}

.modal-shadow {
  position: absolute;

  background: transparent;
}

// Sheet Modal
// --------------------------------------------------

.modal-handle {
  @include margin(null, auto, null, auto);

  position: absolute;

  /**
   * This allows the handle to appear
   * on top of user content in WebKit.
   */
  transform: translateZ(0);

  border: 0;

  cursor: pointer;

  z-index: 11;

  &::before {
    position: absolute;

    transform: translate(-50%, -50%);

    content: "";
  }
}

:host(.modal-sheet) .modal-wrapper,
:host(.modal-sheet) .modal-shadow {
  position: absolute;
  bottom: 0;
}

// Sheet Modal - Scroll at all breakpoints
// --------------------------------------------------

:host(.modal-sheet.modal-no-expand-scroll) ion-footer {
  position: absolute;
  bottom: 0;

  width: var(--width);
}
