/**
 * tilda-forms-fix.css
 * Исправления для отображения кнопок submit в формах Tilda
 */

/* Убеждаемся, что кнопки submit всегда видны */
.t-form__submit {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.t-form__submit button[type="submit"],
.t-form__submit .t-submit,
button.t-submit[type="submit"] {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Убираем скрытие кнопок через display: none */
form .t-form__submit[style*="display: none"],
form .t-form__submit[style*="display:none"] {
    display: block !important;
}

form .t-form__submit button[style*="display: none"],
form .t-form__submit button[style*="display:none"],
form button.t-submit[style*="display: none"],
form button.t-submit[style*="display:none"] {
    display: inline-block !important;
}

/* Убеждаемся, что кнопки видны в попапах */
.t-popup .t-form__submit,
.t-popup .t-form__submit button,
.t-popup button.t-submit {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Отключаем проблемную маску телефона Tilda */
input.js-phonemask-input {
    /* Убираем класс маски, чтобы можно было вводить любой номер */
}

/* Простая маска для российских телефонов */
input[type="tel"][name="Phone"],
input[type="tel"][name="phone"] {
    /* Разрешаем ввод любых символов */
    -webkit-appearance: textfield;
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Исправления для попапов Tilda */
.t-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.t-popup_show {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    align-items: center;
    justify-content: center;
}

.t-popup::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: -1;
}

.t-popup__container {
    position: relative;
    z-index: 1;
    background: white;
    border-radius: 8px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

/* Кнопки для открытия попапов */
a[href^="#popup"] {
    cursor: pointer !important;
    pointer-events: auto !important;
    text-decoration: none;
}

a[href^="#popup"]:hover {
    opacity: 0.8;
}

/* Исправления для сообщения об успехе */
.t-form__successbox {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

.t-form__successbox[style*="display: block"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Убираем лишние элементы маски телефона */
.t-input-group_ph .t-input-block {
    width: 100% !important;
}

.t-input-group_ph input[type="text"],
.t-input-group_ph input[type="tel"] {
    width: 100% !important;
    padding: 12px !important;
    border: 1px solid #c9c9c9 !important;
    border-radius: 5px !important;
}

/* Скрываем дополнительные элементы маски */
.t-input-group_ph > *:not(.t-input-block):not(.t-input-error) {
    display: none !important;
}

/* Улучшаем внешний вид формы */
.t-form__inputsbox {
    margin-bottom: 20px;
}

.t-input-group {
    margin-bottom: 15px;
}

.t-input-group:last-child {
    margin-bottom: 0;
}
