/**
 * Forms Popup Styles for Landing New Template
 * Стили для попапа с формой в новом шаблоне лендинга
 */

/* Оверлей попапа - прозрачный белый с блюром */
.mfp-bg {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 1 !important;
}

/* Контейнер попапа */
.mfp-wrap {
    position: fixed;
    width: 100%;
    overflow: hidden auto;
    height: 100%;
    background: rgb(255 255 255 / 24%) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 9999;
}

/* SweetAlert поверх Magnific Popup */
.swal2-container {
    z-index: 99999 !important;
}
.swal2-container .swal2-popup {
    z-index: 99999 !important;
}
.md-content.mfp-hide {
    display: none;
}

.mfp-container {
    padding: 20px;
}

/* Контент попапа */
.mfp-content {
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
}

.mfp-wrap .hidden,
.mfp-wrap .info-elem {
    display: none !important;
}

.mfp-wrap .md-content#form2_popup form {
    padding-bottom: 0 !important;
}

.mfp-wrap .md-content#form2_popup button.mfp-close {
    font-size: 52px !important;
    position: absolute;
}

/* Обертка формы */
#form2_popup {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    padding: 0;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
}

#form2_popup > div {
    padding: 40px;
    position: relative;
}

/* Кнопка закрытия */
.mfp-close {
    width: 40px !important;
    height: 40px !important;
    line-height: 40px !important;
    text-align: center !important;
    font-size: 28px !important;
    color: #333 !important;
    opacity: 0.6 !important;
    top: 15px !important;
    right: 15px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border-radius: 50% !important;
    transition: all 0.3s ease !important;
    z-index: 10 !important;
}

.mfp-close:hover {
    opacity: 1 !important;
    background: rgba(255, 255, 255, 1) !important;
    transform: rotate(90deg);
}

/* Заголовок формы */
#form2_popup h1,
#form2_popup h2,
p.title,
#form2_popup legend {
    font-size: 22px !important;
    font-weight: 600 !important;
    color: #1a1a1a !important;
    margin: 0 0 26px 0 !important;
    padding: 0 !important;
    line-height: 1.3 !important;
}

/*.mfp-content legend {
    display: none !important;
}*/
#form2_popup legend {
    display: block;
    width: 100%;
    margin-bottom: 25px;
    padding: 0;
    border: none;
}

/* Поля формы */
#form2_popup fieldset {
    border: none;
    padding: 0;
    margin: 0 0 0 0;
}

#form2_popup .form-group {
    margin-bottom: 20px;
}

#form2_popup label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
    line-height: 1.4;
}

#form2_popup input[type="text"],
#form2_popup input[type="tel"],
#form2_popup input[type="email"],
#form2_popup input[type="number"],
#form2_popup textarea {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    line-height: 1.5;
    color: #1a1a1a;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

#form2_popup input[type="text"]:focus,
#form2_popup input[type="tel"]:focus,
#form2_popup input[type="email"]:focus,
#form2_popup input[type="number"]:focus,
#form2_popup textarea:focus {
    outline: none;
    border-color: #d6151b;
    box-shadow: 0 0 0 3px rgba(214, 21, 27, 0.1);
}

#form2_popup input[type="text"]::placeholder,
#form2_popup input[type="tel"]::placeholder,
#form2_popup input[type="email"]::placeholder,
#form2_popup input[type="number"]::placeholder,
#form2_popup textarea::placeholder {
    color: #999;
    opacity: 1;
}

#form2_popup textarea {
    min-height: 120px;
    resize: vertical;
}

/* Селекты */
#form2_popup .select,
#form2_popup fieldset > .select {
    position: relative;
    margin-bottom: 20px;
}

#form2_popup .select select,
#form2_popup fieldset > .select select {
    width: 100%;
    padding: 14px 50px 14px 16px;
    font-size: 16px;
    line-height: 1.5;
    color: #1a1a1a;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    height: auto;
    box-shadow: none;
    position: relative;
}

#form2_popup .select select:focus,
#form2_popup fieldset > .select select:focus {
    outline: none;
    border-color: #d6151b;
    box-shadow: 0 0 0 3px rgba(214, 21, 27, 0.1);
}

/* Arrow only on the .form-group wrapper div, not on label or select */
#form2_popup .form-group.select::after {
    content: '';
    position: absolute;
    right: 16px;
    top: auto;
    bottom: 22px;
    transform: none;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #666;
    pointer-events: none;
    z-index: 2;
    background: none;
}

/* Kill ::after arrows on label.select and select.select — they shouldn't have arrows */
#form2_popup label.select::after,
#form2_popup select.select::after,
#form2_popup .form-group.select label::after,
#form2_popup .form-group.select select::after {
    content: none !important;
    display: none !important;
}

/* Чекбоксы и радио */
#form2_popup .checkbox,
#form2_popup .radio {
    position: relative;
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
    cursor: pointer;
}

#form2_popup .checkbox input[type="checkbox"],
#form2_popup .radio input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

#form2_popup .checkbox input[type="checkbox"] + label,
#form2_popup .radio input[type="radio"] + label,
#form2_popup .checkbox label,
#form2_popup .radio label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    margin: 0;
    padding-left: 32px;
    position: relative;
    font-weight: normal;
}

#form2_popup .checkbox input[type="checkbox"] + label::before,
#form2_popup .radio input[type="radio"] + label::before,
#form2_popup .checkbox label::before,
#form2_popup .radio label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 2px;
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    background: #ffffff;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

#form2_popup .checkbox input[type="checkbox"] + label::before,
#form2_popup .checkbox label::before {
    border-radius: 4px;
}

