/* ============================================
   Модальное окно кастомной формы заказа
   ============================================ */

/* Оверлей (фон) — по умолчанию скрыт */
.custom-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.6) !important;
    z-index: 999999 !important;
    display: none;
    justify-content: center !important;
    align-items: center !important;
    overflow-y: auto !important;
    padding: 20px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

/* Когда открыто — flex */
.custom-modal-overlay.is-open {
    display: flex !important;
}

/* Контент модалки */
.custom-modal-content {
    background: #fff !important;
    padding: 30px !important;
    width: 100% !important;
    max-width: 600px !important;
    border-radius: 8px !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    position: relative !important;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3) !important;
    box-sizing: border-box !important;
    margin: auto !important;
    font-family: sans-serif !important;
}

/* Крестик закрытия */
.custom-modal-close {
    position: absolute !important;
    top: 10px !important;
    right: 15px !important;
    font-size: 28px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    color: #999 !important;
    transition: color 0.2s !important;
    z-index: 10 !important;
    background: transparent !important;
    border: none !important;
    padding: 5px !important;
}
.custom-modal-close:hover {
    color: #333 !important;
}

/* Блок с товаром */
.custom-modal-content .modal-product-info {
    display: flex !important;
    gap: 20px !important;
    margin-bottom: 20px !important;
    border-bottom: 1px solid #eee !important;
    padding-bottom: 15px !important;
    align-items: center !important;
}
.custom-modal-content .modal-product-info img {
    width: 80px !important;
    height: 80px !important;
    object-fit: cover !important;
    border-radius: 4px !important;
    flex-shrink: 0 !important;
}
.custom-modal-content .modal-product-info h3 {
    margin: 0 0 5px 0 !important;
    font-size: 18px !important;
    color: #333 !important;
}
.custom-modal-content .modal-product-info p {
    margin: 0 !important;
    font-weight: bold !important;
    color: #555 !important;
}

/* Поля формы */
.custom-modal-content .form-group {
    margin-bottom: 15px !important;
}
.custom-modal-content .form-group label {
    display: block !important;
    margin-bottom: 5px !important;
    font-size: 14px !important;
    color: #555 !important;
}
.custom-modal-content .form-group input {
    width: 100% !important;
    padding: 12px !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    box-sizing: border-box !important;
    background: #fff !important;
    color: #333 !important;
    height: auto !important;
}
.custom-modal-content .form-group input:focus {
    border-color: #007bff !important;
    outline: none !important;
}

/* Чекбоксы */
.custom-modal-content .form-checkboxes > label {
    display: flex !important;
    align-items: flex-start !important;
    margin-bottom: 10px !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    color: #444 !important;
    cursor: pointer !important;
}
.custom-modal-content .form-checkboxes input[type="checkbox"] {
    margin-top: 2px !important;
    margin-right: 10px !important;
    width: auto !important;
    flex-shrink: 0 !important;
}
.custom-modal-content .form-checkboxes a {
    color: #007bff !important;
    text-decoration: underline !important;
}

/* Звёздочка обязательного поля */
.custom-modal-content .required {
    color: #d63638;
    font-weight: bold;
}

/* Блок полей ребёнка */
#child-fields {
    background: #f9f9f9;
    border-left: 3px solid #007bff;
    padding: 15px;
    border-radius: 4px;
    margin: 10px 0 15px 0;
    padding-left: 15px !important;
}

#child-fields .form-group {
    margin-bottom: 12px;
}

#child-fields .form-group:last-child {
    margin-bottom: 0;
}

#child-fields .child-agree-label {
    display: flex;
    align-items: flex-start;
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.4;
    cursor: pointer;
}

#child-fields .child-agree-label input[type="checkbox"] {
    margin-top: 2px;
    margin-right: 10px;
    flex-shrink: 0;
    width: auto;
}

/* Футер модалки */
.custom-modal-content .modal-footer {
    margin-top: 25px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
    align-items: center !important;
}
.custom-modal-content .modal-total {
    font-size: 18px !important;
    font-weight: bold !important;
    width: 100% !important;
    text-align: right !important;
    color: #333 !important;
}
.custom-modal-content .modal-submit-btn {
    background-color: #007bff !important;
    color: white !important;
    border: none !important;
    padding: 15px 30px !important;
    border-radius: 30px !important;
    font-size: 16px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    width: 100% !important;
    transition: background 0.3s !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    font-family: sans-serif !important;
    line-height: 1.2 !important;
    box-shadow: none !important;
}
.custom-modal-content .modal-submit-btn:hover {
    background-color: #0056b3 !important;
}
.custom-modal-content .modal-submit-btn:disabled {
    background-color: #ccc !important;
    cursor: not-allowed !important;
}

#form-message p {
    margin: 10px 0 0 !important;
    text-align: center !important;
    font-size: 14px !important;
}

/* Кнопка "Оставить заявку" */
.custom-order-button-wrap {
    margin-top: 15px !important;
}
.custom-order-button-wrap .custom-order-trigger {
    display: inline-block !important;
    cursor: pointer !important;
}

/* Кнопка в каталоге */
.woocommerce ul.products li.product .custom-order-button-wrap {
    margin-top: 10px !important;
    text-align: center !important;
}

/* Блокировка скролла при открытой модалке */
body.custom-modal-open {
    overflow: hidden !important;
}

/* Мобильная адаптация */
@media (max-width: 600px) {
    .custom-modal-content {
        padding: 20px !important;
        max-height: 95vh !important;
    }
    .custom-modal-content .modal-product-info {
        flex-direction: column !important;
        text-align: center !important;
    }
    .custom-modal-content .modal-product-info img {
        width: 100px !important;
        height: 100px !important;
    }
}