/**
 * 工作台专用样式
 * AI家教平台
 */

/* ===== 基础样式 ===== */
body {
    background: var(--wanwen-white, #ffffff) !important;
    color: var(--wanwen-dark, #2c3e50) !important;
}

/* ===== 加载状态 ===== */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--wanwen-gray-border);
    border-radius: 50%;
    border-top-color: var(--wanwen-dark);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== 分类展示系统 ===== */
.category-showcase {
    background: var(--wanwen-gray-bg);
    border: 2px solid var(--wanwen-gray-border);
    border-radius: 20px;
    margin: 20px 0;
    padding: 25px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(44, 62, 80, 0.08);
}

.category-showcase::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--wanwen-gradient);
}

/* ===== 分类选择面板 ===== */
.category-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.category-panel.show {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.category-panel-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(44, 62, 80, 0.7);
    backdrop-filter: blur(5px);
    cursor: pointer;
}

.category-panel-content {
    position: relative;
    background: var(--wanwen-white);
    border-radius: 20px;
    box-shadow: 0 25px 80px rgba(44, 62, 80, 0.25);
    max-width: 700px;
    max-height: 85vh;
    width: 95%;
    overflow: hidden;
    border: 2px solid var(--wanwen-gray-border);
    animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideIn {
    from { 
        opacity: 0; 
        transform: scale(0.8) translateY(-30px); 
    }
    to { 
        opacity: 1; 
        transform: scale(1) translateY(0); 
    }
}

.category-panel-header {
    padding: 25px 30px;
    background: linear-gradient(135deg, var(--wanwen-dark) 0%, #2c3e50 100%);
    color: var(--wanwen-white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.category-panel-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.category-panel-header h3 {
    margin: 0;
    color: var(--wanwen-white);
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-panel-header h3::before {
    content: '🏷️';
    font-size: 22px;
}

.close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--wanwen-white);
    font-size: 16px;
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 10px;
    transition: all 0.3s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.category-panel-body {
    padding: 25px 30px 30px;
    max-height: calc(85vh - 120px);
    overflow-y: auto;
}

/* 滚动条样式 */
.category-panel-body::-webkit-scrollbar {
    width: 6px;
}

.category-panel-body::-webkit-scrollbar-track {
    background: var(--wanwen-gray-light);
    border-radius: 3px;
}

.category-panel-body::-webkit-scrollbar-thumb {
    background: var(--wanwen-medium);
    border-radius: 3px;
}

.category-panel-body::-webkit-scrollbar-thumb:hover {
    background: var(--wanwen-dark);
}

.category-group {
    margin-bottom: 25px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--wanwen-gray-border);
}

.category-group:last-child {
    margin-bottom: 0;
}

.category-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--wanwen-white);
    margin-bottom: 0;
    padding: 15px 20px;
    background: linear-gradient(135deg, var(--wanwen-dark) 0%, #34495e 100%);
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.category-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.category-title i {
    font-size: 18px;
    opacity: 0.9;
}

.subcategories-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    padding: 20px;
    background: var(--wanwen-gray-bg);
}

.subcategory-item {
    padding: 15px 18px;
    background: var(--wanwen-white);
    border: 2px solid var(--wanwen-gray-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--wanwen-medium);
    position: relative;
    overflow: hidden;
}

.subcategory-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(44, 62, 80, 0.05), transparent);
    transition: left 0.5s ease;
}

.subcategory-item:hover::before {
    left: 100%;
}

.subcategory-item:hover {
    background: var(--wanwen-white);
    border-color: var(--wanwen-dark);
    color: var(--wanwen-dark);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(44, 62, 80, 0.15);
}

.subcategory-item:active {
    transform: translateY(-1px) scale(1.01);
}

