/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    /* 确保页面可以正常滚动 */
    overflow-x: hidden;
    overflow-y: auto;
}

    .container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 0 20px;
    }

    @media (max-width: 768px) {
        .container {
            padding: 0 12px;
        }
    }

/* 导航栏 */
.navbar {
    background: #1E40AF;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1001;
}

/* 移动端：分类栏作为弹窗覆盖在导航栏之上，不需要隐藏导航栏元素 */

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.nav-brand a {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

.nav-search {
    flex: 1;
    max-width: 500px;
    margin: 0 1rem;
}

.search-form {
    display: flex;
    gap: 0.5rem;
}

    .search-input {
        flex: 1;
        padding: 0.75rem 1rem;
        border: none;
        border-radius: 25px;
        font-size: 1rem;
        outline: none;
    }

    .search-btn {
        padding: 0.75rem 1.5rem;
        background: #fff;
        color: #1E40AF;
        border: none;
        border-radius: 25px;
        cursor: pointer;
        font-weight: bold;
        transition: all 0.3s;
    }

    @media (max-width: 768px) {
        .search-input {
            padding: 0.6rem 0.9rem;
            font-size: 0.9rem;
        }

        .search-btn {
            padding: 0.6rem 1.2rem;
            font-size: 0.9rem;
        }
    }

.search-btn:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
}

.nav-menu {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: background 0.3s;
    display: inline-block; /* PC端显示文字链接 */
}

/* PC端默认隐藏移动端分类按钮 */
.mobile-category-btn {
    display: none !important;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255,255,255,0.2);
}

/* 语言选择器 */
.language-selector {
    position: relative;
    margin-right: 1rem;
}

.language-selector-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.language-selector-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.language-flag {
    font-size: 1.2rem;
    line-height: 1;
}

.language-name {
    font-weight: 500;
    white-space: nowrap;
}

.language-arrow {
    font-size: 0.7rem;
    transition: transform 0.3s ease;
    margin-left: 0.2rem;
}

.language-selector-btn:hover .language-arrow {
    transform: translateY(2px);
}

.language-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1002;
    animation: slideDown 0.3s ease;
    /* 确保下拉菜单可以显示 */
    visibility: visible;
    opacity: 1;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.language-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.language-option:last-child {
    border-bottom: none;
}

.language-option:hover {
    background: #f8f9fa;
}

.language-option.active {
    background: #e3f2fd;
    color: #1976d2;
    font-weight: 500;
}

.language-option.active:hover {
    background: #bbdefb;
}

.language-option .language-flag {
    font-size: 1.3rem;
    line-height: 1;
}

.language-option .language-name {
    flex: 1;
    color: #333;
}

.language-option.active .language-name {
    color: #1976d2;
}

.language-check {
    color: #1976d2;
    font-weight: bold;
    font-size: 1rem;
}

/* 响应式设计 - 语言选择器 */
@media (max-width: 768px) {
    .language-selector {
        margin-right: 0; /* 移除右边距，因为已经通过order控制位置 */
        margin-left: 0.5rem; /* 与GlobalBuy的间距 */
        position: relative; /* 确保定位上下文 */
        z-index: 10001; /* 提高z-index，确保选择器本身也在上层 */
        order: 2; /* 紧跟在nav-brand后面 */
    }
    
    .language-selector-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
    
    /* 移动端也显示语言名称 */
    .language-name {
        display: block;
        font-size: 0.8rem;
    }
    
    .language-dropdown {
        left: auto; /* 由JavaScript动态设置，显示在按钮下方 */
        right: auto; /* 由JavaScript动态设置 */
        min-width: 200px;
        max-width: calc(100vw - 2rem); /* 确保不超出屏幕 */
        min-height: 200px; /* 最小高度，确保显示多个选项 */
        max-height: 500px; /* 最大高度，由JavaScript动态调整 */
        height: auto; /* 高度自适应内容 */
        z-index: 10002 !important; /* 提高z-index，确保显示在最上层，覆盖所有元素 */
        position: fixed; /* 移动端使用fixed定位，避免被父容器裁剪 */
        top: auto; /* 由JavaScript动态设置 */
        bottom: auto;
        transform: none; /* 重置transform */
        animation: slideDown 0.3s ease; /* 从上方滑下的动画 */
        /* 确保下拉菜单可以滚动 */
        overflow-y: auto !important;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch; /* iOS平滑滚动 */
        /* 确保下拉菜单可以显示 */
        visibility: visible !important;
        opacity: 1 !important;
        /* 确保下拉菜单有足够的空间显示 */
        box-sizing: border-box;
    }
    
    /* 从上方滑下的动画 */
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    /* 确保导航栏容器不会裁剪下拉菜单 */
    .navbar {
        overflow: visible !important; /* 确保下拉菜单不被裁剪 */
    }
    
    .navbar .container {
        overflow: visible !important; /* 确保下拉菜单不被裁剪 */
    }
}

/* 主横幅 */
.hero {
    background: #1E40AF;
    color: white;
    padding: 4rem 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="rgba(255,255,255,0.1)" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,122.7C672,117,768,139,864,154.7C960,171,1056,181,1152,165.3C1248,149,1344,107,1392,85.3L1440,64L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') no-repeat bottom;
    background-size: cover;
    opacity: 0.3;
}

.hero .container {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.95;
}

/* 精选类目区域（现在在右侧内容区域内） */
.featured-categories-section {
    padding: 0;
    margin-bottom: 2rem;
    background: transparent;
    /* 与左侧分类栏header对齐 */
    margin-top: 0;
    padding-top: 0;
}

.featured-categories-title {
    font-size: 1.8rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 1.5rem;
    margin-top: 0;
    padding-top: 0;
    text-align: left;
    /* 与左侧分类栏header高度对齐 */
    line-height: 1.2;
    min-height: calc(1.2rem * 2 + 1.1rem); /* 匹配category-sidebar-header的padding和内容高度 */
    display: flex;
    align-items: center;
}

