/* Сброс отступов и базовые стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Для телевизоров и очень больших экранов */
@media (min-width: 1921px) and (min-height: 1081px) {
    .engraving-text {
        width: 250px !important;
        max-width: 250px !important;
        font-size: 22px !important;
    }
}

/* Альтернативно - для 4K/8K экранов */
@media (min-width: 3840px) {
    .engraving-text {
        width: 250px !important;
        max-width: 250px !important;
        font-size: 28px !important;
    }
}


/* Красная обводка при ошибке */
#engraving-text.error {
    border-color: #d63638 !important;
    background: #fff8f8;
}

.engraving-text {
    width: 150px !important;
}

/* Основной контейнер с фоном - растягиваем на всю ширину */
@media (min-width: 1025px) {
    
    .engraving-text {
        width: 150px !important;
    }
    
    .customize-container {
        width: 100vw !important;
        height: 100vh;
        max-width: none !important;
        margin-left: calc(-50vw + 50%) !important;
        position: relative;
        left: 0;
        background: #F3F3F5 !important;
        overflow: hidden;
    }
}

/* Секция с изображением товара и формой */
.product-image-section {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    position: relative;
    max-width: 1800px;
    margin: 0 auto;
}

@media (min-width: 1025px) {
    .content-group {
        display: flex;
        align-items: flex-start;
        justify-content: center;
        gap: 156px;
        width: 100%;
        max-width: 1400px;
        margin: 0 auto;
        padding: 30px 120px 0 70px;
        height: 100%;
        box-sizing: border-box;
    }
}


@media (min-width: 1025px) {
    .image-container {
        position: relative;
        display: flex;
        justify-content: center;
        align-items: flex-start;
        height: calc(100vh - 30px) !important;
        background: transparent !important;
        border-radius: 0;
        box-shadow: none !important;
        padding: 0;
        flex-shrink: 0;
        margin: 0;
        margin-top: 30px;
    }
}

/* Контейнер для изображения */


.product-image {
    height: 100% !important;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

.engraving-text {
    position: absolute;
    top: 25%;
    left: 75%;
    margin-top: 7px;
    transform: translate(-50%, -50%);
    font-family: Nekst Medium;
    font-size: 18px !important;
    font-weight: 500;
    color: inherit;
    z-index: 2;
    pointer-events: none;

    /* Ограничивающий бокс */
    width: 190px !important;
    height: auto;
    min-height: 40px;
    max-height: 90px;
    display: flex;
    align-items: flex-end !important;
    /* меняем на flex-end */
    justify-content: flex-end !important;
    /* меняем на flex-end */
    text-align: right !important;
    /* выравнивание текста по правому краю */

    /* Перенос ТОЛЬКО целых слов */
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: keep-all;
    line-height: 1.2;

    /* Скрываем переполнение */
    overflow: hidden;

    /* Небольшие отступы */
    padding: 5px;
}

/* Секция с формой - обновленные стили */
@media (min-width: 1025px) {
    .form-section {
        width: 512px !important;
        background: #FFFFFF !important;
        padding: 40px 30px 0 30px;
        border-radius: 24px !important;
        border: 1px solid #DFDFDF !important;
        flex-shrink: 0;
        margin-top: 72px !important;
        margin-bottom: 72px !important;
        height: auto !important;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
    }
}

/* Остальные стили формы */
.form-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.back-button {
    font-size: 24px;
    margin-right: 20px;
    margin-bottom: 20px;
}

.back-button:hover {
    background: #f5f5f5;
    color: #666;
}

.form-header h2 {
    font-size: 24px;
    color: #333233;
    font-weight: 500;
}

.input-group {
    margin-bottom: 5px;
}

.input-group label {
    display: block;
    margin-bottom: 19px;
    font-weight: 500;
    color: #6A6A6A;
    font-size: 16px;
}

.label-with-icon {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-with-counter {
    position: relative;
}

#engraving-text {
    
    padding: 15px;
    border: 1px solid #DFDFDF;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
    background: #FFFFFF;
}

#engraving-text:focus {
    outline: none;
    border-color: #333;
    background: white;
}

