/* Asystent AI (assets/advisor.js). Ładowany tylko, gdy czat jest włączony; tokeny kolorów i promieni z shop.css. */
.jf-ai { position: fixed; right: 16px; bottom: 16px; z-index: 35; font-size: 0.9375rem; transition: bottom 0.25s var(--ease); }
.jf-ai--lift { bottom: 88px; }
.jf-ai--consent:not(.is-open) .jf-ai-launcher { visibility: hidden; }

.jf-ai-launcher {
  display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 18px 0 14px; border: 0; border-radius: 999px;
  background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
  box-shadow: 0 10px 24px oklch(0.2 0.01 48 / 0.18), 0 2px 6px oklch(0.2 0.01 48 / 0.12);
  transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}
.jf-ai-launcher:hover { background: var(--brand-hover, var(--brand)); transform: translateY(-1px); }
.jf-ai-launcher:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.jf-ai-launcher-icon svg { display: block; width: 24px; height: 24px; }
/* Justi mruga co 5 s (oba oczy naraz); iskierka błyska przy najechaniu na przycisk. */
.jf-ai-eye { transform-box: fill-box; transform-origin: center; animation: jf-ai-blink 5s infinite; }
@keyframes jf-ai-blink { 0%, 91%, 97%, 100% { transform: none; } 94% { transform: scaleY(0.12); } }
.jf-ai-spark { transform-box: fill-box; transform-origin: center; transition: transform 0.35s var(--ease); }
.jf-ai-launcher:hover .jf-ai-spark { transform: rotate(90deg) scale(1.25); }

.jf-ai-panel {
  position: absolute; right: 0; bottom: 60px; display: flex; flex-direction: column;
  width: min(390px, calc(100vw - 32px)); height: min(620px, calc(100vh - 110px));
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: 0 24px 48px oklch(0.2 0.01 48 / 0.18);
}
.jf-ai-panel[hidden] { display: none; }
.jf-ai.is-open .jf-ai-panel { animation: jf-ai-in 0.22s var(--ease); }
@keyframes jf-ai-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.jf-ai-head { display: flex; align-items: center; gap: 10px; padding: 12px 8px 12px 14px; border-bottom: 1px solid var(--line); }
.jf-ai-avatar {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand); color: #fff;
}
.jf-ai-avatar svg { display: block; width: 22px; height: 22px; }
.jf-ai-head-text { flex: 1; min-width: 0; }
.jf-ai-title { margin: 0; font-weight: 600; line-height: 1.25; }
.jf-ai-sub { display: flex; align-items: center; gap: 6px; margin: 2px 0 0; font-size: 0.75rem; color: var(--muted); }
.jf-ai-dot { width: 7px; height: 7px; border-radius: 50%; background: oklch(0.62 0.15 150); }
.jf-ai-icon {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: var(--radius);
  background: transparent; color: var(--ink-2); cursor: pointer;
}
.jf-ai-icon:hover { background: var(--surface); color: var(--ink); }
.jf-ai-icon svg { width: 20px; height: 20px; }

