/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

:root {
    --primary-color: #00704A;
    --primary-dark: #005537;
    --primary-light: #008857;
    --secondary-color: #D4E9E2;
    --accent-color: #FFB500;
    --accent-hover: #FF9500;
    --text-color: #1E3A2F;
    --light-text: #64748B;
    --white: #FFFFFF;
    --gray-bg: #F8FAFC;
    --border-color: #E2E8F0;
    --border-radius: 16px;
    --border-radius-sm: 8px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 12px 36px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 112, 74, 0.03) 0%, transparent 70%);
    animation: rotate 30s linear infinite;
    z-index: -1;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 顶部导航栏 */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 20px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.back-btn {
    font-size: 22px;
    cursor: pointer;
    transition: var(--transition);
    opacity: 0.9;
}

.back-btn:hover {
    transform: translateX(-4px);
    opacity: 1;
}

h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cart-icon {
    position: relative;
    font-size: 22px;
    cursor: pointer;
    transition: var(--transition);
}

.cart-icon:hover {
    transform: scale(1.1);
}

.cart-count {
    position: absolute;
    top: -10px;
    right: -10px;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
    color: var(--white);
    font-size: 12px;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    padding: 0 6px;
    box-shadow: 0 2px 8px rgba(255, 181, 0, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* 搜索栏 */
.search-bar {
    background: var(--white);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border-color);
}

.search-bar i {
    color: var(--light-text);
    font-size: 18px;
}

.search-bar input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    color: var(--text-color);
    background: transparent;
}

.search-bar input::placeholder {
    color: var(--light-text);
}

/* 分类导航 */
.category-nav {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 16px 24px;
    overflow-x: auto;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 76px;
    z-index: 90;
}

.category-tabs {
    display: flex;
    gap: 12px;
}

.tab-btn {
    background: var(--gray-bg);
    border: 2px solid transparent;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    color: var(--light-text);
    border-radius: 25px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(0, 112, 74, 0.3);
}

.tab-btn:hover:not(.active) {
    background: var(--secondary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

/* 主内容区 */
.main-content {
    padding: 32px 24px 100px;
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-color);
    letter-spacing: -0.5px;
    position: relative;
    padding-left: 20px;
}

.section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 24px;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-light) 100%);
    border-radius: 2px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.product-card {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    border: 1px solid var(--border-color);
}

.product-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(0, 112, 74, 0.05) 100%);
    opacity: 0;
    transition: var(--transition);
    z-index: 1;
}

.product-card:hover::before {
    opacity: 1;
}

.product-image {
    height: 200px;
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
}

.product-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.3), transparent);
}

/* 产品图片背景 */
.coffee-bg {
    background-image: url('https://images.unsplash.com/photo-1507911674604-48b1e9cc1c21?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80');
}

.latte-bg {
    background-image: url('https://images.unsplash.com/photo-1534351590671-310e9e85bb41?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80');
}

.cappuccino-bg {
    background-image: url('https://images.unsplash.com/photo-1559566753-34625762505a?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80');
}

.mocha-bg {
    background-image: url('https://images.unsplash.com/photo-1578314675249-a6910f80cc4e?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80');
}

.caramel-bg {
    background-image: url('https://images.unsplash.com/photo-1611564494260-6f21b80af7ea?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80');
}

.seasonal-bg {
    background-image: url('https://images.unsplash.com/photo-1620360289473-8e2a1275e20b?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80');
}

.tea-bg {
    background-image: url('https://images.unsplash.com/photo-1556679343-c7306c1976bc?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80');
}

.milk-tea-bg {
    background-image: url('https://images.unsplash.com/photo-1558857563-b371033873b8?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80');
}

.sandwich-bg {
    background-image: url('https://images.unsplash.com/photo-1528735602780-2552fd46c7af?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80');
}

.cake-bg {
    background-image: url('https://images.unsplash.com/photo-1571115177098-24ec42ed204d?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80');
}

