/* =========================================================
   CORE.CSS (FINAL SINGLE FILE SYSTEM)
   layout + components + base merged
========================================================= */


/* =========================================
   1. RESET (base.css)
========================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    background: #f5f7fa;
    font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
    color: #111827;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

ul {
    list-style: none;
}


/* =========================================
   2. LAYOUT SYSTEM
========================================= */

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

.page-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 20px;
}

.section {
    padding: 32px 0;
}

.grid {
    display: grid;
    gap: 16px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
    .container {
        padding: 0 12px;
    }

    .page-layout {
        grid-template-columns: 1fr;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
}


/* =========================================
   3. HEADER
========================================= */

.site-header {
    width: 100%;
}

.top-line {
    background: #0f172a;
    color: #cbd5e1;
    font-size: 13px;
}

.top-line-inner {
    height: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.main-header {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
}

.header-inner {
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}


/* =========================================
   4. NAVIGATION
========================================= */

.main-nav ul {
    display: flex;
    gap: 18px;
}

.main-nav a {
    font-size: 14px;
    color: #111;
}

.main-nav a:hover {
    color: #2563eb;
}


/* =========================================
   5. MEGA MENU
========================================= */

.has-mega {
    position: relative;
}

.mega-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 800px;
    background: #fff;
    border: 1px solid #e5e7eb;
    padding: 20px;
    z-index: 1000;
}

.has-mega:hover .mega-menu {
    display: block;
}

.mega-inner {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}


/* =========================================
   6. COMPONENTS (UI)
========================================= */

.card {
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.btn {
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
}


/* =========================================
   7. PAGE ELEMENTS
========================================= */

.page-header {
    margin: 24px 0;
}

.breadcrumb {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 16px;
}


/* =========================================
   8. FOOTER
========================================= */

.site-footer {
    background: #0f172a;
    color: #cbd5e1;
    padding: 40px 0;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.footer-bottom {
    text-align: center;
    margin-top: 20px;
    font-size: 12px;
    color: #94a3b8;
}

html {
    overflow-y: scroll;  /* 强制滚动条常驻，避免抖动 */
}

body {
    margin: 0;
    overflow-x: hidden;
}

/* =========================================
   FOOTER FINAL FIX（企业级排版）
========================================= */

.site-footer {
    background: #0f172a;
    color: #cbd5e1;
    padding: 50px 0 20px;
}

/* 四列布局 */
.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
    align-items: start;
}

/* 每一列 */
.footer-col h4 {
    color: #ffffff;
    font-size: 15px;
    margin-bottom: 14px;
    font-weight: 600;
}

/* 链接统一间距 */
.footer-col a {
    display: block;
    color: #cbd5e1;
    font-size: 13px;
    margin-bottom: 8px;
    line-height: 1.6;
}

.footer-col a:hover {
    color: #ffffff;
}

/* 文本信息 */
.footer-col p {
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.6;
    color: #cbd5e1;
}

/* 底部版权 */
.footer-bottom {
    text-align: center;
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 12px;
    color: #94a3b8;
}

/* =========================
   MOBILE
========================= */

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }
}

/* =========================================
   HEADER FINAL FIX（企业级统一修复）
========================================= */

/* 顶部整体 */
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

/* =========================
   LEFT LOGO（重点修复）
========================= */

.site-logo {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    text-decoration: none;
}

/* 中文标题 */
.logo-main {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    letter-spacing: 0.5px;
}

/* 英文副标题 */
.logo-sub {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
    letter-spacing: 0.3px;
}

/* =========================
   NAV（中间对齐优化）
========================= */

.main-nav ul {
    display: flex;
    align-items: center;
    gap: 20px;
}

.main-nav a {
    font-size: 14px;
    color: #111827;
    padding: 6px 0;
    white-space: nowrap;
}

.main-nav a:hover {
    color: #2563eb;
}

/* =========================
   RIGHT SEARCH
========================= */

.header-search {
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-search input {
    height: 34px;
    padding: 0 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    width: 200px;
    font-size: 13px;
}

.header-search button {
    height: 34px;
    padding: 0 12px;
    border: none;
    background: #2563eb;
    color: #fff;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
}

.header-search button:hover {
    background: #1d4ed8;
}

/* =========================================
   MEGA MENU FINAL FIX（企业级排版）
========================================= */

.mega-menu {
    position: absolute;
    top: 100%;
    left: 0;

    width: 900px;
    background: #fff;

    border: 1px solid #e5e7eb;
    padding: 24px;

    z-index: 1000;

    /* 关键 */
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

/* 四列结构 */
.mega-inner {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;   /* ✔ 列间距 */
}

/* 每一列 */
.mega-col {
    display: flex;
    flex-direction: column;
}

/* 标题 */
.mega-col h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #111827;
}

/* 链接优化 */
.mega-col a {
    display: block;
    font-size: 13px;

    padding: 4px 0;
    line-height: 1.6;

    color: #374151;
    white-space: nowrap;   /* 防止挤压换行错乱 */
}

.mega-col a:hover {
    color: #2563eb;
}

/* 防止整体被压缩 */
.has-mega {
    position: relative;
}

/* hover显示 */
.has-mega:hover .mega-menu {
    display: block;
}

@media (max-width: 768px) {

    /* 顶部 top-line 保留但缩小 */
    .top-line {
        display: none;
    }

    /* 主导航变抽屉 */
    .main-nav {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        height: 100vh;
        background: #fff;
        z-index: 999;
        transition: all 0.3s ease;
        padding: 60px 20px;
        overflow-y: auto;
    }

    /* 打开状态 */
    body.mobile-open .main-nav {
        left: 0;
    }

    /* 菜单纵向 */
    .main-nav ul {
        flex-direction: column;
        gap: 0;
    }

    .main-nav li {
        padding: 12px 0;
        border-bottom: 1px solid #f0f0f0;
    }

    /* mega menu 在手机隐藏 */
    .mega-menu {
        display: none !important;
    }

    /* 搜索隐藏 */
    .header-actions {
        display: none;
    }

    /* 汉堡按钮显示 */
    .mobile-menu-btn {
        display: block;
        position: fixed;
        top: 12px;
        right: 12px;
        z-index: 1000;
        background: #fff;
        border: 1px solid #eee;
        padding: 8px 10px;
        border-radius: 6px;
    }

    /* overlay */
    .mobile-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 998;
    }

    body.mobile-open .mobile-overlay {
        display: block;
    }
}