/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    line-height: 1.6;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* 主内容区域 - 三列布局 */
main.three-column-layout {
    display: grid;
    grid-template-columns: 280px 1fr 260px;
    gap: 25px;
    padding: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    min-height: 600px;
}

.column {
    display: flex;
    flex-direction: column;
}

/* 左列 */
.left-column {
    border-right: 2px solid #f0f0f0;
    padding-right: 15px;
}

/* 中列 */
.middle-column {
    padding: 0 15px;
    overflow-y: auto;
    max-height: calc(100vh - 250px);
}

/* 右列 */
.right-column {
    border-left: 2px solid #f0f0f0;
    padding-left: 15px;
}

/* 上传区域 */
.upload-section {
    padding: 0;
}

.upload-section h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.file-input-container {
    position: relative;
    margin-bottom: 20px;
}

#pdbFile {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

.file-input-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 15px;
    border: 3px dashed #667eea;
    border-radius: 10px;
    background: #f8f9ff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-input-label:hover {
    border-color: #764ba2;
    background: #f0f2ff;
    transform: translateY(-2px);
}

.upload-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.upload-text {
    font-size: 0.95rem;
    color: #666;
    text-align: center;
}

.file-types {
    font-size: 0.85rem;
    color: #999;
    margin-top: 5px;
}

/* 文件列表 */
.file-list {
    margin: 20px 0;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 6px;
}

.file-item .file-info {
    flex: 1;
}

.file-name {
    font-weight: bold;
    color: #333;
    font-size: 0.9rem;
}

.file-size {
    font-size: 0.8rem;
    color: #666;
    margin-top: 2px;
}

.remove-file {
    background: #dc3545;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
}

.remove-file:hover {
    background: #c82333;
}

/* 处理按钮 */
.process-section {
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    padding-bottom: 15px;
}

.process-section h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.process-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.process-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102,126,234,0.4);
}

.process-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 下载区域 */
.download-section {
    position: sticky;
    top: 0;
}

.download-section h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.download-hint {
    color: #999;
    font-size: 0.9rem;
    text-align: center;
    padding: 20px;
}

#downloadButtons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 结果区域 */
.results-section {
    padding: 40px;
    display: none;
}

.results-section.show {
    display: block;
}

.results-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 40px;
    display: none;
}

.loading.show {
    display: block;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 结果容器 */
.results-container {
    display: none;
}

.results-container.show {
    display: block;
}

.pdb-result {
    margin-bottom: 12px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
}

.pdb-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 12px;
    font-weight: bold;
    font-size: 0.9rem;
}

.chain-list {
    padding: 10px;
}

.chain-item {
    margin-bottom: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #667eea;
}

.chain-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.chain-name {
    font-weight: bold;
    color: #333;
    font-size: 1rem;
}

.chain-info {
    font-size: 0.9rem;
    color: #666;
}

.sequence-container {
    margin-top: 6px;
}

.sequence-label {
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
    margin-top: 6px;
    display: block;
    font-size: 0.9rem;
}

.fasta-header {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    background: #f8f9fa;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    color: #495057;
    margin-bottom: 10px;
    word-break: break-all;
}

.sequence {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.2;
    background: white;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    white-space: nowrap !important;
    word-break: keep-all !important;
    word-wrap: normal !important;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: 60px;
    text-overflow: clip;
}

.copy-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-right: 10px;
}

.copy-btn:hover {
    background: #218838;
}

.copy-seq-btn {
    background: #6f42c1;
}

.copy-seq-btn:hover {
    background: #5a32a3;
}

/* 链操作区域 */
.chain-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.download-single-btn {
    background: #fd7e14;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

.download-single-btn:hover {
    background: #e55a00;
}

/* 批量下载区域 */
.download-all h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.download-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.download-all {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e9ecef;
}

.download-btn {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 180px;
    text-align: center;
}

.download-btn:hover {
    background: #138496;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(19, 132, 150, 0.3);
}

/* 错误消息 */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border: 1px solid #f5c6cb;
    border-radius: 5px;
    margin: 10px 0;
}

/* 成功消息 */
.success-message {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border: 1px solid #c3e6cb;
    border-radius: 5px;
    margin: 10px 0;
}

/* 页脚 */
footer {
    text-align: center;
    margin-top: 30px;
    color: white;
    opacity: 0.8;
}

/* 下载区域 */
.download-section {
    position: sticky;
    top: 0;
}

.download-section h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.download-hint {
    color: #999;
    font-size: 0.9rem;
    text-align: center;
    padding: 20px;
}

#downloadButtons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.download-all {
    display: none;
}

.download-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.download-buttons h3 {
    display: none;
}

.download-btn {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    text-align: center;
}

.download-btn:hover {
    background: #138496;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(19, 132, 150, 0.3);
}

/* 响应式设计 */
@media (max-width: 1200px) {
    main.three-column-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .left-column, .right-column {
        border: none;
        padding: 0;
    }
    
    .middle-column {
        padding: 0;
        max-height: none;
    }
}
@media (max-width: 1200px) {
    main.three-column-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .left-column, .right-column {
        border: none;
        padding: 0;
    }
    
    .middle-column {
        padding: 0;
        max-height: none;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .file-input-label {
        padding: 30px 10px;
    }
    
    .upload-icon {
        font-size: 2rem;
    }
    
    .chain-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .chain-actions {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .download-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    
    .download-btn {
        min-width: auto;
        width: 100%;
    }
    
    .copy-btn, .download-single-btn {
        width: 100%;
        margin-right: 0;
    }
}