/* ========== 全局重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Roboto, sans-serif;
}
a {
    text-decoration: none;
    color: inherit;
}
ul,li {
    list-style: none;
}
img {
    max-width: 100%;
    display: block;
}
button {
    border: none;
    cursor: pointer;
    font-family: inherit;
}
input, select {
    font-family: inherit;
}

/* ========== 变量 ========== */
:root {
    --primary: #2c5f45;
    --primary-light: #3b7c5c;
    --dark: #222;
    --gray: #777;
    --light-gray: #f3f3f3;
    --white: #fff;
    --danger: #dc3545;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --transition: all 0.3s ease;
}

/* ========== 布局 ========== */
.container {
    width: 92%;
    max-width: 1280px;
    margin: 0 auto;
}
.header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 99;
}
.header-top {
    padding: 12px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap:20px;
}
.search-wrap {
    flex: 1;
    max-width: 500px;
    display: flex;
}
.search-wrap input {
    flex:1;
    border:1px solid #ddd;
    padding: 10px 14px;
    border-radius: 4px 0 0 4px;
    outline: none;
}
.search-wrap button {
    background: var(--primary);
    color:white;
    padding:0 16px;
    border-radius:0 4px 4px 0;
}
.header-actions {
    display:flex;
    gap:20px;
    align-items:center;
}
.header-actions > div {
    cursor:pointer;
    display:flex;
    align-items:center;
    gap:6px;
    color:var(--dark);
}
.nav {
    border-top:1px solid #eee;
}
.nav ul {
    display:flex;
    gap:32px;
    padding:14px 0;
}
.nav a:hover {
    color:var(--primary);
}

/* ========== 轮播图 ========== */
.banner {
    width:100%;
    height:420px;
    overflow:hidden;
    position:relative;
}
.banner-item {
    width:100%;
    height:100%;
    position:absolute;
    top:0;
    left:0;
    opacity:0;
    transition: var(--transition);
}
.banner-item.active {
    opacity:1;
}
.banner-item img {
    width:100%;
    height:100%;
    object-fit:cover;
}
.banner-dots {
    position:absolute;
    bottom:20px;
    left:50%;
    transform:translateX(-50%);
    display:flex;
    gap:8px;
}
.banner-dots span {
    width:10px;
    height:10px;
    border-radius:50%;
    background:rgba(255,255,255,0.5);
    cursor:pointer;
}
.banner-dots span.active {
    background:white;
}

/* ========== 产品卡片 ========== */
.product-card {
    background:white;
    border-radius:8px;
    overflow:hidden;
    box-shadow:var(--shadow);
    transition:var(--transition);
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow:0 4px 18px rgba(0,0,0,0.12);
}
.product-img {
    height:220px;
    overflow:hidden;
}
.product-img img {
    width:100%;
    height:100%;
    object-fit:cover;
}
.product-info {
    padding:16px;
}
.product-title {
    font-size:16px;
    margin-bottom:8px;
    color:var(--dark);
}
.product-price {
    font-size:18px;
    font-weight:bold;
    color:var(--primary);
    margin-bottom:12px;
}
.product-buttons {
    display:flex;
    gap:8px;
}
.product-buttons button {
    flex:1;
    padding:8px;
    border-radius:4px;
    font-size:14px;
}
.btn-cart {
    background:var(--primary);
    color:white;
}
.btn-fav {
    border:1px solid var(--primary);
    color:var(--primary);
    background:white;
}
.grid-4 {
    display:grid;
    grid-template-columns: repeat(4, 1fr);
    gap:24px;
}
.grid-3 {
    display:grid;
    grid-template-columns: repeat(3, 1fr);
    gap:24px;
}
.grid-2 {
    display:grid;
    grid-template-columns: repeat(2, 1fr);
    gap:24px;
}
.section {
    padding:60px 0;
}
.section-title {
    font-size:26px;
    margin-bottom:30px;
    color:var(--dark);
    display:flex;
    align-items:center;
    gap:10px;
}

/* ========== 评论模块 ========== */
.review-card {
    background:white;
    padding:20px;
    border-radius:8px;
    box-shadow:var(--shadow);
}
.review-name {
    font-weight:bold;
    margin-bottom:6px;
}
.review-star {
    color:#ffc107;
    margin-bottom:10px;
}

