/* ========== 全局公共样式 common.css ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}
:root {
    --primary: #222831;
    --accent: #393E46;
    --orange: #F08A5D;
    --light: #f8f9fa;
    --gray: #6c757d;
    --border: #e5e7eb;
}
body {
    color: #333;
    background-color: #fff;
    line-height: 1.6;
}
ul {
    list-style: none;
}
a {
    text-decoration: none;
    color: inherit;
}
button {
    cursor: pointer;
    border: none;
    font-family: inherit;
}
img {
    max-width: 100%;
    display: block;
}
.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Top Bar */
.top-bar {
    background-color: var(--primary);
    color: #fff;
    padding: 0.6rem 0;
    font-size: 0.9rem;
}
.top-bar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.top-contact span {
    margin-right: 1.5rem;
}
.top-social a {
    margin-left: 0.8rem;
    font-size: 1.1rem;
}

/* Header Nav */
header {
    border-bottom: 1px solid var(--border);
    position: sticky;
    top:0;
    background:#fff;
    z-index:90;
}
.header-wrap {
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:1rem 0;
    gap:1rem;
}
.main-nav ul {
    display:flex;
    gap:2rem;
}
.main-nav a {
    font-weight:500;
    color:var(--primary);
    transition: color 0.2s;
}
.main-nav a:hover {
    color:var(--orange);
}
.nav-right {
    display:flex;
    align-items:center;
    gap:1rem;
}
.search-input {
    border:1px solid var(--border);
    padding:0.6rem 0.8rem;
    border-radius:4px;
    width:240px;
}
.icon-btn {
    font-size:1.3rem;
    background:transparent;
    padding:0.4rem;
    position:relative;
}
.badge {
    position:absolute;
    top:-4px;
    right:-4px;
    background:var(--orange);
    color:white;
    font-size:0.7rem;
    width:18px;
    height:18px;
    border-radius:50%;
    display:grid;
    place-items:center;
}
.btn-primary {
    background:var(--primary);
    color:white;
    padding:0.7rem 1.4rem;
    border-radius:4px;
    font-weight:500;
    transition:background 0.2s;
}
.btn-primary:hover {
    background:var(--accent);
}

/* 轮播 */
.carousel {
    position:relative;
    overflow:hidden;
}
.carousel-track {
    display:flex;
    transition:transform 0.5s ease;
}
.carousel-slide {
    min-width:100%;
    display:grid;
    grid-template-columns:1fr 1fr;
    align-items:center;
    gap:2rem;
    padding:3rem 0;
}
.carousel-img img {
    border-radius:8px;
}
.carousel-text h2 {
    font-size:2.4rem;
    margin-bottom:1rem;
}
.carousel-text p {
    color:var(--gray);
    margin-bottom:1.5rem;
}
.carousel-arrow {
    position:absolute;
    top:50%;
    transform:translateY(-50%);
    background:rgba(255,255,255,0.75);
    width:40px;
    height:40px;
    border-radius:50%;
    font-size:1.2rem;
    z-index:10;
}
.arrow-left { left:1rem; }
.arrow-right { right:1rem; }
.carousel-dots {
    position:absolute;
    bottom:1rem;
    left:50%;
    transform:translateX(-50%);
    display:flex;
    gap:0.5rem;
}
.dot {
    width:10px;
    height:10px;
    border-radius:50%;
    background:#ccc;
}
.dot.active { background:var(--primary); }

/* 区块通用 */
.section {
    padding:4rem 0;
}
.section-head {
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:2rem;
}
.section-title {
    font-size:1.8rem;
    position:relative;
}
.section-title::before {
    content:"";
    display:block;
    width:60px;
    height:2px;
    background:var(--primary);
    margin-bottom:0.6rem;
}
.view-more {
    color:var(--primary);
    font-weight:500;
}

/* 分类网格 */
.category-grid {
    display:grid;
    grid-template-columns:repeat(auto-fit, minmax(140px,1fr));
    gap:1.5rem;
}
.category-card {
    text-align:center;
    padding:1.2rem;
    border:1px solid var(--border);
    border-radius:8px;
    transition:0.2s;
    cursor:pointer;
}
.category-card:hover {
    box-shadow:0 4px 12px rgba(0,0,0,0.08);
}
.category-icon {
    font-size:2.4rem;
    color:var(--orange);
    margin-bottom:0.8rem;
}

/* 产品卡片 */
.product-grid {
    display:grid;
    grid-template-columns:repeat(auto-fill, minmax(220px, 1fr));
    gap:1.8rem;
}
.product-card {
    border:1px solid var(--border);
    border-radius:8px;
    overflow:hidden;
    transition:0.2s;
}
.product-card:hover {
    box-shadow:0 6px 16px rgba(0,0,0,0.1);
}
.product-img-box {
    position:relative;
    height:200px;
    overflow:hidden;
}
.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:0.5rem;
    background:rgba(255,255,255,0.9);
    padding:0.4rem;
    transition:bottom 0.25s;
}
.product-card:hover .product-actions {
    bottom:0;
}
.product-info {
    padding:1rem;
}
.product-name {
    font-weight:500;
    margin-bottom:0.4rem;
}
.product-price {
    color:var(--orange);
    font-weight:bold;
    font-size:1.1rem;
}

