/* mixins & extensions */
@keyframes in {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}
@keyframes in-down {
  0% {
    opacity: 0;
    transform: translate3D(0, -5px, 0);
  }
  100% {
    opacity: 1;
    transform: translate3D(0, 0, 0);
  }
}
@keyframes in-up {
  0% {
    opacity: 0;
    transform: translate3D(0, 5px, 0);
  }
  100% {
    opacity: 1;
    transform: translate3D(0, 0, 0);
  }
}
@keyframes in-scale {
  0% {
    opacity: 0;
    transform: scale3D(0.95, 0.95, 1);
  }
  100% {
    opacity: 1;
    transform: scale3D(1, 1, 1);
  }
}
:root {
  --calcite-animation-timing: calc(150ms * var(--calcite-internal-duration-factor));
  --calcite-internal-duration-factor: var(--calcite-duration-factor, 1);
  --calcite-internal-animation-timing-fast: calc(100ms * var(--calcite-internal-duration-factor));
  --calcite-internal-animation-timing-medium: calc(200ms * var(--calcite-internal-duration-factor));
  --calcite-internal-animation-timing-slow: calc(300ms * var(--calcite-internal-duration-factor));
}

.calcite-animate {
  opacity: 0;
  animation-fill-mode: both;
  animation-duration: var(--calcite-animation-timing);
}

.calcite-animate__in {
  animation-name: in;
}

.calcite-animate__in-down {
  animation-name: in-down;
}

.calcite-animate__in-up {
  animation-name: in-up;
}

.calcite-animate__in-scale {
  animation-name: in-scale;
}

/**
* Currently only used in Checkbox.
*/
:root {
  --calcite-popper-transition: var(--calcite-animation-timing);
}

:host([hidden]) {
  display: none;
}

/**
* CSS Custom Properties
*
* These properties can be overridden using the component's tag as selector.
*
* @prop --calcite-modal-content-text: the font-size of the modal content
* @prop --calcite-modal-padding: the top/bottom padding around items in the modal
* @prop --calcite-modal-padding-large: the left/right padding around items in the modal
* @prop --calcite-modal-title-text: the font-size of the modal title
* @prop --calcite-scrim-background: the semi-transparent background color behind modal
*/
:host {
  position: fixed;
  top: 0px;
  right: 0px;
  bottom: 0px;
  left: 0px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: hidden;
  color: var(--calcite-ui-text-2);
  opacity: 0;
  visibility: hidden !important;
  transition: visibility 0ms linear 300ms, opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88);
  z-index: 101;
}

:host([scale=s]) {
  --calcite-modal-padding: 0.75rem;
  --calcite-modal-padding-large: 1rem;
  --calcite-modal-title-text: var(--calcite-font-size-1);
  --calcite-modal-content-text: var(--calcite-font-size--1);
}

:host([scale=m]) {
  --calcite-modal-padding: 1rem;
  --calcite-modal-padding-large: 1.25rem;
  --calcite-modal-title-text: var(--calcite-font-size-2);
  --calcite-modal-content-text: var(--calcite-font-size-0);
}

:host([scale=l]) {
  --calcite-modal-padding: 1.25rem;
  --calcite-modal-padding-large: 1.5rem;
  --calcite-modal-title-text: var(--calcite-font-size-3);
  --calcite-modal-content-text: var(--calcite-font-size-1);
}

.scrim {
  --calcite-scrim-background: rgba(0, 0, 0, 0.75);
  position: fixed;
  top: 0px;
  right: 0px;
  bottom: 0px;
  left: 0px;
  display: flex;
  overflow-y: hidden;
}

.modal {
  pointer-events: none;
  float: none;
  margin: 1.5rem;
  box-sizing: border-box;
  display: flex;
  width: 100%;
  flex-direction: column;
  border-radius: 0.25rem;
  background-color: var(--calcite-ui-foreground-1);
  opacity: 0;
  --tw-shadow: 0 2px 12px -4px rgba(0, 0, 0, 0.2), 0 2px 4px -2px rgba(0, 0, 0, 0.16);
  --tw-shadow-colored: 0 2px 12px -4px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);
  box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
  overflow: hidden;
  z-index: 102;
  -webkit-overflow-scrolling: touch;
  visibility: hidden;
  transition: transform var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), visibility 0ms linear 300ms, opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88);
  transform: translate3d(0, 20px, 0);
}

