@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes float {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 0.7; }
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica', 'Arial', sans-serif;
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
    overflow-y: auto; /* 允许垂直滚动 */
}

.chemical-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.molecule {
    position: absolute;
    opacity: 0.2;
}

.molecule-1 {
    top: 5%;
    left: 5%;
    width: 180px;
    height: 180px;
    animation: float 15s ease-in-out infinite, pulse 7s ease-in-out infinite;
}

.molecule-2 {
    bottom: 10%;
    right: 5%;
    width: 220px;
    height: 220px;
    animation: float 18s ease-in-out infinite, pulse 9s ease-in-out infinite;
}

.molecule-3 {
    top: 30%;
    right: 20%;
    width: 160px;
    height: 160px;
    animation: float 12s ease-in-out infinite, pulse 6s ease-in-out infinite;
}

.molecule-4 {
    bottom: 25%;
    left: 15%;
    width: 200px;
    height: 200px;
    animation: float 16s ease-in-out infinite, pulse 8s ease-in-out infinite;
}

.molecule-5 {
    top: 60%;
    left: 30%;
    width: 140px;
    height: 140px;
    animation: float 14s ease-in-out infinite, pulse 7s ease-in-out infinite;
}

.container {
    width: 80%;
    max-width: 1000px;
    position: relative;
    z-index: 1;
    max-height: 90vh; /* 设置最大高度为视口高度的90% */
    overflow-y: auto; /* 允许垂直滚动 */
}

.window {
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    max-height: 90vh; /* 设置最大高度为视口高度的90% */
}

.window:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.title-bar {
    background-color: #f6f6f6;
    border-bottom: 1px solid #e0e0e0;
    padding: 16px;
    display: flex;
    align-items: center;
}

.buttons {
    display: flex;
    gap: 12px;
}

.close, .minimize, .zoom {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close:hover, .minimize:hover, .zoom:hover {
    transform: scale(1.1);
}

.close {
    background-color: #ff5f56;
}

.minimize {
    background-color: #ffbd2e;
}

.zoom {
    background-color: #27c93f;
}

.title {
    flex-grow: 1;
    text-align: center;
    font-size: 20px;
    color: #333;
    font-weight: 500;
}

.content {
    flex-grow: 1;
    overflow-y: auto; /* 允许内容区域垂直滚动 */
    padding: 30px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.input-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: #007aff;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.2);
}

.input-group button {
    padding: 12px;
    font-size: 14px;
}

button {
    background-color: #007aff;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 15px 20px;
    cursor: pointer;
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

button:hover {
    background-color: #0056b3;
}

#result {
    background-color: #f8f8f8;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 30px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

#result.show {
    opacity: 1;
    transform: translateY(0);
}

.result-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 18px;
}

.label {
    font-weight: 500;
    color: #555;
}

.value {
    font-weight: 300;
    color: #007aff;
}

#chart {
    width: 100%;
    height: 300px;
    margin-top: 30px;
    margin-bottom: 30px; /* 添加底部边距 */
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.5s ease;
}

#chart.show {
    opacity: 1;
    transform: scale(1);
}

#loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100px;
}

.spinner {
    border: 4px solid rgba(0, 122, 255, 0.1);
    border-left-color: #007aff;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hidden {
    display: none;
}

@media (max-width: 520px) {
    .container {
        width: 90%;
    }
}

.nav-bar {
    background-color: #f6f6f6;
    border-bottom: 1px solid #e0e0e0;
    padding: 10px 0;
}

.nav-bar ul {
    display: flex;
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.nav-bar li {
    flex: 1;
    text-align: center;
}

.nav-bar a {
    display: block;
    padding: 15px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    font-size: 18px;
}

.nav-bar a:hover, .nav-bar a.active {
    background-color: #e0e0e0;
    color: #007aff;
}

.section {
    padding: 30px;
}

.section h2 {
    margin-top: 0;
    color: #333;
    font-size: 24px;
    margin-bottom: 20px;
}

.section p {
    font-size: 16px;
    line-height: 1.6;
}

@media (max-width: 768px) {
    .container {
        width: 95%;
    }
    
    .title {
        font-size: 18px;
    }
    
    .nav-bar a {
        padding: 10px;
        font-size: 16px;
    }
}

/* 其他样式保持不变 */

/* 添加自定义滚动条样式 */
.container::-webkit-scrollbar,
.content::-webkit-scrollbar {
    width: 8px;
}

.container::-webkit-scrollbar-track,
.content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.container::-webkit-scrollbar-thumb,
.content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.container::-webkit-scrollbar-thumb:hover,
.content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 添加以下样式 */
#data-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
    resize: vertical;
    min-height: 150px;
}

