* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    overflow-x: hidden;
}

/* 顶部导航栏 */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 18px;
    font-weight: bold;
    color: #ff6b6b;
}

.logo i {
    margin-right: 5px;
    font-size: 20px;
}

.search-box {
    flex: 1;
    max-width: 500px;
    margin: 0 15px;
    position: relative;
}

.search-box i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.search-box input {
    width: 100%;
    padding: 8px 10px 8px 35px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s;
}

.search-box input:focus {
    border-color: #ff6b6b;
    box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.1);
}

.nav-icons {
    display: flex;
    align-items: center;
}

.icon-item {
    position: relative;
    margin-left: 20px;
    font-size: 20px;
    color: #666;
    text-decoration: none;
    transition: color 0.3s;
}

.icon-item:hover {
    color: #ff6b6b;
}

.badge {
    position: absolute;
    top: -5px;
    right: -8px;
    background-color: #ff6b6b;
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}



/* 主内容区 */
.main-content {
    padding: 15px;
    margin-top: 70px;
    margin-bottom: 70px;
}



/* 通用区块标题 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-header h2 {
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.more {
    font-size: 14px;
    color: #999;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.more i {
    margin-left: 5px;
    font-size: 12px;
}

/* 商品展示区 */
.products-section {
    background-color: #fff;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.product-card {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.product-image {
    position: relative;
    padding-top: 100%;
    overflow: hidden;
}

.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-info {
    padding: 10px;
}

.product-name {
    font-size: 14px;
    color: #333;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 40px;
}

.product-price {
    font-size: 16px;
    font-weight: bold;
    color: #ff6b6b;
    margin-bottom: 5px;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #999;
    margin-bottom: 8px;
}

.add-to-cart {
    width: 100%;
    padding: 6px;
    background-color: #ff6b6b;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
    outline: none;
}

.add-to-cart:hover {
    background-color: #ff5252;
}

.add-to-cart:active {
    transform: scale(0.95);
}

/* 推荐商品区 */
.recommend-section {
    background-color: #fff;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.recommend-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.recommend-item {
    display: flex;
    gap: 15px;
    padding: 10px;
    border-radius: 8px;
    transition: background-color 0.3s;
}

.recommend-item:hover {
    background-color: #fafafa;
}

.recommend-item .product-image {
    flex: 0 0 100px;
    padding-top: 100px;
}

.recommend-item .product-info {
    flex: 1;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.recommend-item .product-name {
    height: auto;
    -webkit-line-clamp: 3;
    margin-bottom: 10px;
}

/* 加载状态 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #999;
    font-size: 14px;
}

.loading i {
    margin-right: 8px;
}

/* 下拉刷新 */
.pull-refresh {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
    color: #999;
    font-size: 14px;
    transform: translateY(-100%);
    transition: transform 0.3s;
    z-index: 950;
}

.pull-refresh.active {
    transform: translateY(0);
}

.pull-refresh i {
    margin-right: 8px;
}

/* 底部导航栏 */
.bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px 0;
    background-color: #fff;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #999;
    font-size: 12px;
    transition: all 0.3s;
}

.nav-item i {
    font-size: 20px;
    margin-bottom: 3px;
}

.nav-item:hover,
.nav-item.active {
    color: #ff6b6b;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .top-nav {
        padding: 8px 12px;
    }
    
    .logo {
        font-size: 16px;
    }
    
    .search-box {
        margin: 0 10px;
    }
    
    .search-box input {
        padding: 6px 8px 6px 30px;
        font-size: 13px;
    }
    
    .icon-item {
        margin-left: 12px;
        font-size: 18px;
    }
    
    .category-item {
        padding: 6px 12px;
        margin-right: 8px;
        font-size: 13px;
    }
    
    .main-content {
        padding: 12px;
    }
    
    .promotion-section,
    .products-section,
    .recommend-section {
        padding: 12px;
    }
    
    .promotion-item {
        flex: 0 0 120px;
    }
    
    .promotion-item img {
        height: 120px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 12px;
    }
    
    .recommend-item .product-image {
        flex: 0 0 80px;
        padding-top: 80px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card,
.recommend-item {
    animation: fadeIn 0.5s ease-out;
}

/* 图片懒加载 */
img[data-src] {
    opacity: 0;
    transition: opacity 0.3s;
}

img.loaded {
    opacity: 1;
}

/* 商品详情页 */
.product-detail {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #fff;
    z-index: 2000;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
    overflow-y: auto;
}

.product-detail.active {
    transform: translateY(0);
}

.detail-header {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 2010;
}

.close-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    padding: 5px;
    margin-right: 15px;
    outline: none;
    transition: all 0.3s;
}

.close-btn:hover {
    color: #ff6b6b;
    transform: rotate(90deg);
}

.detail-header h2 {
    flex: 1;
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin: 0;
}

.detail-content {
    padding: 15px;
}

/* 商品图片平铺 */
.detail-image-grid {
    display: grid;
    gap: 10px;
    margin-bottom: 15px;
}

.detail-image-grid img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 8px;
    background-color: #f0f0f0;
}

.detail-info {
    margin-bottom: 20px;
}

.detail-name {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    line-height: 1.4;
}

.detail-price {
    font-size: 24px;
    font-weight: bold;
    color: #ff6b6b;
    margin-bottom: 15px;
}

.detail-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #999;
}

.detail-description {
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.6;
    color: #666;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section h3 {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.detail-specs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    font-size: 14px;
}

.spec-item {
    display: flex;
    flex-direction: column;
    padding: 10px;
    background-color: #fafafa;
    border-radius: 8px;
}

.spec-label {
    color: #999;
    margin-bottom: 5px;
}

.spec-value {
    color: #333;
    font-weight: 500;
}

.detail-actions {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    background-color: #fff;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 10px;
    z-index: 2010;
}

.action-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.action-btn.primary {
    background-color: #ff6b6b;
    color: #fff;
}

.action-btn.primary:hover {
    background-color: #ff5252;
    transform: translateY(-2px);
}

.action-btn.secondary {
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
}

.action-btn.secondary:hover {
    background-color: #e0e0e0;
    transform: translateY(-2px);
}

/* 响应式调整 */
@media (max-width: 480px) {
    .detail-header {
        padding: 12px;
    }
    
    .detail-content {
        padding: 12px;
    }
    
    .detail-name {
        font-size: 16px;
    }
    
    .detail-price {
        font-size: 20px;
    }
    
    .detail-meta {
        gap: 15px;
        font-size: 13px;
    }
    
    .detail-specs {
        grid-template-columns: 1fr;
        font-size: 13px;
    }
    
    .detail-actions {
        padding: 12px;
        flex-direction: column;
    }
    
    .action-btn {
        font-size: 14px;
        padding: 10px;
    }
}