.char-counter {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    font-size: 14px;
    background: white;
    padding: 2px 6px;
    border-radius: 8px;
}

.clear-text-button {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-text-button:hover {
    background: #f0f0f0;
}

.clear-icon {
    width: 16px;
    height: 16px;
    display: block;
}

.quick-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    max-width: 400px;
}

.quick-option-btn {
    padding: 8px 12px;
    border: 1px solid #DFDFDF;
    background: #EEEEEE;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 16px;
    color: #333233;
    text-transform: none !important;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    flex: 0 1 auto;
    justify-content: space-between;
}

.btn-text {
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    position: relative;
    width: 100%;
}

.btn-remove-icon-new {
    width: 20px;
    height: 20px;
    opacity: 0;
    transition: opacity 0.3s;
    margin-left: 0;
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
}

.quick-option-btn.active .btn-text {
    margin-right: 28px;
}

.quick-option-btn.active .btn-remove-icon-new {
    opacity: 1;
    filter: brightness(0) invert(1);
}

.quick-option-btn:hover {
    background: #f0f2f5;
    border-color: #DFDFDF;
    transform: translateY(-1px);
}

.quick-option-btn:active {
    transform: translateY(0);
}

.quick-option-btn.active {
    background: #333233 !important;
    color: white !important;
    border-color: #333233 !important;
    transform: none;
}

.validation-message {
    color: #d63638;
    font-size: 14px;
    margin-top: 8px;
    min-height: 20px;
    font-weight: 500;
}

.form-footer {
    margin-top: 20px;
    margin-bottom: 36px;
}

.disclaimer ul {
    list-style: none;
    padding: 0;
    margin: 0 0 36px 0;
    font-size: 16px;
    color: #6A6A6A;
    line-height: 1;
}


.disclaimer li {
    margin-bottom: 8px;
    position: relative;
    list-style: none;
}

.details-button {
    background: none;
    border: none;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    margin-left: 4px;
    font-size: 16px;
    font-weight: 500;
    position: relative;
    text-transform: capitalize;
    font-weight: 500;
    background-color: transparent !important;
    outline: none !important;
    box-shadow: none !important;
}

.tooltip {
    position: absolute;
    top: 100%;
    left: 0;
    width: 400px;
    background: white;
    border: 1px solid #DFDFDF;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    margin-top: 10px;
    font-family: Nekst Regular;
}

.tooltip.active {
    opacity: 1;
    visibility: visible;
}

.tooltip-content {
    padding: 20px;
}

.tooltip-content p {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    color: #6A6A6A;
}

.tooltip:after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 20px;
    border: 8px solid transparent;
    border-bottom-color: white;
}

.add-to-cart-button {
    width: 100%;
    padding: 18px;
    background: #FF3284;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 20px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: none;
    letter-spacing: 0.5px;
    margin-top: 0;
}

.add-to-cart-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.add-to-cart-button:not(:disabled):hover {
    background: #FFFFFF99;
    border: 1px solid #FF3284;
    color: #FF3284;
}

/* ===== МОБИЛЬНАЯ ВЕРСИЯ - 50% ФОРМА, 50% ФЕН ===== */

