/* Chatbox 面板样式 */
.chatbox-panel {
    position: fixed;
    right: 0;
    top: 0;
    width: 500px;
    height: 100%;
    background: var(--color-white);
    border-left: 1px solid var(--color-border-primary);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, width 0.15s ease;
    z-index: 1000;
    min-width: 300px;
    max-width: 800px;
}

.chatbox-panel.collapsed {
    transform: translateX(500px);
}

/* 主内容区域样式 */
.main-content {
    transition: margin-right 0.3s ease;
}

.main-content.expanded {
    margin-right: 0 !important;
}

.collapse-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.collapse-btn:hover {
    color: var(--color-text-primary);
}

.icon-collapse, .icon-expand {
    font-size: 1.125rem;
    line-height: 1;
}

.expand-tab {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: var(--color-white);
    border: 1px solid var(--color-border-primary);
    border-right: none;
    padding: 15px 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border-radius: 8px 0 0 8px;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s;
    z-index: 1000;
}

.expand-tab:hover {
    background-color: var(--color-gray-100);
}

.expand-tab span {
    writing-mode: vertical-lr;
    font-size: 0.875rem;
    color: var(--color-text-primary);
    margin-top: 5px;
}

/* 标题栏样式 */
.chatbox-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: var(--color-gray-100);
    border-bottom: 1px solid var(--color-border-primary);
    min-height: 60px;
}

.chatbox-title {
    margin: 0 15px;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text-primary);
    flex-grow: 1;
}

.model-selector {
    display: flex;
    align-items: center;
}

.model-select {
    padding: 6px 12px;
    border: 1px solid var(--color-border-primary);
    border-radius: 6px;
    background: white;
    font-size: 0.875rem;
    color: var(--color-text-primary);
    cursor: pointer;
    min-width: 120px;
    transition: border-color 0.3s ease;
}

.model-select:focus {
    outline: none;
    border-color: var(--color-info);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.1);
}

.model-select:hover {
    border-color: #999;
}

/* 聊天历史区域 */
.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: var(--color-white)fff;
}

/* 消息样式 */
.chat-message {
    margin-bottom: 15px;
    max-width: 95%;
    position: relative;
}

.user-message {
    margin-left: auto;
}

.ai-message {
    margin-right: auto;
}

.message-content {
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 0.875rem;
    line-height: 1.4;
    position: relative;
}

.user-message .message-content {
    background: var(--color-gray-200);
    color: var(--color-text-primary);
    border-radius: 15px 15px 0 15px;
    max-height: 100px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.user-message .message-content.expanded {
    max-height: none;
}

/* 消息底部操作栏 */
.message-actions {
    display: flex;
    gap: 12px;
    padding: 4px 10px;
    margin-top: 4px;
    justify-content: flex-end;
    align-items: center;
}

.user-message .message-actions {
    justify-content: flex-end;
}

.ai-message .message-actions {
    justify-content: flex-start;
}

/* 展开/收起按钮 */
.toggle-expand-btn-chatbox {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.toggle-expand-btn-chatbox:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* 复制按钮 */
.copy-btn-chatbox {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.copy-btn-chatbox:hover {
    background: rgba(0, 0, 0, 0.05);
}

.copy-btn-chatbox.copied {
    color: var(--color-success);
}

/* 移除之前的展开提示样式 */
.user-message .message-content.collapsible::after {
    display: none;
}

/* 输入区域 */
.chat-input-area {
    padding: 15px;
    background: var(--color-white);
    border-top: 1px solid var(--color-border-primary);
}

.chat-input-container {
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--color-border-primary);
    border-radius: 4px;
    font-size: 0.875rem;
    resize: none;
    min-height: 40px;
    max-height: 120px;
}

.chat-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.chat-actions {
    display: flex;
    gap: 8px;
}

.chat-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.send-btn {
    background-color: var(--color-info);
    color: white;
}

.send-btn:hover {
    background-color: var(--color-info-dark);
}

.send-btn.streaming {
    background-color: var(--color-error);
}

.send-btn.streaming:hover {
    background-color: var(--color-error-dark);
}

.clear-btn {
    background: var(--color-gray-100);
    color: var(--color-text-secondary);
}

.clear-btn:hover {
    background: var(--color-border-primary);
}

/* 打字动画效果 */
.typing {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 10px 15px;
    background: var(--color-white);
    border-radius: 15px;
    width: fit-content;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--color-text-secondary);
    border-radius: 50%;
    animation: typing 1s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.3;
    }
    30% {
        transform: translateY(-3px);
        opacity: 1;
    }
}

/* 流式返回样式 */
.streaming {
    opacity: 0.7;
}

.stream-cursor {
    display: inline-block;
    width: 2px;
    height: 15px;
    background: var(--color-text-primary);
    margin-left: 2px;
    animation: blink 1s infinite;
}

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

/* 拖动条样式 */
.resize-handle {
    position: absolute;
    left: -2px;
    top: 0;
    width: 4px;
    height: 100%;
    cursor: col-resize;
    background-color: transparent;
    transition: background-color 0.2s;
    z-index: 1001;
}

.resize-handle:hover,
.resize-handle.dragging {
    background-color: var(--color-info);
}

/* 拖动时添加遮罩，防止文本选中 */
.resize-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
    cursor: col-resize;
}

.resize-overlay.active {
    display: block;
}

/* Electron自定义标题栏适配 */
/* 仅在Electron环境下启用自定义标题栏时生效，浏览器环境不受影响 */
:root.electron-custom-titlebar-active .chatbox-panel {
    top: var(--electron-titlebar-height, 40px);
    height: calc(100% - var(--electron-titlebar-height, 40px));
}

:root.electron-custom-titlebar-active .expand-tab {
    top: calc(50% + var(--electron-titlebar-height, 40px) / 2);
} 