* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px 20px 20px;
}

header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

header h1 {
    font-size: 24px;
    font-weight: 500;
    color: #fff;
    margin: 0;
}

/* 顶部菜单 */
.top-menu {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.menu-btn {
    padding: 8px 16px;
    border: 1px solid #444;
    border-radius: 4px;
    background-color: #333;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    white-space: nowrap;
}

.menu-btn:hover {
    background-color: #444;
}

.menu-btn.active {
    background-color: #4caf50;
    border-color: #4caf50;
}

/* 页面内容切换 */
.page-content {
    display: none;
}

.page-content.active {
    display: block;
}

section {
    background-color: #242424;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 15px 20px;
    margin-bottom: 20px;
}

section h2 {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 15px;
    color: #fff;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.status-panel .status-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
}

.status-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 15px;
    text-align: center;
}

.status-item label {
    font-size: 12px;
    color: #999;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.status-item span {
    font-size: 24px;
    color: #fff;
    font-weight: 600;
    line-height: 1.2;
}

.status-item span.status-running {
    color: #4caf50;
}

.status-item span.status-stopped {
    color: #999;
}

.status-item span.status-up {
    color: #4caf50;
}

.status-item span.status-down {
    color: #f44336;
}

.status-item span.price-up {
    color: #f44336 !important;  /* 红色 - 上涨 */
    transition: color 0.3s;
    font-size: 32px;  /* 调大字体 */
    font-weight: 700;
}

.status-item span.price-down {
    color: #4caf50 !important;  /* 绿色 - 下跌 */
    transition: color 0.3s;
    font-size: 32px;  /* 调大字体 */
    font-weight: 700;
}

.status-item span.countdown-normal {
    color: #2196f3;  /* 蓝色 - 正常 */
}

.status-item span.countdown-warning {
    color: #ff9800;  /* 橙色 - 警告 */
}

.status-item span.countdown-danger {
    color: #f44336;  /* 红色 - 危险 */
    font-weight: bold;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
}

.stat-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 15px;
    text-align: center;
}

.stat-item label {
    font-size: 12px;
    color: #999;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.stat-item .stat-number {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-item .stat-total {
    color: #2196f3;  /* 蓝色 - 总数 */
}

.stat-item .stat-correct {
    color: #4caf50;  /* 绿色 - 正确 */
}

.stat-item .stat-error {
    color: #f44336;  /* 红色 - 错误 */
}

.stat-item .stat-rate {
    color: #ff9800;  /* 橙色 - 胜率 */
}

.stat-item .stat-pnl-positive {
    color: #4caf50;
}

.stat-item .stat-pnl-negative {
    color: #f44336;
}

/* 预测记录面板 */
.predictions-panel {
    position: relative;
}

.predictions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.predictions-header h2 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.date-selector {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.date-selector input[type="date"] {
    background-color: #1a1a1a;
    border: 1px solid #444;
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 13px;
    min-width: 140px;
}

.date-selector button {
    background-color: #333;
    border: 1px solid #444;
    color: #fff;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.date-selector button:hover {
    background-color: #444;
}

.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #333;
}

.pagination button {
    padding: 6px 12px;
    font-size: 12px;
}

.pagination span {
    color: #ccc;
    font-size: 13px;
}

.countdown-display {
    color: #ff9800 !important;
    font-weight: 500;
    font-family: 'Courier New', monospace;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;  /* 等分布局 */
}

table thead {
    background-color: #1a1a1a;
}

table th {
    padding: 12px 8px;
    text-align: center;
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #333;
    white-space: nowrap;
}

table th:nth-child(1) { width: 12%; }  /* 时间 */
table th:nth-child(2) { width: 12%; }  /* 方向 */
table th:nth-child(3) { width: 22%; } /* 开始价格 */
table th:nth-child(4) { width: 22%; } /* 结束价格 */
table th:nth-child(5) { width: 12%; } /* 置信度 */
table th:nth-child(6) { width: 20%; } /* 结果 */

table td {
    padding: 12px 8px;
    border-bottom: 1px solid #2a2a2a;
    font-size: 13px;
    color: #e0e0e0;
    white-space: nowrap;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
}

table tbody tr:hover {
    background-color: #2a2a2a;
}

.result-pending {
    color: #ff9800 !important;  /* 橙色 - 结算中 */
    font-weight: 500;
}

.status-completed {
    color: #fff;
}

.result-correct {
    color: #4caf50;
}

.result-incorrect {
    color: #f44336;
}

.direction-up {
    color: #4caf50 !important;  /* 绿色 - 上涨 */
    font-weight: 500;
}

.direction-down {
    color: #f44336 !important;  /* 红色 - 下跌 */
    font-weight: 500;
}

.auto-trade-dot {
    color: #ffeb3b;
    font-size: 11px;
    margin-left: 4px;
    vertical-align: middle;
}

