/* 数值模拟器样式 */

/* ==================== 容器 ==================== */
/* 确保父容器撑满屏幕 */
#simulator-page {
    width: 100%;
    height: 100vh; /* 强制视口高度 */
    display: flex;
    flex-direction: column;
    background: #1a1a2e;
    color: #eee;
    overflow: hidden; /* 防止页面整体滚动 */
    position: fixed; /* 确保覆盖其他内容 */
    top: 0;
    left: 0;
    z-index: 100;
}

/* 内容区域撑满剩余空间 */
#simulator-content-area {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.simulator-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.simulator-nav-header {
    flex-shrink: 0;
    background: #16213e;
    border-bottom: 1px solid #0f3460;
    z-index: 10;
}

.simulator-body {
    flex: 1;
    overflow-y: auto; /* 内容区域可滚动 */
    padding-bottom: 80px; /* 底部留白，防止内容被遮挡 */
    position: relative;
    /* 滚动条样式优化 */
    scrollbar-width: thin;
    scrollbar-color: #3498db #16213e;
}

.simulator-body::-webkit-scrollbar {
    width: 8px;
}

.simulator-body::-webkit-scrollbar-track {
    background: #16213e;
}

.simulator-body::-webkit-scrollbar-thumb {
    background-color: #3498db;
    border-radius: 4px;
}

.simulator-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #16213e;
    border-bottom: 1px solid #0f3460;
    flex-shrink: 0;
}

.simulator-header h2 {
    margin: 0;
    color: #eee;
}

.simulator-actions {
    display: flex;
    gap: 10px;
}

/* ==================== 标签页 ==================== */
.simulator-tabs {
    display: flex;
    gap: 5px;
    padding: 10px 20px;
    background: #16213e;
}

.tab-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    border-radius: 5px 5px 0 0;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: #eee;
    background: rgba(255, 255, 255, 0.1);
}

.tab-btn.active {
    color: #eee;
    background: #1a1a2e;
}

.tab-panel {
    display: none;
    padding: 20px;
}

.tab-panel.active {
    display: block;
}

/* ==================== 列表 ==================== */
.simulator-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 15px;
}

.simulator-item {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 10px;
    padding: 15px;
    transition: all 0.3s;
}

.simulator-item:hover {
    border-color: #e94560;
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.2);
}

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

.item-name {
    margin: 0;
    font-size: 1.1em;
    color: #eee;
}

.item-date {
    font-size: 0.85em;
    color: #888;
}

.item-description {
    color: #aaa;
    font-size: 0.9em;
    margin: 10px 0;
    min-height: 40px;
}

.item-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}

.tag {
    padding: 2px 8px;
    background: #0f3460;
    border-radius: 3px;
    font-size: 0.8em;
    color: #888;
}

.item-summary {
    display: flex;
    gap: 15px;
    padding: 8px 0;
    border-top: 1px solid #0f3460;
    border-bottom: 1px solid #0f3460;
    margin-bottom: 10px;
}

.summary-item {
    font-size: 0.9em;
    color: #aaa;
}

.item-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ==================== 按钮 ==================== */
.btn-primary, .btn-secondary, .btn-success, .btn-small {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s;
}

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

.btn-primary:hover {
    background: #ff6b6b;
}

.btn-primary:disabled {
    background: #555;
    cursor: not-allowed;
}

.btn-secondary {
    background: #0f3460;
    color: #eee;
}

.btn-secondary:hover {
    background: #1a4a70;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #2ecc71;
}

.btn-small {
    padding: 5px 12px;
    font-size: 0.85em;
}

.item-actions button {
    padding: 5px 12px;
    font-size: 0.85em;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: #0f3460;
    color: #eee;
}

.item-actions button:hover {
    background: #1a4a70;
}

.item-actions .btn-run {
    background: #27ae60;
}

.item-actions .btn-delete {
    background: #e74c3c;
}

