/* ==============================================
   全局样式重置 & 基础通用样式
   ============================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background-color: #f8f9fa;
    color: #333;
    font-size: 14px;
    line-height: 1.5;
    padding-bottom: 20px;
    min-width: 320px; /* 仅新增：防止超小屏内容挤压，不影响居中核心 */
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

ul, li {
    list-style: none;
}

img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 容器：PC端限制最大宽度，避免内容过宽 */
.container {
    width: 94%;
    max-width: 1280px; /* PC端最大宽度，适配大屏 */
    margin: 0 auto;
}

/* 通用标题样式 */
.tit {
    font-size: clamp(1.25rem, 3vw, 1.8rem);
    font-weight: 700;
    color: #1a1a1a;
    text-align: center;
    margin: 25px 0 15px;
    position: relative;
    letter-spacing: 1px;
}

.tit::after {
    content: '';
    display: block;
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, #ff7a00, #ff4500);
    margin: 10px auto 0;
    border-radius: 3px;
    box-shadow: 0 2px 8px rgba(255, 122, 0, 0.3);
}

.tit-sm {
    font-size: clamp(1rem, 2vw, 1.25rem);
    font-weight: 600;
    color: #ff7a00;
    margin: 20px 0 10px;
    display: flex;
    align-items: center;
}

.tit-sm::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 16px;
    background: #ff7a00;
    margin-right: 8px;
    border-radius: 2px;
}

.more-btn {
    display: block;
    text-align: right;
    font-size: 12px;
    color: #ff7a00;
    margin: 5px 0 15px;
    transition: all 0.3s ease;
}

.more-btn:hover {
    color: #ff4500;
    transform: translateX(3px);
}

/* 通用按钮样式 */
.btn {
    display: inline-block;
    padding: 8px 20px;
    background: linear-gradient(90deg, #ff7a00, #ff4500);
    color: #fff;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(255, 122, 0, 0.4);
    background: linear-gradient(90deg, #ff6a00, #ff3500);
}

/* ==============================================
   导航栏样式（全终端适配）
   ============================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    z-index: 999;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.95);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    /* 仅新增：导航内容居中（和container统一规则） */
    width: 94%;
    max-width: 1280px;
    margin: 0 auto;
}

.nav-logo {
    width: clamp(100px, 15vw, 130px);
    transition: all 0.3s ease;
    flex-shrink: 0; /* 防止logo被挤压 */
}

.nav-logo:hover {
    transform: scale(1.03);
}

.nav-menu {
    display: flex;
    overflow-x: auto;
    padding-bottom: 5px;
    flex: 1;
    margin-left: 15px;
}

.nav-menu::-webkit-scrollbar {
    display: none;
}

.nav-item {
    padding: 6px 14px;
    font-size: clamp(0.8125rem, 1.5vw, 0.9rem);
    color: #555;
    white-space: nowrap;
    cursor: pointer;
    border-radius: 15px;
    transition: all 0.3s ease;
    margin-right: 5px;
}

.nav-item.active {
    color: #fff;
    font-weight: 600;
    background: linear-gradient(90deg, #ff7a00, #ff4500);
    box-shadow: 0 2px 8px rgba(255, 122, 0, 0.2);
}

.nav-item:hover:not(.active) {
    color: #ff7a00;
    background: #fff8f2;
}

/* ==============================================
   轮播Banner样式（自适应高度）
   ============================================== */
.banner {
    margin-top: 70px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    /* 仅新增/修改：Banner区块居中 */
    width: 94%;
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
}

.swiper {
    width: 100%;
    height: clamp(200px, 40vw, 400px); /* 高度随屏幕自适应 */
}

.swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.6);
    opacity: 1;
}

.swiper-pagination-bullet-active {
    background: #ff7a00;
    width: 20px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

/* ==============================================
   商品区域核心样式（重点优化PC端排版）
   ============================================== */
.product-section {
    background: #fff;
    padding: clamp(15px, 3vw, 20px) clamp(10px, 2vw, 15px);
    /* 仅修改：margin左右改为auto，实现区块居中 */
    margin: 20px auto;
    border-radius: 15px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.05);
    scroll-margin-top: 80px;
    border: 1px solid #f5f5f5;
    /* 仅新增：和container统一宽度规则 */
    width: 94%;
    max-width: 1280px;
}

