/* ============================================
   河北美莎丽食品有限公司 - 官方网站样式
   PHP 7.2 兼容 | 响应式设计
   ============================================ */

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

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

body {
    font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    color: #333;
    line-height: 1.6;
    background: #fff;
}

a { color: inherit; text-decoration: none; transition: color .3s; }
ul { list-style: none; }
img { max-width: 100%; height: auto; display: block; }

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

/* ---------- 颜色变量 (CSS变量) ---------- */
:root {
    --primary: #c41230;
    --primary-dark: #9e0e27;
    --primary-light: #e8455e;
    --accent: #f5a623;
    --text: #333;
    --text-light: #666;
    --bg-light: #faf6f2;
    --bg-gray: #f5f5f5;
    --white: #fff;
    --shadow: 0 2px 12px rgba(0,0,0,.08);
    --radius: 6px;
}

/* ---------- 头部导航 ---------- */
.site-header {
    background: var(--white);
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
}

.logo a {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 2rem;
}

.logo-text strong {
    display: block;
    font-size: 1.25rem;
    color: var(--primary);
}

.logo-text small {
    display: block;
    font-size: .75rem;
    color: var(--text-light);
}

.main-nav {
    display: flex;
    gap: 8px;
}

.main-nav a {
    padding: 8px 18px;
    font-size: .95rem;
    color: var(--text);
    border-radius: var(--radius);
    transition: all .3s;
    position: relative;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--primary);
    background: rgba(196,18,48,.06);
}

.main-nav a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text);
}

/* ---------- Banner 轮播 ---------- */
.hero-banner {
    position: relative;
    height: 520px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.banner-slide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .8s ease;
}

.banner-slide.active { opacity: 1; }

.banner-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1;
}

.banner-content {
    text-align: center;
    color: var(--white);
    z-index: 2;
}

.banner-content h1 {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 16px;
    text-shadow: 0 2px 8px rgba(0,0,0,.3);
}

.banner-content p {
    font-size: 1.2rem;
    opacity: .9;
    max-width: 600px;
    margin: 0 auto 24px;
}

.btn {
    display: inline-block;
    padding: 12px 32px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .3s;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(196,18,48,.3);
}

.btn-outline {
    background: transparent;
    color: var(--white);
    border: 2px solid var(--white);
}

.btn-outline:hover {
    background: var(--white);
    color: var(--primary);
}

.banner-dots {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 3;
}

.banner-dots span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255,255,255,.4);
    cursor: pointer;
    transition: all .3s;
}

.banner-dots span.active {
    background: var(--white);
    transform: scale(1.2);
}

/* ---------- 区块通用 ---------- */
.section {
    padding: 60px 0;
}

.section-title {
    text-align: center;
    margin-bottom: 40px;
}

.section-title h2 {
    font-size: 2rem;
    color: var(--text);
    position: relative;
    display: inline-block;
    padding-bottom: 12px;
}

.section-title h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
}

.section-title p {
    color: var(--text-light);
    margin-top: 12px;
    font-size: .95rem;
}

/* ---------- 公司简介 (首页) ---------- */
.intro-section {
    background: var(--bg-light);
}

.intro-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}

.intro-image {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.intro-image img {
    width: 100%;
    height: 320px;
    object-fit: cover;
}

.intro-text h3 {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 16px;
}

.intro-text p {
    color: var(--text-light);
    line-height: 1.8;
    margin-bottom: 12px;
}

/* ---------- 产品分类 (首页) ---------- */
.category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.category-card {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform .3s, box-shadow .3s;
}

.category-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
}

.category-card img {
    width: 100%;
    height: 240px;
    object-fit: cover;
    transition: transform .5s;
}

.category-card:hover img {
    transform: scale(1.05);
}

.category-card .overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(transparent, rgba(0,0,0,.7));
    color: var(--white);
}

.category-card .overlay h3 {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.category-card .overlay p {
    font-size: .85rem;
    opacity: .85;
}

/* ---------- 新闻列表 ---------- */
.news-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.news-card {
    display: flex;
    gap: 16px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    transition: transform .3s;
}

.news-card:hover {
    transform: translateY(-3px);
}

.news-card img {
    width: 180px;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius);
    flex-shrink: 0;
}

.news-card .news-info {
    flex: 1;
}

