/* 紧凑型全局样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f0f2f5;
    font-size: 0.85rem;
    line-height: 1.4;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.5rem;
}

h1 {
    font-size: 1.75rem !important;
    margin-bottom: 0.75rem !important;
    font-weight: 700;
    color: #1a1a1a;
}

/* 卡片压缩 */
.card {
    border: none;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 0.5rem !important;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #f0f0f0;
    padding: 0.4rem 0.75rem !important;
}

.card-header h5 {
    color: #333;
    font-weight: 600;
}

.card-body {
    padding: 0.6rem 0.75rem !important;
}

/* 标签页压缩 */
.nav-tabs {
    border-bottom: 1px solid #dee2e6;
}

.nav-link {
    padding: 0.3rem 0.75rem !important;
    border: none !important;
    color: #666;
}

.nav-link.active {
    color: #0d6efd !important;
    border-bottom: 2px solid #0d6efd !important;
    background: none !important;
}

/* 统一配置行标签 */
.config-label {
    width: 70px;
    min-width: 70px;
    margin: 0;
    font-size: 0.8rem !important;
    font-weight: 600;
    color: #555;
}

/* 输入框与下拉框紧凑化 */
.form-control-sm, .form-select-sm {
    font-size: 0.8rem !important;
    padding: 0.2rem 0.4rem;
    height: 28px;
}

/* 修复：对话生成里的“SQL方言”下拉框与其它控件看起来不一致（与文本域同一行时可能被拉伸/对齐异常） */
#chat-config #chat-sql-dialect {
    flex: 0 0 auto;
    align-self: center;
}

/* 修复：对话生成里的 SQL 方言下拉框高度/字体看起来不一致（与 textarea 同行时被拉伸） */
#chat-config #chat-sql-dialect {
    flex: 0 0 auto;
    align-self: center;
}

/* 多表查询：下拉框尽量展示更长的表名/列名 */
#multi-table1,
#multi-table2,
#multi-table-select,
#multi-field-select,
#multi-order-table,
#multi-order-field,
#multi-group-table,
#multi-group-field,
#join-col1,
#join-col2 {
    width: 180px !important;
    max-width: 100% !important;
}

/* 下拉选项本身无法完全控制宽度（受浏览器限制），这里至少保证选中值区域尽量不截断 */
#multi-table1,
#multi-table2,
#multi-table-select,
#multi-field-select,
#multi-order-table,
#multi-order-field,
#multi-group-table,
#multi-group-field,
#join-col1,
#join-col2 {
    white-space: nowrap;
}

textarea.form-control-sm {
    height: auto;
    min-height: 45px;
}

/* 表结构展示区 */
#table-list {
    height: 330px !important;
    font-size: 0.8rem;
}

#table-structure {
    background-color: #fafafa;
    height: 330px !important;
    overflow-y: auto;
}

.structure-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

.structure-table th, .structure-table td {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
    border-bottom: 1px solid #f0f0f0;
    word-break: break-all;
}

.structure-table th {
    background-color: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 1;
    color: #666;
}

/* 按钮紧凑化 */
.btn-sm {
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
}

.btn-xs {
    padding: 0.1rem 0.3rem;
    font-size: 0.7rem;
    line-height: 1;
}

/* 生成结果区域 */
.position-relative textarea {
    padding-right: 45px !important;
    background-color: #fdfdfd;
    font-family: 'Courier New', Courier, monospace;
    color: #2c3e50;
    border-color: #e0e0e0;
}

/* 选中标签 */
.selected-item {
    display: inline-flex;
    align-items: center;
    background-color: #e9ecef;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #495057;
}

.selected-item .remove-btn {
    margin-left: 4px;
    color: #999;
    cursor: pointer;
}

.selected-item .remove-btn:hover {
    color: #dc3545;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1;
}
