/* 全局样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    min-height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    /* 统一由内部滚动容器处理滚动，避免整页滚动 */
    overflow: hidden;
}

/* 免登轻量模式：隐藏顶部区域（header + 空间选择器） */
body.lite-mode header,
body.lite-mode .space-selector {
    display: none !important;
}

.container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 20px;
    height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
header {
    margin-bottom: 30px;
    padding: 20px;
    background-color: #4CAF50;
    color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.header-left {
    flex: 1;
    min-width: 200px;
}

.header-right {
    flex: 0 0 auto;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

/* 用户信息和退出按钮 */
.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info #username {
    font-weight: 500;
    font-size: 1em;
}

.logout-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s ease;
}

.logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* 允许内部聊天区域自行滚动，而不是撑高整个页面 */
}

/* 数据空间选择器 - 选项卡样式 */
.space-selector {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 15px;
    margin-bottom: 20px;
}

.tab-container {
    display: flex;
    background-color: #f5f5f5;
    border-radius: 6px;
    padding: 4px;
    gap: 2px;
}

.tab {
    flex: 1;
    padding: 8px 16px;
    text-align: center;
    font-size: 0.9em;
    font-weight: 500;
    color: #666;
    background-color: transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    user-select: none;
}

.tab:hover {
    background-color: #e0e0e0;
    color: #333;
}

.tab.active {
    background-color: #4CAF50;
    color: white;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

.tab.active:hover {
    background-color: #45a049;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .tab {
        padding: 6px 12px;
        font-size: 0.85em;
    }
    
    .tab-container {
        flex-direction: column;
        gap: 4px;
    }
}

/* 聊天容器 */
.chat-container {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
    flex: 1;
    display: flex;
    flex-direction: row;
    gap: 16px;
    min-height: 0;
}

/* 左侧：历史问答 */
.qa-history-sidebar {
    width: 320px;
    flex: 0 0 320px;
    border: 1px solid #e6e6e6;
    border-radius: 8px;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.qa-history-header,
.qa-history-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid #e6e6e6;
}

.qa-history-footer {
    border-bottom: none;
    border-top: 1px solid #e6e6e6;
}

.qa-history-title {
    font-weight: 600;
    color: #333;
}

.qa-history-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qa-history-btn {
    border: 1px solid #ddd;
    background: white;
    color: #333;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
}

.qa-history-btn:hover {
    background: #f5f5f5;
}

.qa-history-btn-danger {
    border-color: #f44336;
    color: #f44336;
}

.qa-history-btn-danger:hover {
    background: #ffebee;
}

.qa-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

.qa-history-item {
    background: white;
    border: 1px solid #e6e6e6;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.qa-history-item:hover {
    background: #f7fbf7;
    border-color: rgba(76, 175, 80, 0.35);
}

.qa-history-item.active {
    border-color: rgba(76, 175, 80, 0.7);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.12);
}

.qa-history-item .q {
    font-weight: 600;
    color: #222;
    margin-bottom: 6px;
    font-size: 0.95em;
    line-height: 1.35;
}

.qa-history-item .meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.82em;
    color: #666;
    align-items: center;
    justify-content: space-between;
}

