/* 基础样式 */
body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #0B3868;
    color: white;
    line-height: 1.6;
}

/* 头部样式 */
header {
    background-color: #0B3868;
    padding: 10px 5%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    height: auto; /* 改为自动高度以适应内容 */
    min-height: 80px; /* 设置最小高度 */
}

.header-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1200px; /* 增加最大宽度 */
    margin: 0 auto;
    gap: 20px; /* 添加元素间距 */
}

.logo-area, .auth-area {
    flex: 0 0 auto; /* 不增长不收缩，保持内容宽度 */
}

.logo {
    height: 80px;  /* 新尺寸 */
    max-height: 100px; /* 限制最大高度 */
    max-width: none; /* 移除宽度限制 */
    width: auto;    /* 保持原始宽高比 */
    transition: all 0.3s; /* 添加平滑过渡效果 */
}

.auth-area {
    flex: 0 0 auto; /* 不增长不收缩，保持内容宽度 */
    text-align: right;
}

/* 导航栏 */
nav {
    display: flex;
    flex: 1 1 auto; /* 允许导航栏增长和收缩 */
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    min-width: 300px; /* 设置最小宽度防止挤压 */
    padding: 10px 0; /* 添加上下内边距 */
}

nav a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    padding: 5px 12px;
    transition: color 0.3s;
    white-space: nowrap;
}

nav a:hover {
    color: #B89076;
}

/* 按钮样式 */
button, .btn {
    padding: 10px 20px;
    background: #B89076;
    color: black;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    transition: background 0.3s;
}

button:hover, .btn:hover {
    background: #d4a37e;
}

/* 横幅区域 */
.banner {
    width: 100%;
    padding-top: 56.6%; /* 精确比例：998/1764×100% */
    background-image: url('/images/banner.jpg');
    background-size: cover; /* 改为cover确保占满容器 */
    background-position: center center; /* 双重居中 */
    background-repeat: no-repeat;
    position: relative; /* 必须设定 */
    margin-bottom: 30px;
    overflow: hidden;
}

.banner-content {
   position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 800px;
    padding: 25px;
    background-color: rgba(11, 56, 104, 0.7);
    border-radius: 8px;
    text-align: center;
}

/* 弹窗样式 - 修复定位和输入问题 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    -webkit-overflow-scrolling: touch;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.modal form {
    background: white;
    margin: 15% auto;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: relative;
    width: 90%;
    max-width: 400px;
    color: #333;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-user-select: text;
    user-select: text;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.modal h2 {
    margin-top: 0;
    color: #333;
    font-size: 1.5em;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    -webkit-user-select: text;
    user-select: text;
}

/* 修复iOS输入框问题的关键样式 */
.modal input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 12px;
    margin: 10px 0;
    font-size: 16px; /* 重要：避免iOS自动缩放 */
    -webkit-appearance: none;
    -webkit-user-select: text;
    user-select: text;
    touch-action: manipulation;
    cursor: text;
    outline: none;
    -webkit-touch-callout: default;
}

.modal input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
    outline: none;
}

.modal button[type="submit"] {
    width: 100%;
    padding: 12px;
    margin-top: 15px;
}

.modal a {
    display: block;
    text-align: center;
    margin-top: 15px;
    color: #007bff;
    text-decoration: none;
    -webkit-user-select: none;
    user-select: none;
}

.modal a:hover {
    text-decoration: underline;
}

/* --- 新增：营销引擎页面特有样式 --- */
/* 为营销引擎页面的主内容区和搜索区域添加基础响应式类 */
.main-content {
    /* 保留原有样式 */
}

.search-section {
    /* 保留原有样式 */
}

/* 为营销引擎页面的搜索行和标签添加基础响应式类 */
.search-row {
    /* 保留原有样式 */
}

.search-label {
    /* 保留原有样式 */
}

.search-input, .result-box, .search-button {
    /* 保留原有样式 */
}

.result-container {
    /* 保留原有样式 */
}

