/* 优化页面渲染，消除加载感 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* 关闭不必要的动画，减少重绘 */
    transition: none !important;
    animation: none !important;
}

/* 禁止页面滚动抖动 */
html, body {
    overflow: hidden;
    height: 100vh;
    width: 100%;
}

/* 图片提前加载，避免裂图闪烁 */
img {
    object-fit: cover;
    user-select: none;
}/* 官方客服聊天界面样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Microsoft YaHei", Arial, sans-serif;
    background: #f5f5f5;
    height: 100vh;
    overflow: hidden;
}

.official-chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

/* 头部 */
.chat-header {
    padding: 15px 20px;
    background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(24,144,255,0.2);
}

.kf-info {
    display: flex;
    align-items: center;
}

.avatar-box {
    position: relative;
    margin-right: 15px;
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.3);
}

.status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
}

.status-dot.online {
    background: #52c41a;
}

.status-dot.offline {
    background: #d9d9d9;
}

.kf-info .info .name {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 3px;
}

.kf-info .info .status-text {
    font-size: 13px;
    opacity: 0.9;
}

/* 消息区域 */
.messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f5f7fa;
}

.welcome-msg {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.welcome-icon {
    font-size: 60px;
    margin-bottom: 15px;
}

.welcome-msg p {
    font-size: 16px;
    margin-bottom: 8px;
}

.welcome-msg .sub {
    font-size: 14px;
    color: #999;
}

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

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

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin: 0 12px;
    object-fit: cover;
}

.message-content {
    max-width: 70%;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    word-break: break-word;
    line-height: 1.6;
}

.message-item.user .message-bubble {
    background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
    color: #fff;
}

.message-time {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
    text-align: center;
}

/* 输入区域 */
.input-area {
    padding: 15px 20px;
    background: #fff;
    border-top: 1px solid #e8e8e8;
}

.guest-tip {
    padding: 10px 15px;
    background: #fff7e6;
    border: 1px solid #ffd591;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 13px;
    color: #d46b08;
}

.guest-tip a {
    color: #1890ff;
    text-decoration: none;
    margin: 0 5px;
}

.guest-tip a:hover {
    text-decoration: underline;
}

.input-box textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    font-size: 14px;
    resize: none;
    outline: none;
    transition: border-color 0.3s;
}

.input-box textarea:focus {
    border-color: #1890ff;
}

.action-box {
    margin-top: 12px;
    text-align: right;
}

.send-btn {
    padding: 10px 35px;
    background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(24,144,255,0.4);
}

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

/* ==================== 用户客户端手机版适配 ==================== */
@media (max-width: 768px) {
    /* 整体容器适配 */
    .official-chat-container {
        width: 100% !important;
        height: 100vh !important;
        max-width: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }

    /* 头部适配 */
    .chat-header {
        padding: 12px 15px !important;
    }
    
    .chat-header .avatar-box img {
        width: 40px !important;
        height: 40px !important;
    }
    
    .chat-header .name {
        font-size: 16px !important;
    }
    
    .chat-header .status-text {
        font-size: 12px !important;
    }

    /* 消息区域适配 */
    .messages-container {
        padding: 15px !important;
    }
    
    .message-item {
        margin-bottom: 15px !important;
    }
    
    .message-avatar {
        width: 35px !important;
        height: 35px !important;
        margin: 0 8px !important;
    }
    
    .message-content {
        max-width: 75% !important;
    }
    
    .message-bubble {
        padding: 10px 14px !important;
        font-size: 14px !important;
        line-height: 1.5 !important;
    }
    
    .message-time {
        font-size: 11px !important;
    }

    /* 欢迎消息适配 */
    .welcome-msg {
        padding: 30px 20px !important;
    }
    
    .welcome-icon {
        font-size: 50px !important;
        margin-bottom: 15px !important;
    }
    
    .welcome-msg p {
        font-size: 14px !important;
        margin-bottom: 8px !important;
    }
    
    .welcome-msg .sub {
        font-size: 12px !important;
    }

    /* 输入区域适配 */
    .input-area {
        padding: 12px 15px !important;
    }
    
    .login-tip,
    .guest-tip {
        padding: 10px 12px !important;
        font-size: 13px !important;
        margin-bottom: 10px !important;
    }
    
    .input-box textarea {
        padding: 12px !important;
        font-size: 14px !important;
        min-height: 80px !important;
    }
    
    .action-box {
        margin-top: 10px !important;
    }
    
    .send-btn {
        padding: 12px 40px !important;
        font-size: 15px !important;
        width: 100% !important;
    }
}

/* 小屏手机进一步优化 */
@media (max-width: 480px) {
    .message-content {
        max-width: 80% !important;
    }
    
    .message-bubble {
        font-size: 13px !important;
        padding: 9px 12px !important;
    }
}