* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", sans-serif;
}

body {
    background-color: #f5f5f5;
}

/* 顶部导航栏 */
.header {
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    padding: 0 20px;
}

.logo {
    width: 190px;
    height: 60px;
    margin-right: 20px;
}

.logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.search-container {
    flex: 1;
    display: flex;
    position: relative;
}

.search-input {
    width: 100%;
    height: 40px;
    padding: 0 15px;
    border: 2px solid #e4393c;
    border-radius: 4px 0 0 4px;
    outline: none;
    font-size: 14px;
}

.search-btn {
    width: 60px;
    height: 40px;
    background-color: #e4393c;
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover {
    background-color: #c91623;
}

.hot-search {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 0 0 4px 4px;
    padding: 10px;
    display: none;
    z-index: 100;
}

.search-container:focus-within .hot-search {
    display: block;
}

.hot-search-title {
    font-size: 12px;
    color: #999;
    margin-bottom: 5px;
}

.hot-search-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hot-search-item {
    font-size: 12px;
    color: #666;
    cursor: pointer;
}

.hot-search-item:hover {
    color: #e4393c;
}

/* 主体内容 */
.main-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
    display: flex;
}

.product-list {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-right: 20px;
}

.product-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.product-card:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
}

.product-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: #e4393c;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.product-image {
    width: 100%;
    height: 200px;
    padding: 0; /* 移除内边距 */
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #f5f5f5;
    overflow: hidden; /* 隐藏超出部分 */
}

.product-image img {
    width: 100%; /* 宽度100%填充容器 */
    height: 100%; /* 高度100%填充容器 */
    object-fit: cover; /* 保持比例填充整个容器，可能会裁剪部分图片 */
    /* 或者使用 object-fit: contain; 保持完整图片但可能有留白 */
}

.product-info {
    padding: 15px;
}

.product-title {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 40px;
}

.product-desc {
    font-size: 12px;
    color: #999;
    margin-bottom: 10px;
    line-height: 1.4;
    height: 34px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}

.product-tag {
    background-color: #f2f2f2;
    color: #e4393c;
    padding: 2px 6px;
    border-radius: 2px;
    font-size: 10px;
}

.product-price {
    margin-bottom: 10px;
}

.current-price {
    font-size: 18px;
    color: #e4393c;
    font-weight: bold;
}

.original-price {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
    margin-left: 5px;
}

.product-shop {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
}

.product-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.action-btn {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 3px;
    transition: all 0.3s ease;
}

.compare-btn {
    background-color: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
}

.follow-btn {
    background-color: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
}

.add-to-cart-btn {
    background-color: #e4393c;
    color: white;
    border: none;
}

.add-to-cart-btn.adding {
    pointer-events: none;
    opacity: 0.8;
}

/* 购物车样式 */
.cart-container {
    width: 300px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 15px;
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.cart-title {
    font-size: 16px;
    font-weight: bold;
}

.cart-count {
    background-color: #e4393c;
    color: white;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 12px;
}

.cart-items {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.cart-item {
    display: flex;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f5f5f5;
}

.cart-item-img {
    width: 60px;
    height: 60px;
    margin-right: 10px;
}

.cart-item-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.cart-item-info {
    flex: 1;
}

.cart-item-title {
    font-size: 13px;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cart-item-spec {
    font-size: 12px;
    color: #999;
    margin-bottom: 5px;
}

.cart-item-price {
    font-size: 14px;
    color: #e4393c;
    font-weight: bold;
}

.cart-total {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    font-weight: bold;
    text-align: right;
    font-size: 16px;
}

.cart-actions {
    margin-top: 15px;
    display: flex;
    justify-content: space-between;
}

.cart-btn {
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.view-cart {
    background-color: #fff;
    border: 1px solid #e4393c;
    color: #e4393c;
}

.view-cart:hover {
    background-color: #fef0f0;
}

.checkout {
    background-color: #e4393c;
    color: white;
    border: none;
}

.checkout:hover {
    background-color: #c91623;
}

.empty-cart {
    text-align: center;
    padding: 20px 0;
    color: #999;
}