.jf-ai-list { flex: 1; display: flex; flex-direction: column; gap: 12px; padding: 16px 14px; overflow-y: auto; background: var(--surface); overscroll-behavior: contain; }
.jf-ai-msg { display: grid; gap: 3px; max-width: 88%; }
.jf-ai-msg--user { align-self: flex-end; justify-items: end; }
.jf-ai-who { font-size: 0.6875rem; color: var(--muted); padding-inline: 4px; }
.jf-ai-bubble { padding: 10px 12px; border-radius: 12px 12px 12px 4px; background: var(--bg); border: 1px solid var(--line); line-height: 1.5; overflow-wrap: anywhere; }
.jf-ai-bubble p { margin: 0; }
.jf-ai-bubble p + p, .jf-ai-bubble p + ul, .jf-ai-bubble ul + p, .jf-ai-bubble p + ol, .jf-ai-bubble ol + p { margin-top: 8px; }
.jf-ai-bubble ul, .jf-ai-bubble ol { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.jf-ai-bubble ul { list-style: disc; }
.jf-ai-bubble ol { list-style: decimal; }
.jf-ai-bubble a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; font-weight: 500; }
.jf-ai-bubble strong { color: var(--ink); }
.jf-ai-msg--user .jf-ai-bubble { background: var(--ink); color: var(--on-dark); border-color: var(--ink); border-radius: 12px 12px 4px 12px; }
/* Kciuki pod odpowiedzią: ocena idzie do nauki asystenta (AdvisorLearning) */
.jf-ai-rate { display: flex; align-items: center; gap: 2px; padding-left: 2px; min-height: 30px; }
.jf-ai-rate-btn { display: grid; place-items: center; width: 32px; height: 30px; border: 0; border-radius: var(--radius); background: transparent; color: var(--muted); cursor: pointer; }
.jf-ai-rate-btn:hover { background: var(--bg); color: var(--ink); }
.jf-ai-rate-btn svg { width: 17px; height: 17px; }
.jf-ai-rate-btn--down svg { transform: scaleY(-1); }
.jf-ai-rate-thanks { font-size: 0.75rem; color: var(--muted); padding: 6px 4px; }
.jf-ai-note { margin: 0; text-align: center; font-size: 0.8125rem; color: var(--ink-2); }
.jf-ai-note a { color: var(--brand); }

.jf-ai-typing .jf-ai-bubble { display: flex; gap: 4px; align-items: center; height: 40px; }
.jf-ai-typing .jf-ai-bubble span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: jf-ai-dot 1.1s infinite ease-in-out; }
.jf-ai-typing .jf-ai-bubble span:nth-child(2) { animation-delay: 0.15s; }
.jf-ai-typing .jf-ai-bubble span:nth-child(3) { animation-delay: 0.3s; }
@keyframes jf-ai-dot { 0%, 80%, 100% { opacity: 0.3; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }

.jf-ai-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px 0; }
.jf-ai-chips[hidden] { display: none; }
.jf-ai-chip {
  min-height: 34px; padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--bg);
  color: var(--ink); font: inherit; font-size: 0.8125rem; cursor: pointer;
}
.jf-ai-chip:hover { border-color: var(--ink); }

.jf-ai-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; }
.jf-ai-input {
  flex: 1; min-height: 44px; max-height: 120px; padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--bg); color: var(--ink); font: inherit; line-height: 1.4; resize: none;
}
.jf-ai-input::placeholder { color: var(--muted); }
.jf-ai-input:focus { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }
.jf-ai-send {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: var(--radius);
  background: var(--brand); color: #fff; cursor: pointer;
}
.jf-ai-send:disabled { opacity: 0.45; cursor: default; }
.jf-ai-send svg { width: 20px; height: 20px; }
.jf-ai-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.jf-ai-foot { margin: 0; padding: 0 14px 12px; font-size: 0.6875rem; line-height: 1.45; color: var(--muted); }
.jf-ai-foot a { color: inherit; text-decoration: underline; }

@media (max-width: 640px) {
  .jf-ai { right: 12px; bottom: 12px; }
  .jf-ai--lift { bottom: 84px; }
  .jf-ai-launcher { width: 52px; height: 52px; padding: 0; justify-content: center; }
  .jf-ai-launcher-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .jf-ai.is-open .jf-ai-launcher { display: none; }
  .jf-ai-panel { position: fixed; inset: 0; width: auto; height: 100%; height: 100dvh; border: 0; border-radius: 0; }
  .jf-ai-msg { max-width: 92%; }
  .jf-ai-input { font-size: 1rem; }   /* iOS nie powiększa strony przy polu ≥ 16 px */
  html.jf-ai-lock, html.jf-ai-lock body { overflow: hidden; }
  /* Ikonka zgód Cookiebota (lewy dolny róg) leżała na stopce czatu i łapała dotknięcia przy linku „Kontakt". */
  html.jf-ai-lock #CookiebotWidget { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .jf-ai, .jf-ai-launcher, .jf-ai-spark { transition: none; }
  .jf-ai-eye { animation: none; }
  .jf-ai.is-open .jf-ai-panel { animation: none; }
  .jf-ai-typing .jf-ai-bubble span { animation: none; opacity: 0.6; }
}
