/* Chatboat Widget Styles */
:root {
    --cb-primary: #2563eb;
    --cb-primary-dark: #1d4ed8;
    --cb-radius: 16px;
    --cb-shadow: 0 20px 60px rgba(0,0,0,.18);
}

#chatboat-root {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    z-index: 999999;
}

/* Toggle button */
#cb-toggle {
    position: fixed;
    bottom: 24px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--cb-primary);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(37,99,235,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s, background .2s;
    z-index: 999999;
}

#cb-toggle:hover { background: var(--cb-primary-dark); transform: scale(1.08); }
#cb-toggle svg { width: 26px; height: 26px; }

/* Chat window */
#cb-window {
    position: fixed;
    bottom: 96px;
    width: 370px;
    max-height: 560px;
    background: #fff;
    border-radius: var(--cb-radius);
    box-shadow: var(--cb-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 999998;
    transition: opacity .2s, transform .2s;
}

#cb-window.cb-right { right: 24px; }
#cb-window.cb-left  { left: 24px;  }
#cb-toggle.cb-right { right: 24px; }
#cb-toggle.cb-left  { left: 24px;  }

#cb-window.cb-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(16px);
}

/* Header */
#cb-header {
    padding: 16px 20px;
    background: var(--cb-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cb-header-info { display: flex; align-items: center; gap: 10px; }
.cb-avatar {
    width: 36px; height: 36px;
    background: rgba(255,255,255,.2);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}

.cb-name { font-weight: 600; font-size: 15px; }
.cb-status { font-size: 11px; opacity: .8; }

#cb-close {
    background: none; border: none; color: white;
    cursor: pointer; font-size: 20px; line-height: 1;
    opacity: .7; transition: opacity .15s;
    padding: 4px;
}
#cb-close:hover { opacity: 1; }

/* Messages */
#cb-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.cb-msg {
    display: flex;
    flex-direction: column;
    max-width: 88%;
    animation: cbFadeIn .2s ease;
}

.cb-msg.cb-bot { align-self: flex-start; }
.cb-msg.cb-user { align-self: flex-end; }

.cb-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.cb-bot .cb-bubble {
    background: #f1f5f9;
    color: #1e293b;
    border-bottom-left-radius: 4px;
}

.cb-user .cb-bubble {
    background: var(--cb-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

/* Links */
.cb-links {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cb-link-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    text-decoration: none;
    color: #1e293b;
    font-size: 13px;
    transition: background .15s, border-color .15s;
}

.cb-link-item:hover {
    background: #f8fafc;
    border-color: var(--cb-primary);
    color: var(--cb-primary);
    text-decoration: none;
}

.cb-link-icon { font-size: 14px; flex-shrink: 0; }
.cb-link-title { flex: 1; font-weight: 500; }
.cb-link-arrow { color: #94a3b8; font-size: 12px; }

/* Typing indicator */
.cb-typing .cb-bubble {
    display: flex;
    gap: 4px;
    padding: 12px 14px;
}

.cb-dot {
    width: 7px; height: 7px;
    background: #94a3b8;
    border-radius: 50%;
    animation: cbBounce 1.2s infinite;
}
.cb-dot:nth-child(2) { animation-delay: .2s; }
.cb-dot:nth-child(3) { animation-delay: .4s; }

/* Input area */
#cb-input-area {
    padding: 12px 14px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

#cb-input {
    flex: 1;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 14px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    max-height: 100px;
    transition: border-color .15s;
    outline: none;
    background: #f8fafc;
}

#cb-input:focus { border-color: var(--cb-primary); background: white; }

#cb-send {
    width: 40px; height: 40px;
    border: none;
    border-radius: 10px;
    background: var(--cb-primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s, transform .1s;
}

#cb-send:hover { background: var(--cb-primary-dark); }
#cb-send:active { transform: scale(.95); }
#cb-send:disabled { background: #cbd5e1; cursor: not-allowed; }
#cb-send svg { width: 17px; height: 17px; }

/* Branding */
#cb-branding {
    text-align: center;
    padding: 6px;
    font-size: 11px;
    color: #94a3b8;
    border-top: 1px solid #f1f5f9;
}
#cb-branding a { color: #94a3b8; text-decoration: none; }
#cb-branding a:hover { color: var(--cb-primary); }

/* Notification badge */
#cb-badge {
    position: absolute;
    top: -3px; right: -3px;
    width: 18px; height: 18px;
    background: #ef4444;
    border-radius: 50%;
    font-size: 10px;
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    display: none;
}

@keyframes cbFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes cbBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30%           { transform: translateY(-5px); }
}

@media (max-width: 420px) {
    #cb-window {
        width: calc(100vw - 24px);
        right: 12px !important;
        left: 12px !important;
    }
}