.subcategory-item i {
    font-size: 16px;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.subcategory-item:hover i {
    opacity: 1;
}

.count-badge {
    background: var(--wanwen-medium);
    color: var(--wanwen-white);
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
    font-weight: 600;
}

/* ===== 主工作区域 ===== */
.workspace-container {
    display: grid;
    grid-template-columns: 280px 1fr 220px;
    gap: 20px;
    height: calc(100vh - 160px);
    margin-top: 20px;
    transition: grid-template-columns 0.3s ease;
    width: calc(100% + 40px);
    margin-left: -20px;
    margin-right: -20px;
}

.workspace-container.hide-history {
    grid-template-columns: 280px 1fr 0px;
}

.workspace-container.sidebar-collapsed {
    grid-template-columns: 60px 1fr 220px;
}

.workspace-container.sidebar-collapsed.hide-history {
    grid-template-columns: 60px 1fr 0px;
}

/* ===== 侧边栏样式 ===== */
.workspace-sidebar {
    background: var(--wanwen-white);
    border: 2px solid var(--wanwen-gray-border);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(44, 62, 80, 0.08);
    transition: all 0.3s ease;
    width: 280px;
    min-width: 280px;
}

/* 折叠状态的侧边栏 */
.workspace-sidebar.collapsed {
    width: 60px;
    min-width: 60px;
}

/* 折叠状态下隐藏所有文字内容 */
.workspace-sidebar.collapsed .sidebar-title {
    display: none;
}

.workspace-sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 15px 5px;
}

.workspace-sidebar.collapsed .sidebar-header-left {
    display: none;
}

.workspace-sidebar.collapsed .sidebar-collapse-btn {
    position: static;
    margin: 0;
}

/* 折叠状态下的内容区域 */
.workspace-sidebar.collapsed .sidebar-content {
    padding: 10px 5px;
}

/* 折叠状态下的智能体列表项 */
.workspace-sidebar.collapsed .user-agent-item {
    width: 40px;
    height: 40px;
    padding: 8px;
    margin: 5px auto;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.workspace-sidebar.collapsed .user-agent-item .conversation-avatar {
    width: 24px;
    height: 24px;
    margin: 0;
}

.workspace-sidebar.collapsed .user-agent-item .conversation-avatar img {
    width: 24px;
    height: 24px;
}

.workspace-sidebar.collapsed .user-agent-item .conversation-avatar i {
    font-size: 14px;
}

/* 隐藏折叠状态下的文字内容 */
.workspace-sidebar.collapsed .conversation-content,
.workspace-sidebar.collapsed .agent-delete-btn {
    display: none;
}

/* 折叠状态下的添加智能体按钮 */
.workspace-sidebar.collapsed .add-agent-btn {
    width: 40px;
    height: 40px;
    padding: 8px;
    margin: 5px auto;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.workspace-sidebar.collapsed .add-agent-btn i {
    margin: 0;
    font-size: 16px;
}

.workspace-sidebar.collapsed .add-agent-btn div {
    display: none;
}

/* 折叠状态下的激活状态样式 */
.workspace-sidebar.collapsed .user-agent-item.active {
    background: var(--wanwen-primary, #3498db);
    color: white;
}

.workspace-sidebar.collapsed .user-agent-item.active .conversation-avatar i {
    color: white;
}

/* 折叠状态下的悬停效果 */
.workspace-sidebar.collapsed .user-agent-item:hover {
    background: var(--wanwen-gray-light, #f8f9fa);
    transform: scale(1.05);
}

.workspace-sidebar.collapsed .add-agent-btn:hover {
    background: var(--wanwen-primary, #3498db);
    color: white;
    transform: scale(1.05);
}

.history-sidebar.hidden {
    opacity: 0;
    transform: translateX(100%);
    pointer-events: none;
}

.sidebar-header {
    padding: 20px;
    background: var(--wanwen-gray-bg);
    border-bottom: 2px solid var(--wanwen-gray-border);
    font-weight: 700;
    color: var(--wanwen-dark);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    transition: all 0.3s ease;
}

.sidebar-header-left {
    display: flex;
    align-items: center;
}

.sidebar-collapse-btn {
    background: var(--wanwen-white);
    border: 1px solid var(--wanwen-gray-border);
    border-radius: 6px;
    padding: 6px 8px;
    color: var(--wanwen-medium);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
}

.sidebar-collapse-btn:hover {
    background: var(--wanwen-gray-light);
    border-color: var(--wanwen-dark);
    color: var(--wanwen-dark);
}

.category-switch-btn {
    background: var(--wanwen-white);
    border: 1px solid var(--wanwen-gray-border);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--wanwen-medium);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.category-switch-btn:hover {
    background: var(--wanwen-gray-light);
    border-color: var(--wanwen-dark);
    color: var(--wanwen-dark);
}

.sidebar-content {
    height: calc(100% - 80px);
    overflow-y: auto;
    padding: 15px;
}

/* ===== 智能体列表项 ===== */
.agent-item {
    padding: 12px 15px;
    margin-bottom: 8px;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--wanwen-gray-bg);
    position: relative;
    overflow: hidden;
}

.agent-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(44, 62, 80, 0.05), transparent);
    transition: left 0.5s ease;
}

.agent-item:hover::before {
    left: 100%;
}

.agent-item:hover {
    border-color: var(--wanwen-gray-border);
    background: var(--wanwen-white);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(44, 62, 80, 0.12);
}

.agent-item.active {
    border-color: var(--wanwen-dark);
    background: var(--wanwen-white);
    box-shadow: 0 8px 30px rgba(44, 62, 80, 0.18);
    transform: translateY(-1px);
}

.agent-item.active::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--wanwen-gradient);
    border-radius: 0 2px 2px 0;
}

