:root {
    --primary-color: #ff7a00;
    --text-main: #333333;
    --text-light: #666666;
    --bg-body: #f4f4f4;
    --border-color: #eeeeee;
    --white: #ffffff;
    --drawer-width: 280px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    font-size: 14px;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 顶部导航 */
.top-nav {
    background-color: var(--white);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1001;
}

.nav-menu {
    display: flex;
    gap: 30px;
    list-style: none;
    flex: 1;
    padding-left: 35px;
}

.nav-menu a {
    text-decoration: none;
    color: var(--text-main);
    font-size: 15px;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--primary-color);
}

.nav-right {
    display: flex;
    gap: 15px;
    align-items: center;
}

.btn-login,
.btn-register {
    background-color: var(--primary-color);
    color: white;
    padding: 6px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 13px;
    border: none;
    cursor: pointer;
}

.btn-register {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

/* 手机端菜单按钮 */
.menu-btn {
    display: none;
    font-size: 20px;
    color: var(--text-main);
    cursor: pointer;
    background: none;
    border: none;
    padding: 5px;
    z-index: 1001;
}

/* 手机端抽屉遮罩 */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.nav-overlay.active {
    display: block;
    opacity: 1;
}

/* 公告栏 */
.announcement-section {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 20px;
    margin-top: 20px;
    margin-bottom: 20px;
}

.announcement-title {
    font-weight: bold;
    font-size: 15px;
    margin-bottom: 12px;
    color: var(--text-main);
}

.announcement-content {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.8;
    text-align: justify;
}

/* 主体布局 */
.main-layout {
    display: flex;
    gap: 20px;
    margin-bottom: 40px;
}

/* 侧边栏分类 */
.sidebar {
    width: 240px;
    flex-shrink: 0;
    background-color: var(--white);
    border-radius: 4px;
    border: 1px solid var(--border-color);
    padding: 15px 0;
    align-self: flex-start;
    height: fit-content;
}

.sidebar-title {
    padding: 0 20px 10px;
    font-weight: bold;
    font-size: 15px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
}

.cat-list {
    list-style: none;
}

.cat-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-main);
    font-size: 14px;
}

.cat-item:hover {
    background-color: #f9f9f9;
    color: var(--primary-color);
}

.cat-item.active {
    background-color: #fff7f0;
    color: var(--primary-color);
    border-right: 3px solid var(--primary-color);
}

/* 商品列表 */
.content-area {
    flex: 1;
}

.category-section {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}

.category-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.product-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.product-card {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: border-color 0.2s;
}

.product-card:hover {
    border-color: var(--primary-color);
}

.product-img {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    background-color: #f0f0f0;
}

.product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-info {
    flex: 1;
}

.product-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 6px;
    text-decoration: none;
    display: block;
}

.product-title:hover {
    color: var(--primary-color);
}

.product-meta {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: var(--text-light);
}

.meta-item span {
    color: #2563eb;
}

.product-right {
    text-align: right;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.product-price {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    min-width: 60px;
}

.btn-buy {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.btn-buy a{
    color: white;
}
.btn-buy:hover {
    opacity: 0.9;
    color: white;
}

.btn-buy.out-of-stock {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* 热门产品推荐 */
.hot-products-section {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}

.section-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.hot-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
}

.hot-product-card {
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.hot-product-card:hover {
    transform: translateY(-5px);
}

.hot-product-img {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 4px;
    overflow: hidden;
    background-color: #f0f0f0;
    margin-bottom: 10px;
}

.hot-product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hot-product-name {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hot-product-meta {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.hot-product-price {
    font-size: 16px;
    font-weight: bold;
    color: var(--primary-color);
}

/* 热点资讯 - 3列展示 */
.news-section {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 40px;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0 40px;
}

.news-card {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
    cursor: pointer;
}

.news-card:hover {
    color: var(--primary-color);
}

.news-card:last-child {
    border-bottom: 1px solid var(--border-color);
}

.news-content {
    padding: 0;
    flex: 1;
    overflow: hidden;
}

.news-title {
    font-size: 13px;
    font-weight: 400;
    margin-bottom: 0;
    color: var(--text-main);
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.news-card:hover .news-title {
    color: var(--primary-color);
}

.news-date {
    font-size: 11px;
    color: #999;
    white-space: nowrap;
    margin-left: 10px;
}

/* 页脚 */
.footer {
    background-color: var(--white);
    border-top: 1px solid var(--border-color);
    padding: 40px 0 20px;
    margin-top: 40px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin-bottom: 30px;
}

.footer-col h4 {
    font-size: 15px;
    margin-bottom: 15px;
}

.footer-col ul {
    list-style: none;
}

.footer-col li {
    margin-bottom: 8px;
}

.footer-col a {
    text-decoration: none;
    color: var(--text-light);
    font-size: 13px;
}

.footer-col a:hover {
    color: var(--primary-color);
}

.copyright {
    text-align: center;
    font-size: 12px;
    color: #999;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* 响应式调整 */
@media (max-width: 992px) {
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: var(--drawer-width);
        height: 100%;
        background-color: var(--white);
        flex-direction: column;
        gap: 0;
        padding-top: 80px;
        transition: right 0.3s ease;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
        z-index: 1001;
    }

    .nav-menu.active {
        right: 0;
    }

    .nav-menu li {
        width: 100%;
    }

    .nav-menu a {
        display: block;
        padding: 15px 30px;
        border-bottom: 1px solid var(--border-color);
    }

    .menu-btn {
        display: block;
    }

    .nav-right {
        margin-right: 15px;
    }
    .nav-right a:hover{
        color: var(--primary-color);
        opacity: 0.9;
    }
    .main-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        display: flex;
        overflow-x: auto;
        padding: 10px;
    }

    .cat-list {
        display: flex;
    }

    .cat-item {
        white-space: nowrap;
        border-right: none;
    }

    .cat-item.active {
        border-right: none;
        border-bottom: 2px solid var(--primary-color);
    }

    .news-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .nav-right {
        display: none;
        /* 在极小屏幕下隐藏右侧按钮或移入抽屉 */
    }

    .product-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .product-right {
        width: 100%;
        justify-content: space-between;
        border-top: 1px dashed var(--border-color);
        padding-top: 10px;
    }

    .hot-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .news-grid {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }
}