/* ШІ-юрист форуму (/forum/ai-yurist/) + кнопка «ШІ-юрист» у панелі форуму.
   Окремий файл (не forum.css): ?v= у нього власний, за mtime, тож правки не застрягають у кеші браузера. */

/* ── Кнопка в панелі форуму ── */
.al-bar-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700;
  color: #fff; background: linear-gradient(135deg, #1E5BC6, #5d8ee6); text-decoration: none; white-space: nowrap; box-shadow: 0 2px 8px rgba(30,91,198,.25); }
.al-bar-btn:hover { filter: brightness(1.07); color: #fff; }
.al-bar-btn.is-active { box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px #5d8ee6; }

/* CTA-картка на головній форуму і в темах */
.al-cta { display: flex; gap: 14px; align-items: center; padding: 16px 18px; margin: 0 0 20px; border-radius: 18px; text-decoration: none; color: var(--text);
  border: 1px solid rgba(30,91,198,.25); background: linear-gradient(135deg, rgba(30,91,198,.08), rgba(93,142,230,.04)); }
.al-cta:hover { border-color: #5d8ee6; color: var(--text); }
.al-cta__icon { font-size: 28px; line-height: 1; flex: none; }
.al-cta__body { flex: 1; min-width: 0; }
.al-cta__body b { display: block; font-size: 15px; margin-bottom: 2px; }
.al-cta__body span { font-size: 13px; color: var(--text-muted); }
.al-cta__go { flex: none; font-weight: 700; font-size: 13px; color: #1E5BC6; white-space: nowrap; }
[data-theme="dark"] .al-cta__go { color: #8fb3f0; }
.al-cta--side { flex-direction: column; align-items: flex-start; margin: 0; }

/* ── Сторінка ── */
.al-vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.al-hero { margin: 8px 0 18px; }
.al-hero__badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #1E5BC6; background: rgba(30,91,198,.1); margin-bottom: 8px; }
[data-theme="dark"] .al-hero__badge { color: #8fb3f0; background: rgba(93,142,230,.15); }
.al-hero h1 { margin: 0 0 8px; font-size: clamp(22px, 4.6vw, 32px); line-height: 1.2; }
.al-hero__lead { font-size: 16px; margin: 0 0 10px; color: var(--text); }
.al-short { margin: 0 0 26px; padding: 12px 14px; border-left: 3px solid #5d8ee6; background: var(--bg-card); border-radius: 0 12px 12px 0; font-size: 14px; color: var(--text-muted); line-height: 1.55; }
.al-short b { color: var(--text); }

/* Блок чату: окрема «картка-віджет», що вирізняється на сірому фоні сторінки */
.al-chat { --al-blue: #1E5BC6; --al-blue-2: #4f86e8; position: relative; margin: 0 0 28px; border-radius: 24px; background: var(--bg-card);
  border: 1px solid rgba(30,91,198,.22); box-shadow: 0 18px 50px rgba(20,50,110,.14), 0 2px 6px rgba(20,50,110,.06); overflow: hidden; }
.al-chat__head { display: flex; align-items: center; gap: 14px; padding: 18px 20px; color: #fff;
  background: radial-gradient(500px 160px at 90% 0%, rgba(126,181,58,.35), transparent 70%), linear-gradient(135deg, #0f2f6e, var(--al-blue) 60%, var(--al-blue-2)); }
.al-chat__icon { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: rgba(255,255,255,.16); box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }
.al-chat__head-text { flex: 1; min-width: 0; }
.al-chat__title { font-size: 20px; line-height: 1.2; margin: 0 0 6px; color: #fff; }
.al-perks { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: #dbe6fb; }
.al-perks li { position: relative; padding-left: 16px; }
.al-perks li::before { content: ''; position: absolute; left: 0; top: 50%; width: 9px; height: 5px; margin-top: -4px; border: solid #a9e07a; border-width: 0 0 2px 2px; transform: rotate(-45deg); }
.al-status { flex: none; align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: rgba(255,255,255,.15); color: #fff; }
.al-status i { width: 8px; height: 8px; border-radius: 50%; background: #7ee35a; box-shadow: 0 0 0 3px rgba(126,227,90,.25); }
.al-status.is-off i { background: #f5a623; box-shadow: none; }
.al-chat__inner { padding: 18px 20px 16px; background: linear-gradient(180deg, rgba(30,91,198,.05), transparent 160px); }

.al-note { padding: 10px 12px; border-radius: 12px; font-size: 14px; margin: 0 0 12px; background: var(--bg-elev); }
.al-note--warn { background: rgba(245,166,35,.12); border: 1px solid rgba(245,166,35,.35); }

.al-log { display: flex; flex-direction: column; gap: 12px; max-height: 70vh; overflow-y: auto; padding: 2px 2px 10px; scroll-behavior: smooth; }
.al-log:empty { display: none; }
.al-examples__title { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.al-examples__list { display: flex; flex-wrap: wrap; gap: 8px; }
.al-chip { display: inline-flex; align-items: flex-start; gap: 8px; border: 1px solid rgba(30,91,198,.2); background: var(--bg-card); color: var(--text); border-radius: 14px;
  padding: 9px 13px; font: inherit; font-size: 13.5px; font-weight: 500; text-align: left; cursor: pointer; line-height: 1.35; box-shadow: 0 1px 2px rgba(20,50,110,.06);
  transition: border-color .15s, background .15s, transform .15s, box-shadow .15s; }
.al-chip::before { content: '?'; flex: none; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; background: var(--al-blue); margin-top: 1px; }
.al-chip:hover { border-color: var(--al-blue-2); background: rgba(79,134,232,.07); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(30,91,198,.12); }

.al-msg { max-width: 100%; border-radius: 16px; padding: 12px 14px; font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.al-msg--user { align-self: flex-end; max-width: 88%; color: #fff; background: linear-gradient(135deg, var(--al-blue), var(--al-blue-2)); border-radius: 18px 18px 4px 18px; white-space: pre-wrap; }
.al-msg--user .al-file { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.3); color: #fff; }
.al-msg--ai { align-self: stretch; background: var(--bg-card); border: 1px solid var(--border); border-radius: 18px 18px 18px 4px; box-shadow: 0 2px 10px rgba(20,50,110,.06); }
.al-msg--err { background: rgba(232,90,90,.08); border: 1px solid rgba(232,90,90,.3); }
.al-msg__files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; white-space: normal; }
.al-msg__who { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; color: var(--al-blue); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
[data-theme="dark"] .al-msg__who { color: #8fb3f0; }
.al-msg h3, .al-msg h4 { font-size: 16px; margin: 14px 0 6px; }
.al-msg h3:first-child, .al-msg h4:first-child { margin-top: 0; }
.al-msg p { margin: 0 0 10px; }
.al-msg ul, .al-msg ol { margin: 0 0 10px; padding-left: 22px; }
.al-msg li { margin: 3px 0; }
.al-msg blockquote { margin: 0 0 10px; padding: 6px 12px; border-left: 3px solid var(--border-strong); color: var(--text-muted); }
.al-msg a { color: var(--al-blue); }
[data-theme="dark"] .al-msg a { color: #8fb3f0; }
.al-msg > :last-child { margin-bottom: 0; }
.al-msg__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); }
.al-msg__actions a, .al-msg__actions button { font-size: 13px; }
.al-typing { display: inline-flex; gap: 4px; align-items: center; color: var(--text-muted); font-size: 14px; }
.al-typing i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .4; animation: al-dot 1.2s infinite; }
.al-typing i:nth-child(2) { animation-delay: .2s; } .al-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes al-dot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* Поле вводу: біла «капсула» з яскравою рамкою — одразу видно, куди писати */
.al-form { margin-top: 12px; }
.al-composer { position: relative; border-radius: 18px; background: var(--bg-card); border: 2px solid var(--al-blue-2);
  box-shadow: 0 0 0 4px rgba(79,134,232,.10), 0 8px 24px rgba(20,50,110,.10); transition: border-color .15s, box-shadow .15s; }
.al-composer:focus-within { border-color: var(--al-blue); box-shadow: 0 0 0 5px rgba(79,134,232,.22), 0 10px 28px rgba(20,50,110,.14); }
.al-composer.is-flash { animation: al-flash .9s ease-out; }
@keyframes al-flash { 0% { box-shadow: 0 0 0 0 rgba(79,134,232,.55); } 100% { box-shadow: 0 0 0 12px rgba(79,134,232,0), 0 8px 24px rgba(20,50,110,.10); } }
.al-composer__label { display: block; padding: 12px 16px 0; font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--al-blue); }
[data-theme="dark"] .al-composer__label { color: #8fb3f0; }
.al-composer textarea { display: block; width: 100%; box-sizing: border-box; resize: vertical; min-height: 110px; padding: 6px 16px 10px; border: 0; outline: none;
  background: transparent; color: var(--text); font: inherit; font-size: 16px; line-height: 1.55; }
.al-composer textarea::placeholder { color: var(--text-muted); opacity: .85; }
.al-files { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 8px; }
.al-files[hidden] { display: none; }
.al-file { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 5px 6px 5px 10px; border-radius: 999px; background: rgba(30,91,198,.08); border: 1px solid rgba(30,91,198,.2); font-size: 13px; font-weight: 600; }
.al-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.al-file button { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 4px; }
.al-file--sent { padding-right: 10px; }
.al-composer__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--border); background: var(--bg-elev); border-radius: 0 0 16px 16px; }
.al-attach { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 12px; cursor: pointer; font-size: 14px; font-weight: 700;
  color: var(--al-blue); background: var(--bg-card); border: 1px solid rgba(30,91,198,.3); transition: background .15s, border-color .15s; }
[data-theme="dark"] .al-attach { color: #8fb3f0; }
.al-attach:hover, .al-attach:focus-within { border-color: var(--al-blue); background: rgba(79,134,232,.08); }
.al-attach input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.al-form__hint { font-size: 12.5px; color: var(--text-muted); }
.al-send { margin-left: auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 22px; border: 0; border-radius: 12px; cursor: pointer;
  font: inherit; font-size: 15px; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--al-blue), var(--al-blue-2));
  box-shadow: 0 6px 16px rgba(30,91,198,.35); transition: transform .15s, box-shadow .15s, filter .15s; }
.al-send:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(30,91,198,.42); }
.al-send:active { transform: translateY(0); }
.al-send[disabled] { opacity: .6; pointer-events: none; box-shadow: none; }
.al-send.is-busy svg { animation: al-nudge 1s ease-in-out infinite; }
@keyframes al-nudge { 50% { transform: translateX(3px); } }
.al-form__legal { margin: 12px 2px 0; font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.al-form__legal svg { display: inline-block; vertical-align: -2px; margin-right: 4px; }
.al-reset { display: inline-block; margin: 6px 0 0 6px; border: 1px solid var(--border-strong); background: var(--bg-card); color: var(--text); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.al-reset[hidden] { display: none; }
.al-reset:hover { border-color: var(--al-blue); color: var(--al-blue); }
.al-chat.is-drag .al-composer { border-style: dashed; border-color: var(--al-blue); background: rgba(79,134,232,.06); }
@media (prefers-reduced-motion: reduce) { .al-typing i, .al-send.is-busy svg, .al-composer.is-flash { animation: none; } .al-log { scroll-behavior: auto; } .al-chip:hover, .al-send:hover { transform: none; } }

.al-text { line-height: 1.6; }
.al-steps, .al-list { padding-left: 22px; margin: 0 0 10px; }
.al-steps li, .al-list li { margin: 6px 0; }
.al-faq__item { padding: 12px 0; border-top: 1px solid var(--border); }
.al-faq__item h3 { font-size: 16px; margin: 0 0 6px; }
.al-faq__item p { margin: 0; color: var(--text); }

@media (max-width: 600px) {
  .al-chat { border-radius: 18px; margin-left: -4px; margin-right: -4px; }
  .al-chat__head { padding: 14px; gap: 12px; }
  .al-chat__icon { width: 40px; height: 40px; border-radius: 12px; }
  .al-chat__title { font-size: 18px; }
  .al-perks { font-size: 12px; gap: 2px 12px; }
  .al-perks li:nth-child(n+3) { display: none; }
  .al-status { display: none; }
  .al-chat__inner { padding: 14px 12px 12px; }
  /* приклади — горизонтальна стрічка, щоб поле вводу було видно одразу */
  .al-examples__list { flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -12px; padding: 2px 12px 8px; scrollbar-width: none; }
  .al-examples__list::-webkit-scrollbar { display: none; }
  .al-chip { flex: 0 0 78%; scroll-snap-align: start; }
  .al-examples__title { margin-bottom: 8px; }
  .al-composer__bar { padding: 10px; }
  .al-attach { flex: 1; justify-content: center; }
  .al-send { width: 100%; margin-left: 0; padding: 14px; font-size: 16px; }
  .al-form__hint { display: none; }
  .al-msg--user { max-width: 94%; }
  .al-cta { padding: 14px; }
  .al-cta__go { display: none; }
  .al-bar-btn { padding: 6px 10px; }
}

/* На сторінці ШІ-юриста загальний ШІ-помічник не показуємо: два чати поруч плутають, а кнопка перекриває форму */
.al-page .ai-fab, .al-page .ai-modal, .al-page .ai-modal-overlay { display: none !important; }

/* «Звернутися до юриста»: кнопки та вікно для гостей (views/forum/_bottom.ejs) */
.fm-lawyer-cta { margin: 10px 0 6px; }
.fm-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.fm-gate { width: min(420px, calc(100vw - 32px)); }
/* сброс стилів сайту обнуляє margin у <dialog> — повертаємо центрування */
.fm-gate[open] { position: fixed; inset: 0; margin: auto; height: fit-content; max-height: calc(100vh - 32px); overflow: auto; }
.fm-gate__body { position: relative; align-items: center; text-align: center; padding: 28px 24px 22px; gap: 10px; }
.fm-gate__icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; color: #fff; margin-bottom: 4px;
  background: linear-gradient(135deg, #1E5BC6, #4f86e8); box-shadow: 0 8px 20px rgba(30,91,198,.3); }
.fm-gate__body h2 { font-size: 21px; line-height: 1.25; }
.fm-gate__body p { line-height: 1.5; }
.fm-gate__body .fm-btn { margin-top: 8px; }
.fm-gate__login { font-size: 14px; color: var(--text-muted); }
.fm-gate__login a { font-weight: 700; }
.fm-gate__close { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); font-size: 24px; line-height: 1; cursor: pointer; }
.fm-gate__close:hover { background: var(--bg-elev); color: var(--text); }
.fm-gate[open] { animation: fm-gate-in .18s ease-out; }
@keyframes fm-gate-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .fm-gate[open] { animation: none; } }
@media (max-width: 600px) { .fm-gate__body { padding: 26px 18px 18px; } }

/* «Юридична допомога»: блок юридичних компаній над списком тем */
.fm-cat-firms__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 10px; }
.fm-cat-firms__head .fm-h2 { margin: 0; }
.fm-cat-firms__empty { padding: 14px 16px; border-radius: 14px; background: var(--bg-card); border: 1px dashed var(--border); }
.fm-cat-firms__empty p { margin: 0; }
.fm-cat-firms__empty p + p { margin-top: 8px; color: var(--text-muted); }

/* ── Юридична допомога: три способи (головна форуму, /forum/yurydychna-dopomoha/) — lib/forum/legal-seo.js ── */
.fl-ways { margin: 0 0 22px; }
.fl-ways__head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; margin-bottom: 10px; }
.fl-ways__head .fm-h2 { margin: 0; }
.fl-ways__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 12px; }
.fl-way { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 16px; border-radius: 16px; text-decoration: none; color: var(--text);
  background: var(--bg-card); border: 1px solid var(--border); box-shadow: var(--shadow-card); }
.fl-way:hover { border-color: #5d8ee6; color: var(--text); }
.fl-way--ai { border-color: rgba(30,91,198,.3); background: linear-gradient(135deg, rgba(30,91,198,.09), rgba(93,142,230,.03)); }
.fl-way__icon { font-size: 26px; line-height: 1; }
.fl-way__title { font-size: 15px; }
.fl-way__text { font-size: 13px; color: var(--text-muted); line-height: 1.5; flex: 1; }
.fl-way__go { font-weight: 700; font-size: 13px; color: #1E5BC6; }
[data-theme="dark"] .fl-way__go { color: #8fb3f0; }

/* SEO-текст хабу і тематичних розділів */
.fl-hub { margin-top: 10px; }
.fl-topics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 12px; }
.fl-topic { padding: 14px 16px; border-radius: 14px; background: var(--bg-card); border: 1px solid var(--border); min-width: 0; }
.fl-topic h3 { margin: 0 0 6px; font-size: 16px; }
.fl-topic p { margin: 0 0 8px; font-size: 14px; line-height: 1.55; }
.fl-privacy { font-size: 14px; }
.fl-limits { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 12px; }
.fl-limits__col { padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg-card); min-width: 0; }
.fl-limits__col h3 { margin: 0 0 8px; font-size: 16px; }
.fl-limits__col ul { margin: 0; padding-left: 18px; }
.fl-limits__col li { margin: 0 0 6px; font-size: 14px; line-height: 1.5; }
.fl-limits__col--can { border-left: 3px solid #2e9e5b; }
.fl-limits__col--cannot { border-left: 3px solid #d08a1e; }
.fl-sources ul { margin: 0; padding-left: 18px; }
.fl-sources li { margin: 0 0 4px; font-size: 14px; overflow-wrap: anywhere; }
.fl-trust { margin: 14px 0 6px; font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.fl-cat { margin-top: 26px; padding-top: 4px; border-top: 1px solid var(--border); }
.fl-cat p { line-height: 1.6; }
