/* Klubbens assistent (feedback #2121, fase 4): «Spør klubben»-seksjonen og boblen. Fargen følger
   temaets primærknapp; alt annet er nøytralt så det passer i alle tema. */
.bca-root {
    --bca-accent: var(--theme-buttons-primary-background-color, var(--bloc-primary, #1E5E3A));
    --bca-accent-text: var(--theme-buttons-primary-text-color, #fff);
    --bca-soft: color-mix(in srgb, var(--bca-accent) 9%, #fff);
    --bca-border: color-mix(in srgb, var(--bca-accent) 22%, #d5dbe3);
    --bca-text: #1b2430;
    --bca-muted: #5b6573;
    font-family: inherit;
    color: var(--bca-text);
    line-height: 1.5;
}
.bca-root *, .bca-root *::before, .bca-root *::after { box-sizing: border-box; }
.bca-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------- Seksjonen ---------------- */
.bca-section { background: var(--bca-soft); border-radius: 14px; padding: 32px 20px; }
.bca-section-body { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
/* Noen tema setter text-transform på h2; overskriften skal stå slik klubben skrev den. */
.bca-section-title { margin: 0; text-align: center; font-size: 1.75rem; font-weight: 700; line-height: 1.25; text-transform: none; letter-spacing: normal; }
.bca-root .bca-dev, .bca-root .bca-chip, .bca-root .bca-send, .bca-root .bca-launcher { text-transform: none; }
.bca-section-intro { margin: 0; text-align: center; color: var(--bca-muted); }
/* Merket foran overskriften: «Beta» på pilotklubber, «[dev]» for utviklere før lansering. */
.bca-dev { display: inline-block; font-size: 12px; font-weight: 600; background: var(--bca-soft); color: var(--bca-accent); border: 1px solid var(--bca-border); border-radius: 999px; padding: 1px 8px; vertical-align: middle; }

.bca-form { display: flex; gap: 8px; background: #fff; border: 1px solid var(--bca-border); border-radius: 12px; padding: 6px; box-shadow: 0 4px 16px rgba(15, 23, 42, .06); }
.bca-input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 16px; padding: 10px 12px; color: inherit; }
.bca-input:focus { outline: none; }
.bca-form:focus-within { outline: 2px solid var(--bca-accent); outline-offset: 2px; }
.bca-send { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 9px; padding: 0 18px; min-height: 44px; font: inherit; font-weight: 600; cursor: pointer; background: var(--bca-accent); color: var(--bca-accent-text); }
.bca-send:disabled { opacity: .6; cursor: progress; }

.bca-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.bca-chip { border: 1px solid var(--bca-border); background: #fff; color: var(--bca-text); border-radius: 999px; padding: 0 14px; min-height: 40px; font: inherit; font-size: 14px; cursor: pointer; }
.bca-chip:hover { border-color: var(--bca-accent); }

.bca-answer-area:empty { display: none; }
.bca-answer-area { background: #fff; border: 1px solid var(--bca-border); border-radius: 12px; padding: 18px 20px; }
.bca-asked { margin: 0 0 8px; font-weight: 600; }
.bca-loading { margin: 0; color: var(--bca-muted); }
.bca-error { margin: 0; color: #a12622; }
.bca-privacy { margin: 0; text-align: center; font-size: 12px; color: var(--bca-muted); }

/* ---------------- Svaret (felles) ---------------- */
.bca-answer { display: flex; flex-direction: column; gap: 12px; }
.bca-answer-text { margin: 0; white-space: pre-line; }
.bca-sources { display: flex; flex-direction: column; gap: 6px; }
.bca-sources-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--bca-muted); }
.bca-source-list { display: flex; flex-wrap: wrap; gap: 6px; }
.bca-source { display: inline-flex; align-items: center; gap: 6px; background: var(--bca-soft); color: inherit; border-radius: 8px; padding: 6px 10px; font-size: 13px; font-weight: 600; text-decoration: none; }
a.bca-source:hover { text-decoration: underline; }
.bca-contact { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--bca-border); border-radius: 10px; padding: 10px 12px; color: inherit; text-decoration: none; }
.bca-contact-text { display: flex; flex-direction: column; font-size: 13px; }
.bca-contact-text span { color: var(--bca-muted); }
.bca-feedback { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--bca-muted); border-top: 1px solid #eef1f5; padding-top: 10px; }
.bca-feedback-btn { border: 1px solid #c9d2de; background: #fff; border-radius: 8px; padding: 0 12px; min-height: 32px; font: inherit; font-size: 13px; cursor: pointer; }

/* ---------------- Boblen ---------------- */
.bca-bubble { position: fixed; right: 20px; bottom: 20px; z-index: 9990; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
/* Redaktører har admin-verktøyknappen fast nederst til høyre (60 px opp); boblen går til venstre for den. */
body.ui-admin-bottombar-bottom .bca-bubble { right: 92px; }
.bca-launcher { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; padding: 0 18px 0 14px; min-height: 52px; font: inherit; font-weight: 600; cursor: pointer; background: var(--bca-accent); color: var(--bca-accent-text); box-shadow: 0 10px 24px rgba(15, 23, 42, .25); }
.bca-launcher svg { width: 20px; height: 20px; }
.bca-panel { width: 380px; max-width: calc(100vw - 40px); height: min(600px, calc(100vh - 120px)); background: #fff; border-radius: 16px; box-shadow: 0 20px 50px rgba(15, 23, 42, .28); display: flex; flex-direction: column; overflow: hidden; }
.bca-panel[hidden] { display: none; }
.bca-panel-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 12px 12px 16px; background: var(--bca-accent); color: var(--bca-accent-text); }
.bca-panel-title { display: flex; flex-direction: column; }
.bca-panel-title span { font-size: 12px; opacity: .9; }
.bca-panel-title .bca-badge { display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 600; opacity: 1; background: rgba(255, 255, 255, .22); vertical-align: middle; }
.bca-close { border: 0; background: none; color: inherit; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.bca-close svg { width: 22px; height: 22px; }
.bca-panel-privacy { background: #f4f6f9; border-bottom: 1px solid #e3e7ed; padding: 8px 14px; font-size: 12px; color: #3a4452; }
.bca-messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.bca-msg { max-width: 88%; border-radius: 14px; padding: 10px 14px; font-size: 15px; }
.bca-msg--bot { align-self: flex-start; background: var(--bca-soft); border-bottom-left-radius: 4px; }
.bca-msg--user { align-self: flex-end; background: var(--bca-accent); color: var(--bca-accent-text); border-bottom-right-radius: 4px; }
.bca-msg .bca-source { background: #fff; }
.bca-chips--panel { justify-content: flex-start; }
.bca-form--panel { border-radius: 0; border: 0; border-top: 1px solid #e3e7ed; box-shadow: none; padding: 8px 10px 12px; }
.bca-form--panel:focus-within { outline: none; }
.bca-form--panel .bca-input { border: 1px solid #c9d2de; border-radius: 999px; padding: 10px 14px; }
.bca-form--panel .bca-input:focus { outline: 2px solid var(--bca-accent); outline-offset: 1px; }
.bca-form--panel .bca-send { border-radius: 50%; width: 46px; padding: 0; justify-content: center; }
.bca-form--panel .bca-send-text { display: none; }

/* Mobil: panelet fyller skjermen. */
@media (max-width: 600px) {
    .bca-bubble { right: 12px; bottom: 12px; }
    /* Redaktører har knapper nederst til høyre på mobil også; da står boblen til venstre. */
    body.ui-admin-bottombar-bottom .bca-bubble { right: auto; left: 12px; bottom: 12px; }
    /* Rund ikon-knapp på mobil, så den ikke dekker innholdet. */
    .bca-launcher { width: 56px; height: 56px; padding: 0; justify-content: center; }
    .bca-launcher span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .bca-launcher svg { width: 24px; height: 24px; }
    .bca-open .bca-launcher { display: none; }
    /* Åpent panel over alt annet som flyter (admin-knapper, tilbakemeldingsfanen). */
    .bca-bubble.bca-open { z-index: 2147483000; }
    .bca-panel { position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; border-radius: 0; }
    .bca-section { padding: 24px 14px; border-radius: 0; }
    .bca-section-title { font-size: 1.4rem; }
    .bca-send-text { display: none; }
    .bca-send { padding: 0 14px; }
}
