/* AI问答页面专用样式 */
.ai-font {
    font-family: Georgia, "Times New Roman", Times, serif;
}

/* 聊天历史项样式 */
.chat-history-item {
    transition: all 0.3s ease;
}

.chat-history-item:hover {
    background-color: var(--light-gray) !important;
}

.chat-history-item[data-chat-id='default'] {
    background-color: rgba(140, 94, 88, 0.05);
    border-left: 4px solid var(--primary-color);
}

/* 聊天消息样式 */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* 消息气泡样式 */
.chat-container > div {
    animation: fadeIn 0.3s ease;
}

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

/* 用户消息气泡 */
.chat-container > div.flex.justify-end > div > div:first-child {
    position: relative;
}

.chat-container > div.flex.justify-end > div > div:first-child::after {
    content: '';
    position: absolute;
    top: 10px;
    right: -10px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 0 10px 10px;
    border-color: transparent transparent transparent var(--primary-color);
}

/* 助手消息气泡 */
.chat-container > div > div > div:last-child {
    position: relative;
}

.chat-container > div > div > div:last-child::after {
    content: '';
    position: absolute;
    top: 10px;
    left: -10px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 10px 10px 0;
    border-color: transparent white transparent transparent;
}

/* 输入区域样式 */
#user-input, #user-input-mobile {
    transition: all 0.3s ease;
}

#user-input:focus, #user-input-mobile:focus {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* 发送按钮样式 */
#send-button, #send-button-mobile {
    transition: all 0.3s ease;
}

#send-button:hover, #send-button-mobile:hover {
    transform: scale(1.05);
}

#send-button:active, #send-button-mobile:active {
    transform: scale(0.95);
}

/* 正在输入动画 */
.animate-bounce {
    animation: bounce 1.4s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* 新对话按钮样式 */
#new-chat, #new-chat-mobile {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#new-chat::before, #new-chat-mobile::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: all 0.5s ease;
}

#new-chat:hover::before, #new-chat-mobile:hover::before {
    left: 100%;
}

/* 删除对话按钮样式 */
#delete-chat {
    transition: all 0.3s ease;
}

#delete-chat:hover {
    transform: scale(1.1);
}

/* 移动端菜单按钮样式 */
#mobile-menu-button {
    transition: all 0.3s ease;
}

#mobile-menu-button:hover {
    transform: rotate(90deg);
}

/* 移动端菜单样式 */
#mobile-menu {
    transition: all 0.3s ease-in-out;
}

/* 响应式调整 */
@media (max-width: 768px) {
    /* 调整移动端聊天界面高度 */
    .h-\[calc\(100vh-200px\)\] {
        height: calc(100vh - 180px) !important;
    }
    
    /* 调整移动端消息气泡最大宽度 */
    .max-w-\[80\%\] {
        max-width: 85% !important;
    }
    
    /* 调整移动端输入框样式 */
    .p-3 {
        padding: 0.75rem !important;
    }
    
    /* 调整移动端图标大小 */
    .w-8.h-8 {
        width: 2.25rem !important;
        height: 2.25rem !important;
    }
}

@media (max-width: 480px) {
    /* 调整小屏幕聊天界面高度 */
    .h-\[calc\(100vh-200px\)\] {
        height: calc(100vh - 160px) !important;
    }
    
    /* 调整小屏幕消息气泡最大宽度 */
    .max-w-\[80\%\] {
        max-width: 90% !important;
    }
    
    /* 调整小屏幕输入框样式 */
    .p-4 {
        padding: 0.5rem !important;
    }
}

/* 聊天滚动条增强样式 */
.chat-scrollbar {
    scroll-behavior: smooth;
}

.chat-scrollbar::-webkit-scrollbar-track {
    background: var(--light-gray);
    border-radius: 3px;
}

.chat-scrollbar::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.chat-scrollbar::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
    transform: scaleX(1.2);
}

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

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

/* 对话框头部样式 */
.border-b {
    border-bottom: 1px solid var(--border-color);
}

/* 对话框底部样式 */
.border-t {
    border-top: 1px solid var(--border-color);
}

/* 左侧历史对话栏样式 */
.border-r {
    border-right: 1px solid var(--border-color);
}

/* 确保消息内容中的HTML标签正确显示 */
.text-gray-700 br {
    display: block;
    content: '';
    margin: 8px 0;
}

/* 动画延迟 */
.delay-100 {
    animation-delay: 0.1s;
}

.delay-200 {
    animation-delay: 0.2s;
}

.delay-300 {
    animation-delay: 0.3s;
}

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

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--dark-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
}

[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% - 5px);
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 5px 5px 0 5px;
    border-color: var(--dark-color) transparent transparent transparent;
    z-index: 1000;
}

/* 消息时间戳样式 */
.message-time {
    font-size: 0.75rem;
    color: var(--gray-color);
    margin-top: 0.25rem;
    text-align: right;
}

/* 输入框占位符样式 */
::placeholder {
    color: #a0aec0;
    opacity: 1;
}

:-ms-input-placeholder {
    color: #a0aec0;
}

::-ms-input-placeholder {
    color: #a0aec0;
}