/* 产品相册轮播小部件样式 */
.geniatech-product-gallery {
    position: relative;
    max-width: 100%;
}

/* 主轮播容器 */
.geniatech-product-gallery-main {
    position: relative;
    width: 100%;
    min-height: 400px;
    height: auto;
    background: #f5f5f5;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
}

.geniatech-product-gallery-main .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    height: auto;
    min-height: 400px;
}

.geniatech-product-gallery-main img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

/* Elementor编辑器预览样式 */
.geniatech-product-gallery.elementor-editor-preview .geniatech-product-gallery-main {
    display: block !important;
    background: #f5f5f5;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
}

.geniatech-product-gallery.elementor-editor-preview .swiper-wrapper {
    display: block !important;
}

.geniatech-product-gallery.elementor-editor-preview .swiper-slide {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    min-height: 400px;
    position: relative;
}

.geniatech-product-gallery.elementor-editor-preview .swiper-slide:not(:first-child) {
    display: none !important;
}

.geniatech-product-gallery.elementor-editor-preview .swiper-slide img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* 编辑器预览中的导航容器 */
.geniatech-product-gallery.elementor-editor-preview .geniatech-gallery-navigation-container {
    display: flex !important;
}

.geniatech-product-gallery.elementor-editor-preview .geniatech-product-gallery-thumbs {
    display: block !important;
}

.geniatech-product-gallery.elementor-editor-preview .geniatech-product-gallery-thumbs .swiper-wrapper {
    display: flex !important;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 10px;
}

.geniatech-product-gallery.elementor-editor-preview .geniatech-gallery-thumb {
    display: flex !important;
    flex-shrink: 0;
}

/* 编辑器预览提示 */
.geniatech-product-gallery.elementor-editor-preview:before {
    content: "轮播预览 (仅显示第一张图片)";
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    z-index: 20;
}

/* 导航箭头 */
.geniatech-gallery-nav {
    width: 40px;
    height: 40px;
    background: transparent;
    color: #999999;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
    font-size: 16px;
    flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    pointer-events: auto;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.geniatech-gallery-nav:hover {
    color: #666666;
    transform: scale(1.1);
}

.geniatech-gallery-nav:active {
    transform: scale(0.95);
}

.geniatech-gallery-nav:focus {
    outline: none !important;
    box-shadow: none !important;
}

.geniatech-gallery-nav:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

.geniatech-gallery-nav::-moz-focus-inner {
    border: 0;
    outline: none;
}

/* Swiper导航箭头样式 */
.geniatech-gallery-nav:after {
    font-family: swiper-icons;
    font-size: 16px;
    text-transform: none !important;
    letter-spacing: 0;
    font-variant: initial;
    line-height: 1;
    color: inherit;
}

.geniatech-gallery-prev:after {
    content: 'prev';
}

.geniatech-gallery-next:after {
    content: 'next';
}

/* 隐藏自定义图标，使用Swiper内置图标 */
.geniatech-gallery-nav i {
    display: none;
}

/* 导航容器样式 */
.geniatech-gallery-navigation-container {
    display: flex;
    align-items: center;
    gap: 15px;
    justify-content: center;
    position: relative;
    z-index: 10;
    pointer-events: none;
}

.geniatech-gallery-navigation-container > * {
    pointer-events: auto;
}

.geniatech-gallery-navigation-only {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
    position: relative;
    z-index: 10;
}

/* 缩略图导航 */
.geniatech-product-gallery-thumbs {
    position: relative;
    flex: 1;
    height: 84px;
    min-height: 84px;
    max-height: 84px;
    padding: 0;
    overflow: hidden;
}

.geniatech-product-gallery-thumbs .swiper-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    height: 84px;
    width: 100%;
    padding: 0;
    box-sizing: border-box;
}

/* 当缩略图少于5张时，均匀分布 */
.geniatech-product-gallery-thumbs .swiper-wrapper[data-slides="1"] {
    justify-content: left;
}

.geniatech-product-gallery-thumbs .swiper-wrapper[data-slides="2"] {
    justify-content: left;
}

.geniatech-product-gallery-thumbs .swiper-wrapper[data-slides="3"] {
    justify-content: left;
}

.geniatech-product-gallery-thumbs .swiper-wrapper[data-slides="4"] {
    justify-content: left;
}

.geniatech-product-gallery .geniatech-gallery-thumb {
    width: 80px;
    height: 80px;
    min-width: 80px;
    min-height: 80px;
    max-width: 80px;
    max-height: 80px;
    margin: 0 5px;
    cursor: pointer;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
    border: 2px solid #ccc;
    background: #ffffff;
    display: flex !important;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
}

.geniatech-product-gallery .geniatech-gallery-thumb:first-child {
    margin-left: 0;
}

.geniatech-product-gallery .geniatech-gallery-thumb:last-child {
    margin-right: 0;
}

.geniatech-product-gallery .geniatech-gallery-thumb img {
    max-width: calc(100% - 8px);
    max-height: calc(100% - 8px);
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
    transition: all 0.3s ease;
    display: block;
    margin: 4px;
}

/* 激活状态的缩略图 - 红色边框 */
.geniatech-product-gallery .geniatech-gallery-thumb.swiper-slide-thumb-active {
    border-color: #ff0000;
    opacity: 1;
}

/* 非激活状态的缩略图 - 灰色边框 */
.geniatech-product-gallery .geniatech-gallery-thumb:not(.swiper-slide-thumb-active) {
    border-color: #ccc;
    opacity: 0.7;
}

/* 悬停效果 */
.geniatech-product-gallery .geniatech-gallery-thumb:hover {
    opacity: 1;
}