.featured-categories-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .featured-categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

.featured-category-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    border: 1px solid transparent;
}

.featured-category-card:hover {
    border-color: #1E40AF;
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.category-icon-wrapper {
    margin-bottom: 1rem;
}

.category-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.featured-category-card:hover .category-icon {
    transform: scale(1.1);
}

.category-card-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.4rem;
    margin-top: 0.5rem;
}

.category-card-desc {
    font-size: 0.85rem;
    color: #666;
    margin: 0;
}

/* 响应式设计 - 精选类目 */
@media (max-width: 1024px) {
    .featured-categories-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .featured-categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }
    
    .featured-category-card {
        padding: 1.2rem 0.8rem;
        min-height: 140px;
    }
    
    .category-icon {
        width: 60px;
        height: 60px;
    }
    
    .category-card-title {
        font-size: 1.1rem;
    }
    
    .category-card-desc {
        font-size: 0.8rem;
    }
}

@media (max-width: 768px) {
    .featured-categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .featured-category-card {
        padding: 1.5rem 1rem;
        min-height: 150px;
    }
    
    .category-icon {
        width: 60px;
        height: 60px;
    }
    
    .category-card-title {
        font-size: 1.1rem;
    }
    
    .category-card-desc {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 0.5rem 0;
    }

    .nav-brand a {
        font-size: 1.1rem;
    }

    .nav-menu {
        gap: 0.5rem;
    }

    .nav-link {
        padding: 0.35rem 0.6rem;
        font-size: 0.85rem;
    }

    .search-input {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }

    .search-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    .container {
        padding: 0 10px;
    }

    .featured-categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
    }
    
    .featured-category-card {
        padding: 1rem 0.6rem;
        min-height: 120px;
    }
    
    .category-icon {
        width: 45px;
        height: 45px;
    }
    
    .category-card-title {
        font-size: 0.95rem;
        margin-bottom: 0.3rem;
    }
    
    .category-card-desc {
        font-size: 0.75rem;
    }

    .featured-categories-title {
        font-size: 1.3rem;
        margin-bottom: 0.75rem;
    }

    .section-title {
        font-size: 1.3rem;
        margin-bottom: 0.75rem;
    }

    .products-grid {
        gap: 0.6rem;
    }

    .product-image-wrapper {
        height: 140px;
    }

    .product-info {
        padding: 0.6rem;
    }

    .product-title {
        font-size: 0.85rem;
        margin-bottom: 0.4rem;
        min-height: 2rem;
    }

    .product-price {
        font-size: 1rem;
    }

    .category-sidebar-header {
        padding: 1rem;
        font-size: 1rem;
        position: sticky;
        top: 0;
        z-index: 10;
    }

        /* 移动端分类栏关闭按钮 */
        .category-sidebar-header .category-close-btn {
            display: none;
        }

        @media (max-width: 768px) {
            .category-sidebar-header {
                padding: 1rem 1.2rem;
                justify-content: flex-start;
                background: #2c3e50;
                border-bottom: 1px solid rgba(255, 255, 255, 0.1);
            }

            .category-sidebar-header h3 {
                flex: 1;
                text-align: left;
                margin: 0;
                font-size: 1rem;
                font-weight: 600;
            }

            .category-header-icon {
                width: 20px;
                height: 20px;
                opacity: 0.9;
            }

            .category-sidebar-header .category-close-btn {
                display: flex;
                align-items: center;
                justify-content: center;
                position: static;
                transform: none;
                background: transparent;
                border: none;
                color: white;
                width: 32px;
                height: 32px;
                border-radius: 4px;
                cursor: pointer;
                padding: 0;
                transition: background 0.3s;
                flex-shrink: 0;
            }

            .category-sidebar-header .category-close-btn:hover {
                background: rgba(255, 255, 255, 0.2);
            }

            .category-sidebar-header .category-close-btn svg {
                width: 20px;
                height: 20px;
            }

            .category-sidebar-header .category-toggle-btn {
                display: none; /* 移动端隐藏折叠按钮 */
            }
        }

    .category-sidebar-item {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }

    .category-submenu-item {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
}

/* 主要内容区域 */
.main-content-section {
    padding: 2rem 0;
    background: #f8f9fa;
    /* 确保可以正常滚动 */
    position: relative;
    z-index: 0;
    /* 确保可以正常滚动，但不能有overflow:hidden，否则会影响sticky定位 */
    overflow-x: hidden;
    overflow-y: visible;
    /* 确保触摸滚动正常工作 */
    touch-action: pan-y;
    /* 确保sticky定位的父容器有足够高度 */
    min-height: 100vh;
}

.main-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
    align-items: start;
    position: relative;
}

/* 当分类栏固定定位时，调整布局 */
.main-layout .category-sidebar {
    /* 固定定位时，不占用网格空间，但保留占位 */
    grid-column: 1;
}

.main-layout .products-main {
    /* 确保右侧内容区域正常显示 */
    grid-column: 2;
}

/* 左侧分类栏 */
.category-sidebar {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    overflow: visible; /* 保持visible，允许二级分类菜单显示在外部 */
    position: fixed; /* 改为fixed，固定在屏幕上，不随页面滚动 */
    /* left值由JavaScript动态计算，使其与原来grid布局位置一致 */
    top: 80px; /* 距离顶部80px（导航栏下方） */
    width: 250px; /* 固定宽度 */
    height: auto; /* 由JS动态设置高度，与精选类目保持一致 */
    min-height: 600px; /* 设置最小高度 */
    max-height: calc(100vh - 100px); /* 确保不超过视口高度，留出顶部和底部间距 */
    display: flex;
    flex-direction: column;
    border: 1px solid #e9ecef;
    /* 确保不会阻止页面滚动 */
    pointer-events: auto;
    z-index: 1000; /* 提高z-index，确保始终显示在最上层，但低于导航栏 */
    /* 侧边栏内部可以滚动 */
    touch-action: pan-y;
    /* 确保滚动时高度保持不变 */
    box-sizing: border-box;
}

