/* Czat z predefiniowanymi pytaniami — jezyk wizualny przepisany z banera cookie
   (cookie-noraline.css): komiksowa ramka 2px, bursztynowy cien, Fraunces w tytulach,
   Szymon wychylony zza gornej krawedzi. Ladowany z assets.yaml -> footer_styles.
   Wszystko pod #nl-chat, zeby nie dotknac zadnego innego elementu strony. */

#nl-chat {
  position: fixed;
  right: 20px;
  bottom: 20px;
  /* Ponad trescia, ale PONIZEJ banera cookie (#cc-main ma 2147483647) — zgoda
     musi byc zawsze na wierzchu. Launcher i tak chowa sie, gdy baner wisi. */
  z-index: 2147483000;
  font-family: var(--font-sans);
  color: var(--nl-ink);
}

#nl-chat[hidden] { display: none !important; }

/* ---- Zwiniety launcher ----
   Szymon nie jest ikonka w kolku, tylko siedzi na przycisku: „siedzisko" wypada
   na gornej krawedzi pigulki, nogi zwisaja na jej tle, palec wskazuje w dol.
   Dlatego przycisk ma overflow:visible i zarezerwowany margines z prawej. */
.nl-chat-launcher {
  position: relative;
  display: flex;
  align-items: center;
  padding: 14px 96px 14px 22px;
  background: #fff;
  border: 2px solid var(--nl-ink);
  border-radius: 100px;
  box-shadow: -6px 6px 0 var(--nl-amber);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  color: var(--nl-ink);
  overflow: visible;
  transition: transform .12s ease, box-shadow .12s ease;
}

.nl-chat-launcher:hover {
  transform: translate(2px, -2px);
  box-shadow: -8px 8px 0 var(--nl-amber);
}

.nl-chat-launcher:active { transform: translate(0, 0); box-shadow: -4px 4px 0 var(--nl-amber); }

.nl-chat-launcher__szymon {
  position: absolute;
  right: 4px;
  /* stopy konczą sie tuz nad dolna krawedzia pigulki — reszta sylwetki wychodzi
     ponad przycisk, wiec calosc czyta sie jako „siedzi na nim" */
  bottom: 10px;
  width: 76px;
  height: 110px;
  background: url('../images/czat-szymon.png') no-repeat center bottom / contain;
  pointer-events: none;
}

.nl-chat-launcher:hover .nl-chat-launcher__szymon { animation: nl-chat-kiwanie .5s ease-in-out; }

@keyframes nl-chat-kiwanie {
  0%, 100% { transform: rotate(0deg); }
  35%      { transform: rotate(-3deg); }
  70%      { transform: rotate(2deg); }
}

/* ---- Panel ---- */
.nl-chat-panel {
  width: min(380px, calc(100vw - 32px));
  background: #fff;
  border: 2px solid var(--nl-ink);
  border-radius: 18px;
  box-shadow: -8px 8px 0 var(--nl-amber);
  /* Grafika Szymona wychyla sie nad panel — jak w banerze cookie */
  position: relative;
  overflow: visible;
  display: flex;
  flex-direction: column;
  max-height: min(560px, calc(100vh - 48px));
}

.nl-chat-panel::before {
  content: '';
  position: absolute;
  right: 16px;
  bottom: 100%;
  /* Przedramiona konczą się na dolnej krawedzi grafiki, wiec lekkie nasuniecie na ramke
     sprawia, ze Szymon opiera sie o panel, zamiast unosic nad nim. Poza siedzaca dziala
     tylko na waskiej pigulce launchera, ktora obejmuje nogami — na szerokiej krawedzi
     panelu wygladala jak zawieszona w powietrzu. */
  margin-bottom: -7px;
  width: 150px;
  height: 126px;
  background: url('../images/czat-szymon-panel.png') no-repeat center bottom / contain;
  pointer-events: none;
}

.nl-chat-panel__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 2px solid var(--nl-ink);
}

.nl-chat-panel__title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 560;
  letter-spacing: -.02em;
  margin: 0;
  line-height: 1.2;
}

.nl-chat-panel__sub {
  font-size: 13px;
  color: var(--nl-muted);
  margin: 4px 0 0;
  line-height: 1.4;
}

.nl-chat-close {
  margin-left: auto;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 2px solid var(--nl-ink);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 16px;
  line-height: 1;
  color: var(--nl-ink);
}

.nl-chat-close:hover { background: var(--color-secondary-light); }

