/* ========================================
   ReaxTools Web - 样式表
   ======================================== */

/* ========================================
   基础样式设置
   ======================================== */
* {
    box-sizing: border-box;
}

body {
    /* font-family: 'Microsoft YaHei', monospace; */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 20px;
    max-width: 1600px;
    margin: 0 auto;
    padding: 1rem;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

/* ========================================
   标题样式
   ======================================== */
h2 {
    color: #2c3e50;
    border-bottom: 3px solid #3498db;
    padding-bottom: 10px;
    margin-bottom: 20px;
    margin-left: 10px;
}

h3 {
    color: #34495e;
    margin-top: 0;
    margin-bottom: 15px;
    margin-left: 10px;
}

/* ========================================
   段落和链接样式
   ======================================== */
p {
    margin-top: 3px;
    margin-bottom: 3px;
    margin-left: 10px;
    text-align: justify;
}

ul {
    margin-top: 6px;
    margin-bottom: 6px;
    text-align: justify;
    margin-left: 10px;
}

b {
    color: #ee3333;
    margin-top: 3px;
    margin-bottom: 3px;
}

a {
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #2980b9;
    text-decoration: underline;
}

title {
    font-family: 'Consolas', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 24;
    margin-top: 4px;
    margin-bottom: 4px;
    color: #333;
    line-height: 1.6;
}

/* ========================================
   表单元素样式
   ======================================== */
input,
button {
    margin: 0px 0px 0px 0px;
    padding: 12px 15px;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    transition: all 0.3s ease;
}

input:focus,
button:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

/* 输入框特殊样式 */
#argsInput {
    width: 300px;
    background-color: #fff;
}

#argsInput::placeholder {
    color: #95a5a6;
    font-style: italic;
}

/* 文件输入框样式 */
input[type="file"] {
    background-color: #fff;
    cursor: pointer;
}

input[type="file"]:hover {
    border-color: #3498db;
}

/* ========================================
   按钮样式
   ======================================== */
button {
    background-color: #3498db;
    color: white;
    cursor: pointer;
    font-weight: 500;
    border: none;
    min-width: 100;
}

button:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 次要按钮样式 */
.chart-controls button {
    min-width: 100;
    margin: 5px;
    padding: 8px 12px;
    font-size: 1.0rem;
    background-color: #95a5a6;
}

.chart-controls button:hover {
    background-color: #7f8c8d;
}

#clearAllBtn {
    min-width: 100;
    background-color: #e74c3c;
    border-color: #e74c3c;
}

#clearAllBtn:hover {
    background-color: #722323;
    border-color: #722323;
}

/* ========================================
   容器样式
   ======================================== */
/* 通用容器样式 */
.container {
    border: 1px solid #ddd;
    padding: 20px;
    margin-top: 15px;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 输入区域样式 */
#input {
    border: 2px solid #3498db;
    padding: 20px;
    margin-top: 15px;
    border-radius: 8px;
    background-color: #ecf0f1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#input h3 {
    color: #2c3e50;
    margin-top: 0;
}

/* 输出区域样式 */
#output {
    background-color: #fff;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    border-left: 4px solid #27ae60;
}

/* ========================================
   日志输出区域样式
   ======================================== */
#log-container {
    border: 1px solid #ddd;
    padding: 20px;
    margin-top: 15px;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#log-output {
    background-color: #ecf0f1;
    /* color: #ecf0f1; */
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    border-radius: 6px;
    min-height: 200px;
    /* font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; */
    font-family: 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    border: 2px solid #3498db;
}

.code-container {
    background-color: #f4f7fa;
    /* 更淡雅的背景色 */
    border: 3px solid #b0bec5;
    border-radius: 6px;
    /* 边框更细腻 */
    padding: 12px 18px;
    /* 内边距更均衡 */
    margin: 10px 10px 10px 10px;
    /* 上下间距 */
    overflow-x: auto;
    /* 横向滚动 */
    white-space: pre;
    /* 保持代码格式，不自动换行 */
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.08);
    /* 轻微阴影 */
    font-family: 'Consolas', 'Fira Mono', 'Menlo', 'Monaco', monospace;
    /* 优化等宽字体 */
    font-size: 20px;
    /* 稍微小一点 */
    line-height: 1.7;
    /* 行距更舒适 */
}

/* 日志滚动条样式 */
#log-output::-webkit-scrollbar {
    width: 8px;
}

#log-output::-webkit-scrollbar-track {
    background: #34495e;
    border-radius: 4px;
}

#log-output::-webkit-scrollbar-thumb {
    background: #7f8c8d;
    border-radius: 4px;
}

#log-output::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}

/* ========================================
   图表区域样式
   ======================================== */
#charts-container {
    border: 1px solid #ddd;
    padding: 20px;
    margin-top: 15px;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-height: 200px;
}

.chart-controls {
    margin: 15px 0;
    padding: 15px;
    background-color: #ecf0f1;
    border-radius: 6px;
    border: 1px solid #bdc3c7;
}

.chart-controls button {
    margin: 5px;
    padding: 8px 12px;
    font-size: 0.9rem;
    background-color: #95a5a6;
    border: none;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.chart-controls button:hover {
    background-color: #7f8c8d;
    transform: translateY(-1px);
}

#charts-area {
    margin-top: 15px;
}

/* ========================================
   响应式设计
   ======================================== */