/* ========== 侧边弹窗：购物车 / 收藏 ========== */
.overlay {
    position:fixed;
    inset:0;
    background:rgba(0,0,0,0.5);
    z-index:1000;
    opacity:0;
    visibility:hidden;
    transition:var(--transition);
}
.overlay.show {
    opacity:1;
    visibility:visible;
}
.side-drawer {
    position:fixed;
    top:0;
    right:-420px;
    width:400px;
    height:100vh;
    background:white;
    z-index:1001;
    transition:var(--transition);
    display:flex;
    flex-direction:column;
}
.side-drawer.show {
    right:0;
}
.drawer-header {
    padding:20px;
    border-bottom:1px solid #eee;
    display:flex;
    justify-content:space-between;
    align-items:center;
}
.drawer-close {
    font-size:22px;
    cursor:pointer;
}
.drawer-body {
    flex:1;
    padding:20px;
    overflow-y:auto;
}
.drawer-item {
    display:flex;
    gap:12px;
    padding:12px 0;
    border-bottom:1px solid #eee;
}
.drawer-item-img {
    width:70px;
    height:70px;
    border-radius:4px;
}
.drawer-item-info {
    flex:1;
}
.drawer-item-remove {
    color:var(--danger);
    cursor:pointer;
}
.drawer-footer {
    padding:20px;
    border-top:1px solid #eee;
}

/* ========== 列表页筛选栏 ========== */
.filter-bar {
    background:white;
    padding:20px;
    border-radius:8px;
    box-shadow:var(--shadow);
    margin-bottom:30px;
    display:flex;
    align-items:center;
    gap:20px;
    flex-wrap:wrap;
}
.filter-group label {
    margin-right:8px;
}
.filter-group select, .filter-group input {
    padding:8px;
    border:1px solid #ddd;
    border-radius:4px;
}
.view-switch button {
    padding:6px 10px;
    border:1px solid #ddd;
    background:white;
}
.view-switch button.active {
    background:var(--primary);
    color:white;
    border-color:var(--primary);
}

/* ========== 分页 ========== */
.pagination {
    display:flex;
    gap:8px;
    justify-content:center;
    margin-top:40px;
}
.pagination button {
    width:36px;
    height:36px;
    border-radius:4px;
    border:1px solid #ddd;
    background:white;
}
.pagination button.active {
    background:var(--primary);
    color:white;
    border-color:var(--primary);
}

/* ========== 详情页 ========== */
.detail-wrap {
    display:grid;
    grid-template-columns: 1fr 1fr;
    gap:40px;
}
.detail-img {
    border-radius:8px;
    overflow:hidden;
}
.detail-price {
    font-size:28px;
    color:var(--primary);
    font-weight:bold;
    margin:16px 0;
}
.detail-desc {
    color:var(--gray);
    line-height:1.7;
    margin-bottom:20px;
}
.detail-actions {
    display:flex;
    gap:12px;
}
.detail-actions button {
    padding:12px 24px;
    border-radius:4px;
    font-size:16px;
}

/* ========== 页面通用内容容器（政策、关于、联系） ========== */
.page-content {
    background:white;
    padding:40px;
    border-radius:8px;
    box-shadow:var(--shadow);
    line-height:1.8;
    color:#333;
}
.page-content h2 {
    margin-bottom:20px;
    color:var(--dark);
}
.page-content p {
    margin-bottom:14px;
}

/* ========== 页脚 ========== */
.footer {
    background:#1f2937;
    color:#ccc;
    padding:50px 0 20px;
    margin-top:60px;
}
.footer-inner {
    display:grid;
    grid-template-columns: repeat(4, 1fr);
    gap:30px;
}
.footer h4 {
    color:white;
    margin-bottom:20px;
    font-size:18px;
}
.footer-links li {
    margin-bottom:10px;
}
.footer-links a:hover {
    color:var(--primary-light);
}
.footer-bottom {
    margin-top:40px;
    padding-top:20px;
    border-top:1px solid #374151;
    display:flex;
    justify-content:space-between;
    align-items:center;
}
.payment-img {
    height:36px;
}

/* ========== 历史浏览模块 ========== */
.history-item {
    display:flex;
    gap:12px;
    align-items:center;
    background:white;
    padding:10px;
    border-radius:6px;
    box-shadow:var(--shadow);
}
.history-item img {
    width:60px;
    height:60px;
    border-radius:4px;
}

/* ========== 响应式基础 ========== */
@media (max-width:992px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .footer-inner { grid-template-columns: repeat(2, 1fr); }
    .detail-wrap { grid-template-columns: 1fr; }
    .side-drawer { width:320px; }
}
@media (max-width:768px) {
    .grid-3,.grid-2 { grid-template-columns: 1fr; }
    .header-top { flex-wrap:wrap; }
    .nav ul { gap:16px; }
}
