#item .gallery-360-preview {
    position: relative;
    display: block;
    width: 100%;
    line-height: 0;
    z-index: 2;
    overflow: visible;
}

#item .gallery-360-preview:not(.is-active) {
    pointer-events: none;
    overflow: visible;
}

#item .gallery-360-preview:not(.is-active) .gallery-360-preview__trigger {
    pointer-events: auto;
    z-index: 20;
}

#item .gallery-360-preview.is-active {
    pointer-events: auto;
}

#item .gallery-360-item,
#item .gallery-360-item .item {
    overflow: visible;
}

#item .gallery-360-preview__viewport {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    overflow: visible;
    background: transparent;
    touch-action: pan-y;
    -webkit-user-select: none;
    user-select: none;
}

#item .gallery-360-preview:not(.is-active) .gallery-360-preview__viewport {
    overflow: visible;
}

#item .gallery-360-preview__viewport.is-rotating {
    touch-action: none;
    overflow: hidden;
}

@media (max-width: 1199px) {
    #item .gallery-360-preview.is-active .gallery-360-preview__viewport.is-rotating {
        overflow: visible;
    }

    #item .gallery-360-preview.is-active .gallery-360-preview__viewport.is-rotating.is-pinch-zooming {
        overflow: hidden;
    }

    #item .gallery-360-preview.is-active .gallery-360-preview__img.is-pinch-zooming {
        transition: none;
        will-change: transform;
    }

    #item .gallery-360-preview.is-active .gallery-360-preview__img.is-pinch-resetting {
        transition: transform 0.25s ease-out;
        will-change: transform;
    }
}

#item .gallery-360-preview__stage {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform-origin: center center;
    max-width: 100%;
    overflow: visible;
}

#item .gallery-360-preview.is-active .gallery-360-preview__stage {
    overflow: visible;
}

/* выше специфичность, чем #item .item-carousel img в media.css */
#item .item-carousel .gallery-360-item .gallery-360-preview__img,
#item .item-carousel .gallery-360-preview__img {
    display: block;
    position: relative;
    max-width: 800px;
    max-height: 500px;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

@media (max-width: 767px) {
    #item .item-carousel .gallery-360-item .gallery-360-preview__img,
    #item .item-carousel .gallery-360-preview__img {
        max-width: 82% !important;
        max-height: 300px !important;
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    #item .item-carousel .gallery-360-item .gallery-360-preview__img,
    #item .item-carousel .gallery-360-preview__img {
        max-width: 94% !important;
        max-height: 460px !important;
    }
}

#item .gallery-360-preview__trigger {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 20;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    cursor: pointer;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    appearance: none;
    transition: transform 0.25s ease, opacity 0.2s ease;
}

#item .gallery-360-preview.is-active .gallery-360-preview__trigger {
    display: none;
}

#item .gallery-360-preview__trigger:hover,
#item .gallery-360-preview__trigger:focus-visible {
    transform: translate(-50%, -50%) scale(1.03);
    background: transparent !important;
}

#item .gallery-360-preview__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    height: 52px;
    padding: 0 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96) !important;
    border: 1px solid rgba(255, 142, 0, 0.45) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1) !important;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    color: #ff8e00 !important;
    pointer-events: none;
}

#item .gallery-360-preview__text {
    display: inline-block;
    max-width: 190px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
    color: #4a5568 !important;
    background: rgba(255, 255, 255, 0.94) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08) !important;
    pointer-events: none;
}

#item .gallery-360-preview__toolbar {
    position: absolute;
    z-index: 50;
    top: 0;
    right: 0;
    transform: translate(6px, calc(-100% - 8px));
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

#item .gallery-360-preview.is-active .gallery-360-preview__toolbar {
    pointer-events: auto;
}

#item .gallery-360-preview__toolbar .gallery-360-preview__close {
    pointer-events: auto;
    touch-action: manipulation;
}

#item .gallery-360-preview__toolbar[hidden] {
    display: none !important;
}

#item .gallery-360-preview__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin: 0;
    padding: 0;
    border: 2px solid #ff8e00 !important;
    border-radius: 50%;
    background: #fff !important;
    box-shadow: 0 3px 12px rgba(255, 142, 0, 0.28), 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    color: #ff8e00 !important;
    font-size: 24px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    appearance: none;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

#item .gallery-360-preview__close:hover {
    background: linear-gradient(to right, #ff8e00 0%, #fda22d 100%) !important;
    border-color: #ff8e00 !important;
    color: #fff !important;
    box-shadow: 0 4px 16px rgba(255, 142, 0, 0.35) !important;
}

