/* === Floating Chat Widget === */
.rc-chat-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2147483647;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--rc-primary, #2563eb);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.35);
    transition: transform .2s, box-shadow .2s;
}
.rc-chat-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(37, 99, 235, 0.45);
}
.rc-chat-bubble:active {
    transform: scale(0.95);
}

/* === Chat Panel === */
.rc-chat-panel {
    position: fixed;
    bottom: 96px;
    right: 24px;
    z-index: 2147483646;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 560px;
    max-height: calc(100vh - 140px);
    background: var(--rc-surface, #fff);
    border: 1px solid var(--rc-border-soft, #e2e8f0);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
}
.rc-chat-panel.is-open {
    display: flex;
}

/* Header */
.rc-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--rc-primary, #2563eb);
    color: #fff;
    flex-shrink: 0;
}
.rc-chat-header-title {
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}
.rc-chat-header-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background .15s;
}
.rc-chat-header-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* Messages area */
.rc-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
}
.rc-chat-msg {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 0;
    font-size: 0.88rem;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.rc-chat-msg--user {
    align-self: flex-end;
    background: var(--rc-primary, #2563eb);
    color: #fff;
}
.rc-chat-msg--assistant {
    align-self: flex-start;
    background: #fff;
    color: var(--rc-text, #1e293b);
    border: 1px solid var(--rc-border-soft, #e2e8f0);
}
.rc-chat-msg--typing {
    align-self: flex-start;
    background: #fff;
    border: 1px solid var(--rc-border-soft, #e2e8f0);
    color: var(--rc-text-muted, #64748b);
    font-style: italic;
    font-size: 0.85rem;
}
.rc-chat-msg--error {
    align-self: flex-start;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    font-size: 0.83rem;
}

/* Input area */
.rc-chat-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--rc-border-soft, #e2e8f0);
    background: #fff;
    flex-shrink: 0;
}
.rc-chat-input {
    flex: 1;
    border: 1px solid var(--rc-border-soft, #e2e8f0);
    padding: 9px 12px;
    font-size: 0.88rem;
    font-family: inherit;
    resize: none;
    outline: none;
    min-height: 40px;
    max-height: 120px;
    transition: border-color .15s;
}
.rc-chat-input:focus {
    border-color: var(--rc-primary, #2563eb);
}
.rc-chat-send {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 0;
    background: var(--rc-primary, #2563eb);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: background .15s;
}
.rc-chat-send:hover {
    background: var(--rc-primary-hover, #1d4ed8);
}
.rc-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 480px) {
    .rc-chat-panel {
        bottom: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border: none;
    }
    .rc-chat-bubble {
        bottom: 16px;
        right: 16px;
    }
}
