/* ============================================
   SWIPER CUSTOM CSS - ОСНОВНЫЕ СТИЛИ
   ============================================ */

/* Скрываем неинициализированный Swiper */
/* скрываем только слайды, но сохраняем пропорции */
.productSwiper:not(.swiper-initialized) .swiper-slide {
    opacity: 0;
    visibility: hidden;
    position: absolute;
}

/* При этом сам контейнер сохраняет размеры */
.productSwiper:not(.swiper-initialized) {
    min-height: 400px;
    background: #f5f5f5;
}

/* Когда Swiper готов — показываем плавно */
.productSwiper.swiper-initialized,
.thumbsSwiper.swiper-initialized,
.swiper-initialized {
    opacity: 1 !important;
    visibility: visible !important;
    transition: opacity 0.3s ease;
}

/* Контейнер слайдера */
.prodRatioHolder {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
    height: auto !important;
    min-height: 400px !important;
    padding: 0 !important;
}

/* Основной слайдер */
.productSwiper {
    width: 100%;
    overflow: hidden;
    height: auto !important;
    min-height: 400px !important;
}

.productSwiper .swiper-wrapper {
    display: flex;
    width: 100%;
    height: auto !important;
}

.productSwiper .swiper-slide {
    height: auto !important;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
}

/* Изображение на всю ширину */
.productSwiper img.product-slide-image {
    height: auto !important;
    max-height: none !important;
    object-fit: contain !important;
    display: block !important;
}

/* Внутренний контейнер слайда */
.productSwiper .slide-inner {
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
}

/* ============================================
   МИНИАТЮРЫ
   ============================================ */

.thumbsSwiper {
    height: 100px;
    margin-top: 15px;
    overflow: hidden;
}

.thumbsSwiper .swiper-wrapper {
    transition-duration: 0ms !important;
    transform: translate3d(0px, 0px, 0px) !important;
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    margin: 20px auto 0 !important;
    width: 80% !important;
}

/* Один слайд миниатюры */
.thumbsSwiper .thumb-slide {
    width: 60px !important;
    height: 60px !important;
    margin: 4px !important;
    border-radius: 4px !important;
    opacity: 0.5 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

/* Активная миниатюра */
.thumbsSwiper .thumb-slide.active {
    opacity: 1 !important;
    border-width: 1px !important;
    border-style: solid !important;
    border-color: var(--color); !important;
    transform: scale(1) !important;
    box-shadow: 0 2px 4px rgba(175, 222, 243, 0.2) !important;
}

/* Ховер на миниатюрах */
.thumbsSwiper .thumb-slide:hover {
    opacity: 0.8 !important;
    border-color: #ddd !important;
}

/* Внутреннее изображение */
.thumbsSwiper .thumb-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thumbsSwiper .thumb-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.thumbsSwiper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 2px;
}

/* ============================================
   СТРЕЛКИ НАВИГАЦИИ
   ============================================ */

/* Общие стили для стрелок */
.swiper-button-prev,
.swiper-button-next,
div.swiper-button-next,
div.swiper-button-prev {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(240, 243, 245, 0.8);
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 10;
    cursor: pointer;
    display: flex;
    align-items: center !important;
    justify-content: center !important;
    background-image: none !important;
}

/* Ховер эффект */
.swiper-button-prev:hover,
.swiper-button-next:hover {
    background: #f9d500 !important;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

/* Убираем стандартные стрелки Swiper */
.swiper-button-next::after,
.swiper-button-prev::after {
    content: "" !important;
    display: none !important;
}

/* Показываем иконки FontAwesome */
.swiper-button-next .fa,
.swiper-button-prev .fa {
    display: block !important;
    font-size: 24px !important;
}

/* Если нет иконок - создаем псевдоэлемент */
.swiper-button-next:not(:has(.fa))::before {
    content: "\f105" !important;
    font-family: 'FontAwesome' !important;
    font-size: 24px !important;
    color: #333 !important;
}

.swiper-button-prev:not(:has(.fa))::before {
    content: "\f104" !important;
    font-family: 'FontAwesome' !important;
    font-size: 24px !important;
    color: #333 !important;
}

/* Кнопки для основного слайдера */
#product-next,
#product-prev,
#modal-product-next,
#modal-product-prev {
    background: rgba(240, 243, 245, 0.8) !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
}

#product-prev {
    left: 10px;
}

#product-next {
    right: 10px;
}

/* Состояние отключено */
.swiper-button-disabled {
    opacity: 0 !important;
    pointer-events: none !important;
    cursor: default !important;
}

/* Скрываем стрелки неактивных табов */
.tab-pane:not(.active) .swiper-button-prev,
.tab-pane:not(.active) .swiper-button-next {
    display: none !important;
}

/* Позиционирование стрелок для активных табов */
.tab-pane.active .swiper-button-prev,
.tab-pane.active .swiper-button-next {
    display: flex !important;
}

/* ============================================
   ПРЕЛОАДЕРЫ
   ============================================ */

/* Полностью скрываем прелоадеры */
.swiper-lazy-preloader,
.swiper-lazy-preloader-white {
    display: none !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
    position: absolute !important;
    top: -9999px !important;
    left: -9999px !important;
}

/* ============================================
   ВИДЕО
   ============================================ */

.product-slide-video {
    width: 100%;
    height: auto;
    max-height: 80vh;
    object-fit: contain;
    background: #000;
}

/* Видео-значок для основного слайда */
.video-slide-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(175, 222, 243, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    z-index: 5;
    opacity: 0.8;
    transition: all 0.3s ease;
    border: 2px solid white;
}

.video-slide-badge:hover {
    background: rgba(175, 222, 243, 1);
    transform: scale(1.1);
    opacity: 1;
}

