/* ==========================================================================
 * 2025 TAM 调研站样式（v1.2）
 *
 * 设计体系：
 * 1. 颜色全部来自令牌，亮色在 :root 定义，暗色在 public/assist/css/dark.css 的
 *    @media (prefers-color-scheme: dark) 中覆盖，无切换按钮。
 * 2. 三层表面：页面底 / 卡片表面 / 交替区块；三层文字：正文 / 说明 / 弱化。
 * 3. 暗色页面底为纯黑，文字与蓝调降亮，避免长时阅读刺眼。
 * 4. 全站直角、1px 细边框，所有页面专属样式集中在本文件，模板不再写 <style>。
 * ========================================================================== */

:root {
    color-scheme: light;

    /* 表面 */
    --bg-page:        #ffffff;
    --bg-surface:     #ffffff;
    --bg-alternate:   #f4f6f9;
    --header-bg:      rgba(255, 255, 255, .94);

    /* 文字 */
    --dark-text:      #2c3745;
    --light-text:     #6b7788;
    --secondary-color:#1f2b3a;
    --on-primary:     #ffffff;
    --on-secondary:   #ffffff;
    /* 页脚 / Cookie 横幅这类反色区块，与标题用色解耦 */
    --inverse-bg:     #1f2b3a;
    --on-inverse:     #ffffff;

    /* 边框与阴影 */
    --border-color:   #dce2ea;
    --shadow-1:       0 2px 10px rgba(20, 32, 55, .06);
    --shadow-2:       0 8px 24px rgba(20, 32, 55, .10);

    /* 品牌与状态 */
    --primary-color:  #2d68d8;
    --button-hover:   #1f52b5;
    --button-disabled:#aeb7c4;
    --success-bg:     #e6f4ea;  --success-text: #1e7a46;
    --error-bg:       #fde8ea;  --error-text:   #b02a37;
    --info-bg:        #e8f1fd;  --info-text:    #1b5ea8;

    /* 热力图：JS 通过 var(--heatmap-rgb) 生成透明度 */
    --heatmap-rgb:      45, 104, 216;
    --heatmap-text-on:  #ffffff;
    --heatmap-text-off: #1f2b3a;

    --font-sans: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: 'Oswald', 'Inter', sans-serif;
}

/* 兼容旧变量名的页面内联样式 */
:root {
    --white-color: var(--bg-surface);
    --light-bg:    var(--bg-alternate);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; border-radius: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    line-height: 1.7;
    color: var(--dark-text);
    background-color: var(--bg-page);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color .25s ease, color .25s ease;
}
main { flex: 1; width: 100%; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; width: 100%; }
a { color: var(--primary-color); text-decoration: none; transition: color .2s ease; }
a:hover { color: var(--button-hover); }
hr { border: none; border-top: 1px solid var(--border-color); margin: 20px 0; }
img { max-width: 100%; height: auto; }