.qa-history-item .meta-left {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.qa-history-item .meta-right {
    margin-left: auto;
}

.qa-history-delete {
    border: none;
    background: transparent;
    color: #999;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
    opacity: 0;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.qa-history-delete:hover {
    color: #f44336;
}

.qa-history-item:hover .qa-history-delete,
.qa-history-item.active .qa-history-delete {
    opacity: 1;
}

.qa-history-empty {
    color: #777;
    font-size: 0.95em;
    padding: 10px;
}

/* 右侧：对话区域 */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

/* 聊天历史 */
.chat-history {
    flex: 1;
    min-height: 200px;
    overflow-y: auto;
    margin-bottom: 20px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fafafa;
}

@media (max-width: 980px) {
    .chat-container {
        flex-direction: column;
    }
    .qa-history-sidebar {
        width: 100%;
        flex: 0 0 auto;
        max-height: 260px;
    }
}

.message {
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 8px;
    max-width: 90%;
}

.user-message {
    background-color: #e3f2fd;
    color: #1565c0;
    margin-left: auto;
    text-align: right;
}

.ai-message {
    background-color: #e8f5e8;
    color: #2e7d32;
    margin-right: auto;
    text-align: left;
}

.message-content {
    font-size: 1em;
    line-height: 1.6;
}

/* Markdown渲染样式 */
.message-content h1,
.message-content h2,
.message-content h3 {
    margin: 15px 0 10px 0;
    font-weight: 600;
    color: #2e7d32;
}

.message-content h1 {
    font-size: 1.4em;
    border-bottom: 2px solid #4CAF50;
    padding-bottom: 5px;
}

.message-content h2 {
    font-size: 1.2em;
    border-bottom: 1px solid #81c784;
    padding-bottom: 3px;
}

.message-content h3 {
    font-size: 1.1em;
}

.message-content p {
    margin: 8px 0;
    line-height: 1.6;
}

.message-content strong {
    font-weight: 600;
    color: #1b5e20;
}

.message-content em {
    font-style: italic;
    color: #388e3c;
}

.message-content code {
    background-color: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #d32f2f;
}

.message-content pre {
    background-color: #1e1e1e;
    color: #d4d4d4;
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 10px 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    line-height: 1.4;
}

.message-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.message-content li {
    margin: 4px 0;
    line-height: 1.5;
}

.message-content a {
    color: #1976d2;
    text-decoration: none;
    border-bottom: 1px solid #64b5f6;
}

.message-content a:hover {
    color: #1565c0;
    border-bottom-color: #1976d2;
}

.message-time {
    font-size: 0.8em;
    opacity: 0.7;
    margin-top: 5px;
}

/* 聊天消息中的结果展示 */
.ai-analysis-inline {
    background-color: #fff3e0;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 15px;
    border-left: 4px solid #ff9800;
    font-size: 0.95em;
    line-height: 1.6;
    color: #333;
}

.result-section {
    margin-top: 15px;
    margin-bottom: 15px;
}

.section-title {
    font-weight: bold;
    font-size: 1em;
    color: #2e7d32;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 2px solid #4CAF50;
}

.table-container {
    overflow-x: auto;
    margin: 10px 0;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ai-message .data-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    font-size: 0.9em;
}

.ai-message .data-table th {
    background-color: #4CAF50;
    color: white;
    padding: 10px;
    text-align: left;
    font-weight: bold;
    font-size: 0.9em;
}

.ai-message .data-table td {
    padding: 10px;
    border-bottom: 1px solid #ddd;
    color: #333;
}

.ai-message .data-table tr:hover {
    background-color: #f5f5f5;
}

.ai-message .data-table tr:nth-child(even) {
    background-color: #fafafa;
}

.data-count {
    font-size: 0.85em;
    color: #666;
    margin-top: 8px;
    text-align: right;
    font-style: italic;
}

/* 字段限制提示样式 */
.field-limit-notice {
    font-size: 0.8em;
    color: #888;
    margin-top: 8px;
    text-align: center;
    font-style: italic;
    padding: 4px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #6c757d;
}

.truncated-indicator {
    color: #6c757d;
    font-style: italic;
    text-align: center;
    background-color: #f8f9fa;
}

.no-data {
    color: #999;
    font-style: italic;
    padding: 10px;
    text-align: center;
}

.chart-container {
    margin: 15px 0;
    padding: 15px;
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chart-container canvas {
    max-height: 300px;
}

.sql-details {
    margin-top: 10px;
}

.sql-summary {
    cursor: pointer;
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 500;
    border: 1px solid #444;
    transition: all 0.3s ease;
    user-select: none;
}

.sql-summary:hover {
    background-color: #3d3d3d;
    border-color: #4CAF50;
}

.sql-code {
    background-color: #1e1e1e;
    color: #d4d4d4;
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    line-height: 1.5;
    margin-top: 8px;
    border: 1px solid #333;
}

/* 输入区域 */
.input-area {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

#chat-form {
    display: flex;
    gap: 10px;
    width: 100%;
}

#question {
    flex: 1;
    padding: 12px;
    font-size: 1em;
    border: 1px solid #ddd;
    border-radius: 4px;
    outline: none;
    transition: border-color 0.3s;
}

#question:focus {
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

button {
    padding: 12px 20px;
    font-size: 1em;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#send-btn {
    background-color: #4CAF50;
    color: white;
}

#send-btn:hover {
    background-color: #45a049;
}

#send-btn:active {
    background-color: #3e8e41;
}

#clear-btn {
    background-color: #f44336;
    color: white;
}

#clear-btn:hover {
    background-color: #da190b;
}

#clear-btn:active {
    background-color: #b71c1c;
}