/* 移动端分类栏：从左侧弹出的弹窗 */
@media (max-width: 768px) {
    .category-sidebar {
        position: fixed;
        left: -100% !important; /* 默认隐藏在左侧屏幕外 */
        top: 0 !important; /* 从屏幕最顶部开始 */
        width: 60% !important; /* 增加到60%宽度，让分类更宽 */
        height: 100vh; /* 从顶到底，覆盖整个屏幕高度 */
        min-height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        z-index: 9999 !important; /* 最高层级，确保覆盖导航栏和其他元素 */
        transition: left 0.3s ease; /* 平滑滑出动画 */
        box-shadow: 2px 0 10px rgba(0,0,0,0.15); /* 右侧阴影，增强层次感 */
        overflow-y: auto;
        overflow-x: hidden;
        background: white;
        /* 确保不占用布局空间 */
        display: none;
    }

    /* 移动端打开状态：从左侧滑出 */
    .category-sidebar.mobile-open {
        left: 0 !important; /* 滑出到屏幕左侧 */
        top: 0 !important; /* 从屏幕最顶部开始 */
        display: flex;
        flex-direction: column;
        background: white;
        width: 60% !important; /* 增加到60%宽度，让分类更宽 */
        z-index: 9999 !important; /* 确保打开时也在最上层，遮挡导航栏 */
    }

    /* 移动端分类列表样式优化 */
    .category-sidebar-list {
        background: white;
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* 移动端分类项样式优化 */
    .category-sidebar-item {
        padding: 1rem 1.2rem;
        border-bottom: none; /* 去掉下方横线 */
        display: flex;
        align-items: center;
        gap: 0.75rem;
        transition: background 0.2s ease;
    }

    .category-sidebar-item:active {
        background: #f8f9fa;
    }

    .category-icon {
        font-size: 1.5rem;
        width: 24px;
        text-align: center;
        flex-shrink: 0;
    }

    .category-text {
        flex: 1;
        font-size: 0.95rem;
        font-weight: 500;
        color: #333;
    }

    .category-arrow {
        color: #999;
        font-size: 1.2rem;
        flex-shrink: 0;
    }
}

.category-sidebar-header {
    background: #1E40AF;
    color: white;
    padding: 1.2rem 1.2rem;
    font-size: 1.1rem;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    /* 确保与右侧标题对齐 */
    min-height: calc(1.2rem * 2 + 1.1rem);
}

.category-header-icon {
    flex-shrink: 0;
    opacity: 0.9;
}

.category-sidebar-header h3 {
    margin: 0;
    flex: 1;
    line-height: 1.2;
}

.category-toggle-btn {
    display: none;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.3s;
}

.category-toggle-btn:hover {
    background: rgba(255,255,255,0.3);
}

.toggle-icon {
    display: block;
}

.category-sidebar-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255,255,255,0.2);
}

.category-sidebar-list {
    overflow-y: auto;
    overflow-x: visible; /* 允许二级分类菜单横向溢出 */
    position: relative; /* 确保定位上下文 */
    /* 确保滚动不会影响页面滚动 */
    overscroll-behavior: contain;
    /* 确保侧边栏滚动不会阻止页面滚动 */
    touch-action: pan-y;
    /* 防止滚动穿透 */
    -webkit-overflow-scrolling: touch;
    /* 侧边栏内部滚动，不影响页面 */
    flex: 1;
    /* 确保列表可以滚动，最小高度为0 */
    min-height: 0;
    /* 最大高度由父容器控制，但确保不超过视口 */
    max-height: 100%;
}

.category-sidebar-list::-webkit-scrollbar {
    width: 6px;
}

.category-sidebar-list::-webkit-scrollbar-track {
    background: #f0f0f0;
}

.category-sidebar-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.category-sidebar-list::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.category-sidebar-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.2rem;
    color: #1E40AF;
    text-decoration: underline;
    border-bottom: none; /* 去掉下方横线 */
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
}

/* 当有二级分类时，最后一项的边框由二级分类处理 */
.category-item-wrapper:not(.submenu-open) .category-sidebar-item:last-child,
.category-item-wrapper.submenu-open + .category-item-wrapper .category-sidebar-item {
    border-bottom: none; /* 去掉下方横线 */
}

.category-sidebar-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: #1E40AF;
    transition: width 0.3s ease;
}

.category-sidebar-item:hover {
    background: rgba(30, 64, 175, 0.1);
    color: #1E3A8A;
    text-decoration: underline;
    padding-left: 1.5rem;
}

.category-sidebar-item:hover::before {
    width: 3px;
}

.category-sidebar-item.active {
    background: rgba(30, 64, 175, 0.15);
    color: #1E40AF;
    font-weight: 600;
    text-decoration: underline;
}

.category-sidebar-item.active::before {
    width: 3px;
}

.category-icon {
    font-size: 1.3rem;
    margin-right: 0.8rem;
    width: 28px;
    text-align: center;
    transition: transform 0.3s;
}

.category-sidebar-item:hover .category-icon {
    transform: scale(1.1);
}

