/* quiz-chat.css
 * Widget quiz-czatu do zbierania leadów na landingu.
 * Spec 1:1 z nagrania: docs/landing-page/spec-quiz-chat-leadtok-nagranie-2026-09-07.md
 * Tokeny z sekcji 11 specu (żółć wiodąca, beż dymków, zieleń tylko na checku).
 */

.qc-page {
  margin: 0;
  background: #ffffff;
  color: #111111;
  font-family: "Satoshi", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.qc-wrap {
  max-width: 800px;
  margin: 0 auto;
  padding: 48px 16px 140px;
}

.qc-foot {
  margin: 16px 0 0;
  text-align: center;
  font-size: 12px;
  color: #9a9a9a;
}

/* ---------- karta widgetu ---------- */

.qc {
  --qc-yellow: #f8c845;
  --qc-yellow-soft: #fff5cf;
  --qc-yellow-wash: #fdf3d6;
  --qc-ai: #f1f1ef;
  --qc-tray: #f5f4f0;
  --qc-cream: #fbf8ef;
  --qc-ink: #111111;
  --qc-ink-2: #6b6b6b;
  --qc-ink-3: #9a9a9a;
  --qc-line: #e9e8e4;
  --qc-green: #22c55e;
  --qc-radius: 28px;
  --qc-ease: cubic-bezier(0.16, 1, 0.3, 1);

  position: relative;
  display: flex;
  flex-direction: column;
  height: min(78vh, 760px);
  min-height: 520px;
  background: #ffffff;
  border: 1px solid #ededeb;
  border-radius: var(--qc-radius);
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.03),
    0 24px 60px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  font-family: inherit;
}

.qc [hidden] {
  display: none !important;
}

/* ---------- feed (strumień rozmowy) ---------- */

.qc-feed {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 28px 32px 20px;
}

/* ---------- dymki ---------- */

.qc-row {
  display: flex;
  margin: 0 0 10px;
}

.qc-row.qc-left {
  justify-content: flex-start;
}

.qc-row.qc-right {
  justify-content: flex-end;
}

.qc-bubble {
  width: max-content;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border-radius: 24px;
  padding: 12px 18px;
  font-size: 16px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.qc-ai {
  background: var(--qc-ai);
  color: var(--qc-ink);
}

.qc-user {
  background: var(--qc-yellow);
  color: #ffffff;
}

/* Kropki żyją W dymku: ten sam node przechodzi dots -> morph -> typing -> done. */
.qc-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 1.45em;
  margin-left: 3px;
  vertical-align: top;
}

.qc-bubble[data-state="dots"] .qc-dots {
  margin-left: 0;
}

.qc-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8b8b8b;
  animation: qc-pulse 1s ease-in-out infinite;
}

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

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

.qc-bubble[data-state="typing"] .qc-dots,
.qc-bubble[data-state="done"] .qc-dots {
  display: none;
}

@keyframes qc-pulse {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

/* ---------- taca + karty ---------- */

.qc-tray {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 6px 0 14px;
  padding: 12px;
  background: var(--qc-tray);
  border-radius: 22px;
  opacity: 0;
  transform: scale(0.97);
}

.qc-tray.is-in {
  animation: qc-pop 400ms var(--qc-ease) forwards;
}

@keyframes qc-pop {
  to {
    opacity: 1;
    transform: none;
  }
}

/*
 * Trzy stany karty: spoczynek to delikatna poświata marki, najechanie i wybór
 * to pełny kolor. Napis wszędzie czarny, bo biały na żółtym ledwo czytelny.
 * Biała kostka ikony trzyma się we wszystkich stanach; zmienia się tylko tło.
 */
.qc-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 22px 12px 20px;
  background: var(--qc-yellow-wash);
  border: 1px solid transparent;
  border-radius: 16px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--qc-ink);
  text-align: center;
  cursor: pointer;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    color 250ms ease;
}

.qc-card:hover,
.qc-card.is-selected {
  background: var(--qc-yellow);
  border-color: var(--qc-yellow);
  color: var(--qc-ink);
}

.qc-card:focus-visible {
  outline: 2px solid var(--qc-ink);
  outline-offset: 2px;
}

.qc-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #ffffff;
  color: var(--qc-yellow);
  transition:
    background 250ms ease,
    color 250ms ease,
    opacity 300ms ease;
}

