/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
    color: #e0e0e0;
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(90deg, #4facfe, #00f2fe);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 2px 10px rgba(79, 172, 254, 0.3);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.8;
    margin-top: 10px;
}

/* 主内容区域 */
.main-content {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* 控制面板样式 */
.control-panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    height: fit-content;
    position: sticky;
    top: 20px;
}

section {
    margin-bottom: 30px;
}

section:last-child {
    margin-bottom: 0;
}

h2 {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: #4facfe;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(79, 172, 254, 0.3);
}

/* 晶胞库网格 */
.crystal-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.crystal-btn {
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.2), rgba(0, 242, 254, 0.2));
    border: 1px solid rgba(79, 172, 254, 0.3);
    border-radius: 12px;
    padding: 15px 10px;
    color: #e0e0e0;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.crystal-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(79, 172, 254, 0.4);
    border-color: #4facfe;
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.3), rgba(0, 242, 254, 0.3));
}

.crystal-btn.active {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    color: #0f2027;
    font-weight: bold;
    border-color: #00f2fe;
}

.crystal-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

/* 上传区域样式 */
.upload-area {
    border: 2px dashed rgba(79, 172, 254, 0.4);
    border-radius: 15px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(79, 172, 254, 0.05);
}

.upload-area:hover {
    border-color: #4facfe;
    background: rgba(79, 172, 254, 0.1);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.8;
}

.upload-area p {
    margin-bottom: 15px;
    color: #aaa;
}

.file-info {
    font-size: 0.9rem;
    color: #888;
    margin-top: 10px;
}

/* 按钮样式 */
.btn {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    border: none;
    border-radius: 10px;
    padding: 12px 25px;
    color: #0f2027;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(79, 172, 254, 0.5);
}

/* 进度条 */
.upload-progress {
    margin-top: 20px;
}

.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4facfe, #00f2fe);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 4px;
}

.progress-text {
    font-size: 0.9rem;
    color: #4facfe;
}

/* 信息框样式 */
.info-box {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.info-row:last-child {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.label {
    font-weight: 600;
    color: #aaa;
    min-width: 100px;
}

.value {
    color: #4facfe;
    font-family: 'Consolas', monospace;
    text-align: right;
    max-width: 180px;
    word-break: break-all;
}

/* 控制按钮 */
.control-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.btn-control {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 12px;
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-control:hover {
    background: rgba(79, 172, 254, 0.2);
    border-color: #4facfe;
    transform: translateY(-2px);
}

.btn-control.active {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    color: #0f2027;
    border-color: #00f2fe;
}

.slider-container {
    grid-column: span 2;
    margin-top: 10px;
}

.slider-container label {
    display: block;
    margin-bottom: 8px;
    color: #aaa;
}

input[type="range"] {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #4facfe;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(79, 172, 254, 0.8);
}

/* 3D渲染区样式 */
.viewer-area {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.viewer-header {
    padding: 20px 25px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.viewer-header h2 {
    margin: 0;
    border: none;
    padding: 0;
}

.tool-tip {
    font-size: 0.9rem;
    color: #888;
}

.viewer-container {
    width: 100%;
    height: 600px;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    position: relative;
}

.viewer-footer {
    padding: 15px 25px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.atom-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
}

.legend-title {
    font-weight: 600;
    color: #aaa;
}

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

/* 导航链接 */
.nav-links {
    margin-top: 20px;
}

.nav-btn {
    display: inline-block;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    color: #4facfe;
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid rgba(79, 172, 254, 0.3);
    transition: all 0.3s;
    font-size: 0.95rem;
}

.nav-btn:hover {
    background: rgba(79, 172, 254, 0.2);
    border-color: #4facfe;
    transform: translateY(-2px);
}

/* 页脚样式 */
footer {
    text-align: center;
    padding: 25px 20px;
    margin-top: 40px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

footer p {
    margin-bottom: 10px;
    color: #aaa;
}

.copyright {
    font-size: 0.9rem;
    color: #666;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .crystal-grid {
        grid-template-columns: 1fr;
    }
    
    .control-buttons {
        grid-template-columns: 1fr;
    }
    
    .viewer-container {
        height: 400px;
    }
}

/* 加载动画 */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading {
    animation: pulse 1.5s infinite ease-in-out;
}

/* 通知样式 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    background: rgba(79, 172, 254, 0.9);
    color: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transform: translateX(150%);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.notification.show {
    transform: translateX(0);
}

.notification.error {
    background: rgba(255, 87, 87, 0.9);
}

.notification.success {
    background: rgba(76, 217, 100, 0.9);
}