/* Планшеты и мобильные (до 1024px) */
@media (max-width: 1024px) {
    .customize-container {
        width: 100vw !important;
        height: 100vh;
        max-width: none !important;
        margin-left: calc(-50vw + 50%) !important;
        position: relative;
        left: 0;
        background: #F3F3F5 !important;
    }

    .product-image-section {
        padding: 0 !important;
        height: 100vh;
        justify-content: flex-start;
    }

    .quick-options {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        margin-top: 10px;
        max-width: 1000px;
    }

    .elementor-3224 .elementor-element.elementor-element-236e06c:not(.elementor-motion-effects-element-type-background),
    .elementor-3224 .elementor-element.elementor-element-236e06c>.elementor-motion-effects-container>.elementor-motion-effects-layer {
        display: none !important;
    }

    .wd-footer {
        display: none !important;
    }

    .content-group {
        flex-direction: column;
        padding: 0 !important;
        margin: 0 !important;
        width: 100%;
        align-items: stretch;
    }

    /* Скрываем заголовок и стрелку */
    .form-header {
        display: none !important;
    }



    .input-group {
        margin-top: 15px !important;
    }

    /* Контейнер изображения - занимает 50% сверху */
    .image-container {
        width: 100%;
        min-height: auto !important;
        max-height: 100px;
        margin: 0 !important;
        padding: 0 !important;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        position: relative;
        background: #F3F3F5;
        z-index: 1 !important;
        order: 1 !important;
        margin-top: 150px !important;
    }

    .tooltip {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        /* Затемнение */
        backdrop-filter: blur(5px);
        /* Блюр */
        -webkit-backdrop-filter: blur(5px);
        /* Для Safari */
        border: none;
        border-radius: 0;
        padding: 0;
        box-shadow: none;
        z-index: 10000;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        margin: 0;
        font-family: Nekst Regular;
        display: flex;
        align-items: flex-end;
        /* Контент снизу */
        justify-content: center;
    }

    .tooltip.active {
        opacity: 1;
        visibility: visible;
    }

    .tooltip-content {
        width: 100%;
        max-width: 100%;
        background: white;
        border-radius: 24px 24px 0 0;
        padding: 30px 20px;
        margin: 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
        position: relative;
        max-height: 80vh;
        overflow-y: auto;
    }

    .tooltip-content p {
        margin: 0;
        font-size: 16px;
        line-height: 1.5;
        color: #333;
        text-align: center;
    }

    /* Убираем стрелку */
    .tooltip:after {
        display: none;
    }



    /* Анимация появления снизу */
    @keyframes slideUp {
        from {
            transform: translateY(100%);
        }

        to {
            transform: translateY(0);
        }
    }

    .tooltip.active .tooltip-content {
        animation: slideUp 0.3s ease-out;
    }


    .product-image {
        height: 100% !important;
        width: auto !important; 
        max-width: 100% !important;
        object-fit: contain !important;
        display: block !important;
    }

    .form-section {
        height: auto;
        min-height: 50vh;
        overflow: visible;
        flex: 1;
        flex-shrink: 0;
        box-sizing: border-box;
        position: relative;
        z-index: 2 !important;
        order: 2 !important;
        background: #FFFFFF !important;
        padding: 40px 30px 0 30px;
        border-radius: 24px 24px 0 0 !important;
        border: none !important;
        border-top: 1px solid #DFDFDF !important;
        flex-shrink: 0;
        height: 65vh !important;
        display: flex;
        flex-direction: column;
        margin-top: 250px !important;
    }

    .elementor-3224 .elementor-element.elementor-element-888daa9:not(.elementor-motion-effects-element-type-background),
    .elementor-3224 .elementor-element.elementor-element-888daa9>.elementor-motion-effects-container>.elementor-motion-effects-layer {
        display: none;
    }

    .wd-prefooter {
        display: none;
    }

    .wp-bottom-menu {
        display: none !important;
    }

    /* Настройки текста гравировки для мобильных */
    .engraving-text {
        position: absolute;
        top: 29vh !important;
        /* вместо % используем vh */
        left: 70vw !important;
        /* вместо % используем vw */
        width: 25vw !important;
        /* относительная ширина */
        max-width: 120px !important;
        max-height: 40px !important;
        font-size: clamp(10px, 3vw, 16px) !important;
        /* относительный размер шрифта */
        line-height: 1.1;
        padding: 3px;
        justify-content: center !important;
        text-align: center !important;
        transform: translate(-50%, -50%);
        /* центрируем */
    }

    /* Улучшение touch-интерфейса */
    .quick-option-btn {
        min-height: 44px;
    }

    #engraving-text {
        min-height: 44px;
    }

    .add-to-cart-button {
        min-height: 50px;
        margin-bottom: 30px;
    }
}

