/* ================== 基础样式 ================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f5f5f7;
    color: #1d1d1f;
    line-height: 1.4;
    overflow-x: hidden;
}

/* ================== 布局样式 ================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    height: 100vh;
}

.sidebar {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    overflow-y: auto;
    position: relative;
}

.main-viewer {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    overflow: hidden;
    position: relative;
    min-height: 500px;
}

/* ================== 标题样式 ================== */
h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 32px;
    text-align: center;
}

/* ================== 上传区域样式 ================== */
.upload-section {
    margin-bottom: 24px;
}

.upload-area {
    border: 2px dashed #d1d1d6;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    background: #fbfbfd;
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 12px;
}

.upload-area:hover {
    border-color: #007aff;
    background: #f0f8ff;
    transform: translateY(-1px);
}

.upload-area.success {
    border-color: #30d158;
    background: #f0fff4;
}

input[type="file"] {
    display: none;
}

.upload-text {
    font-size: 14px;
    color: #86868b;
    margin-top: 4px;
}

.upload-text.success {
    color: #30d158;
    font-weight: 500;
}

/* ================== 按钮样式 ================== */
.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 12px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.btn-primary {
    background: #007aff;
    color: white;
}

.btn-primary:disabled {
    background: #d1d1d6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: #f2f2f7;
    color: #1d1d1f;
}

.btn-success {
    background: #30d158;
    color: white;
}

.btn-danger {
    background: #ff3b30;
    color: white;
}

.btn-export {
    background: #ff9500;
    color: white;
}

/* ================== 调试样式 ================== */
.btn-debug {
    background: #6c757d;
    color: white;
    font-size: 14px;
    opacity: 0.8;
}

.btn-debug:hover {
    opacity: 1;
    background: #5a6268;
}

/* ================== 圆形按钮样式 ================== */
.control-buttons {
    display: flex;
    gap: 16px;
    margin-top: 24px;
    justify-content: center;
}

.circle-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    background: #007aff;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0,122,255,0.3);
    position: relative;
}

.circle-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0,122,255,0.4);
}

.circle-btn:active {
    transform: scale(0.95);
}

.circle-btn.disabled {
    background: #d1d1d6;
    cursor: not-allowed;
    box-shadow: none;
}

.circle-btn.disabled:hover {
    transform: none;
}

.circle-btn.vibration {
    background: #30d158;
    box-shadow: 0 4px 16px rgba(48,209,88,0.3);
}

.circle-btn.vibration.playing {
    background: #ff3b30;
    box-shadow: 0 4px 16px rgba(255,59,48,0.3);
}

/* ================== 侧滑面板样式 ================== */
.slide-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1000;
    overflow-y: auto;
}

.slide-panel.open {
    right: 0;
}

.panel-header {
    padding: 24px;
    border-bottom: 1px solid #f2f2f7;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-size: 20px;
    font-weight: 600;
}

.close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f2f2f7;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.close-btn:hover {
    background: #e5e5ea;
}

.panel-content {
    padding: 24px;
}

/* ================== 控制组件样式 ================== */
.control-group {
    margin-bottom: 32px;
}

.control-label {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #1d1d1f;
}

.input-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.input-label {
    flex: 1;
    font-size: 14px;
    color: #86868b;
}

.number-input {
    width: 80px;
    padding: 8px 12px;
    border: 1px solid #d1d1d6;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    background: white;
    transition: border-color 0.2s ease;
}

.number-input:focus {
    outline: none;
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0,122,255,0.1);
}

.color-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.color-input {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    background: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ================== 遮罩层样式 ================== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ================== 3DMol容器样式 ================== */
#molecule-viewer {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 500px;
    overflow: hidden !important;
}

#molecule-viewer canvas {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 1 !important;
}

#molecule-viewer > div {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
}

/* ================== 状态指示器样式 ================== */
.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d1d1d6;
    margin-right: 8px;
    transition: background 0.3s ease;
}

.status-indicator.success {
    background: #30d158;
}

/* ================== 分隔线样式 ================== */
.divider {
    height: 1px;
    background: #f2f2f7;
    margin: 24px 0;
}

/* ================== 工具提示样式 ================== */
.btn-tooltip {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.circle-btn:hover .btn-tooltip {
    opacity: 1;
}

/* ================== 模式选择样式 ================== */
.mode-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d1d6;
    border-radius: 8px;
    background-color: white;
    font-size: 14px;
    margin-bottom: 12px;
}

.frequency-display {
    background: #f2f2f7;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    font-weight: 500;
    color: #007aff;
}

.mode-info {
    margin-bottom: 16px;
}

/* ================== Log文件上传特殊样式 ================== */
#logUpload {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: 2px solid transparent;
    margin-bottom: 16px;
}

#logUpload:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

#logUpload.success {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%);
    border-color: transparent;
}

#logUpload .upload-text {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

#logUpload.success .upload-text {
    color: white;
}

#logUpload .status-indicator {
    background: rgba(255, 255, 255, 0.3);
}

#logUpload.success .status-indicator {
    background: #30d158;
}

/* ================== 悬浮控制面板样式 ================== */
.floating-controls {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.floating-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1d1d1f;
    user-select: none;
    position: relative;
}

.floating-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.floating-btn:active {
    transform: scale(0.95);
    transition: all 0.1s ease;
}

.floating-btn:disabled {
    background: rgba(200, 200, 200, 0.7);
    cursor: not-allowed;
    opacity: 0.6;
}

.floating-btn:disabled:hover {
    transform: scale(0.95);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.floating-btn.active {
    background: rgba(0, 122, 255, 0.9);
    color: white;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3);
}

.floating-btn.active:hover {
    background: rgba(0, 122, 255, 1);    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.4);
}

/* ================== 响应式设计 ================== */
@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        height: auto;
        gap: 16px;
    }
    
    .main-viewer {
        height: 500px;
    }
    
    .slide-panel {
        width: 100vw;
        right: -100vw;
    }
}