#data-input:focus {
    outline: none;
    border-color: #007aff;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.2);
}

/* 添加以下样式 */
select, .checkbox-group {
    width: 100%;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 10px;
}

.checkbox-group {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: center;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 5px;
}

.checkbox-group input[type="number"] {
    width: 100%;
    padding: 5px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 14px;
}

.checkbox-group input[type="number"]:focus {
    outline: none;
    border-color: #007aff;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.2);
}

/* 在文件末尾添加以下样式 */
select option {
    padding: 10px;
}

select option i, .checkbox-group label i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
}

.checkbox-group label i {
    font-size: 1.2em;
}

/* 修改图标颜色 */
select option[value="allDB"] i { color: #007bff; }
select option[value="plantDB"] i { color: #28a745; }
select option[value="MicroDB"] i { color: #ffc107; }
select option[value="DrugDB"] i { color: #dc3545; }

.checkbox-group label:nth-child(1) i { color: #17a2b8; }
.checkbox-group label:nth-child(3) i { color: #6610f2; }
.checkbox-group label:nth-child(5) i { color: #fd7e14; }

#evaluator option[value="FPS"] i { color: #4CAF50; }
#evaluator option[value="AAS"] i { color: #2196F3; }
#evaluator option[value="CSS"] i { color: #FF9800; }
#evaluator option[value="FPSS"] i { color: #9C27B0; }

/* 在文件末尾添加以下样式 */
#evaluator {
    width: 100%;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 10px;
}

#evaluator option i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* 为不同的评估器设置不同的颜色 */
#evaluator option[value="FPS"] i { color: #4CAF50; }
#evaluator option[value="AAS"] i { color: #2196F3; }
#evaluator option[value="CSS"] i { color: #FF9800; }
#evaluator option[value="FPSS"] i { color: #9C27B0; }

/* 在文件末尾添加以下样式 */
#results {
    padding: 20px;
}

#result-content {
    background-color: #f8f8f8;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 20px;
}

#result-chart {
    width: 100%;
    height: 300px;
    margin-top: 20px;
}

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

.result-table th,
.result-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.result-table th {
    background-color: #f2f2f2;
}

.result-row-0 { background-color: #f0f8ff; }
.result-row-1 { background-color: #f0fff0; }
.result-row-2 { background-color: #fff0f0; }
.result-row-3 { background-color: #f0f0ff; }
.result-row-4 { background-color: #fffff0; }

.result-table tr:hover {
    background-color: #e6e6e6;
}

.result-table img {
    max-width: 100px;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* 在文件末尾添加以下样式 */
.result-table tr {
    cursor: pointer;
    position: relative;
}

/* 添加一个小图标表示可点击 */
.result-table td:first-child::after {
    content: "👆";  /* 使用手指表情符号 */
    font-size: 12px;
    margin-left: 5px;
    opacity: 0.5;
}

/* 添加提示文本 */
.result-table thead tr::after {
    content: "Click row for details";
    position: absolute;
    right: 10px;
    color: #666;
    font-size: 0.9em;
    font-style: italic;
}

/* 保持原有的悬浮效果 */
.result-table tr:hover {
    background-color: #e6e6e6;
}

/* 确保悬浮图片的样式不变 */
.hover-image {
    position: fixed;
    z-index: 1000;
    max-width: 200px;
    max-height: 200px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    pointer-events: none;
}

#label-chart {
    max-width: 400px;
    margin: 20px auto;
    display: block; /* 确保 canvas 是块级元素 */
}

#data-distribution-chart {
    width: 100%;
    max-width: 800px;
    height: 400px;
    margin: 20px auto;
    display: block;
}

#data-distribution-chart, #label-chart {
    width: 100%;
    max-width: 800px;
    height: 400px;
    margin: 20px auto;
    display: block;
}

.intro-image img {
    max-width: 100%;
    height: auto;
    max-height: 300px;
    display: block;
    margin: 0 auto;
}

/* 详细分析部分的样式 */
#detailed-analysis {
    margin-top: 30px;
    padding: 20px;
    background-color: #f8f8f8;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.molecule-details {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.structure-view {
    flex: 1;
    text-align: center;
}

.structure-view img {
    max-width: 300px;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chemical-info {
    flex: 1;
}

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

.info-table td {
    padding: 8px;
    border-bottom: 1px solid #ddd;
}

.info-table td:first-child {
    font-weight: bold;
    width: 120px;
}

/* 添加点击效果到结果表格的行 */
.result-table tr {
    cursor: pointer;
    transition: background-color 0.2s;
}

.result-table tr:hover {
    background-color: #e6e6e6;
}

.result-table tr.selected {
    background-color: #007bff20;
}

.analysis-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.analysis-header h3 {
    margin: 0 0 0 20px;
}

.back-button {
    padding: 8px 16px;
    background-color: #f0f0f0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    display: flex;
    align-items: center;
    transition: background-color 0.2s;
}

.back-button:hover {
    background-color: #e0e0e0;
}

#detailed-analysis {
    scroll-margin-top: 20px; /* 确保滚动时留有一些空间 */
}

.pubchem-button {
    margin-top: 10px;
    padding: 8px 16px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.pubchem-button:hover {
    background-color: #45a049;
}

.pubchem-info {
    margin-top: 20px;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.pubchem-content {
    margin-top: 10px;
}

.search-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
}

.search-button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    color: white;
}

#search-pubchem {
    background-color: #4CAF50;
}

.search-button:hover {
    filter: brightness(90%);
}

.logo-container {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.results-logo {
    width: 150px;  /* 调整大小 */
    height: auto;
    opacity: 0.9;  /* 稍微透明 */
    transition: opacity 0.3s ease;
}

.results-logo:hover {
    opacity: 1;
}

/* 确保结果部分有相对定位 */
#results.section {
    position: relative;
}

/* Analysis Section Styles */
.analysis-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.15);
}

.analysis-header {
    text-align: center;
    margin-bottom: 40px;
}

.analysis-header h2 {
    color: #2c3e50;
    font-size: 32px;
    margin-bottom: 10px;
}

.header-description {
    color: #7f8c8d;
    font-size: 16px;
}

.analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.parameter-section {
    background: #ffffff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}

.parameter-section:hover {
    transform: translateY(-5px);
}

.section-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    color: #2c3e50;
}

.section-header i {
    font-size: 24px;
    margin-right: 15px;
    color: #3498db;
}

.section-header h3 {
    margin: 0;
    font-size: 20px;
}

.styled-select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    color: #2c3e50;
    background: #fff;
    transition: all 0.3s ease;
}

.styled-select:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.filter-grid {
    display: grid;
    gap: 15px;
}

.filter-item {
    display: flex;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    width: 100%;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    margin-right: 10px;
    position: relative;
    transition: all 0.3s ease;
}

.checkbox-label input:checked + .checkbox-custom {
    background: #3498db;
    border-color: #3498db;
}

.checkbox-label input:checked + .checkbox-custom::after {
    content: '✓';
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.filter-input {
    width: 80px;
    padding: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    margin-left: auto;
    transition: all 0.3s ease;
}

.filter-input:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.input-section {
    background: #ffffff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.input-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#data-input {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    line-height: 1.5;
    resize: vertical;
    transition: all 0.3s ease;
}

#data-input:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.button-container {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.styled-button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.example-button {
    background: #f39c12;
    color: white;
}

.analyze-button {
    background: #2ecc71;
    color: white;
}

.styled-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.styled-button i {
    font-size: 18px;
}

.parameter-group {
    margin-bottom: 20px;
}

.parameter-group h3 {
    margin-bottom: 10px;
}

.input-group {
    margin-top: 20px;
}

.button-group {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}
