* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 60px;
}

/* 顶部轮播图区域 */
.top-background {
    height: 180px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #ffd100 0%, #ffb800 100%); /* 备用背景 */
}

.carousel-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.carousel-slides {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 180px; /* 固定高度 */
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    z-index: 1;
}

.carousel-slide.active {
    opacity: 1;
}

.carousel-slide img {
    width: 100%;
    height: 180px; /* 固定高度 */
    object-fit: cover;
    object-position: center;
    display: block;
}

/* 轮播指示器 */
.carousel-indicators {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 3;
}

.indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background 0.3s ease;
}

.indicator.active {
    background: rgba(255, 255, 255, 0.9);
}



/* 语言切换器 */
.language-switcher {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 5;
}

.language-switcher select {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    color: #333;
    cursor: pointer;
    outline: none;
    backdrop-filter: blur(10px);
}

/* 头部商家信息卡片 */
.merchant-card {
    background: white;
    margin: 16px;
    padding: 20px;
    position: relative;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    z-index: 10;
    margin-top: -60px;
}

.merchant-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.merchant-info {
    flex: 1;
}

.merchant-title {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.merchant-logo {
    width: 32px;
    height: 32px;
    background: #ffd100;
    border-radius: 6px;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    color: #333;
    flex-shrink: 0;
}

.merchant-info h1 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
    line-height: 1.2;
}

.merchant-tags {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.tag {
    padding: 2px 6px;
    border-radius: 2px;
    font-size: 10px;
    font-weight: 500;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
}

.tag:first-child {
    background: #ffd100;
    color: #333;
}

.tag.delivery {
    background: #ff6b35;
    color: white;
}

.tag.time {
    background: #4CAF50;
    color: white;
}

.merchant-desc {
    font-size: 12px;
    color: #999;
    line-height: 1.4;
    margin: 0;
}

.language-switcher {
    position: absolute;
    top: 20px;
    right: 20px;
}

.language-switcher select {
    padding: 6px 12px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 20px;
    background: rgba(255,255,255,0.2);
    color: #333;
    font-size: 12px;
    outline: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.2s;
}

.language-switcher select:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
}

/* 主容器 */
.main-container {
    display: flex;
    background: white;
    margin: 0;
    height: calc(100vh - 240px);
    overflow: hidden;
}

/* 左侧分类菜单 */
.sidebar {
    width: 88px;
    background: #f7f7f7;
    border-right: 1px solid #e8e8e8;
    overflow-y: auto;
    flex-shrink: 0;
}

.categories {
    padding: 0;
}

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    background: #f7f7f7;
    position: relative;
}

.category-item:hover {
    background: #fff;
}

.category-item.active {
    background: #fff;
    color: #333;
    position: relative;
}

.category-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #ffd100;
}

.category-item img {
    display: none;
}

.category-item span {
    font-size: 13px;
    color: #666;
    line-height: 1.2;
    font-weight: 400;
}

.category-item.active span {
    color: #333;
    font-weight: 500;
}

/* 右侧商品区域 */
.main-content {
    flex: 1;
    padding: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: white;
}

.products-list {
    padding: 0;
}

.product-item {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    border-bottom: 1px solid #f5f5f5;
    background: white;
    position: relative;
}

.product-item:hover {
    background: #fafafa;
}

.product-image {
    width: 76px;
    height: 76px;
    border-radius: 4px;
    object-fit: cover;
    margin-right: 12px;
    flex-shrink: 0;
}

.product-info {
    flex: 1;
    min-width: 0;
    padding-right: 8px;
}

.product-name {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
    line-height: 1.3;
    word-break: break-word;
}

.product-desc {
    font-size: 12px;
    color: #999;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.product-sales {
    font-size: 12px;
    color: #999;
    margin-bottom: 12px;
}

.product-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.product-price {
    font-size: 18px;
    font-weight: 600;
    color: #ff6649;
    line-height: 1;
}

.product-price::before {
    content: '¥';
    font-size: 14px;
}

.add-btn {
    background: #ffd100;
    color: #333;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(255, 209, 0, 0.3);
}

.add-btn:hover {
    background: #ffcc00;
    transform: scale(1.05);
}

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

/* 产品内联数量控制器 */
.quantity-controls-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
}

.qty-btn-inline {
    background: #f5f5f5;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #666;
    transition: all 0.2s;
    font-weight: 600;
}

.qty-btn-inline:hover {
    background: #e8e8e8;
    transform: scale(1.1);
}

.qty-btn-inline.minus {
    color: #999;
}

.qty-btn-inline.plus {
    background: #ffd100;
    color: #333;
}

.qty-btn-inline.plus:hover {
    background: #ffcc00;
}

.qty-display-inline {
    font-weight: 600;
    color: #333;
    min-width: 24px;
    text-align: center;
    font-size: 14px;
    background: transparent;
    border: none;
    padding: 4px 6px;
}

