/* KHunter 狩猎场 - 样式文件 */

/* 顶部控制区 */
.khunter-header {
    margin-bottom: 24px;
}

.khunter-controls {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.form-control {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #E74C3C;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

/* 加载指示器 */
.loading-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f0f9ff;
    border-radius: 6px;
    color: #0284c7;
    font-size: 14px;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #0284c7;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 内容区 */
.khunter-content {
    margin-bottom: 24px;
}

.table-container {
    overflow-x: auto;
    width: 100%;
}

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

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.data-table th {
    font-weight: 600;
    color: #6b7280;
    background-color: #f9fafb;
    text-transform: uppercase;
    font-size: 12px;
}

.data-table tbody tr:hover {
    background-color: #f9fafb;
}

.data-table td {
    color: #374151;
}

/* 股票代码链接 */
.stock-link {
    color: #E74C3C;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid transparent;
}

.stock-link:hover {
    color: #C0392B;
    border-bottom-color: #E74C3C;
    text-decoration: underline;
}

/* 评分链接 */
.score-link {
    color: #10b981;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid transparent;
}

.score-link:hover {
    color: #059669;
    border-bottom-color: #10b981;
    text-decoration: underline;
}

/* 占位符 */
.placeholder {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
    font-size: 14px;
}

/* 分页控件 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

#page-info {
    font-size: 14px;
    color: #6b7280;
    min-width: 100px;
}

/* 底部统计 */
.khunter-footer {
    margin-bottom: 24px;
}

.stats-grid {
    display: grid;
    gap: 16px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f9fafb;
    border-radius: 6px;
}

.stat-item .label {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
}

.stat-item .value {
    font-size: 14px;
    font-weight: 600;
    color: #E74C3C;
}

/* 模态窗口 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    overflow: auto;
    display: flex;
    flex-direction: column;
    margin: auto;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #9ca3af;
    transition: all 0.2s;
}

.close-btn:hover {
    color: #374151;
}

/* 按钮样式 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-primary {
    background: #E74C3C;
    color: white;
}

.btn-primary:hover {
    background: #C0392B;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-success:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 文本样式 */
.text-muted {
    color: #6b7280;
    font-size: 13px;
}

.text-success {
    color: #10b981;
}

.text-danger {
    color: #ef4444;
}

.text-warning {
    color: #f59e0b;
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 40px;
    color: #9ca3af;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid #E74C3C;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .khunter-controls {
        gap: 12px;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px;
    }
}

@media (max-width: 768px) {
    .khunter-controls {
        grid-template-columns: 1fr;
    }
    
    .form-group {
        width: 100%;
    }
    
    .data-table {
        font-size: 11px;
    }
    
    .data-table th,
    .data-table td {
        padding: 6px;
    }
    
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 16px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .stat-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .pagination {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .khunter-controls {
        grid-template-columns: 1fr;
    }
    
    .data-table {
        font-size: 10px;
    }
    
    .data-table th,
    .data-table td {
        padding: 4px;
    }
    
    .btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .modal-content {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
}

/* 卡片样式 */
.card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.card-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 0;
}

/* 页面容器 */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* 内容区 */
.content {
    padding: 24px;
}

/* 页面标题 */
#page-title {
    font-size: 20px;
    font-weight: 600;
}

/* 结果摘要 */
#result-summary {
    font-size: 13px;
    color: #6b7280;
}

/* 成功提示 */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #86efac;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.alert-info {
    background: #f0f9ff;
    color: #0c2d6b;
    border: 1px solid #7dd3fc;
}

/* 策略执行器样式 */
.execution-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.execution-status.status-idle {
    background: #f0fdf4;
    color: #16a34a;
}

.execution-status.status-running {
    background: #fffbeb;
    color: #d97706;
    animation: pulse 1.5s infinite;
}

.execution-status.status-error {
    background: #fef2f2;
    color: #dc2626;
}

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

.save-status {
    display: none;
    padding: 6px 12px;
    background: #f0fdf4;
    color: #16a34a;
    border-radius: 6px;
    font-size: 13px;
}

.save-status.show {
    display: inline-block;
}

.strategy-combo-item {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
}

