/**
 * Профессиональные стили для модальных окон
 * Полная блокировка всех анимаций и переходов
 * Мгновенное открытие/закрытие
 */

/* ============================================================================
   ПОЛНАЯ БЛОКИРОВКА ВСЕХ АНИМАЦИЙ И ПЕРЕХОДОВ
   Максимальная специфичность для переопределения OneUI
   ============================================================================ */
html body .modal,
html body .modal *,
html body .modal *::before,
html body .modal *::after,
html body .modal-backdrop,
html body .modal-backdrop *,
html body [class*="modal"],
html body [class*="fade"] {
    transition: none !important;
    -webkit-transition: none !important;
    -moz-transition: none !important;
    -ms-transition: none !important;
    -o-transition: none !important;
    animation: none !important;
    -webkit-animation: none !important;
    -moz-animation: none !important;
    -ms-animation: none !important;
    -o-animation: none !important;
    animation-duration: 0s !important;
    -webkit-animation-duration: 0s !important;
    -moz-animation-duration: 0s !important;
    -ms-animation-duration: 0s !important;
    -o-animation-duration: 0s !important;
    transition-duration: 0s !important;
    -webkit-transition-duration: 0s !important;
    -moz-transition-duration: 0s !important;
    -ms-transition-duration: 0s !important;
    -o-transition-duration: 0s !important;
    animation-delay: 0s !important;
    -webkit-animation-delay: 0s !important;
    transition-delay: 0s !important;
    -webkit-transition-delay: 0s !important;
    transform: none !important;
    -webkit-transform: none !important;
    -moz-transform: none !important;
    -ms-transform: none !important;
    -o-transform: none !important;
}

/* ============================================================================
   ПЕРЕОПРЕДЕЛЕНИЕ ВСЕХ СТИЛЕЙ ИЗ UI-ENHANCEMENTS.CSS ДЛЯ МОДАЛЬНЫХ ОКОН
   Блокируем все эффекты, которые могут быть применены из ui-enhancements.css
   ============================================================================ */
html body .modal .block,
html body .modal .card,
html body .modal .btn,
html body .modal .table,
html body .modal .badge,
html body .modal .form-control,
html body .modal .form-control-alt,
html body .modal .alert,
html body .modal .block-header,
html body .modal .block-title,
html body .modal .block-content,
html body .modal .card-header,
html body .modal .card-title,
html body .modal .card-body,
html body .modal .nav-main-link,
html body .modal .items-push .block,
html body .modal .block-link-shadow {
    transition: none !important;
    -webkit-transition: none !important;
    -moz-transition: none !important;
    animation: none !important;
    -webkit-animation: none !important;
    -moz-animation: none !important;
    transform: none !important;
    -webkit-transform: none !important;
    -moz-transform: none !important;
    box-shadow: none !important;
}

html body .modal .block:hover,
html body .modal .card:hover,
html body .modal .btn:hover,
html body .modal .block-link-shadow:hover,
html body .modal .items-push .block:hover {
    transform: none !important;
    -webkit-transform: none !important;
    box-shadow: none !important;
    transition: none !important;
}

html body .modal .btn-primary:hover,
html body .modal .btn-success:hover,
html body .modal .btn-danger:hover {
    transform: none !important;
    box-shadow: none !important;
}

html body .modal .nav-main-link:hover {
    transform: none !important;
    background: transparent !important;
}

html body .modal .nav-main-link:hover::before {
    height: 0 !important;
}

html body .modal .nav-main-link-icon:hover {
    transform: none !important;
}

html body .modal .table tbody tr:hover {
    background: transparent !important;
}

html body .modal *::before,
html body .modal *::after {
    transition: none !important;
    animation: none !important;
    transform: none !important;
}

/* ============================================================================
   БАЗОВЫЕ СТИЛИ МОДАЛЬНОГО ОКНА
   ============================================================================ */
.modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 1050 !important;
    width: 100% !important;
    height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    outline: 0 !important;
    transition: none !important;
    animation: none !important;
}

.modal.show,
.modal.in,
.modal.show.in {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transition: none !important;
    animation: none !important;
}