/* ── 通用文字 / 间距工具类 ── */
.text-muted { color: var(--light-text); }
.text-secondary { color: var(--secondary-color); }
.text-center { text-align: center; }
.mt-2 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 2rem; }
.section { padding: 4rem 0; }
.section.alternate {
    background-color: var(--bg-alternate);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

/* ── 页头 / 导航 ── */
header[role="banner"] {
    background-color: var(--header-bg);
    backdrop-filter: blur(5px);
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}
.navbar { display: flex; justify-content: space-between; align-items: center; min-height: 50px; }
.navbar-brand a { text-decoration: none; color: var(--secondary-color); }
.navbar-brand span { display: block; line-height: 1.3; }
.navbar-brand .title-line-1 { font-size: 1rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.navbar-brand .title-line-2 { font-size: .8rem; font-weight: 400; color: var(--light-text); }
.navbar-menu { display: flex; align-items: center; gap: 1.5rem; }
.navbar-links { display: flex; list-style: none; gap: 1rem; }
.navbar-links a {
    color: var(--dark-text);
    font-weight: 500;
    font-size: .95rem;
    padding: 8px 12px;
    transition: color .2s ease, background-color .2s ease;
}
.navbar-links a:hover { color: var(--primary-color); background-color: var(--bg-alternate); }
.menu-toggle {
    display: none;
    color: var(--dark-text);
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    z-index: 1001;
}

/* ── 语言下拉 ── */
.language-dropdown { position: relative; display: inline-block; }
.language-button {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--dark-text);
    padding: 8px 16px;
    font-size: .9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color .2s ease, color .2s ease;
}
.language-button:hover { background-color: var(--inverse-bg); color: var(--on-inverse); }
.language-button .arrow { transition: transform .3s ease; }
.current-lang { white-space: nowrap; }
.language-options {
    display: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all .2s ease;
    position: absolute;
    background-color: var(--bg-surface);
    min-width: 160px;
    box-shadow: var(--shadow-2);
    border: 1px solid var(--border-color);
    z-index: 1002;
    list-style: none;
    right: 0;
    margin-top: 0;
}
.language-dropdown.active .language-options { display: block; opacity: 1; visibility: visible; transform: translateY(0); }
.language-dropdown.active .language-button .arrow { transform: rotate(180deg); }
.language-options li a {
    color: var(--dark-text);
    padding: 12px 20px;
    text-decoration: none;
    display: block;
    font-size: .9rem;
    font-weight: normal;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color);
}
.language-options li:last-child a { border-bottom: none; }
.language-options li a:hover { background-color: var(--bg-alternate); color: var(--primary-color); }
.language-options li a.active { background-color: var(--primary-color); color: var(--on-primary); font-weight: 700; }

/* ── 按钮 ── */
.button {
    display: inline-block;
    background-color: var(--primary-color);
    color: var(--on-primary);
    padding: 12px 30px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: background-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.button:hover { background-color: var(--button-hover); transform: translateY(-2px); box-shadow: 0 4px 0 var(--border-color); }
.button:active { transform: translateY(0); }
.button:disabled { background-color: var(--button-disabled); cursor: not-allowed; transform: none; box-shadow: none; }

/* ── 表单 ── */
.form-group { margin-bottom: 1.5rem; text-align: left; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--secondary-color); }
.form-control,
.form-group input[type="text"],
.form-group input[type="email"],
.form-group textarea,
#user-email {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--dark-text);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: border-color .3s ease, box-shadow .3s ease;
}
.form-control:focus,
.form-group input:focus,
.form-group textarea:focus,
#user-email:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--heatmap-rgb), .18);
}
textarea.form-control { resize: vertical; min-height: 120px; }
.form-container {
    margin: 0 auto;
    background: var(--bg-surface);
    padding: 2.5rem;
    box-shadow: var(--shadow-2);
}

/* ── 消息反馈 ── */
#feedbackMessage { padding: 12px; text-align: center; font-size: .95rem; }
#feedbackMessage.success { background-color: var(--success-bg); color: var(--success-text); border: 1px solid var(--success-text); }
#feedbackMessage.error   { background-color: var(--error-bg);   color: var(--error-text);   border: 1px solid var(--error-text); }
#feedbackMessage.info    { background-color: var(--info-bg);    color: var(--info-text);    border: 1px solid var(--info-text); }