.news-card .news-date {
    font-size: .8rem;
    color: var(--primary);
    margin-bottom: 8px;
}

.news-card .news-info h3 {
    font-size: 1rem;
    margin-bottom: 8px;
    line-height: 1.5;
}

.news-card .news-info p {
    font-size: .85rem;
    color: var(--text-light);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- 新闻详情 ---------- */
.news-detail {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

.news-detail h1 {
    font-size: 1.8rem;
    margin-bottom: 16px;
}

.news-detail .meta {
    color: var(--text-light);
    font-size: .9rem;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.news-detail .content {
    line-height: 2;
    color: #444;
}

.news-detail .content img {
    margin: 16px 0;
    border-radius: var(--radius);
}

/* ---------- 产品列表 ---------- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.product-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform .3s, box-shadow .3s;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,.1);
}

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

.product-card .info {
    padding: 14px;
    text-align: center;
}

.product-card .info h3 {
    font-size: 1rem;
    margin-bottom: 6px;
}

.product-card .info p {
    font-size: .85rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 8px;
}

.product-desc-short {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.4em;
}

/* ---------- 产品详情弹窗 ---------- */
.product-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.product-modal.show {
    display: flex;
}

.product-modal .modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(4px);
}

.product-modal .modal-content {
    position: relative;
    background: var(--white);
    border-radius: 12px;
    max-width: 680px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    animation: modalIn .3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(.92) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
    transition: color .3s;
}

.modal-close:hover { color: var(--primary); }

.modal-body {
    display: flex;
    flex-direction: column;
}

.modal-image {
    width: 100%;
    max-height: 400px;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
}

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

.modal-info {
    padding: 28px 32px 32px;
}

.modal-info h2 {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 16px;
    line-height: 1.4;
}

.modal-info p {
    color: var(--text-light);
    line-height: 1.9;
    font-size: .95rem;
}

.btn-detail {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 20px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 20px;
    font-size: .85rem;
    cursor: pointer;
    transition: all .3s;
}

.btn-detail:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* ---------- 系列总览说明 ---------- */
.series-summary {
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
    padding: 30px 20px;
}

.series-summary-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.series-summary h3 {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 14px;
}

.series-summary p {
    color: var(--text-light);
    line-height: 1.9;
    font-size: .95rem;
}

/* ---------- 弹窗分类标签 ---------- */
.modal-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 600;
    margin-bottom: 12px;
    background: rgba(196,18,48,.1);
    color: var(--primary);
}

/* ---------- 产品分类筛选 ---------- */
.filter-bar {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 20px;
    border: 1px solid #ddd;
    border-radius: 30px;
    background: var(--white);
    cursor: pointer;
    font-size: .9rem;
    transition: all .3s;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* ---------- 关于我们 ---------- */
.about-hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 60px 0;
    text-align: center;
}

.about-hero h1 {
    font-size: 2.4rem;
    margin-bottom: 12px;
}

.about-hero p {
    font-size: 1.1rem;
    opacity: .85;
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    padding: 50px 0;
}

.about-content .text h3 {
    font-size: 1.4rem;
    color: var(--primary);
    margin-bottom: 16px;
}

.about-content .text p {
    color: var(--text-light);
    line-height: 1.9;
    margin-bottom: 14px;
}

.about-content .images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.about-content .images img {
    border-radius: var(--radius);
    height: 180px;
    object-fit: cover;
}

.about-content .images img:first-child {
    grid-column: 1 / -1;
    height: 240px;
}

/* 企业资质 */
.certs-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 30px;
}

.cert-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    text-align: center;
    transition: transform .3s;
}

.cert-card:hover {
    transform: translateY(-4px);
}

.cert-card img {
    width: 100%;
    height: 160px;
    object-fit: contain;
    margin-bottom: 12px;
}

.cert-card h4 {
    font-size: .95rem;
    color: var(--text);
}

/* ---------- 联系我们 ---------- */
.contact-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    padding: 50px 0;
}

.contact-form .form-group {
    margin-bottom: 16px;
}

.contact-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: .9rem;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: var(--radius);
    font-size: .95rem;
    font-family: inherit;
    transition: border-color .3s;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.contact-form textarea {
    height: 120px;
    resize: vertical;
}

.contact-info h3 {
    font-size: 1.3rem;
    color: var(--primary);
    margin-bottom: 20px;
}

