/**
 * 移动端产品图片展示组件
 * 替代Bootstrap轮播图，提供更优雅的移动端体验
 */

/* 只在移动端显示 */
@media (max-width: 767px) {

    /* 移动端产品图片容器 */
    .mobile-product-gallery {
        position: relative;
        width: 100%;
        background: #ffffff;
        overflow: hidden;
    }

    /* 主图显示区域 */
    .mobile-main-image {
        position: relative;
        width: 100%;
        height: 40vh;
        min-height: 280px;
        max-height: 380px;
        background: #f8f9fa;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }

    .mobile-main-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: opacity 0.3s ease;
        cursor: pointer;
    }

    /* 缩略图滚动区域 */
    .mobile-thumbnails {
        padding: 12px 15px;
        background: #ffffff;
        border-top: 1px solid #e9ecef;
    }

    .mobile-thumbnails-scroll {
        display: flex;
        gap: 10px;
        overflow-x: auto;
        padding: 5px 0 10px 0;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }

    /* 隐藏滚动条但保持功能 */
    .mobile-thumbnails-scroll::-webkit-scrollbar {
        height: 3px;
    }

    .mobile-thumbnails-scroll::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 3px;
    }

    .mobile-thumbnails-scroll::-webkit-scrollbar-thumb {
        background: #c1c1c1;
        border-radius: 3px;
    }

    .mobile-thumbnails-scroll::-webkit-scrollbar-thumb:hover {
        background: #a8a8a8;
    }

    /* 缩略图项目 */
    .mobile-thumbnail-item {
        flex: 0 0 70px;
        height: 70px;
        border-radius: 6px;
        overflow: hidden;
        border: 2px solid transparent;
        transition: all 0.3s ease;
        cursor: pointer;
        position: relative;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    }

    .mobile-thumbnail-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.3s ease;
    }

    .mobile-thumbnail-item:hover {
        transform: scale(1.05);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    }

    .mobile-thumbnail-item:hover img {
        transform: scale(1.05);
    }

    .mobile-thumbnail-item.active {
        border-color: #007bff;
        box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
        transform: scale(1.02);
    }

    /* 图片计数器 */
    .mobile-image-counter {
        position: absolute;
        top: 15px;
        right: 15px;
        background: rgba(0, 0, 0, 0.7);
        color: white;
        padding: 6px 12px;
        border-radius: 20px;
        font-size: 12px;
        font-weight: 500;
        z-index: 10;
    }

    /* 放大镜提示 */
    .mobile-zoom-hint {
        position: absolute;
        bottom: 15px;
        right: 15px;
        background: rgba(0, 0, 0, 0.8);
        color: white;
        padding: 10px;
        border-radius: 50%;
        font-size: 14px;
        z-index: 10;
        opacity: 0.9;
        transition: all 0.3s ease;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }

    /* Bootstrap Icons 放大镜图标样式 */
    .mobile-zoom-hint i {
        font-size: 18px;
        line-height: 1;
    }

    .mobile-main-image:hover .mobile-zoom-hint,
    .mobile-main-image:active .mobile-zoom-hint {
        opacity: 1;
        transform: scale(1.1);
    }

    /* 加载状态 */
    .mobile-main-image.loading {
        background: #f8f9fa;
    }

    .mobile-main-image.loading::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 40px;
        height: 40px;
        margin: -20px 0 0 -20px;
        border: 3px solid #e9ecef;
        border-top: 3px solid #007cba;
        border-radius: 50%;
        animation: spin 1s linear infinite;
        z-index: 5;
    }

    @keyframes spin {
        0% {
            transform: rotate(0deg);
        }

        100% {
            transform: rotate(360deg);
        }
    }

    /* 图片切换动画 */
    .mobile-main-image img.fade-in {
        animation: fadeIn 0.3s ease-in-out;
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
        }

        to {
            opacity: 1;
        }
    }

    /* 小屏幕优化 */
    @media (max-width: 480px) {
        .mobile-main-image {
            height: 45vh;
            min-height: 280px;
            max-height: 400px;
        }

        .mobile-thumbnail-item {
            flex: 0 0 70px;
            height: 70px;
        }

        .mobile-thumbnails {
            padding: 12px;
        }

        .mobile-thumbnails-scroll {
            gap: 8px;
        }
    }

    /* 超小屏幕优化 */
    @media (max-width: 360px) {
        .mobile-main-image {
            height: 35vh;
            min-height: 240px;
            max-height: 320px;
        }

        .mobile-thumbnail-item {
            flex: 0 0 60px;
            height: 60px;
        }

        .mobile-thumbnails {
            padding: 10px;
        }

        .mobile-image-counter {
            font-size: 11px;
            padding: 5px 10px;
        }

        .mobile-zoom-hint {
            width: 36px;
            height: 36px;
            bottom: 12px;
            right: 12px;
        }

        .mobile-zoom-hint i {
            font-size: 16px;
        }
    }
}

/* 确保在桌面端不显示 */
@media (min-width: 768px) {
    .mobile-product-gallery {
        display: none !important;
    }
}

/* 移动端产品元数据布局优化 */
@media (max-width: 768px) {
    .product_meta {
        flex-direction: column !important;
        gap: 0.8rem !important;
        padding: 1rem !important;
        margin: 1rem 0 !important;
        background-color: #f8f9fa !important;
        border-radius: 8px;
    }

    .product_meta>span {
        display: block;
        padding: 0.5rem 0;
        border-bottom: 1px solid #e9ecef;
        font-size: 14px;
        line-height: 1.4;
    }

    .product_meta>span:last-child {
        border-bottom: none;
    }

    /* SKU样式 */
    .product_meta .sku_wrapper {
        color: #495057;
    }

    .product_meta .sku {
        font-weight: 700;
        color: #212529;
    }

    /* 分类和标签样式 */
    .product_meta .posted_in,
    .product_meta .tagged_as {
        color: #495057;
    }

    .product_meta .posted_in a,
    .product_meta .tagged_as a {
        color: var(--theme-color, #007cba);
        text-decoration: none;
        font-weight: 600;
    }

    .product_meta .posted_in a:hover,
    .product_meta .tagged_as a:hover {
        text-decoration: underline;
    }
}