/* NLWeb chat widget — Sky Storm Digital build.
   Inherits the site's font; accent colour comes from Settings → NLWeb Chat Widget. */

.nlweb-chat,
.nlweb-launcher {
    --nlweb-ink: #1b1f27;
    --nlweb-muted: #5b6372;
    --nlweb-line: #e3e6ec;
    --nlweb-surface: #ffffff;
    --nlweb-soft: #f4f6f9;
    --nlweb-accent-ink: #ffffff;
    font-family: inherit;
    color: var(--nlweb-ink);
    line-height: 1.5;
    box-sizing: border-box;
}
.nlweb-chat *,
.nlweb-launcher * { box-sizing: border-box; }

/* Reset theme / Elementor button styles inside the widget */
.nlweb-chat button,
.nlweb-launcher button {
    font: inherit;
    text-transform: none;
    letter-spacing: normal;
    margin: 0;
    box-shadow: none;
    cursor: pointer;
}

/* ---------- Panel ---------- */
.nlweb-chat {
    display: flex;
    flex-direction: column;
    background: var(--nlweb-surface);
    border: 1px solid var(--nlweb-line);
    border-radius: 14px;
    overflow: hidden;
}
.nlweb-chat--inline { max-width: 760px; height: 560px; margin: 0 auto; }

.nlweb-chat__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--nlweb-line);
}
.nlweb-chat__title { margin: 0; font-size: 16px; font-weight: 600; color: var(--nlweb-ink); }
.nlweb-chat .nlweb-chat__close {
    display: grid; place-items: center;
    width: 32px; height: 32px; padding: 0;
    border: 0; border-radius: 8px;
    background: transparent; color: var(--nlweb-muted);
}
.nlweb-chat .nlweb-chat__close:hover { background: var(--nlweb-soft); color: var(--nlweb-ink); }

/* ---------- Log ---------- */
.nlweb-chat__log {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overscroll-behavior: contain;
}
.nlweb-chat__intro { margin: 0 0 14px; color: var(--nlweb-muted); font-size: 15px; }
.nlweb-chat__suggestions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.nlweb-chat .nlweb-chat__chip {
    padding: 8px 12px;
    border: 1px solid var(--nlweb-line);
    border-radius: 10px;
    background: var(--nlweb-surface);
    color: var(--nlweb-ink);
    font-size: 14px;
    text-align: left;
}
.nlweb-chat .nlweb-chat__chip:hover { border-color: var(--nlweb-accent); color: var(--nlweb-accent); background: var(--nlweb-surface); }

.nlweb-msg { max-width: 92%; font-size: 15px; }
.nlweb-msg--user {
    align-self: flex-end;
    padding: 9px 14px;
    border-radius: 14px 14px 4px 14px;
    background: var(--nlweb-accent);
    color: var(--nlweb-accent-ink);
    white-space: pre-wrap;
}
.nlweb-msg--bot { align-self: flex-start; }
.nlweb-msg--error {
    padding: 9px 14px;
    border-radius: 10px;
    background: #fff4f2;
    color: #8a2a17;
}

.nlweb-answer { margin: 0 0 10px; white-space: pre-line; }