.qc-icon svg {
  width: 22px;
  height: 22px;
}

/* Niewybrana po decyzji: zostaje czytelna, ale wychodzi z żółtej rodziny. */
.qc-card.is-dim {
  background: #edece7;
  border-color: transparent;
  color: #8c8c88;
}

.qc-card.is-dim .qc-icon {
  background: #ffffff;
  opacity: 0.45;
}

.qc-tray.is-locked .qc-card {
  pointer-events: none;
  cursor: default;
}

.qc-check {
  position: absolute;
  top: -9px;
  right: -9px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--qc-green);
  color: var(--qc-green);
  box-sizing: border-box;
  transform: scale(0);
  transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.qc-check svg {
  width: 14px;
  height: 14px;
}

.qc-card.is-selected .qc-check {
  transform: scale(1);
}

.qc-caption {
  margin: 4px 0 6px;
  text-align: center;
  font-size: 12px;
  color: var(--qc-ink-3);
}

/* ---------- composer (sticky na dole karty) ---------- */

.qc-composer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 14px 20px 16px;
  border-top: 1px solid var(--qc-line);
  background: #ffffff;
}

.qc-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 13px 20px;
  border: 2px solid var(--qc-line);
  border-radius: 999px;
  background: #f7f7f6;
  font: inherit;
  font-size: 16px;
  color: var(--qc-ink);
  outline: none;
  transition: border-color 180ms ease;
}

.qc-input::placeholder {
  color: var(--qc-ink-3);
}

.qc-input:focus {
  border-color: var(--qc-yellow);
}

.qc-send {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--qc-yellow-soft);
  color: var(--qc-yellow);
  cursor: pointer;
  transition:
    background 180ms ease,
    color 180ms ease;
}

.qc-send svg {
  width: 20px;
  height: 20px;
}

.qc-send:hover:not(:disabled) {
  background: var(--qc-yellow);
  color: #ffffff;
}

.qc-send .qc-spin {
  display: none;
}

.qc-send.is-busy {
  cursor: default;
}

.qc-send.is-busy .qc-plane {
  display: none;
}

.qc-send.is-busy .qc-spin {
  display: block;
  animation: qc-rot 800ms linear infinite;
}

@keyframes qc-rot {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- panel telefonu ---------- */

.qc-phone {
  margin: 6px 0 14px;
  padding: 24px 20px 20px;
  background: var(--qc-cream);
  border-radius: 24px;
  text-align: center;
  opacity: 0;
  transform: translateY(12px);
}

.qc-phone.is-in {
  animation: qc-rise 400ms var(--qc-ease) forwards;
}

@keyframes qc-rise {
  to {
    opacity: 1;
    transform: none;
  }
}

.qc-phone h3 {
  margin: 0 0 18px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--qc-ink);
}

.qc-digits {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.qc-digit {
  width: 38px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--qc-line);
  border-radius: 12px;
  background: #ffffff;
  font: inherit;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  color: var(--qc-ink);
  caret-color: var(--qc-ink);
  outline: none;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.qc-digit:focus {
  border-color: var(--qc-yellow);
  box-shadow: 0 0 0 1px var(--qc-yellow);
}

.qc-digit:disabled {
  color: var(--qc-ink-2);
  background: #faf8f3;
}

.qc-phone-send {
  display: none;
  align-items: center;
  margin-top: 16px;
  padding: 12px 22px;
  border: 0;
  border-radius: 999px;
  background: var(--qc-yellow);
  color: #ffffff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 180ms ease;
}

.qc-phone.is-complete .qc-phone-send {
  display: inline-flex;
}

.qc-phone-send:disabled {
  opacity: 0.6;
  cursor: default;
}

.qc-phone-note {
  margin: 14px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--qc-ink-3);
}

/* ---------- mobile ---------- */

@media (max-width: 640px) {
  .qc-wrap {
    padding: 16px 10px 80px;
  }

  .qc {
    height: min(86svh, 760px);
  }

  .qc-feed {
    padding: 28px 16px 16px;
  }

  .qc-tray {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .qc-card {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px 14px;
    text-align: left;
  }

  .qc-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
  }

  .qc-digits {
    gap: 5px;
  }

  .qc-digit {
    width: 30px;
    height: 42px;
    border-radius: 9px;
    font-size: 16px;
  }
}
