/* ========== Chatbot Panel ========== */
.chatbot-panel {
    display: none;
    font-size: 0;
    background-color: var(--bg-card);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    width: 100%;
    height: 500px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    position: fixed;
    bottom: 20px;
    right: 1px;
    z-index: 2147483647;
    max-width: 400px;
    max-height: 80vh;
    flex-direction: column;
}

.chatbot-panel.visible {
    display: flex;
}

/* ========== Chatbot Header ========== */
.chatbot-header {
    width: 100%;
    box-sizing: border-box;
    background: var(--chat-header-bg);
    margin: 0;
    padding: 0 16px;
    font-size: 16px;
    color: var(--text-on-primary);
    line-height: 44px;
    font-weight: 600;
    height: 44px;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chatbot-header-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chatbot-close {
    cursor: pointer;
    font-size: 18px;
    color: var(--text-on-primary);
    background: none;
    border: none;
    padding: 4px 8px;
    line-height: 1;
    flex-shrink: 0;
}

/* ========== Chat Messages ========== */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: var(--chat-bg);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
}

.chat-message {
    margin: 10px 0;
}

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

.chat-message-user {
    text-align: right;
}

.chat-avatar {
    width: 36px;
    height: 36px;
    background: var(--chat-header-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-on-primary);
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}

.chat-bubble-group {
    flex: 1;
    min-width: 0;
}

.chat-sender-name {
    font-weight: bold;
    font-size: var(--fs-caption);
    margin-bottom: 4px;
    display: block;
    color: var(--text-secondary);
}

.chat-bubble {
    display: inline-block;
    max-width: 100%;
    word-break: break-word;
}

.chat-bubble-bot-text {
    background: var(--chat-bubble-bot);
    padding: 10px 14px;
    border-radius: 18px 18px 18px 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.chat-bubble-user-text {
    background: var(--chat-bubble-user);
    color: var(--text-on-primary);
    padding: 8px 14px;
    border-radius: 18px 18px 6px 18px;
}

.chat-image-bubble {
    background: var(--chat-bubble-user);
    color: var(--text-on-primary);
    padding: 8px 14px;
    border-radius: 18px 18px 6px 18px;
    display: inline-block;
}

.chat-system-msg {
    text-align: center;
    margin: 10px 0;
}

.chat-system-msg span {
    background: #eee;
    padding: 4px 12px;
    border-radius: var(--radius-lg);
    font-size: var(--fs-caption);
    color: #666;
}

/* ========== Chatbot Input ========== */
.chatbot-input-bar {
    display: flex;
    padding: 12px;
    background: var(--chat-input-bg);
    border-top: 1px solid #ffe3d6;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.chatbot-btn-upload {
    background: #f0e4db;
    border: none;
    border-radius: var(--radius-round);
    padding: 8px 14px;
    cursor: pointer;
    font-size: 16px;
    white-space: nowrap;
    transition: background 0.2s;
}

.chatbot-btn-upload:hover {
    background: #e8d5c8;
}

.chatbot-text-input {
    flex: 1;
    margin: 0;
    padding: 10px 14px;
    border: 1px solid var(--border-card);
    border-radius: var(--radius-round);
    background: var(--bg-card);
    font-size: 14px;
    min-width: 0;
}

.chatbot-btn-send {
    background: var(--chat-header-bg);
    color: var(--text-on-primary);
    border: none;
    padding: 8px 20px;
    border-radius: var(--radius-round);
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.chatbot-btn-send:hover {
    background: #1380d6;
}

/* ========== Platform Quick Bar ========== */
.chatbot-platform-bar {
    padding: 12px;
    background: var(--chat-input-bg);
    border-top: 1px solid #ffe3d6;
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.chatbot-platform-btn {
    flex: 1;
    color: var(--text-on-primary);
    border: none;
    border-radius: var(--radius-round);
    padding: 10px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
}

.chatbot-platform-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-xhs {
    background: linear-gradient(145deg, #ff5e7c, #ff3850);
}

.btn-bili {
    background: linear-gradient(145deg, #00a1d6, #0084b4);
}

/* ========== Responsive ========== */
@media (max-width: 428px) {
    .chatbot-panel {
        max-width: 100%;
        right: 0;
        bottom: 0;
        border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
        max-height: 90vh;
    }

    .chatbot-platform-btn {
        font-size: 13px;
        padding: 8px 6px;
    }
}