/* 日志面板 */
.logs-panel {
    background-color: #242424;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 15px 20px;
    margin-bottom: 20px;
}

.logs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.logs-header h2 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.logs-container {
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 12px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    height: 150px;
    overflow-y: auto;
    color: #e0e0e0;
    line-height: 1.8;
}

.log-entry {
    margin-bottom: 2px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.log-timestamp {
    color: #999;
    margin-right: 8px;
}

.log-message {
    color: #e0e0e0;
}

.log-error {
    color: #f44336;
}

.log-warning {
    color: #ff9800;
}

.log-success {
    color: #4caf50;
}

.log-signal {
    color: #03a9f4 !important;  /* 蓝色 - 新信号 */
    font-weight: 500;
}

.log-training {
    color: #4caf50 !important;  /* 绿色 - 训练完成 */
    font-weight: 500;
}

.log-settlement {
    color: #4caf50 !important;  /* 橙色 - 结算完成 */
    font-weight: 500;
}

.log-cooldown {
    color: #ff9800 !important;  /* 紫色 - 冷却事件 */
    font-weight: bold !important;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-primary {
    background-color: #333;
    color: #fff;
    border: 1px solid #444;
}

.btn-primary:hover {
    background-color: #444;
}

.btn-secondary {
    background-color: #2a2a2a;
    color: #fff;
    border: 1px solid #444;
}

.btn-secondary:hover {
    background-color: #333;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 配置面板 */
.config-panel {
    background-color: #242424;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 15px 20px;
    margin-bottom: 20px;
}

.config-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.config-section {
    background-color: #1a1a1a;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #333;
}

.config-section h3 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 15px;
    color: #fff;
    border-bottom: 1px solid #333;
    padding-bottom: 8px;
}

.form-group {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
}

.form-group label {
    font-size: 13px;
    color: #ccc;
    min-width: 150px;
    flex-shrink: 0;
}

.form-hint {
    font-size: 12px;
    color: #888;
    line-height: 1.5;
    margin-top: 4px;
}

.form-group input[type="text"],
.form-group input[type="number"] {
    flex: 1;
    background-color: #242424;
    border: 1px solid #444;
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 13px;
    min-width: 0;
}

.form-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

.config-buttons {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    justify-content: center;
    padding-top: 20px;
    border-top: 1px solid #333;
    flex-wrap: wrap;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header {
        flex-direction: column;
        align-items: stretch;
    }
    
    header h1 {
        font-size: 20px;
    }
    
    .top-menu {
        justify-content: space-between;
        width: 100%;
    }
    
    .menu-btn {
        flex: 1;
        min-width: calc(50% - 5px);
        font-size: 13px;
        padding: 8px 12px;
    }
    
    section {
        padding: 12px 15px;
    }
    
    .status-panel .status-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0;
    }
    
    .status-item span {
        font-size: 20px;
    }
    
    .status-item span.price-up,
    .status-item span.price-down {
        font-size: 28px;  /* 移动端价格字体 */
    }
    
    .stat-item .stat-number {
        font-size: 24px;
    }
    
    .predictions-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .predictions-header h2 {
        font-size: 16px;
    }
    
    .date-selector {
        width: 100%;
        justify-content: space-between;
    }
    
    .date-selector input[type="date"] {
        flex: 1;
        min-width: 0;
    }
    
    .date-selector button {
        flex: 1;
        min-width: 0;
    }
    
    /* 移动端表格：只显示5列（隐藏结束价格） */
    table {
        font-size: 12px;
        table-layout: fixed;
        width: 100%;
    }
    
    table th:nth-child(4),
    table td:nth-child(4) {
        display: none;  /* 隐藏结束价格列 */
    }
    
    table th:nth-child(1) { width: 15%; }  /* 时间 */
    table th:nth-child(2) { width: 15%; }  /* 方向 */
    table th:nth-child(3) { width: 25%; } /* 开始价格 */
    table th:nth-child(5) { width: 20%; } /* 置信度 */
    table th:nth-child(6) { width: 25%; } /* 结果 */
    
    table th,
    table td {
        padding: 10px 6px;
        font-size: 12px;
    }
    
    .logs-container {
        height: 120px;
        font-size: 11px;
    }
    
    .config-form {
        grid-template-columns: 1fr;
    }
    
    .form-group {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .form-group label {
        min-width: auto;
        margin-bottom: 0;
    }
    
    .form-group input[type="text"],
    .form-group input[type="number"] {
        width: 100%;
    }
    
    .config-buttons {
        flex-direction: column;
    }
    
    .config-buttons button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 18px;
    }
    
    .menu-btn {
        font-size: 12px;
        padding: 6px 8px;
    }
    
    .status-item span {
        font-size: 18px;
    }
    
    .stat-item .stat-number {
        font-size: 20px;
    }
}
