// 主容器
.chat-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #E8F4FD 0%, #F5FAFF 25%, #FAFCFE 50%, #FFFFFF 100%);
    position: relative;
    // 多种安全区域适配方式
    padding-top: env(safe-area-inset-top);
    padding-top: constant(safe-area-inset-top); /* 兼容iOS < 11.2 */
    box-sizing: border-box;
}

// 顶部标题栏
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
	flex-direction: row;
    align-items: center;
    padding: 0 16px;
    z-index: 100;
    box-sizing: border-box;
    
    // 小程序需要为右侧胶囊按钮留出空间
    /* #ifdef MP-WEIXIN */
    padding-right: 100px;
    /* #endif */
}

.title {
    font-size: 20px;
    font-weight: bold;
    color: #000000;
    line-height: 1;
    flex-shrink: 0;
}

.header-right {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.workcase-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px 10px;
    height: 28px;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 14px;
    box-sizing: border-box;
    white-space: nowrap;
    flex-shrink: 0;
    margin: 0;
    line-height: 1;
}

.workcase-btn::after {
    border: none;
}

.btn-icon {
    width: 16px;
    height: 16px;
}

.btn-text {
    color: #333333;
    font-size: 12px;
    font-weight: 500;
}

// 欢迎区域（机器人+浮动标签）
.hero {
    position: relative;
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 80px;
}

.rings {
    position: absolute;
    width: 100%;
    height: 100%;
    background: none !important;
    border: none !important;
}

.ring {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: none !important;
    border: none !important;
}

.r1 { width: 260px; height: 260px; }
.r2 { width: 200px; height: 200px; }
.r3 { width: 150px; height: 150px; }
.r4 { width: 110px; height: 110px; }

