/* ==========================================================================
   common.css — 北京中科测试全站公共样式
   视觉方向：纯净白底 + 极淡实验室网格
   包含：CSS 变量 / 基础重置 / 科学背景 / 顶部通知 / 头部导航 / 搜索
         页脚 / 返回顶部 / 移动底栏 / 微信弹窗 / 移动全屏搜索 / 动画
   引用方式：<link rel="stylesheet" href="public/1228/css/common.css">
   ========================================================================== */

/* ==========================================================================
   1. CSS 变量
   ========================================================================== */
:root {
    --primary-color: #1a4b8c;
    --primary-dark: #0d2c5a;
    --primary-light: #e8f1fb;
    --sci-accent: #8ecae6;
    --sci-accent-deep: #5fa8c9;
    --dark-color: #1f2d3d;
    --gray-color: #6b7684;
    --warning-color: #ffc107;
    --danger-color: #e53935;
    --success-color: #43a047;
    --border-radius: 12px;
    --box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    --box-shadow-hover: 0 12px 32px rgba(26, 75, 140, 0.14);
    --transition: all 0.3s ease;
    --mobile-bar-height: 60px;
}

/* ==========================================================================
   2. 基础重置
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
                 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    color: var(--dark-color);
    background: #ffffff;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

a {
    color: inherit;
}

button {
    font-family: inherit;
}

/* ==========================================================================
   3. 科学背景 —— 纯净白底 + 极淡实验室网格
   ========================================================================== */
.scientific-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background-color: #ffffff;
    background-image:
        linear-gradient(rgba(26, 75, 140, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(26, 75, 140, 0.035) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
}

/* 顶部极淡光晕，增强层次（不抢内容） */
.scientific-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 70% 45% at 50% 0%,
        rgba(26, 75, 140, 0.045), transparent 70%);
    pointer-events: none;
}

/* ==========================================================================
   4. 顶部通知
   ========================================================================== */
.top-notice {
    background: var(--primary-dark);
    color: #ffffff;
    text-align: center;
    font-size: 0.85rem;
    padding: 8px 1rem;
    letter-spacing: 0.3px;
}

.top-notice i {
    margin-right: 6px;
    color: var(--sci-accent);
}

/* ==========================================================================
   5. 容器
   ========================================================================== */
.container {
    max-width: 100%;
    margin: 0 auto;
}

/* ==========================================================================
   6. 头部
   ========================================================================== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid #eef1f5;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 2rem;
    gap: 1.5rem;
}

.logo-container {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.site-logo {
    height: 48px;
    width: auto;
    display: block;
}

.logo-fallback {
    display: none;
    align-items: center;
    gap: 10px;
}

.logo-fallback.active {
    display: flex;
}

.logo-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.logo-text h1 {
    font-size: 1.15rem;
    color: var(--dark-color);
    line-height: 1.2;
    font-weight: 700;
}

.logo-text .tagline {
    font-size: 0.6rem;
    color: var(--gray-color);
    letter-spacing: 0.5px;
    line-height: 1.2;
}

/* ==========================================================================
   7. 导航
   ========================================================================== */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
}

.nav-menu > li {
    position: relative;
}

.nav-menu > li > a {
    display: block;
    padding: 0.6rem 0.9rem;
    color: var(--dark-color);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 8px;
    transition: var(--transition);
    white-space: nowrap;
}

.nav-menu > li > a:hover,
.nav-menu > li > a.active {
    color: var(--primary-color);
    background: var(--primary-light);
}

/* ==========================================================================
   8. 桌面搜索
   ========================================================================== */
.search-container {
    position: relative;
}

.search-box {
    display: flex;
    align-items: center;
    position: relative;
}

.search-input {
    width: 200px;
    padding: 0.5rem 2.2rem 0.5rem 0.9rem;
    border: 1.5px solid #e0e6ee;
    border-radius: 20px;
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
    background: #ffffff;
    color: var(--dark-color);
}

