/*
 * Asystent Neo — pływający przycisk, panel rozmowy, karty.
 *
 * Tokeny koloru i typografii są te same, co reszta witryny (styles.css:
 * --ink, --brand, --paper, --line, --muted, --display, --body, --ease).
 * Arkusz jest osobny, bo widget stoi na KAŻDEJ stronie i nie należy do
 * żadnej sekcji — a jego reguły nie mogą przeciekać do treści (prefiks
 * `neo-` na każdej klasie).
 */
.neo {
  --neo-szer: 400px;
  --neo-wys: min(680px, calc(100dvh - 48px));
  --neo-cien: 0 18px 60px rgba(25, 26, 36, 0.18), 0 4px 12px rgba(25, 26, 36, 0.08);
  font-family: var(--body, 'Plus Jakarta Sans', system-ui, sans-serif);
  color: var(--ink, #191a24);
  line-height: 1.5;
}

.neo[hidden] {
  display: none;
}

/* ——— przycisk ——— */
.neo-przycisk {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 50%;
  background: var(--brand, #f26c51);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--neo-cien), 0 0 0 6px rgba(242, 108, 81, 0.12);
  transition: transform 0.2s var(--ease, ease), background 0.2s;
}

.neo-przycisk:hover {
  transform: translateY(-2px) scale(1.04);
  background: var(--brand-hover, #df5940);
}

.neo-przycisk:focus-visible {
  outline: 3px solid var(--ink, #191a24);
  outline-offset: 3px;
}

.neo-przycisk .neo-ikona-zamknij {
  display: none;
}

.neo[data-otwarty] .neo-przycisk .neo-ikona-czat {
  display: none;
}

.neo[data-otwarty] .neo-przycisk .neo-ikona-zamknij {
  display: block;
}

/* ——— dymek zachęty ——— */
.neo-dymek {
  position: fixed;
  right: 96px;
  bottom: 34px;
  z-index: 90;
  max-width: 260px;
  padding: 12px 36px 12px 16px;
  border-radius: 14px 14px 4px 14px;
  background: #fff;
  box-shadow: var(--neo-cien);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  animation: neo-wejscie 0.3s var(--ease, ease);
}

.neo-dymek p {
  margin: 0;
}

.neo-dymek-zamknij {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: var(--paper, #f7f8fc);
  color: var(--muted, #626470);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ——— panel ——— */
.neo-panel {
  position: fixed;
  right: 24px;
  bottom: 96px;
  z-index: 95;
  width: min(var(--neo-szer), calc(100vw - 48px));
  height: var(--neo-wys);
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line, #dedfe7);
  border-radius: var(--radius, 20px);
  box-shadow: var(--neo-cien);
  overflow: hidden;
  animation: neo-wejscie 0.26s var(--ease, ease);
}

.neo-panel[hidden] {
  display: none;
}

.neo-naglowek {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 14px 18px;
  border-bottom: 1px solid var(--line, #dedfe7);
  background: #fff;
}

.neo-awatar {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand, #f26c51);
  color: #fff;
  font-family: var(--display, 'Outfit', sans-serif);
  font-weight: 600;
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.neo-awatar-duzy {
  width: 42px;
  height: 42px;
  font-size: 1.25rem;
  box-shadow: 0 0 0 4px var(--brand-soft, #fff1ec);
}

.neo-kto {
  flex: 1;
  min-width: 0;
}

.neo-tytul {
  margin: 0;
  font-family: var(--display, 'Outfit', sans-serif);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.neo-plakietka {
  font-family: var(--body, sans-serif);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--brand-soft, #fff1ec);
  color: var(--brand-ink, #b83f28);
}

.neo-status {
  margin: 2px 0 0;
  font-size: 0.75rem;
  color: var(--muted, #626470);
  display: flex;
  align-items: center;
  gap: 6px;
}

.neo-kropka {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2fb673;
  display: inline-block;
}

.neo-akcje {
  display: flex;
  gap: 2px;
}

.neo-akcje button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted, #626470);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.neo-akcje button:hover {
  background: var(--paper, #f7f8fc);
  color: var(--ink, #191a24);
}

.neo-akcje button:focus-visible,
.neo-chip:focus-visible,
.neo-wyslij:focus-visible,
.neo-nawigacja-zostan:focus-visible,
.neo-nawigacja-przejdz:focus-visible,
.neo-karta-link:focus-visible {
  outline: 2px solid var(--brand-ink, #b83f28);
  outline-offset: 2px;
}

.neo-kontekst {
  margin: 0;
  padding: 8px 18px;
  font-size: 0.75rem;
  color: var(--brand-ink, #b83f28);
  background: var(--brand-soft, #fff1ec);
  border-bottom: 1px solid var(--line, #dedfe7);
}

.neo-kontekst[hidden] {
  display: none;
}

/* ——— log ——— */
.neo-log {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 8px;
  background: linear-gradient(180deg, var(--paper, #f7f8fc), #fff 200px);
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.neo-wiadomosc {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 12px;
  animation: neo-wejscie 0.25s var(--ease, ease);
}

.neo-user {
  justify-content: flex-end;
}

.neo-dymek-tresc {
  max-width: 84%;
  font-size: 0.9375rem;
  padding: 10px 14px;
  border-radius: 16px;
  overflow-wrap: anywhere;
}

.neo-bot .neo-dymek-tresc {
  background: #fff;
  border: 1px solid var(--line, #dedfe7);
  border-bottom-left-radius: 4px;
}

.neo-user .neo-dymek-tresc {
  background: var(--ink, #191a24);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.neo-tresc p,
.neo-tresc ul {
  margin: 0 0 0.6em;
}

.neo-tresc > :last-child {
  margin-bottom: 0;
}

.neo-tresc ul {
  padding-left: 1.2em;
}

.neo-tresc strong {
  color: var(--brand-ink, #b83f28);
  font-weight: 700;
}

.neo-user .neo-tresc strong {
  color: #fff;
}

.neo-tresc a {
  color: var(--brand-ink, #b83f28);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.neo-strumien p::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 1em;
  margin-left: 2px;
  vertical-align: -0.15em;
  background: var(--brand, #f26c51);
  animation: neo-kursor 1s steps(2) infinite;
}

.neo-kropki {
  display: inline-flex;
  gap: 4px;
  padding: 4px 2px;
}

.neo-kropki i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted, #626470);
  animation: neo-skok 1.2s infinite;
}

.neo-kropki i:nth-child(2) {
  animation-delay: 0.15s;
}

.neo-kropki i:nth-child(3) {
  animation-delay: 0.3s;
}

/* ——— karty szkoleń ——— */
.neo-karty {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.neo-karta {
  border: 1px solid var(--line, #dedfe7);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--paper, #f7f8fc);
  display: grid;
  gap: 3px;
}

.neo-karta-glowa {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.neo-karta-kod {
  font-family: var(--display, 'Outfit', sans-serif);
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  color: var(--brand-ink, #b83f28);
}

.neo-karta-poziom {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted, #626470);
}

.neo-karta-nazwa {
  margin: 0;
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.35;
}

.neo-karta-meta,
.neo-karta-termin {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted, #626470);
}

.neo-karta-link,
.neo-nawigacja-przejdz {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 9px;
  background: var(--ink, #191a24);
  color: #fff !important;
  font-size: 0.8125rem;
  font-weight: 700;
  text-decoration: none !important;
  width: fit-content;
  transition: background 0.2s, transform 0.2s;
}

.neo-karta-link:hover,
.neo-nawigacja-przejdz:hover {
  background: var(--brand, #f26c51);
  transform: translateY(-1px);
}

/* ——— karta nawigacji ——— */
.neo-nawigacja {
  position: relative;
  margin-top: 10px;
  padding: 12px 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--brand, #f26c51);
  background: var(--brand-soft, #fff1ec);
  overflow: hidden;
}

.neo-nawigacja-tytul {
  margin: 0 0 8px;
  font-size: 0.875rem;
  font-weight: 600;
}

.neo-nawigacja-licznik {
  font-weight: 400;
  color: var(--brand-ink, #b83f28);
}

.neo-nawigacja-akcje {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.neo-nawigacja-akcje .neo-nawigacja-przejdz {
  margin-top: 0;
}

.neo-nawigacja-zostan {
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--ink, #191a24);
  border-radius: 9px;
  background: #fff;
  color: var(--ink, #191a24);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
}

.neo-nawigacja-pasek {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 4px;
  width: 100%;
  background: var(--brand, #f26c51);
  transform-origin: left;
  animation: neo-pasek 4s linear forwards;
}

/* ——— podpowiedzi ——— */
.neo-podpowiedzi {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 10px;
}

.neo-podpowiedzi[hidden] {
  display: none;
}

.neo-chip {
  border: 1px solid var(--line, #dedfe7);
  border-radius: 18px;
  background: #fff;
  color: var(--ink, #191a24);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 7px 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.neo-chip:hover {
  border-color: var(--brand, #f26c51);
  background: var(--brand-soft, #fff1ec);
  transform: translateY(-1px);
}

/* ——— Turnstile: pusty = 0 px; przy widocznym wyzwaniu wchodzi w układ nad polem ——— */
.neo-turnstile {
  padding: 0 14px;
  display: flex;
  justify-content: center;
}

.neo-turnstile:empty {
  display: none;
}

/* ——— formularz ——— */
.neo-formularz {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 0 14px;
  padding: 6px 6px 6px 14px;
  border: 1.5px solid var(--line, #dedfe7);
  border-radius: 14px;
  background: #fff;
  transition: border-color 0.15s;
}

.neo-formularz:focus-within {
  border-color: var(--brand, #f26c51);
}

.neo-pole {
  flex: 1;
  min-width: 0;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--ink, #191a24);
  padding: 8px 0;
  max-height: 140px;
  line-height: 1.4;
}

.neo-pole::placeholder {
  color: var(--muted, #626470);
}

.neo-wyslij {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: var(--brand, #f26c51);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.15s;
}

.neo-wyslij:hover:not(:disabled) {
  background: var(--brand-hover, #df5940);
}

.neo-wyslij:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.neo-disclaimer {
  margin: 8px 16px 12px;
  font-size: 0.6875rem;
  line-height: 1.45;
  color: var(--muted, #626470);
}

.neo-disclaimer a {
  color: inherit;
  text-decoration: underline;
}

/* ——— animacje ——— */
@keyframes neo-wejscie {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes neo-skok {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@keyframes neo-kursor {
  50% {
    opacity: 0;
  }
}

@keyframes neo-pasek {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

/* ——— karta filtrow (Neo ustawil filtry katalogu na miejscu) ——— */
.neo-filtry {
  border-color: var(--line, #dedfe7);
  background: var(--paper, #f7f7f9);
}

.neo-filtry-wynik {
  margin: -4px 0 10px;
  font-size: 0.8125rem;
  color: var(--muted, #6b6d7a);
}

.neo-filtry-pokaz {
  border: 0;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
}

.neo-nawigacja-zostan:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ——— telefon: panel na całą wysokość, klawiatura nie chowa pola (100dvh) ——— */
@media (max-width: 640px) {
  .neo-panel {
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    border: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .neo[data-otwarty] .neo-przycisk {
    display: none;
  }

  .neo-przycisk {
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
  }

  .neo-dymek {
    right: 88px;
    bottom: calc(26px + env(safe-area-inset-bottom));
    max-width: calc(100vw - 112px);
  }

  .neo-dymek-tresc {
    max-width: 90%;
  }

  body.neo-otwarty {
    overflow: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  .neo-przycisk,
  .neo-panel,
  .neo-wiadomosc,
  .neo-dymek,
  .neo-chip,
  .neo-karta-link,
  .neo-nawigacja-przejdz {
    animation: none;
    transition: none;
  }

  .neo-kropki i,
  .neo-strumien p::after {
    animation: none;
  }

  .neo-nawigacja-pasek {
    display: none;
  }
}