/* Настройки для разных размеров экранов */
@media (max-width: 1024px) and (min-width: 769px) {
    .form-section {
        padding: 15px !important;
        z-index: 999999 !important;
    }


    .product-image {
        height: 100% !important;
        width: auto !important;
        max-width: 100% !important;
        max-height: 50vh !important;
        object-fit: contain !important;
        display: block !important;

        /* Добавьте для центрирования */
        margin: 0 auto !important;
        position: relative !important;
        left: 24% !important;
        transform: translateX(-50%) !important;
    }

    .engraving-text {
        width: 150px !important;
        max-height: 40px !important;
        font-size: 12px !important;
        left: 61% !important;
        top: 120% !important;
        align-items: flex-end !important;
        /* меняем на flex-end */
        justify-content: flex-end !important;
        /* меняем на flex-end */
        text-align: right !important;
        /* выравнивание текста по правому краю */
        display: flex !important;
        flex-direction: column;
        /* если нужно вертикальное выравнивание */
    }

    .elementor-3224 .elementor-element.elementor-element-888daa9:not(.elementor-motion-effects-element-type-background),
    .elementor-3224 .elementor-element.elementor-element-888daa9>.elementor-motion-effects-container>.elementor-motion-effects-layer {
        display: none;
    }

    .wd-prefooter {
        display: none;
    }

    .wp-bottom-menu {
        display: none !important;
    }

}

@media (max-width: 768px) and (min-width: 521px) {
    .form-section {
        padding: 15px !important;
        z-index: 999999 !important;
    }


    .product-image {
        height: 100% !important;
        width: auto !important;
        max-width: 100% !important;
        max-height: 60vh !important;
        object-fit: contain !important;
        display: block !important;

        /* Добавьте для центрирования */
        margin: 0 auto !important;
        position: relative !important;
        left: 24% !important;
        transform: translateX(-50%) !important;
    }

    .engraving-text {
        width: 120px !important;
        max-height: 40px !important;
        font-size: 12px !important;
        left: 70% !important;
        top: 120% !important;
        align-items: flex-end !important;
        /* меняем на flex-end */
        justify-content: flex-end !important;
        /* меняем на flex-end */
        text-align: right !important;
        /* выравнивание текста по правому краю */
        display: flex !important;
        flex-direction: column;
        /* если нужно вертикальное выравнивание */
    }

    .elementor-3224 .elementor-element.elementor-element-888daa9:not(.elementor-motion-effects-element-type-background),
    .elementor-3224 .elementor-element.elementor-element-888daa9>.elementor-motion-effects-container>.elementor-motion-effects-layer {
        display: none;
    }

    .wd-prefooter {
        display: none;
    }

    .wp-bottom-menu {
        display: none !important;
    }

}

@media (max-width: 520px) and (min-width: 321px) {
    .form-section {
        padding: 15px !important;
        z-index: 999999 !important;
    }


    .product-image {
        height: 100% !important;
        object-fit: contain !important;
        display: block !important;
        position: relative !important;

    }
        
    .engraving-text {
        width: 200px !important;
        max-height: 40px !important;
        font-size: 12px !important;
        left: 78% !important;
        top: 140% !important;
        display: flex !important;
        flex-direction: row !important; /* В строку, а не в колонку */
        align-items: center !important; /* Вертикальное выравнивание по центру */
        justify-content: flex-end !important; /* Горизонтальное выравнивание по правому краю */
        text-align: right !important;
    }
    
    /* Стили для иконок в мобильной версии */
    .engraving-text img {
        width: 30px !important;
        height: 30px !important;
        margin: 0 2px !important;
        flex-shrink: 0; /* Чтобы иконка не сжималась */
    } 
    

    .elementor-3224 .elementor-element.elementor-element-888daa9:not(.elementor-motion-effects-element-type-background),
    .elementor-3224 .elementor-element.elementor-element-888daa9>.elementor-motion-effects-container>.elementor-motion-effects-layer {
        display: none;
    }

    .wd-prefooter {
        display: none;
    }

    .wp-bottom-menu {
        display: none !important;
    }

}