/* --- 新增：营销引擎页面的移动端响应式规则 --- */
@media screen and (max-width: 768px) {
    /* 调整主内容区和搜索区域的内边距 */
    .main-content {
        padding: 10px;
        margin: 15px auto;
    }

    .search-section {
        padding: 10px;
    }

    /* 关键修改：让搜索行在小屏幕上变为垂直堆叠 */
    .search-row {
        flex-direction: column; /* 子元素垂直排列 */
        align-items: stretch; /* 子元素拉伸以填满容器宽度 */
        margin: 8px 0; /* 调整行间距 */
    }

    /* 关键修改：调整标签样式以适应垂直布局 */
    .search-label {
        width: auto; /* 取消固定宽度 */
        text-align: left; /* 文本左对齐更自然 */
        padding-right: 0; /* 移除右侧内边距 */
        padding-bottom: 5px; /* 在标签下方增加一点间距 */
        margin-top: 0; /* 重置顶部外边距 */
        font-weight: bold; /* 可选：加粗标签文字以突出 */
    }

    /* 关键修改：让输入框、结果框和按钮在垂直布局下占满宽度 */
    .search-input,
    .result-box,
    .search-button {
        width: 100%; /* 宽度100% */
        margin-left: 0; /* 移除左侧外边距 */
        margin-top: 5px; /* 在元素上方增加间距 */
        min-width: auto; /* 重置最小宽度 */
    }

    /* 关键修改：处理包含多个元素的行（如CIBM/QFI资格行） */
    /* 使用属性选择器定位这些特殊行 */
    .search-row:has(#CIBM_holding),
    .search-row:has(#QFI_holding),
    .search-row:has(#BondConnect_holding) {
        flex-wrap: wrap; /* 允许子元素换行 */
    }

    .search-row:has(#CIBM_holding) .search-label,
    .search-row:has(#QFI_holding) .search-label,
    .search-row:has(#BondConnect_holding) .search-label {
        flex: 0 0 auto; /* 不 grow, 不 shrink, 宽度自适应内容 */
        margin-right: 5px;
        margin-top: 5px;
    }

    .search-row:has(#CIBM_holding) .result-box,
    .search-row:has(#QFI_holding) .result-box,
    .search-row:has(#BondConnect_holding) .result-box {
        flex: 1 1 45%; /* grow 1, shrink 1, 基础大小 45% */
        min-width: 45%; /* 最小宽度 */
        margin-top: 5px;
        margin-right: 5px;
    }

    /* 移除每行最后一个结果框的右边距 */
    .search-row:has(#CIBM_holding) .result-box:last-child,
    .search-row:has(#QFI_holding) .result-box:last-child,
    .search-row:has(#BondConnect_holding) .result-box:last-child {
        margin-right: 0;
    }

    /* 关键修改：确保按钮在垂直布局下也能居中 */
    .search-row:has(#confirm_search),
    .search-row:has(#marketing_suggestion_btn) {
        align-items: center; /* 居中对齐子元素 */
    }

    .search-row:has(#confirm_search) .search-button,
    .search-row:has(#marketing_suggestion_btn) .search-button {
        align-self: center; /* 按钮自身居中 */
        width: auto; /* 按钮宽度自适应内容 */
        margin-top: 10px; /* 增加顶部间距 */
    }

    /* 调整结果容器在小屏幕下的间距 */
    .result-container {
        gap: 10px; /* 增大结果项之间的间距 */
    }
}
/* --- 新增结束 --- */


/* 移动端优化 */
@media (max-width: 768px) {
    .header-container {
        flex-direction: row; /* 保持行布局 */
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 10px;
    }
    
    .logo-area, .auth-area {
        order: 1; /* logo排第一 */
        flex: 0 0 100%; /* 占据整行 */
        text-align: center;
    }
    
    .auth-area {
        order: 2; /* 登录按钮排第二 */
        flex: 0 0 auto;
        text-align: center;
        margin: 0 auto;
    }
    
    nav {
        order: 3; /* 导航排第三 */
        flex: 0 0 100%; /* 占据整行 */
        justify-content: center;
        min-width: auto;
    }
    
    .banner {
        height: 250px;
    }
    
    .banner-content {
        padding: 20px;
    }
    
    button, .btn {
        padding: 12px 20px;
        width: 100%;
    }
    
    /* 移动端模态框优化 */
    .modal form {
        margin: 10% auto;
        width: 95%;
        padding: 20px;
    }
}

/* 电脑端优化 */
@media (min-width: 769px) {
    .banner {
        padding-top: 30%; /* 根据您的图片比例调整 */
    }
    
    .banner-content {
        padding: 40px;
    }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .banner {
        padding-top: 70%; /* 手机端微调比例 */
        background-position: center 30%; /* 优先显示图片上半部分 */
    }
}

@media (min-width: 769px) {
    .banner {
        padding-top: 56.6%; /* 保持精确比例 */
    }
}

/* 底部备案信息区域 */
.footer {
    background-color: #0B3868;
    padding: 30px 5%;
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    font-size: 14px;
    line-height: 1.8;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 10px;
}

.footer-links a {
    color: #B89076;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: #d4a37e;
    text-decoration: underline;
}

.icp-info {
    color: rgba(255,255,255,0.7);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .footer {
        padding: 20px 5%;
    }
    .footer-links {
        flex-direction: column;
        gap: 10px;
    }
}

/* 苹果手机兼容性优化 */
#authBtn, #showRegister, .modal button {
    -webkit-appearance: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    touch-action: manipulation;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

/* 重要：移除输入框的用户选择限制，允许输入 */
.modal input {
    -webkit-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
    cursor: text;
}

.modal {
    -webkit-overflow-scrolling: touch;
}

/* 确保模态框在iOS上正确显示 */
.modal-overlay {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* ---- 站点统一补充（2026-11-13）---- */
/* 页脚备案号在深蓝底上原为浏览器默认链接蓝，几乎不可读，这里统一为暖灰 */
.footer-links a { color: #B89076; text-decoration: none; }
.footer-links a:hover { color: #d4a37e; text-decoration: underline; }
.icp-info a { color: #c9b898; text-decoration: none; }
.icp-info a:hover { color: #e8d3b4; text-decoration: underline; }
.footer { padding-bottom: 24px; }
