@use "./modal.common";
@import "./modal.native.vars.scss";
@import "../../themes/native/native.globals";

// Modals: Native Styles
// --------------------------------------------------

:host {
  --background: #{$background-color};
  --border-radius: 0;
  --backdrop-opacity: 0;

  color: $modal-text-color;
}

@media only screen and (min-width: $modal-inset-min-width) and (min-height: $modal-inset-min-height-small) {
  :host {
    --width: #{$modal-inset-width};
    --height: #{$modal-inset-height-small};
    --ion-safe-area-top: 0px;
    --ion-safe-area-bottom: 0px;
    --ion-safe-area-right: 0px;
    --ion-safe-area-left: 0px;
  }
}

@media only screen and (min-width: $modal-inset-min-width) and (min-height: $modal-inset-min-height-large) {
  :host {
    --width: #{$modal-inset-width};
    --height: #{$modal-inset-height-large};
  }
}

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

.modal-handle {
  @include position(5px, 0px, null, 0px);
  @include border-radius(8px, 8px, 8px, 8px);

  width: 36px;
  height: 5px;

  background: var(--ion-color-step-350, var(--ion-background-color-step-350, #c0c0be));

  &::before {
    /**
    * Adds a 4px tap area to the perimeter
    * of the handle.
    */
    @include padding(4px, 4px, 4px, 4px);

    width: 36px;
    height: 5px;
  }
}

/**
 * Ensure that the sheet modal does not
 * completely cover the content.
 *
 * --ion-modal-offset-top is an internal property set by modal.tsx
 * with the resolved root safe-area-top pixel value. This decouples
 * the height calculation from --ion-safe-area-top (which is zeroed
 * for sheet modals to prevent header double-padding).
 */
:host(.modal-sheet) {
  --height: calc(100% - (var(--ion-modal-offset-top, 0px) + 10px));
}
