@use "../mixins";

.alchemy-image-overlay-container,
.alchemy-dialog-container {
  position: fixed;
  overflow: auto;
  top: 0;
  left: 0;
  z-index: 100;
  width: 100%;
  height: 100%;
  text-align: center;
  white-space: nowrap;
  opacity: 0;
  transform: scale(0.98);
  transition-property: transform, opacity;
  transition-duration: var(--dialog-transition-duration);
  transition-timing-function: ease-in;

  // vertical aligment
  &:before {
    content: "";
    width: 0;
    height: 100%;
    display: inline-block;
    vertical-align: middle;
    margin-right: -0.25em;
  }

  &.open {
    opacity: 1;
    transform: scale(1);
  }
}

.alchemy-image-overlay,
.alchemy-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 30;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0);
  transition: background-color var(--dialog-transition-duration) linear;

  &.closable {
    cursor: pointer;
  }
}

.alchemy-dialog-overlay {
  &.open {
    background-color: var(--dialog-overlay-color);
  }
}

.alchemy-dialog,
.alchemy-image-overlay-dialog {
  position: relative;
  max-width: calc(100vw - var(--spacing-4));
  display: inline-block;
  vertical-align: middle;
  text-align: left;
}

.alchemy-dialog {
  white-space: normal;
  margin: var(--spacing-2);
  @include mixins.border-top-radius(var(--border-radius_medium));
  box-shadow: var(--dialog-box-shadow);
  background-color: var(--dialog-background-color);
  transition: min-height var(--dialog-transition-duration) ease-in-out;

  div#jscropper {
    padding: var(--spacing-2);

    .thumbnail_background {
      width: 800px;
      height: 600px;
      position: relative;
    }

    form,
    .info.message,
    alchemy-message[type="info"] {
      position: absolute;
      right: var(--spacing-2);
      width: 256px;
    }

    .info.message,
    alchemy-message[type="info"] {
      top: var(--spacing-2);
      margin: 0 0 0 var(--spacing-2);
      padding: 0 var(--spacing-2) 0 var(--spacing-8);
    }

    .jcrop-holder {
      display: inline-block;
    }

    img {
      width: auto;
      max-height: 600px;
    }

    form {
      padding: 0;
      bottom: var(--spacing-2);
      margin-left: var(--spacing-2);

      button {
        margin-bottom: 0;
        width: calc(50% - var(--spacing-1));
      }

      button[type="submit"] {
        float: right;
      }
    }
  }
}

.alchemy-dialog-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-1);
  position: relative;
  height: var(--dialog-header-height);
  padding: var(--dialog-header-padding);
  background: var(--dialog-header-color);
  color: var(--dialog-header-text-color);
  font-weight: normal;
  font-size: var(--dialog-header-font-size);
  @include mixins.border-top-radius(var(--border-radius_medium));
}

.alchemy-dialog-title {
  flex-grow: 1;
  font-weight: bold;
  padding: 0 var(--spacing-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  @include mixins.antialiased-font-smoothing;
}

.alchemy-image-overlay-close,
.alchemy-dialog-close {
  cursor: pointer;
  height: 16px;

  .icon {
    fill: currentColor;
  }
}

.alchemy-dialog-close {
  display: inline-flex;
  width: var(--spacing-6);
  height: var(--spacing-6);
  justify-content: center;
  align-items: center;
  background-color: transparent;
  border-color: transparent;
  border-radius: var(--border-radius_medium);
  color: var(--color-white);
  padding: 0;

  &:hover {
    background-color: var(--color-blue_medium);
  }
}

.alchemy-dialog-body {
  position: relative;
  color: var(--text-color);

  .message,
  alchemy-message {
    margin: var(--spacing-2);
  }

  &.padded {
    padding: var(--spacing-4);

    .message,
    alchemy-message {
      margin: 0 0 var(--spacing-2) 0;
    }
  }

  .buttons {
    text-align: right;

    label {
      float: left;
      margin-top: var(--spacing-3);
    }
  }
}

.alchemy-dialog-buttons {
  padding-top: var(--spacing-4);
  text-align: right;

  button:first-child {
    margin-right: var(--spacing-2);
  }
}

#overlay_tabs {
  margin: calc(-1 * var(--spacing-4));
}