/* Видео-значок для миниатюр */
.thumb-slide[data-type="video"] .video-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    background: rgba(175, 222, 243, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    z-index: 2;
    opacity: 0.9;
    transition: all 0.3s ease;
}

.thumb-slide[data-type="video"]:hover .video-badge {
    background: rgba(175, 222, 243, 1);
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 1;
}

/* ============================================
   ИНДИКАТОР СВАЙПА
   ============================================ */

.swipe-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(175, 222, 243, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
}

.swipe-indicator::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(175, 222, 243, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(175, 222, 243, 0); }
    100% { box-shadow: 0 0 0 0 rgba(175, 222, 243, 0); }
}

/* ============================================
   КНОПКА ГАЛЕРЕИ
   ============================================ */

#product-gallery-btn {
    animation: galleryPulse 5s infinite;
}

@keyframes galleryPulse {
    0% { box-shadow: 0 0 0 0 rgba(108, 117, 125, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(108, 117, 125, 0); }
    100% { box-shadow: 0 0 0 0 rgba(108, 117, 125, 0); }
}

/* ============================================
   ЛАЙТБОКС / ГАЛЕРЕЯ
   ============================================ */

.product-lightbox {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.product-lightbox[style*="display: block"] {
    opacity: 1;
    visibility: visible;
}

#product-lightbox {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: -webkit-fill-available !important;
    background: #fff !important;
    z-index: 9999 !important;
    overflow: hidden !important;
    touch-action: none !important;
}

#product-lightbox > div {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px 10px !important;
    box-sizing: border-box !important;
}

#lightbox-main {
    max-width: 95% !important;
    max-height: 60vh !important;
    margin-bottom: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 1 !important;
}

#lightbox-image {
    max-width: 100% !important;
    max-height: 60vh !important;
    object-fit: contain !important;
}

/* Миниатюры в лайтбоксе */
.lightbox-thumbs {
    position: absolute !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: auto !important;
    overflow-x: auto !important;
    display: flex !important;
    justify-content: center !important;
    gap: 10px !important;
    background: rgba(255, 255, 255, 0.95) !important;
    z-index: 1000 !important;
    box-shadow: none !important;
}

.lightbox-thumb {
    width: 70px !important;
    height: 70px !important;
    flex-shrink: 0 !important;
    cursor: pointer !important;
    border: 1px solid #ddd !important;
    opacity: 0.6 !important;
    border-radius: 4px !important;
    overflow: hidden !important;
    transition: all 0.2s ease;
}

.lightbox-thumb:hover {
    opacity: 0.8 !important;
    transform: scale(1.05);
}

.lightbox-thumb.active {
    opacity: 1 !important;
    border-color: rgba(240, 243, 245, 0.8) !important;
}

/* Ховер-эффекты для лайтбокса */
#lightbox-next:hover,
#lightbox-prev:hover,
#lightbox-close:hover {
    background: #f9d500 !important;
}

#lightbox-next:hover,
#lightbox-prev:hover {
    transform: translateY(-50%) scale(1.1) !important;
}

#lightbox-close:hover {
    transform: scale(1.1) !important;
}

/* ============================================
   ЗУМ КОНТЕЙНЕР
   ============================================ */

.swiper-zoom-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: grab;
}

.swiper-zoom-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.swiper-slide-zoomed .swiper-zoom-container {
    cursor: grab;
}

.swiper-slide-zoomed {
    z-index: 100 !important;
}

/* Подсказка для пользователя */
.swiper-zoom-container::before {
    content: attr(data-zoom-hint);
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.swiper-zoom-container.active-zoom-hint::before {
    opacity: 0;
    pointer-events: none;
}

/* ============================================
   АДАПТИВНОСТЬ
   ============================================ */

/* Мобильные устройства */
@media (max-width: 767px) {
    .prodRatioHolder {
        min-height: 300px !important;
    }
    
    .productSwiper {
        min-height: 300px !important;
    }
}

/* Планшеты и мобильные (общие) */
@media (max-width: 768px) {
    .lightbox-thumbs {
        bottom: 50px !important;
        padding: 12px 15px !important;
        max-width: 95% !important;
    }
    
    #product-gallery-btn {
        top: 10px;
        right: 60px;
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    #lightbox-prev,
    #lightbox-next {
        width: 45px !important;
        height: 45px !important;
        font-size: 20px !important;
    }
    
}

/* Очень маленькие экраны */
@media (max-width: 480px) {
    #lightbox-main {
        max-height: 55vh !important;
    }
    
    #lightbox-image {
        max-height: 55vh !important;
    }
    
    .lightbox-thumb {
        width: 40px !important;
        height: 40px !important;
    }
}

/* Горизонтальная ориентация */
@media (orientation: landscape) and (max-height: 500px) {
    #lightbox-main {
        max-height: 70vh !important;
    }
    
    #lightbox-image {
        max-height: 70vh !important;
    }
    
    #lightbox-thumbs {
        padding: 8px !important;
    }
    
    .lightbox-thumb {
        width: 35px !important;
        height: 35px !important;
    }
}

/* iPad */
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
    .spec-main-slider .swiper-slide > .product-card,
    .spec-hit-slider .swiper-slide > .product-card,
    .spec-main-icon-slider .swiper-slide > .product-card,
    .recommended-slider .swiper-slide > .product-card,
    .last-slider .swiper-slide > .product-card,
    .brands-slider .swiper-slide > .product-card,
    .gbook-slider .swiper-slide > .product-card,
    .nowBuy-slider .swiper-slide > .product-card {
        min-height: 380px;
    }
    
    .product-card {
        min-height: 400px;
    }
}