/* 智能体信息布局 */
.agent-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.agent-item .agent-avatar {
    width: 20px !important;
    height: 20px !important;
    border-radius: 50% !important;
    flex-shrink: 0;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: var(--wanwen-gradient) !important;
    color: white !important;
    font-size: 10px !important;
    position: relative;
    overflow: hidden;
    min-width: 20px;
    max-width: 20px;
    min-height: 20px;
    max-height: 20px;
}

.agent-item .agent-avatar img {
    width: 20px !important;
    height: 20px !important;
    object-fit: cover;
    border-radius: 50% !important;
}

.agent-details {
    flex: 1;
    min-width: 0;
}

.agent-item .agent-name {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: var(--wanwen-dark) !important;
    margin: 0 !important;
    line-height: 20px !important;
    height: 20px !important;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== 聊天区域 ===== */
.chat-area {
    background: var(--wanwen-white);
    border: 2px solid var(--wanwen-gray-border);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(44, 62, 80, 0.08);
}

.chat-header {
    padding: 20px 24px;
    background: var(--wanwen-gray-bg);
    border-bottom: 2px solid var(--wanwen-gray-border);
    font-weight: 600;
    color: var(--wanwen-dark);
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 24px;
    right: 24px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--wanwen-gray-border), transparent);
}

.chat-header-content {
    flex: 1;
    margin-right: 0 !important;
}

/* 聊天头部右侧区域 */
.chat-header-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

/* 模型信息方框样式 */
.model-info-box {
    background: var(--wanwen-gray-light);
    border: 1px solid var(--wanwen-gray-border);
    border-radius: 8px;
    padding: 10px 14px;
    min-width: 180px;
    font-size: 12px;
    flex-shrink: 0;
}

.model-info-row {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
    line-height: 1.2;
}

.model-info-row:last-child {
    margin-bottom: 0;
}

.model-label {
    color: var(--wanwen-medium);
    font-weight: 500;
    min-width: 70px;
}

.model-name {
    color: var(--wanwen-dark);
    font-weight: 600;
    flex: 1;
}

.model-limit {
    color: var(--wanwen-success);
    font-weight: 500;
}

.model-switch-btn {
    background: var(--wanwen-gray-light);
    color: var(--wanwen-dark);
    border: 1px solid var(--wanwen-gray-border);
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 8px;
    transition: all 0.2s ease;
    font-size: 11px;
}