#form2_popup .radio input[type="radio"] + label::before,
#form2_popup .radio label::before {
    border-radius: 50%;
}

#form2_popup .checkbox input[type="checkbox"]:checked + label::before,
#form2_popup .checkbox input[type="checkbox"]:checked ~ label::before {
    background: #d6151b;
    border-color: #d6151b;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='white' d='M10 3L4.5 8.5L2 6l1.5-1.5L4.5 6L8.5 2z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px;
}

#form2_popup .radio input[type="radio"]:checked + label::before,
#form2_popup .radio input[type="radio"]:checked ~ label::before {
    background: #d6151b;
    border-color: #d6151b;
    box-shadow: inset 0 0 0 4px #ffffff;
}

#form2_popup .checkbox input[type="checkbox"]:focus + label::before,
#form2_popup .radio input[type="radio"]:focus + label::before,
#form2_popup .checkbox input[type="checkbox"]:focus ~ label::before,
#form2_popup .radio input[type="radio"]:focus ~ label::before {
    box-shadow: 0 0 0 3px rgba(214, 21, 27, 0.1);
}

/* Ссылки в лейблах */
#form2_popup .checkbox label a,
#form2_popup .radio label a {
    color: #d6151b;
    text-decoration: underline;
    transition: color 0.3s ease;
}

#form2_popup .checkbox label a:hover,
#form2_popup .radio label a:hover {
    color: #a01015;
}

/* Ошибки — скрыты по умолчанию, показываются когда JS добавляет текст */
#form2_popup .errors-elem,
#form2_popup .t-input-error {
    color: #d6151b;
    font-size: 13px;
    margin-top: 6px;
    line-height: 1.4;
    min-height: 0;
}

#form2_popup .form-group.has-error input,
#form2_popup .form-group.has-error textarea,
#form2_popup .form-group.has-error select {
    border-color: #d6151b;
}

/* Кнопка отправки */
#form2_popup .btn,
#form2_popup #form2-send,
#form2_popup input[type="submit"],
#form2_popup button[type="submit"] {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    color: #ffffff;
    background: #d6151b;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin-top: 10px;
}

#form2_popup .btn:hover,
#form2_popup #form2-send:hover,
#form2_popup input[type="submit"]:hover,
#form2_popup button[type="submit"]:hover {
    background: #a01015;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(214, 21, 27, 0.3);
}

#form2_popup .btn:active,
#form2_popup #form2-send:active,
#form2_popup input[type="submit"]:active,
#form2_popup button[type="submit"]:active {
    transform: translateY(0);
}

#form2_popup .btn:disabled,
#form2_popup #form2-send:disabled,
#form2_popup input[type="submit"]:disabled,
#form2_popup button[type="submit"]:disabled,
#form2_popup .btn.is-sending {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Группы кнопок */
#form2_popup .btn-group {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

#form2_popup .btn-group .btn {
    flex: 1;
    margin: 0;
}

/* Вкладки Очное/Заочное в form_program */
.form_all_program_tab {
    width: 100%;
    height: auto;
    display: none;
    margin-top: 0 !important;
}
.form_all_program_tab.form_all_program_tab_active {
    display: block;
}

/* Скрытые поля */
#form2_popup input[type="hidden"] {
    display: none;
}

/* Honeypot поле */
#form2_popup input[name="hp_site"] {
    position: absolute;
    left: -9999px;
    opacity: 0;
}

/* Скроллбар для попапа */
#form2_popup::-webkit-scrollbar {
    width: 8px;
}

#form2_popup::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 4px;
}

#form2_popup::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

#form2_popup::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Анимация появления */
.mfp-zoom-in .mfp-content {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
}

.mfp-zoom-in.mfp-ready .mfp-content {
    opacity: 1;
    transform: scale(1);
}

.mfp-zoom-in.mfp-removing .mfp-content {
    opacity: 0;
    transform: scale(0.8);
}

/* Адаптивность */
@media screen and (max-width: 768px) {
    .mfp-container {
        padding: 15px;
    }
    
    #form2_popup > div {
        padding: 30px 20px;
    }
    
    #form2_popup {
        max-width: 100%;
        border-radius: 12px;
        max-height: 95vh;
    }
    
    #form2_popup h1,
    #form2_popup h2,
    p.title,
    #form2_popup legend {
        font-size: 16px !important;
        margin-bottom: 20px;
    }
    
    .mfp-close {
        width: 36px !important;
        height: 36px !important;
        line-height: 36px !important;
        font-size: 24px !important;
        top: 10px !important;
        right: 10px !important;
    }
    
    #form2_popup input[type="text"],
    #form2_popup input[type="tel"],
    #form2_popup input[type="email"],
    #form2_popup input[type="number"],
    #form2_popup textarea,
    #form2_popup .select select,
    #form2_popup fieldset > .select select {
        padding: 12px 14px;
        font-size: 16px; /* Предотвращаем увеличение на iOS */
    }
    
    #form2_popup .btn-group {
        flex-direction: column;
    }
}

@media screen and (max-width: 480px) {
    #form2_popup > div {
        padding: 25px 15px;
    }
    
    #form2_popup h1,
    #form2_popup h2,
    p.title,
    #form2_popup legend {
        font-size: 20px;
    }
    
    #form2_popup .btn,
    #form2_popup #form2-send {
        padding: 14px 20px;
        font-size: 15px;
    }
}

/* Кастомный скролл для старых браузеров */
@supports not (backdrop-filter: blur(10px)) {
    .mfp-bg {
        background: rgba(255, 255, 255, 0.95) !important;
    }
}