.combo-bg {
    background-image: url('https://images.unsplash.com/photo-1567620905732-2d1ec7ab7445?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80');
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--white);
    font-size: 24px;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.product-info {
    padding: 20px;
    position: relative;
    z-index: 2;
}

.product-info h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-color);
    letter-spacing: -0.3px;
}

.description {
    color: var(--light-text);
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.5;
}

.price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.price {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-color);
}

.original-price {
    font-size: 16px;
    color: var(--light-text);
    text-decoration: line-through;
    margin-right: 8px;
}

.combo-card {
    position: relative;
}

.combo-badge,
.new-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
    color: var(--white);
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(255, 181, 0, 0.4);
    z-index: 10;
}

.new-badge {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF5757 100%);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

.add-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: var(--white);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(0, 112, 74, 0.3);
    font-size: 18px;
}

.add-btn:hover {
    transform: scale(1.15) rotate(180deg);
    box-shadow: 0 6px 20px rgba(0, 112, 74, 0.4);
}

.add-btn:active {
    transform: scale(1.05) rotate(180deg);
}

/* 购物车底部栏 */
.cart-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 100;
    border-top: 1px solid var(--border-color);
}

.cart-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.total-items {
    font-size: 14px;
    color: var(--light-text);
}

.total-price {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

.checkout-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: var(--white);
    border: none;
    padding: 14px 32px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 16px rgba(0, 112, 74, 0.3);
    letter-spacing: 0.5px;
}

.checkout-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 112, 74, 0.4);
}

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

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 200;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
}

.modal-content {
    background: var(--white);
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-color);
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--light-text);
    cursor: pointer;
    transition: var(--transition);
    width: 36px;
    height: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
}

.close-btn:hover {
    background: var(--gray-bg);
    color: var(--text-color);
}

.modal-body {
    padding: 24px;
}

.modal-info {
    margin-top: 20px;
}

.size-options {
    margin: 24px 0;
}

.size-options h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-color);
}

.size-buttons {
    display: flex;
    gap: 12px;
}

.size-btn {
    flex: 1;
    background: var(--gray-bg);
    border: 2px solid transparent;
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition);
}

.size-btn.active {
    background: var(--secondary-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.size-btn:hover:not(.active) {
    background: var(--secondary-color);
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 24px;
    margin: 24px 0;
    justify-content: center;
}

.quantity-btn {
    background: var(--gray-bg);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-color);
}

.quantity-btn:hover {
    background: var(--secondary-color);
    transform: scale(1.1);
}

.quantity {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-color);
    min-width: 40px;
    text-align: center;
}

.modal-footer {
    padding: 24px;
    border-top: 1px solid var(--border-color);
}

.add-to-cart-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: var(--white);
    border: none;
    padding: 16px;
    border-radius: var(--border-radius-sm);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 16px rgba(0, 112, 74, 0.3);
}

.add-to-cart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 112, 74, 0.4);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 16px;
    }
    
    .main-content {
        padding: 20px 16px 100px;
    }
    
    .section-title {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: 1fr;
    }
    
    .product-image {
        height: 180px;
    }
    
    .header-content h1 {
        font-size: 20px;
    }
    
    .cart-bottom {
        padding: 12px 16px;
    }
    
    .checkout-btn {
        padding: 12px 24px;
        font-size: 14px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-section {
    display: none;
}

.category-section.active {
    display: block;
    animation: fadeIn 0.5s ease forwards;
}

.product-card {
    opacity: 0;
    animation: fadeIn 0.6s ease forwards;
}

.product-card:nth-child(1) { animation-delay: 0.1s; }
.product-card:nth-child(2) { animation-delay: 0.2s; }
.product-card:nth-child(3) { animation-delay: 0.3s; }
.product-card:nth-child(4) { animation-delay: 0.4s; }
.product-card:nth-child(5) { animation-delay: 0.5s; }
.product-card:nth-child(6) { animation-delay: 0.6s; }

/* 加载动画 */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}