/**
 * 产品图片缩略图切换组件
 * 布局：左侧大图预览 + 右侧垂直小图列表
 * BEM命名规范
 */

/* ============================================
   Block: thumb-gallery (缩略图画廊组件)
   ============================================ */

/**
 * 画廊容器
 * 采用flex布局，左侧大图 + 右侧小图列表
 * 比例为 4:1
 */
.thumb-gallery {
    display: flex;
    gap: 16px;
    width: 100%;
    flex-direction: column;
}

/* ============================================
   Element: thumb-gallery__preview (左侧预览区)
   ============================================ */

/**
 * 大图预览容器
 * 占据 4/5 空间，保持图片比例
 */
.thumb-gallery__preview {
    flex: 4;
    min-width: 0;
    border-radius: 8px;
    overflow: hidden;
    background-color: #f5f5f5;
    aspect-ratio: 1;
    max-height: 350px;
}

/**
 * 预览图片
 * 铺满父区域显示
 */
.thumb-gallery__preview-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/**
 * 预览区域悬停放大效果
 */
.thumb-gallery__preview:hover .thumb-gallery__preview-img {
    transform: scale(1.15);
}

/* ============================================
   Element: thumb-gallery__thumbs (右侧缩略图列表)
   ============================================ */

/**
 * 缩略图列表容器
 * 占据 1/5 空间，垂直排列
 */
.thumb-gallery__thumbs {
    display: flex;
    /* flex-direction: column; */
    gap: 12px;
    flex: 1;
    min-width: 0;
    justify-content: flex-start;
}

/**
 * 缩略图项
 * 自适应容器宽度，保持正方形比例，圆角边框
 */
.thumb-gallery__thumb-item {
    width: 24%;
    max-height: 120px;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s ease, transform 0.2s ease;
    background-color: #f5f5f5;
}

/**
 * 缩略图项悬停状态
 */
.thumb-gallery__thumb-item:hover {
    border-color: #ccc;
    transform: scale(1.02);
}

/**
 * 缩略图项激活状态
 * 当前选中的缩略图
 */
.thumb-gallery__thumb-item--active {
    border-color: #1890ff;
}

/**
 * 缩略图图片
 * 填充整个容器
 */
.thumb-gallery__thumb-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ============================================
   响应式设计 - Responsive Design
   移动端：左右结构变为上下结构
   ============================================ */

/**
 * 平板及以下设备 (768px以下)
 * 大图在上，缩略图列表在下水平排列
 */
@media screen and (max-width: 768px) {
    .thumb-gallery {
        flex-direction: column;
        gap: 12px;
    }

    .thumb-gallery__preview {
        flex: none;
        width: 100%;
        max-height: 400px;
        aspect-ratio: 4 / 3;
    }

    .thumb-gallery__thumbs {
        flex: none;
        flex-direction: row;
        gap: 8px;
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .thumb-gallery__thumb-item {
        flex-shrink: 0;
        width: 80px;
        height: 80px;
        max-height: none;
    }
}

/**
 * 移动设备 (480px以下)
 * 更紧凑的布局
 */
@media screen and (max-width: 480px) {
    .thumb-gallery {
        gap: 8px;
    }

    .thumb-gallery__preview {
        max-height: 300px;
        border-radius: 6px;
    }

    .thumb-gallery__thumbs {
        gap: 6px;
    }

    .thumb-gallery__thumb-item {
        width: 60px;
        height: 60px;
        border-radius: 6px;
    }
}