:root {
    --primary-color: #1976d2;  /* 主色改为可靠蓝色 */
    --secondary-color: #f5f5f5;
    --accent-color: #e0e0e0;
    --text-color: #333333;
    --link-color: #1976d2;     /* 链接色与主色一致 */
    --page-width: 1200px;
    --base-font-size: 1.125rem;
    --spacing-unit: 1rem;      /* 新增间距基准单位 */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: var(--base-font-size);
    color: var(--text-color);
    line-height: 1.6;          /* 优化行高 */
    background-color: #fff;
    padding-bottom: 50px;      /* 为底部订单栏预留空间 */
}

h1, h2, h3 {
    font-weight: 700;
    line-height: 1.5;          /* 优化标题行高 */
    color: #222;
    margin-bottom: calc(var(--spacing-unit) * 0.75); /* 统一标题间距 */
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.17rem; }

.container {
    width: 100%;
    max-width: var(--page-width);
    margin: 0 auto;
    padding: 0 calc(var(--spacing-unit) * 1.5);
}

header {
    background-color: var(--primary-color);
    color: #fff;
    padding: calc(var(--spacing-unit) * 0.75) 0;
    box-shadow: 0 2px 5px rgba(0,0,0,.1);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-name {
    font-size: 1.8rem;
    font-weight: 700;
}
.site-name a {
    color: #fff;
    text-decoration: none;
}

.aboutus {
    background-color: #f8f9fa;
    padding: calc(var(--spacing-unit) * 1);
    margin-top: var(--spacing-unit);
    border-radius: 4px;
    border-left: 4px solid #cc0000;
    border-right: 4px solid #cc0000;
}
.aboutus h2 {
    margin: 0 0 calc(var(--spacing-unit) * 0.5) 0;
    font-size: 1.5rem;
    color: #2c3e50;
}
.aboutus p { 
    margin: 0;
    font-size: 1.125rem;
    color: #444;
}
.aboutus a {
    color: var(--primary-color);
    text-decoration: none;
}

.category-title {
    position: relative;
    background-color: #f8f9fa;
    padding: calc(var(--spacing-unit) * 1);
    margin-top: var(--spacing-unit);
    border-radius: 4px;
    border-left: 4px solid var(--primary-color);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: calc(var(--spacing-unit) * 1.5);
    margin: calc(var(--spacing-unit) * 2) 0;
}

.product-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0,0,0,.1);
    transition: transform .3s ease, box-shadow .3s ease;
}
.product-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,.2);
}

.product-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.product-image-container {
    position: relative;
    width: 100%;
    padding-top: 81.25%;
    overflow: hidden;
    background: #fff;
}
.product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-name {
    padding: var(--spacing-unit);
    text-align: center;
    font-weight: 500;
    color: var(--text-color);
    transition: color .3s ease;
}
.product-name:hover {
    color: var(--primary-color);
    cursor: pointer;
}

.add-to-cart-btn {
    display: inline-block;
    padding: 12px 24px;
    margin: 10px 10px 10px 0;
    width: 40%;
    background-color: var(--primary-color);
    color: #fff;
    font-weight: 700;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all .3s;
}
.add-to-cart-btn:hover {
    background-color: #1565c0;  /* 深蓝色悬停效果 */
}

.pagination {
    display: flex;
    justify-content: center;
    margin: calc(var(--spacing-unit) * 2) 0;
    flex-wrap: wrap;
}
.pagination a {
    display: inline-block;
    padding: calc(var(--spacing-unit) * 0.5) calc(var(--spacing-unit) * 1);
    margin: calc(var(--spacing-unit) * 0.25);
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: var(--primary-color);
    transition: all .3s ease;
}
.pagination a.active, 
.pagination a:hover {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

footer {
    background-color: var(--secondary-color);
    padding: var(--spacing-unit) 0;
}
.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: calc(var(--spacing-unit) * 0.5);
}
.footer-links a {
    color: var(--text-color);
    text-decoration: none;
    transition: color .3s ease;
}
.footer-links a:hover {
    color: var(--primary-color);
}
.copyright {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

.prod-top {
    margin-top: var(--spacing-unit);
}
.prod-top-image {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: cover;
    border-radius: 8px;
}
.product-content {
    margin-bottom: var(--spacing-unit);
}
.product-content p {
    line-height: 1.8;
    margin-bottom: calc(var(--spacing-unit) * 0.75);
    text-align: justify;
    overflow-wrap: break-word;
}
.product-content ol, 
.product-content ul {
    padding: 0 30px 0 40px;
}

.related-products {
    padding: var(--spacing-unit) 0;
    border-top: 1px solid var(--accent-color);
}
.related-products h2 {
    margin-bottom: calc(var(--spacing-unit) * 1.5);
    color: var(--primary-color);
}
.related-products-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--spacing-unit);
}
.related-product-item {
    background: var(--accent-color);
    padding: calc(var(--spacing-unit) * 0.8) var(--spacing-unit);
    border-radius: 4px;
    transition: all .3s ease;
}
.related-product-item a {
    display: block;
    text-decoration: none;
    color: var(--text-color);
}
.related-product-item:hover {
    background: var(--primary-color);
}
.related-product-item:hover a {
    color: #fff;
}

.order-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px;
    display: flex;
    background-color: #fff;
    box-shadow: 0 -2px 5px rgba(0,0,0,.1);
    z-index: 1000;
}
.order-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    transition: all .3s ease;
}
.home-btn {
    width: 20%;
    background-color: #333;
}
.home-btn:hover {
    background-color: #555;
}
.order-now-btn {
    width: 80%;
    background-color: var(--primary-color);
}
.order-now-btn:hover {
    background-color: #1565c0;
}

@media (max-width: 1200px) {
    .container {
        padding: 0 calc(var(--spacing-unit) * 2);
    }
}
@media (max-width: 992px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .site-name {
        font-size: 1.5rem;
    }
}
@media (max-width: 576px) {
    .product-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-unit);
    }
    :root {
        --base-font-size: 1.0125rem;
    }
    .container {
        padding: 0 var(--spacing-unit);
    }
}