.add-btn.has-quantity {
    background: rgba(255, 209, 0, 0.1);
    border: 1px solid #ffd100;
    padding: 4px 6px;
    width: auto;
    min-width: 80px;
}

/* 底部购物车栏 */
.bottom-cart {
    position: fixed;
    bottom: 16px;
    left: 16px;
    right: 16px;
    background: #2c2c2c;
    color: white;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
    height: 60px;
    border-radius: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.cart-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.cart-icon-container {
    position: relative;
    margin-right: 12px;
}

.cart-icon {
    width: 44px;
    height: 44px;
    background: #4a4a4a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cart-icon.has-items {
    background: #ffd100;
}

.cart-icon i {
    font-size: 20px;
    color: white;
}

.cart-icon.has-items i {
    color: #333;
}

.cart-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    min-width: 20px;
}

.cart-total {
    color: white;
    font-size: 16px;
    font-weight: 400;
}

.cart-total .price {
    color: white;
    font-weight: 600;
}

.checkout-btn {
    background: #ffd100;
    color: #333;
    border: none;
    padding: 12px 24px;
    border-radius: 22px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 88px;
    opacity: 0.5;
}

.checkout-btn:not(:disabled) {
    background: #ffd100;
    color: #333;
    opacity: 1;
}

.checkout-btn:hover:not(:disabled) {
    background: #ffcc00;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 209, 0, 0.3);
}

.checkout-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* 购物车弹出层 */
.cart-popup {
    position: fixed;
    bottom: 92px;
    left: 16px;
    right: 16px;
    background: white;
    max-height: 60vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1001;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    border-radius: 16px;
}

.cart-popup.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.cart-popup-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f5f5f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.cart-popup-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.clear-cart {
    color: #999;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.clear-cart:hover {
    background: #f5f5f5;
}

.cart-items {
    padding: 0;
    background: white;
}

.cart-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f8f8f8;
}

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

.cart-item-info {
    flex: 1;
    margin-right: 12px;
}

.cart-item-name {
    font-size: 15px;
    color: #333;
    margin-bottom: 6px;
    font-weight: 500;
    line-height: 1.3;
}

.cart-item-price {
    font-size: 14px;
    color: #ff6649;
    font-weight: 600;
}

.cart-item-price::before {
    content: '¥';
    font-size: 12px;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.qty-btn {
    background: #f5f5f5;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #666;
    transition: all 0.2s;
    font-weight: 600;
    position: relative;
    z-index: 10;
    user-select: none;
}

.qty-btn:hover {
    background: #e8e8e8;
    transform: scale(1.05);
}

.qty-btn.minus {
    color: #999;
}

.qty-btn.plus {
    background: #ffd100 !important;
    color: #333 !important;
    border: 1px solid #ffd100;
}

.qty-btn.plus:hover {
    background: #ffcc00 !important;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(255, 209, 0, 0.4);
}

.qty-display {
    font-weight: 600;
    color: #333;
    min-width: 24px;
    text-align: center;
    font-size: 16px;
}

/* 遮罩层 */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 空购物车样式 */
.empty-cart {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-cart i {
    font-size: 64px;
    margin-bottom: 20px;
    color: #ddd;
}

.empty-cart p {
    font-size: 16px;
    color: #999;
    margin: 0;
}

/* 移动端优化 */
@media (max-width: 480px) {
    .top-background {
        height: 140px;
    }
    
    .merchant-card {
        margin: 12px;
        padding: 16px;
        margin-top: -40px;
        border-radius: 12px;
    }
    
    .merchant-info h1 {
        font-size: 16px;
    }
    
    .main-container {
        margin: 0;
        height: calc(100vh - 200px);
    }
    
    .language-switcher {
        top: 15px;
        right: 15px;
    }
    
    .language-switcher select {
        padding: 4px 8px;
        font-size: 11px;
    }
    
    .sidebar {
        width: 80px;
    }
    
    .category-item {
        padding: 12px 6px;
    }
    
    .category-item span {
        font-size: 12px;
    }
    
    .product-item {
        padding: 12px;
    }
    
    .product-image {
        width: 68px;
        height: 68px;
    }
    
    .product-name {
        font-size: 15px;
    }
    
    .product-desc {
        font-size: 11px;
    }
    
    .product-price {
        font-size: 16px;
    }
    
    .add-btn {
        width: 26px;
        height: 26px;
        font-size: 16px;
    }
    
    .bottom-cart {
        bottom: 12px;
        left: 12px;
        right: 12px;
        height: 56px;
        border-radius: 28px;
        padding: 0 16px;
    }
    
    .cart-popup {
        bottom: 80px;
        left: 12px;
        right: 12px;
        border-radius: 12px;
    }
    
    .cart-icon {
        width: 40px;
        height: 40px;
    }
    
    .cart-icon i {
        font-size: 18px;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #ffd100;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
