/* Любое модальное окно */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
}

.custom-modal.active {
    display: flex !important;
}

.custom-modal__backdrop {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.custom-modal__dialog {
    position: relative;
    background: var(--white);
    padding: 40px 30px 30px;
    max-width: 520px;
    width: 90%;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.custom-modal__close {
    position: absolute;
    top: 12px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    color: var(--white);
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.custom-modal__close:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.custom-modal__content h2 {
    font-size: 24px;
    margin-bottom: 20px;
    color: var(--text-dark);
    text-align: center;
}

/* Стили для CF7 внутри любого модального окна */
.custom-modal .wpcf7-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.custom-modal .wpcf7-form-control:not(.wpcf7-submit):not(.wpcf7-acceptance) {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-light);
    color: var(--text-dark);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    box-sizing: border-box;
    outline: none;
}

.custom-modal .wpcf7-form-control:focus {
    border-color: var(--primary-color);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(224, 46, 122, 0.1);
}

.custom-modal textarea.wpcf7-form-control {
    min-height: 100px;
    resize: vertical;
}

.custom-modal .wpcf7-submit {
    width: 100%;
    padding: 15px 25px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    margin-top: 10px;
}

.custom-modal .wpcf7-submit:hover {
    background: var(--primary-dark);
}

.wpcf7 form .wpcf7-response-output{
    display:none;
}

/* body.modal-open {
    overflow: hidden;
} */

/* ===== МОБИЛЬНАЯ АДАПТАЦИЯ МОДАЛЬНЫХ ОКОН (компактный вид без скролла) ===== */
@media (max-width: 767px) {

    /* ---------- Диалог ---------- */
    .custom-modal__dialog {
        width: calc(100% - 30px);
        max-width: none;
        padding: 20px 15px 15px;          /* компактные внутренние отступы */
        margin: 0 15px;
        max-height: 85vh;                 /* safety net для очень низких экранов */
        overflow-y: auto;                 /* прокрутка появится только если совсем не влезает */
        overflow-x: hidden;
    }

    /* ---------- Крестик ---------- */
    .custom-modal__close {
        top: 6px;
        right: 10px;
        width: 26px;
        height: 26px;
        font-size: 14px;
    }

    /* ---------- Заголовок формы ---------- */
    .custom-modal__content h2 {
        font-size: 18px;
        margin-bottom: 12px;
    }

    /* ---------- Сама форма (убираем лишние отступы) ---------- */
    .custom-modal .wpcf7-form {
        gap: 8px;                         /* меньше расстояние между полями */
    }

    /* Убираем стандартные отступы абзацев внутри CF7 */
    .custom-modal .wpcf7-form p {
        margin: 0;
    }

    /* ---------- Поля ввода ---------- */
    .custom-modal .wpcf7-form-control:not(.wpcf7-submit):not(.wpcf7-acceptance) {
        padding: 10px 12px;
        font-size: 14px;
    }

    /* Текстовая область – ещё компактнее */
    .custom-modal textarea.wpcf7-form-control {
        min-height: 60px;
    }

    /* ---------- Чекбокс согласия ---------- */
    .custom-modal .wpcf7-acceptance .wpcf7-list-item {
        margin: 0;
    }

    .custom-modal .wpcf7-acceptance label {
        display: flex;
        align-items: flex-start;
        gap: 6px;
        font-size: 13px;
        line-height: 1.4;
    }

    /* Блок с текстом согласия – ограничиваем высоту и включаем свою прокрутку */
    .custom-modal .wpcf7-list-item-label {
        display: block;
        max-height: 65px;                 /* примерно 3 строки */
        overflow-y: auto;
        font-size: 12px;
        line-height: 1.35;
    }

    /* ---------- Кнопка отправки ---------- */
    .custom-modal .wpcf7-submit {
        padding: 10px 16px;
        font-size: 14px;
        margin-top: 4px;
    }
}