/* OI反身性交易系统 - Web展示层样式表 */

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

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

/* 页头 */
.header {
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.header h1 {
    font-size: 28px;
    color: #2c3e50;
    margin-bottom: 10px;
}

.header .subtitle {
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 10px;
}

/* 冻结期提醒 */
.freeze-notice {
    font-size: 13px;
    font-weight: 600;
    color: #d35400;
    background-color: #fff3cd;
    border-left: 4px solid #ff9800;
    padding: 10px 15px;
    margin: 15px 0;
    border-radius: 4px;
    text-align: center;
}

.nav {
    display: flex;
    gap: 15px;
    border-top: 1px solid #e0e0e0;
    padding-top: 20px;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 5px;
    color: #3498db;
    background-color: #ecf0f1;
    transition: all 0.3s;
}

.nav-link:hover {
    background-color: #3498db;
    color: #fff;
}

.nav-link.active {
    background-color: #2980b9;
    color: #fff;
}

/* 更新按钮（导航栏样式） */
.nav-link.update-btn {
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.nav-link.update-btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
    opacity: 0.7;
}

/* 5条交易原则 */
.principles {
    background-color: #fff3cd;
    border-left: 5px solid #ffc107;
    padding: 20px 30px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.principles details summary {
    cursor: pointer;
    user-select: none;
    list-style: none;
}

.principles details summary::-webkit-details-marker {
    display: none;
}

.principles details summary h2 {
    font-size: 20px;
    color: #856404;
    margin: 0;
    display: inline-block;
}

.principles details summary h2::before {
    content: '▶ ';
    display: inline-block;
    transition: transform 0.3s;
}

.principles details[open] summary h2::before {
    transform: rotate(90deg);
}

.principles ul {
    list-style: none;
    padding-left: 0;
    margin-top: 15px;
}

.principles li {
    padding: 10px 0;
    border-bottom: 1px solid #fff3cd;
    color: #856404;
    font-weight: 500;
}

.principles li:last-child {
    border-bottom: none;
}

/* 更新时间 */
.update-info {
    text-align: right;
    padding: 10px 0;
    color: #7f8c8d;
    font-size: 14px;
}

/* 更新状态提示（导航栏内） */
.update-status {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 3px;
    font-weight: 600;
    white-space: nowrap;
}

.update-status.updating {
    color: #2980b9;
    background-color: #ebf5fb;
}

.update-status.success {
    color: #27ae60;
    background-color: #d5f4e6;
}

.update-status.error {
    color: #c0392b;
    background-color: #fadbd8;
}

/* 仪表板 */
.dashboard {
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.dashboard h2 {
    font-size: 22px;
    color: #2c3e50;
    margin-bottom: 20px;
}

/* 无数据提示 */
.no-data {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
}

.no-data p {
    font-size: 18px;
    margin-bottom: 10px;
}

.no-data ul {
    list-style: none;
    padding: 0;
    margin-top: 20px;
}

.no-data li {
    padding: 8px 0;
    color: #95a5a6;
}

/* 表格容器（20日视图需要横向滚动） */
.table-wrapper {
    overflow-x: auto;
}

/* 筛选结果表格 */
.screen-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    margin-top: 20px;
}

.screen-table thead {
    background-color: #34495e;
    color: #fff;
}

.symbol-header,
.date-header {
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    border: 1px solid #ddd;
}

.symbol-header {
    position: sticky;
    left: 0;
    background-color: #34495e;
    z-index: 10;
    min-width: 80px;
}

.date-header {
    min-width: 120px;
    font-size: 14px;
}

.symbol-cell {
    padding: 12px 8px;
    text-align: center;
    background-color: #ecf0f1;
    border: 1px solid #ddd;
    position: sticky;
    left: 0;
    z-index: 5;
}

.symbol-code {
    font-size: 12px;
    font-weight: 400;
    color: #7f8c8d;
}

.symbol-name {
    font-size: 14px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 3px;
}

.data-cell {
    padding: 8px;
    text-align: center;
    border: 1px solid #ddd;
    min-width: 120px;
    vertical-align: middle;
}

/* 单元格颜色编码 */
.cell-green {
    background-color: #d4edda;
    color: #155724;
}

.cell-yellow {
    background-color: #fff3cd;
    color: #856404;
}

.cell-orange {
    background-color: #ffe5b4;
    color: #cc5500;
}

.cell-forbidden {
    background-color: #f8d7da;
    color: #721c24;
    font-weight: 600;
}

.cell-empty {
    background-color: #f0f0f0;
    color: #bbb;
}

/* 单元格内容 */
.cell-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 13px;
}

.oi-percentile {
    font-size: 16px;
    font-weight: 700;
}

.consensus-level {
    font-size: 12px;
    font-weight: 600;
}

.position-advice {
    font-size: 12px;
    padding: 3px 6px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 3px;
}

.direction {
    font-size: 11px;
    color: #666;
}

.forbidden-badge {
    font-size: 14px;
    font-weight: 700;
    padding: 5px;
    background-color: rgba(220, 53, 69, 0.2);
    border-radius: 3px;
}

/* 20日视图紧凑模式 */
.cell-content-compact {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 12px;
}

.cell-content-compact .oi-percentile {
    font-size: 14px;
    font-weight: 700;
}

.holding-days {
    font-size: 11px;
    color: #666;
}

.forbidden-badge-small {
    font-size: 16px;
}

/* 图例 */
.legend {
    background-color: #fff;
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.legend h3 {
    font-size: 18px;
    color: #2c3e50;
    margin-bottom: 15px;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.legend-color {
    width: 30px;
    height: 30px;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.legend-item span:last-child {
    font-size: 14px;
    color: #555;
}

/* 分析逻辑说明（可折叠） */
.analysis-legend {
    background-color: #e7f3ff;
    border-left: 5px solid #2196f3;
    padding: 20px 30px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.analysis-legend details summary {
    cursor: pointer;
    user-select: none;
    list-style: none;
}

.analysis-legend details summary::-webkit-details-marker {
    display: none;
}

.analysis-legend details summary h2 {
    font-size: 18px;
    color: #1976d2;
    margin: 0;
    display: inline-block;
}

.analysis-legend details summary h2::before {
    content: '▶ ';
    display: inline-block;
    transition: transform 0.3s;
}

.analysis-legend details[open] summary h2::before {
    transform: rotate(90deg);
}

.analysis-content {
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.analysis-section {
    background-color: white;
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.analysis-section h3 {
    font-size: 16px;
    color: #2c3e50;
    margin-bottom: 10px;
}

.analysis-section ul {
    list-style: none;
    padding-left: 0;
}

.analysis-section li {
    padding: 5px 0;
    font-size: 13px;
    color: #555;
    line-height: 1.5;
}

/* 品种分析判断 */
.symbol-analysis {
    margin-top: 8px;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

/* 评级颜色 */
.analysis-rating-5 {
    background-color: #4caf50;
    color: white;
}

.analysis-rating-4 {
    background-color: #8bc34a;
    color: white;
}

.analysis-rating-3 {
    background-color: #ff9800;
    color: white;
}

.analysis-rating-2 {
    background-color: #78909c;  /* 蓝灰色 - 不那么抢眼 */
    color: white;
}

.analysis-rating-1 {
    background-color: #f44336;  /* 红色 - 禁止级别 */
    color: white;
}

.analysis-rating-0 {
    background-color: #9e9e9e;
    color: white;
}

/* 风险信号 */
.symbol-risks {
    margin-top: 5px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
}

.risk-badge {
    font-size: 10px;
    padding: 2px 6px;
    background-color: #ffebee;
    color: #c62828;
    border-radius: 3px;
    border: 1px solid #ef9a9a;
}

/* 操作建议容器 */
.action-advice-container {
    margin-top: 8px;
    padding: 8px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #2196f3;
}

.action-item {
    margin: 4px 0;
    font-size: 11px;
    line-height: 1.5;
}

.action-label {
    font-weight: 600;
    margin-right: 4px;
}

.action-holders {
    color: #2e7d32;
}

.action-new {
    color: #ed6c02;
}

.action-stage {
    color: #0288d1;
}

/* 允许/禁止行为容器 */
.behavior-container {
    margin-top: 8px;
    padding: 8px;
    background-color: #fff;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.behavior-item {
    margin: 4px 0;
    font-size: 11px;
    line-height: 1.5;
}

.behavior-label {
    font-weight: 600;
    margin-right: 4px;
}

.behavior-allowed {
    color: #388e3c;
}

.behavior-forbidden {
    color: #d32f2f;
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 20px;
    color: #7f8c8d;
    font-size: 13px;
}

.footer p {
    margin: 5px 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }

    .header {
        padding: 15px;
    }

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

    .header .subtitle {
        font-size: 12px;
    }

    /* 冻结期提醒 */
    .freeze-notice {
        font-size: 11px;
        padding: 8px 10px;
        margin: 10px 0;
    }

    /* 导航栏：手机端竖向排列 */
    .nav {
        flex-direction: column;
        gap: 10px;
        padding-top: 15px;
    }

    .nav-link {
        width: 100%;
        text-align: center;
        padding: 10px;
        font-size: 15px;
    }

    .nav-link.update-btn {
        font-size: 15px;
    }

    .update-status {
        width: 100%;
        text-align: center;
        padding: 8px;
        font-size: 13px;
    }

    /* 5条原则 */
    .principles {
        padding: 12px 15px;
    }

    .principles details summary h2 {
        font-size: 16px;
    }

    .principles li {
        font-size: 12px;
        padding: 8px 0;
    }

    /* 分析逻辑 */
    .analysis-legend {
        padding: 12px 15px;
    }

    .analysis-legend details summary h2 {
        font-size: 15px;
    }

    .analysis-content {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .analysis-section {
        padding: 12px;
    }

    .analysis-section h3 {
        font-size: 14px;
    }

    .analysis-section li {
        font-size: 12px;
    }

    /* 仪表板 */
    .dashboard {
        padding: 15px 10px;
    }

    .dashboard h2 {
        font-size: 18px;
    }

    /* 表格优化 */
    .table-wrapper {
        margin: 0 -10px;
        padding: 0 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .screen-table {
        font-size: 11px;
    }

    .symbol-header {
        min-width: 60px;
        font-size: 13px;
        padding: 10px 5px;
    }

    .date-header {
        min-width: 50px;  /* 从70px缩小到50px */
        font-size: 11px;
        padding: 8px 3px;
    }

    .symbol-cell {
        min-width: 60px;
        padding: 8px 5px;
    }

    .symbol-name {
        font-size: 13px;
    }

    .symbol-code {
        font-size: 10px;
    }

    .data-cell {
        min-width: 50px;  /* 从70px缩小到50px */
        padding: 4px 2px;
    }

    /* 5日视图：品种分析简化 */
    .symbol-analysis {
        font-size: 13px;
        padding: 5px 8px;
        margin-top: 6px;
    }

    /* 手机端只显示星星 */
    .analysis-stars {
        display: inline;
        font-size: 10px;  /* 缩小 */
    }

    .analysis-detail {
        display: none;  /* 隐藏详细文字 */
    }

    /* 隐藏风险信号 */
    .symbol-risks {
        display: none;
    }

    /* 操作建议：手机端隐藏 */
    .action-advice-container {
        display: none;
    }

    /* 允许/禁止行为：手机端隐藏 */
    .behavior-container {
        display: none;
    }

    /* 单元格内容 */
    .cell-content {
        gap: 3px;
        font-size: 11px;
    }

    .oi-percentile {
        font-size: 10px;  /* 从14px缩小到10px */
    }

    .consensus-level {
        font-size: 9px;  /* 显示共识等级，字体缩小 */
    }

    .position-advice {
        display: none;  /* 隐藏持仓建议 */
    }

    .direction {
        display: none;  /* 隐藏价格和OI方向 */
    }

    .forbidden-badge {
        font-size: 12px;
        padding: 4px;
    }

    /* 20日视图紧凑模式 */
    .cell-content-compact {
        gap: 2px;
        font-size: 10px;
    }

    .cell-content-compact .oi-percentile {
        font-size: 9px;  /* 从12px缩小到9px */
    }

    .holding-days {
        display: none;  /* 隐藏持仓天数 */
    }

    /* 图例 */
    .legend {
        padding: 15px;
    }

    .legend h3 {
        font-size: 16px;
    }

    .legend-items {
        flex-direction: column;
        gap: 12px;
    }

    .legend-item {
        font-size: 13px;
    }

    .legend-color {
        width: 25px;
        height: 25px;
    }

    /* 页脚 */
    .footer {
        padding: 15px 10px;
        font-size: 11px;
    }

    .footer p {
        margin: 3px 0;
    }
}
