:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --background-color: #f8f9fa;
    --card-background: #ffffff;
    --text-color: #2c3e50;
    --light-text: #7f8c8d;
    --border-color: #dee2e6;
    --hover-color: #ecf0f1;
    --shadow-light: rgba(0, 0, 0, 0.05);
    --shadow-medium: rgba(0, 0, 0, 0.1);
    --shadow-dark: rgba(0, 0, 0, 0.15);
    --border-radius: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 深色模式支援 */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #3498db;
        --secondary-color: #2980b9;
        --background-color: #1a1a1a;
        --card-background: #2c2c2c;
        --text-color: #ffffff;
        --light-text: #bdc3c7;
        --border-color: #404040;
        --hover-color: #3c3c3c;
    }
}

/* 重置和基礎樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    font-size: 14px;
}

/* 布局容器 */
.app-container {
    display: flex;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

/* 側邊欄樣式 */
.sidebar {
    width: 280px;
    background: var(--card-background);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px var(--shadow-light);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.sidebar-header h1 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.sidebar-header .user-info {
    font-size: 0.85rem;
    opacity: 0.9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.admin-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: var(--transition);
}

.admin-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.logout-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: var(--transition);
}

.logout-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

/* 新對話按鈕 */
.new-chat-section {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.new-chat-btn {
    width: 100%;
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.new-chat-btn:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px var(--shadow-medium);
}

/* 對話列表 */
.chat-tabs {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.chat-tab {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    user-select: none;
}

.chat-tab:hover {
    background-color: var(--hover-color);
    border-color: var(--border-color);
}

.chat-tab.active {
    background-color: var(--secondary-color);
    color: white;
    box-shadow: 0 2px 8px var(--shadow-medium);
}

.chat-tab-info {
    flex: 1;
    min-width: 0;
}

.chat-tab-name {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-tab-meta {
    font-size: 0.75rem;
    opacity: 0.7;
    display: flex;
    justify-content: space-between;
}

.chat-tab-actions {
    margin-left: 0.5rem;
    opacity: 0;
    transition: var(--transition);
}

.chat-tab:hover .chat-tab-actions {
    opacity: 1;
}

.chat-tab.active .chat-tab-actions {
    opacity: 1;
}

.delete-tab-btn {
    background: none;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 3px;
    font-size: 0.8rem;
    transition: var(--transition);
}

.delete-tab-btn:hover {
    background-color: var(--accent-color);
    color: white;
}

/* 主內容區域 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 聊天標頭 */
.chat-header {
    background: var(--card-background);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px var(--shadow-light);
}

.chat-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
}

.chat-options {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.option-group label {
    font-size: 0.85rem;
    color: var(--light-text);
    cursor: pointer;
    user-select: none;
}

.option-group input[type="checkbox"] {
    cursor: pointer;
}

/* 聊天內容區域 */
.chat-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* 消息樣式 */
.message {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    max-width: 85%;
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.assistant {
    align-self: flex-start;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: var(--secondary-color);
    color: white;
}

.message.assistant .message-avatar {
    background: var(--success-color);
    color: white;
}

.message-content {
    background: var(--card-background);
    padding: 1rem 1.25rem;
    border-radius: 16px;
    box-shadow: 0 2px 8px var(--shadow-light);
    border: 1px solid var(--border-color);
    position: relative;
    word-wrap: break-word;
}

.message.user .message-content {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.message-content .message-text {
    line-height: 1.6;
    font-size: 0.95rem;
}

/* 流式響應時的打字動畫 */
.message-content.streaming::after {
    content: '▋';
    animation: blink 1s infinite;
    color: var(--secondary-color);
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* 代碼塊樣式 */
.code-block {
    background: #2d2d2d;
    border-radius: 8px;
    margin: 1rem 0;
    overflow: hidden;
}

.code-header {
    background: #1e1e1e;
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #444;
}

.code-language {
    color: #aaa;
    font-size: 0.85rem;
    font-weight: 500;
}

.code-actions {
    display: flex;
    gap: 0.5rem;
}

.code-btn {
    background: none;
    border: 1px solid #555;
    color: #aaa;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.code-btn:hover {
    background: #3d3d3d;
    color: #fff;
    border-color: #777;
}

.code-btn.success {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.code-content {
    position: relative;
    overflow-x: auto;
}

.code-content pre {
    margin: 0;
    padding: 1rem;
    overflow-x: auto;
}

.code-content code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 0.85rem;
    color: #f8f8f2;
    line-height: 1.5;
    display: block;
}

/* 消息操作按鈕 */
.message-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.message-action-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--light-text);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.message-action-btn:hover {
    background: var(--hover-color);
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.message.user .message-action-btn {
    border-color: rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.8);
}

.message.user .message-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: white;
    color: white;
}

.message-meta {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 輸入區域 */
.chat-input-section {
    background: var(--card-background);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
    box-shadow: 0 -2px 10px var(--shadow-light);
}

/* 文件上傳區域 */
.file-upload-section {
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--background-color);
    border-radius: var(--border-radius);
    border: 2px dashed var(--border-color);
    text-align: center;
    transition: var(--transition);
}

.file-upload-section.dragover {
    border-color: var(--secondary-color);
    background-color: rgba(52, 152, 219, 0.05);
}

.file-upload-btn {
    background: none;
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.file-upload-btn:hover {
    background-color: var(--hover-color);
}

.uploaded-files {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.file-tag {
    background: var(--secondary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.file-tag .remove-file {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 0.7rem;
    padding: 0;
    line-height: 1;
}

/* 輸入表單 */
.input-form {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.input-group {
    flex: 1;
    position: relative;
}

.message-input {
    width: 100%;
    min-height: 50px;
    max-height: 150px;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    font-size: 0.95rem;
    line-height: 1.4;
    resize: none;
    transition: var(--transition);
    font-family: inherit;
}

.message-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.send-btn {
    background: var(--secondary-color);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.send-btn:hover {
    background-color: #2980b9;
    transform: scale(1.05);
    box-shadow: 0 4px 12px var(--shadow-medium);
}

.send-btn:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 載入狀態 */
.loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--light-text);
    padding: 1rem 0;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Toast 通知 */
/* Toast 通知 - 完全修复版 */
.toast-notification {
    position: fixed;
    top: 20px;      
    right: 20px;
    background: var(--card-background);
    color: var(--text-color);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow-medium);
    z-index: 10000;
    opacity: 0;     
    transform: translateX(400px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 350px;
    pointer-events: auto;
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-notification.success {
    background: var(--success-color);
    color: white;
}

.toast-notification.error {
    background: var(--accent-color);
    color: white;
}

.toast-notification.info {
    background: var(--secondary-color);
    color: white;
}

.toast-notification.warning {
    background: var(--warning-color);
    color: #212529;
}

/* 移动端 Toast 优化 */
@media (max-width: 768px) {
    .toast-notification {
        right: 10px;
        top: 10px;
        max-width: calc(100vw - 20px);
        font-size: 13px;
        padding: 0.75rem 1rem;
    }
}

/* 響應式設計 */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        z-index: 1000;
        transition: var(--transition);
    }
    
    .sidebar.mobile-open {
        left: 0;
    }
    
    .mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }
    
    .mobile-overlay.active {
        display: block;
    }
    
    .main-content {
        width: 100%;
    }
    
    .chat-header {
        padding-left: 4rem;
        position: relative;
    }
    
    .mobile-menu-btn {
        position: absolute;
        left: 1rem;
        top: 50%;
        transform: translateY(-50%);
        background: none;
        border: none;
        font-size: 1.5rem;
        cursor: pointer;
        color: var(--text-color);
    }
    
    .message {
        max-width: 95%;
    }
    
    .chat-options {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .option-group {
        font-size: 0.8rem;
    }
    
    .chat-input-section {
        padding: 1rem;
    }
    
    .input-form {
        gap: 0.5rem;
    }
    
    .send-btn {
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 480px) {
    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
    
    .message-content {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .message-input {
        font-size: 16px; /* 防止 iOS 縮放 */
    }
}

/* 無障礙支援 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 高對比模式支援 */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --shadow-light: rgba(0, 0, 0, 0.3);
        --shadow-medium: rgba(0, 0, 0, 0.5);
    }
}

/* 滾動條樣式 */
.chat-content::-webkit-scrollbar,
.chat-tabs::-webkit-scrollbar {
    width: 8px;
}

.chat-content::-webkit-scrollbar-track,
.chat-tabs::-webkit-scrollbar-track {
    background: var(--background-color);
}

.chat-content::-webkit-scrollbar-thumb,
.chat-tabs::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.chat-content::-webkit-scrollbar-thumb:hover,
.chat-tabs::-webkit-scrollbar-thumb:hover {
    background: var(--light-text);
}

/* 打印樣式 */
@media print {
    .sidebar,
    .chat-header,
    .chat-input-section {
        display: none !important;
    }
    
    .main-content {
        width: 100% !important;
    }
    
    .message {
        break-inside: avoid;
        margin-bottom: 1rem;
    }
}

/* 錯誤提示樣式 */
.error-message {
    background-color: #fdf2f2;
    color: var(--accent-color);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--accent-color);
    margin: 1rem 0;
    font-size: 0.9rem;
}

.success-message {
    background-color: #f0f9f0;
    color: var(--success-color);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--success-color);
    margin: 1rem 0;
    font-size: 0.9rem;
}

/* 工具提示 */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]:before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-color);
    color: var(--card-background);
    padding: 0.5rem;
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

[data-tooltip]:hover:before {
    opacity: 1;
}

/* 空狀態 */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--light-text);
}

.empty-state h3 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.empty-state p {
    font-size: 0.9rem;
    line-height: 1.6;
}

/* 品牌色彩調整 */
.brand-primary { color: var(--primary-color); }
.brand-secondary { color: var(--secondary-color); }
.brand-success { color: var(--success-color); }
.brand-warning { color: var(--warning-color); }
.brand-danger { color: var(--accent-color); }

/* 間距工具類 */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }

/* 文字工具類 */
.text-small { font-size: 0.8rem; }
.text-large { font-size: 1.1rem; }
.text-bold { font-weight: 600; }
.text-center { text-align: center; }
.text-muted { color: var(--light-text); }

/* Flexbox 工具類 */
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }

/* 登錄頁面樣式 */
.login-container {
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: 0 15px 35px var(--shadow-color);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-header {
    margin-bottom: 2rem;
}

.login-header h1 {
    color: var(--primary-color);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #7f8c8d;
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.remember-group {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.remember-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

.login-button {
    width: 100%;
    background: linear-gradient(135deg, var(--secondary-color), #2980b9);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

.login-button:active {
    transform: translateY(0);
}

.footer-info {
    margin-top: 2rem;
    font-size: 0.8rem;
    color: #95a5a6;
}

@media (max-width: 480px) {
    .login-container {
        margin: 1rem;
        padding: 2rem;
    }
}

/* 登錄頁面背景 */
body.login-page {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* ========== 表格樣式優化 ========== */
.table-wrapper {
    overflow-x: auto;
    margin: 15px 0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.markdown-table {
    border-collapse: collapse;
    width: 100%;
    min-width: 100%;
    background: white;
    font-size: 14px;
}

.markdown-table thead {
    background: linear-gradient(to bottom, #f8f9fa, #e9ecef);
}

.markdown-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border: 1px solid #dee2e6;
    white-space: nowrap;
}

.markdown-table td {
    padding: 10px 16px;
    border: 1px solid #dee2e6;
    color: #212529;
    line-height: 1.5;
}

.markdown-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.markdown-table tbody tr:hover {
    background-color: #e9ecef;
    transition: background-color 0.2s;
}

.markdown-table code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
    color: #d73a49;
}

/* 響應式表格 */
@media (max-width: 768px) {
    .table-wrapper {
        margin: 10px -10px;
        border-radius: 0;
    }
    
    .markdown-table {
        font-size: 12px;
    }
    
    .markdown-table th,
    .markdown-table td {
        padding: 8px 10px;
    }
}

/* ========== 圖表容器樣式 ========== */
.chart-container {
    margin: 20px 0;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.chart-header {
    background: #f8f9fa;
    padding: 10px 15px;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-type {
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.chart-action-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
}

.chart-action-btn:hover {
    background: #0056b3;
}

.chart-content {
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    background: white;
}

.chart-content svg {
    max-width: 100%;
    height: auto;
}

.chart-content canvas {
    max-width: 100% !important;
    height: auto !important;
}

.chart-code {
    padding: 10px 15px;
    border-top: 1px solid #e1e5e9;
    background: #f8f9fa;
}

.chart-code summary {
    cursor: pointer;
    color: #6c757d;
    font-size: 13px;
    user-select: none;
}

.chart-code summary:hover {
    color: #495057;
}

/* SVG圖表特殊樣式 */
.svg-chart svg {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

/* Mermaid圖表特殊樣式 */
.mermaid-chart .mermaid {
    text-align: center;
}

/* ========== 消息操作按鈕優化 ========== */
.message-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
}

.message-action-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--light-text);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.message-action-btn:hover {
    background: var(--hover-color);
    border-color: var(--secondary-color);
    color: var(--secondary-color);
    transform: translateY(-1px);
}

/* 深色模式下的表格樣式 */
@media (prefers-color-scheme: dark) {
    .markdown-table {
        background: #2c2c2c;
    }
    
    .markdown-table thead {
        background: linear-gradient(to bottom, #3c3c3c, #2c2c2c);
    }
    
    .markdown-table th {
        color: #ffffff;
        border-color: #404040;
    }
    
    .markdown-table td {
        color: #e0e0e0;
        border-color: #404040;
    }
    
    .markdown-table tbody tr:nth-child(even) {
        background-color: #333333;
    }
    
    .markdown-table tbody tr:hover {
        background-color: #3c3c3c;
    }
    
    .chart-container {
        background: #2c2c2c;
        border-color: #404040;
    }
    
    .chart-header {
        background: #333333;
        border-color: #404040;
    }
    
    .chart-content {
        background: #2c2c2c;
    }
}