/* 商品列表：PC端固定列数，移动端自适应 */
.product-list {
    display: grid;
    /* 核心优化：不同终端固定列数，避免PC端错乱 */
    grid-template-columns: repeat(2, 1fr); /* 移动端默认2列 */
    gap: clamp(10px, 2vw, 18px);
}

/* 商品卡片样式 */
.product-item {
    background: linear-gradient(180deg, #fff9f4, #fff);
    border: 1px solid #ffe8d8;
    border-radius: 12px;
    padding: clamp(10px, 2vw, 15px);
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    transition: all 0.4s ease;
    overflow: hidden;
    height: 100%; /* 保证同排卡片高度一致 */
}

.product-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #ff7a00, #ff4500);
    opacity: 0;
    transition: all 0.3s ease;
}

.product-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(255, 122, 0, 0.1);
    border-color: #ffccb0;
}

.product-item:hover::before {
    opacity: 1;
}

/* 商品图片 */
.product-img {
    width: clamp(80px, 25vw, 120px);
    height: clamp(80px, 25vw, 120px);
    margin: 0 auto 12px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    border: 2px solid #fff;
}

.product-item:hover .product-img {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(255, 122, 0, 0.15);
}

/* 商品名称 */
.product-name {
    font-size: clamp(0.875rem, 1.8vw, 1rem);
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 40px;
    flex-shrink: 0;
    line-height: 1.4;
}

