/* H5移动端样式 */
* {
    margin: 0px;
    padding: 2px;
    box-sizing: border-box;
}

/* 全局链接样式 */
a {
    text-decoration: none;
    color: inherit;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    font-size: 14px;
    -webkit-text-size-adjust: none;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

.container {
    width: 100%;
    padding: 0 15px;
}

/* 头部样式 */
.header {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 2px 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    min-height: 42px; /* 进一步减小最小高度 */
}

/* 强制覆盖任何可能的内联样式 */
.header .container {
    min-height: auto !important;
    height: 100% !important;
}

.header .container {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 10px;
}

/* 头部搜索栏 */
.header .search {
    display: flex;
    align-items: center;
    margin: 0;
    width: 100%;
}

/* 搜索栏 */
.search {
    display: flex;
    align-items: center;
    margin: 0;
}

.search-input {
    flex: 1;
    height: 32px;
    padding: 0 15px;
    border: 2px solid #e4393c;
    outline: none;
    font-size: 14px;
    border-radius: 20px 0 0 20px;
}

.search-button {
    width: 60px;
    height: 32px;
    background-color: #e4393c;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 14px;
    border-radius: 0 20px 20px 0;
}

/* 轮播图 */
.slider {
    width: 100%;
    height: 200px;
    background-color: #f0f0f0;
    margin-top: 42px; /* 调整margin-top以匹配优化后的头部高度 */
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

/* 商品分类 */
.categories {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.category-item {
    text-align: center;
    padding: 10px 0;
}

.category-item img {
    width: 60px;
    height: 60px;
    margin-bottom: 5px;
    border-radius: 50%;
}

.category-name {
    font-size: 12px;
}

/* 商品列表 */
.product-section {
    margin-bottom: 30px;
}

.section-title {
    font-size: 18px;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e4393c;
    position: relative;
}

.product-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.product-item {
    background-color: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
}

.product-image {
    width: 100%;
    height: 150px;
    object-fit: contain;
}

.product-info {
    padding: 10px;
}

.product-name {
    font-size: 12px;
    font-weight: normal;
    line-height: 1.5;
    margin-bottom: 8px;
    height: auto;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    display: -moz-box;
    -webkit-box-orient: vertical;
    -moz-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    max-height: 3.6em;
    color: #333;
}

.product-price {
    font-size: 16px;
    color: #e4393c;
    font-weight: bold;
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #fff;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    z-index: 1000;
}

.nav-item {
    text-align: center;
    color: #666;
}



.nav-item.active {
    color: #e4393c;
}

.nav-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

.nav-text {
    font-size: 12px;
}

/* 适配不同屏幕 */
@media (max-width: 320px) {
    .product-image {
        height: 120px;
    }
}

@media (min-width: 414px) {
    .product-image {
        height: 180px;
    }
}

/* 相关商品样式 */
.related-products {
    margin-bottom: 30px;
    padding: 0 15px;
}

.related-products-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.related-products-list::-webkit-scrollbar {
    display: none;
}

.related-product-item {
    min-width: 80px;
    text-align: center;
}

.related-product-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 4px;
    margin: 0 auto 5px;
}

.related-product-name {
    font-size: 12px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}

.related-product-price {
    font-size: 14px;
    color: #e4393c;
    font-weight: bold;
}