/*
 * Sonar UI Common
 * Copyright (C) 2019-2020 SonarSource SA
 * mailto:info AT sonarsource DOT com
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
.modal,
.ReactModal__Content {
  position: fixed;
  z-index: var(--modalZIndex);
  top: 0;
  left: 50%;
  margin-left: -270px;
  width: 540px;
  background-color: #fff;
  opacity: 0;
  transition: all 0.2s ease;
  border-radius: 3px;
}

.modal:focus,
.ReactModal__Content:focus {
  outline: none;
}

.modal.in,
.ReactModal__Content--after-open {
  top: 15%;
  opacity: 1;
}

.modal-small {
  width: 450px;
  margin-left: -225px;
}

.modal-medium {
  width: 830px;
  margin-left: -415px;
}

.modal-large {
  width: calc(100% - 40px);
  max-width: 1280px;
  min-width: 1040px;
  margin-left: 0;
  transform: translateX(-50%);
}

.modal-overlay,
.ReactModal__Overlay {
  position: fixed;
  z-index: var(--modalOverlayZIndex);
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(0, 0, 0, 0.7);
  opacity: 0;
  transition: all 0.2s ease;
}

.modal-overlay.in,
.ReactModal__Overlay--after-open {
  opacity: 1;
}

.modal-no-backdrop {
  background-color: transparent;
}

.modal-open,
.ReactModal__Body--open {
  overflow: hidden;
  margin-right: var(--sbw);
}

.modal-head {
  padding: calc(4 * var(--gridSize));
  padding-bottom: 0;
}

.modal-head h1,
.modal-head h2 {
  margin: 0;
  font-size: var(--bigFontSize);
  font-weight: bold;
  line-height: normal;
  overflow-wrap: break-word;
}

.modal-body {
  padding: var(--pagePadding) calc(4 * var(--gridSize));
}

.modal-container {
  max-height: 60vh;
  box-sizing: border-box;
  overflow-y: auto;
  border-top: 1px solid var(--barBorderColor);
  margin-top: var(--pagePadding);
  padding-right: calc(4 * var(--gridSize));
}

.modal-container > :last-child {
  margin-bottom: var(--pagePadding);
}

.modal-field,
.modal-validation-field {
  clear: both;
  display: block;
  padding: 0;
  margin-bottom: calc(var(--gridSize) * 2);
}

.modal-field label,
.modal-validation-field label {
  display: block;
  font-weight: bold;
  padding-bottom: calc(var(--gridSize) / 2);
}

.modal-field a.icon-checkbox,
.modal-field input,
.modal-field select,
.modal-field textarea,
.modal-field .Select {
  margin-right: 5px;
}

.modal-field a.icon-checkbox {
  height: 24px;
}

.modal-field input[type='radio'],
.modal-field input[type='checkbox'] {
  margin-top: 5px;
  margin-bottom: 4px;
}

.modal-field > .icon-checkbox {
  padding-top: 6px;
  padding-right: 8px;
}

.modal-field input[type='text'],
.modal-field input[type='email'],
.modal-field input[type='password'],
.modal-field textarea,
.modal-field select,
.modal-field .Select {
  width: 100%;
}

.modal-validation-field input,
.modal-validation-field textarea,
.modal-validation-field .Select {
  margin-right: var(--gridSize);
  margin-bottom: 2px;
  width: calc(100% - 3 * var(--gridSize));
}

.modal-field textarea,
.modal-validation-field textarea {
  max-width: 100%;
  min-width: 100%;
  max-height: 50vh;
  min-height: var(--controlHeight);
}
.modal-validation-field input:not(.is-invalid),
.modal-validation-field .Select:not(.is-invalid) {
  margin-bottom: calc(var(--tinyControlHeight) + 2px);
}

.modal-field-description {
  line-height: 1.4;
  color: var(--secondFontColor);
  font-size: var(--smallFontSize);
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.modal-foot {
  padding: var(--pagePadding) calc(4 * var(--gridSize));
  border-top: 1px solid var(--barBorderColor);
  background-color: var(--barBackgroundColor);
  border-radius: 3px;
  text-align: right;
}

.modal-foot button,
.modal-foot .button,
.modal-foot input[type='submit'],
.modal-foot input[type='button'] {
  margin-left: var(--gridSize);
}
