/* style.css - 基金估值列表页面样式 */
/* 功能：定义页面的布局、颜色、字体等样式 */

/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* 容器样式 */
.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 10px;
    background-color: #fff;
    padding-top: 115px; /* 为固定头部和基金列表标题留出空间 */
}

/* 固定头部区域 */
.fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: #fff;
    z-index: 100;
    border-bottom: 1px solid #e0e0e0;
    padding: 0px;
    margin: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 基金列表标题表格样式 */
.fund-table-header {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin: 0;
    padding: 0;
    border-top: 1px solid #e0e0e0;
}

/* 基金列表标题样式 */
.fund-table-header th {
    background-color: #f9f9f9;
    padding: 4px 6px;
    text-align: left;
    font-weight: 600;
    color: #666;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: middle;
    white-space: nowrap;
}

/* 溢价率表头样式 */
.premium-header {
    font-size: 12px;
}

.premium-links,
.fund-name-header-links {
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.premium-links a,
.fund-name-header-links a {
    color: #1890ff;
    text-decoration: none;
    white-space: nowrap;
}

.premium-links a:hover,
.fund-name-header-links a:hover {
    text-decoration: underline;
}

.premium-links .separator,
.fund-name-header-links .separator {
    margin: 0 2px;
    color: #999;
}

/* 为表头和表格内容设置相同的列宽 */
.fund-table-header th:nth-child(1),
.fund-table td:nth-child(1) {
    width: 40%; /* 基金名称列 */
}

.fund-table-header th:nth-child(2),
.fund-table td:nth-child(2) {
    width: 30%; /* 溢价率列 */
}

.fund-table-header th:nth-child(3),
.fund-table td:nth-child(3) {
    width: 15%; /* 场内价格列 */
}

.fund-table-header th:nth-child(4),
.fund-table td:nth-child(4) {
    width: 15%; /* 自选列 */
    text-align: center;
}

/* 头部样式 */
.header {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: 1px solid #e0e0e0;
    padding-right: 10px;
}

.header-content {
    display: flex;
    align-items: center;
    flex: 1;
}

.header-info {
    font-size: 18px;
    color: #666;
    margin-left: auto;
}

#search-toggle {
    margin-left: auto;
}

/* 微信图标样式 */
.wechat-icon {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    vertical-align: middle;
}

/* 详情页微信图标样式 */
.header-info .wechat-icon {
    width: 18px;
    height: 18px;
    margin-right: 6px;
}

/* 标题样式 */
h1 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: #333;
}

/* 搜索功能样式 */
.search-button {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s;
    color: #999;
}

.search-button:hover {
    color: #666;
    background-color: #f0f0f0;
}

.search-box {
    margin: 0;
    display: flex;
    align-items: center;
    background-color: transparent;
    padding: 0;
    border: none;
    display: none;
}

.search-box input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
    background-color: white;
}