/* ── Hero / 卡片 / 网格 ── */
.hero-header, .hero {
    text-align: center;
    padding: 5rem 2rem;
    background-color: var(--bg-alternate);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 3rem;
}
.hero-header h1, .hero h1 { font-size: 2.5rem; color: var(--secondary-color); margin-bottom: .75rem; font-weight: 700; }
.hero-header p, .hero p { font-size: 1.2rem; color: var(--light-text); max-width: 800px; margin: 0 auto 1.5rem; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 2rem; }
.content-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 2rem; margin-bottom: 2rem; }
.full-width-card { grid-column: 1 / -1; }
.info-card, .survey-card {
    background: var(--bg-surface);
    padding: 2.5rem;
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    box-shadow: var(--shadow-1);
    height: 100%;
    overflow-x: auto;
    transition: transform .2s ease, box-shadow .2s ease;
}
.info-card:hover, .survey-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.info-card h3, .survey-card h3 {
    margin-top: 0;
    color: var(--secondary-color);
    font-size: 1.4rem;
    border-bottom: 2px solid var(--bg-alternate);
    padding-bottom: 12px;
    margin-bottom: 1.5rem;
    font-weight: 700;
}
.info-card h4 { color: var(--primary-color); margin-bottom: .5rem; }
.info-card p { line-height: 1.7; color: var(--light-text); }
.info-card ul { padding-left: 20px; line-height: 1.8; color: var(--dark-text); }
.info-card li { margin-bottom: 10px; }
.feature-list { list-style: none; padding-left: 0; margin-bottom: 1.5rem; }
.feature-list li {
    margin-bottom: 1rem;
    padding-left: 2rem;
    position: relative;
    color: var(--dark-text);
    line-height: 1.5;
}
.feature-list li::before {
    content: '✔';
    color: var(--on-primary);
    background-color: var(--primary-color);
    position: absolute;
    left: 0; top: 2px;
    width: 20px; height: 20px;
    font-size: 12px;
    text-align: center;
    line-height: 20px;
}
.survey-list-container { text-align: center; }
.survey-card { text-align: left; margin-bottom: 1.5rem; border-top-width: 1px; }
.survey-card .button { float: right; }

/* ── 图表 / 热力图 ── */
.chart-container { position: relative; height: 350px; width: 100%; min-width: 300px; display: flex; justify-content: center; }
.table-responsive, .heatmap-table-wrapper { width: 100%; overflow-x: auto; }
.heatmap-table {
    width: 100%;
    min-width: 600px;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 1rem;
    border: 1px solid var(--border-color);
    overflow: hidden;
}
.heatmap-table th, .heatmap-table td {
    padding: 15px 10px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}
.heatmap-table th {
    background-color: var(--bg-alternate);
    font-weight: 700;
    color: var(--secondary-color);
    border-right: 1px solid var(--border-color);
}
.heatmap-table th:last-child { border-right: none; }
.heatmap-table tbody tr td:first-child {
    text-align: left;
    padding-left: 20px;
    background-color: var(--bg-surface);
    border-right: 2px solid var(--border-color);
    font-weight: 600;
    color: var(--secondary-color);
    min-width: 150px;
}
.heatmap-table tbody tr:hover td:first-child { background-color: var(--bg-alternate); }
.heatmap-cell { font-weight: 600; color: var(--secondary-color); transition: background-color .3s ease; }
.legend-swatch { display: inline-block; width: 12px; height: 12px; margin-right: 5px; border: 1px solid var(--border-color); }
.legend-swatch.legend-low  { background: rgba(var(--heatmap-rgb), .2); }
.legend-swatch.legend-high { background: rgba(var(--heatmap-rgb), 1); border-color: var(--primary-color); }

/* ── 下载区 ── */
#download-form {
    margin: 2rem auto 0;
    text-align: left;
    background: var(--bg-surface);
    padding: 2.5rem;
    box-shadow: var(--shadow-2);
}
.download-note { display: block; text-align: right; margin-top: 15px; color: var(--light-text); }

/* ── 加载动画 ── */
.loading-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    vertical-align: text-bottom;
    animation: tam-spin .75s linear infinite;
}
@keyframes tam-spin { to { transform: rotate(360deg); } }

/* ── Cookie 横幅 ── */
.cookie-consent-banner {
    position: fixed;
    bottom: 0; left: 0;
    width: 100%;
    background-color: var(--inverse-bg);
    color: var(--on-inverse);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 2000;
    transform: translateY(100%);
    transition: transform .5s ease-in-out;
}
.cookie-consent-banner.show { transform: translateY(0); }
.cookie-consent-banner p { margin: 0 20px 0 0; font-size: 14px; }
.cookie-consent-banner .button {
    white-space: nowrap;
    background-color: var(--on-inverse);
    color: var(--inverse-bg);
    border-color: var(--on-inverse);
}
.cookie-consent-banner .button:hover { background-color: var(--bg-alternate); color: var(--dark-text); box-shadow: none; }

