/* ========================================
   横溪剑毫 - 主样式表
   ======================================== */

/* CSS变量 */
:root {
    --color-primary: #2D5016;
    --color-primary-dark: #1e3a0f;
    --color-secondary: #8B6914;
    --color-accent: #C0392B;
    --color-bg: #F5F0E8;
    --color-card: #FFFFFF;
    --color-text: #333333;
    --color-text-secondary: #666666;
    --color-text-muted: #999999;
    --color-border: #E0D5C1;
    --color-success: #27AE60;
    --color-warning: #E67E22;
    --color-info: #3498DB;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius: 8px;
    --radius-sm: 4px;
    --transition: all 0.3s ease;
    --header-height: 70px;
}

/* 重置 */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--color-primary-dark); }

img { max-width: 100%; height: auto; display: block; }

button { cursor: pointer; border: none; font-family: inherit; transition: var(--transition); }

input, textarea, select {
    font-family: inherit; font-size: 14px; outline: none;
    border: 1px solid var(--color-border); border-radius: var(--radius-sm);
    padding: 10px 14px; transition: var(--transition);
}
input:focus, textarea:focus, select:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(45,80,22,0.1); }

/* 容器 */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ========================================
   头部导航
   ======================================== */

.header {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--header-height); z-index: 1000;
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.header-inner {
    max-width: 1200px; margin: 0 auto; padding: 0 20px;
    display: flex; align-items: center; justify-content: space-between;
    height: 100%;
}

.logo {
    display: flex; align-items: center; gap: 12px;
    font-size: 22px; font-weight: 700; color: var(--color-primary);
}

.logo img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }

/* 导航菜单 */
.nav-menu { display: flex; list-style: none; gap: 32px; }
.nav-menu a {
    color: var(--color-text); font-size: 15px; font-weight: 500;
    position: relative; padding: 5px 0;
}
.nav-menu a::after {
    content: ''; position: absolute; bottom: 0; left: 0;
    width: 0; height: 2px; background: var(--color-primary);
    transition: var(--transition);
}
.nav-menu a:hover::after, .nav-menu a.active::after { width: 100%; }
.nav-menu a:hover, .nav-menu a.active { color: var(--color-primary); }

/* 头部右侧 */
.header-actions { display: flex; align-items: center; gap: 20px; }
.header-actions a {
    color: var(--color-text); font-size: 18px;
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    position: relative;
}
.header-actions a:hover { background: var(--color-bg); color: var(--color-primary); }

.cart-count {
    position: absolute; top: -2px; right: -2px;
    background: var(--color-accent); color: #fff;
    font-size: 10px; font-weight: 600;
    width: 16px; height: 16px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}

/* 移动端菜单按钮 */
.menu-toggle {
    display: none; background: none; font-size: 24px; color: var(--color-text);
    width: 40px; height: 40px; align-items: center; justify-content: center;
}

/* ========================================
   轮播图
   ======================================== */

.hero-slider {
    position: relative; width: 100%; height: 600px;
    overflow: hidden; margin-top: var(--header-height);
}

.hero-slide {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0; transition: opacity 1s ease;
    display: flex; align-items: center;
}
.hero-slide.active { opacity: 1; }

.hero-slide .bg-image {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover; background-position: center;
    transition: transform 6s ease;
}
.hero-slide.active .bg-image { transform: scale(1.05); }

.hero-slide .overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to right, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.2) 60%, transparent 100%);
}

.hero-content {
    position: relative; z-index: 2; max-width: 1200px;
    margin: 0 auto; padding: 0 20px; width: 100%;
}

.hero-content h2 {
    font-size: 42px; font-weight: 700; color: #fff;
    line-height: 1.3; margin-bottom: 16px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
    opacity: 0; transform: translateY(30px);
    transition: all 0.8s ease 0.3s;
}
.hero-slide.active .hero-content h2 { opacity: 1; transform: translateY(0); }

.hero-content p {
    font-size: 18px; color: rgba(255,255,255,0.9);
    max-width: 520px; line-height: 1.7; margin-bottom: 32px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
    opacity: 0; transform: translateY(30px);
    transition: all 0.8s ease 0.5s;
}
.hero-slide.active .hero-content p { opacity: 1; transform: translateY(0); }

