a {
    text-decoration: none;
    color: inherit;
}

a:hover, a:visited, a:active, a:link {
    text-decoration: none;
    color: inherit;
}

/* 顶部导航栏样式 */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: #fff;
    display: flex;
    align-items: center;
    padding: 0 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    z-index: 1000;
    max-width: 640px;
    margin: 0 auto;
}

.header-left,
.header-right {
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-left a {
    color: #ef4444; /* 返回按钮颜色与主色调一致 */
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.header-center {
    flex: 1;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
}

/* 分类标签样式 */
.category-menu {
    margin-top: 50px; /* 与header高度一致 */
    position: sticky;
    top: 50px; /* 与header底部对齐 */
    z-index: 999; /* 确保在其他内容之上，但在header之下 */
    background: #fff;
    padding: 12px 0;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    max-width: 640px;
    margin: 0 auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border-bottom: 1px solid #f0f0f0;
}

.category-menu::-webkit-scrollbar {
    display: none;
}

.category-list {
    display: inline-flex;
    padding: 0 5px;
    align-items: center;
}

.category-item {
    padding: 8px 18px;
    margin-right: 12px;
    background: #f5f5f5;
    border-radius: 20px;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    cursor: pointer;
    user-select: none;
}

.category-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.category-item.active {
    background: #ef4444;
    color: #fff;
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

/* 商品列表样式 */
.product-list {
    padding: 10px 5px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 640px;
    margin: 0 auto;
    margin-top: 40px; /* 添加与category-menu的间距 */
    margin-bottom: 50px;
    box-sizing: border-box;
    position: relative;
    z-index: 1; /* 确保在category-menu下方 */
}

/* 商品卡片样式 */
.product-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: relative;
}

.product-image {
    position: relative;
    padding-top: 100%;
    background: #f8f8f8;
    overflow: hidden;
}

.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

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

.product-tag {
    position: absolute;
    top: 8px;
    left: 8px;
    background: linear-gradient(45deg, #ff6b6b, #ef4444);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
    z-index: 1;
}

.product-info {
    padding: 8px;
}

.product-name {
    font-size: 14px;
    color: #333;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.current-price {
    color: #ef4444;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: baseline;
}

.current-price::before {
    content: '¥';
    font-size: 14px;
    margin-right: 2px;
}

.original-price {
    color: #999;
    font-size: 12px;
    text-decoration: line-through;
    flex-shrink: 0;
}

.sales-count {
    color: #666;
    font-size: 12px;
    margin-top: 6px;
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

/* 底部导航栏样式 */
/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
    z-index: 100;
    max-width: 640px;
    margin: 0 auto;
}

.bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    width: 20%;
}

.bottom-nav .nav-item .nav-icon {
    font-size: 20px;
    color: #666;
    margin-bottom: 4px;
    display: block;
    text-align: center;
    width: 100%;
    max-width: 20px;
    max-height: 20px;
    margin: 0 auto 4px;
}

/* 确保所有SVG图标在非激活状态下颜色一致 */
.bottom-nav .nav-item svg path {
    fill: #666;
}

/* 为img类型的SVG图标设置颜色 */
.bottom-nav .nav-item .nav-icon {
    color: #666;
    filter: invert(42%) sepia(0%) saturate(0%) hue-rotate(143deg) brightness(95%) contrast(92%);
}

.bottom-nav .nav-item span {
    font-size: 12px;
    color: #666;
    text-align: center;
}

.bottom-nav .nav-item.active .nav-icon,
.bottom-nav .nav-item.active span {
    color: #ff4d4f;
}

.bottom-nav .nav-item.active .nav-icon {
    color: #ff4d4f;
    filter: invert(39%) sepia(79%) saturate(2449%) hue-rotate(328deg) brightness(100%) contrast(98%);
}

.bottom-nav .nav-item.active svg path {
    fill: #ff4d4f;
    /* 确保激活状态下SVG图标颜色覆盖默认颜色 */
    transition: fill 0.2s ease;
}

/* 返回顶部按钮样式 */
.back-to-top {
    position: fixed;
    bottom: 70px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s;
}

.back-to-top.visible {
    opacity: 1;
    font-size: 14px;
}