.search-submit {
    padding: 6px 12px;
    background-color: #f9f9f9;
    color: #666;
    border: 1px solid #e0e0e0;
    border-left: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.search-submit:hover {
    background-color: #f0f0f0;
}

/* Tab切换样式 */
.tab-container {
    display: flex;
    margin: 0;
    padding: 0;
    border-bottom: 1px solid #e0e0e0;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 1px solid transparent;
}

.tab-btn:hover {
    color: #333;
}

.tab-btn.active {
    color: #4CAF50;
    border-bottom-color: #4CAF50;
}

/* 表格样式 */
.fund-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

/* 表头样式 */
.fund-table th {
    background-color: #f9f9f9;
    padding: 4px 6px;
    text-align: left;
    font-weight: 600;
    color: #666;
    border-bottom: 1px solid #e0e0e0;
}

/* 可排序表头样式 */
.sortable {
    cursor: pointer;
}

.sortable a {
    color: #1890ff;
    text-decoration: none;
    display: block;
}

.sortable a:hover {
    text-decoration: underline;
}

/* 表格行样式 */
.fund-table tr {
    border-bottom: 0.5px solid #f0f0f0;
}

.fund-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* 表格单元格样式 */
.fund-table td {
    padding: 4px 6px;
    vertical-align: middle;
    line-height: 0.9;
    text-align: left;
}

/* 基金名称样式 */
.fund-name {
    font-weight: 500;
    color: #333;
}

.fund-code {
    font-size: 11px;
    color: #999;
}

/* 限额状态样式 */
.limit-status {
    font-size: 10px;
    color: #ff4d4f;
    font-weight: normal;
}

/* 成交额样式 */
.turnover {
    font-size: 10px;
    color: #1890ff;
    font-weight: normal;
    margin-left: 4px;
}

/* 溢价率样式 */
.premium-rate {
    font-weight: 500;
}

/* 溢价率正数样式 */
.premium-positive {
    color: #ff4d4f;
}

/* 溢价率负数样式 */
.premium-negative {
    color: #52c41a;
}

/* 溢价率零样式 */
.premium-zero {
    color: #999;
}

/* 最新价格样式 */
.latest-price {
    font-weight: 500;
}

/* 涨跌幅样式 */
.change-percent {
    font-size: 12px;
}

/* 正涨幅样式 */
.positive {
    color: #ff4d4f;
}

/* 负涨幅样式 */
.negative {
    color: #52c41a;
}

/* 零涨幅样式 */
.zero {
    color: #999;
}

/* 微信公众号规则适配 */
body {
    -webkit-tap-highlight-color: transparent;
    -webkit-overflow-scrolling: touch;
}

.container {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* 自选开关样式 */
.custom-column {
    text-align: center;
}

.switch {
    position: relative;
    display: inline-block;
    width: 30px;
    height: 15px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 15px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 11px;
    width: 11px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #52c41a;
}

input:focus + .slider {
    box-shadow: 0 0 1px #52c41a;
}

input:checked + .slider:before {
    transform: translateX(15px);
}

/* 基金详情页面样式 */
.fund-detail {
    padding: 0px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.fund-info {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.fund-info h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
}

.fund-info .fund-code {
    font-size: 14px;
    color: #999;
    margin: 0;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 14px;
    color: #666;
}

.detail-value {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

/* 基金代码样式 */
h1 .fund-code-detail {
    color: #999;
    font-size: 10px;
    font-weight: normal;
}

/* 更新时间样式 */
.update-time {
    font-size: 10px;
    color: #ff4d4f;
    margin-top: 2px;
}

/* 固定统计信息样式 */
.fixed-stats {
    padding: 8px 10px;
    background-color: #f9f9f9;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
}

.stat-row {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: nowrap;
    margin-bottom: 8px;
}

.stat-row:last-child {
    margin-bottom: 0;
}

.stat-item {
    display: flex;
    align-items: center;
    padding: 0 5px;
    white-space: nowrap;
}

.stat-label {
    font-size: 12px;
    color: #666;
    margin-right: 5px;
}

.stat-value {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

/* 底部导航菜单样式 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    border-top: 1px solid #e0e0e0;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px 0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #333;
    padding: 8px 20px;
    border-radius: 20px;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.nav-item:hover {
    background: #e3f2fd;
    color: #1976d2;
    transform: translateY(-2px);
}

.nav-text {
    font-size: 14px;
    font-weight: 500;
}

/* 为容器添加底部空间 */
.container {
    padding-bottom: 70px; /* 为底部导航留出空间 */
}

/* 历史数据模块样式 */
.history-section {
    margin-top: 10px;
    padding: 10px 0;
    background-color: #f9f9f9;
    border-radius: 0;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}

.history-section h2 {
    margin-bottom: 10px;
    color: #333;
    font-size: 16px;
    text-align: center;
}

.history-table-container {
    overflow-x: auto;
    width: 100%;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.history-table th,
.history-table td {
    padding: 6px 4px;
    text-align: center;
    border-bottom: 1px solid #eee;
}

.history-table th {
    background-color: #f5f5f5;
    font-weight: bold;
    color: #333;
    font-size: 11px;
}

.history-table tr:hover {
    background-color: #f5f5f5;
}

/* NewQD基金样式 */
.newqd-section-header {
    background-color: #f9f9f9 !important;
}

.newqd-section-header td {
    padding: 8px 14px !important;
    font-size: 12px !important;
    color: #666 !important;
    font-weight: 500 !important;
    border-top: 1px solid #e0e0e0 !important;
    border-bottom: 1px solid #e0e0e0 !important;
}

.newqd-fund-row {
    background-color: #fafafa;
}

.newqd-fund-row:hover {
    background-color: #f5f5f5 !important;
}

.newqd-fund-row .fund-code {
    font-size: 11px;
    color: #999;
}

.newqd-limit {
    font-size: 11px;
    margin-left: 4px;
}

.module-title {
    background-color: #f9f9f9;
    color: #333;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 600;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
}

#newqd-custom-module {
    display: none;
}

#newqd-custom-module .fund-table-header {
    position: static !important;
}

/* ========== 完整的响应式设计 ========== */

/* PC端响应式样式 - 中等屏幕 (平板) */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    .container {
        max-width: 768px;
        padding: 20px;
        padding-top: 130px;
    }

    .fixed-header {
        padding: 0 20px;
    }

    .fund-table {
        font-size: 14px;
    }

    .fund-table th,
    .fund-table td {
        padding: 10px 8px;
    }

    .fixed-stats {
        padding: 12px 20px;
    }

    .stat-label {
        font-size: 13px;
    }

    .stat-value {
        font-size: 15px;
    }

    .nav-item {
        padding: 12px 30px;
    }

    .nav-text {
        font-size: 15px;
    }

    h1 {
        font-size: 18px;
    }

    .history-table {
        font-size: 14px;
    }

    .history-table th,
    .history-table td {
        padding: 8px 6px;
    }

    .module-title {
        padding: 12px 20px;
        font-size: 15px;
    }

    .bottom-nav {
        padding: 15px 0;
    }
}

/* PC端响应式样式 - 大屏幕 (桌面) */
@media screen and (min-width: 1025px) {
    .container {
        max-width: 1200px;
        padding: 30px;
        padding-top: 150px;
    }

    .fixed-header {
        padding: 0 30px;
    }

    .fund-table {
        font-size: 15px;
    }

    .fund-table th,
    .fund-table td {
        padding: 12px 10px;
    }

    .fixed-stats {
        padding: 15px 30px;
    }

    .stat-label {
        font-size: 14px;
    }

    .stat-value {
        font-size: 16px;
    }

    .nav-item {
        padding: 15px 40px;
    }

    .nav-text {
        font-size: 16px;
    }

    h1 {
        font-size: 20px;
    }

    .history-table {
        font-size: 15px;
    }

    .history-table th,
    .history-table td {
        padding: 10px 8px;
    }

    .module-title {
        padding: 15px 20px;
        font-size: 16px;
    }

    .bottom-nav {
        padding: 20px 0;
    }
}

/* 移动端响应式样式 - 小屏幕 */
@media screen and (max-width: 480px) {
    .container {
        padding: 10px;
        padding-top: 115px;
    }

    h1 {
        font-size: 16px;
        margin-bottom: 10px;
    }

    .fund-table {
        font-size: 13px;
    }

    .fund-table th,
    .fund-table td {
        padding: 8px 6px;
    }

    .fund-code {
        font-size: 11px;
    }

    .fixed-stats {
        padding: 6px 8px;
    }

    .stat-row {
        margin-bottom: 6px;
    }

    .stat-item {
        padding: 0 3px;
    }

    .stat-label {
        font-size: 11px;
        margin-right: 3px;
    }

    .stat-value {
        font-size: 12px;
    }
}

/* 移动端响应式样式 - 平板 */
@media (max-width: 768px) {
    .history-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .history-table {
        min-width: 100%;
    }

    .history-table th,
    .history-table td {
        padding: 4px 2px;
        font-size: 12px;
    }

    .history-table th {
        font-size: 10px;
    }
}
