/* 风险管理中心样式 */

:root {
    --risk-low: #28a745;
    --risk-medium: #ffc107;
    --risk-high: #fd7e14;
    --risk-critical: #dc3545;
}

body {
    background-color: #f5f5f5;
}

/* 统计卡片 */
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.12);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.stat-total::before { background: #6c757d; }
.stat-open::before { background: #17a2b8; }
.stat-critical::before { background: var(--risk-critical); }
.stat-high::before { background: var(--risk-high); }
.stat-overdue::before { background: #6f42c1; }
.stat-rpn::before { background: #20c997; }

.stat-icon {
    font-size: 24px;
    margin-bottom: 10px;
    opacity: 0.7;
}

.stat-total .stat-icon { color: #6c757d; }
.stat-open .stat-icon { color: #17a2b8; }
.stat-critical .stat-icon { color: var(--risk-critical); }
.stat-high .stat-icon { color: var(--risk-high); }
.stat-overdue .stat-icon { color: #6f42c1; }
.stat-rpn .stat-icon { color: #20c997; }

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

.stat-label {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
}

/* 风险矩阵 */
.risk-matrix {
    display: grid;
    grid-template-columns: 30px repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr) 30px;
    gap: 3px;
    aspect-ratio: 1;
    padding: 10px;
}

.matrix-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.matrix-cell:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 1;
}

.matrix-cell.level-low { background-color: var(--risk-low); }
.matrix-cell.level-medium { background-color: var(--risk-medium); color: #333; }
.matrix-cell.level-high { background-color: var(--risk-high); }
.matrix-cell.level-critical { background-color: var(--risk-critical); }

.matrix-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #6c757d;
    font-weight: 500;
}

.matrix-label.y-axis {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
}

.matrix-legend {
    display: flex;
    justify-content: center;
    gap: 15px;
    font-size: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.bg-orange {
    background-color: var(--risk-high) !important;
}

/* 类别列表 */
.category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    border-left: 4px solid transparent;
    transition: background-color 0.2s;
}

.category-item:hover {
    background-color: #f8f9fa;
}

.category-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-right: 12px;
}

.category-info {
    flex: 1;
}

.category-name {
    font-weight: 500;
    font-size: 14px;
}

.category-stats {
    font-size: 12px;
    color: #6c757d;
}

/* 风险表格 */
.table th {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #6c757d;
    border-bottom: 2px solid #dee2e6;
}

.table td {
    vertical-align: middle;
    font-size: 13px;
}

.risk-number {
    font-family: monospace;
    font-size: 11px;
    color: #6c757d;
}

.risk-title {
    font-weight: 500;
    color: #333;
}

.risk-title:hover {
    color: #dc3545;
    cursor: pointer;
}

.sod-badge {
    display: inline-block;
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.sod-1, .sod-2, .sod-3 { background-color: #d4edda; color: #155724; }
.sod-4, .sod-5, .sod-6 { background-color: #fff3cd; color: #856404; }
.sod-7, .sod-8 { background-color: #ffe5d0; color: #c45b00; }
.sod-9, .sod-10 { background-color: #f8d7da; color: #721c24; }

.rpn-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.rpn-low { background-color: var(--risk-low); }
.rpn-medium { background-color: var(--risk-medium); color: #333; }
.rpn-high { background-color: var(--risk-high); }
.rpn-critical { background-color: var(--risk-critical); }

.status-badge {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
}

.status-identified { background-color: #e2e3e5; color: #383d41; }
.status-analyzing { background-color: #cce5ff; color: #004085; }
.status-treating { background-color: #d4edda; color: #155724; }
.status-monitoring { background-color: #fff3cd; color: #856404; }
.status-closed { background-color: #d6d8db; color: #1b1e21; }
.status-accepted { background-color: #d1ecf1; color: #0c5460; }

.due-date {
    font-size: 12px;
}

.due-date.overdue {
    color: var(--risk-critical);
    font-weight: 600;
}

.due-date.soon {
    color: var(--risk-high);
}

/* RPN 显示 */
.rpn-display {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    border: 2px solid #dee2e6;
}

.rpn-formula {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 10px;
}

.rpn-result {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.rpn-value {
    font-size: 48px;
    font-weight: 700;
    line-height: 1;
}

.rpn-level {
    font-size: 16px;
    padding: 8px 16px;
}

/* 滑块样式 */
.form-range {
    flex: 1;
}

.input-group-text.severity-value,
.input-group-text.occurrence-value,
.input-group-text.detection-value {
    min-width: 40px;
    justify-content: center;
    font-weight: 600;
}

/* 卡片样式 */
.card {
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-radius: 12px;
}

.card-header {
    background-color: white;
    border-bottom: 1px solid #eee;
    font-weight: 600;
    padding: 15px 20px;
    border-radius: 12px 12px 0 0 !important;
}

/* 分页 */
.pagination .page-link {
    border: none;
    color: #6c757d;
    padding: 6px 12px;
    margin: 0 2px;
    border-radius: 6px;
}

.pagination .page-item.active .page-link {
    background-color: #dc3545;
    color: white;
}

.pagination .page-link:hover {
    background-color: #f8f9fa;
}

/* 操作按钮 */
.btn-action {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
}

/* 响应式 */
@media (max-width: 768px) {
    .stat-card {
        padding: 15px;
    }
    
    .stat-value {
        font-size: 22px;
    }
    
    .stat-icon {
        font-size: 20px;
    }
    
    .risk-matrix {
        font-size: 10px;
    }
    
    .table th, .table td {
        padding: 8px 6px;
        font-size: 12px;
    }
}

/* 风险详情 */
.risk-detail-section {
    margin-bottom: 20px;
}

.risk-detail-section h6 {
    color: #6c757d;
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
}

.sod-display {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 15px 0;
}

.sod-item {
    text-align: center;
}

.sod-item .value {
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
}

.sod-item .label {
    font-size: 11px;
    color: #6c757d;
    text-transform: uppercase;
}

/* 评估历史时间线 */
.assessment-timeline {
    position: relative;
    padding-left: 30px;
}

.assessment-timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #dee2e6;
}

.assessment-item {
    position: relative;
    padding-bottom: 15px;
}

.assessment-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #dc3545;
    border: 2px solid white;
    box-shadow: 0 0 0 2px #dc3545;
}

.assessment-date {
    font-size: 11px;
    color: #6c757d;
}

.assessment-change {
    font-size: 13px;
}

.rpn-change {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.rpn-change.decrease { color: var(--risk-low); }
.rpn-change.increase { color: var(--risk-critical); }

/* 措施列表 */
.action-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    background-color: #f8f9fa;
    margin-bottom: 8px;
}

.action-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    color: white;
}

.action-prevention { background-color: #28a745; }
.action-detection { background-color: #17a2b8; }
.action-contingency { background-color: #ffc107; }
.action-corrective { background-color: #dc3545; }

.action-info {
    flex: 1;
}

.action-name {
    font-weight: 500;
    font-size: 13px;
}

.action-meta {
    font-size: 11px;
    color: #6c757d;
}

.action-status {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
}

/* 风险矩阵计数 */
.matrix-count {
    font-size: 16px;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.matrix-cell.level-medium .matrix-count {
    color: #333;
    text-shadow: none;
}

/* 高危风险列表 */
.top-risk-item {
    padding: 10px 15px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.top-risk-item:hover {
    background-color: #fff5f5;
}

.top-risk-title {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-risk-info small {
    font-size: 11px;
}
