/**
 * Copyright (c) HashiCorp, Inc.
 * SPDX-License-Identifier: BUSL-1.1
 */

.modal {
  align-items: center;
  bottom: 0;
  left: 0;
  right: 0;
  top: 0;
  display: none;
  justify-content: center;
  overflow: hidden;
  position: fixed;
  z-index: 20;

  &.is-active {
    display: flex;
  }
}

.modal-background {
  background: $ui-gray-100;
  bottom: 0;
  left: 0;
  opacity: 0.9;
  position: absolute;
  right: 0;
  top: 0;
}

.modal-card {
  box-shadow: $box-shadow-highest;
  border: 1px solid $grey-light;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 70px);
  margin-top: 60px;
  min-width: calc(100vw * 0.3);
  overflow: hidden;
  position: relative;

  &-head {
    border-radius: 0;
    background-color: $grey-lightest;
    border-bottom: 1px solid $grey-light;
    display: flex;
    justify-content: flex-start;
    padding: 20px;
  }

  &-foot {
    border-radius: 0;
    border: 0;
    background-color: $white;
    padding: 20px;

    .button:not(:last-child) {
      margin-right: 10px;
    }
  }

  &-title.title {
    margin: 0;
    flex-grow: 1;
  }

  .copy-text {
    background-color: $grey-lightest;
    padding: $spacing-s;
    margin-bottom: $spacing-s;

    code {
      overflow: scroll;
      max-width: calc(100% - 36px);
      background-color: inherit;
    }
  }

  .copy-close {
    margin-top: $spacing-s;
  }
}

.modal-card-title.title {
  display: flex;
  align-items: center;
}

.modal-card-body {
  background-color: $white;
  flex-grow: 1;
  flex-shrink: 1;
  overflow: auto;
  padding: 20px;
}

pre {
  background-color: inherit;
}

.is-highlight {
  .modal-card-head {
    background: $yellow-010;
    border: 1px solid $yellow-100;
  }
  .modal-card-title {
    color: $yellow-dark;
  }
}

.is-danger {
  .modal-card-head {
    background: $red-010;
    border: 1px solid $red-100;
  }
  .modal-card-title {
    color: $red-dark;
  }
}

.modal-confirm-section {
  margin: $spacing-xl 0 $spacing-m;
}

.modal-card-foot-outlined {
  background: $ui-gray-050;
  border-top: $base-border;
}
// kv engine clean up - can remove this style after you remove secret-delete-menu
.modal-radio-button {
  display: flex;
  align-items: baseline;
  margin-bottom: $spacing-xs;

  input {
    top: 2px;
  }

  .helper-text {
    margin-left: 10px;
  }
}

// customize spacing (.modal-card-body is restricted to padding: 20px)
.modal-card-custom {
  background-color: white;
  flex-grow: 1;
  flex-shrink: 1;
  overflow: auto;

  &.has-padding-m {
    padding: $spacing-m;
  }

  &.has-padding-btm-left {
    padding-bottom: $spacing-m;
    padding-left: $spacing-m;
  }
}

// responsive css
@media screen and (min-width: 769px), print {
  .modal-card,
  .modal-content {
    margin: 0 auto;
    max-height: calc(100vh - 40px);
    width: 640px;
  }
}