.model-switch-btn:hover {
    background: var(--wanwen-dark);
    color: white;
    border-color: var(--wanwen-dark);
    transform: scale(1.05);
}

.model-switch-btn:active {
    transform: scale(0.95);
}

.chat-header .history-toggle-btn,
#historyToggleBtn {
    background: var(--wanwen-white) !important;
    border: 1px solid var(--wanwen-gray-border) !important;
    border-radius: 8px !important;
    padding: 10px 14px !important;
    color: var(--wanwen-medium) !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    font-size: 12px !important;
    margin: 0 8px 0 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    box-shadow: none !important;
    text-decoration: none !important;
    flex-shrink: 0 !important;
    height: auto !important;
}

.chat-header .history-toggle-btn:hover,
#historyToggleBtn:hover {
    background: var(--wanwen-gray-light) !important;
    border-color: var(--wanwen-dark) !important;
    color: var(--wanwen-dark) !important;
}

.chat-header .history-toggle-btn.active,
#historyToggleBtn.active {
    background: var(--wanwen-dark) !important;
    color: var(--wanwen-white) !important;
    border-color: var(--wanwen-dark) !important;
}

/* 聊天头部智能体信息样式 */
.chat-agent-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 4px 0;
    margin-left: 12px !important;
}

.chat-agent-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--wanwen-gradient);
    color: white;
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.15);
    border: 2px solid var(--wanwen-white);
}

.chat-agent-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.chat-agent-details {
    flex: 1;
    min-width: 0;
}

.chat-agent-name {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--wanwen-dark);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chat-agent-description {
    margin: 2px 0 0 0;
    font-size: 12px;
    color: var(--wanwen-light);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: var(--wanwen-white);
}

.chat-input {
    padding: 20px;
    border-top: 2px solid var(--wanwen-gray-border);
    background: var(--wanwen-gray-bg);
}

/* ===== 输入组件 ===== */
.input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    width: 100%;
    flex-wrap: nowrap;
}

.message-input {
    padding: 12px 20px;
    border: 2px solid var(--wanwen-gray-border);
    border-radius: 24px;
    outline: none;
    background: var(--wanwen-white);
    color: var(--wanwen-dark);
    font-size: 14px;
    height: 48px !important;
    box-sizing: border-box !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.05);
    flex: 1;
    min-width: 0;
}

.message-input:focus {
    border-color: var(--wanwen-dark);
    box-shadow: 0 4px 20px rgba(44, 62, 80, 0.12);
    transform: translateY(-1px);
}

.message-input:disabled {
    background: var(--wanwen-gray-bg);
    color: var(--wanwen-light);
    cursor: not-allowed;
}

/* 图片上传按钮 */
.image-upload-btn {
    width: 48px !important;
    height: 48px !important;
    border: 2px solid var(--wanwen-gray-border) !important;
    border-radius: 24px !important;
    background: var(--wanwen-white);
    color: var(--wanwen-medium);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.08);
    box-sizing: border-box !important;
    flex-shrink: 0;
    outline: none;
}

.image-upload-btn.d-none {
    display: none !important;
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.image-upload-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(44, 62, 80, 0.1) 0%, transparent 70%);
    transition: all 0.3s ease;
    transform: translate(-50%, -50%);
    border-radius: 50%;
}

.image-upload-btn:hover::before {
    width: 100%;
    height: 100%;
}

.image-upload-btn:hover {
    border-color: var(--wanwen-dark);
    color: var(--wanwen-dark);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(44, 62, 80, 0.15);
}

.image-upload-btn:active {
    transform: translateY(0) scale(0.98);
}

/* ===== 图片预览样式 ===== */
.image-preview-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--wanwen-gray-bg);
    border: 1px solid var(--wanwen-gray-border);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.image-preview-container:hover {
    border-color: var(--wanwen-primary);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.1);
}

