/* BM Tools — Chatbot widget. Kleur via --bmtc-color (uit de instellingen). */

.bmtc-root {
    --bmtc-color: #1a56db;
    --bmtc-on-color: #fff;
    --bmtc-bg: #fff;
    --bmtc-text: #1f2937;
    --bmtc-muted: #6b7280;
    --bmtc-line: #e5e7eb;
    --bmtc-soft: #f3f4f6;
    --bmtc-side: 20px;
    --bmtc-bottom: 20px;
    position: fixed;
    bottom: var(--bmtc-bottom);
    z-index: 99990;
    font: inherit;
    font-size: 14px;
    line-height: 1.5;
    color: var(--bmtc-text);
}
.bmtc-root *, .bmtc-root *::before, .bmtc-root *::after { box-sizing: border-box; }
.bmtc-right { right: var(--bmtc-side); }
.bmtc-left { left: var(--bmtc-side); }

/* Knop */
.bmtc-launcher {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 42px;
    padding: 0 18px 0 6px;
    border: 0;
    border-radius: 0;
    background: var(--bmtc-color);
    color: var(--bmtc-on-color);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
    transition: background-color .15s ease;
}
.bmtc-launcher:hover { background: color-mix(in srgb, var(--bmtc-color) 85%, #000); }
.bmtc-launcher:focus-visible, .bmtc-root button:focus-visible, .bmtc-input:focus-visible, .bmtc-log:focus-visible {
    outline: 3px solid var(--bmtc-color);
    outline-offset: 2px;
}
.bmtc-launcher:focus-visible { outline-color: var(--bmtc-text); }
.bmtc-root.is-open .bmtc-launcher { display: none; }

.bmtc-launcher-avatar, .bmtc-head-avatar {
    width: 34px;
    height: 34px;
    border-radius: 0;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255, 255, 255, .2);
}
.bmtc-launcher-avatar { width: 30px; height: 30px; }

/* Pulse: een paar zachte ringen na het laden */
.bmtc-launcher { position: relative; }
.bmtc-launcher.is-pulse::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 2px solid var(--bmtc-color);
    pointer-events: none;
    animation: bmtc-pulse 1.6s ease-out 1s 3;
    opacity: 0;
}
@keyframes bmtc-pulse { 0% { opacity: .7; transform: scale(1); } 100% { opacity: 0; transform: scale(1.6); } }

/* Uitnodigend tekstje naast de knop */
.bmtc-teaser {
    position: absolute;
    bottom: 0;
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid var(--bmtc-line);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .14);
    white-space: nowrap;
    animation: bmtc-teaser-in .3s ease-out;
}
.bmtc-right .bmtc-teaser { right: calc(100% + 10px); }
.bmtc-left .bmtc-teaser { left: calc(100% + 10px); }
.bmtc-teaser-text {
    border: 0;
    background: transparent;
    padding: 0 6px 0 14px;
    height: 40px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--bmtc-text);
    cursor: pointer;
}
.bmtc-teaser-close { width: 30px; height: 40px; color: var(--bmtc-muted); }
.bmtc-teaser-close svg { width: 14px; height: 14px; }
@keyframes bmtc-teaser-in { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: none; } }
.bmtc-launcher--icon { width: 42px; padding: 0; justify-content: center; }
.bmtc-launcher--icon svg { width: 26px; height: 26px; display: block; }
.bmtc-avatar-icon { display: inline-flex; align-items: center; justify-content: center; }
.bmtc-avatar-icon svg { width: 20px; height: 20px; }

/* Venster */
.bmtc-panel {
    width: 380px;
    max-width: calc(100vw - 40px);
    height: min(600px, calc(100vh - 40px));
    display: flex;
    flex-direction: column;
    background: var(--bmtc-bg);
    border-radius: 0;
    overflow: hidden;
}
.bmtc-panel[hidden] { display: none; }
.bmtc-root::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: rgba(0, 0, 0, .5);
    -webkit-backdrop-filter: blur(1px);
    backdrop-filter: blur(1px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .25s ease, visibility 0s linear .25s;
}
.bmtc-root.is-open::before {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity .25s ease, visibility 0s;
}
/* Geminimaliseerd: alleen de knop, het gesprek blijft bewaard */
.bmtc-panel.is-min { display: none; }

.bmtc-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 10px 12px 14px;
    background: var(--bmtc-color);
    color: var(--bmtc-on-color);
}
.bmtc-head-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bmtc-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
}
.bmtc-icon svg { width: 20px; height: 20px; }
.bmtc-head .bmtc-icon:hover { background: rgba(255, 255, 255, .18); }

