/* style.css - QDII 套利数据页面样式 */
/* 功能：定义页面的布局、颜色、字体等样式 */

/* 全局样式 */
* {
    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;
    margin-top: 82px; /* 为固定头部和基金列表标题留出空间 */
}

/* 固定头部区域 */
.fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: #fff;
    z-index: 100;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    height: 85px; /* 明确设置固定头部的高度 */
}

.header {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #e0e0e0;
}

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

.header h1 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

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

#back-button {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 5px 10px;
    color: #999;
}

.fund-code-detail {
    color: #999;
    font-size: 10px;
    font-weight: normal;
}

.wechat-icon {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    vertical-align: middle;
}

/* 基金列表标题 */
.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: center;
    font-weight: 600;
    color: #666;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: middle;
}

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

.fund-table-header th:nth-child(2),
.data-table td:nth-child(2) {
    width: 30%; /* 开仓收益列 */
}

.fund-table-header th:nth-child(3),
.data-table td:nth-child(3) {
    width: 30%; /* 平仓收益列 */
}

.fund-table-header th.sortable {
    cursor: pointer;
}

.fund-table-header th.sortable a {
    color: #666;
    text-decoration: none;
    display: block;
}

.fund-table-header th.sortable a:hover {
    color: #4CAF50;
}

/* 数据模块样式 - 模仿主网站列表样式 */
.data-modules {
    margin-top: 0;
}

.data-module {
    margin-bottom: 2px;
    border-radius: 4px;
    overflow: hidden;
    background: white;
}

.data-module a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.module-content {
    display: block;
}

/* 套利参考数据表格 - 模仿主网站列表样式 */
.data-section {
    padding: 0;
}

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

.data-table tr {
    border-bottom: 0.5px solid #f0f0f0;
}

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

.data-table tr:last-child {
    border-bottom: 1px solid #e0e0e0;
}

.data-table td {
    padding: 4px 6px;
    vertical-align: middle;
    line-height: 0.9;
    text-align: left;
}

.data-table td:first-child {
    text-align: left;
    padding-left: 10px;
}

.data-table td:nth-child(2),
.data-table td:nth-child(3) {
    text-align: center;
}

/* 套利计算表格样式 - 模仿主网站内页样式 */
.arbitrage-table {
    width: 100%;
    font-size: 13px;
}

.arbitrage-table th {
    background-color: #f9f9f9;
    color: #666;
    font-weight: 600;
    padding: 4px 6px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.arbitrage-table td {
    padding: 4px 6px;
    text-align: left;
    border-bottom: 0.5px solid #f0f0f0;
    vertical-align: middle;
    line-height: 0.9;
}

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

.arbitrage-table tr:last-child {
    border-bottom: 1px solid #e0e0e0;
}

.arbitrage-table td:first-child {
    text-align: left;
    padding-left: 10px;
}

.arbitrage-table td:nth-child(2),
.arbitrage-table td:nth-child(3) {
    text-align: center;
}

/* 收益颜色 */
.positive {
    color: #ff4d4f;
    font-weight: 500;
}

.negative {
    color: #52c41a;
    font-weight: 500;
}

.zero {
    color: #999;
}

/* 无数据提示 */
.no-data {
    text-align: center;
    padding: 20px 0;
    color: #999;
    font-size: 13px;
}

/* 交易日期底部显示 */
.trade-date-footer {
    text-align: center;
    padding: 12px 0;
    font-size: 12px;
    color: #7f8c8d;
    border-top: 1px solid #e0e0e0;
    margin-top: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
}

/* 页脚 */
footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 12px;
    color: #999;
    font-size: 11px;
    border-top: 1px solid #e0e0e0;
}

/* 更新动画 */
.updating {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

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

.container {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    padding-bottom: 70px; /* 为底部导航留出空间 */
}

/* 底部导航菜单样式 */
.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;
}

/* 自选开关样式 */
.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-table-header th:nth-child(1),
.data-table td:nth-child(1) {
    width: 45%;
}

.fund-table-header th:nth-child(2),
.data-table td:nth-child(2) {
    width: 20%;
}

.fund-table-header th:nth-child(3),
.data-table td:nth-child(3) {
    width: 20%;
}

.fund-table-header th:nth-child(4),
.data-table td:nth-child(4) {
    width: 15%;
    text-align: center;
}

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

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

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

    .header {
        padding: 15px 20px;
    }

    .header h1 {
        font-size: 18px;
    }

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

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

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

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

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

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

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

    .trade-date-footer {
        padding: 15px 0;
        font-size: 13px;
    }
}

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

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

    .header {
        padding: 20px 30px;
    }

    .header h1 {
        font-size: 20px;
    }

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

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

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

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

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

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

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

    .trade-date-footer {
        padding: 20px 0;
        font-size: 14px;
    }
}

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

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

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

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

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

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

/* 移动端响应式样式 - 平板 */
@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;
    }
}
