.vb-chat { position: fixed; z-index: 140; right: 24px; bottom: 24px; font-family: var(--sans); }
.body-lock .vb-chat { visibility: hidden; }
.vb-chat-launcher svg {width:24px;height:24px;display:block}
body.has-buybar:has(.product-buybar.is-visible) .vb-chat { bottom: 88px; }
.vb-chat-launcher { display: grid; place-items: center; width: 58px; height: 58px; padding: 0; border: 0; border-radius: 50%; background: var(--ink); color: var(--cream-soft); cursor: pointer; box-shadow: 0 10px 26px rgba(35,21,13,.28); transition: transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s, background-color .22s; }
.vb-chat-launcher:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(35,21,13,.34); }
.vb-chat-launcher:active { transform: translateY(0) scale(.96); }
.vb-chat-launcher:focus-visible { outline: 3px solid var(--coral-deep); outline-offset: 3px; }
/* Popisek drzi aria-label; v bubline zustava jen ikona. */
.vb-chat-launcher .vb-chat-launcher-text { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.vb-chat-panel {
  position: absolute;
  right: 0;
  bottom: 74px;
  display: flex;
  flex-direction: column;
  width: min(384px, calc(100vw - 32px));
  height: min(560px, calc(100dvh - 160px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--cream-soft);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(40, 24, 15, .22);
}
.vb-chat-panel[hidden] { display: none; }

/* --- hlavicka --- */
.vb-chat-head {
  display: flex;
  gap: 12px;
  align-items: center;
  flex: 0 0 auto;
  padding: 14px 16px;
  background: var(--ink);
  color: var(--cream-soft);
}
.vb-chat-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
}
.vb-chat-avatar svg { width: 20px; height: 20px; }
.vb-chat-head-copy { display: grid; gap: 2px; min-width: 0; }
.vb-chat-head-copy strong { font-family: var(--serif); font-size: 17px; font-weight: 400; }
.vb-chat-head-copy span { color: rgba(249, 245, 236, .68); font-size: 11px; line-height: 1.4; }
.vb-chat-close {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  color: inherit;
  cursor: pointer;
  transition: background-color .2s;
}
.vb-chat-close:hover { background: rgba(255, 255, 255, .22); }
.vb-chat-close svg { width: 16px; height: 16px; }

/* --- konverzace --- */
.vb-chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.vb-chat-row { display: flex; }
.vb-chat-row.question { justify-content: flex-end; }
.vb-chat-row.answer { justify-content: flex-start; }

.vb-chat-bubble {
  max-width: 84%;
  padding: 11px 14px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.vb-chat-row.answer .vb-chat-bubble {
  border: 1px solid var(--line);
  border-radius: 16px 16px 16px 4px;
  background: #fff;
}
.vb-chat-row.question .vb-chat-bubble {
  border-radius: 16px 16px 4px 16px;
  background: var(--ink);
  color: var(--cream-soft);
}
.vb-chat-bubble.is-error { border-color: var(--coral-deep); color: var(--coral-deep); }

.vb-chat-sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.vb-chat-sources a {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--coral-deep);
  font-size: 11px;
  text-decoration: none;
}
.vb-chat-sources a:hover { border-color: var(--ink); color: var(--ink); }

/* --- indikator psani --- */
.vb-chat-typing { display: flex; gap: 4px; align-items: center; padding: 14px; }
.vb-chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(35, 21, 13, .38);
  animation: vb-chat-dot 1.1s infinite ease-in-out;
}
.vb-chat-typing span:nth-child(2) { animation-delay: .16s; }
.vb-chat-typing span:nth-child(3) { animation-delay: .32s; }