.nl-chat-panel__body {
  /* Panel konczy sie teraz trescia, wiec dolny padding musi domykac zaokraglenie ramki */
  padding: 14px 16px 18px;
  border-radius: 0 0 16px 16px;
  overflow-y: auto;
  flex: 1 1 auto;
}

/* ---- Dymki ---- */
.nl-chat-bubble {
  max-width: 92%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.5;
  margin-bottom: 10px;
  border: 2px solid var(--nl-ink);
}

.nl-chat-bubble--bot { background: #faf8ff; border-bottom-left-radius: 4px; }

.nl-chat-bubble--user {
  background: var(--nl-amber);
  margin-left: auto;
  border-bottom-right-radius: 4px;
  font-weight: 600;
}

.nl-chat-bubble p { margin: 0 0 8px; }
.nl-chat-bubble p:last-child { margin-bottom: 0; }
.nl-chat-bubble a { color: var(--color-primary); font-weight: 600; }

/* ---- Opcje ---- */
.nl-chat-options { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

.nl-chat-option {
  text-align: left;
  padding: 10px 14px;
  background: #fff;
  border: 2px solid var(--nl-ink);
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--nl-ink);
  line-height: 1.35;
  transition: background .12s ease, transform .12s ease;
}

.nl-chat-option:hover { background: var(--color-secondary-light); transform: translateX(2px); }
.nl-chat-option--quiet { font-weight: 500; color: var(--nl-muted); border-style: dashed; }

/* ---- Formularz ---- */
.nl-chat-form { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }

.nl-chat-form label { font-size: 13px; font-weight: 600; display: block; margin-bottom: 4px; }

.nl-chat-form input[type="text"],
.nl-chat-form input[type="email"],
.nl-chat-form textarea {
  width: 100%;
  padding: 9px 12px;
  border: 2px solid var(--nl-ink);
  border-radius: 10px;
  font: inherit;
  font-size: 14.5px;
  background: #fff;
  color: var(--nl-ink);
}

.nl-chat-form textarea { resize: vertical; min-height: 84px; }

.nl-chat-form input:focus-visible,
.nl-chat-form textarea:focus-visible,
.nl-chat-option:focus-visible,
.nl-chat-close:focus-visible,
.nl-chat-launcher:focus-visible,
.nl-chat-submit:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

.nl-chat-consent { display: flex; gap: 8px; font-size: 12.5px; line-height: 1.45; color: var(--nl-muted); }
.nl-chat-consent input { margin-top: 2px; flex: 0 0 auto; width: 16px; height: 16px; }
.nl-chat-consent a { color: var(--color-primary); }

.nl-chat-submit {
  padding: 11px 18px;
  background: var(--nl-amber);
  border: 2px solid var(--nl-ink);
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  color: var(--nl-ink);
  cursor: pointer;
}

.nl-chat-submit:hover { background: #ffb63f; }
.nl-chat-submit[disabled] { opacity: .6; cursor: progress; }

.nl-chat-error {
  font-size: 13px;
  color: #a3160f;
  background: #fff2f1;
  border: 2px solid #a3160f;
  border-radius: 10px;
  padding: 8px 12px;
}

/* Honeypot — poza ekranem, nie display:none (czesc botow pomija ukryte pola) */
.nl-chat-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@media screen and (max-width: 640px) {
  #nl-chat { right: 12px; bottom: 12px; left: 12px; }
  .nl-chat-launcher { margin-left: auto; padding-right: 84px; }
  .nl-chat-launcher__szymon { width: 66px; height: 96px; }
  .nl-chat-panel { width: 100%; max-height: min(72vh, calc(100vh - 90px)); box-shadow: -6px 6px 0 var(--nl-amber); }
  .nl-chat-panel::before { right: 10px; width: 118px; height: 99px; margin-bottom: -6px; }
}

@media (prefers-reduced-motion: reduce) {
  .nl-chat-launcher, .nl-chat-option { transition: none; }
  .nl-chat-launcher:hover, .nl-chat-option:hover { transform: none; }
}

/* Alpine podnosi sie z `defer`, wiec bez tego panel mignalby rozwiniety przy kazdym wejsciu */
[x-cloak] { display: none !important; }

/* Etykieta widoczna tylko dla czytnikow ekranu — pole imienia ma placeholder
   z tekstem scenariusza, wiec etykieta nad nim dublowalaby to samo zdanie. */
.nl-chat-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Gdy wszystkie pytania z tego wezla zostaly juz zadane */
.nl-chat-wyczerpane {
  font-size: 13.5px;
  color: var(--nl-muted);
  line-height: 1.45;
  margin: 4px 0 0;
}
