/* ========================================
   自建客服系统 - 前端聊天组件样式（科幻版）
   ======================================== */

/* 聊天悬浮按钮 */
.chat-float-btn {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00f0ff 0%, #8b5cf6 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(0,240,255,0.3), 0 0 60px rgba(0,240,255,0.1);
    z-index: 9999;
    transition: all 0.3s ease;
    border: 1px solid rgba(0,240,255,0.3);
    outline: none;
}
.chat-float-btn:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 0 30px rgba(0,240,255,0.5), 0 0 80px rgba(0,240,255,0.15);
}
.chat-float-btn .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #ff0066, #ff00aa);
    color: #fff;
    font-size: 11px;
    border-radius: 9px;
    padding: 0 5px;
    display: none;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: 0 0 10px rgba(255,0,102,0.4);
}
.chat-float-btn .badge.show {
    display: flex;
}

/* 聊天窗口 */
.chat-window {
    position: fixed;
    right: 20px;
    bottom: 88px;
    width: 360px;
    height: 500px;
    max-height: calc(100vh - 120px);
    background: rgba(16,16,45,0.95);
    border-radius: 16px;
    box-shadow: 0 0 40px rgba(0,240,255,0.1), 0 0 80px rgba(139,92,246,0.05);
    z-index: 9998;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(0,240,255,0.15);
    backdrop-filter: blur(20px);
}
.chat-window.show {
    display: flex;
    animation: chatSlideUp 0.25s ease;
}
@keyframes chatSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 聊天头部 */
.chat-header {
    padding: 14px 16px;
    background: linear-gradient(135deg, #00f0ff 0%, #8b5cf6 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.chat-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.chat-header-title {
    font-size: 15px;
    font-weight: 600;
}
.chat-header-subtitle {
    font-size: 11px;
    opacity: 0.85;
    margin-top: 2px;
}
.chat-header-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.2s;
}
.chat-header-close:hover {
    background: rgba(255,255,255,0.2);
}

/* 聊天消息区域 */
.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: rgba(5,5,15,0.5);
    scroll-behavior: smooth;
}
.chat-body::-webkit-scrollbar {
    width: 4px;
}
.chat-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #00f0ff, #8b5cf6);
    border-radius: 2px;
}

/* 系统提示 */
.chat-system-msg {
    text-align: center;
    color: #666699;
    font-size: 12px;
    padding: 8px 0;
}

/* 消息气泡 */
.chat-msg {
    display: flex;
    margin-bottom: 12px;
    animation: msgFadeIn 0.2s ease;
}
@keyframes msgFadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: translateY(0); }
}
.chat-msg.me {
    flex-direction: row-reverse;
}
.chat-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.chat-msg.me .chat-msg-avatar {
    background: linear-gradient(135deg, #00f0ff, #8b5cf6);
    color: #fff;
    margin-left: 8px;
    box-shadow: 0 0 8px rgba(0,240,255,0.2);
}
.chat-msg.other .chat-msg-avatar {
    background: rgba(0,240,255,0.08);
    color: #00f0ff;
    border: 1px solid rgba(0,240,255,0.15);
    margin-right: 8px;
}
.chat-msg-content {
    max-width: 70%;
}
.chat-msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.6;
    word-break: break-word;
    white-space: pre-wrap;
}
.chat-msg.me .chat-msg-bubble {
    background: linear-gradient(135deg, rgba(0,240,255,0.12), rgba(139,92,246,0.12));
    color: #e0e0ff;
    border: 1px solid rgba(0,240,255,0.2);
    border-bottom-right-radius: 4px;
}
.chat-msg.other .chat-msg-bubble {
    background: rgba(18,18,50,0.6);
    color: #c0c0e0;
    border: 1px solid rgba(0,240,255,0.08);
    border-bottom-left-radius: 4px;
}
.chat-msg-time {
    font-size: 11px;
    color: #555588;
    margin-top: 4px;
    text-align: right;
}
.chat-msg.me .chat-msg-time {
    text-align: left;
}

/* 底部输入区 */
.chat-footer {
    padding: 10px 12px;
    background: rgba(10,10,30,0.6);
    border-top: 1px solid rgba(0,240,255,0.08);
    flex-shrink: 0;
}
.chat-input-wrap {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.chat-input {
    flex: 1;
    border: 1px solid rgba(0,240,255,0.12);
    border-radius: 18px;
    padding: 8px 14px;
    font-size: 13px;
    resize: none;
    outline: none;
    max-height: 80px;
    min-height: 36px;
    line-height: 1.5;
    transition: all 0.3s;
    background: rgba(0,0,0,0.2);
    color: #e0e0ff;
}
.chat-input:focus {
    border-color: rgba(0,240,255,0.4);
    box-shadow: 0 0 10px rgba(0,240,255,0.1);
}
.chat-input::placeholder { color: #666699; }
.chat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00f0ff, #8b5cf6);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s;
    flex-shrink: 0;
}
.chat-send-btn:hover {
    box-shadow: 0 0 15px rgba(0,240,255,0.4);
    transform: scale(1.05);
}
.chat-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 连接状态 */
.chat-status-bar {
    padding: 4px 12px;
    font-size: 11px;
    text-align: center;
    background: rgba(255,200,0,0.08);
    color: #ffaa00;
    border-bottom: 1px solid rgba(255,200,0,0.15);
    flex-shrink: 0;
}
.chat-status-bar.connected {
    background: rgba(0,240,255,0.06);
    color: #00f0ff;
    border-color: rgba(0,240,255,0.12);
}
.chat-status-bar.error {
    background: rgba(255,0,102,0.08);
    color: #ff4488;
    border-color: rgba(255,0,102,0.15);
}

/* 昵称输入 */
.chat-nickname-wrap {
    padding: 20px;
    text-align: center;
}
.chat-nickname-wrap p {
    margin-bottom: 12px;
    color: #8888bb;
    font-size: 14px;
}
.chat-nickname-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid rgba(0,240,255,0.12);
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 12px;
    outline: none;
    background: rgba(0,0,0,0.25);
    color: #e0e0ff;
    transition: all 0.3s;
}
.chat-nickname-input:focus {
    border-color: #00f0ff;
    box-shadow: 0 0 10px rgba(0,240,255,0.15);
}
.chat-nickname-input::placeholder { color: #666699; }
.chat-nickname-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #00f0ff, #8b5cf6);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}
.chat-nickname-btn:hover {
    box-shadow: 0 0 20px rgba(0,240,255,0.3);
    transform: translateY(-1px);
}

/* 移动端适配 */
@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 20px);
        right: 10px;
        left: 10px;
        height: 65vh;
        bottom: 78px;
    }
}
