/**
 * Main Workflow Panel Styles
 *
 * 首页主流程面板样式
 *
 * @version 1.0.0
 * @updated 2026-03-01
 */

/* 主流程面板容器 */
.main-workflow-panel {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

/* 步骤导航 */
.workflow-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xl);
    position: relative;
}

.workflow-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-border);
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-weight-bold);
    font-size: 16px;
    margin-bottom: var(--spacing-sm);
    transition: all var(--transition-base);
}

.step-label {
    font-size: var(--font-size-small);
    color: var(--color-text-muted);
    font-weight: var(--font-weight-medium);
}

.workflow-step.active .step-number {
    background: var(--color-primary);
    color: white;
}

.workflow-step.active .step-label {
    color: var(--color-primary);
    font-weight: var(--font-weight-semibold);
}

.workflow-step.completed .step-number {
    background: var(--color-success);
    color: white;
}

.workflow-step.completed .step-label {
    color: var(--color-success);
}

/* 步骤连接线 */
.workflow-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 20px;
    left: calc(50% + 30px);
    width: calc(100% - 60px);
    height: 2px;
    background: var(--color-border);
    z-index: 0;
}

.workflow-step.completed:not(:last-child)::after {
    background: var(--color-success);
}

/* 候选操作区域 */
.candidate-actions-section {
    margin-top: var(--spacing-lg);
}

.repair-config-inline-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: var(--spacing-md);
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: #f8fafc;
    font-size: 12px;
    color: var(--color-text-muted);
}

.repair-config-title {
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-secondary);
}

.candidate-action-row {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: var(--spacing-md);
    align-items: center;
    padding: var(--spacing-md);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    transition: all var(--transition-base);
}

.candidate-action-row:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.candidate-info-cell {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.candidate-main-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.candidate-asset-code {
    font-weight: var(--font-weight-semibold);
    font-size: 16px;
}

.candidate-direction-badge {
    padding: 2px var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
}

.candidate-direction-badge.long {
    background: var(--color-success-light);
    color: var(--color-success-dark);
}

.candidate-direction-badge.short {
    background: var(--color-error-light);
    color: var(--color-error-dark);
}

.candidate-meta {
    display: flex;
    gap: var(--spacing-md);
    font-size: var(--font-size-small);
    color: var(--color-text-muted);
}

.candidate-confidence {
    font-weight: var(--font-weight-medium);
}

.candidate-valuation-repair {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.repair-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.repair-phase-badge,
.repair-signal-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
}

.repair-phase-badge {
    background: #e8f0ff;
    color: #1d4ed8;
}

.repair-phase-badge.phase-undervalued,
.repair-phase-badge.phase-repair_started {
    background: #fef3c7;
    color: #92400e;
}

.repair-phase-badge.phase-repairing,
.repair-phase-badge.phase-near_target {
    background: #dcfce7;
    color: #166534;
}

.repair-phase-badge.phase-stalled {
    background: #fee2e2;
    color: #991b1b;
}

.repair-signal-badge {
    background: #f1f5f9;
    color: #475569;
}

.repair-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: var(--color-text-muted);
}

.candidate-valuation-repair-empty {
    margin-top: 6px;
}

.repair-empty-text {
    font-size: 12px;
    color: var(--color-text-muted);
}

/* 操作按钮组 */
.action-buttons-cell {
    display: flex;
    gap: var(--spacing-sm);
}

.btn-precheck,
.btn-submit-decision,
.btn-execute {
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-medium);
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.btn-precheck {
    background: var(--color-surface);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
}

.btn-precheck:hover {
    background: var(--color-border);
}

.btn-submit-decision {
    background: var(--color-primary);
    color: white;
}

.btn-submit-decision:hover {
    background: var(--color-primary-dark);
}

.btn-execute {
    background: var(--color-success);
    color: white;
}

.btn-execute:hover {
    background: var(--color-success-dark);
}

.btn-execute:disabled {
    background: var(--color-border);
    color: var(--color-text-muted);
    cursor: not-allowed;
}


/* 预检查结果 */
.precheck-result {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-top: var(--spacing-sm);
    font-size: var(--font-size-small);
}

.precheck-result.passed {
    background: var(--color-success-light);
    border: 1px solid var(--color-success);
    color: var(--color-success-dark);
}

.precheck-result.failed {
    background: var(--color-error-light);
    border: 1px solid var(--color-error);
    color: var(--color-error-dark);
}

.precheck-result-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
}

.precheck-result-item:last-child {
    margin-bottom: 0;
}

@media (max-width: 960px) {
    .candidate-action-row {
        grid-template-columns: 1fr;
    }

    .repair-config-inline-summary {
        gap: 8px;
    }
}

/* 执行模态框 */
.execute-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.execute-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.execute-modal {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

.execute-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
}

.execute-modal-title {
    font-size: var(--font-size-h3);
    font-weight: var(--font-weight-semibold);
}

.execute-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all var(--transition-base);
}

.execute-modal-close:hover {
    background: var(--color-border);
    color: var(--color-text-primary);
}

/* 执行目标选择 */
.execution-target-selector {
    margin-bottom: var(--spacing-lg);
}

.target-option-group {
    display: flex;
    gap: var(--spacing-md);
}

.target-option {
    flex: 1;
    padding: var(--spacing-lg);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    text-align: center;
}

.target-option:hover {
    border-color: var(--color-primary);
}

.target-option.selected {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.target-option-icon {
    font-size: 32px;
    margin-bottom: var(--spacing-sm);
}

.target-option-label {
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--spacing-xs);
}

.target-option-desc {
    font-size: var(--font-size-small);
    color: var(--color-text-muted);
}

/* 执行表单 */
.execute-form {
    margin-top: var(--spacing-lg);
}

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-medium);
    margin-bottom: var(--spacing-xs);
    color: var(--color-text-secondary);
}

.form-input,
.form-select {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-body);
    transition: all var(--transition-base);
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

/* 执行按钮组 */
.execute-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-md);
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--color-border);
}

.btn-cancel,
.btn-confirm-execute {
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-body);
    font-weight: var(--font-weight-medium);
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
}

.btn-cancel {
    background: var(--color-surface);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
}

.btn-cancel:hover {
    background: var(--color-border);
}

.btn-confirm-execute {
    background: var(--color-success);
    color: white;
}

.btn-confirm-execute:hover {
    background: var(--color-success-dark);
}

.btn-confirm-execute:disabled {
    background: var(--color-border);
    color: var(--color-text-muted);
    cursor: not-allowed;
}

/* 执行引用显示 */
.execution-ref-display {
    padding: var(--spacing-md);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-top: var(--spacing-md);
}

.execution-ref-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-size-small);
}

.execution-ref-item:last-child {
    margin-bottom: 0;
}

.execution-ref-label {
    color: var(--color-text-muted);
}

.execution-ref-value {
    font-weight: var(--font-weight-medium);
    font-family: monospace;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .candidate-action-row {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }

    .action-buttons-cell {
        width: 100%;
        justify-content: stretch;
    }

    .btn-precheck,
    .btn-submit-decision,
    .btn-execute {
        flex: 1;
        justify-content: center;
    }

    .target-option-group {
        flex-direction: column;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .workflow-steps {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .workflow-step:not(:last-child)::after {
        display: none;
    }
}