.search-input:focus {
    width: 260px;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 75, 140, 0.08);
}

.search-button {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 0.9rem;
}

.search-button:hover {
    color: var(--primary-dark);
}

.search-suggestions,
.search-results-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
    border: 1px solid #eef1f5;
    display: none;
    z-index: 200;
    max-height: 420px;
    overflow-y: auto;
}

.search-suggestions.active,
.search-results-panel.active {
    display: block;
}

.search-suggestion-item {
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
    color: var(--dark-color);
    cursor: pointer;
    border-bottom: 1px solid #f4f7fa;
    transition: var(--transition);
}

.search-suggestion-item:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eef1f5;
    font-size: 0.9rem;
    color: var(--gray-color);
    position: sticky;
    top: 0;
    background: #ffffff;
    z-index: 1;
}

.search-results-header h4 {
    font-size: 0.95rem;
    color: var(--dark-color);
    font-weight: 700;
}

.search-results-count {
    font-size: 0.8rem;
    color: #98a4b0;
}

.search-result-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f4f7fa;
    transition: var(--transition);
}

.search-result-item:hover {
    background: var(--primary-light);
}

.search-result-title {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.92rem;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-result-title i {
    color: var(--primary-color);
    font-size: 0.85rem;
}

.search-result-snippet {
    font-size: 0.82rem;
    color: var(--gray-color);
    line-height: 1.5;
}

.search-result-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    font-size: 0.75rem;
    color: #98a4b0;
}

.search-result-tags {
    display: flex;
    gap: 4px;
}

.search-result-tag {
    background: var(--primary-light);
    color: var(--primary-color);
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 500;
}

.search-results-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: #98a4b0;
}

.search-results-empty i {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    display: block;
    color: #c5cdd6;
}

.search-results-empty p {
    font-size: 0.88rem;
}

.highlight {
    background: #fff3b0;
    padding: 0 1px;
    border-radius: 2px;
}

/* ==========================================================================
   9. 移动菜单/搜索按钮
   ========================================================================== */
.mobile-menu-btn,
.mobile-search-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0.4rem;
    transition: var(--transition);
}

.mobile-menu-btn:hover,
.mobile-search-btn:hover {
    color: var(--primary-dark);
}

/* ==========================================================================
   10. 移动全屏搜索
   ========================================================================== */
.search-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 250;
    background: #ffffff;
    display: none;
    flex-direction: column;
}

.search-fullscreen.active {
    display: flex;
}

.search-fullscreen-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border-bottom: 1px solid #eef1f5;
}

.search-fullscreen-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1.5px solid #e0e6ee;
    border-radius: 24px;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

.search-fullscreen-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 75, 140, 0.08);
}

.search-fullscreen-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--gray-color);
    cursor: pointer;
    padding: 0.4rem;
}

.search-fullscreen-close:hover {
    color: var(--danger-color);
}

.search-fullscreen-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.search-overlay {
    position: fixed;
    inset: 0;
    z-index: 240;
    background: rgba(0, 0, 0, 0.4);
    display: none;
}

.search-overlay.active {
    display: block;
}

/* ==========================================================================
   11. 页脚
   ========================================================================== */
