/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: linear-gradient(135deg, #5592ee 0%, #97b5e4 100%);
    min-height: 100vh;
    color: #333;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ai-badge {
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

.version-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 500;
}

.header-right a {
    color: white;
    text-decoration: none;
    transition: opacity 0.2s;
}

.header-right a:hover {
    opacity: 0.8;
}

/* 容器布局 */
.container {
    display: flex;
    gap: 2rem;
    padding: 2rem;
    height: calc((100vh - 80px) *1.0); /* 将思维导图区域高度减少到75% */

    max-width: 1600px;
    margin: 0 auto;
}

/* 编辑器面板 */
.editor-panel {
    width: 420px;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.panel-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-weight: 600;
    font-size: 1.1rem;
}

/* 模式切换器 */
.mode-switcher {
    display: flex;
    gap: 0.5rem;
}

/* 隐藏文件处理模式 */
#file-mode-btn {
    display: none;
}

#file-mode {
    display: none !important;
}

.mode-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.mode-btn.active {
    background: rgb(56, 54, 54);
    color: #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 模式内容 */
.mode-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    background: #fafbfc;
}

/* 思维导图面板 */
.mindmap-panel {
    flex: 1;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.mindmap-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.mindmap-container {
    width: 100%;
    height: calc(100% - 60px);
    background: #fafbfc;
    position: relative;
    flex: 1;
}

#mindmap {
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 0 0 16px 16px;
}

/* 按钮样式改进 */
.control-btn {
    padding: 0.7rem 1.2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.control-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.control-btn.secondary {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(116, 185, 255, 0.3);
}

.control-btn.secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(116, 185, 255, 0.4);
}

.control-btn.danger {
    background: linear-gradient(135deg, #fd79a8 0%, #e84393 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(253, 121, 168, 0.3);
}

.control-btn.danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(253, 121, 168, 0.4);
}

.control-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* 上传区域改进 */
.upload-area {
    border: 2px dashed #93b1e0;
    border-radius: 12px;
    padding: 2.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f2ff 100%);
}

.upload-area:hover {
    border-color: #667eea;
    background: linear-gradient(135deg, #f0f2ff 0%, #e8ebff 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.1);
}

.upload-area.dragover {
    border-color: #667eea;
    background: linear-gradient(135deg, #e8ebff 0%, #dde1ff 100%);
    transform: scale(1.02);
}

/* 配置区域改进 */
.ai-config {
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f2ff 100%);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.config-textarea {
    width: 100%;
    min-height: 80px;
    padding: 1rem;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    transition: all 0.3s;
    background: white;
}

.config-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 加载动画改进 */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    color: #666;
    gap: 1rem;
    backdrop-filter: blur(5px);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.hidden {
    display: none !important;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .container {
        flex-direction: column;
        height: auto;
        gap: 1.5rem;
    }
    
    .editor-panel {
        width: 100%;
        height: auto;
    }
    
    .mindmap-panel {
        height: 600px; /* 修改这里：将右侧思维导图高度从600px减少到450px（75%） */
    }
    
    .text-input {
        min-height: 250px;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .container {
        padding: 1rem;
        gap: 1rem;
    }
    
    .mode-switcher {
        flex-direction: column;
        gap: 0.3rem;
    }
    
    .button-row {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .text-input {
        min-height: 200px;
    }
}

/* URL模式样式 */
.url-input-section {
    margin-bottom: 1rem;
}

.url-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    background: white;
}

.url-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.url-content-section {
    margin-top: 1rem;
}

.url-status {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #667eea;
}

.url-status.loading {
    color: #667eea;
    border-left-color: #667eea;
}

.url-status.success {
    color: #28a745;
    border-left-color: #28a745;
}

.url-status.error {
    color: #dc3545;
    border-left-color: #dc3545;
}

#url-content {
    min-height: 150px;
    background: #f8f9fa;
    border: 1px solid #e1e8ed;
    resize: vertical;
}

#url-content:focus {
    background: white;
}

/* 按钮行样式 */
.button-row {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

/* 控制区域 */
.control-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* 文本输入区域 */
.text-input-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.text-input {
    flex: 1;
    width: 100%;
    min-height: 300px;
    padding: 1rem;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: none;
    transition: all 0.3s;
    background: white;
}

.text-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 模式按钮样式改进 */
.mode-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.4);
    color: white;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.6);
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.5);
}

.mode-btn.active {
    background: white;
    color: #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border-color: white;
    font-weight: 700;
}

/* 响应式设计修改 */
@media (max-width: 1024px) {
    .container {
        flex-direction: column;
        height: auto;
        gap: 1.5rem;
    }
    
    .editor-panel {
        width: 100%;
        height: auto;
    }
    
    .mindmap-panel {
        height: 600px;
    }
    
    .text-input {
        min-height: 250px;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .container {
        padding: 1rem;
        gap: 1rem;
    }
    
    .mode-switcher {
        flex-direction: column;
        gap: 0.3rem;
    }
    
    .button-row {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .text-input {
        min-height: 200px;
    }
}