/* ── 页脚 ── */
footer[role="contentinfo"] {
    background-color: var(--inverse-bg);
    color: var(--on-inverse);
    text-align: center;
    padding: 2rem 0;
    margin-top: auto;
    width: 100%;
}
footer a, footer p, footer small { color: var(--on-inverse); text-decoration: none; }
footer a:hover { color: var(--on-inverse); text-decoration: underline; }

/* ── 状态提示卡（联系反馈 / 链接失效） ── */
.status-card { text-align: center; margin: 0 auto; }
.status-card h3.status-success { color: var(--success-text); border-bottom-color: var(--success-bg); }
.status-card h3.status-error { color: var(--error-text); border-bottom-color: var(--error-bg); }
.status-card .icon { color: inherit; vertical-align: middle; }
.lead-text { font-size: 1.1rem; margin: 20px 0; }
.actions-row { margin-top: 30px; }
.ml-1 { margin-left: 10px; }
.button.button-secondary { background-color: var(--button-disabled); }
.button.button-secondary:hover { background-color: var(--light-text); box-shadow: none; transform: none; }

/* ── 独立错误页（400 / 403 / 404） ── */
.site-header {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    padding: 30px 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
}
.site-logo {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--secondary-color);
}
.site-logo:hover { color: var(--primary-color); }
.back-link {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--light-text);
    padding: 10px 0;
    position: relative;
}
.back-link::before {
    content: '';
    position: absolute;
    bottom: 8px; left: 0;
    width: 0; height: 2px;
    background: var(--primary-color);
    transition: width .3s;
}
.back-link:hover { color: var(--secondary-color); }
.back-link:hover::before { width: 100%; }
.error-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 100px 20px 20px;
}
.error-code {
    font-family: var(--font-display);
    font-size: clamp(140px, 22vw, 220px);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -6px;
    color: var(--primary-color);
    animation: tam-fade-up .6s ease-out;
    user-select: none;
}
.error-msg {
    font-family: var(--font-display);
    font-size: clamp(16px, 2.5vw, 22px);
    text-transform: uppercase;
    letter-spacing: 8px;
    color: var(--light-text);
    margin-top: -8px;
    animation: tam-fade-up .6s ease-out .15s both;
}
.footer-info {
    position: fixed;
    bottom: 24px; left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--light-text);
    font-size: 11px;
    letter-spacing: 1.5px;
}
.beian-links { display: flex; gap: 15px; flex-wrap: wrap; justify-content: center; }
.beian-links a { color: var(--light-text); }
.beian-links a:hover { color: var(--secondary-color); }
@keyframes tam-fade-up {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── 响应式 ── */
@media (max-width: 992px) {
    .menu-toggle { display: block; }
    .navbar-menu {
        display: none;
        position: fixed;
        width: 100%; height: 100vh;
        top: 0; left: 0;
        background-color: var(--bg-surface);
        flex-direction: column;
        justify-content: center;
        gap: 2rem;
        transform: translateX(100%);
        transition: transform .3s ease-in-out;
        z-index: 999;
    }
    .navbar-menu.active { display: flex; transform: translateX(0); }
    .navbar-links { flex-direction: column; gap: 1.5rem; align-items: center; width: 100%; }
    .navbar-links a {
        font-size: 1.5rem;
        display: block;
        width: 100%;
        text-align: center;
        padding: 15px;
        border-bottom: 1px solid var(--border-color);
    }
    .content-grid, .info-grid { grid-template-columns: 1fr; }
    .desktop-switcher { display: block; margin-top: 2rem; }
}
@media (max-width: 576px) {
    .hero-header h1, .hero h1 { font-size: 2rem; }
    .container { padding: 0 15px; }
    .section { padding: 3rem 0; }
    .site-header { padding: 20px 24px; }
    .site-logo { font-size: 17px; }
    .error-code { letter-spacing: -3px; }
    .error-msg { letter-spacing: 4px; margin-top: -4px; }
    .beian-links { flex-direction: column; align-items: center; gap: 5px; }
}
