:root {
    --chat--color--primary: rgb(222, 0, 90);
    --chat--color--primary-shade-50: rgb(222, 0, 90);
    --chat--color--primary--shade-100: rgb(222, 0, 90);
    --chat--color--secondary: #eaeaea;
    --chat--color-secondary-shade-50: #1ca08a;
    --chat--color-white: #ffffff;
    --chat--color-light: #ffffff;
    --chat--color-light-shade-50: #e6e9f1;
    --chat--color-light-shade-100: #c2c5cc;
    --chat--color-medium: #d2d4d9;
    --chat--color-dark: rgb(222, 0, 90);
    --chat--color-disabled: #eee;
    --chat--color-typing: #404040;

    --chat--spacing: 20px;
    --chat--border-radius: 10px;
    --chat--transition-duration: 0.15s;

    --chat--window--width: 470px;
    --chat--window--height: 80vh;
    /* 80% van viewport hoogte */

    --chat--header-height: auto;
    --chat--header--padding: 15px 5px;
    --chat--header--background: var(--chat--color-dark);
    --chat--header--color: var(--chat--color-light);
    --chat--header--border-top: none;
    --chat--header--border-bottom: none;
    --chat--header--border-bottom: none;
    --chat--header--border-bottom: none;
    --chat--heading--font-size: 20px;
    --chat--header--color: var(--chat--color-light);
    --chat--subtitle--font-size: inherit;
    --chat--subtitle--line-height: 1.8;

    --chat--textarea--height: 50px;

    --chat--message--font-size: 14px;
    --chat--message--padding: var(--chat--spacing);
    --chat--message--border-radius: var(--chat--border-radius);
    --chat--message--line-height: 21px;
    --chat--message--bot--background: #eaeaea;
    --chat--message--bot--color: rgb(34, 34, 34);
    --chat--message--bot--border: none;
    --chat--message--user--background: var(--chat--color--primary);
    --chat--message--user--color: var(--chat--color-white);
    --chat--message--user--border: none;
    --chat--message--pre--background: rgba(0, 0, 0, 0.05);
    --chat--message--pre--link-color: #fdae2a;

    --chat--toggle--background: var(--chat--color--primary);
    --chat--toggle--hover--background: var(--chat--color--primary-shade-50);
    --chat--toggle--active--background: var(--chat--color--primary--shade-100);
    --chat--toggle--color: var(--chat--color-white);
    --chat--toggle--size: 64px;
    --chat--bg-image: url("/assets/img/chat.svg");
}

.btn-chatbot {
    display: none !important;
}

#n8n-chat-fake-toggle {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    height: 64px;
    width: auto;
    padding: 0 15px;
    gap: 10px;
    border-radius: 32px;
    background-color: var(--chat--toggle--background);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: background 0.15s;
}

.travelbase #n8n-chat-fake-toggle {
    bottom: 50px;
}

.chat-window-wrapper {
    bottom: 20px;
    left: 20px;
}

.travelbase .chat-window-wrapper {
    bottom: 50px;
}

.chat-window-wrapper .chat-window-toggle {
    margin-left: 0;
    margin-right: auto;
}

#n8n-chat-fake-toggle:hover {
    background: var(--chat--toggle--hover--background);
}

#n8n-chat-fake-toggle::before {
    content: "Chat";
    font-weight: 700;
    font-size: 16px;
    color: var(--chat--toggle--color);
    font-family: Arial, Helvetica, sans-serif;
}

#n8n-chat-fake-toggle::after {
    content: "";
    width: 32px;
    height: 30px;
    background-image: var(--chat--bg-image);
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

@media (max-width: 767px) {
    #n8n-chat-fake-toggle {
        display: none !important;
    }
}

