/**
 * 微信公众号页面样式
 * 基金数据展示专用样式
 */

/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    padding: 20px;
    max-width: 100%;
    overflow-x: hidden;
}

/* 容器样式 */
.container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    padding: 0;
}

/* 数据卡片 */
.data-card {
    padding: 1px 20px 2px 20px;
}

.data-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 0;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.data-item:hover {
    background-color: #fafafa;
}

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

.curve-section {
    padding: 0px 0;
    border-bottom: 1px solid #f0f0f0;
}

.curve-container {
    width: 100%;
}

.curve-canvas-wrapper {
    width: 100%;
    height: 80px;
    overflow: hidden;
}

.curve-x-axis {
    display: flex;
    justify-content: space-between;
    padding: 0 5px;
    margin-top: 5px;
}

.curve-x-axis span {
    font-size: 11px;
    color: #999;
}

.data-label {
    font-size: 16px;
    color: #666;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.data-label i {
    margin-right: 10px;
    color: #1a8cff;
    font-size: 18px;
}

.data-value {
    font-size: 18px;
    font-weight: 600;
    text-align: right;
}

.data-value.highlight {
    color: #e74c3c;
    font-size: 20px;
}

.data-value.positive {
    color: #2ecc71;
}

.data-value.neutral {
    color: #3498db;
}

.data-value.threshold {
    color: #888;
    font-size: 16px;
    font-weight: 500;
}

/* 溢价率特别样式 */
.data-value.premium {
    color: #9b59b6;
    font-size: 20px;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 年化收益率样式 */
.data-value.annualized {
    color: #e67e22;
    font-size: 19px;
    font-weight: 700;
    position: relative;
}

.data-value.annualized::before {
    content: "≈";
    font-size: 14px;
    margin-right: 4px;
    opacity: 0.7;
}

.data-unit {
    font-size: 14px;
    color: #999;
    margin-left: 4px;
    font-weight: normal;
}

/* 溢价率单位样式 */
.premium-unit {
    font-size: 15px;
    color: #9b59b6;
    margin-left: 6px;
    font-weight: 600;
    background: rgba(155, 89, 182, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
}

/* 年化收益率单位样式 */
.annualized-unit {
    font-size: 13px;
    color: #e67e22;
    margin-left: 6px;
    font-weight: 500;
    opacity: 0.9;
}

/* 状态标签 */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 10px;
    vertical-align: middle;
}

.status-live {
    background-color: rgba(46, 204, 113, 0.1);
    color: #e74c3c;
}

.status-gray {
    background-color: rgba(26, 140, 255, 0.1);
    color: #1a8cff;
}

.status-closed {
    background-color: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

/* 实时更新状态 */
.update-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #7f8c8d;
    padding: 8px 20px;
    background-color: #f9f9f9;
    border-top: 1px solid #f0f0f0;
}

.auto-update-indicator {
    display: flex;
    align-items: center;
}

.auto-update-indicator .indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
    animation: pulse 1s infinite;
}

.auto-update-indicator.active .indicator {
    background-color: #2ecc71;
}

.auto-update-indicator.inactive .indicator {
    background-color: #e74c3c;
}

.update-interval {
    color: #95a5a6;
}

/* 修改：历史数据模块样式调整 */
.history-section {
    /* 缩小模块与上方的边距 */
    padding: 10px 20px; /* 上边距从20px减少到10px */
    border-top: 1px solid #f0f0f0;
    background-color: #fff;
}

.section-header {
    margin-bottom: 2px; /* 略微减小标题下方的边距 */
    text-align: center;
}

.section-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.section-subtitle {
    font-size: 13px;
    color: #7f8c8d;
    font-weight: 500;
}

.history-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #fff;
}

.no-history {
    padding: 40px 20px;
    text-align: center;
    color: #95a5a6;
    font-size: 16px;
}

.history-table-container {
    overflow-x: hidden;
}

/* 修改：调整表格样式以适配5列显示 */
.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px; /* 字体略微调小，以便五列能在一行内显示 */
    table-layout: fixed;
}

.history-table thead {
    background-color: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* 修改：缩小表格头部单元格的内边距 */
.history-table th {
    padding: 1px 1px; /* 减小内边距 */
    text-align: center;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #e0e0e0;
}

/* 修改：缩小表格数据单元格的内边距 */
.history-table td {
    padding: 1px 1px; /* 减小内边距 */
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
    word-break: break-all;
}

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

.history-table tbody tr:last-child td {
    border-bottom: none;
}

/* 误差样式 */
.error {
    font-weight: 600;
    border-radius: 4px;
    padding: 1px 1px;
    display: inline-block;
}

.error.positive {
    color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.1);
}

.error.negative {
    color: #2ecc71;
    background-color: rgba(46, 204, 113, 0.1);
}

.error.zero {
    color: #95a5a6;
    background-color: rgba(149, 165, 166, 0.1);
}

.history-summary {
    padding: 12px 8px;
    text-align: center;
    font-size: 12px;
    color: #7f8c8d;
    border-top: 1px solid #f0f0f0;
    background-color: #f8f9fa;
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 13px;
    border-top: 1px solid #f0f0f0;
    background-color: #fcfcfc;
}

.update-time {
    color: #666;
    font-size: 13px;
    margin-top: 5px;
}