:host([active]) {
  opacity: 1;
  visibility: visible !important;
  transition-delay: 0ms;
}
:host([active]) .modal {
  pointer-events: auto;
  visibility: visible;
  opacity: 1;
  transform: translate3d(0, 0, 0);
  transition: transform var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), visibility 0ms linear, opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), max-width var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), max-height var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88);
  transition-delay: 0ms;
}

/**
 * Header
 */
.header {
  display: flex;
  min-width: 0px;
  max-width: 100%;
  border-top-left-radius: 0.25rem;
  border-top-right-radius: 0.25rem;
  border-width: 0px;
  border-bottom-width: 1px;
  border-style: solid;
  border-color: var(--calcite-ui-border-3);
  background-color: var(--calcite-ui-foreground-1);
  flex: 0 0 auto;
  z-index: 2;
}

.close {
  order: 2;
  margin: 0px;
  cursor: pointer;
  -webkit-appearance: none;
          appearance: none;
  border-style: none;
  background-color: transparent;
  color: var(--calcite-ui-text-3);
  outline-offset: 0;
  outline-color: transparent;
  transition: outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;
  transition-property: all;
  transition-duration: var(--calcite-animation-timing);
  transition-timing-function: ease-in-out;
  transition-delay: 0s;
  border-start-end-radius: 0.25rem;
  padding: var(--calcite-modal-padding);
  flex: 0 0 auto;
}
.close calcite-icon {
  pointer-events: none;
  vertical-align: -2px;
}
.close:focus {
  outline: 2px solid var(--calcite-ui-brand);
  outline-offset: -2px;
}
.close:hover, .close:focus, .close:active {
  background-color: var(--calcite-ui-foreground-2);
  color: var(--calcite-ui-text-1);
}

.title {
  order: 1;
  display: flex;
  min-width: 0px;
  align-items: center;
  flex: 1 1 auto;
  padding: var(--calcite-modal-padding) var(--calcite-modal-padding-large);
}

slot[name=header]::slotted(*), *::slotted([slot=header]) {
  margin: 0px;
  font-weight: var(--calcite-font-weight-normal);
  color: var(--calcite-ui-text-1);
  font-size: var(--calcite-modal-title-text);
}

/**
 * Content area
 */
.content {
  position: relative;
  box-sizing: border-box;
  display: block;
  height: 100%;
  overflow: auto;
  background-color: var(--calcite-ui-foreground-1);
  padding: 0px;
  max-height: calc(100vh - 12rem);
  z-index: 1;
}

.content--spaced {
  padding: var(--calcite-modal-padding) var(--calcite-modal-padding-large);
}

.content--no-footer {
  border-bottom-right-radius: 0.25rem;
  border-bottom-left-radius: 0.25rem;
}

slot[name=content]::slotted(*),
*::slotted([slot=content]) {
  font-size: var(--calcite-modal-content-text);
}

:host([background-color=grey]) .content {
  background-color: var(--calcite-ui-background);
}

/**
 * Footer
 */
.footer {
  margin-top: auto;
  box-sizing: border-box;
  display: flex;
  width: 100%;
  justify-content: space-between;
  border-bottom-right-radius: 0.25rem;
  border-bottom-left-radius: 0.25rem;
  border-width: 0px;
  border-top-width: 1px;
  border-style: solid;
  border-color: var(--calcite-ui-border-3);
  background-color: var(--calcite-ui-foreground-1);
  flex: 0 0 auto;
  padding: var(--calcite-modal-padding) var(--calcite-modal-padding-large);
  z-index: 2;
}

.footer--hide-back .back, .footer--hide-secondary .secondary {
  display: none;
}

.back {
  display: block;
  margin-inline-end: auto;
}

.secondary {
  margin-left: 0.25rem;
  margin-right: 0.25rem;
  display: block;
}

slot[name=primary] {
  display: block;
}

/**
 * Sizes
 */
:host([width=small]) .modal {
  width: auto;
}

:host([width=s]) .modal {
  max-width: 32rem;
}

