/* ---------- 全局样式 ---------- */
body {
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 30px;
    background: linear-gradient(135deg, #f0f2f5, #e2e6ea);
    color: #2c3e50;
}

/* ---------- 标题 ---------- */
h2 {
    text-align: center;
    color: #34495e;
    margin-bottom: 25px;
    font-weight: 700;
    font-size: 28px;
    letter-spacing: 0.5px;
}

/* ---------- 文本区域和输入框 ---------- */
#userInput, #fileNameInput {
    width: 100%;
    font-size: 15px;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid #d1d5db;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    background-color: #fff;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

#userInput {
    height: 150px;
    resize: vertical;
}

#userInput:focus, #fileNameInput:focus {
    border-color: #3498db;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.3);
    outline: none;
}

/* ---------- 按钮样式 ---------- */
button {
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #fff;
    min-width: 120px;
}

/* 生成按钮 */
#generateBtn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    box-shadow: 0 4px 14px rgba(52, 152, 219, 0.3);
}
#generateBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(52, 152, 219, 0.4);
}

/* 清空按钮 */
#clearBtn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    box-shadow: 0 4px 14px rgba(231, 76, 60, 0.3);
}
#clearBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(231, 76, 60, 0.4);
}

/* 导出按钮 */
#exportBtn {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    box-shadow: 0 4px 14px rgba(46, 204, 113, 0.3);
}
#exportBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(46, 204, 113, 0.4);
}

/* ---------- 下拉选择框 ---------- */
select {
    padding: 12px 16px;
    font-size: 14px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    background: #fff;
    transition: all 0.3s ease;
}

select:focus {
    border-color: #3498db;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.3);
    outline: none;
}

/* ---------- 工具栏布局 ---------- */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
}

/* ---------- Mermaid 容器 ---------- */
.mermaid-container {
    margin-top: 30px;
    background: #ffffff;
    border-radius: 16px;
    padding: 25px;
    min-height: 480px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    overflow: auto;
    position: relative;
}

/* Mermaid 图居中 */
.mermaid {
    text-align: center;
}

/* ---------- 加载动画 ---------- */
.loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 6px solid #f3f3f3;
    border-top: 6px solid #3498db;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    display: none;
    z-index: 10;
}

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

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    button, select {
        width: 100%;
        margin-left: 0 !important;
    }
}