/* ===== 全局公共样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, Helvetica, sans-serif;
}
:root {
    --primary: #195c42;
    --primary-light: #277c5a;
    --dark: #222;
    --gray: #777;
    --light-gray: #eee;
    --white: #fff;
    --danger: #dc3545;
}
body {
    color: var(--dark);
    background-color: #f8f9fa;
    line-height: 1.6;
}
a {
    text-decoration: none;
    color: inherit;
}
ul {
    list-style: none;
}
img {
    max-width: 100%;
    display: block;
}
.container {
    width: 92%;
    max-width: 1280px;
    margin: 0 auto;
}
.btn {
    display: inline-block;
    padding: 10px 18px;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.25s;
}
.btn-primary {
    background-color: var(--primary);
    color: white;
}
.btn-primary:hover {
    background-color: var(--primary-light);
}
.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}
.btn-outline:hover {
    background-color: var(--primary);
    color: white;
}
.btn-danger {
    background-color: var(--danger);
    color: white;
}

/* ===== Header ===== */
header {
    background-color: white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 99;
}
.header-top {
    padding: 10px 0;
    border-bottom: 1px solid var(--light-gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--gray);
}
.header-main {
    padding: 16px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}
.search-wrap {
    flex: 1;
    max-width: 520px;
    display: flex;
}
.search-wrap input {
    flex: 1;
    padding: 11px 14px;
    border: 1px solid #ddd;
    border-right: none;
    border-radius: 4px 0 0 4px;
    outline: none;
}
.search-wrap button {
    padding: 0 16px;
    border: none;
    background: var(--primary);
    color: white;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}
.header-icons {
    display: flex;
    gap: 22px;
    font-size: 20px;
}
.header-icons > div {
    cursor: pointer;
    position: relative;
}
.badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: grid;
    place-items: center;
}
nav {
    background-color: var(--primary);
}
.nav-list {
    display: flex;
}
.nav-list li a {
    display: block;
    padding: 12px 16px;
    color: white;
}
.nav-list li a:hover {
    background-color: var(--primary-light);
}

/* ===== 侧滑弹窗（购物车 / 收藏） ===== */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}
.drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}
.drawer {
    position: fixed;
    top:0;
    right:0;
    width: 420px;
    max-width: 90%;
    height: 100vh;
    background: white;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}
.drawer.active {
    transform: translateX(0);
}
.drawer-header {
    padding:18px;
    display:flex;
    justify-content: space-between;
    align-items:center;
    border-bottom:1px solid var(--light-gray);
}
.drawer-close {
    font-size:22px;
    cursor:pointer;
}
.drawer-body {
    flex:1;
    padding:18px;
    overflow-y:auto;
}
.drawer-item {
    display:flex;
    gap:12px;
    padding:12px 0;
    border-bottom:1px solid var(--light-gray);
}
.drawer-item img {
    width:70px;
    height:70px;
    object-fit:cover;
    border-radius:4px;
}
.drawer-item-info {
    flex:1;
}
.drawer-footer {
    padding:18px;
    border-top:1px solid var(--light-gray);
}

/* ===== 首页轮播 ===== */
.banner {
    height: 440px;
    overflow:hidden;
    position:relative;
}
.banner-slide {
    width:100%;
    height:100%;
    position:absolute;
    opacity:0;
    transition:opacity 0.7s;
    background-size:cover;
    background-position:center;
}
.banner-slide.active {
    opacity:1;
}
.banner-dots {
    position:absolute;
    bottom:20px;
    left:50%;
    transform:translateX(-50%);
    display:flex;
    gap:8px;
}
.banner-dots span {
    width:12px;
    height:12px;
    border-radius:50%;
    background:rgba(255,255,255,0.5);
    cursor:pointer;
}
.banner-dots span.active {
    background:white;
}

/* ===== 产品卡片 ===== */
.product-grid {
    display:grid;
    grid-template-columns: repeat(auto-fill, minmax(240px,1fr));
    gap:24px;
}
.product-card {
    background:white;
    border-radius:6px;
    overflow:hidden;
    box-shadow:0 2px 8px rgba(0,0,0,0.06);
    transition:transform 0.25s;
}
.product-card:hover {
    transform:translateY(-4px);
}
.product-img-box {
    height:220px;
    overflow:hidden;
    position:relative;
}
.product-img-box img {
    width:100%;
    height:100%;
    object-fit:cover;
}
.product-actions {
    position:absolute;
    bottom:-40px;
    left:0;
    width:100%;
    display:flex;
    justify-content:center;
    gap:8px;
    transition:bottom 0.25s;
}
.product-card:hover .product-actions {
    bottom:12px;
}
.product-actions button {
    width:36px;
    height:36px;
    border-radius:50%;
    border:none;
    background:white;
    display:grid;
    place-items:center;
    cursor:pointer;
}
.product-info {
    padding:14px;
}
.product-name {
    font-weight:500;
    margin-bottom:6px;
}
.product-price {
    color:var(--primary);
    font-weight:bold;
    font-size:18px;
}

/* ===== 区块通用 ===== */
.section {
    padding:60px 0;
}
.section-title {
    text-align:center;
    font-size:28px;
    margin-bottom:40px;
    color:var(--dark);
}

/* ===== 列表页筛选栏 ===== */
.filter-bar {
    background:white;
    padding:20px;
    border-radius:6px;
    margin-bottom:24px;
    display:flex;
    flex-wrap:wrap;
    gap:16px;
    align-items:center;
}
.view-switch span {
    cursor:pointer;
    font-size:20px;
    margin-right:8px;
}

/* ===== 分页 ===== */
.pagination {
    display:flex;
    justify-content:center;
    gap:8px;
    margin-top:40px;
}
.pagination button {
    padding:8px 14px;
    border:1px solid #ddd;
    background:white;
    cursor:pointer;
    border-radius:4px;
}
.pagination button.active {
    background:var(--primary);
    color:white;
    border-color:var(--primary);
}

/* ===== 产品详情页 ===== */
.product-detail-wrap {
    display:grid;
    grid-template-columns: 1fr 1fr;
    gap:40px;
}
.product-gallery img {
    width:100%;
    border-radius:6px;
}

/* ===== 历史浏览侧边小模块 ===== */
.history-view {
    background:white;
    padding:20px;
    border-radius:6px;
}
.history-item {
    display:flex;
    gap:10px;
    margin-bottom:10px;
}
.history-item img {
    width:60px;
    height:60px;
    object-fit:cover;
}

/* ===== 评论模块 ===== */
.review-item {
    background:white;
    padding:16px;
    border-radius:6px;
    margin-bottom:12px;
}

/* ===== Footer ===== */
footer {
    background-color:#111;
    color:#aaa;
    padding:60px 0 24px;
    margin-top:60px;
}
.footer-grid {
    display:grid;
    grid-template-columns: repeat(auto-fit, minmax(220px,1fr));
    gap:30px;
    margin-bottom:40px;
}
.footer-col h4 {
    color:white;
    margin-bottom:16px;
}
.footer-col li {
    margin-bottom:8px;
}
.footer-col a {
    color:#aaa;
}
.footer-bottom {
    border-top:1px solid #333;
    padding-top:20px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    flex-wrap:wrap;
    gap:16px;
}
.payment-img {
    height:32px;
}

/* ===== 响应式适配 ===== */
@media(max-width:768px){
    .header-main {
        flex-wrap:wrap;
    }
    .nav-list {
        flex-wrap:wrap;
    }
    .product-detail-wrap {
        grid-template-columns:1fr;
    }
    .banner {
        height:280px;
    }
}