@media screen and (max-width: 35rem) {
  :host([width=s]) .modal {
    margin: 0px;
  }
  :host([width=s]) .modal {
    height: 100%;
  }
  :host([width=s]) .modal {
    max-height: 100%;
  }
  :host([width=s]) .modal {
    width: 100%;
  }
  :host([width=s]) .modal {
    max-width: 100%;
  }
  :host([width=s]) .modal {
    border-radius: 0px;
  }
  :host([width=s]) .content {
    flex: 1 1 auto;
    max-height: unset;
  }

  :host([width=s][docked]) {
    align-items: flex-end;
  }
}
:host([width=m]) .modal {
  max-width: 48rem;
}

@media screen and (max-width: 51rem) {
  :host([width=m]) .modal {
    margin: 0px;
  }
  :host([width=m]) .modal {
    height: 100%;
  }
  :host([width=m]) .modal {
    max-height: 100%;
  }
  :host([width=m]) .modal {
    width: 100%;
  }
  :host([width=m]) .modal {
    max-width: 100%;
  }
  :host([width=m]) .modal {
    border-radius: 0px;
  }
  :host([width=m]) .content {
    flex: 1 1 auto;
    max-height: unset;
  }

  :host([width=m][docked]) {
    align-items: flex-end;
  }
}
:host([width=l]) .modal {
  max-width: 94rem;
}

@media screen and (max-width: 97rem) {
  :host([width=l]) .modal {
    margin: 0px;
  }
  :host([width=l]) .modal {
    height: 100%;
  }
  :host([width=l]) .modal {
    max-height: 100%;
  }
  :host([width=l]) .modal {
    width: 100%;
  }
  :host([width=l]) .modal {
    max-width: 100%;
  }
  :host([width=l]) .modal {
    border-radius: 0px;
  }
  :host([width=l]) .content {
    flex: 1 1 auto;
    max-height: unset;
  }

  :host([width=l][docked]) {
    align-items: flex-end;
  }
}
/**
 * Fullscreen
 */
:host([fullscreen]) {
  background-color: transparent;
}
:host([fullscreen]) .modal {
  margin: 0px;
  height: 100%;
  max-height: 100%;
  width: 100%;
  max-width: 100%;
  transform: translate3D(0, 20px, 0) scale(0.95);
}
:host([fullscreen]) .content {
  max-height: 100%;
  flex: 1 1 auto;
}

:host([active][fullscreen]) .modal {
  transform: translate3D(0, 0, 0) scale(1);
}
:host([active][fullscreen]) .header {
  border-radius: 0;
}
:host([active][fullscreen]) .footer {
  border-radius: 0;
}

/**
 * Docked
 */
:host([docked]) .modal {
  height: auto;
}
:host([docked]) .content {
  height: auto;
  flex: 1 1 auto;
}
@media screen and (max-width: 860px) {
  :host([docked]) .modal {
    border-radius: var(--calcite-border-radius) var(--calcite-border-radius) 0 0;
  }
  :host([docked]) .close {
    border-start-end-radius: var(--calcite-border-radius);
  }
}

/**
 * Colors
 */
:host([color=red]) .modal {
  border-color: var(--calcite-ui-danger);
}

:host([color=blue]) .modal {
  border-color: var(--calcite-ui-info);
}

:host([color=red]) .modal, :host([color=blue]) .modal {
  border-width: 0px;
  border-top-width: 4px;
  border-style: solid;
}
:host([color=red]) .header, :host([color=blue]) .header {
  border-radius: 0.25rem;
  border-bottom-right-radius: 0px;
  border-bottom-left-radius: 0px;
}

/**
 * Tablet
 */
@media screen and (max-width: 860px) {
  slot[name=header]::slotted(*), *::slotted([slot=header]) {
    font-size: var(--calcite-font-size-1);
  }

  .footer {
    position: sticky;
  }

  .footer {
    bottom: 0px;
  }
}
/**
 * Mobile
 */
@media screen and (max-width: 480px) {
  .footer {
    flex-direction: column;
  }

  .back, .secondary {
    margin: 0px;
  }

  .back, .secondary {
    margin-bottom: 0.25rem;
  }
}