/* ==================== 结果评级 ==================== */
.result-rating {
    padding: 8px 15px;
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
    margin-bottom: 10px;
}

/* ==================== 空状态 ==================== */
.simulator-empty {
    text-align: center;
    padding: 60px 20px;
    color: #555;
}

.simulator-empty p {
    margin: 10px 0;
}

.simulator-empty .hint {
    font-size: 0.9em;
    color: #444;
}

/* ==================== 编辑器 ==================== */
.simulator-editor {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #16213e;
    flex-shrink: 0;
}

.editor-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.editor-section {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.editor-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #eee;
}

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

.form-row {
    margin-bottom: 15px;
}

.form-row label {
    display: block;
    margin-bottom: 5px;
    color: #aaa;
}

.form-row input[type="text"],
.form-row input[type="number"],
.form-row textarea {
    width: 100%;
    max-width: 400px;
    padding: 10px;
    background: #0f3460;
    border: 1px solid #1a4a70;
    border-radius: 5px;
    color: #eee;
    font-size: 0.9em;
}

.form-row textarea {
    min-height: 60px;
    resize: vertical;
}

.form-row .hint {
    margin-left: 10px;
    color: #666;
    font-size: 0.85em;
}

/* ==================== 队伍列表 ==================== */
.team-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.team-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #0f3460;
    border-radius: 8px;
}

.team-item .item-avatar {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a4a70;
    border-radius: 50%;
}

.team-item .item-info {
    flex: 1;
}

.team-item .item-info h4 {
    margin: 0 0 5px 0;
}

.team-item .item-stats {
    margin: 0;
    color: #888;
    font-size: 0.9em;
}

.empty-hint {
    text-align: center;
    padding: 30px;
    color: #555;
}

/* ==================== 模板 ==================== */
.template-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.template-btn {
    padding: 10px 20px;
    background: #0f3460;
    border: 1px solid #1a4a70;
    border-radius: 5px;
    color: #eee;
    cursor: pointer;
}

.template-btn:hover {
    background: #1a4a70;
    border-color: #e94560;
}

/* ==================== 弹窗 ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #16213e;
    border-radius: 10px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #888;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.character-grid, .enemy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.character-card, .enemy-card {
    padding: 15px;
    background: #0f3460;
    border-radius: 8px;
    text-align: center;
}

.character-card .card-avatar,
.enemy-card .card-avatar {
    font-size: 32px;
    margin-bottom: 10px;
}

.character-card h4,
.enemy-card h4 {
    margin: 0 0 10px 0;
}

.card-stats {
    color: #888;
    font-size: 0.9em;
    margin-bottom: 10px;
}

/* ==================== 结果查看 ==================== */
.result-viewer, .comparison-viewer {
    max-width: 1200px;
    margin: 0 auto;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #16213e;
    border-bottom: 1px solid #0f3460;
}

.header-left h2 {
    margin: 0;
}