@media (min-width: 1200px) {
    #item .gallery-360-preview.is-active {
        padding-top: 20px;
    }

    #item .gallery-360-preview.is-active .gallery-360-preview__viewport.is-rotating {
        overflow: visible;
    }

    #item .gallery-360-preview.is-active .gallery-360-preview__stage {
        overflow: visible;
    }

    #item .gallery-360-preview.is-active .gallery-360-preview__toolbar {
        top: 0;
        right: 0;
        left: auto;
        transform: translate(6px, calc(-100% + 24px));
    }
}

@media (max-width: 1199px) {
    #item .item-carousel.owl-carousel {
        width: 100% !important;
    }

    #item .item-carousel .owl-stage-outer {
        width: 100% !important;
    }

    #item .item-carousel .owl-item:not(.active) {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    #item .item-carousel .owl-item.active {
        opacity: 1 !important;
        visibility: visible !important;
    }

    #item .item-carousel .owl-item .slide-content {
        transform: none !important;
        left: auto !important;
        top: auto !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    #item .item-carousel .owl-item.active .item,
    #item .item-carousel .owl-item.active .gallery-360-item {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
    }

    #item .item-carousel .owl-item.active .gallery-360-preview {
        width: 100%;
        margin: 0 auto;
    }

    #item .item-carousel .owl-item.active .gallery-360-preview__viewport {
        width: 100%;
    }

    #item .gallery-360-preview.is-active {
        padding-top: 22px;
    }

    #item .gallery-360-preview.is-active .gallery-360-preview__stage {
        overflow: visible;
    }

    #item .gallery-360-preview.is-active .gallery-360-preview__toolbar {
        top: 0;
        right: auto;
        left: 76%;
        transform: translate(calc(-50% + 6px), calc(-100% + 2px));
    }

    #item .gallery-360-preview.is-active .gallery-360-preview__close {
        width: 36px;
        height: 36px;
        font-size: 22px;
    }

    #item .gallery-360-preview__icon {
        min-width: 48px;
        height: 48px;
        font-size: 14px;
    }

    #item .gallery-360-preview__text {
        font-size: 11px;
        padding: 5px 10px;
    }
}

@media (max-width: 767px) {
    #item .item-carousel .owl-item.active img.slide-content,
    #item .item-carousel .owl-item.active iframe {
        max-width: 82% !important;
        max-height: 300px !important;
        width: auto !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    #item .item-carousel .owl-item.active img.slide-content,
    #item .item-carousel .owl-item.active iframe {
        max-width: 88% !important;
        max-height: 400px !important;
        width: auto !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    #item .item-carousel .owl-prev,
    #item .item-carousel .owl-next {
        width: 36px;
        margin-top: -18px;
    }

    #item .item-carousel .owl-prev {
        left: 4px;
        right: auto;
    }

    #item .item-carousel .owl-next {
        right: 4px;
        left: auto;
    }

    #item .gallery-360-preview.is-active .gallery-360-preview__toolbar {
        top: 0;
        right: 0;
        left: auto;
        transform: translate(6px, calc(-100% + 24px));
    }
}

#item .gallery-360-preview__loader {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 25;
    transform: translate(-50%, -50%);
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.3;
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
}

#item .gallery-360-preview__loader[hidden] {
    display: none !important;
}

#item .gallery-360-preview__viewport.is-dragging {
    cursor: grabbing;
}

#item .gallery-360-preview.is-active .gallery-360-preview__viewport {
    cursor: grab;
}

#item .item-carousel.owl-carousel--gallery360-locked .owl-nav {
    pointer-events: auto;
    opacity: 1;
    z-index: 5;
}

#item .item-carousel.owl-carousel--gallery360-locked .owl-stage-outer,
#item .item-carousel.owl-carousel--gallery360-locked .owl-item.active,
#item .item-carousel.owl-carousel--gallery360-locked .owl-item.active .gallery-360-item {
    overflow: visible;
}

#item .gallery-360-preview.is-active .gallery-360-preview__stage.slide-content {
    transform: none !important;
    transition: none !important;
}

#item .owl-item:not(.active) .gallery-360-preview__trigger {
    display: none;
}

#item .owl-item:not(.active) .gallery-360-preview__viewport,
#item .owl-item:not(.active) .gallery-360-preview,
#item .item-carousel .owl-item .gallery-360-item,
#item .item-carousel .owl-item .gallery-360-preview {
    overflow: visible;
}

#item .gallery-360-item .gallery-360-preview__trigger {
    touch-action: manipulation;
}

#item .item-carousel .gallery-360-preview__stage.slide-content {
    position: relative;
    margin: 0 auto;
}

#item .owl-item.active .gallery-360-preview.is-active .gallery-360-preview__toolbar {
    z-index: 60;
}