.n8n-chat {
    font-family: Arial, Helvetica, sans-serif !important;

    .chat-window {
        border: 0;
        box-shadow: rgba(9, 14, 21, 0.5) 0px 5px 40px 0px;
        transform-origin: bottom left;
    }

    @media (max-width: 767px) {
        .chat-window {
            transform-origin: bottom right;
        }
    }

    h1 {
        font-weight: 400;
        margin: 0 0 0 1rem;
    }

    .chat-footer {
        border: 0;
    }

    .chat-inputs textarea,
    .chat-inputs button {
        background-color: #f4f7f9;
    }

    .chat-inputs button svg {
        color: #999;
    }

    .chat-inputs button:not(:disabled):hover svg {
        color: #666;
    }

    .chat-inputs button:disabled svg {
        color: #ddd;
    }

    .chat-messages-list {
        margin-top: 0;
    }

    /* Only the message list (.chat-body) should scroll. The .chat-layout
     * wrapper ships with overflow-y: auto, so when the footer grows tall
     * (the injected quick-action buttons wrap to multiple rows) the whole
     * layout overflows the fixed 80vh window and shows a redundant
     * scrollbar. Clip the layout and let the body shrink to absorb the
     * footer height instead of forcing that overflow. */
    .chat-layout {
        overflow: hidden;
    }

    .chat-body {
        min-height: 0;
    }

    .chat-message {
        max-width: 225px;
    }

    .chat-message-markdown ul,
    .chat-message-markdown ol {
        margin-bottom: 1rem;
        padding: 0 0 0 0.75rem;
        list-style-type: disc;
    }

    .chat-message-markdown ol {
        list-style-type: decimal;
    }

    .chat-message-markdown a {
        color: var(--chat--message--pre--link-color);
        text-decoration: none;
        font-weight: bold;
    }

    .chat-message-markdown a:hover {
        color: var(--chat--message--pre--link-color);
        text-decoration: underline;
        font-weight: bold;
    }

    .chat-messages-list .chat-message {
        max-width: 85%;
    }

    /* === CHAT BUTTON === */
    .chat-window-toggle {
        width: auto !important;
        padding: 0 15px !important;
        border-radius: 32px !important;
        gap: 10px;
    }

    /* Hide the default chat icon */
    .chat-window-toggle svg {
        display: none;
    }

    /* Add "Chat" text before the content */
    .chat-window-toggle::before {
        content: "Chat";
        font-weight: 700;
        font-size: 16px;
        color: white;
    }

    /* Add round operator image */
    .chat-window-toggle::after {
        content: "";
        width: 32px;
        height: 30px;
        background-image: var(--chat--bg-image);
        background-size: contain;
        background-position: center;
        /* border: 0px solid white; */
        flex-shrink: 0;
    }

    /* === BOT BERICHTEN MET AVATAR === */
    .chat-message.chat-message-from-bot {
        position: relative;
        margin-left: 44px !important;
        /* Ruimte voor avatar */
    }

    /* Operator avatar voor elk bot bericht */
    .chat-message.chat-message-from-bot::before {
        content: "";
        position: absolute;
        left: -44px;
        top: 0;
        width: 36px;
        height: 36px;
        background-image: var(--chat--bg-image);
        background-size: contain;
        background-position: center;
    }

    /* Verberg avatar bij typing indicator */
    .chat-message.chat-message-from-bot.chat-message-typing::before {
        display: none;
    }

    /* Typing indicator: alleen dots, geen achtergrond */
    .chat-message.chat-message-from-bot.chat-message-typing {
        background: transparent !important;
        border: none !important;
        padding: 20px 0 !important;
        margin-left: 0 !important;
    }

    .chat-message.chat-message-from-bot.chat-message-typing::before {
        display: none;
    }

    .chat-header {
        position: relative;
        padding: var(--chat--header--padding);
    }

    .custom-close-btn {
        position: absolute;
        right: 10px;
        background: transparent;
        border: none;
        color: var(--chat--header--color);
        font-size: 20px;
        cursor: pointer;
        width: 32px;
        height: 32px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background 0.2s;
    }

    .custom-close-btn:hover {
        background: rgba(255, 255, 255, 0.1);
    }
}

@media (max-width: 767px) {
    #n8n-chat .chat-window-toggle {
        display: none !important;
    }
}

.n8n-quick-actions,
.n8n-suggest-actions {
    padding: 10px 12px 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
    justify-content: flex-start;
    align-content: flex-start;
    text-align: left;
    margin: 0;
}

.n8n-quick-actions button,
.n8n-suggest-actions button {
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: #fff;
    color: #374151;
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    line-height: 1;
    margin: 0;
    display: inline-flex;
    align-self: flex-start;
    transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    transform 0.02s ease;
}

.n8n-quick-actions button:active,
.n8n-suggest-actions button:active {
    transform: translateY(1px);
}

.n8n-quick-actions button:disabled,
.n8n-suggest-actions button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.dark .n8n-quick-actions button,
.dark .n8n-suggest-actions button {
    background: #1f2937;
    color: #f9fafb;
    border-color: rgba(255, 255, 255, 0.2);
}

.dark .n8n-quick-actions button:hover,
.dark .n8n-suggest-actions button:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* === n8n-chat-cards / n8n-chat-expand plugin integration === */

/* Neutralize the plugin stylesheet's chat-window size override by
* redefining its CSS variables to match our existing widget sizes. */
:root {
    --n8n-chat-width: 470px;
    --n8n-chat-height: 80vh;
}

/* Brand the card accents to match --chat--color--primary. */
:root {
    --n8n-card-accent: rgb(0, 142, 255);
    --n8n-card-accent-hover: rgb(0, 120, 220);
}

/* Style the expand toggle to match the custom close button so the two
* header buttons look like a pair. Plugin injects its own low-key rules
* via a runtime <style> tag — we beat them on specificity (id + 2 classes). */
#n8n-chat .chat-header .n8n-chat-expand-toggle {
    position: absolute;
    right: 48px;
    background: transparent;
    border: none;
    color: var(--chat--header--color);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    padding: 0;
    opacity: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#n8n-chat .chat-header .n8n-chat-expand-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    opacity: 1;
}

/* Hide expand toggle on mobile — an innerWidth/3 panel is unusable
* on phones, and the widget is effectively full-screen there already. */
@media (max-width: 767px) {
    .n8n-chat-expand-toggle {
        display: none !important;
    }
}

/* Expand animation. The plugin's animate() now just toggles
* .n8n-chat-expanded on .chat-window-wrapper; everything visual is CSS.
* Transitions live on the chat-window (the actual popup) so the panel
* appears to grow from its bottom-left corner without moving. The
* wrapper itself is a full-viewport flex overlay and is never touched. */
#n8n-chat .chat-window-wrapper .chat-window {
    transition:
    width 400ms cubic-bezier(0.4, 0, 0.2, 1),
    max-width 400ms cubic-bezier(0.4, 0, 0.2, 1),
    height 400ms cubic-bezier(0.4, 0, 0.2, 1),
    max-height 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

#n8n-chat .chat-window-wrapper.n8n-chat-expanded .chat-window {
    width: 33vw !important;
    max-width: 33vw !important;
    height: calc(100vh - 40px) !important;
    max-height: calc(100vh - 40px) !important;
}