/* ── Champion Chatbot Widget ── */

#cg-chatbot {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    line-height: 1.4;
}

/* ── Bubble button ── */
#cg-chatbot-bubble {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #25D366;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    float: right;
}
#cg-chatbot-bubble:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
}
.cg-bubble-label {
    position: absolute;
    right: 64px;
    background: #1a1a1a;
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
#cg-chatbot-bubble:hover .cg-bubble-label {
    opacity: 1;
}

/* ── Chat panel ── */
#cg-chatbot-panel {
    display: none;
    width: 360px;
    height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    overflow: hidden;
    flex-direction: column;
    margin-bottom: 12px;
}
#cg-chatbot.open #cg-chatbot-panel {
    display: flex;
}
#cg-chatbot.open #cg-chatbot-bubble {
    display: none;
}

/* ── Header ── */
#cg-chatbot-header {
    background: #1a1a1a;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.cg-header-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #cc0000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.cg-header-info {
    flex: 1;
    min-width: 0;
}
.cg-header-info strong {
    display: block;
    font-size: 14px;
}
.cg-header-info span {
    display: block;
    font-size: 11px;
    color: rgba(255,255,255,0.7);
}
#cg-chatbot-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
#cg-chatbot-close:hover {
    color: #fff;
}

/* ── Messages ── */
#cg-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f5f5f5;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.cg-message {
    display: flex;
    max-width: 85%;
}
.cg-bot-msg {
    align-self: flex-start;
}
.cg-user-msg {
    align-self: flex-end;
}
.cg-msg-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    word-wrap: break-word;
    line-height: 1.5;
}
.cg-bot-msg .cg-msg-bubble {
    background: #fff;
    color: #1a1a1a;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.cg-user-msg .cg-msg-bubble {
    background: #cc0000;
    color: #fff;
    border-bottom-right-radius: 4px;
}
/* Typing indicator */
.cg-typing .cg-msg-bubble {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 14px 18px;
}
.cg-typing .cg-msg-bubble span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #999;
    animation: cg-bounce 1.4s infinite ease-in-out;
}
.cg-typing .cg-msg-bubble span:nth-child(1) { animation-delay: 0s; }
.cg-typing .cg-msg-bubble span:nth-child(2) { animation-delay: 0.2s; }
.cg-typing .cg-msg-bubble span:nth-child(3) { animation-delay: 0.4s; }
@keyframes cg-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ── Input area ── */
#cg-chatbot-input-area {
    display: flex;
    padding: 10px 12px;
    border-top: 1px solid #eee;
    background: #fff;
    flex-shrink: 0;
    gap: 8px;
}
#cg-chatbot-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
#cg-chatbot-input:focus {
    border-color: #cc0000;
}
#cg-chatbot-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #cc0000;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}
#cg-chatbot-send:hover {
    background: #990000;
}
#cg-chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Footer / human handoff ── */
#cg-chatbot-footer {
    flex-shrink: 0;
    padding: 8px 12px;
    border-top: 1px solid #eee;
    background: #fafafa;
}
#cg-chatbot-human {
    width: 100%;
    padding: 8px;
    font-size: 12px;
    font-weight: 500;
    color: #25D366;
    background: none;
    border: 1px solid #25D366;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.2s, color 0.2s;
}
#cg-chatbot-human:hover {
    background: #25D366;
    color: #fff;
}

/* ── Mobile ── */
@media (max-width: 480px) {
    #cg-chatbot {
        bottom: 16px;
        right: 16px;
        left: 16px;
    }
    #cg-chatbot-panel {
        width: 100%;
        height: 80vh;
        border-radius: 12px;
    }
    .cg-bubble-label {
        display: none;
    }
}
