/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #ddd;
}

header h1 {
    color: #333;
}

/* Logo样式 */
.logo-link {
    text-decoration: none;
    display: flex;
    align-items: center;
}

.site-logo {
    max-height: 50px;
    max-width: 200px;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.logo-link:hover .site-logo {
    transform: scale(1.05);
}

/* 右上角菜单样式 */
.top-nav {
    display: flex;
    gap: 8px;
    background-color: white;
    padding: 5px;
    border-radius: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.top-nav a {
    text-decoration: none;
    color: #555;
    font-weight: 600;
    padding: 5px 18px;
    border-radius: 20px;
    transition: all 0.3s ease;
    font-size: 14px;
    position: relative;
}

.top-nav a:hover {
    background-color: #f0f0f0;
    color: #333;
    transform: translateY(-2px);
}

.top-nav a.active {
    background: linear-gradient(135deg, #ff6b9d 0%, #ff8e9e 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 157, 0.4);
}

/* 分类导航样式 */
.category-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.category-nav a {
    text-decoration: none;
    color: #555;
    font-weight: 500;
    padding: 5px 18px;
    border-radius: 20px;
    transition: all 0.3s ease;
    font-size: 14px;
    background-color: #f8f9fa;
    border: 2px solid transparent;
}

.category-nav a:hover {
    background-color: #e9ecef;
    color: #333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.category-nav a.active {
    background: linear-gradient(135deg, #ff6b9d 0%, #ff8e9e 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(255, 107, 157, 0.4);
}

/* 搜索框样式 */
.search-bar {
    margin-bottom: 25px;
}

.search-form {
    display: flex;
    gap: 10px;
    max-width: 400px;
}

.search-form input[type="text"] {
    flex: 1;
    padding: 8px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    font-size: 14px;
    transition: all 0.3s ease;
    outline: none;
}

.search-form input[type="text"]:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-form button {
    padding: 8px 18px;
    background: linear-gradient(135deg, #ff6b9d 0%, #ff8e9e 100%);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 157, 0.3);
}

.search-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 157, 0.4);
}

.cart-icon {
    position: relative;
    cursor: pointer;
}

.cart-icon img {
    width: 24px;
    height: 24px;
}

#cart-count {
    position: absolute;
    top: -10px;
    right: -10px;
    background-color: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
}

/* 产品展示样式 */
.products {
    margin-bottom: 40px;
}

.products h2 {
    margin-bottom: 20px;
    color: #333;
}

.category-filter {
    margin-bottom: 20px;
    padding: 15px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.category-filter label {
    margin-right: 10px;
    font-weight: bold;
    color: #333;
}

.category-filter select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
}

/* 响应式产品网格 */
@media (max-width: 1200px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #666;
    background-color: #f9f9f9;
    border-radius: 8px;
}

.product-card {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 12px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.product-card.out-of-stock {
    opacity: 0.7;
}

.product-card.out-of-stock .add-to-cart {
    background: linear-gradient(135deg, #ccc 0%, #aaa 100%);
    cursor: not-allowed;
    color: #666;
}

.product-card .image-container {
    width: 100%;
    padding-bottom: 100%;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 12px;
    background-color: #f8f9fa;
    flex-shrink: 0;
}

.product-card .image-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-card h3 {
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    flex-shrink: 0;
}

.product-card .price {
    font-size: 16px;
    font-weight: bold;
    color: #ff4d4f;
    margin-bottom: 6px;
    flex-shrink: 0;
}

.product-card .stock {
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
    font-weight: normal;
    flex-shrink: 0;
}

.product-card .description {
    margin-bottom: 12px;
    color: #999;
    font-size: 12px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    flex-shrink: 0;
}

.quantity-control {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.quantity-control button {
    width: 24px;
    height: 24px;
    background-color: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
}

.quantity-control button:hover {
    background-color: #e8e8e8;
}

.quantity-control input {
    width: 40px;
    height: 24px;
    text-align: center;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin: 0 8px;
    font-size: 12px;
}

.add-to-cart {
    width: 100%;
    padding: 8px 12px;
    background: linear-gradient(135deg, #ff6b9d 0%, #ff8e9e 100%);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 107, 157, 0.3);
    flex-shrink: 0;
    margin-top: auto;
}

.add-to-cart:hover {
    background: linear-gradient(135deg, #ff8e9e 0%, #ff6b9d 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 157, 0.4);
}
}

/* 购物车样式 */
.cart {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 40px;
}

.cart h2 {
    margin-bottom: 20px;
    color: #333;
}

.cart-items {
    margin-bottom: 20px;
}

.empty-cart {
    text-align: center;
    color: #999;
    padding: 20px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-info {
    flex: 1;
}

.cart-item-info h4 {
    margin-bottom: 5px;
    color: #333;
}

.cart-item-info p {
    color: #666;
    font-size: 14px;
}

.stock-info {
    color: #999;
    font-size: 12px;
    margin-top: 5px;
}

.cart-item-quantity {
    margin: 0 20px;
}

.cart-item-price {
    font-weight: bold;
    color: #e74c3c;
}

.remove-item {
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 12px;
}

.remove-item:hover {
    background-color: #c0392b;
}

.cart-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.total {
    font-size: 18px;
    font-weight: bold;
}

#total-price {
    color: #e74c3c;
    margin-left: 10px;
}

.checkout {
    padding: 8px 18px;
    background: linear-gradient(135deg, #ff6b9d 0%, #ff8e9e 100%);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 107, 157, 0.3);
}

.checkout:hover {
    background: linear-gradient(135deg, #ff8e9e 0%, #ff6b9d 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 157, 0.4);
}

/* 订单表单样式 */
.order-form {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 40px;
    display: none;
}

.order-form h2 {
    margin-bottom: 20px;
    color: #333;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #333;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.submit-order {
    padding: 8px 18px;
    background: linear-gradient(135deg, #ff6b9d 0%, #ff8e9e 100%);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 107, 157, 0.3);
}

.submit-order:hover {
    background: linear-gradient(135deg, #ff8e9e 0%, #ff6b9d 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 157, 0.4);
}

/* 订单成功提示样式 */
.order-success {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 40px;
    text-align: center;
    margin-bottom: 40px;
    display: none;
}

.order-success h2 {
    margin-bottom: 20px;
    color: #27ae60;
}

.order-success p {
    margin-bottom: 30px;
    color: #666;
}

.back-to-products {
    padding: 8px 18px;
    background: linear-gradient(135deg, #ff6b9d 0%, #ff8e9e 100%);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 107, 157, 0.3);
}

.back-to-products:hover {
    background: linear-gradient(135deg, #ff8e9e 0%, #ff6b9d 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 157, 0.4);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    /* 头部响应式 */
    header {
        flex-direction: column;
        gap: 15px;
        padding-bottom: 15px;
    }

    header h1 {
        font-size: 20px;
    }

    /* 右上角菜单响应式 */
    .top-nav {
        gap: 5px;
        padding: 4px;
        border-radius: 20px;
    }

    .top-nav a {
        padding: 8px 14px;
        font-size: 13px;
        border-radius: 16px;
    }

    /* 分类导航响应式 */
    .category-nav {
        gap: 8px;
        padding: 12px;
        border-radius: 10px;
    }

    .category-nav a {
        padding: 8px 14px;
        font-size: 13px;
        border-radius: 16px;
    }

    /* 搜索框响应式 */
    .search-form {
        max-width: 100%;
    }

    .search-form input[type="text"] {
        padding: 8px 14px;
        font-size: 14px;
    }

    .search-form button {
        padding: 8px 18px;
        font-size: 13px;
    }

    /* 产品网格响应式 */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .product-card {
        padding: 15px;
    }

    .cart-summary {
        flex-direction: column;
        align-items: flex-start;
    }

    .checkout {
        margin-top: 15px;
        width: 100%;
    }
}

@media (max-width: 480px) {
    /* 超小屏幕优化 */
    .top-nav {
        gap: 3px;
    }

    .top-nav a {
        padding: 6px 10px;
        font-size: 12px;
    }

    .category-nav {
        gap: 6px;
        padding: 10px;
    }

    .category-nav a {
        padding: 6px 12px;
        font-size: 12px;
    }

    .search-form {
        flex-direction: column;
    }

    .search-form button {
        width: 100%;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}