/* 评论区块 */
.review-grid {
    display:grid;
    grid-template-columns:repeat(auto-fit, minmax(280px,1fr));
    gap:1.5rem;
}
.review-card {
    border:1px solid var(--border);
    padding:1.5rem;
    border-radius:8px;
}
.review-stars {
    color:#ffc107;
    margin-bottom:0.6rem;
}

/* 列表页筛选栏 */
.filter-bar {
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:1rem;
    border:1px solid var(--border);
    border-radius:8px;
    margin-bottom:2rem;
    flex-wrap:wrap;
    gap:1rem;
}
.filter-group select {
    padding:0.5rem;
    border:1px solid var(--border);
    border-radius:4px;
}
.layout-switch button {
    padding:0.4rem 0.6rem;
    background:#eee;
    margin:0 0.2rem;
}
.layout-switch button.active {
    background:var(--primary);
    color:white;
}

/* 分页 */
.pagination {
    display:flex;
    gap:0.5rem;
    justify-content:center;
    margin-top:3rem;
}
.pagination button {
    width:36px;
    height:36px;
    border:1px solid var(--border);
    background:#fff;
    border-radius:4px;
}
.pagination button.active {
    background:var(--primary);
    color:white;
    border-color:var(--primary);
}

/* 详情页布局 */
.detail-wrap {
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:3rem;
}
.detail-img-main {
    border-radius:8px;
    overflow:hidden;
}
.detail-price {
    font-size:2rem;
    color:var(--orange);
    font-weight:bold;
    margin:1rem 0;
}
.detail-desc {
    margin:1.5rem 0;
    color:var(--gray);
}
.quantity-control {
    display:flex;
    align-items:center;
    margin:1.5rem 0;
}
.quantity-control button {
    width:36px;
    height:36px;
    border:1px solid var(--border);
    background:#f4f4f4;
}
.quantity-control input {
    width:50px;
    text-align:center;
    border:1px solid var(--border);
    height:36px;
}

/* 侧边弹窗（购物车/收藏） */
.overlay {
    position:fixed;
    inset:0;
    background:rgba(0,0,0,0.45);
    z-index:99;
    display:none;
}
.side-drawer {
    position:fixed;
    top:0;
    right:-420px;
    width:400px;
    height:100vh;
    background:#fff;
    z-index:100;
    transition:right 0.3s ease;
    display:flex;
    flex-direction:column;
}
.side-drawer.open {
    right:0;
}
.drawer-header {
    padding:1rem;
    display:flex;
    justify-content:space-between;
    align-items:center;
    border-bottom:1px solid var(--border);
}
.drawer-body {
    flex:1;
    overflow-y:auto;
    padding:1rem;
}
.drawer-footer {
    padding:1rem;
    border-top:1px solid var(--border);
}
.cart-item, .wish-item {
    display:flex;
    gap:1rem;
    padding:0.8rem 0;
    border-bottom:1px solid #eee;
}
.cart-item img, .wish-item img {
    width:70px;
    height:70px;
    object-fit:cover;
    border-radius:4px;
}

/* 历史浏览模块 */
.history-list {
    display:flex;
    gap:1rem;
    overflow-x:auto;
    padding:0.5rem 0;
}
.history-item {
    min-width:130px;
    border:1px solid var(--border);
    border-radius:6px;
    padding:0.6rem;
    cursor:pointer;
}
.history-item img {
    height:100px;
    object-fit:cover;
    width:100%;
}

/* Footer */
footer {
    background:var(--primary);
    color:#fff;
    padding:4rem 0 2rem;
    margin-top:4rem;
}
.footer-grid {
    display:grid;
    grid-template-columns:repeat(auto-fit, minmax(220px,1fr));
    gap:2rem;
    margin-bottom:3rem;
}
.footer-col h4 {
    margin-bottom:1.2rem;
    font-size:1.1rem;
}
.footer-col li {
    margin-bottom:0.6rem;
    color:#ccc;
}
.footer-bottom {
    border-top:1px solid #444;
    padding-top:1.5rem;
    display:flex;
    justify-content:space-between;
    align-items:center;
    flex-wrap:wrap;
    gap:1rem;
}
.payment-img {
    height:32px;
}

/* 条约页面内容 */
.page-content {
    padding:3rem 0;
}
.page-content h1 {
    margin-bottom:2rem;
}
.page-content p {
    margin-bottom:1rem;
    color:#444;
}

/* 响应式 */
@media(max-width:992px) {
    .carousel-slide { grid-template-columns:1fr; }
    .detail-wrap { grid-template-columns:1fr; }
    .side-drawer { width:100%; right:-100%; }
}
@media(max-width:768px) {
    .header-wrap { flex-wrap:wrap; }
    .main-nav ul { gap:1rem; }
    .search-input { width:160px; }
}