.contact-info .info-item {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: flex-start;
}

.contact-info .info-item .icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.contact-info .info-item h4 {
    font-size: .95rem;
    margin-bottom: 4px;
}

.contact-info .info-item p {
    font-size: .9rem;
    color: var(--text-light);
}

/* 地图占位 */
.map-placeholder {
    width: 100%;
    height: 300px;
    background: var(--bg-gray);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    margin-top: 20px;
    font-size: .9rem;
}

/* 百度地图容器 */
.map-container {
    position: relative;
}

#contactMap,
#aboutMap {
    width: 100%;
    border-radius: var(--radius);
}

/* 百度地图加载动画 */
.map-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: var(--bg-gray);
    color: var(--text-light);
    font-size: .9rem;
}

.map-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #eee;
    border-top-color: var(--primary);
    border-radius: 50%;
    margin-bottom: 12px;
    animation: mapSpin .8s linear infinite;
}

@keyframes mapSpin {
    to { transform: rotate(360deg); }
}

/* 百度地图降级方案 */
.map-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: linear-gradient(135deg, #f8f6f4 0%, #f0ebe6 100%);
    padding: 30px;
}

.map-fallback-inner {
    text-align: center;
}

.map-fallback-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.map-fallback-inner h4 {
    color: var(--text);
    font-size: 1rem;
    margin-bottom: 8px;
    line-height: 1.6;
}

.map-fallback-inner p {
    color: var(--text-light);
    font-size: .9rem;
    margin-bottom: 16px;
}

.map-fallback-btn {
    display: inline-block;
    padding: 8px 24px;
    background: var(--primary);
    color: var(--white);
    border-radius: 20px;
    font-size: .85rem;
    transition: all .3s;
}

.map-fallback-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(196,18,48,.3);
    color: var(--white);
}

/* 百度地图信息窗口自定义样式 */
.BMap_bubble_content {
    font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif !important;
}

.BMap_bubble_content h4 {
    color: var(--primary) !important;
}

.BMap_bubble_content div {
    color: var(--text-light) !important;
    line-height: 1.6 !important;
}

.baidu-map-info {
    padding: 4px 0;
}

.baidu-map-info h4 {
    margin: 0 0 8px;
    color: var(--primary);
    font-size: 14px;
    font-weight: 600;
}

.baidu-map-info-content {
    color: #666;
    font-size: 13px;
    line-height: 1.7;
}

/* ---------- 返回顶部 ---------- */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all .3s;
    z-index: 999;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
}

/* ---------- 页脚 ---------- */
.site-footer {
    background: #2c2c2c;
    color: #ccc;
    padding: 50px 0 0;
}

.site-footer h3 {
    color: var(--white);
    margin-bottom: 16px;
    font-size: 1.1rem;
}

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

.footer-col p { margin-bottom: 8px; font-size: .9rem; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col ul li a { color: #ccc; font-size: .9rem; }
.footer-col ul li a:hover { color: var(--primary-light); }

.footer-bottom {
    border-top: 1px solid #444;
    padding: 16px 0;
    text-align: center;
}

.footer-info {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
    font-size: .82rem;
    color: #aaa;
    line-height: 1.8;
}

.footer-info a {
    color: #aaa;
    transition: color .3s;
}

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

.footer-info .footer-divider {
    color: #555;
    margin: 0 2px;
}

.footer-info img {
    display: inline-block;
    vertical-align: middle;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
    .product-grid { grid-template-columns: repeat(3, 1fr); }
    .footer-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .main-nav {
        display: none;
        position: absolute;
        top: 80px;
        left: 0;
        right: 0;
        background: var(--white);
        flex-direction: column;
        padding: 16px;
        box-shadow: 0 4px 12px rgba(0,0,0,.1);
    }

    .main-nav.open { display: flex; }
    .menu-toggle { display: block; }

    .hero-banner { height: 360px; }
    .banner-content h1 { font-size: 1.8rem; }

    .intro-grid,
    .about-content,
    .contact-section {
        grid-template-columns: 1fr;
    }

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

    .news-card { flex-direction: column; }
    .news-card img { width: 100%; height: 180px; }
}

@media (max-width: 480px) {
    .category-grid { grid-template-columns: 1fr; }
    .product-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; }
}