@media (max-width: 768px) {
    body {
        padding: 0.5rem;
        max-width: 100%;
    }

    #argsInput {
        width: 100%;
        max-width: 300px;
    }

    input,
    button {
        margin: 5px 5px 5px 0;
        padding: 10px;
        font-size: 0.9rem;
    }

    .container,
    #input,
    #log-container,
    #charts-container {
        padding: 15px;
        margin-top: 10px;
    }

    #log-output {
        max-height: 200px;
        min-height: 150px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.25rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.2rem;
    }

    input,
    button {
        width: 100%;
        margin: 5px 0;
    }

    #argsInput {
        max-width: none;
    }
}

/* ========================================
   动画效果
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container,
#input,
#log-container,
#charts-container {
    animation: fadeIn 0.5s ease-out;
}

/* ========================================
   状态指示器
   ======================================== */
.processing {
    background-color: #fff3cd !important;
    border-color: #ffeaa7 !important;
    color: #856404 !important;
}

.success {
    background-color: #d4edda !important;
    border-color: #c3e6cb !important;
    color: #155724 !important;
}

.error {
    background-color: #f8d7da !important;
    border-color: #f5c6cb !important;
    color: #721c24 !important;
}

/* ========================================
   工具提示样式
   ======================================== */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #2c3e50;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.8rem;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* 全局字体：西文 Consolas，中文默认 */
html,
body {
    font-family: Consolas, "PingFang SC", "Microsoft YaHei", "WenQuanYi Micro Hei", "Noto Sans SC", "Source Han Sans SC", "Heiti SC", "SimHei", "STHeiti", Arial, sans-serif;
}

:lang(zh),
body:lang(zh),
*:lang(zh) {
    font-family: "PingFang SC", "Microsoft YaHei", "WenQuanYi Micro Hei", "Noto Sans SC", "Source Han Sans SC", "Heiti SC", "SimHei", "STHeiti", Arial, sans-serif;
}

/* Key molecules 表格样式 */
.key-mol-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1rem;
    background-color: white;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.key-mol-table thead tr {
    background-color: #3498db;
    color: white;
    font-weight: bold;
}

.key-mol-table th,
.key-mol-table td {
    font-size: 20px;
    padding: 12px 8px;
    text-align: left;
    border-bottom: 2px solid #2980b9;
    font-family: inherit;
}

.key-mol-table tbody tr {
    font-size: 20px;
    border-bottom: 1px solid #ecf0f1;
    transition: background-color 0.2s ease;
}

.key-mol-table tbody tr:nth-child(even) {
    font-size: 20px;
    background-color: #f8f9fa;
}

.key-mol-table tbody tr:hover {
    font-size: 20px;
    background-color: #e3f2fd;
}

.key-mol-table td.molecule {
    font-size: 20px;
    font-weight: bold;
    color: #2c3e50;
}

.key-mol-table td.from {
    font-size: 20px;
    color: #2980b9;
    font-family: inherit;
}

.key-mol-table td.to {
    font-size: 20px;
    color: #e74c3c;
    font-family: inherit;
}

/* log-output 也用等宽字体 */
#log-output {
    font-family: Consolas, monospace;
}

/* 性能测试表格样式 */
.perf-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background-color: #fff;
    font-size: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.perf-table th,
.perf-table td {
    border: 1px solid #3498db;
    padding: 10px 8px;
    text-align: center;
}

.perf-table thead tr {
    background-color: #3498db;
    color: #fff;
}

.perf-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.perf-table tbody tr:hover {
    background-color: #e3f2fd;
}

#network-info {
    background-color: #ecf0f1;
    padding: 15px;
    min-height: 200px;
    max-height: 300px;
    border-radius: 6px;
    border: 2px solid #3498db;
    font-family: Consolas, monospace;
    font-size: 0.95rem;
    line-height: 1.4;
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    margin-top: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    color: #333;
}

/* ========================================
   动态生成的图表样式
   ======================================== */

/* Key Molecules 可视化容器 */
.key-mol-charts-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.key-mol-chart-div {
    width: 100%;
    height: 400px;
}

.key-mol-table-container {
    margin-top: 20px;
    padding: 15px;
    background-color: #fff;
    border-radius: 5px;
    border: 1px solid #fff;
}

.key-mol-table-title {
    margin: 0 0 15px 0;
    color: #34495e;
    font-weight: bold;
}

.key-mol-scroll-container {
    /* max-height: 400px; */
    /* overflow-y: auto; */
    border: 1px solid #fff;
    border-radius: 5px;
}

/* 图表容器通用样式 */
.chart-main-div {
    width: 100%;
    min-height: 400px;
    margin-bottom: 20px;
}

.chart-network-div {
    width: 100%;
    min-height: 400px;
}

.chart-keymol-div {
    width: 100%;
    min-height: 400px;
}

.chart-csv-div {
    width: 100%;
    min-height: 400px;
}

/* 网络图样式 */
.chart-suptitle {
    text-align: left;
    margin-bottom: 10px;
    font-size: 24px;
    margin-top: 10px;
    color: #34495e;
    font-weight: bold;
}

.sigma-container {
    width: 100%;
    overflow: hidden;
    border: 2px solid #3498db;
    border-radius: 5px;
    background-color: #fff;
    padding: 0;
    margin-bottom: 10px;
    position: relative;
}

.network-info-box {
    display: flex;
    flex-direction: row;
    gap: 20px;
    width: 100%;
    margin-top: 10px;
}

.network-info-col {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
}

.network-info-note {
    color: #888;
}

/* 网络信息列显示/隐藏 */
.network-info-col.hidden {
    display: none;
}

.network-info-col.visible {
    display: block;
}

/* 错误消息样式 */
.error-message {
    color: red;
}

/* Sigma.js 错误消息样式 */
.sigma-error-message {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

/* 恢复信息样式 */
.restore-info {
    color: #666;
    font-size: 0.9em;
}