.combo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.combo-body {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.combo-field {
    display: flex;
    align-items: center;
    gap: 6px;
}

.combo-field label {
    font-weight: 600;
    color: #6b7280;
    font-size: 13px;
}

.combo-field span {
    color: #1f2937;
    font-size: 13px;
}

.plan-list-item {
    cursor: pointer;
    transition: all 0.2s;
}

.plan-list-item:hover {
    background: #f3f4f6;
}

.plan-list-item.active {
    background: #e74c3c;
    color: white;
}

.plan-list-item.active .text-muted {
    color: rgba(255, 255, 255, 0.7);
}

.log-container {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #374151;
}

/* ==================== 风控模块样式 ==================== */

/* 风险等级样式 */
.risk-level {
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 12px;
}

.risk-normal {
    background-color: #dcfce7;
    color: #16a34a;
}

.risk-caution {
    background-color: #fef3c7;
    color: #d97706;
}

.risk-danger {
    background-color: #fecaca;
    color: #dc2626;
}

.risk-crash {
    background-color: #f5f5f5;
    color: #374151;
    background-color: #1f2937;
    color: #f97316;
}

/* VaR值样式 */
.var-value {
    font-weight: 600;
    font-size: 14px;
}

.var-normal {
    color: #16a34a;
}

.var-caution {
    color: #d97706;
}

.var-danger {
    color: #dc2626;
}

.var-crash {
    color: #f97316;
}

/* 策略状态样式 */
.strategy-status {
    padding: 4px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
}

.strategy-status.enabled {
    background-color: #dcfce7;
    color: #16a34a;
}

.strategy-status.disabled {
    background-color: #fee2e2;
    color: #dc2626;
}

/* 风控卡片样式 */
#risk-status-card .card-body {
    padding: 16px;
}

#risk-status-card .card-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
}

#risk-status-card h5 {
    font-size: 14px;
    font-weight: 600;
}

#risk-status-card .table {
    margin-bottom: 0;
}

#risk-status-card .table td {
    padding: 8px 0;
    border: none;
}

#risk-status-card .table td:first-child {
    color: #6b7280;
    font-weight: 500;
}

#risk-history-chart {
    height: 200px;
}

/* 统计卡片增强样式 */
.risk-stat-card, .temp-stat-card {
    position: relative;
    overflow: visible;
    align-items: flex-start !important;
}

.temp-stat-card .stat-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.temp-stat-card .stat-info .temp-main-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
}

.temp-stat-card .stat-info .temp-action {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    gap: 8px !important;
    font-size: 11px !important;
    line-height: 1.5 !important;
    margin-top: 8px !important;
    padding: 6px 10px !important;
    border-radius: 6px !important;
    box-sizing: border-box !important;
    max-width: 100% !important;
    width: 100% !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow: visible !important;
}

.risk-stat-card:hover, .temp-stat-card:hover {
    border-color: #3b82f6;
}

.stat-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover .stat-arrow {
    opacity: 1;
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-info p {
    margin: 0;
    font-size: 12px;
    color: #6b7280;
}

.risk-badge, .temp-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    margin-top: 4px;
}

/* 风险等级徽章颜色 */
.risk-badge.risk-normal {
    background: #dcfce7;
    color: #16a34a;
}

.risk-badge.risk-caution {
    background: #fef3c7;
    color: #d97706;
}

.risk-badge.risk-danger {
    background: #fecaca;
    color: #dc2626;
}

.risk-badge.risk-crash {
    background: #f3e8ff;
    color: #7c3aed;
}

/* 温度徽章颜色 */
.temp-badge.temp-active {
    background: #fef3c7;
    color: #d97706;
}

.temp-badge.temp-normal {
    background: #dcfce7;
    color: #16a34a;
}

.temp-badge.temp-cold {
    background: #dbeafe;
    color: #2563eb;
}

.temp-badge.temp-freezing {
    background: #e0e7ff;
    color: #6366f1;
}

/* VaR值显示样式 */
.var-display {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 24px;
    font-weight: 700;
}

.var-display.var-normal {
    color: #16a34a;
}

.var-display.var-caution {
    color: #d97706;
}

.var-display.var-danger {
    color: #dc2626;
}

.var-display.var-crash {
    color: #7c3aed;
}

/* 温度值显示样式 */
.temp-display {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 24px;
    font-weight: 700;
}