/* 响应式调整 */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .container {
        border-radius: 10px;
    }
    
    .data-card {
        padding: 1px 15px 2px 15px;
    }
    
    .data-item {
        padding: 2px 0;
    }
    
    .data-label {
        font-size: 15px;
    }
    
    .data-value {
        font-size: 16px;
    }
    
    .data-value.threshold {
        font-size: 14px;
    }
    
    .data-value.premium {
        font-size: 18px;
    }
    
    .data-value.annualized {
        font-size: 17px;
    }
    
    .premium-unit {
        font-size: 13px;
        padding: 2px 6px;
    }
    
    /* 修改：移动端进一步调整历史数据模块边距 */
    .history-section {
        padding: 1px 1px; /* 移动端也减小边距 */
    }
    
    .section-header h3 {
        font-size: 16px;
    }
    
    /* 修改：移动端表格字体更小，内边距更小 */
    .history-table {
        font-size: 11px;
    }
    
    .history-table th,
    .history-table td {
        padding: 6px 4px; /* 移动端进一步减小内边距 */
    }
    
    .error {
        min-width: 50px;
        padding: 2px 4px;
    }
}

/* 动画效果 */
@keyframes pulse {
    0% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
    100% {
        opacity: 0.6;
        transform: scale(1);
    }
}

/* 添加在现有样式之后 */

.no-data-hint {
    font-size: 12px;
    color: #95a5a6;
    margin-top: 5px;
}

/* 表格单元格的悬停提示 */
.history-table td[title] {
    position: relative;
    cursor: help;
}

.history-table td[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 100;
    margin-bottom: 5px;
}

/* 修改：调整列宽以适应五列显示 */
.history-table td:nth-child(4) {
    min-width: 70px; /* 误差列宽度略微减小 */
}

/* 新增：为规模变动列设置合适的最小宽度 */
.history-table td:nth-child(5) {
    min-width: 90px;
}

/* 新增：为511520基金的6列表格设置一致的列宽 */
.history-table td:nth-child(1),
.history-table th:nth-child(1) {
    width: 12%; /* 交易日期/日期列 */
}

.history-table td:nth-child(2),
.history-table th:nth-child(2) {
    width: 14%; /* 单位净值/净值列 */
}

.history-table td:nth-child(3),
.history-table th:nth-child(3) {
    width: 14%; /* 盘中估值/预测净值列 */
}

.history-table td:nth-child(4),
.history-table th:nth-child(4) {
    width: 14%; /* 实时价格列 */
}

.history-table td:nth-child(5),
.history-table th:nth-child(5) {
    width: 14%; /* 误差/万列 */
}

.history-table td:nth-child(6),
.history-table th:nth-child(6) {
    width: 18%; /* 实际溢价率列 */
}

/* Tab页样式 - 从index.php迁移过来 */
.fund-tabs {
    display: flex;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.fund-tab {
    flex: 1;
    text-align: center;
    padding: 15px 5px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    text-decoration: none;
    position: relative;
}

.fund-tab:hover {
    color: rgba(255, 255, 255, 0.9);
    background-color: rgba(255, 255, 255, 0.1);
}

.fund-tab.active {
    color: white;
    font-weight: 600;
    border-bottom-color: white;
}

.fund-tab .fund-code {
    display: block;
    font-size: 12px;
    opacity: 0.8;
    margin-top: 2px;
    font-weight: normal;
}

/* 511880 Tab - 蓝色主题 */
.fund-tab-511880 {
    background: linear-gradient(135deg, #1a8cff, #0066cc);
}

.fund-tab-511880.active {
    border-bottom-color: #0047b3;
    background: linear-gradient(135deg, #0066cc, #0047b3);
}

/* 511360 Tab - 绿色主题 */
.fund-tab-511360 {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
}

.fund-tab-511360.active {
    border-bottom-color: #1e8449;
    background: linear-gradient(135deg, #27ae60, #1e8449);
}

/* 511520 Tab - 紫色主题 */
.fund-tab-511520 {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
}

.fund-tab-511520.active {
    border-bottom-color: #7d3c98;
    background: linear-gradient(135deg, #8e44ad, #7d3c98);
}

/* 响应式调整Tab页 */
@media (max-width: 480px) {
    .fund-tabs {
        padding: 0 10px;
    }
    
    .fund-tab {
        padding: 1px 3px;
        font-size: 14px;
    }
    
    .fund-tab .fund-code {
        font-size: 11px;
    }
    
    .fund-title h1 {
        font-size: 18px;
    }
    
    .fund-subtitle {
        font-size: 14px;
    }
}

/* 基金信息模块样式 */
.fund-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #f0f0f0;
}

.fund-info-left {
    display: flex;
    align-items: center;
}

.fund-info-right {
    display: flex;
    align-items: center;
}

.fund-name {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
    margin-right: 10px;
}

.fund-code-display {
    font-size: 16px;
    color: #666;
    background-color: #e9ecef;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
}

/* 响应式调整基金信息模块 */
@media (max-width: 480px) {
    .fund-info {
        padding: 10px 15px;
    }
    
    .fund-name {
        font-size: 16px;
    }
    
    .fund-code-display {
        font-size: 14px;
        padding: 3px 8px;
    }
}

/* 底部导航栏样式 */
.bottom-nav {
    position: relative;
    background-color: #fff;
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 56px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    margin-top: 20px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-decoration: none;
    color: #999;
    font-size: 12px;
    flex: 1;
    height: 100%;
    justify-content: center;
}

.nav-item.active {
    color: #1a8cff;
}

.nav-icon {
    font-size: 20px;
}

/* 移除为底部导航栏预留的空间 */
body {
    padding-bottom: 20px;
}