
/* Блок: modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Модификатор: открытое модальное окно */
.modal--open {
    opacity: 1;
    visibility: visible;
}

/* Элемент: затемнение (оверлей) */
.modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    cursor: pointer;
}

/* Элемент: окно модалки */
.modal__window {
    position: relative;
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 0;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
    z-index: 1;
}

/* Анимация появления */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Элемент: заголовок */
.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px 16px;
    border-bottom: 1px solid #e9ecef;
}

/* Элемент: заголовок (текст) */
.modal__title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.3;
}

/* Элемент: кнопка закрытия */
.modal__close {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 50%;
    color: #6c757d;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    padding: 0;
    margin-left: 16px;
}

.modal__close:hover {
    background: #f1f3f5;
    color: #212529;
}

.modal__close:focus-visible {
    outline: 2px solid #0056b3;
    outline-offset: 2px;
}

/* Элемент: тело модального окна */
.modal__body {
    padding: 24px 28px 28px;
}

/* Элемент: футер */
.modal__footer {
    padding: 16px 28px 24px;
    border-top: 1px solid #e9ecef;
    text-align: center;
}

/* Элемент: примечание */
.modal__note {
    font-size: 13px;
    color: #6c757d;
}


.modal__body .wpcf7-form label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 14px;
    color: #1a1a1a;
}

.modal__body .wpcf7-form input,
.modal__body .wpcf7-form textarea,
.modal__body .wpcf7-form select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #ffffff;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.modal__body .wpcf7-form input:focus,
.modal__body .wpcf7-form textarea:focus,
.modal__body .wpcf7-form select:focus {
    outline: none;
    border-color: #0056b3;
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.15);
}

.modal__body .wpcf7-form textarea {
    min-height: 100px;
    resize: vertical;
}

.modal__body .wpcf7-form .wpcf7-submit {
    display: inline-block;
    width: 100%;
    padding: 14px 24px;
    background: #0056b3;
    color: #ffffff;
    border: none;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    text-align: center;
}

.modal__body .wpcf7-form .wpcf7-submit:hover {
    background: #003d82;
}

.modal__body .wpcf7-form .wpcf7-submit:active {
    transform: scale(0.98);
}

/* Стили для ошибок валидации */
.modal__body .wpcf7-not-valid-tip {
    color: #dc3545;
    font-size: 13px;
    margin-top: -12px;
    margin-bottom: 12px;
    display: block;
}

.modal__body .wpcf7-form .wpcf7-not-valid {
    border-color: #dc3545;
}

.modal__body .wpcf7-form .wpcf7-not-valid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

/* Стили для успешной отправки */
.modal__body .wpcf7-response-output {
    margin: 16px 0 0;
    padding: 12px 16px;
    border: none;
    font-size: 14px;
}

.modal__body .wpcf7-response-output.wpcf7-mail-sent-ok {
    background: #d4edda;
    color: #155724;
}

.modal__body .wpcf7-response-output.wpcf7-validation-errors {
    background: #f8d7da;
    color: #721c24;
}



@media (max-width: 768px) {
    .modal__window {
        width: 95%;
        max-height: 95vh;
        border-radius: 12px;
    }
    
    .modal__header {
        padding: 18px 20px 14px;
    }
    
    .modal__title {
        font-size: 19px;
    }
    
    .modal__body {
        padding: 18px 20px 22px;
    }
    
    .modal__body .wpcf7-form input,
    .modal__body .wpcf7-form textarea {
        font-size: 16px; /* Предотвращаем зум на iOS */
        padding: 12px 14px;
    }
    
    .modal__footer {
        padding: 14px 20px 20px;
    }
}

@media (max-width: 480px) {
    .modal__window {
        border-radius: 8px;
    }
    
    .modal__header {
        padding: 14px 16px 12px;
    }
    
    .modal__title {
        font-size: 17px;
    }
    
    .modal__body {
        padding: 14px 16px 18px;
    }
    
    .modal__body .wpcf7-form .wpcf7-submit {
        font-size: 15px;
        padding: 12px 20px;
    }
}