.footer {
    background: linear-gradient(135deg, #0d2c5a 0%, #1a4b8c 100%);
    color: rgba(255, 255, 255, 0.85);
    padding: 3.5rem 2rem 1.5rem;
    margin-top: 0;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
    gap: 2.5rem;
    padding-bottom: 2rem;
}

.footer-logo h3 {
    color: #ffffff;
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.footer-logo p {
    font-size: 0.88rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.7);
}

.footer-links h4 {
    color: #ffffff;
    font-size: 1rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.55rem;
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.72);
    line-height: 1.6;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover,
.footer-links a.active {
    color: var(--sci-accent);
}

.footer-links i {
    width: 18px;
    color: var(--sci-accent);
    margin-right: 4px;
}

.footer-bottom {
    max-width: 1400px;
    margin: 0 auto;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.8;
}

.footer-bottom p {
    margin-bottom: 0.4rem;
}

.footer-bottom p:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   12. 返回顶部
   ========================================================================== */
.back-to-top {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 90;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    box-shadow: 0 6px 18px rgba(26, 75, 140, 0.35);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

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

/* ==========================================================================
   13. 移动底栏
   ========================================================================== */
.mobile-bottom-bar {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 95;
    background: #ffffff;
    border-top: 1px solid #eef1f5;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
    padding-bottom: env(safe-area-inset-bottom);
}

.mobile-bar-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 0.55rem 0;
    font-size: 0.7rem;
    color: var(--gray-color);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
}

.mobile-bar-btn i {
    font-size: 1.15rem;
}

.mobile-bar-btn:hover,
.mobile-bar-btn:active {
    color: var(--primary-color);
}

.mobile-bar-btn.primary {
    color: var(--primary-color);
    font-weight: 600;
}

/* ==========================================================================
   14. 微信弹窗
   ========================================================================== */
.wechat-modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(0, 0, 0, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.wechat-modal.active {
    display: flex;
}

.wechat-modal-content {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    padding: 2rem 1.75rem 1.5rem;
    max-width: 320px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.wechat-modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #98a4b0;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    transition: var(--transition);
}

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

.wechat-qr-wrap {
    width: 200px;
    height: 200px;
    margin: 0 auto 1rem;
    border: 1px solid #eef1f5;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #fafcff;
}

.wechat-qr-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.wechat-modal-content h4 {
    font-size: 1rem;
    color: var(--dark-color);
    margin-bottom: 0.4rem;
    font-weight: 700;
}

.wechat-modal-content p {
    font-size: 0.82rem;
    color: var(--gray-color);
    margin-bottom: 0.75rem;
}

.wechat-id {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary-color);
    font-weight: 600;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   15. 动画
   ========================================================================== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fadeInUp {
    animation: fadeInUp 0.7s ease both;
}

/* ==========================================================================
   16. 移动端
   ========================================================================== */
@media (max-width: 900px) {
    .header-content {
        padding: 0.6rem 1rem;
    }

    .mobile-menu-btn,
    .mobile-search-btn {
        display: block;
    }

    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        z-index: 150;
        width: 78%;
        max-width: 320px;
        height: 100vh;
        background: #ffffff;
        flex-direction: column;
        align-items: stretch;
        padding: 5rem 1.5rem 2rem;
        gap: 0.25rem;
        box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
        transition: right 0.3s ease;
        overflow-y: auto;
    }

    .nav-menu.active {
        right: 0;
    }

    .nav-menu > li > a {
        padding: 0.85rem 1rem;
        font-size: 1rem;
    }

    .search-container {
        display: none;
    }

    .footer {
        padding: 0 1rem calc(1.5rem + var(--mobile-bar-height));
    }

    .footer-content {
        display: none !important;
    }

    .footer-bottom {
        padding-top: 1.5rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        text-align: center;
    }

    .footer-bottom p {
        font-size: 0.78rem;
        line-height: 1.7;
        margin-bottom: 0.4rem;
        color: rgba(255, 255, 255, 0.7);
    }

    .footer-bottom p:last-child {
        margin-bottom: 0;
        font-size: 0.72rem;
        color: rgba(255, 255, 255, 0.5);
    }

    .mobile-bottom-bar {
        display: flex;
    }

    .back-to-top {
        bottom: calc(1.5rem + var(--mobile-bar-height));
    }

    body.menu-open {
        overflow: hidden;
    }
}

@media (max-width: 480px) {
    .logo-text h1 {
        font-size: 1.5rem;
    }

    .logo-icon {
        width: 48px;
        height: 48px;
        font-size: 1.6rem;
        padding: 8px;
    }
}