/* ===== 浮动客服窗口样式 ===== */
.chat-widget-btn {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1B3A5C 0%, #0F2538 100%);
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s, box-shadow 0.3s, opacity 0.3s;
}
.chat-widget-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}
.chat-widget-btn:active {
    transform: scale(0.95);
}
.chat-widget-btn.hidden {
    display: none !important;
}

.chat-panel {
    position: fixed;
    bottom: 88px;
    right: 20px;
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 480px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    z-index: 9998;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.chat-panel.show {
    display: flex;
}

.chat-header {
    background: linear-gradient(135deg, #1B3A5C 0%, #0F2538 100%);
    color: white;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.chat-header-title {
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.chat-header-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}
.chat-header-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #F7F5F0;
}
.chat-message {
    margin-bottom: 12px;
    display: flex;
    animation: chatFadeIn 0.3s ease;
}
@keyframes chatFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.chat-message.user {
    justify-content: flex-end;
}
.chat-message.bot {
    justify-content: flex-start;
}
.chat-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}
.chat-message.user .chat-bubble {
    background: #1B3A5C;
    color: white;
    border-bottom-right-radius: 4px;
}
.chat-message.bot .chat-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.chat-message-time {
    font-size: 10px;
    color: #999;
    margin-top: 4px;
    text-align: right;
}
.chat-message.bot .chat-message-time {
    text-align: left;
}

.chat-typing {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    font-size: 12px;
    color: #999;
}
.chat-typing.show {
    display: flex;
}
.chat-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #999;
    animation: typingBounce 1.4s infinite ease-in-out;
}
.chat-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

.chat-input-area {
    padding: 10px 12px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
}
.chat-input {
    flex: 1;
    border: 1px solid #e0dcd6;
    border-radius: 20px;
    padding: 10px 14px;
    font-size: 14px;
    resize: none;
    outline: none;
    font-family: inherit;
    max-height: 80px;
    min-height: 40px;
}
.chat-input:focus {
    border-color: #1B3A5C;
}
.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1B3A5C;
    color: white;
    border: none;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.chat-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.chat-welcome {
    text-align: center;
    padding: 16px 8px;
    color: #999;
    font-size: 13px;
}

/* 手机端适配 */
@media (max-width: 480px) {
    .chat-panel {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    .chat-widget-btn {
        bottom: 100px;
        right: 16px;
    }
}