.nlweb-sources { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.nlweb-source {
    margin: 0;
    padding: 10px 12px;
    border-left: 3px solid var(--nlweb-accent);
    background: var(--nlweb-soft);
    border-radius: 0 8px 8px 0;
}
.nlweb-chat a.nlweb-source__link { color: var(--nlweb-ink); font-weight: 600; text-decoration: none; font-size: 14px; }
.nlweb-chat a.nlweb-source__link:hover { color: var(--nlweb-accent); text-decoration: underline; }
.nlweb-source__desc { margin: 4px 0 0; color: var(--nlweb-muted); font-size: 13.5px; }
.nlweb-source__score { display: block; margin-top: 4px; font-size: 12px; color: var(--nlweb-muted); }

.nlweb-chat a.nlweb-cta {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 14px;
    border-radius: 8px;
    background: var(--nlweb-ink);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}
.nlweb-chat a.nlweb-cta:hover { background: var(--nlweb-accent); color: var(--nlweb-accent-ink); }

.nlweb-msg--pending { display: flex; align-items: center; gap: 8px; color: var(--nlweb-muted); font-size: 14px; }
.nlweb-pending__dots { display: inline-flex; gap: 3px; }
.nlweb-pending__dots i {
    width: 5px; height: 5px; border-radius: 50%;
    background: currentColor; opacity: .3;
    animation: nlweb-blink 1.2s infinite;
}
.nlweb-pending__dots i:nth-child(2) { animation-delay: .2s; }
.nlweb-pending__dots i:nth-child(3) { animation-delay: .4s; }
@keyframes nlweb-blink { 40% { opacity: 1; } }

/* ---------- Composer ---------- */
.nlweb-chat__composer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 14px 6px;
    border-top: 1px solid var(--nlweb-line);
}
.nlweb-chat .nlweb-chat__input {
    flex: 1;
    min-height: 42px;
    max-height: 120px;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--nlweb-line);
    border-radius: 10px;
    background: var(--nlweb-surface);
    color: var(--nlweb-ink);
    font: inherit;
    font-size: 15px;
    resize: none;
    box-shadow: none;
}
.nlweb-chat .nlweb-chat__input:focus { outline: none; border-color: var(--nlweb-accent); }
.nlweb-chat .nlweb-chat__send {
    display: grid; place-items: center;
    flex: 0 0 42px; width: 42px; height: 42px; padding: 0;
    border: 0; border-radius: 10px;
    background: var(--nlweb-accent); color: var(--nlweb-accent-ink);
}
.nlweb-chat .nlweb-chat__send:disabled { opacity: .5; cursor: progress; }
.nlweb-chat__fineprint { margin: 0; padding: 0 14px 10px; font-size: 11.5px; color: var(--nlweb-muted); }

/* ---------- Floating launcher ---------- */
.nlweb-launcher {
    position: fixed;
    bottom: calc(var(--nlweb-bottom, 24px) + env(safe-area-inset-bottom, 0px));
    z-index: 99990;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.nlweb-launcher--right { right: 20px; align-items: flex-end; }
.nlweb-launcher--left  { left: 20px;  align-items: flex-start; }

.nlweb-launcher .nlweb-launcher__button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 52px;
    padding: 0 18px 0 15px;
    border: 0;
    border-radius: 26px;
    background: var(--nlweb-accent);
    color: var(--nlweb-accent-ink);
    font-size: 15px;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(20, 30, 50, .22);
}
.nlweb-launcher.is-open .nlweb-launcher__label { display: none; }
.nlweb-launcher.is-open .nlweb-launcher__button { padding: 0 14px; }

.nlweb-launcher__panel { order: -1; }
.nlweb-launcher__panel .nlweb-chat {
    width: 380px;
    height: min(600px, calc(100vh - 140px));
    box-shadow: 0 18px 50px rgba(20, 30, 50, .22);
}

.nlweb-chat :focus-visible,
.nlweb-launcher :focus-visible { outline: 2px solid var(--nlweb-accent); outline-offset: 2px; }

@media (max-width: 520px) {
    .nlweb-launcher.is-open { inset: 0; padding: 0; gap: 0; }
    .nlweb-launcher.is-open .nlweb-launcher__button { display: none; }
    .nlweb-launcher__panel,
    .nlweb-launcher__panel .nlweb-chat { width: 100%; height: 100%; }
    .nlweb-launcher__panel .nlweb-chat { border-radius: 0; border: 0; }
    .nlweb-chat--inline { height: 70vh; }
}

@media (prefers-reduced-motion: reduce) {
    .nlweb-pending__dots i { animation: none; opacity: .6; }
}