.result-time {
    color: #888;
    margin: 5px 0 0 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.rating-badge {
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
}

.result-section {
    padding: 20px;
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 10px;
    margin: 20px;
}

.result-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

/* ==================== 指标卡片 ==================== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.metric-card {
    padding: 20px;
    background: #0f3460;
    border-radius: 8px;
    text-align: center;
}

.metric-label {
    color: #888;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.metric-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #eee;
}

.metric-value.success {
    color: #27ae60;
}

.metric-value.danger {
    color: #e74c3c;
}

/* ==================== 统计表格 ==================== */
.stats-table {
    width: 100%;
    border-collapse: collapse;
}

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

.stats-table th {
    color: #888;
    font-weight: normal;
}

.death-rate.high {
    color: #e74c3c;
}

.death-rate.medium {
    color: #f39c12;
}

.death-rate.low {
    color: #27ae60;
}

/* ==================== 对比表格 ==================== */
.comparison-table-wrapper {
    overflow-x: auto;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
}

.comparison-table td {
    padding: 10px;
    border: 1px solid #0f3460;
}

.comparison-table .row-label {
    background: #0f3460;
    font-weight: bold;
}

.comparison-table .separator {
    background: #1a4a70;
}

.comparison-table .group-header {
    background: #1a4a70;
    font-weight: bold;
}

.comparison-table .numeric {
    text-align: right;
}

/* ==================== 变化分析 ==================== */
.changes-summary {
    padding: 15px;
    background: #0f3460;
    border-radius: 8px;
}

.changes-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.change-item {
    display: grid;
    grid-template-columns: 100px 1fr auto 1fr;
    gap: 15px;
    align-items: center;
    padding: 10px;
    background: #1a4a70;
    border-radius: 5px;
}

.change-icon.increase {
    color: #e74c3c;
}

.change-icon.decrease {
    color: #27ae60;
}

.change-icon.neutral {
    color: #888;
}

/* ==================== 趋势图 ==================== */
.trend-charts {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.trend-chart {
    background: #0f3460;
    border-radius: 8px;
    padding: 15px;
}

.trend-chart h4 {
    margin-top: 0;
    margin-bottom: 15px;
}

.chart-container {
    overflow-x: auto;
}

.trend-svg {
    min-width: 100%;
    height: 150px;
}

/* ==================== 评估 ==================== */
.assessment {
    padding: 15px;
}

.assessment-rating {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 25px;
    background: #0f3460;
    border-radius: 8px;
    margin-bottom: 20px;
}

.assessment-rating.good {
    background: rgba(39, 174, 96, 0.2);
    border: 1px solid #27ae60;
}

.assessment-rating.bad {
    background: rgba(231, 76, 60, 0.2);
    border: 1px solid #e74c3c;
}

.rating-grade {
    font-size: 2em;
    font-weight: bold;
}

.assessment-issues,
.assessment-suggestions {
    margin-top: 15px;
    padding: 15px;
    background: #0f3460;
    border-radius: 8px;
}

.assessment-issues h4,
.assessment-suggestions h4 {
    margin-top: 0;
    color: #f39c12;
}

.assessment-issues ul,
.assessment-suggestions ul {
    margin: 10px 0 0 20px;
}

/* ==================== 对比选区 ==================== */
.compare-section {
    margin-top: 30px;
    padding: 20px;
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 10px;
}

.compare-section h4 {
    margin-top: 0;
}

.compare-items {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 15px 0;
}

.compare-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: #0f3460;
    border-radius: 5px;
}

.compare-item .btn-remove {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 18px;
}

/* ==================== 进度弹窗 ==================== */
.simulator-progress-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.progress-content {
    background: #16213e;
    padding: 30px;
    border-radius: 10px;
    width: 400px;
    text-align: center;
}

.progress-content h3 {
    margin-top: 0;
}

.progress-title {
    color: #888;
    margin-bottom: 20px;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #0f3460;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #e94560, #ff6b6b);
    transition: width 0.3s;
}

.progress-text {
    color: #888;
}

/* ==================== Toast ==================== */
.simulator-toast {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ==================== 百分位可视化 ==================== */
.percentile-bar {
    margin-top: 20px;
}

.percentile-visual {
    position: relative;
    height: 60px;
    margin-top: 30px;
}

.percentile-scale {
    display: flex;
    justify-content: space-between;
    color: #888;
    font-size: 0.85em;
}

.percentile-markers {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
}

.marker {
    position: absolute;
    font-size: 0.75em;
    color: #888;
    transform: translateX(-50%);
}

.marker::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 20px;
    width: 1px;
    height: 40px;
    background: #888;
}

.marker-75 {
    color: #f39c12;
}

.marker-75::after {
    background: #f39c12;
}

.marker-90 {
    color: #e74c3c;
}

.marker-90::after {
    background: #e74c3c;
}