/* 商品价格 */
.product-price {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.price-original {
    font-size: 11px;
    color: #999;
    text-decoration: line-through;
}

.price-current {
    font-size: clamp(0.9375rem, 2vw, 1.1rem);
    font-weight: 700;
    color: #ff4500;
    text-shadow: 0 1px 2px rgba(255, 69, 0, 0.1);
}

/* 商品按钮组 */
.product-btn-group {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: auto;
}

.detail-btn, .buy-btn {
    flex: 1;
    padding: 7px 0;
    font-size: 12px;
    border-radius: 15px;
    transition: all 0.3s ease;
    cursor: pointer;
    font-weight: 500;
}

.detail-btn {
    background: #fff;
    color: #ff7a00;
    border: 1px solid #ff7a00;
}

.detail-btn:hover {
    background: #fff8f2;
    box-shadow: 0 2px 8px rgba(255, 122, 0, 0.1);
}

.buy-btn {
    background: linear-gradient(90deg, #ff7a00, #ff4500);
    color: #fff;
    border: none;
}

.buy-btn:hover {
    background: linear-gradient(90deg, #ff6a00, #ff3500);
    box-shadow: 0 2px 8px rgba(255, 122, 0, 0.2);
}

/* ==============================================
   弹窗样式（详情+购买）
   ============================================== */
/* 通用弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: clamp(10px, 3vw, 20px);
    backdrop-filter: blur(5px);
}

.modal-content {
    width: 100%;
    max-width: clamp(300px, 90vw, 400px);
    background: #fff;
    border-radius: 15px;
    padding: clamp(20px, 4vw, 25px);
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    animation: modalShow 0.3s ease forwards;
}

@keyframes modalShow {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-close {
    text-align: right;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    border-radius: 50%;
    background: #f5f5f5;
    margin-left: auto;
}

.modal-close:hover {
    color: #ff4500;
    background: #ffe8d8;
}

/* 详情弹窗 */
.detail-img {
    width: clamp(120px, 40vw, 180px);
    height: clamp(120px, 40vw, 180px);
    margin: 0 auto 20px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border: 3px solid #fff;
}

.detail-name {
    font-size: clamp(1rem, 2.5vw, 1.1rem);
    font-weight: 700;
    text-align: center;
    margin-bottom: 15px;
    color: #333;
    letter-spacing: 0.5px;
}

.detail-price {
    text-align: center;
    font-size: clamp(1.1rem, 3vw, 1.2rem);
    color: #ff4500;
    margin-bottom: 20px;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(255, 69, 0, 0.1);
}

.detail-desc {
    font-size: 13px;
    color: #666;
    line-height: 1.7;
    margin-bottom: 25px;
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    border-left: 3px solid #ff7a00;
}

.modal-btn {
    display: block;
    width: 85%;
    margin: 0 auto;
    padding: 11px 0;
    text-align: center;
    font-weight: 600;
    letter-spacing: 1px;
}

/* 购买弹窗 */
.buy-modal .modal-content {
    max-height: unset;
    max-width: clamp(300px, 90vw, 620px);
}

.buy-form label {
    display: block;
    font-size: 13px;
    color: #555;
    margin-bottom: 8px;
    font-weight: 500;
}

.buy-form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.buy-form input:focus {
    outline: none;
    border-color: #ff7a00;
    box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.1);
}

.buy-confirm-btn {
    display: block;
    width: 100%;
    padding: 12px 0;
    background: linear-gradient(90deg, #ff7a00, #ff4500);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.3s ease;
    letter-spacing: 1px;
}

.buy-confirm-btn:hover {
    background: linear-gradient(90deg, #ff6a00, #ff3500);
    box-shadow: 0 4px 15px rgba(255, 122, 0, 0.2);
    transform: translateY(-2px);
}

/* ==============================================
   底部样式
   ============================================== */
.footer {
    background: linear-gradient(180deg, #1a1a1a, #0f0f0f);
    color: #fff;
    padding: clamp(20px, 4vw, 30px) 0 20px;
    /* 仅修改：margin左右改为auto，实现区块居中 */
    margin: 30px auto 0;
    border-radius: 20px 20px 0 0;
    /* 仅新增：和container统一宽度规则 */
    width: 94%;
    max-width: 1280px;
}

.footer-contact {
    text-align: center;
    margin-bottom: 20px;
}

.footer-title {
    font-size: clamp(1rem, 2vw, 1.1rem);
    margin-bottom: 15px;
    color: #ff7a00;
    font-weight: 600;
}

.footer-contact p {
    margin-bottom: 8px;
    color: #e0e0e0;
    font-size: clamp(0.8125rem, 1.5vw, 0.9rem);
    line-height: 1.6;
}

.footer-copyright {
    font-size: 12px;
    color: #999;
    text-align: center;
    padding-top: 15px;
    border-top: 1px solid #333;
    margin-top: 10px;
}

/* ==============================================
   媒体查询：精细化适配（重点优化PC端）
   ============================================== */
/* 超小屏手机 (<375px) */
@media (max-width: 375px) {
    .product-list {
        grid-template-columns: 1fr; /* 超小屏强制1列 */
    }
    .nav-menu {
        margin-left: 10px;
    }
    .nav-item {
        padding: 5px 10px;
    }
    .product-name {
        height: 36px;
    }
    .detail-btn, .buy-btn {
        font-size: 11px;
        padding: 6px 0;
    }
}

/* 平板端 (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .product-list {
        grid-template-columns: repeat(3, 1fr); /* 平板固定3列 */
    }
    .header {
        position: sticky; /* 平板粘性导航 */
    }
    .banner {
        margin-top: 20px;
    }
    .product-item {
        padding: 20px;
    }
}

/* PC端 (≥1024px) - 核心优化排版 */
@media (min-width: 1024px) {
    .product-list {
        grid-template-columns: repeat(4, 1fr); /* PC端固定4列，避免拥挤 */
        gap: 20px;
    }
    /* 若需要5列展示，可替换为：grid-template-columns: repeat(5, 1fr); */
    .header {
        position: sticky; /* PC粘性导航 */
    }
    .banner {
        margin-top: 20px;
    }
    .product-item {
        padding: 20px;
    }
    .product-item:hover {
        transform: translateY(-8px);
    }
    /* PC端底部横向布局 */
    .footer {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 40px 0 20px;
    }
    .footer-contact {
        text-align: left;
        margin-bottom: 0;
    }
    .footer-copyright {
        border-top: none;
        padding-top: 0;
        margin-top: 0;
    }
    /* PC端弹窗放大 */
    .modal-content {
        max-width: 500px;
    }
    .buy-modal .modal-content {
        max-width: 620px;
    }
}

/* 大屏PC (≥1200px) */
@media (min-width: 1200px) {
    .product-list {
        grid-template-columns: repeat(5, 1fr); /* 大屏PC固定5列，排版更美观 */
    }
}