/**
 * ZAPPE商城样式 - 严格按照官方设计
 */

/* CSS变量 */
:root {
    --temu-red: #E60023;
    --temu-orange: #FF6900;
    --temu-green: #008c2f;
    --text-primary: #222222;
    --text-secondary: #757575;
    --border-color: #E5E5E5;
    --bg-gray: #F5F5F5;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: #FFF;
}

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

/* 桌面版样式 */
@media (min-width: 769px) {
    /* 顶部红条 */
    .top-bar {
        background: var(--temu-red);
        color: white;
        padding: 8px 0;
        font-size: 13px;
    }
    
    .top-bar-content {
        max-width: 1200px;
        margin: 0 auto;
        display: flex;
        justify-content: space-between;
        padding: 0 20px;
    }
    
    .top-bar-left,
    .top-bar-right {
        display: flex;
        gap: 20px;
        align-items: center;
    }
    
    .top-bar a {
        color: white;
    }
    
    /* 主导航 */
    .main-nav {
        background: white;
        box-shadow: 0 2px 4px rgba(0,0,0,0.06);
        position: sticky;
        top: 0;
        z-index: 100;
    }
    
    .main-nav-content {
        max-width: 1200px;
        margin: 0 auto;
        display: flex;
        align-items: center;
        padding: 12px 20px;
        gap: 30px;
    }
    
    .logo {
        display: flex;
        align-items: center;
    }
    
    .logo img {
        height: 36px;
    }
    
    .search-box {
        flex: 1;
        max-width: 600px;
        position: relative;
    }
    
    .search-input {
        width: 100%;
        height: 40px;
        padding: 0 40px 0 15px;
        border: 2px solid var(--temu-red);
        border-radius: 20px;
        font-size: 14px;
    }
    
    .search-input:focus {
        outline: none;
    }
    
    .search-button {
        position: absolute;
        right: 5px;
        top: 50%;
        transform: translateY(-50%);
        background: none;
        border: none;
        color: var(--temu-red);
        cursor: pointer;
        padding: 8px;
    }
    
    .nav-cart {
        position: relative;
        font-size: 24px;
        color: var(--text-primary);
    }
    
    .cart-count {
        position: absolute;
        top: -8px;
        right: -8px;
        background: var(--temu-red);
        color: white;
        font-size: 11px;
        padding: 2px 6px;
        border-radius: 10px;
        font-weight: bold;
    }
    
    /* 分类导航 */
    .category-nav {
        background: white;
        border-bottom: 1px solid var(--border-color);
    }
    
    .category-nav-content {
        max-width: 1200px;
        margin: 0 auto;
        padding: 0 20px;
    }
    
    .category-list {
        display: flex;
        gap: 30px;
        list-style: none;
    }
    
    .category-item {
        padding: 15px 0;
        cursor: pointer;
        position: relative;
    }
    
    .category-item:hover,
    .category-item.active {
        color: var(--temu-red);
    }
    
    .category-item.active::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 2px;
        background: var(--temu-red);
    }
    
    /* 轮播区域 */
    .hero-carousel {
        max-width: 1200px;
        margin: 20px auto;
        padding: 0 20px;
    }
    
    .carousel-container {
        background: white;
        border-radius: 8px;
        padding: 20px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    }
    
    .carousel-items {
        display: flex;
        justify-content: space-around;
        gap: 20px;
    }
    
    .carousel-item {
        text-align: center;
        cursor: pointer;
    }
    
    .carousel-item img {
        width: 180px;
        height: 180px;
        object-fit: cover;
        border-radius: 8px;
    }
    
    .carousel-item-name {
        margin-top: 8px;
        font-size: 13px;
        color: var(--text-primary);
    }
    
    .carousel-item-price {
        margin-top: 4px;
        font-size: 16px;
        font-weight: bold;
        color: var(--text-primary);
    }
    
    /* ZAPPE 横幅样式（现在使用内联样式，仅保留基本结构） */
    .zappe-banner {
        margin: 20px auto;
        max-width: 1200px;
        padding: 0 20px;
    }
    
    /* 促销横幅 */
    .promo-banners {
        max-width: 1200px;
        margin: 20px auto;
        padding: 0 20px;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
    
    .promo-banner {
        border-radius: 8px;
        padding: 30px 20px;
        text-align: center;
        cursor: pointer;
        transition: transform 0.2s;
    }
    
    .promo-banner:hover {
        transform: translateY(-2px);
    }
    
    .promo-banner.orange {
        background: linear-gradient(135deg, #FFA500 0%, #FF6347 100%);
    }
    
    .promo-banner.pink {
        background: linear-gradient(135deg, #FFB6C1 0%, #FF69B4 100%);
    }
    
    .promo-banner.purple {
        background: linear-gradient(135deg, #DDA0DD 0%, #9370DB 100%);
    }
    
    .promo-banner h3 {
        color: white;
        font-size: 24px;
        margin-bottom: 8px;
    }
    
    .promo-banner p {
        color: white;
        font-size: 14px;
    }
    
    /* 实时热卖 */
    .hot-deals {
        max-width: 1200px;
        margin: 20px auto;
        padding: 0 20px;
    }
    
    .hot-deals-banner {
        background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
        border-radius: 8px;
        padding: 20px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    .hot-deals-text h3 {
        font-size: 28px;
        color: #333;
        margin-bottom: 5px;
    }
    
    .hot-deals-text p {
        font-size: 14px;
        color: #333;
    }
    
    .hot-deals-images {
        display: flex;
        gap: 10px;
    }
    
    .hot-deal-item {
        background: white;
        padding: 5px;
        border-radius: 6px;
    }
    
    .hot-deal-item img {
        width: 80px;
        height: 80px;
        object-fit: cover;
        border-radius: 4px;
    }
    
    /* 商品网格 */
    .products-section {
        max-width: 1200px;
        margin: 30px auto;
        padding: 0 20px;
    }
    
    .section-title {
        font-size: 20px;
        font-weight: bold;
        margin-bottom: 20px;
        text-align: center;
    }
    
    .products-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .product-card {
        background: white;
        border-radius: 8px;
        overflow: hidden;
        cursor: pointer;
        transition: box-shadow 0.2s;
        border: 1px solid #f0f0f0;
    }
    
    .product-card:hover {
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }
    
    .product-image {
        position: relative;
        padding-bottom: 100%;
    }
    
    .product-image img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .product-info {
        padding: 12px;
    }
    
    .product-name {
        font-size: 13px;
        color: var(--text-primary);
        line-height: 1.4;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        margin-bottom: 8px;
    }
    
    .product-price {
        font-size: 18px;
        font-weight: bold;
        color: var(--text-primary);
    }
    
    .product-price::before {
        content: '$';
        font-size: 14px;
    }
    
    .product-original-price {
        font-size: 13px;
        color: #999;
        text-decoration: line-through;
        margin-left: 8px;
    }
}

/* 移动版样式 */
@media (max-width: 768px) {
    /* 顶部应用推广条 */
    .app-promotion {
        background: white;
        padding: 10px 15px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
    
    .app-promotion-left {
        display: flex;
        align-items: center;
        gap: 10px;
    }
    
    .app-icon {
        width: 50px;
        height: 40px;
        background: var(--temu-orange);
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-weight: bold;
        font-size: 12px;
    }
    
    .app-text h4 {
        font-size: 14px;
        margin-bottom: 2px;
    }
    
    .app-text p {
        font-size: 12px;
        color: var(--text-secondary);
    }
    
    
    /* 移动端主导航 */
    .mobile-header {
        background: white;
        padding: 10px 15px;
        position: sticky;
        top: 0;
        z-index: 100;
    }
    
    .mobile-logo {
        font-size: 24px;
        font-weight: bold;
        color: var(--temu-orange);
        margin-bottom: 10px;
    }
    
    .mobile-search {
        position: relative;
    }
    
    .mobile-search input {
        width: 100%;
        height: 36px;
        padding: 0 35px 0 15px;
        background: var(--bg-gray);
        border: none;
        border-radius: 18px;
        font-size: 14px;
    }
    
    .mobile-search button {
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        background: none;
        border: none;
        color: var(--text-secondary);
    }
    
    /* 移动端分类 */
    .mobile-categories {
        background: white;
        padding: 10px 0;
        border-bottom: 1px solid var(--border-color);
    }
    
    .mobile-category-list {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0 15px;
        gap: 20px;
        list-style: none;
    }
    
    .mobile-category-list::-webkit-scrollbar {
        display: none;
    }
    
    .mobile-category-item {
        white-space: nowrap;
        padding: 5px 0;
        color: var(--text-secondary);
        font-size: 14px;
    }
    
    .mobile-category-item.active {
        color: var(--text-primary);
        font-weight: 500;
        position: relative;
    }
    
    .mobile-category-item.active::after {
        content: '';
        position: absolute;
        bottom: -2px;
        left: 0;
        right: 0;
        height: 2px;
        background: var(--temu-orange);
    }
    
    /* 移动端促销横幅 */
    .mobile-promo-banner {
        background: linear-gradient(135deg, #FF6900 0%, #FF8A00 100%);
        padding: 15px;
        margin: 10px 15px;
        border-radius: 8px;
        color: white;
    }
    
    .mobile-promo-title {
        font-size: 28px;
        font-weight: bold;
        margin-bottom: 5px;
    }
    
    .mobile-promo-subtitle {
        font-size: 16px;
        opacity: 0.9;
        margin-bottom: 10px;
    }
    
    .mobile-promo-products {
        display: flex;
        justify-content: space-between;
        gap: 0;
        padding: 0 5px;
        width: 100%;
    }
    
    .mobile-promo-product {
        background: white;
        padding: 6px;
        border-radius: 6px;
        text-align: center;
        flex: 1;
        margin: 0 1px;
        min-width: 0;
        box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    }
    
    .mobile-promo-product img {
        width: 100%;
        height: 65px;
        object-fit: cover;
        border-radius: 4px;
        max-width: 75px;
        margin: 0 auto;
        display: block;
    }
    
    .mobile-promo-price {
        color: var(--temu-orange);
        font-weight: bold;
        font-size: 11px;
        margin-top: 3px;
        line-height: 1.2;
    }
    
    /* 为什么选择Temu */
    .why-temu {
        background: var(--temu-green);
        color: white;
        padding: 12px 15px;
        margin: 10px 15px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    .why-temu-left {
        display: flex;
        align-items: center;
        gap: 10px;
    }
    
    .why-temu-icon {
        width: 24px;
        height: 24px;
        background: rgba(255,255,255,0.2);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .why-temu-text {
        font-size: 15px;
        font-weight: 500;
    }
    
    .why-temu-arrow {
        font-size: 12px;
    }
    
    /* 移动端商品网格 */
    .mobile-products {
        padding: 0 15px 80px;
    }
    
    .mobile-section-title {
        font-size: 18px;
        font-weight: bold;
        margin: 20px 0 15px;
    }
    
    .mobile-products-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .mobile-product-card {
        background: white;
        border-radius: 8px;
        overflow: hidden;
        border: 1px solid #f0f0f0;
    }
    
    .mobile-product-image {
        position: relative;
        padding-bottom: 100%;
    }
    
    .mobile-product-image img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .mobile-product-info {
        padding: 8px;
    }
    
    .mobile-product-name {
        font-size: 12px;
        color: var(--text-primary);
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        margin-bottom: 6px;
        min-height: 2.6em;
    }
    
    .mobile-product-price {
        font-size: 16px;
        font-weight: bold;
        color: var(--text-primary);
    }
    
    .mobile-product-price::before {
        content: '$';
        font-size: 12px;
    }
    
    .mobile-product-original {
        font-size: 12px;
        color: #999;
        text-decoration: line-through;
        margin-left: 5px;
    }
    
    /* 移动端底部导航 */
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid var(--border-color);
        padding: 8px 0 env(safe-area-inset-bottom);
        z-index: 1001; /* 提高z-index确保可点击 */
        box-shadow: 0 -2px 4px rgba(0,0,0,0.05);
    }
    
    .mobile-nav-items {
        display: flex;
        justify-content: space-around;
        align-items: center;
        list-style: none;
        margin: 0;
        padding: 0;
        height: 45px;
    }
    
    .mobile-nav-item {
        position: relative;
        flex: 1;
        text-align: center;
        padding: 5px;
        color: var(--text-secondary);
        cursor: pointer;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
    
    .mobile-nav-item.active {
        color: var(--temu-orange);
    }
    
    .mobile-nav-icon {
        font-size: 20px;
        margin-bottom: 2px;
    }
    
    .mobile-nav-text {
        font-size: 11px;
    }
    
    /* 移动端购物车数量 */
    .mobile-cart-count {
        position: absolute !important;
        top: 0 !important;
        right: calc(50% - 15px) !important;
    }
    
    /* 为底部导航留出空间（仅移动端） */
    body {
        padding-bottom: 60px;
        padding-top: 0; /* 移动端不需要顶部padding */
    }
    
    /* 隐藏桌面元素 */
    .desktop-only {
        display: none;
    }
}

/* 桌面端隐藏移动元素 */
@media (min-width: 769px) {
    .mobile-only {
        display: none;
    }
    
    /* 只固定第一个桌面导航元素 */
    .desktop-only:first-child {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: white;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    /* 确保页脚和其他元素不固定 */
    .desktop-only:not(:first-child) {
        position: static !important;
    }
    
    /* 桌面端购物车侧边栏 */
    .cart-sidebar {
        position: static !important;
        width: 350px !important;
        height: auto !important;
        background: white !important;
        border: 1px solid #E5E5E5 !important;
        border-radius: 8px !important;
        padding: 20px !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
    }
    
    /* 桌面端结算页侧边栏 */
    .checkout-sidebar {
        position: static !important;
        width: 350px !important;
        height: auto !important;
        background: white !important;
        border: 1px solid #E5E5E5 !important;
        border-radius: 8px !important;
        padding: 20px !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
    }
    
    /* 为固定导航添加占位空间 */
    body {
        padding-top: 160px; /* 顶部栏和导航栏的总高度 - 增加到160px，提供更多缓冲空间 */
        padding-bottom: 0; /* 桌面端不需要底部padding */
    }
    
    /* 桌面端购物车商品对齐 */
    .cart-item {
        display: flex;
        align-items: center;
        padding: 15px 0;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .item-image {
        width: 100px;
        height: 100px;
        flex-shrink: 0;
        margin-right: 15px;
    }
    
    .item-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 8px;
    }
    
    /* 桌面端猜你喜欢图片大小 */
    .product-grid .product-image img {
        width: 100%;
        height: 200px;
        object-fit: cover;
    }
}

/* 商品添加到购物车按钮 */
.add-to-cart {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.product-card:hover .add-to-cart,
.mobile-product-card:hover .add-to-cart {
    opacity: 1;
}

/* 移动端始终显示购物车按钮 */
@media (max-width: 768px) {
    .add-to-cart,
    .mobile-product-card .add-to-cart {
        opacity: 1;
    }
    
    /* 移动端购物车结算信息 */
    .cart-sidebar {
        position: fixed !important;
        bottom: 60px !important; /* 底部导航上方 */
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        width: 100% !important;
        height: auto !important;
        max-height: 40vh !important;
        background: white !important;
        border-top: 1px solid #E5E5E5 !important;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1) !important;
        z-index: 1000 !important;
        padding: 15px !important;
        overflow-y: auto !important;
    }
    
    /* 移动端结算页订单摘要 */
    .checkout-sidebar {
        position: fixed !important;
        bottom: 60px !important; /* 底部导航上方 */
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        width: 100% !important;
        height: auto !important;
        max-height: 40vh !important;
        background: white !important;
        border-top: 1px solid #E5E5E5 !important;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1) !important;
        z-index: 1000 !important;
        padding: 15px !important;
        overflow-y: auto !important;
    }
    
    /* 移动端购物车商品对齐 */
    .cart-item {
        display: flex !important;
        align-items: flex-start !important;
        padding: 15px 0 !important;
        border-bottom: 1px solid #f0f0f0 !important;
        gap: 10px !important;
    }
    
    .cart-item-checkbox {
        flex-shrink: 0 !important;
        margin-top: 5px !important;
    }
    
    .item-image {
        width: 80px !important;
        height: 80px !important;
        flex-shrink: 0 !important;
        border-radius: 8px !important;
        overflow: hidden !important;
    }
    
    .item-image img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }
    
    .item-details {
        flex: 1 !important;
        min-width: 0 !important;
    }
    
    .item-name {
        font-size: 14px !important;
        font-weight: 500 !important;
        color: #333 !important;
        margin-bottom: 8px !important;
        line-height: 1.4 !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
    }
    
    .item-price {
        font-size: 16px !important;
        font-weight: bold !important;
        color: #ff4444 !important;
        margin-bottom: 8px !important;
    }
    
    .item-controls {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        margin-top: 10px !important;
    }
    
    .quantity-controls {
        display: flex !important;
        align-items: center !important;
        border: 1px solid #ddd !important;
        border-radius: 4px !important;
        overflow: hidden !important;
    }
    
    .quantity-controls button {
        width: 30px !important;
        height: 30px !important;
        border: none !important;
        background: #f5f5f5 !important;
        color: #666 !important;
        font-size: 16px !important;
        cursor: pointer !important;
    }
    
    .quantity-controls input {
        width: 40px !important;
        height: 30px !important;
        border: none !important;
        text-align: center !important;
        font-size: 14px !important;
    }
    
    .remove-item {
        color: #999 !important;
        font-size: 12px !important;
        background: none !important;
        border: none !important;
        cursor: pointer !important;
    }
    
    /* 猜你喜欢图片大小 */
    .product-grid .product-image img {
        width: 100% !important;
        height: 150px !important;
        object-fit: cover !important;
    }
    
    /* 购物车主要内容区域调整 */
    .cart-main {
        margin-bottom: 250px !important; /* 为底部固定元素留出空间 */
    }
    
    /* 结算页主要内容区域调整 */
    .checkout-main {
        margin-bottom: 250px !important; /* 为底部固定元素留出空间 */
    }
}

/* 折扣标签 */
.discount-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--temu-red);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}