/* Berichten */
.bmtc-log {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fafafa;
    overscroll-behavior: contain;
}
.bmtc-msg { display: flex; flex-direction: column; max-width: 88%; }
.bmtc-user { align-self: flex-end; align-items: flex-end; }
.bmtc-bot { align-self: flex-start; }
.bmtc-bubble {
    padding: 10px 13px;
    border-radius: 0;
    background: var(--bmtc-bg);
    border: 1px solid var(--bmtc-line);
    overflow-wrap: anywhere;
}
.bmtc-user .bmtc-bubble { background: var(--bmtc-color); color: var(--bmtc-on-color); border-color: transparent; white-space: pre-wrap; }
.bmtc-bot.is-error .bmtc-bubble { border-color: #fca5a5; background: #fef2f2; }
.bmtc-msg { min-width: 0; }
/* Thema-stijlen voor tekst en lijsten neutraliseren binnen de chat */
.bmtc-root .bmtc-bubble,
.bmtc-root .bmtc-bubble p,
.bmtc-root .bmtc-bubble li { font-size: 14px; line-height: 1.5; color: inherit; font-family: inherit; letter-spacing: normal; }
.bmtc-root .bmtc-user .bmtc-bubble { color: var(--bmtc-on-color); }
.bmtc-root .bmtc-bubble p { margin: 0 0 8px; padding: 0; }
.bmtc-root .bmtc-bubble p:last-child { margin-bottom: 0; }
.bmtc-root .bmtc-bubble ul,
.bmtc-root .bmtc-bubble ol { margin: 4px 0 8px; padding: 0 0 0 20px; }
.bmtc-root .bmtc-bubble ul { list-style: disc outside; }
.bmtc-root .bmtc-bubble ol { list-style: decimal outside; }
.bmtc-root .bmtc-bubble li { display: list-item; list-style: inherit; margin: 2px 0; padding: 0; }
.bmtc-root .bmtc-bubble li::before { content: none; }
.bmtc-root .bmtc-bubble a { color: var(--bmtc-color); text-decoration: underline; }

.bmtc-sources { margin-top: 12px; font-size: 13px; color: var(--bmtc-muted); display: flex; flex-direction: column; gap: 3px; width: 100%; min-width: 0; }
.bmtc-root .bmtc-sources a {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--bmtc-color);
    font-size: 13px;
}

.bmtc-retry {
    margin-top: 6px;
    align-self: flex-start;
    border: 1px solid var(--bmtc-line);
    background: var(--bmtc-bg);
    border-radius: 0;
    padding: 4px 10px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.bmtc-starts { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.bmtc-start {
    border: 1px solid var(--bmtc-color);
    color: var(--bmtc-color);
    background: var(--bmtc-bg);
    border-radius: 0;
    padding: 7px 12px;
    font: inherit;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}
.bmtc-start:hover { background: var(--bmtc-soft); }

/* Typindicator */
.bmtc-typing .bmtc-bubble { display: inline-flex; gap: 4px; align-items: center; padding: 12px 14px; }
.bmtc-typing .bmtc-bubble > span:not(.bmtc-sr) {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--bmtc-muted);
    animation: bmtc-dot 1.2s infinite ease-in-out;
}
.bmtc-typing .bmtc-bubble > span:nth-child(2) { animation-delay: .15s; }
.bmtc-typing .bmtc-bubble > span:nth-child(3) { animation-delay: .3s; }
@keyframes bmtc-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* Invoer */
.bmtc-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 6px; border-top: 1px solid var(--bmtc-line); background: var(--bmtc-bg); }
.bmtc-input {
    flex: 1;
    resize: none;
    height: 40px;
    min-height: 40px;
    max-height: 120px;
    padding: 9px 12px;
    border: 1px solid var(--bmtc-line);
    border-radius: 0;
    font: inherit;
    font-size: 16px; /* voorkomt inzoomen op iOS */
    line-height: 1.4;
    color: var(--bmtc-text);
    background: var(--bmtc-bg);
    overflow-y: hidden;
}
.bmtc-input::placeholder { font-size: 13px; }
.bmtc-send { background: var(--bmtc-color); color: var(--bmtc-on-color); width: 40px; height: 40px; flex-shrink: 0; }
.bmtc-send:disabled { opacity: .5; cursor: default; }
.bmtc-counter { padding: 0 14px; font-size: 12px; color: var(--bmtc-muted); text-align: right; }
.bmtc-disclaimer { padding: 2px 14px 10px; font-size: 11.5px; color: var(--bmtc-muted); background: var(--bmtc-bg); }
.bmtc-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.bmtc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Mobiel: volledig scherm */
@media (max-width: 600px) {
    .bmtc-root.is-open { inset: 0; bottom: 0; }
    .bmtc-root.is-open .bmtc-panel { width: 100%; max-width: none; height: 100vh; height: 100dvh; border-radius: 0; }
    .bmtc-panel.is-min { width: auto; border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .bmtc-launcher, .bmtc-root::before, .bmtc-typing .bmtc-bubble > span, .bmtc-launcher.is-pulse::after, .bmtc-teaser { transition: none; animation: none; }
}