@keyframes vb-chat-dot {
  0%, 60%, 100% { opacity: .28; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* --- psani dotazu --- */
.vb-chat-composer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex: 0 0 auto;
  padding: 12px 14px 10px;
  border-top: 1px solid var(--line);
  background: var(--cream-soft);
}
.vb-chat-composer textarea {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 42px;
  max-height: 132px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  resize: none;
  overflow-y: auto;
}
.vb-chat-composer textarea:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.vb-chat-composer button {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: var(--cream-soft);
  cursor: pointer;
  transition: opacity .2s, transform .2s;
}
.vb-chat-composer button svg { width: 18px; height: 18px; }
.vb-chat-composer button:hover:not(:disabled) { transform: scale(1.05); }
.vb-chat-composer button:disabled { opacity: .32; cursor: default; }

.vb-chat-panel > small {
  flex: 0 0 auto;
  padding: 0 16px 14px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
}

/* Na uzkych displejich je z panelu spodni list pres celou sirku. */
@media (max-width: 600px) {
  .vb-chat-panel {
    position: fixed;
    right: 12px;
    left: 12px;
    bottom: 92px;
    width: auto;
    height: min(72dvh, calc(100dvh - 150px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .vb-chat-messages { scroll-behavior: auto; }
  .vb-chat-typing span { animation: none; opacity: .6; }
  .vb-chat-composer button:hover:not(:disabled) { transform: none; }
}

.vb-consent { position: fixed; inset: auto 20px 20px; z-index: 400; display: flex; align-items: center; justify-content: space-between; gap: 24px; max-width: 1000px; margin: auto; padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--cream-soft); color: var(--ink); box-shadow: 0 10px 50px #28180f26; }
.vb-consent p { margin: 8px 0 0; max-width: 580px; font-size: 13px; line-height: 1.6; }
.vb-consent-actions { display: flex; gap: 10px; flex-shrink: 0; }
.vb-consent button { min-height: 46px; border: 1px solid var(--ink); border-radius: 24px; padding: 10px 16px; background: var(--cream-soft); color: var(--ink); cursor: pointer; font-size: 13px; }
.vb-consent button:hover { background: var(--cream); }
.vb-consent { flex-wrap: wrap; max-height: calc(100dvh - 24px); overflow-y: auto; }
.vb-consent-copy { flex: 1 1 350px; }
.vb-consent strong { font-family: var(--serif); font-size: 24px; font-weight: 400; }
.vb-consent-actions { flex-wrap: wrap; flex: 1 1 280px; }
.vb-consent-actions button { flex: 1 1 130px; }
.vb-consent a { text-decoration: underline; text-underline-offset: 3px; }
.vb-consent button:focus-visible,.vb-consent a:focus-visible,.vb-consent input:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
#vb-cookie-options { flex-basis: 100%; border-top: 1px solid var(--line); padding-top: 16px; }
#vb-cookie-options[hidden] { display: none; }
.vb-cookie-category { display: flex; align-items: center; gap: 20px; justify-content: space-between; padding: 12px 0; }
.vb-cookie-category p { margin: 4px 0; }
.vb-cookie-category span { flex-shrink: 0; font-size: 12px; }
.vb-cookie-category input { width: 24px; height: 24px; flex-shrink: 0; accent-color: var(--ink); }
#vb-cookie-options > a { display: inline-block; margin: 12px; font-size: 13px; }
.vb-privacy-settings { background: transparent; color: inherit; border: 0; padding: 12px 0; text-decoration: underline; cursor: pointer; font-size: 12px; }
@media(min-width:761px) {
  .vb-consent { padding: 14px 18px; gap: 18px; }
  .vb-consent strong { display: none; }
  .vb-consent p { margin: 0; max-width: 640px; font-size: 12px; line-height: 1.4; }
  .vb-consent-actions { flex-wrap: nowrap; flex: 0 0 auto; gap: 8px; }
  .vb-consent-actions button { flex: 0 0 auto; min-height: 40px; padding: 8px 12px; font-size: 12px; }
}
@media(max-width:760px) {
  .vb-chat { right: 16px; bottom: 16px; }
  body.account-page .vb-chat:has(.vb-chat-panel[hidden]) { visibility: hidden; pointer-events: none; }
  body.shop-page.view-moth.moth-grid-in-view .vb-chat:has(.vb-chat-panel[hidden]) { visibility: hidden; pointer-events: none; }
  body.pdp-vilgain:has(.vgn-mobilebar.is-visible) .vb-chat {
    bottom: calc(84px + env(safe-area-inset-bottom));
  }
  .vb-chat-launcher {width:52px;height:52px;min-height:52px;border-radius:50%;padding:15px;gap:0;font-size:0;justify-content:center}
  .vb-consent { inset: auto 8px calc(8px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: minmax(0, 1fr) min(230px, 52vw); align-items: center; gap: 8px; padding: 8px 10px; border-radius: 14px; }
  .vb-consent-copy { min-width: 0; }
  .vb-consent strong { display: none; }
  .vb-consent p { margin: 0; max-width: none; font-size: 10.5px; line-height: 1.28; }
  .vb-consent-actions { display: flex; flex-wrap: nowrap; gap: 4px; width: auto; min-width: 0; }
  .vb-consent-actions button { flex: 1 1 0; min-width: 0; min-height: 36px; padding: 5px 6px; font-size: 10px; line-height: 1.15; }
  .vb-consent-copy,.vb-consent-actions { flex-basis: auto; }
}


@media (prefers-reduced-motion: reduce) {
  .vb-chat-launcher { transition: none; }
  .vb-chat-launcher:hover { transform: none; }
}
/* Rozbalene nastaveni cookies na mobilu pres celou sirku listy. */
@media (max-width: 760px) {
  .vb-consent #vb-cookie-options { grid-column: 1 / -1; padding-top: 10px; }
  .vb-consent .vb-cookie-category { gap: 14px; padding: 10px 2px; }
  .vb-consent .vb-cookie-category b { font-size: 14px; }
  .vb-consent .vb-cookie-category p { font-size: 12px; line-height: 1.4; }
  .vb-consent #vb-cookie-options [data-save] { width: 100%; min-height: 44px; margin-top: 4px; font-size: 13px; }
  .vb-consent #vb-cookie-options > a { margin: 10px 2px 4px; font-size: 12px; }
}
