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

/* 对话系统相关元素样式 */

/* 对话按钮样式 */
.chat-btn {
    position: fixed;
    bottom: 50px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

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

/* 输入框容器样式 */
.input-container {
    position: fixed;
    bottom: 200px;
    right: 270px;
    width: 300px;
    min-width: 300px;
    max-width: 500px; /* 允许横向调整大小，但限制最大值 */
    min-height: 210px; /* 增加最小高度，确保所有元素都能显示完整 */
    max-height: 400px; /* 允许纵向调整大小，但限制最大值 */
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(102, 126, 234, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    resize: none; /* 明确禁止浏览器默认调整大小行为 */
}

.input-container.active {
    opacity: 1;
    visibility: visible;
}

/* 输入框头部（可拖动区域） */
.input-header {
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
    cursor: move;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* 输入框调整大小手柄 */
.resize-handle {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 12px;
    height: 12px;
    background-color: #667eea;
    border-radius: 2px;
    cursor: nwse-resize;
    opacity: 0.5;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.resize-handle:hover {
    opacity: 0.8;
}

.resize-handle:active {
    opacity: 1;
    background-color: #5a6fd8;
}

/* 拖动时的视觉反馈 */
.input-container.dragging {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    transition: box-shadow 0.1s ease;
}

/* 关闭按钮 */
.close-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: opacity 0.2s ease;
}

.close-btn:hover {
    opacity: 0.8;
}

/* 输入框内容区域 */
.input-content {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* 文本输入框 */
#chat-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    resize: none;
    font-size: 14px;
    font-family: inherit;
    margin-bottom: 12px;
    transition: border-color 0.3s ease;
    flex: 1;
    min-height: 80px;
    max-height: 220px;
    box-sizing: border-box;
}

#chat-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 发送按钮 */
.send-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.send-btn:active {
    transform: translateY(0);
}

/* 对话框样式 */
.dialogue-box {
    position: fixed;
    bottom: 350px;
    right: 200px;
    max-width: 300px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    padding: 16px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.dialogue-box.active {
    opacity: 1;
    visibility: visible;
}

.dialogue-content {
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    word-wrap: break-word;
}

/* 对话框三角形指示器 */
.dialogue-box::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid white;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.dialogue-box.active {
    animation: fadeIn 0.3s ease;
}

.input-container.active {
    animation: slideIn 0.3s ease;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .chat-btn {
        bottom: 20px;
        right: 20px;
    }
    
    .input-container {
        bottom: 90px;
        right: 20px;
        width: calc(100% - 40px);
        max-width: 320px;
    }
    
    .dialogue-box {
        bottom: 250px;
        right: 20px;
        max-width: calc(100% - 40px);
    }
}