/* 结果容器 */
.result-container {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.result-header {
    margin-bottom: 20px;
}

.result-header h3 {
    color: #333;
    font-size: 1.5em;
    border-bottom: 2px solid #4CAF50;
    padding-bottom: 10px;
}

/* SQL部分 - 深色主题 */
.sql-section {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #1e1e1e;
    border-radius: 6px;
    border-left: 4px solid #4CAF50;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sql-section h4 {
    color: #4CAF50;
    margin-bottom: 12px;
    font-size: 1.1em;
    font-weight: 600;
}

#generated-sql {
    background-color: #1e1e1e;
    color: #d4d4d4;
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
    border: 1px solid #333;
}

/* 数据部分 */
.data-section {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f5f5f5;
    border-radius: 4px;
    border-left: 4px solid #4CAF50;
}

.data-section h4 {
    color: #4CAF50;
    margin-bottom: 10px;
}

#result-data {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.data-table th {
    background-color: #4CAF50;
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: bold;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #ddd;
}

.data-table tr:hover {
    background-color: #f5f5f5;
}

.data-table tr:nth-child(even) {
    background-color: #fafafa;
}

/* 纵向表格样式 */
.vertical-table-container {
    max-width: 100%;
    margin: 10px 0;
}

.vertical-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.vertical-table th.field-name {
    background-color: #f8f9fa;
    color: #333;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    border-right: 1px solid #e0e0e0;
    width: 30%;
    min-width: 120px;
    vertical-align: top;
}

.vertical-table td.field-value {
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
    color: #333;
    word-break: break-word;
    vertical-align: top;
}

.vertical-table tr:last-child th.field-name,
.vertical-table tr:last-child td.field-value {
    border-bottom: none;
}

.vertical-table tr:hover {
    background-color: #f5f7fa;
}

.vertical-table tr:nth-child(even) {
    background-color: #fafafa;
}

.vertical-table tr:nth-child(even):hover {
    background-color: #f0f4f8;
}

.vertical-table .truncated-indicator {
    color: #666;
    font-style: italic;
    background-color: #fff3cd;
}

/* 聊天消息中的纵向表格样式 */
.ai-message .vertical-table {
    font-size: 0.9em;
}

.ai-message .vertical-table th.field-name {
    font-size: 0.85em;
    padding: 8px 12px;
}

.ai-message .vertical-table td.field-value {
    padding: 8px 12px;
}

/* 分析部分 */
.analysis-section {
    padding: 15px;
    background-color: #f5f5f5;
    border-radius: 4px;
    border-left: 4px solid #ff9800;
}

.analysis-section h4 {
    color: #ff9800;
    margin-bottom: 10px;
}

#ai-analysis {
    background-color: white;
    padding: 15px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    line-height: 1.6;
}

/* 加载状态 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #666;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

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

/* 数据空间选项卡样式 */
.space-tabs {
    margin-bottom: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.tab-header {
    background-color: #4CAF50;
    color: white;
    padding: 15px 20px;
}

.tab-header h3 {
    margin: 0;
    font-size: 1.2em;
}

.tab-container {
    display: flex;
    padding: 15px;
    gap: 10px;
}

.tab {
    flex: 1;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #fafafa;
    text-align: center;
}

.tab:hover {
    border-color: #4CAF50;
    background-color: #f0f8f0;
    transform: translateY(-2px);
}

.tab-icon {
    display: block;
    font-size: 2em;
    margin-bottom: 8px;
}

.tab-title {
    display: block;
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 5px;
    color: #333;
}

.tab-desc {
    display: block;
    font-size: 0.9em;
    color: #666;
    line-height: 1.4;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .chat-container {
        padding: 15px;
    }
    
    .chat-history {
        height: 250px;
    }
    
    .input-area {
        flex-direction: column;
    }
    
    #chat-form {
        flex-direction: column;
    }
    
    button {
        width: 100%;
    }
    
    .message {
        max-width: 95%;
    }
    
    /* 移动端选项卡样式 */
    .tab-container {
        flex-direction: column;
    }
    
    .tab {
        padding: 12px;
    }
    
    .tab-icon {
    font-size: 1.5em;
}
}

/* 表格列数提示信息 */
.column-info {
    font-size: 0.9em;
    color: #666;
    text-align: center;
    margin-top: 10px;
    font-style: italic;
}

/* 纵向表格样式 - 用于单条记录展示 */
.vertical-table-container {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    margin: 10px 0;
}