.modal:not(.show):not(.in) {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* ============================================================================
   БЛОКИРОВКА FADE АНИМАЦИЙ
   ============================================================================ */
.modal.fade,
.modal.fade * {
    opacity: 1 !important;
    transition: none !important;
    -webkit-transition: none !important;
    -moz-transition: none !important;
    animation: none !important;
    -webkit-animation: none !important;
    -moz-animation: none !important;
}

.modal.fade.show,
.modal.fade.in,
.modal.fade.show.in {
    opacity: 1 !important;
    display: block !important;
}

.modal.fade:not(.show):not(.in) {
    opacity: 0 !important;
    display: none !important;
}

/* ============================================================================
   МОДАЛЬНЫЙ ДИАЛОГ
   ============================================================================ */
.modal-dialog {
    position: relative;
    width: auto;
    margin: 0.5rem;
    pointer-events: none;
    transform: none !important;
    -webkit-transform: none !important;
    -moz-transform: none !important;
    transition: none !important;
    animation: none !important;
}

@media (min-width: 576px) {
    .modal-dialog {
        max-width: 500px;
        margin: 1.75rem auto;
    }
}

.modal.show .modal-dialog,
.modal.in .modal-dialog,
.modal.show.in .modal-dialog {
    pointer-events: auto;
    transform: none !important;
}

/* ============================================================================
   МОДАЛЬНЫЙ КОНТЕНТ
   ============================================================================ */
.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    pointer-events: auto;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 0.3rem;
    outline: 0;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.5);
    transition: none !important;
    animation: none !important;
}

/* ============================================================================
   МОДАЛЬНЫЙ HEADER
   ============================================================================ */
.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    border-top-left-radius: calc(0.3rem - 1px);
    border-top-right-radius: calc(0.3rem - 1px);
}

.modal-header .close,
.modal-header .btn-close {
    padding: 1rem;
    margin: -1rem -1rem -1rem auto;
    background: transparent;
    border: 0;
    opacity: 0.5;
    cursor: pointer;
    transition: none !important;
}

.modal-header .close:hover,
.modal-header .btn-close:hover {
    opacity: 1;
}

.modal-title {
    margin-bottom: 0;
    line-height: 1.5;
}

/* ============================================================================
   МОДАЛЬНЫЙ BODY
   ============================================================================ */
.modal-body {
    position: relative;
    flex: 1 1 auto;
    padding: 1rem;
}

/* ============================================================================
   МОДАЛЬНЫЙ FOOTER
   ============================================================================ */
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 1rem;
    border-top: 1px solid #dee2e6;
    border-bottom-right-radius: calc(0.3rem - 1px);
    border-bottom-left-radius: calc(0.3rem - 1px);
}

.modal-footer > * {
    margin-left: 0.25rem;
}

.modal-footer > *:first-child {
    margin-left: 0;
}

/* ============================================================================
   BACKDROP
   ============================================================================ */
.modal-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 1040 !important;
    width: 100vw !important;
    height: 100vh !important;
    background-color: #000 !important;
    opacity: 0.5 !important;
    transition: none !important;
    animation: none !important;
    display: block !important;
}

.modal-backdrop.fade {
    opacity: 0.5 !important;
    transition: none !important;
}

.modal-backdrop.show,
.modal-backdrop.in,
.modal-backdrop.show.in {
    opacity: 0.5 !important;
    display: block !important;
}

.modal-backdrop:not(.show):not(.in) {
    display: none !important;
    opacity: 0 !important;
}

/* ============================================================================
   BODY БЛОКИРОВКА ПРОКРУТКИ
   ============================================================================ */
body.modal-open {
    overflow: hidden !important;
    padding-right: 0 !important;
}

/* ============================================================================
   РАЗМЕРЫ МОДАЛЬНЫХ ОКОН
   ============================================================================ */
.modal-sm {
    max-width: 300px;
}

@media (min-width: 576px) {
    .modal-dialog {
        max-width: 500px;
        margin: 1.75rem auto;
    }
    
    .modal-sm {
        max-width: 300px;
    }
}

@media (min-width: 992px) {
    .modal-lg {
        max-width: 800px;
    }
    
    .modal-xl {
        max-width: 1140px;
    }
}

.modal-lg {
    max-width: 800px;
}

.modal-xl {
    max-width: 1140px;
}

/* ============================================================================
   ДОПОЛНИТЕЛЬНАЯ ЗАЩИТА ОТ АНИМАЦИЙ
   Переопределяем все возможные варианты
   ============================================================================ */
[class*="modal"] *,
[class*="modal"] *::before,
[class*="modal"] *::after {
    transition: none !important;
    animation: none !important;
}

[class*="fade"] *,
[class*="fade"] *::before,
[class*="fade"] *::after {
    transition: none !important;
    animation: none !important;
}

/* Блокируем все @keyframes анимации */
@keyframes fadeIn {
    from { opacity: 1 !important; }
    to { opacity: 1 !important; }
}

@keyframes fadeOut {
    from { opacity: 1 !important; }
    to { opacity: 1 !important; }
}

@keyframes slideInDown {
    from { transform: none !important; }
    to { transform: none !important; }
}

@keyframes slideInUp {
    from { transform: none !important; }
    to { transform: none !important; }
}