/* Elementor编辑器预览中的缩略图 */
.geniatech-product-gallery.elementor-editor-preview .geniatech-gallery-thumb {
    display: inline-block;
}

.geniatech-product-gallery.elementor-editor-preview .geniatech-product-gallery-thumbs .swiper-wrapper {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
}

/* 空状态 */
.geniatech-gallery-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    background: #f9f9f9;
    border: 2px dashed #ddd;
    border-radius: 8px;
    color: #666;
    font-size: 16px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .geniatech-product-gallery-main {
        height: 300px;
        margin-bottom: 10px;
    }
    
    .geniatech-gallery-nav {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .geniatech-gallery-prev {
        left: 10px;
    }
    
    .geniatech-gallery-next {
        right: 10px;
    }
    
    .geniatech-product-gallery .geniatech-gallery-thumb {
        width: 60px;
        height: 60px;
        min-width: 60px;
        min-height: 60px;
        max-width: 60px;
        max-height: 60px;
        margin: 0 4px;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
    
    .geniatech-product-gallery .geniatech-gallery-thumb:first-child {
        margin-left: 0;
    }
    
    .geniatech-product-gallery .geniatech-gallery-thumb:last-child {
        margin-right: 0;
    }
    
    .geniatech-product-gallery-thumbs {
        height: 64px;
        min-height: 64px;
        max-height: 64px;
    }

    .geniatech-product-gallery-thumbs .swiper-wrapper {
        height: 64px;
    }
}

@media (max-width: 480px) {
    .geniatech-product-gallery-main {
        height: 250px;
    }
    
    .geniatech-product-gallery .geniatech-gallery-thumb {
        width: 50px;
        height: 50px;
        min-width: 50px;
        min-height: 50px;
        max-width: 50px;
        max-height: 50px;
        margin: 0 3px;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
    
    .geniatech-product-gallery .geniatech-gallery-thumb:first-child {
        margin-left: 0;
    }
    
    .geniatech-product-gallery .geniatech-gallery-thumb:last-child {
        margin-right: 0;
    }
    
    .geniatech-product-gallery-thumbs {
        height: 54px;
        min-height: 54px;
        max-height: 54px;
    }

    .geniatech-product-gallery-thumbs .swiper-wrapper {
        height: 54px;
    }
}

/* Swiper 覆盖样式 */
.geniatech-product-gallery .swiper-wrapper {
    align-items: stretch;
}

.geniatech-product-gallery .swiper-slide {
    height: auto;
}

/* 加载状态 */
.geniatech-product-gallery-main .swiper-slide img {
    transition: opacity 0.3s ease;
}

.geniatech-product-gallery-main .swiper-slide img[loading] {
    opacity: 0;
}

.geniatech-product-gallery-main .swiper-slide img:not([loading]) {
    opacity: 1;
}

/* 缩略图滚动条隐藏 */
.geniatech-product-gallery-thumbs {
    overflow: hidden;
}

.geniatech-product-gallery-thumbs .swiper-wrapper {
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.geniatech-product-gallery-thumbs .swiper-wrapper::-webkit-scrollbar {
    display: none;
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .geniatech-product-gallery-main {
        background: #2a2a2a;
    }
    
    .geniatech-product-gallery-main .swiper-slide {
        background: #1a1a1a;
    }
    
    .geniatech-gallery-empty {
        background: #2a2a2a;
        border-color: #444;
        color: #ccc;
    }
}

/* 图片懒加载效果 */
.geniatech-product-gallery img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.geniatech-product-gallery img[loading="lazy"].loaded {
    opacity: 1;
}

/* 焦点状态 */
.geniatech-gallery-nav:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.geniatech-gallery-thumb:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.geniatech-product-gallery {
    animation: fadeIn 0.5s ease;
}

/* 灯箱样式 */
.geniatech-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: lightboxFadeIn 0.3s ease forwards;
    backdrop-filter: blur(2px);
}

@keyframes lightboxFadeIn {
    to {
        opacity: 1;
    }
}

.geniatech-lightbox-container {
    position: relative;
    max-width: 95%;
    max-height: 95%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.geniatech-lightbox-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: calc(100vh - 80px);
    width: 100%;
    flex: 1;
}

.geniatech-lightbox-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    transition: all 0.3s ease;
}

.geniatech-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10001;
    outline: none;
    backdrop-filter: blur(10px);
}

.geniatech-lightbox-close:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.05);
}

.geniatech-lightbox-prev,
.geniatech-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 54px;
    height: 54px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10001;
    user-select: none;
    outline: none;
    backdrop-filter: blur(10px);
}

.geniatech-lightbox-prev {
    left: 20px;
}

.geniatech-lightbox-next {
    right: 20px;
}

.geniatech-lightbox-prev:hover,
.geniatech-lightbox-next:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-50%) scale(1.05);
}

.geniatech-lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 14px;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 25px;
    white-space: nowrap;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 响应式灯箱 */
@media (max-width: 768px) {
    .geniatech-lightbox-container {
        max-width: 98%;
        max-height: 98%;
    }

    .geniatech-lightbox-content {
        max-height: calc(100vh - 60px);
    }
}

@media (max-width: 480px) {
    .geniatech-lightbox-prev {
        left: 15px;
        width: 44px;
        height: 44px;
        font-size: 16px;
    }

    .geniatech-lightbox-next {
        right: 15px;
        width: 44px;
        height: 44px;
        font-size: 16px;
    }

    .geniatech-lightbox-close {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .geniatech-lightbox-counter {
        bottom: 15px;
        font-size: 13px;
        padding: 8px 16px;
    }

    .geniatech-lightbox-container {
        max-width: 95%;
        max-height: 95%;
    }

    .geniatech-lightbox-content {
        max-height: calc(100vh - 50px);
    }
}