.vertical-table-header {
    background-color: #4CAF50;
    color: white;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.vertical-table-header h3 {
    margin: 0 0 5px 0;
    font-size: 1.1em;
    font-weight: 600;
}

.record-count {
    margin: 0;
    font-size: 0.9em;
    opacity: 0.9;
}

.vertical-table {
    width: 100%;
    border-collapse: collapse;
}

.vertical-table th,
.vertical-table td {
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
    text-align: left;
    vertical-align: top;
}

.vertical-table th {
    width: 30%;
    background-color: #f8f9fa;
    color: #555;
    font-weight: 600;
    font-size: 0.9em;
    border-right: 1px solid #e0e0e0;
}

.vertical-table td {
    width: 70%;
    background-color: white;
    color: #333;
    word-break: break-word;
    max-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vertical-table tr:last-child th,
.vertical-table tr:last-child td {
    border-bottom: none;
}

.vertical-table tr:hover th {
    background-color: #e9ecef;
}

.vertical-table tr:hover td {
    background-color: #f8f9fa;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .vertical-table th,
    .vertical-table td {
        padding: 10px 15px;
        font-size: 0.9em;
    }
    
    .vertical-table th {
        width: 35%;
    }
    
    .vertical-table td {
        width: 65%;
    }
    
    .vertical-table-header {
        padding: 12px 15px;
    }
    
    .vertical-table-header h3 {
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    .vertical-table {
        display: block;
    }
    
    .vertical-table tr {
        display: block;
        margin-bottom: 10px;
        border: 1px solid #e0e0e0;
        border-radius: 4px;
        background-color: white;
    }
    
    .vertical-table th,
    .vertical-table td {
        display: block;
        width: 100%;
        padding: 8px 12px;
        border: none;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .vertical-table th {
        background-color: #f8f9fa;
        font-weight: 600;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .vertical-table tr:last-child th,
    .vertical-table tr:last-child td {
        border-bottom: none;
    }
}

/* Markdown渲染样式 */
.message-content h1,
.message-content h2,
.message-content h3 {
    margin: 15px 0 10px 0;
    color: #333;
}

.message-content h1 {
    font-size: 1.4em;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}

.message-content h2 {
    font-size: 1.2em;
}

.message-content h3 {
    font-size: 1.1em;
}

.message-content strong {
    font-weight: bold;
    color: #2c3e50;
}

.message-content em {
    font-style: italic;
    color: #7f8c8d;
}

.message-content code {
    background-color: #f8f9fa;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.message-content pre {
    padding: 10px;
    border-radius: 5px;
    overflow-x: auto;
    margin: 10px 0;
}

.message-content pre code {
    background: none;
    padding: 0;
}

.message-content ul,
.message-content ol {
    margin: 10px 0;
    padding-left: 20px;
}

.message-content li {
    margin: 5px 0;
}

.message-content blockquote {
    border-left: 4px solid #4CAF50;
    padding-left: 15px;
    margin: 10px 0;
    color: #666;
    font-style: italic;
}

.message-content a {
    color: #4CAF50;
    text-decoration: none;
}

.message-content a:hover {
    text-decoration: underline;
}

/* 联网检索开关样式 */
.web-search-toggle {
    display: flex;
    align-items: center;
    margin-right: 10px;
}

.toggle-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    width: 40px;
    height: 20px;
    background-color: #ccc;
    border-radius: 10px;
    position: relative;
    transition: background-color 0.3s ease;
    margin-right: 8px;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background-color: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
}

.toggle-label input[type="checkbox"]:checked + .toggle-slider {
    background-color: #4CAF50;
}

.toggle-label input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-text {
    font-size: 0.9em;
    color: #666;
    white-space: nowrap;
}

.toggle-label input[type="checkbox"]:checked ~ .toggle-text {
    color: #4CAF50;
    font-weight: 500;
}

/* 联网检索结果样式 */
.web-search-result {
    background-color: #e8f5e9;
    border-left: 4px solid #4CAF50;
    padding: 15px;
    margin: 10px 0;
    border-radius: 4px;
}

.source-badge {
    display: inline-block;
    background-color: #4CAF50;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    margin-bottom: 10px;
}

.web-search-result .content {
    line-height: 1.6;
    color: #333;
}

/* 数据库结果样式标记 */
.database-result {
    background-color: #e3f2fd;
    border-left: 4px solid #2196f3;
}

.database-badge {
    display: inline-block;
    background-color: #2196f3;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    margin-bottom: 10px;
}

/* 响应式设计 - 联网开关 */
@media (max-width: 768px) {
    .web-search-toggle {
        margin-bottom: 10px;
        width: 100%;
    }
    
    #chat-form {
        flex-wrap: wrap;
    }
}