.temp-display.temp-active {
    color: #d97706;
}

.temp-display.temp-normal {
    color: #16a34a;
}

.temp-display.temp-cold {
    color: #2563eb;
}

.temp-display.temp-freezing {
    color: #6366f1;
}

/* 温度卡片样式简化 */
#stat-temp-action {
    display: block !important;
    font-size: 11px !important;
    line-height: 1.5 !important;
    margin-top: 8px !important;
    padding: 6px 10px !important;
    border-radius: 6px !important;
    box-sizing: border-box !important;
    max-width: 100% !important;
    width: auto !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    word-break: normal !important;
    overflow: visible !important;
}

#stat-temp-action .action-icon {
    display: inline-block !important;
    width: 14px !important;
    height: 14px !important;
    border-radius: 50% !important;
    font-size: 9px !important;
    font-weight: 700 !important;
    text-align: center !important;
    line-height: 14px !important;
    margin-right: 6px !important;
    vertical-align: middle !important;
}

/* 模态窗口样式 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
}

.modal-content.modal-lg {
    max-width: 800px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #9ca3af;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: #374151;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(90vh - 120px);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
}

.modal-section {
    margin-bottom: 24px;
}

.modal-section:last-child {
    margin-bottom: 0;
}

.modal-section h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

/* 网格布局 */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (max-width: 600px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

/* 信息框 */
.info-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #f9fafb;
    border-radius: 8px;
}

.info-box label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

.info-box span {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

/* 大尺寸徽章 */
.risk-badge-lg, .temp-badge-lg {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
}

.risk-badge-lg.risk-normal {
    background: #dcfce7;
    color: #16a34a;
}

.risk-badge-lg.risk-caution {
    background: #fef3c7;
    color: #d97706;
}

.risk-badge-lg.risk-danger {
    background: #fecaca;
    color: #dc2626;
}

.risk-badge-lg.risk-crash {
    background: #f3e8ff;
    color: #7c3aed;
}

.temp-badge-lg.temp-active {
    background: #fef3c7;
    color: #d97706;
}

.temp-badge-lg.temp-normal {
    background: #dcfce7;
    color: #16a34a;
}

.temp-badge-lg.temp-cold {
    background: #dbeafe;
    color: #2563eb;
}

.temp-badge-lg.temp-freezing {
    background: #e0e7ff;
    color: #6366f1;
}

/* VaR值样式 */
.var-value {
    font-family: 'Monaco', 'Consolas', monospace;
    font-weight: 700;
}

.var-value.var-normal {
    color: #16a34a;
}

.var-value.var-caution {
    color: #d97706;
}

.var-value.var-danger {
    color: #dc2626;
}

.var-value.var-crash {
    color: #7c3aed;
}

/* 温度值大样式 */
.temp-value-lg {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 28px;
    font-weight: 700;
}

.temp-value-lg.temp-active {
    color: #d97706;
}

.temp-value-lg.temp-normal {
    color: #16a34a;
}

.temp-value-lg.temp-cold {
    color: #2563eb;
}

.temp-value-lg.temp-freezing {
    color: #6366f1;
}

/* 策略状态 */
.strategy-status {
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
}

.strategy-status.enabled {
    background: #dcfce7;
    color: #16a34a;
}

.strategy-status.disabled {
    background: #fee2e2;
    color: #dc2626;
}

/* 清仓状态 */
.liquidate-status {
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
}

.liquidate-status.liquidate {
    background: #fee2e2;
    color: #dc2626;
}

.liquidate-status.normal {
    background: #dcfce7;
    color: #16a34a;
}

/* 图表容器 */
.chart-container {
    /* 【2026-09-20】Chart.js 要求容器 position:relative 作为响应式尺寸计算基准
       （缺失时弹窗/隐藏状态下渲染会出现 0 尺寸或尺寸错乱） */
    position: relative;
    height: 250px;
    background: #f9fafb;
    border-radius: 8px;
    padding: 16px;
}

/* 得分框 */
.score-box {
    background: #f9fafb;
    border-radius: 8px;
    padding: 12px;
}

.score-box label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    margin-bottom: 8px;
    display: block;
}

.score-bar-container {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4px;
}

.score-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #10b981);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.score-box span {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
}
