/* ============================================================
   Business Assistant Chat Widget
   ============================================================ */

/* ---- Toggle button ---- */
#cb-toggle-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10001;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #673ab7;
    color: #fff;
    border: none;
    box-shadow: 0 4px 16px rgba(103, 58, 183, 0.45);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#cb-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(103, 58, 183, 0.55);
}

#cb-toggle-btn:active {
    transform: scale(0.97);
}

/* ---- Panel ---- */
#chatbot-widget {
    position: fixed;
    bottom: 88px;
    right: 24px;
    z-index: 10000;
    width: 360px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    background: #fff;
    display: flex;
    flex-direction: column;
    animation: cb-slide-in 0.25s ease;
}

@keyframes cb-slide-in {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0);    }
}

/* ---- Header ---- */
#cb-header {
    background: #673ab7;
    color: #fff;
    padding: 13px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.cb-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cb-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: 1rem;
    flex-shrink: 0;
}

.cb-title {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.2;
}

.cb-subtitle {
    font-size: 0.72rem;
    opacity: 0.8;
    line-height: 1.2;
}

#cb-clear-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 0.8rem;
    transition: color 0.15s, background 0.15s;
}

#cb-clear-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

/* ---- Messages area ---- */
#cb-messages {
    flex: 1;
    max-height: 340px;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

#cb-messages::-webkit-scrollbar {
    width: 4px;
}
#cb-messages::-webkit-scrollbar-thumb {
    background: #d1c4e9;
    border-radius: 4px;
}

/* ---- Message bubbles ---- */
.cb-msg {
    max-width: 85%;
    padding: 9px 14px;
    font-size: 0.855rem;
    line-height: 1.5;
    word-break: break-word;
}

.cb-msg--user {
    align-self: flex-end;
    background: #673ab7;
    color: #fff;
    border-radius: 16px 16px 4px 16px;
}

.cb-msg--assistant {
    align-self: flex-start;
    background: #f3f0fa;
    color: #212121;
    border-radius: 16px 16px 16px 4px;
}

.cb-msg--system {
    align-self: center;
    background: #fff8e1;
    color: #7c5e00;
    border-radius: 8px;
    font-size: 0.78rem;
    padding: 6px 12px;
    text-align: center;
    max-width: 95%;
}

/* ---- Typing indicator ---- */
.cb-typing {
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 14px;
    background: #f3f0fa;
    border-radius: 16px 16px 16px 4px;
}

.cb-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9575cd;
    display: inline-block;
    animation: cb-bounce 1.2s infinite ease-in-out;
}

.cb-typing span:nth-child(2) { animation-delay: 0.2s; }
.cb-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes cb-bounce {
    0%, 80%, 100% { transform: translateY(0);    opacity: 0.5; }
    40%            { transform: translateY(-5px); opacity: 1;   }
}

/* ---- Suggestion chips row ---- */
.cb-suggestions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 12px 10px;
    animation: cb-slide-in 0.2s ease;
}

.cb-suggestion {
    background: #ede7f6;
    color: #512da8;
    border: 1px solid #ce93d8;
    border-radius: 20px;
    font-size: 0.76rem;
    padding: 4px 12px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.cb-suggestion:hover {
    background: #673ab7;
    color: #fff;
    border-color: #673ab7;
}

/* ---- Input area ---- */
#cb-input-area {
    border-top: 1px solid #ede7f6;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    flex-shrink: 0;
    background: #fff;
}

#cb-input {
    flex: 1;
    border: none;
    resize: none;
    font-size: 0.875rem;
    outline: none;
    line-height: 1.4;
    max-height: 80px;
    overflow-y: auto;
    font-family: inherit;
    color: #212121;
}

#cb-input::placeholder {
    color: #bbb;
}

#cb-send-btn {
    background: #673ab7;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.1s;
}

#cb-send-btn:hover  { background: #512da8; }
#cb-send-btn:active { transform: scale(0.92); }
#cb-send-btn:disabled {
    background: #d1c4e9;
    cursor: not-allowed;
}

/* ---- Mobile ---- */
@media (max-width: 480px) {
    #chatbot-widget {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 82px;
    }
    #cb-toggle-btn {
        bottom: 16px;
        right: 16px;
    }
}