@media (max-width: 426px) and (min-width: 321px) {
    .form-section {
        padding: 15px !important;
        z-index: 999999 !important;
    }



    .engraving-text {
        width: 120px !important;
        max-height: 40px !important;
        font-size: 12px !important;
        left: 74% !important;
        top: 110% !important;
        align-items: flex-end !important;
        /* меняем на flex-end */
        justify-content: flex-end !important;
        /* меняем на flex-end */
        text-align: right !important;
        /* выравнивание текста по правому краю */
        display: flex !important;
        flex-direction: column;
        /* если нужно вертикальное выравнивание */
    }

    .elementor-3224 .elementor-element.elementor-element-888daa9:not(.elementor-motion-effects-element-type-background),
    .elementor-3224 .elementor-element.elementor-element-888daa9>.elementor-motion-effects-container>.elementor-motion-effects-layer {
        display: none;
    }

    .wd-prefooter {
        display: none;
    }

    .wp-bottom-menu {
        display: none !important;
    }

}

@media (max-width: 320px) {
    .form-section {
        padding: 15px !important;
        z-index: 999999 !important;
    }


    .engraving-text {
        width: 90px !important;
        max-height: 40px !important;
        font-size: 12px !important;
        left: 75% !important;
        top: 28% !important;
        align-items: flex-end !important;
        /* меняем на flex-end */
        justify-content: flex-end !important;
        /* меняем на flex-end */
        text-align: right !important;
        /* выравнивание текста по правому краю */
        display: flex !important;
        flex-direction: column;
        /* если нужно вертикальное выравнивание */
    }
}

@media (max-width: 1024px) {
    .wp-bottom-menu {
        display: none;
    }

    .elementor-3224 .elementor-element.elementor-element-888daa9:not(.elementor-motion-effects-element-type-background),
    .elementor-3224 .elementor-element.elementor-element-888daa9>.elementor-motion-effects-container>.elementor-motion-effects-layer {
        display: none;
    }

    .wd-prefooter {
        display: none;
    }

    .wp-bottom-menu {
        display: none !important;
    }


    /* Горизонтальная ориентация */
    @media (max-height: 600px) and (orientation: landscape) and (max-width: 1024px) {
        .customize-container {
            flex-direction: row;
        }

        .content-group {
            flex-direction: row;
        }

        .image-container {
            height: 100vh !important;
            width: 50vw;
        }

        .form-section {
            height: 100vh !important;
            width: 50vw;
            border-top: none !important;
            border-left: 1px solid #DFDFDF !important;
        }
    }

    /* Десктоп (1025px и выше) */
    @media (min-width: 1025px) {
        .engraving-text {
            top: 25% !important;
            left: 75% !important;
            width: 150px !important;
            max-height: 70px !important;
            font-size: 18px !important;
        }
    }

    /* Адаптивность для больших экранов */
    @media (min-width: 1500px) {
        .content-group {
            gap: 156px;
            padding: 30px 120px 0 70px;
        }
    }

    @media (max-width: 1499px) and (min-width: 1200px) {
        .content-group {
            gap: 120px;
            padding: 30px 80px 0 30px;
        }

        .image-container {
            height: calc(100vh - 30px) !important;
        }

        .form-section {
            width: 608px !important;
            margin-top: 72px !important;
            margin-bottom: 28px !important;
        }
    }

    @media (max-width: 1199px) and (min-width: 1025px) {
        .content-group {
            gap: 80px;
            padding: 30px 60px 0 10px;
        }

        .form-section {
            width: 608px !important;
            margin-top: 72px !important;
            margin-bottom: 72px !important;
        }

        .image-container {
            height: calc(100vh - 30px) !important;
        }
    }

    /* Предотвращение масштабирования при фокусе на iOS */
    @media (max-width: 1024px) {

        input,
        select,
        textarea {
            font-size: 16px;
        }
    }
}