.category-text {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-arrow {
    color: #ccc;
    font-size: 1.4rem;
    font-weight: 300;
    transition: all 0.3s;
    margin-left: 0.5rem;
    display: inline-block;
}

.category-sidebar-item:hover .category-arrow {
    color: #1E40AF;
}

.category-sidebar-item.active .category-arrow {
    color: #1E40AF;
}

/* 展开状态下的箭头旋转 */
.category-item-wrapper.submenu-open .category-arrow {
    color: #1E40AF;
    transform: rotate(90deg); /* 箭头旋转90度，表示已展开 */
}

/* 二级分类样式 */
.category-item-wrapper {
    position: relative;
}

/* 展开时，一级分类项移除底部边框，与二级分类无缝连接 */
.category-item-wrapper.submenu-open .category-sidebar-item {
    border-bottom: none;
    border-radius: 8px 8px 0 0; /* 只保留顶部圆角 */
}

.category-submenu {
    /* 使用正常文档流，让二级分类推动下面的内容下移 */
    position: relative;
    width: 100%; /* 与一级分类同宽 */
    background: white;
    border: none; /* 去掉所有边框 */
    border-radius: 0; /* 所有角都是直角 */
    /* 移除下方阴影 */
    box-shadow: none;
    max-height: 0; /* 初始高度为0，隐藏 */
    overflow: hidden; /* 隐藏溢出内容 */
    transition: max-height 0.3s ease, opacity 0.3s ease;
    padding: 0; /* 初始padding为0 */
    opacity: 0;
    margin: 0;
}

.category-item-wrapper.submenu-open .category-submenu {
    max-height: 500px; /* 展开时设置足够大的高度 */
    opacity: 1 !important;
    padding: 0.5rem 0; /* 展开时添加padding */
    overflow-y: auto; /* 内容过多时显示滚动条 */
    /* 确保二级菜单的滚动不会影响页面滚动 */
    overscroll-behavior: contain;
    /* 确保不会阻止页面滚动 */
    touch-action: pan-y;
    /* 防止滚动穿透 */
    -webkit-overflow-scrolling: touch;
}

.category-submenu-item {
    display: block;
    padding: 0.75rem 1.2rem;
    color: #1E40AF;
    text-decoration: underline;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    white-space: nowrap; /* 防止文字换行 */
}

.category-submenu-item:hover {
    background: rgba(30, 64, 175, 0.1);
    color: #1E3A8A;
    text-decoration: underline;
    border-left-color: #1E40AF;
    padding-left: 1.5rem;
}

.category-submenu-item:first-child {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.category-submenu-item:last-child {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* 当有二级分类时，一级分类项的样式调整 */
.category-sidebar-item[data-has-submenu="true"] {
    position: relative;
    cursor: pointer; /* 显示手型光标，表示可点击 */
}

.category-sidebar-item[data-has-submenu="true"]:hover {
    background: rgba(30, 64, 175, 0.1);
}

.category-item-wrapper.submenu-open .category-sidebar-item[data-has-submenu="true"] {
    background: rgba(30, 64, 175, 0.15);
    color: #1E40AF;
    font-weight: 600;
}

/* 商品区域 */
.products-section {
    padding: 0;
    margin-top: 2rem;
    background: transparent;
}

.products-main {
    background: transparent;
    display: flex;
    flex-direction: column;
    transition: margin-top 0.3s ease;
    margin-top: 0;
    /* 确保可以正常滚动 */
    position: relative;
    z-index: 0;
    overflow: visible;
    /* 确保触摸滚动正常工作 */
    touch-action: pan-y;
    /* 确保可以正常滚动 */
    will-change: transform;
    /* 当分类栏固定定位时，确保内容不被遮挡 */
    margin-left: 0;
}

.section-title {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: #333;
    font-weight: bold;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.product-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.product-image-wrapper {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #f0f0f0;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

.product-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(30, 64, 175, 0.9);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
}

.product-info {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-title {
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 0.75rem;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.5rem;
    line-height: 1.4;
}

.product-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.product-price {
    font-size: 1.2rem;
    color: #e74c3c;
    font-weight: 600;
}

.product-min-order {
    font-size: 0.85rem;
    color: #666;
    background: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.product-seller {
    font-size: 0.9rem;
    color: #666;
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.seller-label {
    color: #999;
}

.seller-name {
    color: #1E40AF;
    font-weight: 500;
}

/* 筛选栏 */
.filters-section {
    background: white;
    padding: 1.5rem 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.filters {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: bold;
    color: #333;
}

.filter-input {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    width: 100px;
}

.filter-select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.filter-btn {
    padding: 0.5rem 1.5rem;
    background: #1E40AF;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.filter-btn:hover {
    background: #1E3A8A;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

.page-btn {
    padding: 0.5rem 1.5rem;
    background: #1E40AF;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.page-btn:hover:not(:disabled) {
    background: #1E3A8A;
}

.page-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.page-info {
    font-weight: bold;
    color: #333;
}

/* 商品详情 */
.product-detail-section {
    padding: 3rem 0;
}

.product-detail {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* 推荐商品区域 */
.related-products-section {
    padding: 3rem 0;
    background: #f8f9fa;
}

.related-products-title {
    font-size: 1.8rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 2rem;
    text-align: center;
}

.related-products-section .products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 0;
}

.detail-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.detail-images {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    max-width: 500px;
}

.main-image-wrapper {
    width: 500px;
    height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f0f0f0;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.main-image {
    width: 500px;
    height: 500px;
    object-fit: contain;
    border-radius: 10px;
    display: block;
    aspect-ratio: 1 / 1;
    transition: opacity 0.3s ease, transform 0.3s ease;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.thumbnail-list {
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
    padding: 0.5rem 0;
}

.thumbnail-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    background: #f0f0f0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.thumbnail-image:hover {
    border-color: #1E40AF;
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(30, 64, 175, 0.3);
}

.thumbnail-image.active {
    border-color: #1E40AF;
    border-width: 3px;
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.4);
}

.detail-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.detail-info h1 {
    font-size: 1.5rem;
    line-height: 1.4;
    margin: 0 0 0.5rem 0;
    color: #333;
    font-weight: 600;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e9ecef;
}

.detail-price-section {
    margin: 0;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.price-section-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
    min-width: 60px;
    padding-top: 0.5rem;
}

.price-ranges-horizontal {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0; /* 允许flex子元素收缩 */
    overflow-x: auto; /* 如果内容过多，允许横向滚动 */
}

.price-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 1.25rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    min-width: 120px;
    max-width: 150px;
    flex: 0 0 auto; /* 不允许收缩，但可以换行 */
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.price-card:hover {
    border-color: #1E40AF;
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.15);
    transform: translateY(-2px);
}

.price-negotiable {
    font-size: 1.2rem;
    font-weight: 600;
    color: #e74c3c;
    text-align: center;
    padding: 0.5rem 0;
}

.price-vnd {
    font-size: 1.2rem;
    font-weight: 700;
    color: #e74c3c;
    margin-bottom: 0.5rem;
    text-align: center;
}

.price-cny {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.5rem;
    text-align: center;
}

.price-min-order {
    font-size: 0.8rem;
    color: #999;
    text-align: center;
}

/* 商品基本信息 */
.product-basic-info {
    margin: 0;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.info-row {
    display: flex;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.info-row:last-child {
    border-bottom: none;
}

.info-row:hover {
    background-color: #f8f9fa;
    margin: 0 -1.5rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    border-radius: 6px;
}

.info-label {
    font-weight: 600;
    color: #555;
    min-width: 100px;
    margin-right: 1rem;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
}

.info-label::after {
    content: ':';
    margin-left: 0.25rem;
    color: #999;
}

.info-value {
    color: #333;
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
}

.info-value.in-stock {
    color: #28a745;
    font-weight: 600;
}

.info-value.out-of-stock {
    color: #dc3545;
    font-weight: 600;
}

/* 颜色选择区域 */
.color-selection-section {
    margin: 0;
    padding: 1rem 1.5rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.color-selection-table-wrapper {
    width: 100%;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    overflow: hidden;
}

.color-selection-table-header {
    display: grid;
    grid-template-columns: 60px 1fr 120px 100px 140px;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
}

.color-header-cell {
    display: flex;
    align-items: center;
}

.color-selection-table-body {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #c0c0c0 #f0f0f0;
}

/* 自定义滚动条样式 */
.color-selection-table-body::-webkit-scrollbar {
    width: 8px;
}

.color-selection-table-body::-webkit-scrollbar-track {
    background: #f0f0f0;
}

.color-selection-table-body::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.color-selection-table-body::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

.color-selection-row {
    display: grid;
    grid-template-columns: 60px 1fr 120px 100px 140px;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.2s ease;
    align-items: center;
}

.color-selection-row:last-child {
    border-bottom: none;
}

.color-selection-row:hover {
    background: #f8f9fa;
}

.color-selection-row.selected {
    background: #f0f4ff;
    border-left: 3px solid #1E40AF;
}

.color-cell {
    display: flex;
    align-items: center;
    overflow: hidden;
}

.color-cell-thumb {
    justify-content: center;
}

.color-cell-name {
    min-width: 0;
}

.color-cell-price {
    justify-content: flex-start;
}

.color-cell-stock {
    justify-content: flex-start;
}

.color-cell-quantity {
    justify-content: flex-start;
}

.color-thumb-small {
    width: 45px;
    height: 45px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    flex-shrink: 0;
}

.color-thumb-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.color-placeholder-small {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    color: #999;
}

.color-name-text {
    font-size: 0.9rem;
    color: #333;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.color-price-text {
    font-size: 0.9rem;
    color: #e74c3c;
    font-weight: 500;
    white-space: nowrap;
}

.color-stock-text {
    font-size: 0.9rem;
    color: #666;
    white-space: nowrap;
}

.quantity-controls-inline {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    width: 120px;
}

.quantity-btn-inline {
    width: 32px;
    height: 32px;
    border: none;
    background: #f5f5f5;
    color: #333;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-btn-inline:hover {
    background: #1E40AF;
    color: white;
}

.quantity-btn-inline:active {
    transform: scale(0.95);
}

.quantity-input-inline {
    width: 50px;
    height: 32px;
    border: none;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
    background: white;
    -moz-appearance: textfield;
}

.quantity-input-inline::-webkit-outer-spin-button,
.quantity-input-inline::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.quantity-input-inline:focus {
    outline: none;
    background: #f8f9fa;
}

/* 加入购物车按钮 */
.add-to-cart-section {
    margin: 0;
    padding: 1rem 1.5rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.add-to-cart-btn {
    width: 100%;
    max-width: 100%;
    padding: 0.875rem 2rem;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
    box-sizing: border-box;
}

.add-to-cart-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(231, 76, 60, 0.4);
}

.add-to-cart-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

/* 规格选择器样式 */
.product-variants {
    margin: 0;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.variant-group {
    margin-bottom: 1.5rem;
}

.variant-group:last-child {
    margin-bottom: 0;
}

.variant-label {
    margin-bottom: 0.75rem;
}

.variant-title {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #f0f0f0;
    border-radius: 4px;
}

.variant-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* 颜色选择器 */
.color-options {
    gap: 1rem;
}

.color-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    min-width: 80px;
}

.color-option:hover {
    border-color: #1E40AF;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(30, 64, 175, 0.2);
}

.color-option.selected {
    border-color: #1E40AF;
    background: #f0f4ff;
    box-shadow: 0 0 0 2px rgba(30, 64, 175, 0.2);
}

.color-thumbnail {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
}

.color-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.color-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: #999;
}

.color-name {
    font-size: 0.85rem;
    color: #666;
    text-align: center;
}

.color-option.selected .color-name {
    color: #1E40AF;
    font-weight: 600;
}

/* 尺码选择器 */
.size-options {
    gap: 0.75rem;
}

.size-option {
    padding: 0.75rem 1.25rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    min-width: 100px;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.size-option:hover {
    border-color: #1E40AF;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(30, 64, 175, 0.2);
}

.size-option.selected {
    border-color: #1E40AF;
    background: #f0f4ff;
    box-shadow: 0 0 0 2px rgba(30, 64, 175, 0.2);
}

.size-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.size-name {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.size-option.selected .size-name {
    color: #1E40AF;
}

.size-price {
    font-size: 0.9rem;
    color: #e74c3c;
    font-weight: 600;
}

.size-stock {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.25rem;
}

/* 数量选择器 */
.quantity-selector {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.quantity-label {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}

.quantity-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: #f5f5f5;
    color: #333;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-btn:hover {
    background: #1E40AF;
    color: white;
}

.quantity-btn:active {
    transform: scale(0.95);
}

.quantity-input {
    width: 60px;
    height: 36px;
    border: none;
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    background: white;
    -moz-appearance: textfield;
}

.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.quantity-input:focus {
    outline: none;
    background: #f8f9fa;
}

/* 标签页容器 */
.detail-tabs-container {
    grid-column: 1 / -1; /* 跨越所有列 */
    margin-top: 3rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow: visible; /* 改为visible，确保内容可见 */
    width: 100%;
    clear: both; /* 清除浮动 */
}

/* 标签页导航 */
.detail-tabs {
    display: flex;
    border-bottom: 2px solid #e9ecef;
    background: #f8f9fa;
    overflow-x: auto;
}

.tab-button {
    flex: 1;
    min-width: 120px;
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #666;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-button:hover {
    color: #1E40AF;
    background: rgba(30, 64, 175, 0.05);
}

.tab-button.active {
    color: #1E40AF;
    border-bottom-color: #1E40AF;
    background: white;
    font-weight: 600;
}

/* 标签页内容 */
.tab-content {
    display: none !important; /* 确保非激活状态隐藏 */
    padding: 2rem;
    min-height: 200px;
}

.tab-content.active {
    display: block !important; /* 确保激活状态显示 */
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 商品描述 */
.detail-description {
    margin: 0;
    padding: 0;
}

.detail-description h3 {
    display: none;
}

.description-content {
    color: #666;
    line-height: 1.8;
}

.description-content img {
    max-width: 100%;
    height: auto;
    margin: 1rem 0;
    border-radius: 8px;
}

/* 规格参数表格 */
.specifications-table {
    margin: 0;
    padding: 0;
}

.spec-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.spec-row {
    border-bottom: 1px solid #e9ecef;
    transition: background 0.2s ease;
}

.spec-row:hover {
    background: #f8f9fa;
}

.spec-row:last-child {
    border-bottom: none;
}

.spec-label-cell {
    width: 200px;
    padding: 1rem 1.5rem;
    font-weight: 600;
    color: #333;
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
    vertical-align: top;
}

.spec-value-cell {
    padding: 1rem 1.5rem;
    color: #666;
    line-height: 1.6;
    word-break: break-word;
}

/* 注意事项 */
.instructions-content,
.service-content {
    margin: 0;
    padding: 0;
}

.instructions-content h3,
.service-content h3 {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e9ecef;
}

.instructions-list,
.service-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.instruction-item,
.service-item {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #1E40AF;
}

.instruction-item strong,
.service-item strong {
    display: block;
    color: #333;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.instruction-item p,
.service-item p {
    color: #666;
    line-height: 1.6;
    margin: 0;
}

.no-specifications {
    text-align: center;
    padding: 3rem;
    color: #999;
}

.detail-specs {
    margin: 0;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.spec-item {
    display: flex;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.spec-item:last-child {
    border-bottom: none;
}

.spec-label {
    font-weight: 600;
    width: 120px;
    color: #555;
    font-size: 0.95rem;
}

.spec-value {
    color: #333;
    font-size: 0.95rem;
    font-weight: 500;
}

/* 分类导航栏 */
.category-nav-section {
    background: white;
    border-bottom: 1px solid #eee;
    padding: 1rem 0;
    position: sticky;
    top: 60px;
    z-index: 999;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

@media (max-width: 768px) {
    .category-nav-section {
        top: auto;
        position: relative;
    }
}

.category-nav-wrapper {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.5rem 0;
    scrollbar-width: thin;
    scrollbar-color: #1E40AF #f0f0f0;
}

.category-nav-wrapper::-webkit-scrollbar {
    height: 6px;
}

.category-nav-wrapper::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.category-nav-wrapper::-webkit-scrollbar-thumb {
    background: #1E40AF;
    border-radius: 3px;
}

.category-nav-wrapper::-webkit-scrollbar-thumb:hover {
    background: #1E3A8A;
}

.category-nav-item {
    flex-shrink: 0;
    padding: 0.5rem 1.2rem;
    background: #f8f9fa;
    color: #333;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: all 0.3s;
    border: 1px solid transparent;
}

.category-nav-item:hover {
    background: #1E40AF;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.3);
}

/* 分类页面 */
.categories-section {
    padding: 3rem 0;
}

.category-search {
    margin-bottom: 2rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.category-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.category-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 0.5rem;
}

.category-id {
    font-size: 0.9rem;
    color: #666;
}

/* 页脚 */
.footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

/* 加载和错误状态 */
.loading,
.error {
    text-align: center;
    padding: 2rem;
    font-size: 1.1rem;
}

.loading {
    color: #1E40AF;
}

.error {
    color: #e74c3c;
}

/* 加载更多指示器 */
.loading-more {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
}

.loading-more .loading {
    padding: 1rem;
    font-size: 1rem;
    color: #1E40AF;
}

/* 空状态样式 */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-message {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.empty-hint {
    font-size: 0.95rem;
    color: #999;
    margin-top: 0.5rem;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 200px 1fr;
        gap: 1.5rem;
    }

    .category-sidebar {
        width: 200px; /* 响应式宽度 */
        left: 10px; /* 调整左侧间距 */
        top: 80px; /* 保持与导航栏的距离 */
    }

    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.2rem;
    }

    .related-products-section .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.2rem;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 0.75rem 0;
    }

    .navbar .container {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.75rem;
    }

    .nav-brand {
        flex: 0 0 auto;
        order: 1;
    }

    .nav-brand a {
        font-size: 1.2rem;
    }
    
    /* 移动端：语言选择器放在GlobalBuy右侧 */
    .language-selector {
        order: 2; /* 紧跟在nav-brand后面 */
        margin-right: 0;
        margin-left: 0.5rem; /* 与GlobalBuy的间距 */
    }

    .nav-search {
        order: 4; /* 调整顺序，放在语言选择器后面 */
        width: 100%;
        max-width: 100%;
        margin: 0;
        flex: 1 1 100%;
    }

    .nav-menu {
        order: 3; /* 调整顺序 */
        flex: 0 0 auto; /* 改为不自动扩展，让联系客服按钮紧跟在后面 */
        gap: 0.5rem;
        justify-content: flex-start; /* 改为左对齐 */
        align-items: center;
    }

    /* 移动端隐藏文字链接，只显示分类按钮 */
    .nav-link {
        padding: 0.4rem 0.75rem;
        font-size: 0.9rem;
        display: none; /* 移动端隐藏文字链接 */
    }

    .nav-contact {
        order: 2; /* 改为和nav-menu同一顺序，这样会显示在同一行 */
        flex: 0 0 auto;
        margin-left: -0.75rem; /* 使用负边距抵消容器的gap，让按钮紧挨着 */
    }

    .hero h1 {
        font-size: 1.8rem;
    }

    .main-layout {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    /* 移动端分类栏样式优化 */
    .category-sidebar-header {
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .category-sidebar-list {
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }

    .category-sidebar.collapsed .category-sidebar-list {
        display: block;
    }

    .category-toggle-btn {
        display: block;
    }

    /* 移动端分类遮罩层 */
    .category-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1999;
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: auto;
    }

    .category-overlay.show {
        display: block;
        opacity: 1;
    }

    /* 移动端：遮罩层覆盖分类栏右侧区域 */
    @media (max-width: 768px) {
        .category-overlay {
            /* 遮罩层从分类栏右侧开始，覆盖剩余40%区域（分类栏现在是60%） */
            left: 60%;
            width: 40%;
            display: none;
        }

        .category-overlay.show {
            display: block;
        }

        /* 确保分类栏始终在遮罩层之上，且不受遮罩层影响 */
        .category-sidebar {
            z-index: 9999 !important; /* 最高层级，确保显示在最上层 */
            background: white !important;
        }

        .category-sidebar.mobile-open {
            z-index: 9999 !important; /* 确保打开时也在最上层 */
            background: white !important;
            box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        }
    }

    /* 只在移动端显示分类按钮 */
    @media (max-width: 768px) {
        .mobile-category-btn {
            display: flex !important;
            align-items: center;
            gap: 0.5rem;
            padding: 0.5rem 1rem;
            background: rgba(255, 255, 255, 0.15);
            border: 1px solid rgba(255, 255, 255, 0.3);
            border-radius: 20px;
            color: white;
            cursor: pointer;
            font-size: 0.9rem;
            transition: all 0.3s ease;
            white-space: nowrap;
        }

        .mobile-category-btn:hover {
            background: rgba(255, 255, 255, 0.25);
        }

        .mobile-category-btn svg {
            width: 18px;
            height: 18px;
        }
    }

    .products-main {
        order: 1;
        margin-left: 0;
        width: 100%;
        /* 移动端确保商品区域占满宽度，不被分类栏遮挡 */
        flex: 1;
    }

    .category-sidebar-list {
        max-height: 300px;
    }

    .featured-categories-section {
        margin-bottom: 1.5rem;
    }

    .featured-categories-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .section-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .product-card {
        border-radius: 8px;
    }

    .product-image-wrapper {
        height: 160px;
    }

    .product-info {
        padding: 0.75rem;
    }

    .product-title {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
        min-height: 2.2rem;
    }

    .product-price {
        font-size: 1.1rem;
    }

    .product-min-order {
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
    }

    .product-seller {
        font-size: 0.8rem;
    }

    .detail-container {
        grid-template-columns: 1fr;
    }
    
    .detail-images {
        max-width: 100%;
    }
    
    .main-image-wrapper {
        width: 100%;
        max-width: 500px;
        height: auto;
        aspect-ratio: 1 / 1;
        padding: 5px;
    }
    
    .main-image {
        width: 100%;
        height: 100%;
        max-width: 500px;
        max-height: 500px;
        aspect-ratio: 1 / 1;
    }
    
    .thumbnail-list {
        gap: 0.5rem;
        padding: 0.5rem 0;
    }
    
    .thumbnail-image {
        width: 60px;
        height: 60px;
    }
    
    .detail-tabs-container {
        margin-top: 2rem;
    }
    
    .detail-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .tab-button {
        min-width: 100px;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .tab-content {
        padding: 1.5rem;
    }
    
    .detail-description h3,
    .instructions-content h3,
    .service-content h3 {
        font-size: 1.3rem;
    }
    
    .spec-table {
        font-size: 0.9rem;
    }
    
    .spec-table {
        display: block;
    }
    
    .spec-table tbody {
        display: block;
    }
    
    .spec-row {
        display: block;
        border-bottom: 1px solid #e9ecef;
        padding: 0.75rem 0;
        margin-bottom: 0.5rem;
    }
    
    .spec-row:hover {
        background: transparent;
    }
    
    .spec-label-cell {
        display: block;
        width: 100%;
        padding: 0.5rem 0;
        font-size: 0.9rem;
        background: transparent;
        border-right: none;
        border-bottom: 1px solid #e9ecef;
        margin-bottom: 0.5rem;
    }
    
    .spec-value-cell {
        display: block;
        width: 100%;
        padding: 0.5rem 0;
        font-size: 0.9rem;
    }
    
    .instruction-item,
    .service-item {
        padding: 0.75rem;
    }
    
    .instruction-item strong,
    .service-item strong {
        font-size: 1rem;
    }
    
    .detail-info {
        gap: 0.75rem;
    }
    
    .detail-info h1 {
        font-size: 1.5rem;
        padding-bottom: 0.5rem;
        margin-bottom: 0.25rem;
    }
    
    .detail-price-section {
        flex-direction: column;
        padding: 1.25rem;
        gap: 1rem;
    }
    
    .price-section-label {
        min-width: auto;
        padding-top: 0;
    }
    
    .price-ranges-horizontal {
        width: 100%;
        flex-direction: column;
    }
    
    .price-card {
        width: 100%;
        min-width: auto;
    }
    
    .price-vnd {
        font-size: 1.2rem;
    }
    
    .color-selection-section {
        padding: 1rem;
    }
    
    .color-selection-table-header {
        grid-template-columns: 50px 1fr 100px 80px 120px;
        gap: 0.5rem;
        padding: 0.5rem;
        font-size: 0.85rem;
    }
    
    .color-selection-row {
        grid-template-columns: 50px 1fr 100px 80px 120px;
        gap: 0.5rem;
        padding: 0.5rem;
    }
    
    .color-selection-table-body {
        max-height: 300px;
    }
    
    .color-thumb-small {
        width: 40px;
        height: 40px;
    }
    
    .color-name-text,
    .color-price-text,
    .color-stock-text {
        font-size: 0.85rem;
    }
    
    .quantity-controls-inline {
        width: 100px;
    }
    
    .quantity-input-inline {
        width: 40px;
    }
    
    .quantity-btn-inline {
        width: 28px;
        height: 28px;
        font-size: 1rem;
    }
    
    .color-section-label {
        min-width: auto;
        padding-top: 0;
    }
    
    .color-selection-content {
        max-height: 300px; /* 移动端稍小的高度 */
    }
    
    .color-selection-item {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .color-name-text,
    .color-price-text,
    .color-stock-text {
        min-width: auto;
    }
    
    .quantity-controls-inline {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
    
    .add-to-cart-section {
        padding: 1.25rem;
    }
    
    .add-to-cart-btn {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    .product-basic-info {
        padding: 1.25rem;
    }
    
    .info-row {
        padding: 0.875rem 0;
    }
    
    .product-variants {
        padding: 1.25rem;
    }
    
    .detail-specs {
        padding: 1.25rem;
    }
    
    .detail-price {
        font-size: 1.5rem;
    }
    
    .price-range-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .price-range-price {
        font-size: 1.1rem;
    }
    
    .product-basic-info {
        margin: 1rem 0;
        padding: 0.75rem;
    }
    
    .info-row {
        flex-direction: column;
        align-items: flex-start;
        padding: 0.5rem 0;
    }
    
    .info-label {
        min-width: auto;
        margin-right: 0;
        margin-bottom: 0.25rem;
    }
    
    
    .related-products-section {
        padding: 2rem 0;
    }
    
    .related-products-title {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .related-products-section .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-input {
        width: 100%;
    }

    .category-nav-section {
        top: auto;
        position: relative;
    }

    .category-nav-wrapper {
        gap: 0.5rem;
    }

    .category-nav-item {
        padding: 0.4rem 1rem;
        font-size: 0.85rem;
    }
    
    /* 规格选择器移动端样式 */
    .product-variants {
        padding: 1rem;
    }
    
    .variant-group {
        margin-bottom: 1.25rem;
    }
    
    .color-option {
        min-width: 70px;
        padding: 0.4rem;
    }
    
    .color-thumbnail {
        width: 50px;
        height: 50px;
    }
    
    .color-name {
        font-size: 0.8rem;
    }
    
    .size-option {
        min-width: 90px;
        padding: 0.6rem 1rem;
    }
    
    .size-name {
        font-size: 0.9rem;
    }
    
    .size-price {
        font-size: 0.85rem;
    }
    
    .size-stock {
        font-size: 0.8rem;
    }
    
    .quantity-selector {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .quantity-controls {
        width: 100%;
        max-width: 200px;
    }
    
    .quantity-input {
        flex: 1;
        width: auto;
    }
}

/* WhatsApp联系按钮 */
.nav-contact {
    display: flex;
    align-items: center;
    margin-left: 1rem;
}

.whatsapp-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #25D366;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.whatsapp-btn:hover {
    background: #20BA5A;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(37, 211, 102, 0.3);
}

.whatsapp-btn svg {
    width: 20px;
    height: 20px;
}

.whatsapp-text {
    display: inline-block;
}

/* WhatsApp弹窗 */
.whatsapp-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.whatsapp-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.whatsapp-modal-content {
    background-color: white;
    margin: auto;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.whatsapp-modal-close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 2rem;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s;
}

.whatsapp-modal-close:hover {
    color: #333;
}

.whatsapp-modal-content h3 {
    margin: 0 0 1.5rem 0;
    color: #333;
    font-size: 1.5rem;
    text-align: center;
}

.whatsapp-options {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.whatsapp-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.whatsapp-link-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: #25D366;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    width: 100%;
    justify-content: center;
}

.whatsapp-link-btn:hover {
    background: #20BA5A;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

.whatsapp-link-btn svg {
    width: 24px;
    height: 24px;
}

.whatsapp-phone {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
    text-align: center;
}

.whatsapp-divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: #999;
    font-size: 0.9rem;
    margin: 0.5rem 0;
}

.whatsapp-divider::before,
.whatsapp-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #ddd;
}

.whatsapp-divider span {
    padding: 0 1rem;
}

.whatsapp-qr-label {
    margin: 0 0 1rem 0;
    color: #666;
    font-size: 0.9rem;
    text-align: center;
}

.whatsapp-qr-code {
    width: 200px;
    height: 200px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    overflow: hidden;
}

.whatsapp-qr-code img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.qr-placeholder {
    color: #999;
    font-size: 0.85rem;
    text-align: center;
    padding: 1rem;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .nav-contact {
        margin-left: -0.75rem; /* 使用负边距抵消容器的gap，让按钮紧挨着 */
    }
    
    .whatsapp-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .whatsapp-text {
        display: none;
    }
    
    .whatsapp-modal-content {
        padding: 1.5rem;
        width: 95%;
    }
    
    .whatsapp-qr-code {
        width: 180px;
        height: 180px;
    }
}

