@import '../themes';

@include themify() {
  $select-arrow: 'data:image/svg+xml,%3Csvg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 512 512" xml:space="preserve"%3E%3Cpath fill="%23' +
    str-slice(to-string(themed('primaryForegroundColor')), 2, 4) +
    '" d="M256,294.1L383,167c9.4-9.4,24.6-9.4,33.9,0s9.3,24.6,0,34L273,345c-9.1,9.1-23.7,9.3-33.1,0.7L95,201.1 c-4.7-4.7-7-10.9-7-17c0-6.1,2.3-12.3,7-17c9.4-9.4,24.6-9.4,33.9,0L256,294.1z"/%3E%3C/svg%3E%0A';
  $modal-margin: 1.4rem;

  .modal-cover {
    position: fixed;
    display: block;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background: themed('modalOverlayColor');
    width: 100%;
    height: 100%;
    z-index: 50;
    visibility: collapse;
    transition: visibility 0.3s, opacity 0.3s;
  }

  .modal:not(.modal-active) .modal-cover {
    opacity: 0;
  }

  .modal-active .modal-cover {
    z-index: 1024;
    visibility: visible;
  }

  .modal-outer-container {
    pointer-events: none;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100%;
    z-index: 1050;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    visibility: collapse;
    transition: visibility 0.3s;
  }

  .modal-active .modal-outer-container {
    visibility: visible;
  }

  .modal-inner-container {
    padding: 0;
    pointer-events: all;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: themed('modalBackgroundColor');
    backdrop-filter: blur(20px);
    width: 550px;
    min-height: 350px;
    box-shadow: 0 0 60px 5px themed('modalShadowColor');
    text-align: center;
    transition: opacity 0.3s, transform 0.3s;
  }

  .modal:not(.modal-active) .modal-inner-container {
    transform: translateY(50%);
    opacity: 0;
  }

  .modal-header {
    padding: $modal-margin;
    border-bottom: 1px solid themed('highlightBorderColor');
    -webkit-app-region: drag;
  }

  .modal-header h1 {
    font-size: 1.8rem;
    margin-top: 6px;
    margin-bottom: 17px;
  }

  .modal-header p {
    font-size: 1rem;
    margin: 0;
  }

  .modal-header i {
    font-size: 80px;
  }

  .modal-body {
    margin: $modal-margin;
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .modal-body button {
    flex: 0;
  }

  .modal-body hr.divider {
    overflow: visible;
    padding: 0;
    margin-top: 30px;
    margin-bottom: 4px;
    border: none;
    border-top: 1px solid themed('backgroundColor');
    width: 200px;
  }

  .modal-body hr.divider:after {
    content: 'or';
    border-radius: 100rem;
    display: inline-block;
    position: relative;
    top: -15px;
    padding: 5px 10px;
    background: themed('backgroundColor');
  }

  .modal-inner-container .cancel {
    position: absolute;
    right: 20px;
    top: 5px;
    font-size: 2rem;
    padding: 4px;
  }

  .modal-body textarea,
  .modal-body input,
  .modal-body select {
    align-self: stretch;
    font-size: 0.9rem;
    background: themed('backgroundColor');
    color: themed('primaryForegroundColor');
    border: none;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 0.2em;
  }

  .modal-body select {
    background-image: url($select-arrow);
    background-repeat: no-repeat, repeat;
    background-position: right 0.7em top 50%, 0 0;
    background-size: 1rem auto, 100%;
  }

  .modal-body textarea::placeholder,
  .modal-body input::placeholder {
    color: themed('primaryForegroundColor');
  }

  .modal-body textarea {
    font-family: monospace;
    resize: none;
  }

  .modal-inner-container .error-message {
    color: themed('dangerColor');
    margin: 0;
    margin-top: $modal-margin * 0.3;
  }

  .modal-inner-container .message {
    color: themed('primaryColor');
    margin: 0;
    margin-bottom: 10px;
  }

  .modal-action {
    margin: $modal-margin;
  }
}
