/* 启动策略页样式 (gostrategy) */

/* ========== 1. 基础全局样式 ========== */
body {
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.5;
    background-color: #f5f5f5;
}
.container-fluid {
    padding-top: 0.5rem;
    max-width: 1600px;
    margin: 0 auto;
}

/* ========== 2. 通用组件规范 ========== */
.card {
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
}
.card-body {
    font-size: 13px;
    padding: 0.75rem;
    flex: 1;
}
.chart-card-header {
    height: 44px; /* 统一标题栏高度 */
    padding: 0 0.75rem;
    background-color: #fff;
    border-bottom: 1px solid #f1f3f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px 8px 0 0;
}
.card-header-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}
.card-header-title i {
    color: #adb5bd;
    font-size: 14px;
    width: 16px;
    text-align: center;
}

.status-badge {
    display: inline-block;
    padding: 0.35rem 0.7rem;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}
.status-badge.running { background-color: #d4edda; color: #155724; }
.status-badge.stopped { background-color: #f8d7da; color: #721c24; }
.status-badge.waiting { background-color: #fff3cd; color: #856404; }

/* ========== 3. 页面布局与栅格 ========== */
.trading-panel {
    display: flex;
    align-items: stretch;
}
.trading-left-panel, .trading-right-panel {
    display: flex;
    flex-direction: column;
}

/* 核心卡片等高布局 - 设置适中的固定高度 */
.strategy-config-card, .monitor-card {
    height: 440px !important;
    flex: 0 0 440px !important;
    display: flex;
    flex-direction: column;
}
.strategy-config-card .card-body, .monitor-card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ========== 4. 账户仪表盘 (顶部) ========== */
.account-overview .account-item {
    text-align: center;
    padding: 0.15rem 0.5rem;
}
.account-overview .account-label {
    font-size: 11px;
    opacity: 0.9;
    margin-bottom: 0.2rem;
}
.account-overview .account-value {
    font-size: 15px;
    font-weight: 600;
}
.metric-item {
    display: flex;
    align-items: center;
}
/* 小屏下性能指标自动换行 */
.metrics-row {
    gap: 0.5rem 1rem;
}
@media (max-width: 1200px) {
    .metrics-row .metric-item.border-start { border-left: none !important; }
}

/* ========== 5. 策略配置模块 ========== */
.strategy-config-card {
    border: 1px solid #f1f3f5 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02) !important;
}
.strategy-config-card .card-body {
    justify-content: space-between;
    padding: 1rem 1.25rem; /* 减小内边距，让内容更靠近边界，参考交易页 */
}
.strategy-config-card .trade-form-row {
    margin-bottom: 0.5rem; /* 给每一行一点基础间距 */
}
.trade-form-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.8rem;
}
.trade-form-row .form-label {
    width: 80px;
    margin-bottom: 0;
    margin-top: 6px;
    flex-shrink: 0;
    font-weight: 600;
    color: #333;
    font-size: 12px;
}
.trade-form-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.trade-form-content .form-control,
.trade-form-content .form-select {
    font-size: 13px;
    font-weight: 600;
    height: 31px;
    padding: 0.4rem 0.6rem;
}

/* ========== 6. 策略管理模块 ========== */
.strategy-management-card {
    height: 360px !important;
    flex: 0 0 360px !important;
    overflow: hidden;
}
.strategy-management-card .card-body {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0.5rem 0.75rem 0.5rem;
    min-height: 0;
    overflow: hidden;
}
.strategy-files-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.25rem; 
}
.strategy-files-container::-webkit-scrollbar { width: 4px; }
.strategy-files-container::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 2px; }
.strategy-files-container::-webkit-scrollbar-thumb { background: #d1d1d1; border-radius: 2px; }

.strategy-file-item {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}
.strategy-file-item:hover {
    background-color: #f8f9fa;
    border-color: #0d6efd;
}
.strategy-file-name {
    font-size: 12px;
    font-weight: 500;
    color: #333;
    margin-bottom: 0.15rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.strategy-file-meta { font-size: 10px; color: #6c757d; display: flex; gap: 6px; }
.strategy-file-actions { margin-left: 0.5rem; }
.strategy-file-actions .btn-action {
    padding: 0.2rem 0.35rem; font-size: 10px; border-radius: 3px;
    border: none; background: transparent;
}
.strategy-file-actions .strategy-action-select { color: #28a745; }
.strategy-file-actions .strategy-action-select:hover { color: #218838; }
.strategy-file-actions .strategy-action-view { color: #0d6efd; }
.strategy-file-actions .strategy-action-view:hover { color: #0a58ca; }
.strategy-file-actions .strategy-action-download { color: #6f42c1; }
.strategy-file-actions .strategy-action-download:hover { color: #5a32a3; }
.strategy-file-actions .strategy-action-delete { color: #dc3545; }
.strategy-file-actions .strategy-action-delete:hover { color: #c82333; }

.strategy-upload-btn {
    border: 1px solid #dee2e6; border-radius: 4px 0 0 4px; font-size: 11px;
    background: transparent; color: #0dcaf0;
}
.strategy-upload-btn:hover { color: #0aa2c0; border-color: #0dcaf0; }

/* ========== 7. 实时监控模块 (图表与盘口) ========== */
.monitor-card .card-body { padding: 0.75rem; }
.chart-container-box { flex: 1; position: relative; min-height: 320px; }
.chart-container-box canvas { width: 100% !important; height: 100% !important; display: block; }
#dailyChartContainer, #equityChartContainer { width: 100%; height: 100%; position: absolute; top: 0; left: 0; }
.chart-container-relative { position: relative; }
.chart-placeholder-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(248, 249, 250, 0.9);
    z-index: 5;
    pointer-events: none;
}
.chart-placeholder-overlay.hide { display: none; }
.daily-chart-tooltip {
    position: absolute;
    pointer-events: none;
    z-index: 10;
    background: rgba(33, 37, 41, 0.95);
    color: #fff;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    white-space: nowrap;
}
.daily-chart-tooltip .tooltip-date { font-weight: 600; margin-bottom: 4px; }
.daily-chart-tooltip .tooltip-ohlc { color: #dee2e6; }

.chart-type-group {
    display: inline-flex;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #dee2e6;
    background: #f8f9fa;
}
.chart-type-group .chart-type-btn {
    padding: 0.25rem 0.6rem;
    font-size: 12px;
    font-weight: 500;
    border: none;
    background: transparent;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s;
}
.chart-type-group .chart-type-btn:not(:last-child) { border-right: 1px solid #e9ecef; }
.chart-type-group .chart-type-btn:hover { background: #e9ecef; color: #495057; }
.chart-type-group .chart-type-btn.active { background: #198754; color: #fff; }
.chart-type-group.indicator-group { margin-left: 0.5rem; border-color: #ced4da; }
.chart-type-group.indicator-group .chart-type-btn.active { background: #0d6efd; color: #fff; }

.clock-row {
    font-size: 14px;
    font-weight: 500;
    font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
    color: #495057;
    letter-spacing: 0.02em;
}

.quote-list { width: 165px; display: flex; flex-direction: column; gap: 1px; }
.quote-row { display: flex; justify-content: space-between; padding: 1px 4px; border-radius: 2px; font-size: 12px; }
.quote-row .label { width: 30px; flex-shrink: 0; color: #999; font-size: 11px; }
.quote-row .price { flex: 1; min-width: 0; text-align: right; margin-right: 8px; font-weight: 500; font-family: "JetBrains Mono", "SF Mono", Consolas, monospace; white-space: nowrap; }
.quote-row .vol { width: 58px; min-width: 58px; flex-shrink: 0; text-align: right; color: #666; font-size: 11px; font-family: "JetBrains Mono", "SF Mono", Consolas, monospace; white-space: nowrap; }
.quote-ask-row { background: rgba(40, 167, 69, 0.04); }
.quote-ask-row .price { color: #28a745; }
.quote-bid-row { background: rgba(220, 53, 69, 0.04); }
.quote-bid-row .price { color: #dc3545; }

/* 实时信号栏 */
.signal-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    margin-top: 8px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}
.signal-bar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    flex-shrink: 0;
}
.pulse-dot.buy { background: #dc3545; box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.3); }
.pulse-dot.sell { background: #198754; box-shadow: 0 0 0 2px rgba(25, 135, 84, 0.3); }
.signal-label {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}
.signal-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.signal-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    color: #fff;
}
.signal-badge.buy { background: #dc3545; }
.signal-badge.sell { background: #198754; }
.signal-symbol {
    font-size: 13px;
    font-weight: 600;
    font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
    color: #334155;
}
.signal-qty {
    font-size: 12px;
    color: #64748b;
}
.signal-price {
    font-size: 14px;
    font-weight: 700;
    font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
}
.signal-price.buy { color: #dc3545; }
.signal-price.sell { color: #198754; }
.signal-placeholder {
    font-size: 13px;
    font-weight: 500;
    color: #6c757d;
}
.signal-bar-right {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #94a3b8;
}
.signal-time-icon { font-size: 11px; }

/* 盘口信号按钮 */
.monitor-signal-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    min-height: 44px;
}
.monitor-signal-btn.buy {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.08) 0%, rgba(220, 53, 69, 0.04) 100%);
    border-color: rgba(220, 53, 69, 0.3);
    color: #dc3545;
}
.monitor-signal-btn.sell {
    background: linear-gradient(135deg, rgba(25, 135, 84, 0.08) 0%, rgba(25, 135, 84, 0.04) 100%);
    border-color: rgba(25, 135, 84, 0.3);
    color: #198754;
}
.monitor-signal-btn .monitor-signal-icon {
    font-size: 16px;
}

/* 信号日志 Badge */
.signal-log-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}
.signal-log-badge.signal-icon-buy {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}
.signal-log-badge.signal-icon-sell {
    background: rgba(25, 135, 84, 0.1);
    color: #198754;
}
.signal-log-badge.signal-icon-hold {
    background: rgba(108, 117, 125, 0.1);
    color: #6c757d;
}

/* 信号明细六列等分 */
.signals-table-seven {
    table-layout: fixed;
}
.signals-table-seven th,
.signals-table-seven td {
    width: 16.67%; /* 1/6 */
}

/* ========== 8. 数据表格视图 (同步自 trader.css) ========== */
.trading-bottom-card {
    height: 360px !important;
    flex: 0 0 360px !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.trading-bottom-card .card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 0 !important;
    overflow: hidden;
    min-height: 0;
}
.table-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    min-height: 0;
}
/* 委托/成交/持仓/信号/日志 暂无数据时垂直居中 */
.table-container .empty-state-cell {
    padding: 0;
    vertical-align: middle;
}
.table-container .empty-state-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 260px;
    padding: 2rem;
    color: #6c757d;
}
.table-container .empty-state-placeholder i {
    margin-bottom: 0.75rem;
    opacity: 0.3;
}

/* 日志表格优化 */
.data-view-logs .data-table tbody tr.log-row {
    transition: background-color 0.15s ease;
}
.data-view-logs .data-table tbody tr.log-row-odd {
    background-color: #fafbfc;
}
.data-view-logs .data-table tbody tr.log-row:hover {
    background-color: #f0f4f8 !important;
}
.data-view-logs .data-table td.log-time {
    width: 90px;
    min-width: 90px;
    font-size: 12px;
    color: #868e96;
    font-variant-numeric: tabular-nums;
}
.data-view-logs .data-table td.log-msg {
    font-size: 12px;
    word-break: break-word;
    line-height: 1.6;
    color: #495057;
}
.data-view-logs .log-action-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 6px;
}
.data-view-logs .log-action-badge.log-buy {
    background: rgba(220, 53, 69, 0.12);
    color: #dc3545;
}
.data-view-logs .log-action-badge.log-sell {
    background: rgba(40, 167, 69, 0.12);
    color: #198754;
}
.data-view-logs .log-msg-icon.log-success { color: #198754; }
.data-view-logs .log-msg-icon.log-error { color: #dc3545; }
.data-view-logs .log-msg-icon.log-warning { color: #fd7e14; }
.data-view-logs .log-msg-icon.log-info { color: #6c757d; }
.table-header.sticky-top {
    background-color: #f8f9fa;
    z-index: 10;
    top: 0;
}
.data-table thead th {
    font-weight: 600 !important;
    font-size: 12px !important;
    padding: 0.75rem 0.6rem !important;
    background-color: #f8f9fa !important;
    border-bottom: 2px solid #dee2e6 !important;
    color: #495057 !important;
    white-space: nowrap;
}
.data-table tbody td {
    padding: 0.75rem 0.6rem !important;
    vertical-align: middle;
    border-bottom: 1px solid #f0f0f0;
    font-size: 12px;
    line-height: 1.5;
    color: #343a40;
}

/* ========== 9. 模态框与辅助类 ========== */
.manage-modal .manage-modal-dialog { max-width: 720px !important; width: 100%; margin: 1.75rem auto; }
.manage-modal .modal-content { border: 1.5px solid #dee2e6; border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08); overflow: hidden; }
.manage-modal .manage-account-form .trade-form-row { padding: 0.8rem 0; border-bottom: 1px solid #f0f0f0; margin-bottom: 0; justify-content: space-between; }
.manage-modal .manage-account-form .trade-form-row:last-child { border-bottom: none; }
.manage-modal .manage-account-form .form-control-sm { border: none !important; background: transparent !important; text-align: right; font-weight: 600; padding: 0; height: auto; }
.manage-modal .manage-radio-option { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 13px; cursor: pointer; }
.manage-modal .btn-icon-only { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border: none; background: transparent; transition: background 0.2s; }
.manage-modal .btn-icon-only:hover { background-color: #f8f9fa; }

.flex-row-nowrap { display: flex !important; flex-direction: row !important; flex-wrap: nowrap !important; align-items: center; gap: 1rem; }
.opacity-3 { opacity: 0.3 !important; }

/* ========== 10. 启动策略页内联样式抽离 ========== */
.text-11 { font-size: 11px; }
.text-12 { font-size: 12px; }
.text-13 { font-size: 13px; }
.text-14 { font-size: 14px; }
.metric-label { font-size: 11px; }
.metric-value { font-size: 13px; }
.status-badge-compact { padding: 2px 8px; vertical-align: middle; }
.account-config-preview.dashed { border-style: dashed !important; }
.preview-label { font-size: 13px; }
.preview-value { font-size: 14px; color: #333; }
.input-readonly-preview { background-color: #f8f9fa !important; color: #666 !important; border-style: dashed !important; }
.btn-run-strategy { height: 31px; font-size: 13px; border-radius: 6px; font-weight: 500; border: none; }
.btn-run-strategy.btn-success { box-shadow: 0 2px 4px rgba(40, 167, 69, 0.15); }
.header-btn-group-shadow { box-shadow: 0 1px 2px rgba(0,0,0,0.03); }
.btn-refresh-list { border-width: 1px; border-radius: 0 4px 4px 0; border-left: none; font-size: 11px; color: #6c757d; border-color: #dee2e6; }
.chart-flex-fill { flex: 1; min-height: 0; }
.quote-divider { width: 1px; background-color: #e9ecef; }
.monitor-prev-price { font-size: 22px; color: #1a1a1a; line-height: 1.1; }
.monitor-prev-unit { font-size: 16px; }
.monitor-prev-row { font-size: 13px; margin-top: 2px; }
.monitor-prev-label { font-size: 12px; }
.strategy-code-pre { margin: 0; padding: 1rem; max-height: 600px; overflow-y: auto; background-color: #f8f9fa; font-family: 'Consolas', 'Monaco', monospace; font-size: 13px; }
.chart-placeholder-text { font-size: 14px; }

/* 投资标的联想（与 trader 页一致） */
.symbol-input-wrap { position: relative; width: 100%; }
.symbol-suggestions {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    background: #fff; border: 1px solid #dee2e6; border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    max-height: 240px; overflow-y: auto; z-index: 1050; padding: 4px;
}
.symbol-suggestion-item {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px; border-radius: 6px; cursor: pointer; line-height: 1.35;
}
.symbol-suggestion-item:hover,
.symbol-suggestion-item.active { background: #f1f3f5; }
.symbol-suggestion-code { font-size: 12px; font-weight: 600; color: #212529; min-width: 90px; }
.symbol-suggestion-name { font-size: 12px; color: #6c757d; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