.image-preview-thumbnail {
    position: relative;
    flex-shrink: 0;
}

.preview-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--wanwen-white);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

.preview-image:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.image-remove-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 24px;
    height: 24px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(231, 76, 60, 0.3);
}

.image-remove-btn:hover {
    background: #c0392b;
    transform: scale(1.1);
    box-shadow: 0 3px 10px rgba(231, 76, 60, 0.4);
}

.image-preview-info {
    flex: 1;
    min-width: 0;
}

.image-name {
    display: block;
    font-weight: 500;
    color: var(--wanwen-dark);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-tip {
    color: var(--wanwen-medium);
    font-size: 12px;
}

/* 用户上传图片样式 */
.message-image {
    margin: -12px -16px 8px -16px;
    line-height: 0;
}

.message-image:first-child {
    margin-top: -12px;
}

.user-uploaded-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    border: 1px solid var(--wanwen-gray-border);
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
}

.user-uploaded-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.user-uploaded-image.history-image {
    max-width: 250px;
    max-height: 250px;
}

.message-text {
    margin-top: 8px;
    line-height: 1.6;
    padding: 0 16px;
}

.message-image + .message-text {
    margin-top: 8px;
}

.message-content.image-only .message-image {
    margin-bottom: -12px;
}

/* ===== 发送按钮 ===== */
.send-button {
    width: 48px !important;
    height: 48px !important;
    border: none !important;
    border-radius: 24px !important;
    background: var(--wanwen-gray-border);
    color: var(--wanwen-white);
    cursor: not-allowed;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.08);
    box-sizing: border-box !important;
    flex-shrink: 0;
    outline: none;
}

.send-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    transition: all 0.3s ease;
    transform: translate(-50%, -50%);
    border-radius: 50%;
}

.send-button.enabled {
    background: var(--wanwen-gradient);
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(44, 62, 80, 0.2);
}

.send-button.enabled:hover::before {
    width: 100%;
    height: 100%;
}

.send-button.enabled:hover {
    transform: translateY(-2px) scale(1.1);
    box-shadow: 0 8px 25px rgba(44, 62, 80, 0.3);
}

.send-button.enabled:active {
    transform: translateY(0) scale(0.95);
}

.send-button.loading {
    background: #e74c3c;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* ===== 对话历史样式 ===== */
.conversation-item {
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--wanwen-gray-bg);
    border: 2px solid transparent;
}

.conversation-item:hover {
    background: var(--wanwen-white);
    border-color: var(--wanwen-gray-border);
}

.conversation-item.active {
    background: var(--wanwen-white);
    border-color: var(--wanwen-dark);
}

/* 对话记录头像样式 */
.conversation-item .conversation-avatar {
    width: 20px !important;
    height: 20px !important;
    border-radius: 50% !important;
    flex-shrink: 0;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: var(--wanwen-gradient) !important;
    color: white !important;
    font-size: 10px !important;
    position: relative;
    overflow: hidden;
    min-width: 20px;
    max-width: 20px;
    min-height: 20px;
    max-height: 20px;
}

.conversation-item .conversation-avatar img {
    width: 20px !important;
    height: 20px !important;
    object-fit: cover;
    border-radius: 50% !important;
}

/* 对话记录内容样式 */
.conversation-item .conversation-content {
    flex: 1;
    min-width: 0;
    margin-left: 12px;
}

.conversation-item .conversation-title {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: var(--wanwen-dark) !important;
    margin: 0 !important;
    line-height: 20px !important;
    height: 20px !important;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.conversation-item .conversation-time {
    font-size: 11px !important;
    color: var(--wanwen-light) !important;
    margin: 2px 0 0 0 !important;
    line-height: 1.2;
}

.conversation-item .conversation-delete {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--wanwen-light, #7f8c8d);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    margin-left: 8px;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    pointer-events: auto;
}

.conversation-item .conversation-delete:hover {
    background: rgba(231, 76, 60, 0.1) !important;
    color: #e74c3c !important;
}

/* 新建对话按钮 */
.new-chat-btn {
    width: 100%;
    padding: 15px;
    background: var(--wanwen-gradient);
    border: none;
    border-radius: 12px;
    color: var(--wanwen-white);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

.new-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 62, 80, 0.3);
}

