/* ===================================
   МОДАЛЬНЫЕ ОКНА
   =================================== */

/* Контейнер для всех модальных окон */
#modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
}

#modal-container:empty {
    display: none;
}

/* Модальное окно */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    pointer-events: auto;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal--active {
    opacity: 1;
}

/* Overlay (затемнение фона) */
.modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 26, 0.75);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    cursor: pointer;
}

/* Контент модального окна */
.modal__content {
    position: relative;
    background: #FFFFFF;
    border-radius: 20px;
    padding: 60px;
    max-width: 750px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    z-index: 10000;
}

.modal--active .modal__content {
    transform: scale(1);
}

/* Кнопка закрытия */
.modal__close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.modal__close:hover {
    transform: rotate(90deg);
}

.modal__close svg {
    width: 24px;
    height: 24px;
    stroke: #1A1A1A;
    stroke-width: 2;
    transition: stroke 0.2s ease;
}

.modal__close:hover svg {
    stroke: var(--color-primary, #D50E2E);
}

/* Заголовок формы */
.modal__title {
    font-family: 'Roboto Condensed', sans-serif;
    font-weight: 800;
    font-size: 36px;
    line-height: 1.2;
    text-transform: uppercase;
    margin: 0 0 40px 0;
    color: #1A1A1A;
}

.modal__title.warning {
    margin-bottom: 10px;
}

.beh2.popup {
    margin-bottom: 20px;
}

.modal__title .text-red {
    color: var(--color-primary, #D50E2E);
}

/* Форма */
.modal__form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Группа полей формы */
.modal__form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal__form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Label (скрыт, но доступен для screen readers) */
.modal__form-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Поля ввода */
.modal__form-input,
.modal__form-textarea {
    width: 100%;
    padding: 18px 20px;
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.4;
    color: #1A1A1A;
    background: #FFFFFF;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    outline: none;
    transition: all 0.3s ease;
}

.modal__form-input::placeholder,
.modal__form-textarea::placeholder {
    color: #999999;
}

.modal__form-input:focus,
.modal__form-textarea:focus {
    border-color: var(--color-primary, #D50E2E);
    box-shadow: 0 0 0 3px rgba(213, 14, 46, 0.1);
}

.modal__form-input.error,
.modal__form-textarea.error {
    border-color: #ff4444;
    background: #fff5f5;
}

.modal__form-checkbox input[type="checkbox"].error {
    border-color: #ff4444;
    box-shadow: 0 0 0 2px rgba(255, 68, 68, 0.2);
}

.modal__form-checkbox.error {
    outline: 2px solid #ff4444;
    outline-offset: 2px;
    border-radius: 4px;
    padding: 4px;
    margin: -4px;
}

.modal__form-textarea {
    min-height: 120px;
    resize: vertical;
}

/* Кнопка отправки */
.modal__form-submit {
    width: 100%;
    padding: 18px 25px;
    font-family: 'Roboto', sans-serif;
    font-weight: 600;
    font-size: 18px;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.36px;
    color: #FFFFFF;
    background: var(--color-primary, #D50E2E);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.modal__form-submit:hover {
    background: #b50c26;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(213, 14, 46, 0.3);
}

.modal__form-submit:active {
    transform: translateY(0);
}

.modal__form-submit:disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
}

/* Чекбоксы */
.modal__form-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.modal__form-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.modal__form-checkbox input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 1px solid #E0E0E0;
    border-radius: 4px;
    background: #FFFFFF;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.modal__form-checkbox input[type="checkbox"]:checked {
    background: var(--color-primary, #D50E2E);
    border-color: var(--color-primary, #D50E2E);
}

.modal__form-checkbox input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 6px;
    width: 5px;
    height: 10px;
    border: solid #FFFFFF;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.modal__form-checkbox-label {
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 1.4;
    color: #666666;
}

.modal__form-checkbox-label a {
    color: var(--color-primary, #D50E2E);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.modal__form-checkbox-label a:hover {
    opacity: 0.8;
}

/* Ошибки */
.modal__error {
    padding: 15px 20px;
    background: #ffebee;
    border-left: 4px solid #ff4444;
    border-radius: 8px;
    margin-bottom: 20px;
}

.modal__error p {
    margin: 0;
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 1.4;
    color: #c62828;
}

.modal__error p + p {
    margin-top: 8px;
}

/* Успешная отправка */
.modal__success {
    text-align: center;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.modal__success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 30px;
    animation: successScale 0.6s ease;
}

@keyframes successScale {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.modal__success-title {
    font-family: 'Roboto Condensed', sans-serif;
    font-weight: 800;
    font-size: 36px;
    line-height: 1.2;
    text-transform: uppercase;
    margin: 0 0 20px 0;
    color: #1A1A1A;
}

.modal__success-text {
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.5;
    color: #666666;
    margin: 0;
    max-width: 450px;
}

/* Скрываем кнопку закрытия в success-сообщении */
.modal__success-btn {
    display: none;
}

/* Loader */
.modal__loader {
    text-align: center;
    padding: 40px;
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    font-size: 16px;
    color: #666666;
}


.modal__form-checkbox input[type="checkbox"].error

/* Адаптивность */
@media (max-width: 768px) {
    .modal__content {
        padding: 40px 30px;
        width: 95%;
        max-height: 95vh;
    }

    .modal__title {
        font-size: 28px;
        margin-bottom: 30px;
    }

    .modal__form-row {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .modal__form-input,
    .modal__form-textarea {
        padding: 16px 18px;
        font-size: 15px;
    }

    .modal__form-submit {
        padding: 16px 20px;
        font-size: 16px;
    }

    .modal__close {
        top: 15px;
        right: 15px;
        width: 36px;
        height: 36px;
    }

    .modal__close svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    .modal__content {
        padding: 30px 20px;
    }

    .modal__title {
        font-size: 24px;
        margin-bottom: 25px;
    }

    .modal__form-input,
    .modal__form-textarea {
        padding: 14px 16px;
        font-size: 14px;
    }

    .modal__form-submit {
        padding: 14px 18px;
        font-size: 15px;
    }
}
