/* AI Chatbot Widget Styles */
#aicb-root {
    --aicb-primary: #2563eb;
    --aicb-bg: #ffffff;
    --aicb-text: #111827;
    --aicb-muted: #6b7280;
    --aicb-border: #e5e7eb;
    --aicb-bubble-user: #2563eb;
    --aicb-bubble-bot: #f3f4f6;
}

.aicb-launcher {
    position: fixed;
    bottom: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--aicb-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99998;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.aicb-launcher:hover {
    transform: scale(1.06);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.2);
}

.aicb-launcher svg { width: 28px; height: 28px; }

.aicb-pos-right { right: 24px; }
.aicb-pos-left  { left: 24px; }

.aicb-window {
    position: fixed;
    bottom: 100px;
    width: 370px;
    max-width: calc(100vw - 32px);
    height: 540px;
    max-height: calc(100vh - 130px);
    background: var(--aicb-bg);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--aicb-text);
    animation: aicbFadeIn 0.2s ease;
}

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

.aicb-header {
    background: var(--aicb-primary);
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.aicb-header-title { font-weight: 600; font-size: 16px; }
.aicb-header-sub   { font-size: 12px; opacity: 0.85; margin-top: 2px; }

.aicb-close {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    line-height: 0;
    border-radius: 6px;
    opacity: 0.85;
}
.aicb-close:hover { opacity: 1; background: rgba(255, 255, 255, 0.15); }

.aicb-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.aicb-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.aicb-msg-user {
    align-self: flex-end;
    background: var(--aicb-bubble-user);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.aicb-msg-bot {
    align-self: flex-start;
    background: var(--aicb-bubble-bot);
    color: var(--aicb-text);
    border-bottom-left-radius: 4px;
}

.aicb-msg-error {
    align-self: flex-start;
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-bottom-left-radius: 4px;
}

.aicb-typing {
    display: inline-flex;
    gap: 4px;
    padding: 4px 0;
}
.aicb-typing span {
    width: 7px;
    height: 7px;
    background: var(--aicb-muted);
    border-radius: 50%;
    animation: aicbBlink 1.2s infinite ease-in-out;
}
.aicb-typing span:nth-child(2) { animation-delay: 0.2s; }
.aicb-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes aicbBlink {
    0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
    40%           { opacity: 1; transform: translateY(-3px); }
}

.aicb-input-row {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--aicb-border);
    background: #fff;
}

.aicb-input {
    flex: 1;
    border: 1px solid var(--aicb-border);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
    resize: none;
    max-height: 120px;
    font-family: inherit;
}
.aicb-input:focus { border-color: var(--aicb-primary); }

.aicb-send {
    background: var(--aicb-primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0 14px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: opacity 0.15s ease;
}
.aicb-send:disabled { opacity: 0.5; cursor: not-allowed; }

.aicb-footer {
    text-align: center;
    font-size: 11px;
    color: var(--aicb-muted);
    padding: 6px;
    background: #fff;
    border-top: 1px solid var(--aicb-border);
}

@media (max-width: 480px) {
    .aicb-window {
        width: calc(100vw - 16px);
        height: calc(100vh - 100px);
        bottom: 90px;
    }
}