/* ===== 加载和错误状态样式 ===== */
.loading-indicator {
    text-align: center;
    padding: 40px 20px;
    color: var(--wanwen-medium);
    font-size: 14px;
}

.loading-indicator::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--wanwen-gray-border);
    border-top: 2px solid var(--wanwen-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

.error-message {
    text-align: center;
    padding: 40px 20px;
    color: #e74c3c;
    font-size: 14px;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 8px;
    margin: 20px;
}

.no-messages {
    text-align: center;
    padding: 40px 20px;
    color: var(--wanwen-light);
    font-size: 14px;
}

/* ===== 消息样式 ===== */
.message {
    display: flex;
    margin-bottom: 20px;
    align-items: flex-start;
    flex-direction: column;
}

.message-row {
    display: flex;
    align-items: flex-start;
    width: 100%;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--wanwen-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-right: 12px;
    flex-shrink: 0;
}

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

.user-message .message-avatar {
    margin-right: 0;
    margin-left: 12px;
    background: var(--wanwen-dark);
}

.message-content {
    background: var(--wanwen-gray-bg);
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 70%;
    word-wrap: break-word;
}

.user-message .message-content {
    background: var(--wanwen-dark);
    color: white;
}

.message-time {
    font-size: 12px;
    color: var(--wanwen-light);
    margin-top: 6px;
    margin-left: 52px;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.user-message .message-time {
    margin-left: 0;
    margin-right: 52px;
    text-align: right;
    justify-content: flex-end;
}

/* ===== 输入指示器 ===== */
.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--wanwen-medium);
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* ===== 图片样式 ===== */
.message-image img {
    max-width: 200px;
    border-radius: 8px;
    cursor: pointer;
}

.generated-image-img {
    max-width: 300px;
    border-radius: 8px;
    cursor: pointer;
}

/* ===== 推荐问题样式 ===== */
.recommended-questions {
    margin-top: 15px;
    background: var(--wanwen-gray-bg);
    border: 2px solid var(--wanwen-gray-border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.recommended-questions-header {
    padding: 12px 16px;
    background: var(--wanwen-white);
    border-bottom: 1px solid var(--wanwen-gray-border);
    font-size: 14px;
    font-weight: 600;
    color: var(--wanwen-medium);
    display: flex;
    align-items: center;
    gap: 8px;
}

.recommended-questions-header i {
    color: #f39c12;
    font-size: 16px;
}

.recommended-questions-list {
    padding: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.recommended-question-item {
    background: var(--wanwen-white);
    border: 2px solid var(--wanwen-gray-border);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--wanwen-medium);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.recommended-question-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(44, 62, 80, 0.05), transparent);
    transition: left 0.5s ease;
}

.recommended-question-item:hover::before {
    left: 100%;
}

.recommended-question-item:hover {
    background: var(--wanwen-white);
    border-color: var(--wanwen-dark);
    color: var(--wanwen-dark);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 20px rgba(44, 62, 80, 0.15);
}

.recommended-question-item:active {
    transform: translateY(0) scale(0.98);
}

.recommended-question-item i {
    font-size: 11px;
    opacity: 0.7;
}

.recommended-question-item:hover i {
    opacity: 1;
}

.recommended-questions.empty {
    display: none !important;
}

/* ===== 消息操作按钮样式 ===== */
.message-actions {
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
}

.message:hover .message-actions {
    opacity: 1;
}

.message-action-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: transparent;
    border: none;
    color: var(--wanwen-light);
    transition: all 0.2s ease;
    cursor: pointer;
}

.message-action-btn:hover {
    color: var(--wanwen-dark);
    background-color: var(--wanwen-gray-bg);
    transform: scale(1.1);
}

.message-action-btn i {
    font-size: 12px;
}

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

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

.message-action-btn.copy-success {
    color: #28a745 !important;
}

.message-deleted {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ===== 智能体选择面板样式 ===== */
.agent-select-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10001;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.agent-select-panel.show {
    display: block;
    opacity: 1;
}

.agent-select-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.agent-select-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 800px;
    height: 80%;
    background: var(--wanwen-white, #ffffff);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.agent-select-panel.show .agent-select-content {
    transform: translate(-50%, -50%) scale(1);
}

.agent-select-header {
    padding: 20px;
    border-bottom: 1px solid var(--wanwen-gray-bg, #f8f9fa);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.agent-select-header h3 {
    margin: 0;
    color: var(--wanwen-dark, #2c3e50);
    font-size: 18px;
}

.agent-select-header .close-btn {
    background: var(--wanwen-gray-bg, #f8f9fa);
    border: 1px solid var(--wanwen-gray-border, #e9ecef);
    color: var(--wanwen-dark, #2c3e50);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.agent-select-header .close-btn:hover {
    background: var(--wanwen-danger, #e74c3c);
    color: white;
    border-color: var(--wanwen-danger, #e74c3c);
    transform: scale(1.1);
}

.agent-select-body {
    flex: 1;
    padding: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.agent-select-search {
    position: relative;
    margin-bottom: 16px;
}

.agent-select-search input {
    width: 100%;
    padding: 12px 40px 12px 16px;
    border: 1px solid var(--wanwen-gray-bg, #e9ecef);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
}

.agent-select-search i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--wanwen-light, #7f8c8d);
}

.agent-select-categories {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.category-filter-btn {
    padding: 8px 16px;
    border: 1px solid var(--wanwen-gray-bg, #e9ecef);
    background: var(--wanwen-white, #ffffff);
    color: var(--wanwen-dark, #2c3e50);
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.category-filter-btn:hover {
    background: var(--wanwen-gray-bg, #f8f9fa);
}

.category-filter-btn.active {
    background: var(--wanwen-primary, #3498db);
    color: white;
    border-color: var(--wanwen-primary, #3498db);
}

.agent-select-list {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    grid-auto-rows: max-content;
    gap: 12px;
    padding: 8px 0;
    align-content: start;
}

.agent-select-item {
    padding: 16px;
    border: 1px solid var(--wanwen-gray-bg, #e9ecef);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--wanwen-white, #ffffff);
    height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.agent-select-item:hover {
    border-color: var(--wanwen-primary, #3498db);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.1);
}

.agent-select-item.selected {
    border-color: var(--wanwen-primary, #3498db);
    background: rgba(52, 152, 219, 0.05);
}

.agent-select-item-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--wanwen-gray-bg, #f8f9fa);
    overflow: hidden;
    flex-shrink: 0;
}

.agent-select-item-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.agent-select-item-avatar i {
    font-size: 18px;
    color: var(--wanwen-light, #7f8c8d);
}

.agent-select-item-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--wanwen-dark, #2c3e50);
    text-align: center;
    margin-bottom: 6px;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-select-item-desc {
    font-size: 12px;
    color: var(--wanwen-light, #7f8c8d);
    text-align: center;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

/* ===== 用户智能体列表样式 ===== */
.user-agent-item {
    position: relative;
    cursor: move;
}

.user-agent-item.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

.user-agent-item .agent-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--wanwen-light, #7f8c8d);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    z-index: 10;
    pointer-events: auto;
}

.user-agent-item .agent-delete-btn:hover {
    background: rgba(231, 76, 60, 0.1) !important;
    color: #e74c3c !important;
}

.user-agent-item:hover .agent-delete-btn {
    display: flex;
}

.user-agent-item {
    cursor: pointer !important;
}

.user-agent-item:hover {
    background: var(--wanwen-white) !important;
    border-color: var(--wanwen-gray-border) !important;
}

.user-agent-item.active {
    background: var(--wanwen-white) !important;
    border-color: var(--wanwen-dark) !important;
}

.add-agent-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border: 2px dashed var(--wanwen-gray-bg, #e9ecef);
    border-radius: 12px;
    background: var(--wanwen-white, #ffffff);
    color: var(--wanwen-light, #7f8c8d);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 12px;
    gap: 8px;
}

.add-agent-btn:hover {
    border-color: var(--wanwen-primary, #3498db);
    color: var(--wanwen-primary, #3498db);
    background: rgba(52, 152, 219, 0.05);
}

.add-agent-btn i {
    font-size: 16px;
    flex-shrink: 0;
}

.add-agent-btn > div {
    text-align: center;
    line-height: 1.2;
}

/* ===== 响应式设计 ===== */
@media (max-width: 1200px) {
    .workspace-container {
        grid-template-columns: 260px 1fr 200px;
        gap: 15px;
    }

    .workspace-container.sidebar-collapsed {
        grid-template-columns: 60px 1fr 200px;
    }

    .workspace-container.sidebar-collapsed.hide-history {
        grid-template-columns: 60px 1fr 0px;
    }
}

@media (max-width: 992px) {
    .workspace-container {
        grid-template-columns: 1fr;
        height: auto;
    }

    .workspace-container.sidebar-collapsed {
        grid-template-columns: 1fr;
    }

    .primary-tab {
        font-size: 14px;
        padding: 12px 20px;
        min-width: 80px;
    }

    /* 移动端隐藏折叠按钮 */
    .sidebar-collapse-btn {
        display: none;
    }

    .secondary-tab {
        font-size: 13px;
        padding: 8px 16px;
    }
}

@media (max-width: 768px) {
    .category-showcase {
        margin: 20px 0;
        padding: 20px;
    }

    .primary-tab {
        font-size: 13px;
        padding: 10px 16px;
        min-width: 70px;
    }

    .secondary-tab {
        font-size: 12px;
        padding: 6px 12px;
    }

    .agent-select-content {
        width: 95%;
        height: 90%;
    }

    .agent-select-list {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .agent-select-item {
        height: 120px;
        padding: 12px;
    }

    .agent-select-item-avatar {
        width: 32px;
        height: 32px;
        margin-bottom: 8px;
    }

    .agent-select-item-name {
        font-size: 13px;
        margin-bottom: 4px;
    }

    .agent-select-item-desc {
        font-size: 11px;
        -webkit-line-clamp: 2;
    }

    .agent-select-categories {
        flex-wrap: wrap;
    }

    .category-filter-btn {
        font-size: 11px;
        padding: 6px 12px;
    }

    .recommended-questions-list {
        padding: 10px;
        gap: 6px;
    }

    .recommended-question-item {
        font-size: 12px;
        padding: 6px 12px;
    }

    /* 移动端消息操作按钮始终显示 */
    .message-actions {
        opacity: 1;
    }

    .message-action-btn {
        width: 22px;
        height: 22px;
    }

    .message-action-btn i {
        font-size: 11px;
    }

    .agent-select-categories {
        flex-wrap: wrap;
    }

    .category-filter-btn {
        font-size: 11px;
        padding: 6px 12px;
    }
}

/* ===== 智能体选择面板分类筛选 ===== */
.agent-select-categories {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.category-filter-btn {
    padding: 8px 16px;
    border: 1px solid var(--wanwen-gray-bg, #e9ecef);
    background: var(--wanwen-white, #ffffff);
    color: var(--wanwen-dark, #2c3e50);
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.category-filter-btn:hover {
    background: var(--wanwen-gray-bg, #f8f9fa);
}

.category-filter-btn.active {
    background: var(--wanwen-primary, #3498db);
    color: white;
    border-color: var(--wanwen-primary, #3498db);
}
