#andbot-chat-root {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.andbot-chat {
    position: relative;
    width: 320px;
    max-width: calc(100vw - 32px);
    color: #1c1c1c;
    --andbot-accent-start: #4c6ef5;
    --andbot-accent-end: #7b5bff;
    --andbot-accent-solid: #4c6ef5;
}

.andbot-chat__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, var(--andbot-accent-start), var(--andbot-accent-end));
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(76, 110, 245, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
}

.andbot-chat__toggle:hover,
.andbot-chat__toggle:focus {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(76, 110, 245, 0.45);
}

.andbot-chat__panel {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 100%;
    max-height: 480px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.35);
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.andbot-chat[data-open="true"] .andbot-chat__panel {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.andbot-chat__header {
    padding: 16px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.andbot-chat__title {
    font-size: 15px;
    font-weight: 600;
}

.andbot-chat__close {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 18px;
    color: #4b5563;
}

.andbot-chat__messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f8fafc;
}

.andbot-chat__message {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    background: #fff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.andbot-chat__message--user {
    background: #000;
    color: #fff;
    margin-left: 40px;
}

.andbot-chat__message--bot {
    margin-right: 40px;
}

.andbot-chat__message--error {
    border: 1px solid rgba(239, 68, 68, 0.4);
    background: rgba(254, 226, 226, 0.7);
    color: #b91c1c;
}

.andbot-chat__message--no-knowledge {
    border: 1px solid rgba(245, 158, 11, 0.4);
    background: rgba(255, 247, 237, 0.9);
    color: #92400e;
}

.andbot-chat__sources {
    margin-top: 8px;
    padding-left: 16px;
    font-size: 13px;
}

.andbot-chat__sources li {
    margin-bottom: 4px;
}

.andbot-chat__sources a {
    color: #2563eb;
    text-decoration: none;
}

.andbot-chat__sources a:hover {
    text-decoration: underline;
}

.andbot-chat__form {
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    padding: 12px 16px 0px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.andbot-chat__textarea {
    width: 100%;
    min-height: 64px;
    max-height: 120px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.2);
    font-size: 14px;
    resize: vertical;
    box-sizing: border-box;
    max-width: 100%;
}

.andbot-chat__submit {
    align-self: flex-end;
    padding: 10px 20px;
    border-radius: 999px;
    border: none;
    background: var(--andbot-accent-solid);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.andbot-chat__submit[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.andbot-chat__status {
    font-size: 12px;
    color: #6b7280;
    min-height: 16px;
    padding: 0 16px 0px;
}

.andbot-chat__retry {
    margin-top: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    border: none;
    background: #ef4444;
    color: #fff;
    cursor: pointer;
    font-size: 12px;
}

@media (max-width: 768px) {
    #andbot-chat-root {
        right: 16px;
        left: 16px;
        bottom: 16px;
        width: auto;
    }

    .andbot-chat {
        width: 100%;
        max-width: none;
    }

    .andbot-chat__panel {
        position: fixed;
        right: 16px;
        left: 16px;
        bottom: 100px;
        width: auto;
        max-width: none;
        max-height: 70vh;
    }
}