.robot {
    position: relative;
    z-index: 2;
    width: 140px;
    height: 140px;
    /* 父容器加一层径向渐变背景，模拟外层模糊光晕 */
    background: radial-gradient(circle at center, 
        rgba(180, 220, 255, 0.5) 0%, 
        rgba(180, 220, 255, 0.25) 50%,
        transparent 75%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.robot-face {
    width: 100px;
    height: 100px;
    background: linear-gradient(145deg, #e8f7ff 0%, #c5e4ff 100%);
    border-radius: 50%;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 16px;
    /* 只保留内阴影，外模糊交给父容器的径向渐变 */
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.8);
    /* 取消overflow:hidden，避免裁切父容器的渐变光晕 */
    overflow: visible;
}

.eye {
    width: 14px;
    height: 24px;
    background: linear-gradient(180deg, #7ec1ff 0%, #1846ff 100%);
    border-radius: 10px;
}

.float-tag {
    position: absolute;
    padding: 6px 12px;
    background: transparent; /* 去掉背景色，和左侧一致 */
    border: none; /* 去掉边框 */
    border-radius: 0; /* 保持直角（如果需要圆角也可以改回16px） */
    font-size: 12px;
    color: #666;
}

.t1 { right: 20px; top: 40px; }
.t2 { left: 20px; top: 80px; }
.t3 { right: 30px; bottom: 50px; }

.greeting {
    text-align: left;
    padding: 0 30px;
    margin-top: 24px;
}

.greeting-title {
    display: block;
    font-size: 24px;
    font-weight: 800;
    color: #1d72d3;
    margin-bottom: 10px;
}

.greeting-sub {
    font-size: 15px;
    color: #a2a9b7;
}

// AI初始消息
.ai-initial-msg {
    background: #fff;
    padding: 12px 16px;
    border-radius: 12px;
    margin: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.ai-msg-text {
    font-size: 14px;
    color: #333;
    line-height: 1.5;
}

// 聊天消息区域
.chat-messages {
    flex: 1;
    // background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    padding: 20px 16px;
    padding-bottom: 120px;
    position: relative;
    // 为固定定位的header留出空间
    margin-top: 50px; // 默认header高度
}

// 欢迎界面
.welcome-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    text-align: center;
    padding: 40px 20px;
}

.welcome-image {
    width: 90%; // 增大图片尺寸以适应PNG图标+文字气泡
    margin-bottom: 32px;
}

.welcome-text-primary {
    font-size: 22px; // 增大主标题字体
    font-weight: 600;
    color: #1A1A1A; // 更深的文字颜色
    margin-bottom: 12px;
    line-height: 1.3;
}

.welcome-text-secondary {
    font-size: 16px; // 增大副标题字体  
    color: #4A4A4A; // 调整副标题颜色
    line-height: 1.4;
}

// 消息列表
.messages-list {
    padding: 16px 0;
}

.message-item {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.user-message-content {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 8px;
}

// 消息内容包装器（包含气泡和文件列表）
.message-content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    max-width: 260px;
}

.bot-message-content {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-avatar {
    background: #5B8FF9;
}

.bot-avatar {
    background: #FF6B6B;
}

.avatar-text {
    font-size: 14px;
    font-weight: 500;
    color: #FFFFFF;
}

.message-bubble {
    max-width: 240px;
    padding: 10px 14px;
    border-radius: 12px;
    position: relative;
}

.user-bubble {
    background: #5B8FF9;
    border-radius: 12px;
}

.bot-bubble {
    background: #FFFFFF;
    border: 1px solid #E5E5E5;
    border-radius: 12px;
    min-height: 40px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

.user-bubble .message-text {
    color: #FFFFFF;
}

.bot-bubble .message-text {
    color: #333333;
}

.message-text {
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

// rich-text 组件样式（用于 Markdown 渲染）
.message-rich-text {
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    max-width: 100%;
}

.message-time {
    font-size: 11px;
    color: #999999;
    margin-top: 4px;
}

.user-message .message-time {
    text-align: right;
    padding-right: 48px;
}

.bot-message .message-time {
    text-align: left;
    padding-left: 48px;
}

// 底部操作区域
.bottom-area {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    // background: rgba(240, 241, 246, 0.95);
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 50;
}

// 快捷按钮横向滚动
.quick-scroll {
    white-space: nowrap;
    margin-bottom: 12px;
}

.quick-list {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.quick-btn {
    margin: 0;
    position: relative;
    box-sizing: border-box;
    flex-shrink: 0;
    flex-grow: 0;
    flex-basis: auto;
    align-content: stretch;
    min-height: 0px;
    min-width: 0px;
    overflow: hidden;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: none;
    display: flex;
    flex-direction: row;
    padding: 10px 24px;
    color: black;
}

.quick-btn.has-icon {
    // background: linear-gradient(90deg, #173294 0%, #4a6fd9 100%);
    border: none;
    padding: 10px 24px;
}

.quick-btn.has-icon .quick-text {
    // color: #fff;
    font-weight: 500;
}

.quick-icon {
    font-size: 14px;
    margin-right: 6px;
    color: #333;
}

.quick-divider {
    width: 1px;
    height: 20px;
    background: #d0d5dd;
    margin: 0 4px;
}

.quick-text {
    font-size: 13px;
    color: #333;
    white-space: nowrap;
}

// 输入区域
.chat-input-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 24px;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

// 已上传文件预览区
.uploaded-files {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 8px 4px;
    border-bottom: 1px solid #f0f0f0;
}

.uploaded-file-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80px;
    background: #f5f5f5;
    border-radius: 8px;
    padding: 8px;
    gap: 4px;
}

.file-preview-image {
    width: 64px;
    height: 64px;
    border-radius: 6px;
    overflow: hidden;
}

.preview-img {
    width: 100%;
    height: 100%;
}

.file-preview-doc {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 6px;
}

.doc-icon {
    font-size: 32px;
}

.file-name {
    font-size: 11px;
    color: #666;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.remove-file-btn {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    border-radius: 10px;
    background: #ff4d4f;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-icon {
    font-size: 12px;
    color: #fff;
}

// 输入行（上传按钮+输入框+发送按钮）
.input-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 4px;
}

.upload-btn {
    width: 40px;
    height: 40px;
    border-radius: 20px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 4px;
}

.upload-btn.uploading {
    background: #e6f7ff;
}

.upload-icon {
    font-size: 20px;
}

.chat-input {
    flex: 1;
    height: 40px;
    padding: 0 12px;
    background: transparent;
    border: none;
    font-size: 14px;
    color: #333;
}

.chat-input::placeholder {
    color: #999;
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 20px;
    background: linear-gradient(135deg, #e9f1ff 0%, #d4e4ff 100%);
    border: 1px solid #8dbbff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: 4px;
}

.send-btn.active {
    background: linear-gradient(135deg, #5b9eff 0%, #4b87ff 100%);
    border-color: #4b87ff;
}

.send-btn.active .send-icon {
    color: #fff;
}

.send-icon {
    font-size: 18px;
    color: #4b87ff;
}

// 消息中的文件列表
.message-files {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

.message-file-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 70px;
}

.file-thumb {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.file-thumb.image {
    border: 1px solid #e5e5e5;
    background: #fff;
}

.file-img {
    width: 100%;
    height: 100%;
}

.file-thumb.doc {
    background: #f5f5f5;
    padding: 8px;
}

.file-icon {
    font-size: 28px;
}

.file-name-small {
    font-size: 10px;
    color: #666;
    text-align: center;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 4px;
}

// 打字指示器动画
.typing-indicator {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #999;
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

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

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

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

// 设备代码输入弹窗样式
.device-code-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-mask {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background-color: white;
    border-radius: 16px;
    width: 80%;
    max-width: 320px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.modal-header {
    margin-bottom: 20px;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    text-align: center;
    display: block;
}

.modal-body {
    margin-bottom: 20px;
}

.device-code-input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    background-color: #f9f9f9;
    box-sizing: border-box;
}

.device-code-input:focus {
    border-color: #007AFF;
    background-color: white;
    outline: none;
}

.modal-footer {
    display: flex;
    flex-direction: row;
    gap: 12px;
}

.modal-btn {
    flex: 1;
    height: 44px;
    border-radius: 8px;
    border: none;
    font-size: 16px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn.cancel {
    background-color: #f5f5f5;
    color: #666;
}

.modal-btn.cancel:active {
    background-color: #e5e5e5;
}

.modal-btn.confirm {
    background-color: #007AFF;
    color: white;
}

.modal-btn.confirm:active {
    background-color: #0056b3;
}

.modal-btn .btn-text {
    font-size: 16px;
}