.hero-btn {
    display: inline-block; padding: 14px 40px;
    background: var(--color-primary); color: #fff;
    border-radius: var(--radius-sm); font-size: 16px; font-weight: 500;
    opacity: 0; transform: translateY(30px);
    transition: all 0.8s ease 0.7s;
}
.hero-slide.active .hero-btn { opacity: 1; transform: translateY(0); }
.hero-btn:hover { background: var(--color-primary-dark); color: #fff; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(45,80,22,0.3); }

/* 轮播指示器 */
.hero-dots {
    position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 10px; z-index: 3;
}
.hero-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: rgba(255,255,255,0.5); cursor: pointer;
    transition: var(--transition);
}
.hero-dot.active { background: #fff; width: 28px; border-radius: 5px; }

/* ========================================
   区块标题
   ======================================== */

.section-header {
    text-align: center; margin-bottom: 48px;
}
.section-header h2 {
    font-size: 28px; font-weight: 700; color: var(--color-text);
    margin-bottom: 12px;
}
.section-header .subtitle {
    font-size: 14px; color: var(--color-text-muted);
    position: relative; display: inline-block;
}
.section-header .subtitle::before,
.section-header .subtitle::after {
    content: ''; position: absolute; top: 50%;
    width: 40px; height: 1px; background: var(--color-border);
}
.section-header .subtitle::before { right: 100%; margin-right: 16px; }
.section-header .subtitle::after { left: 100%; margin-left: 16px; }

/* ========================================
   产品卡片
   ======================================== */

.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.product-card {
    background: var(--color-card); border-radius: var(--radius);
    overflow: hidden; box-shadow: var(--shadow);
    transition: var(--transition);
}
.product-card:hover {
    transform: translateY(-4px); box-shadow: var(--shadow-lg);
}

.product-card .product-img {
    position: relative; overflow: hidden; padding-top: 100%;
}
.product-card .product-img img {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover; transition: transform 0.4s ease;
}
.product-card:hover .product-img img { transform: scale(1.05); }

.product-card .product-tags {
    position: absolute; top: 10px; left: 10px; display: flex; gap: 6px;
}
.tag {
    padding: 3px 10px; border-radius: 20px; font-size: 11px;
    font-weight: 500; color: #fff;
}
.tag-new { background: var(--color-success); }
.tag-hot { background: var(--color-accent); }
.tag-recommend { background: var(--color-secondary); }

.product-card .product-info { padding: 16px; }
.product-card .product-name {
    font-size: 15px; font-weight: 600; color: var(--color-text);
    margin-bottom: 6px; overflow: hidden;
    white-space: nowrap; text-overflow: ellipsis;
}
.product-card .product-origin {
    font-size: 12px; color: var(--color-text-muted); margin-bottom: 10px;
}
.product-card .product-price {
    display: flex; align-items: baseline; gap: 8px;
}
.product-card .price {
    font-size: 18px; font-weight: 700; color: var(--color-accent);
}
.product-card .original-price {
    font-size: 13px; color: var(--color-text-muted);
    text-decoration: line-through;
}
.product-card .sales {
    margin-left: auto; font-size: 12px; color: var(--color-text-muted);
}

/* ========================================
   分类卡片
   ======================================== */

.category-grid {
    display: grid; grid-template-columns: repeat(6, 1fr); gap: 20px;
}
.category-card {
    background: var(--color-card); border-radius: var(--radius);
    overflow: hidden; box-shadow: var(--shadow);
    text-align: center; padding: 24px 16px;
    transition: var(--transition);
}
.category-card:hover {
    transform: translateY(-4px); box-shadow: var(--shadow-lg);
}
.category-card img {
    width: 64px; height: 64px; border-radius: 50%;
    object-fit: cover; margin: 0 auto 12px;
}
.category-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.category-card p { font-size: 12px; color: var(--color-text-muted); }

/* ========================================
   优势展示
   ======================================== */

.advantage-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px;
}
.advantage-card {
    background: var(--color-card); border-radius: var(--radius);
    padding: 32px 24px; text-align: center; box-shadow: var(--shadow);
    transition: var(--transition);
}
.advantage-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.advantage-card .icon {
    width: 64px; height: 64px; border-radius: 50%;
    background: rgba(45,80,22,0.08); color: var(--color-primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; margin: 0 auto 20px;
}
.advantage-card h3 { font-size: 17px; font-weight: 600; margin-bottom: 10px; }
.advantage-card p { font-size: 13px; color: var(--color-text-secondary); line-height: 1.7; }

/* ========================================
   新闻列表
   ======================================== */

.news-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.news-card {
    background: var(--color-card); border-radius: var(--radius);
    overflow: hidden; box-shadow: var(--shadow); transition: var(--transition);
}
.news-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.news-card img { width: 100%; height: 180px; object-fit: cover; }
.news-card .news-info { padding: 16px; }
.news-card h3 {
    font-size: 15px; font-weight: 600; margin-bottom: 8px;
    overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; line-height: 1.5;
}
.news-card .date { font-size: 12px; color: var(--color-text-muted); }

/* ========================================
   防伪查询区块
   ======================================== */

.anti-fake-section {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    padding: 64px 0; text-align: center;
}
.anti-fake-section h2 { font-size: 28px; color: #fff; margin-bottom: 12px; }
.anti-fake-section p { color: rgba(255,255,255,0.8); margin-bottom: 32px; }

.anti-fake-form {
    max-width: 600px; margin: 0 auto;
    display: flex; gap: 12px;
}
.anti-fake-form input {
    flex: 1; padding: 14px 20px; border: none;
    font-size: 16px; border-radius: var(--radius-sm);
}
.anti-fake-form button {
    padding: 14px 36px; background: var(--color-secondary);
    color: #fff; font-size: 16px; font-weight: 500;
    border-radius: var(--radius-sm); white-space: nowrap;
}
.anti-fake-form button:hover { background: #7a5c10; }

/* 扫码按钮 */
.scan-btn {
    display: inline-flex; align-items: center; gap: 8px;
    margin-top: 20px; padding: 10px 24px;
    background: rgba(255,255,255,0.15); color: #fff;
    border-radius: var(--radius-sm); font-size: 14px;
    border: 1px solid rgba(255,255,255,0.3);
}
.scan-btn:hover { background: rgba(255,255,255,0.25); color: #fff; }

/* ========================================
   查询结果
   ======================================== */

.query-result {
    max-width: 800px; margin: 32px auto 0;
    background: var(--color-card); border-radius: var(--radius);
    padding: 32px; text-align: left; display: none;
    animation: slideDown 0.4s ease;
}
.query-result.show { display: block; }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-success { border-left: 4px solid var(--color-success); }
.result-warning { border-left: 4px solid var(--color-warning); }
.result-error { border-left: 4px solid var(--color-accent); }

.result-status {
    display: flex; align-items: center; gap: 12px; margin-bottom: 24px;
}
.result-status .status-icon {
    width: 48px; height: 48px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; flex-shrink: 0;
}
.result-success .status-icon { background: rgba(39,174,96,0.1); color: var(--color-success); }
.result-warning .status-icon { background: rgba(230,126,34,0.1); color: var(--color-warning); }
.result-error .status-icon { background: rgba(192,57,43,0.1); color: var(--color-accent); }

.result-status h3 { font-size: 20px; }
.result-status p { font-size: 13px; color: var(--color-text-secondary); }

/* 溯源时间轴 */
.trace-timeline { position: relative; padding-left: 32px; }
.trace-timeline::before {
    content: ''; position: absolute; left: 11px; top: 0; bottom: 0;
    width: 2px; background: var(--color-border);
}
.trace-item {
    position: relative; padding-bottom: 28px;
    opacity: 0; transform: translateY(20px);
    animation: fadeInUp 0.5s ease forwards;
}
.trace-item:nth-child(1) { animation-delay: 0.1s; }
.trace-item:nth-child(2) { animation-delay: 0.3s; }
.trace-item:nth-child(3) { animation-delay: 0.5s; }
.trace-item:nth-child(4) { animation-delay: 0.7s; }
.trace-item:nth-child(5) { animation-delay: 0.9s; }
.trace-item:nth-child(6) { animation-delay: 1.1s; }

@keyframes fadeInUp {
    to { opacity: 1; transform: translateY(0); }
}

.trace-item .dot {
    position: absolute; left: -26px; top: 4px;
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--color-primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 600; z-index: 1;
}
.trace-item h4 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.trace-item .meta {
    font-size: 12px; color: var(--color-text-muted); margin-bottom: 8px;
}
.trace-item p { font-size: 13px; color: var(--color-text-secondary); line-height: 1.6; }

/* ========================================
   按钮
   ======================================== */

.btn {
    display: inline-block; padding: 10px 24px;
    border-radius: var(--radius-sm); font-size: 14px;
    font-weight: 500; text-align: center; cursor: pointer;
    transition: var(--transition);
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); color: #fff; }

.btn-secondary { background: var(--color-secondary); color: #fff; }
.btn-secondary:hover { background: #7a5c10; color: #fff; }

.btn-outline {
    background: transparent; color: var(--color-primary);
    border: 1px solid var(--color-primary);
}
.btn-outline:hover { background: var(--color-primary); color: #fff; }

.btn-sm { padding: 6px 16px; font-size: 13px; }
.btn-lg { padding: 14px 40px; font-size: 16px; }

/* ========================================
   分页
   ======================================== */

.pagination {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; margin-top: 48px;
}
.page-btn, .page-num {
    padding: 8px 16px; border-radius: var(--radius-sm);
    font-size: 14px; color: var(--color-text);
    background: var(--color-card); border: 1px solid var(--color-border);
    transition: var(--transition);
}
.page-btn:hover, .page-num:hover {
    background: var(--color-primary); color: #fff; border-color: var(--color-primary);
}
.page-num.active {
    background: var(--color-primary); color: #fff; border-color: var(--color-primary);
    font-weight: 600;
}
.page-btn.disabled {
    color: var(--color-text-muted); cursor: not-allowed;
    background: var(--color-bg);
}
.page-ellipsis { color: var(--color-text-muted); padding: 0 4px; }

/* ========================================
   页脚
   ======================================== */

.footer {
    background: #1a1a1a; color: rgba(255,255,255,0.7);
    padding: 64px 0 0;
}
.footer-grid {
    display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 48px;
    margin-bottom: 48px;
}
.footer-brand h3 { font-size: 20px; color: #fff; margin-bottom: 16px; }
.footer-brand p { font-size: 13px; line-height: 1.8; margin-bottom: 20px; }
.footer-brand .contact-info p {
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; margin-bottom: 10px;
}

.footer h4 { font-size: 15px; color: #fff; margin-bottom: 20px; font-weight: 600; }
.footer-links { list-style: none; }
.footer-links li { margin-bottom: 12px; }
.footer-links a { color: rgba(255,255,255,0.6); font-size: 13px; }
.footer-links a:hover { color: #fff; }

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 20px 0; text-align: center; font-size: 12px;
    color: rgba(255,255,255,0.4);
}

/* ========================================
   区块间距
   ======================================== */

.section { padding: 64px 0; }
.section-light { background: var(--color-card); }

/* ========================================
   通用页面头部
   ======================================== */

.page-header {
    padding: 100px 0 48px; margin-top: var(--header-height);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    text-align: center; color: #fff;
}
.page-header h1 { font-size: 32px; font-weight: 700; margin-bottom: 8px; }
.page-header p { font-size: 15px; color: rgba(255,255,255,0.8); }

/* ========================================
   面包屑导航
   ======================================== */

.breadcrumb {
    padding: 16px 0; font-size: 13px; color: var(--color-text-muted);
    background: var(--color-card); border-bottom: 1px solid var(--color-border);
}
.breadcrumb a { color: var(--color-text-secondary); }
.breadcrumb a:hover { color: var(--color-primary); }
.breadcrumb span { margin: 0 8px; color: var(--color-border); }

/* ========================================
   扫码弹窗
   ======================================== */

.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7); z-index: 2000;
    display: none; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }

.modal-box {
    background: var(--color-card); border-radius: var(--radius);
    padding: 32px; max-width: 480px; width: 90%;
    text-align: center; position: relative;
}
.modal-close {
    position: absolute; top: 12px; right: 16px;
    font-size: 24px; color: var(--color-text-muted);
    background: none; cursor: pointer;
}
.modal-close:hover { color: var(--color-text); }

#scan-video {
    width: 100%; max-width: 360px; height: 270px;
    background: #000; border-radius: var(--radius-sm);
    margin: 16px auto;
}

/* ========================================
   响应式
   ======================================== */

@media (max-width: 1200px) {
    .product-grid { grid-template-columns: repeat(3, 1fr); }
    .category-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 992px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); }
    .category-grid { grid-template-columns: repeat(3, 1fr); }
    .advantage-grid { grid-template-columns: repeat(2, 1fr); }
    .news-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: repeat(2, 1fr); }
    .hero-slider { height: 450px; }
    .hero-content h2 { font-size: 32px; }
}

@media (max-width: 768px) {
    .nav-menu {
        position: fixed; top: var(--header-height); left: 0; right: 0;
        background: #fff; flex-direction: column; padding: 20px;
        box-shadow: var(--shadow); gap: 0;
        transform: translateY(-100%); opacity: 0; pointer-events: none;
        transition: var(--transition);
    }
    .nav-menu.active {
        transform: translateY(0); opacity: 1; pointer-events: auto;
    }
    .nav-menu a { padding: 12px 0; border-bottom: 1px solid var(--color-border); }
    .nav-menu a:last-child { border-bottom: none; }
    .nav-menu a::after { display: none; }
    
    .menu-toggle { display: flex; }
    
    .hero-slider { height: 400px; }
    .hero-content h2 { font-size: 26px; }
    .hero-content p { font-size: 15px; }
    
    .anti-fake-form { flex-direction: column; padding: 0 20px; }
    .anti-fake-form button { width: 100%; }
    
    .footer-grid { grid-template-columns: 1fr; gap: 32px; }
    .section { padding: 48px 0; }
}

@media (max-width: 480px) {
    .product-grid { grid-template-columns: 1fr; }
    .category-grid { grid-template-columns: repeat(2, 1fr); }
    .advantage-grid { grid-template-columns: 1fr; }
    .news-grid { grid-template-columns: 1fr; }
    .hero-slider { height: 350px; }
    .hero-content h2 { font-size: 22px; }
}
