/* 世禹工艺参数收敛工作台 - 样式表 */

:root {
    /* 半导体精密主题：深蓝底+金色强调 */
    --bg-primary: #0A1628;
    --bg-secondary: #164A9E;
    --bg-card: #1A2642;
    --bg-card-hover: #223256;
    --accent-gold: #F0B429;
    --accent-gold-dark: #D19A1F;
    --text-primary: #FFFFFF;
    --text-secondary: #A8C5E8;
    --text-muted: #6B8CB3;
    --border-color: #2D4567;
    --success: #2ECC71;
    --warning: #F39C12;
    --danger: #E74C3C;
    --shadow: rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* 顶栏 */
.header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, #0F3A7A 100%);
    border-bottom: 2px solid var(--accent-gold);
    padding: 1.5rem 2rem;
    box-shadow: 0 4px 12px var(--shadow);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.header-subtitle {
    font-size: 1rem;
    color: var(--accent-gold);
    font-weight: 500;
}

.btn-primary {
    background: var(--accent-gold);
    color: #0A1628;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: var(--accent-gold-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(240, 180, 41, 0.4);
}

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

.btn-icon {
    font-size: 1.2rem;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-gold);
}

/* 流程条 */
.pipeline-steps {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    opacity: 0.5;
    transition: all 0.3s;
}

.step::after {
    content: '';
    position: absolute;
    top: 20px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--border-color);
    z-index: -1;
}

.step:last-child::after {
    display: none;
}

.step.active {
    opacity: 1;
}

.step.active .step-number {
    background: var(--accent-gold);
    color: #0A1628;
    box-shadow: 0 0 20px rgba(240, 180, 41, 0.6);
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s;
}

.step-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* 主内容 */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem 4rem;
}

.section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px var(--shadow);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.eyebrow {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--accent-gold);
    background: rgba(240, 180, 41, 0.15);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 0.5rem;
}

.section-badge {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 0.4rem 1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

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

.highlight-section {
    border: 2px solid var(--accent-gold);
    background: linear-gradient(135deg, var(--bg-card) 0%, #1E2D4A 100%);
}

/* 设备网格 */
.device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.device-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    transition: all 0.2s;
}

.device-card:hover {
    border-color: var(--accent-gold);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(240, 180, 41, 0.2);
}

.device-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.device-type {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.device-id {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: 'Courier New', monospace;
    margin-bottom: 0.5rem;
}

.device-records {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent-gold);
    font-size: 0.9rem;
    font-weight: 600;
}

/* 数据质量 */
.quality-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.stat-card.highlight {
    border-color: var(--accent-gold);
    background: rgba(240, 180, 41, 0.1);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.quality-chart {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    min-height: 200px;
}

/* 参数推荐 */
.recommend-input {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.input-group {
    flex: 1;
    min-width: 180px;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.input-group input,
.input-group select {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(240, 180, 41, 0.1);
}

.recommend-results {
    margin-bottom: 1.5rem;
}

.placeholder {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem;
    font-size: 1rem;
}

.recommend-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.recommend-card.top {
    border: 2px solid var(--accent-gold);
    background: linear-gradient(135deg, rgba(240, 180, 41, 0.05) 0%, var(--bg-primary) 100%);
}

.recommend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.recommend-rank {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-gold);
}

.recommend-yield {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success);
}

.recommend-meta {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.meta-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.recommend-params {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 1rem;
}

.param-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.param-item:last-child {
    border-bottom: none;
}

.param-name {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.param-value {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
}

.backtest-chart {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    min-height: 250px;
}

.chart-title {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.chart-bars {
    display: flex;
    gap: 2rem;
    align-items: flex-end;
    height: 180px;
    padding: 1rem 0;
}

.chart-bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.bar-fill {
    width: 100%;
    background: var(--bg-secondary);
    border-radius: 6px 6px 0 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 0.5rem;
    transition: all 0.3s;
}

.bar-fill.baseline {
    background: var(--text-muted);
}

.bar-fill.recommendation {
    background: var(--accent-gold);
}

.bar-value {
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
}

.bar-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* 配方列表 */
.recipe-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.recipe-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.recipe-card:hover {
    border-color: var(--accent-gold);
}

.recipe-info {
    flex: 1;
}

.recipe-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.recipe-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.recipe-status {
    padding: 0.4rem 1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.recipe-status.draft {
    background: rgba(108, 117, 125, 0.2);
    color: #A8C5E8;
}

.recipe-status.pending {
    background: rgba(243, 156, 18, 0.2);
    color: var(--warning);
}

.recipe-status.approved {
    background: rgba(46, 204, 113, 0.2);
    color: var(--success);
}

.recipe-status.rejected {
    background: rgba(231, 76, 60, 0.2);
    color: var(--danger);
}

/* 报表指标 */
.report-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.metric-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s;
}

.metric-card:hover {
    border-color: var(--accent-gold);
    transform: translateY(-2px);
}

.metric-icon {
    font-size: 2rem;
}

.metric-content {
    flex: 1;
}

.metric-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* 页脚 */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer p {
    margin: 0.25rem 0;
}

/* Toast 通知 */
.toast {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--accent-gold);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    transform: translateX(400px);
    transition: transform 0.3s;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--danger);
}

/* 加载状态 */
.loading {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-size: 0.95rem;
}

/* 响应式 */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .pipeline-steps {
        overflow-x: auto;
        justify-content: flex-start;
    }

    .step {
        min-width: 100px;
    }

    .recommend-input {
        flex-direction: column;
    }

    .chart-bars {
        gap: 1rem;
    }
}
