/* Czat kursu (includes/czat_widget.php, assets/js/czat.js). Prefiks .hbcz-. Ciemny motyw domyślnie, jasny: [data-theme="light"]. */
.hbcz{--hbcz-zloto:#e5a820;--hbcz-zloto2:#f2c050;--hbcz-granat:#16213e;--hbcz-tlo:#111827;--hbcz-tlo2:#1b2436;--hbcz-tekst:#f3f4f6;--hbcz-slaby:rgba(255,255,255,.62);
  --hbcz-linia:rgba(255,255,255,.1);--hbcz-dymek-my:#e5a820;--hbcz-dymek-my-t:#1a1408;--hbcz-dymek-oni:#232e44;--hbcz-zielony:#22c55e;--hbcz-pierscien:#111827;
  font-family:'Jost','Segoe UI',system-ui,-apple-system,Roboto,Arial,sans-serif}
[data-theme="light"] .hbcz{--hbcz-tlo:#fffdf8;--hbcz-tlo2:#f6f1e7;--hbcz-tekst:#2c2416;--hbcz-slaby:rgba(44,36,22,.72);--hbcz-linia:rgba(44,36,22,.12);
  --hbcz-dymek-my:#e5a820;--hbcz-dymek-my-t:#1a1408;--hbcz-dymek-oni:#efe8da;--hbcz-pierscien:#fffdf8}

/* ── kółko ── */
.hbcz-kolko{position:fixed;right:max(16px,env(safe-area-inset-right));bottom:calc(var(--hbcz-dol,16px) + env(safe-area-inset-bottom));z-index:96;
  width:56px;height:56px;border-radius:50%;border:0;padding:0;cursor:pointer;display:flex;align-items:center;justify-content:center;
  background:linear-gradient(140deg,var(--hbcz-zloto2),#c98d12);color:var(--hbcz-granat);
  box-shadow:0 6px 18px rgba(0,0,0,.35),0 0 0 1px rgba(0,0,0,.08);-webkit-tap-highlight-color:transparent;
  transition:transform .25s cubic-bezier(.2,.8,.2,1),box-shadow .25s,opacity .2s}
.hbcz-kolko:hover{transform:scale(1.06);box-shadow:0 8px 24px rgba(0,0,0,.4)}
.hbcz-kolko:active{transform:scale(.96)}
.hbcz-kolko:focus-visible{outline:3px solid var(--hbcz-zloto2);outline-offset:3px}
.hbcz-ikona{width:30px;height:30px}
.hbcz-ikona .hbcz-kropka{fill:var(--hbcz-zloto2)}
.hbcz-online{position:absolute;right:1px;bottom:2px;width:15px;height:15px;border-radius:50%;background:var(--hbcz-zielony);border:2.5px solid var(--hbcz-pierscien);box-sizing:border-box}
.hbcz-kolko .hbcz-online{border-color:#fff}
.hbcz-licznik{position:absolute;top:-4px;right:-4px;min-width:21px;height:21px;padding:0 6px;border-radius:999px;background:#e11d48;color:#fff;
  font:700 12px/21px 'Jost',sans-serif;text-align:center;box-shadow:0 0 0 2px #fff;box-sizing:border-box}
.hbcz-licznik[hidden]{display:none}
.hbcz.is-otwarte .hbcz-kolko{opacity:0;pointer-events:none;transform:scale(.6)}
@media (min-width:640px){.hbcz.is-otwarte .hbcz-kolko{opacity:1;pointer-events:auto;transform:none}}
.hbcz-kolko.is-dzwonek{animation:hbcz-dzwonek .9s ease}
@keyframes hbcz-dzwonek{0%,100%{transform:none}20%{transform:rotate(-12deg) scale(1.08)}40%{transform:rotate(10deg) scale(1.08)}60%{transform:rotate(-6deg)}80%{transform:rotate(3deg)}}

/* ── podgląd wiadomości przy zamkniętym oknie ── */
.hbcz-podglad{position:fixed;right:max(16px,env(safe-area-inset-right));bottom:calc(var(--hbcz-dol,16px) + 66px + env(safe-area-inset-bottom));z-index:96;
  width:min(290px,calc(100vw - 32px));padding:11px 30px 11px 13px;border-radius:16px 16px 4px 16px;background:var(--hbcz-tlo);color:var(--hbcz-tekst);
  border:1px solid var(--hbcz-linia);box-shadow:0 10px 30px rgba(0,0,0,.35);cursor:pointer;animation:hbcz-wejscie .28s cubic-bezier(.2,.8,.2,1);box-sizing:border-box}
.hbcz-podglad[hidden]{display:none}
.hbcz-podglad-kto{font-size:12px;font-weight:700;color:var(--hbcz-zloto2);margin-bottom:2px}
[data-theme="light"] .hbcz-podglad-kto{color:#8a5f00}
.hbcz-podglad-tresc{font-size:14px;line-height:1.4;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}
.hbcz-podglad-x{position:absolute;top:4px;right:6px;width:24px;height:24px;border:0;background:transparent;color:var(--hbcz-slaby);font-size:18px;line-height:1;cursor:pointer;border-radius:6px}
.hbcz-podglad-x:hover{background:var(--hbcz-linia);color:var(--hbcz-tekst)}

/* ── okno ── */
.hbcz-okno{position:fixed;z-index:97;display:flex;flex-direction:column;background:var(--hbcz-tlo);color:var(--hbcz-tekst);overflow:hidden;
  inset:0;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  animation:hbcz-wejscie .25s cubic-bezier(.2,.8,.2,1)}
.hbcz-okno[hidden]{display:none}
@media (min-width:640px){.hbcz-okno{inset:auto;right:max(16px,env(safe-area-inset-right));bottom:calc(var(--hbcz-dol,16px) + 68px + env(safe-area-inset-bottom));
  width:380px;height:min(600px,calc(100vh - var(--hbcz-dol,16px) - 100px));height:min(600px,calc(100dvh - var(--hbcz-dol,16px) - 100px));padding:0;border-radius:18px;
  border:1px solid var(--hbcz-linia);box-shadow:0 18px 50px rgba(0,0,0,.45)}}
@keyframes hbcz-wejscie{from{opacity:0;transform:translateY(14px) scale(.98)}to{opacity:1;transform:none}}
.hbcz-glowa{display:flex;align-items:center;gap:10px;padding:10px 8px 10px 12px;background:var(--hbcz-granat);color:#fff;flex-shrink:0}
[data-theme="light"] .hbcz-glowa{background:#2a2218}
.hbcz-avatar{position:relative;flex-shrink:0;width:40px;height:40px}
.hbcz-avatar img{width:40px;height:40px;border-radius:50%;object-fit:cover;display:block;background:#334}
.hbcz-avatar .hbcz-online{width:12px;height:12px;border-width:2px;border-color:var(--hbcz-granat);right:-1px;bottom:0}
[data-theme="light"] .hbcz-avatar .hbcz-online{border-color:#2a2218}
.hbcz-glowa-tekst{flex:1;min-width:0}
.hbcz-tytul{margin:0;font-size:16px;font-weight:700;line-height:1.2;color:#fff}
.hbcz-status{margin:1px 0 0;font-size:12.5px;color:rgba(255,255,255,.72);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hbcz-status.is-pisze{color:#86efac}
.hbcz-przycisk{display:inline-flex;align-items:center;gap:6px;height:36px;min-width:36px;padding:0 9px;border:0;border-radius:10px;background:transparent;
  color:rgba(255,255,255,.82);cursor:pointer;font:600 12.5px 'Jost',sans-serif;flex-shrink:0}
.hbcz-przycisk svg{width:19px;height:19px;flex-shrink:0}
.hbcz-przycisk:hover{background:rgba(255,255,255,.1);color:#fff}
.hbcz-przycisk:focus-visible{outline:2px solid var(--hbcz-zloto2);outline-offset:1px}
.hbcz-x{padding:0;justify-content:center}
@media (max-width:379px){.hbcz-przycisk-napis{display:none}}
.hbcz-kto-odpisuje{margin:0;padding:6px 14px;font-size:11.5px;line-height:1.35;color:var(--hbcz-slaby);border-bottom:1px solid var(--hbcz-linia);background:var(--hbcz-tlo2);flex-shrink:0}

/* ── wiadomości ── */
.hbcz-lista{flex:1;overflow-y:auto;overscroll-behavior:contain;padding:14px 12px 8px;display:flex;flex-direction:column;gap:3px;-webkit-overflow-scrolling:touch}
.hbcz-pusto{margin:auto;display:flex;flex-direction:column;align-items:center;gap:3px;text-align:center;color:var(--hbcz-slaby);font-size:13px;padding:20px 0}
.hbcz-pusto img{width:72px;height:72px;border-radius:50%;object-fit:cover;margin-bottom:6px}
.hbcz-pusto strong{color:var(--hbcz-tekst);font-size:16px}
.hbcz-pusto[hidden]{display:none}
.hbcz-dzien{align-self:center;margin:10px 0 6px;font-size:11.5px;color:var(--hbcz-slaby)}
.hbcz-w{display:flex;align-items:flex-end;gap:7px;max-width:100%}
.hbcz-w.my{justify-content:flex-end}
.hbcz-w-av{width:28px;height:28px;flex-shrink:0;border-radius:50%;overflow:hidden;display:flex;align-items:center;justify-content:center;font-size:14px;
  background:var(--hbcz-dymek-oni);color:var(--hbcz-zloto2)}
.hbcz-w-av img{width:100%;height:100%;object-fit:cover}
.hbcz-w-av.puste{visibility:hidden}
.hbcz-w-kol{display:flex;flex-direction:column;min-width:0;max-width:calc(100% - 48px)}
.hbcz-w.my .hbcz-w-kol{align-items:flex-end;max-width:84%}
.hbcz-d{padding:8px 12px;border-radius:18px;font-size:14.5px;line-height:1.42;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word}
.hbcz-w.oni .hbcz-d{background:var(--hbcz-dymek-oni);color:var(--hbcz-tekst);border-bottom-left-radius:6px}
.hbcz-w.my .hbcz-d{background:var(--hbcz-dymek-my);color:var(--hbcz-dymek-my-t);border-bottom-right-radius:6px}
.hbcz-d a{color:inherit;text-decoration:underline;text-underline-offset:2px}
.hbcz-w.oni .hbcz-d a{color:var(--hbcz-zloto2)}
[data-theme="light"] .hbcz-w.oni .hbcz-d a{color:#7a5400}
.hbcz-podpis{font-size:11px;color:var(--hbcz-slaby);margin:2px 4px 0}
.hbcz-w.koniec-grupy{margin-bottom:8px}
.hbcz-w.nowa .hbcz-d{animation:hbcz-dymek .3s cubic-bezier(.2,.8,.2,1)}
@keyframes hbcz-dymek{from{opacity:0;transform:translateY(6px) scale(.97)}to{opacity:1;transform:none}}
.hbcz-w.wysylanie .hbcz-d{opacity:.6}
.hbcz-w.nieudana .hbcz-d{outline:1.5px solid #f87171}

/* ── animacja pisania ── */
.hbcz-pisze .hbcz-d{display:inline-flex;align-items:center;gap:4px;padding:12px 14px}
.hbcz-pisze i{width:7px;height:7px;border-radius:50%;background:var(--hbcz-slaby);display:block;animation:hbcz-kropki 1.25s infinite ease-in-out}
.hbcz-pisze i:nth-child(2){animation-delay:.16s}
.hbcz-pisze i:nth-child(3){animation-delay:.32s}
@keyframes hbcz-kropki{0%,60%,100%{transform:translateY(0);opacity:.45}30%{transform:translateY(-5px);opacity:1}}

/* ── pole pisania ── */
.hbcz-pole{display:flex;align-items:flex-end;gap:8px;padding:8px 10px 10px;border-top:1px solid var(--hbcz-linia);flex-shrink:0;background:var(--hbcz-tlo)}
.hbcz-pole textarea{flex:1;min-height:42px;max-height:132px;resize:none;border:1px solid var(--hbcz-linia);border-radius:21px;padding:10px 15px;
  background:var(--hbcz-tlo2);color:var(--hbcz-tekst);font:15px/1.4 'Jost','Segoe UI',system-ui,sans-serif;outline:none;box-sizing:border-box}
.hbcz-pole textarea::placeholder{color:var(--hbcz-slaby)}
.hbcz-pole textarea:focus{border-color:var(--hbcz-zloto)}
.hbcz-wyslij{width:42px;height:42px;flex-shrink:0;border-radius:50%;border:0;cursor:pointer;display:flex;align-items:center;justify-content:center;
  background:var(--hbcz-zloto);color:var(--hbcz-granat);transition:transform .15s,opacity .15s}
.hbcz-wyslij svg{width:20px;height:20px;margin-left:2px}
.hbcz-wyslij:disabled{opacity:.35;cursor:default}
.hbcz-wyslij:not(:disabled):hover{transform:scale(1.06)}
.hbcz-wyslij:focus-visible{outline:2px solid var(--hbcz-zloto2);outline-offset:2px}
.hbcz-blad{margin:0;padding:0 14px 10px;font-size:12.5px;color:#fca5a5}
[data-theme="light"] .hbcz-blad{color:#b91c1c}
.hbcz-blad[hidden]{display:none}

@media (prefers-reduced-motion:reduce){
  .hbcz-okno,.hbcz-podglad,.hbcz-w.nowa .hbcz-d,.hbcz-kolko.is-dzwonek{animation:none}
  .hbcz-pisze i{animation:hbcz-kropki-cicho 1.4s infinite}
  @keyframes hbcz-kropki-cicho{0%,100%{opacity:.35}50%{opacity:1}}
}
@media print{.hbcz{display:none!important}}
