:host,
#kontext-chatbot-react-root,
.chatbot-widget-wrapper,
* {
    --kontext-color-bg-ai-icon: transparent;
    --kontext-color-primary-dark: #355f1f;
    --kontext-color-primary-blue: #5c8f2b;
    --kontext-color-primary-blue-hover: #4a7522;
    --kontext-color-text-primary: #1e293b;
    --kontext-color-border-purple: #5c8f2b;
    --kontext-color-border-purple-hover: #4a7522;
    --kontext-color-text-code: #4f7f2a;
    --kontext-font-family-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --kontext-font-family-mono: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace;
    --kontext-color-bg-typing: transparent;
    --kontext-predefined-question-btn-font-size: 1rem;

    --kontext-spacing: 0.25rem;
    --kontext-radius-2xl: 1.125rem;
    --kontext-radius-3xl: 1.875rem;
    --kontext-color-text-white: #ffffff;
    --kontext-color-hover-bg-light: #f3f8ed;
    --kontext-color-hover-bg-lighter: #edf5e4;
    --kontext-color-border-input-focus: #cbd5e1;
    --kontext-transition-fast: all 0.2s;
}

/* Header */
.chatbot-widget-title {
    color: #4f7f2a !important;
    font-size: 1.25rem !important;
    font-weight: 500 !important;
    letter-spacing: 0 !important;
}

.chatbot-widget-header-left {
    align-items: center !important;
    gap: 0.5rem !important;
}

.chatbot-widget-logo {
    width: 2rem !important;
    height: 2rem !important;
}

.chatbot-widget-logo img {
    height: auto !important;
}

.chatbot-widget-container.chatbot-widget-maximized .chatbot-widget-title {
    font-size: 1.5rem !important;
}

/* Messages area */
.chatbot-messages {
    background-color: #f8faf7 !important;
    background-image: none !important;
}

/* User bubble */
.bubble-user {
    background-color: #4f7f2a !important;
    color: #fff !important;
}

/* AI message */
.message-ai .message-content {
    background-color: #ffffff !important;
    border: 1px solid #e1e9d9 !important;
    border-radius: var(--kontext-radius-2xl) !important;
    padding-inline: calc(var(--kontext-spacing) * 4) !important;
    padding-block: calc(var(--kontext-spacing) * 1.5) !important;
}

/* AI icon */
.ai-icon {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    width: 1.75rem !important;
    height: 1.75rem !important;
}

.ai-icon .ai-icon-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
}

/* Predefined questions */
.predefined-question-btn {
    background-color: #fff !important;
    border: 1px solid #d4dfc8 !important;
    color: #355f1f !important;
}

.predefined-question-btn:hover {
    background-color: #f3f8ed !important;
    border-color: #4f7f2a !important;
    color: #4f7f2a !important;
}

/* Input */
.chatbot-input-container {
    border-top: 1px solid #dde5d6 !important;
    background: #fff !important;
}

.chatbot-input-container input,
.chatbot-input-container textarea {
    border-color: #dfe7d7 !important;
}

.chatbot-input-container input:focus,
.chatbot-input-container textarea:focus {
    border-color: #5c8f2b !important;
    outline-color: #5c8f2b !important;
}

/* Send button */
.chatbot-send-button {
    background-color: #4f7f2a !important;
    color: #fff !important;
}

.chatbot-send-button:hover:not(:disabled) {
    background-color: #5c8f2b !important;
}

/* Links */
.message-ai .message-content a,
.message-ai .message-content a:visited {
    color: #4f7f2a !important;
}

.message-ai .message-content a:hover {
    color: #355f1f !important;
}

/* Widget button */
.chatbot-widget-button {
    border: none !important;
    border-radius: 50% !important;
}

/* Bubble message */
.chatbot-widget-button-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.chatbot-widget-bubble {
    position: absolute;
    bottom: 100%;
    right: 50%;
    transform: translateX(calc(50% - 30px));
    margin-bottom: 1.25rem;
    width: auto;
    min-width: 200px;
    max-width: 320px;
    height: auto;
    background-color: var(--kontext-color-bg-white);
    border: 2px solid var(--kontext-color-primary-blue);
    border-radius: var(--kontext-radius-2xl);
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
}

.chatbot-widget-bubble::before {
    content: '';
    position: absolute;
    bottom: -10px;
    left: calc(50% + 30px);
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid var(--kontext-color-primary-blue);
}

.chatbot-widget-bubble::after {
    content: '';
    position: absolute;
    bottom: -7px;
    left: calc(50% + 30px);
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid var(--kontext-color-bg-white);
    z-index: 1;
}

.chatbot-widget-bubble-text {
    font-family: var(--kontext-font-family-base);
    font-size: 1rem;
    color: var(--kontext-color-text-primary);
    font-weight: 600;
    text-align: center;
    max-width: 280px;
    line-height: 1.3;
    white-space: pre-wrap;
}

/* Widget button position - higher up and slightly left */
.chatbot-widget-wrapper:has(.chatbot-widget-button-container) {
    bottom: calc(1.25rem + 70px) !important;
}

/* Widget container position */
.chatbot-widget-wrapper:has(.chatbot-widget-container) {
    bottom: 1.25rem !important;
    right: 5.5rem !important;
}

/* Desktop positioning */
@media (min-width: 769px) {
    .chatbot-widget-wrapper:has(.chatbot-widget-button-container) {
        right: auto !important;
        left: calc(100vw - 6.25rem - 3.75rem) !important;
    }

    .chatbot-widget-wrapper:has(.chatbot-widget-container.chatbot-widget-maximized) {
        right: 1.25rem !important;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .chatbot-widget-bubble {
        right: 0;
        transform: translateX(0);
        margin-right: 0;
        max-width: calc(100vw - 90px);
    }

    .chatbot-widget-bubble::before {
        left: auto;
        right: 25px;
        transform: translateX(0);
    }

    .chatbot-widget-bubble::after {
        left: auto;
        right: 25px;
        transform: translateX(0);
    }
}
