/**
 * Dynamite AI Chat — widget i kafle. Kolor akcentu: --dsac-accent (konfiguracja).
 * @author Dynamite Studio
 */
.dsac {
  --dsac-accent: #1f6feb;
  --dsac-bg: #ffffff;
  --dsac-soft: #f3f5f8;
  --dsac-line: #dde2e9;
  --dsac-text: #1d2430;
  --dsac-muted: #5f6b7a;
  --dsac-radius: 14px;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9990;
  font-size: 15px;
  line-height: 1.45;
  color: var(--dsac-text);
}
.dsac--left { right: auto; left: 20px; }
.dsac *, .dsac *::before, .dsac *::after { box-sizing: border-box; }
.dsac-ic, .dsac-ic svg { display: inline-flex; width: 20px; height: 20px; }

.dsac-launcher {
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--dsac-accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(16, 24, 40, .25);
  transition: transform .15s ease;
}
.dsac-launcher:hover { transform: scale(1.05); }
/* 1.3.3: ikona konsultanta z plakietką „AI” i napis obok (przycisk w kształcie pigułki). */
.dsac-launcher__ic { position: relative; display: inline-flex; }
.dsac-launcher__ai {
  position: absolute; top: -7px; right: -11px;
  padding: 1px 4px; border-radius: 6px;
  background: #fff; color: var(--dsac-accent);
  font-size: 10px; font-weight: 700; line-height: 1.2; letter-spacing: .02em;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .3);
}
.dsac-launcher--caption {
  width: auto; padding: 0 20px 0 14px; gap: 14px; border-radius: 29px;
}
/* Bez transformacji na przycisku z napisem: skalowanie i przesunięcie rozmywały tekst (uwaga 30.10). */
.dsac-launcher--caption, .dsac-launcher--caption:hover { transform: none; }
.dsac-launcher--caption:hover { box-shadow: 0 8px 24px rgba(16, 24, 40, .32); }
.dsac-launcher__txt { font-size: 16px; font-weight: 400; line-height: 1.2; letter-spacing: .01em; white-space: nowrap; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
.dsac-launcher:focus-visible, .dsac button:focus-visible, .dsac a:focus-visible, .dsac textarea:focus-visible, .dsac input:focus-visible {
  outline: 3px solid var(--dsac-accent); outline-offset: 2px;
}
.dsac.is-open .dsac-launcher { display: none; }
.dsac.is-blocked { display: none; }

.dsac-panel {
  position: absolute; bottom: 0; right: 0;
  width: 440px; height: min(720px, calc(100vh - 40px));
  display: flex; flex-direction: column;
  background: var(--dsac-bg); border-radius: var(--dsac-radius);
  box-shadow: 0 16px 48px rgba(16, 24, 40, .28); overflow: hidden;
}
.dsac--left .dsac-panel { right: auto; left: 0; }
.dsac-panel[hidden] { display: none; }

.dsac-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px;
  background: var(--dsac-accent); color: #fff;
}
.dsac-head__name { flex: 1; font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsac-avatar { position: relative; width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 255, 255, .2); display: flex; align-items: center; justify-content: center; }
.dsac-avatar .dsac-ic, .dsac-avatar .dsac-ic svg { width: 24px; height: 24px; }
.dsac-avatar .dsac-launcher__ai { top: -4px; right: -8px; font-size: 9px; }
.dsac-iconbtn {
  border: 0; background: transparent; color: inherit; cursor: pointer;
  width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.dsac-head .dsac-iconbtn:hover { background: rgba(255, 255, 255, .18); }

.dsac-tabs { display: flex; border-bottom: 1px solid var(--dsac-line); }
.dsac-tab { flex: 1; border: 0; background: none; padding: 10px; cursor: pointer; font-weight: 600; color: var(--dsac-muted); border-bottom: 2px solid transparent; }
.dsac-tab.is-active { color: var(--dsac-text); border-bottom-color: var(--dsac-accent); }

.dsac-log, .dsac-tasks { flex: 1; overflow-y: auto; padding: 14px; background: var(--dsac-soft); overscroll-behavior: contain; }
.dsac-log[hidden], .dsac-tasks[hidden], .dsac-foot[hidden] { display: none; }
.dsac-msg { display: flex; flex-direction: column; margin-bottom: 12px; }
.dsac-msg--user { align-items: flex-end; }
.dsac-bubble {
  max-width: 88%; padding: 9px 13px; border-radius: 14px; background: #fff; border: 1px solid var(--dsac-line);
  word-wrap: break-word; overflow-wrap: anywhere;
}
.dsac-msg--user .dsac-bubble { background: var(--dsac-accent); border-color: var(--dsac-accent); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.dsac-msg--bot .dsac-bubble { border-bottom-left-radius: 4px; }
.dsac-bubble p { margin: 0 0 6px; }
.dsac-bubble p:last-child { margin-bottom: 0; }
.dsac-bubble ul { margin: 4px 0 6px; padding-left: 18px; }
.dsac-bubble a { color: var(--dsac-accent); text-decoration: underline; }
.dsac-msg__tools { display: flex; gap: 2px; margin-top: 2px; color: var(--dsac-muted); align-items: center; }
.dsac-msg__tools .dsac-iconbtn { width: 30px; height: 30px; }
.dsac-msg__tools .dsac-iconbtn:hover { background: #e7ebf0; color: var(--dsac-text); }
.dsac-thanks { font-size: 12px; padding-left: 6px; }
.dsac-login { margin-top: 6px; align-self: flex-start; font-weight: 600; color: var(--dsac-accent); }

.dsac-typing .dsac-bubble { display: inline-flex; gap: 4px; padding: 12px 14px; width: auto; }
.dsac-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--dsac-muted); animation: dsac-dot 1s infinite ease-in-out; }
.dsac-typing span:nth-child(2) { animation-delay: .15s; }
.dsac-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes dsac-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.dsac-cards { display: flex; gap: 10px; overflow-x: auto; padding: 8px 2px 4px; scroll-snap-type: x mandatory; max-width: 100%; }
.dsac-card {
  flex: 0 0 160px; scroll-snap-align: start; background: #fff; border: 1px solid var(--dsac-line); border-radius: 12px;
  padding: 8px; display: flex; flex-direction: column; gap: 4px; font-size: 13px;
}
.dsac-card__img { display: block; aspect-ratio: 1 / 1; border-radius: 8px; overflow: hidden; background: var(--dsac-soft); }
.dsac-card__img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.dsac-card__noimg { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; color: var(--dsac-muted); }
.dsac-card__name { color: var(--dsac-text); font-weight: 600; text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.dsac-card__price strong { font-size: 15px; }
.dsac-card__price s { color: var(--dsac-muted); margin-left: 6px; }
.dsac-card__stock { font-size: 12px; color: #1a7f37; }
.dsac-card__stock--backorder { color: #9a6700; }
.dsac-card__stock--out_of_stock { color: #b42318; }
.dsac-card__actions { display: flex; flex-direction: column; gap: 4px; margin-top: auto; }
.dsac-card__add {
  border: 0; border-radius: 8px; padding: 7px 8px; background: var(--dsac-accent); color: #fff; cursor: pointer; font-weight: 600; font-size: 13px;
}
.dsac-card__add.is-added { background: #1a7f37; }
.dsac-card__add:disabled { opacity: .85; cursor: default; }
.dsac-card__view { text-align: center; color: var(--dsac-accent); font-size: 13px; padding: 3px; }

.dsac-foot { border-top: 1px solid var(--dsac-line); background: #fff; padding: 8px 10px 10px; }
.dsac-status { font-size: 12px; color: var(--dsac-muted); min-height: 0; }
.dsac-status:not(:empty) { margin-bottom: 6px; }
.dsac-compose { display: flex; align-items: flex-end; gap: 6px; }
.dsac-input {
  flex: 1; resize: none; border: 1px solid var(--dsac-line); border-radius: 12px; padding: 9px 12px; font: inherit; line-height: 1.45;
  min-height: calc(2 * 1.45em + 20px); max-height: 160px; overflow-y: hidden;
  color: var(--dsac-text); background: #fff;
}
.dsac-send {
  border: 0; width: 40px; height: 40px; border-radius: 50%; background: var(--dsac-accent); color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.dsac-send:disabled { opacity: .5; cursor: default; }
.dsac-mic, .dsac-stopaudio { color: var(--dsac-muted); width: 40px; height: 40px; flex: 0 0 auto; }
.dsac-mic:hover, .dsac-stopaudio:hover { background: var(--dsac-soft); }
.dsac-mic.is-recording { background: #d92d20; color: #fff; animation: dsac-pulse 1.2s infinite; }
@keyframes dsac-pulse { 0% { box-shadow: 0 0 0 0 rgba(217, 45, 32, .5); } 100% { box-shadow: 0 0 0 12px rgba(217, 45, 32, 0); } }
.dsac-foot__links { margin-top: 6px; text-align: center; }
.dsac-link { border: 0; background: none; color: var(--dsac-accent); cursor: pointer; font-size: 13px; text-decoration: underline; padding: 4px; }

.dsac-handoff { background: #fff; border: 1px solid var(--dsac-line); border-radius: 12px; padding: 12px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.dsac-handoff__title { font-weight: 700; }
.dsac-handoff__intro { margin: 0; color: var(--dsac-muted); font-size: 13px; }
.dsac-handoff label { display: flex; flex-direction: column; gap: 3px; }
.dsac-handoff input[type="text"], .dsac-handoff input[type="email"], .dsac-handoff textarea {
  border: 1px solid var(--dsac-line); border-radius: 8px; padding: 7px 9px; font: inherit;
}
.dsac-handoff .dsac-handoff__consent { flex-direction: row; align-items: flex-start; gap: 8px; font-size: 12px; color: var(--dsac-muted); }
.dsac-handoff__err { color: #b42318; font-size: 13px; }
.dsac-handoff__err:empty { display: none; }
.dsac-handoff__send { border: 0; border-radius: 8px; padding: 9px; background: var(--dsac-accent); color: #fff; font-weight: 600; cursor: pointer; }

.dsac-note { margin: 4px 2px 0; font-size: 12px; color: var(--dsac-muted); max-width: 88%; }
.dsac-memory__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.dsac-memory__list { list-style: none; margin: 0 0 12px; padding: 0; }
.dsac-memory__item { display: flex; justify-content: space-between; gap: 8px; align-items: center; background: #fff; border: 1px solid var(--dsac-line); border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; }
.dsac-memory__empty, .dsac-memory__status { color: var(--dsac-muted); font-size: 13px; }
.dsac-memory__all { width: 100%; }

/* Kafle zadań (widget, strona /asystent, hook motywu) */
.dsac-tasks__intro { margin: 0 0 10px; color: var(--dsac-muted); }
.dsac-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.dsac-tile {
  --dsac-tile: var(--dsac-accent, #1f6feb);
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left;
  border: 1px solid #dde2e9; border-radius: 14px; background: #fff; padding: 14px; cursor: pointer; color: #1d2430;
  transition: border-color .15s ease, box-shadow .15s ease; font: inherit;
}
.dsac-tile:hover { border-color: var(--dsac-tile); box-shadow: 0 4px 14px rgba(16, 24, 40, .08); }
.dsac-tile__icon { display: inline-flex; width: 38px; height: 38px; border-radius: 10px; align-items: center; justify-content: center; color: var(--dsac-tile); background: color-mix(in srgb, var(--dsac-tile) 12%, #fff); }
.dsac-tile__icon svg { width: 22px; height: 22px; }
.dsac-tile__title { font-weight: 700; font-size: 15px; line-height: 1.25; }
.dsac-tile__desc { font-size: 13px; color: #5f6b7a; line-height: 1.35; }
.dsac-tile--free { background: #f3f5f8; }
.dsac-tiles-block { margin: 24px 0; }
.dsac-tiles-block__title { margin-bottom: 14px; }
.dsac-tiles-block .dsac-tiles { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.dsac-page__intro { margin-bottom: 8px; }

.dsac-q { display: flex; flex-direction: column; gap: 12px; }
.dsac-q__task { display: flex; align-items: center; gap: 10px; }
.dsac-q__label { font-weight: 600; font-size: 16px; }
.dsac-q__opts { display: flex; flex-wrap: wrap; gap: 8px; }
.dsac-q__opt {
  border: 1px solid var(--dsac-accent); color: var(--dsac-accent); background: #fff; border-radius: 999px; padding: 8px 14px; cursor: pointer; font: inherit;
}
.dsac-q__opt:hover { background: var(--dsac-accent); color: #fff; }
.dsac-q__input { border: 1px solid var(--dsac-line); border-radius: 10px; padding: 9px 12px; font: inherit; }
.dsac-q__next { align-self: flex-start; border: 0; border-radius: 10px; padding: 9px 18px; background: var(--dsac-accent); color: #fff; font-weight: 600; cursor: pointer; }
.dsac-q__nav { display: flex; justify-content: space-between; }

/* 1.2.1: pełny ekran na komputerze (przycisk w nagłówku), okno wyśrodkowane nad przyciemnionym tłem. */
/* 1.2.3: tło tylko przy otwartym oknie - po zamknięciu klasa is-full zostaje (zapamiętany wybór), a tło przykrywało stronę. */
.dsac.is-full.is-open::before { content: ''; position: fixed; inset: 0; background: rgba(15, 20, 30, .45); }
.dsac.is-full .dsac-panel {
  position: fixed; top: 24px; bottom: 24px; left: 50%; right: auto; transform: translateX(-50%);
  width: min(1100px, calc(100vw - 48px)); height: auto;
}
.dsac.is-full .dsac-log { padding: 20px 28px; }
.dsac.is-full .dsac-bubble { max-width: 75%; }
.dsac.is-full .dsac-input { min-height: calc(3 * 1.45em + 20px); }
@media (max-width: 575px) {
  .dsac-full-btn { display: none; }
  .dsac.is-full.is-open::before { display: none; }
  .dsac.is-full .dsac-panel { transform: none; }
  .dsac { bottom: 14px; right: 14px; }
  .dsac-launcher { width: 52px; height: 52px; }
  /* 1.3.7 (dobrewino 03.11): na telefonie samo kółko z ikoną i plakietką „AI” - napis zostaje w aria-label. */
  .dsac-launcher--caption { width: 52px; padding: 0; gap: 0; border-radius: 50%; }
  .dsac-launcher__txt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .dsac--left { left: 14px; }
  .dsac.is-open { inset: 0; }
  .dsac.is-open .dsac-panel { position: fixed; inset: 0; width: 100%; height: 100%; border-radius: 0; }
  .dsac-tiles-block .dsac-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .dsac *, .dsac-tile { animation: none !important; transition: none !important; }
}

/* Źródła odpowiedzi (1.2.0) */
.dsac-sources { margin-top: 6px; font-size: 12px; color: var(--dsac-muted); display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: baseline; }
.dsac-sources__label { font-weight: 600; }
.dsac-sources__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.dsac-sources__list li { background: rgba(0, 0, 0, .05); border-radius: 10px; padding: 1px 8px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsac-sources__list a { color: inherit; text-decoration: underline; }

/* 1.2.2: czytanie odpowiedzi - podświetlony głośnik przy czytanej wiadomości i pasek Pauza / Od nowa / Stop. */
.dsac-msg__tools .dsac-speak.is-active { background: var(--dsac-accent); color: #fff; }
.dsac-msg__tools .dsac-speak.is-active:not(.is-paused) { animation: dsac-speak 1.4s infinite; }
.dsac-msg__tools .dsac-speak.is-paused { background: #fff; color: var(--dsac-accent); box-shadow: inset 0 0 0 2px var(--dsac-accent); }
@keyframes dsac-speak { 0% { box-shadow: 0 0 0 0 rgba(0, 0, 0, .25); } 100% { box-shadow: 0 0 0 8px rgba(0, 0, 0, 0); } }
.dsac-playbar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; padding: 6px 8px; border-radius: 12px; background: var(--dsac-soft); }
.dsac-playbar[hidden] { display: none; }
.dsac-playbar__label { flex: 1 1 auto; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--dsac-muted); min-width: 0; }
.dsac-playbar__label .dsac-ic { color: var(--dsac-accent); }
.dsac-playbtn {
  display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--dsac-line); background: #fff; color: var(--dsac-text); font: inherit; font-size: 13px; font-weight: 600;
}
.dsac-playbtn .dsac-ic, .dsac-playbtn .dsac-ic svg { width: 16px; height: 16px; }
.dsac-playbtn:hover { border-color: var(--dsac-accent); color: var(--dsac-accent); }
.dsac-pauseaudio { background: var(--dsac-accent); border-color: var(--dsac-accent); color: #fff; }
.dsac-pauseaudio:hover { color: #fff; filter: brightness(1.08); }
@media (max-width: 575px) {
  .dsac-playbar { flex-wrap: nowrap; }
  .dsac-playbar__label > span:not(.dsac-ic) { display: none; }
  /* 1.3.6 (DW2-194): etykieta to sama ikona - nie rozpycha paska; trzy przyciski dzielą szerokość, „Zamknij” nie jest ucięty. */
  .dsac-playbar__label { flex: 0 0 auto; }
  .dsac-playbtn { flex: 1 1 0; min-width: 0; justify-content: center; padding: 0 6px; white-space: nowrap; }
}
/* 1.3.1: wiadomość pracownika sklepu w oknie czatu */
.dsac-msg--staff .dsac-bubble { border-left: 3px solid var(--dsac-accent, #8c1d2f); }
.dsac-msg__who { display: block; margin: 0 0 4px 2px; font-size: 11px; font-weight: 600; letter-spacing: .02em; opacity: .7; }
