/* ============================================================
 * ValachShop AI Asistent — Widget Styles
 * ============================================================
 * Version:   1.2.2-embed
 * Build:     2026-04-27
 * Deploy:    https://ai.valachshop.sk/media/widget/widget.css
 * Embed:     Magento Admin → Content → Design → Configuration
 *            → HTML Head → Scripts and Style Sheets
 * ============================================================
 * NAMESPACE: Všetky selektory sú prefixované #vs- alebo .vs-
 * aby nedochádzalo ku konfliktu s Magento theme štýlmi.
 *
 * LOCKED dimensions (nemeniť bez konzultácie):
 *   - Modal:        680×740px desktop
 *   - Postavička:   220px width, top:-68px
 *   - Product card: 208px width
 *   - Product img:  137px height
 *   - Footer:       min 126px
 *   - Header:       105px desktop, 86px mobile
 * ============================================================ */

/* ============================================================
   FONT — Titillium Web (servovaný z /media/widget/widget-assets/)
   ============================================================ */
@font-face {
  font-family: 'Titillium Web';
  src: url('https://ai.valachshop.sk/media/widget/widget-assets/Titillium_Web/TitilliumWeb-Light.ttf') format('truetype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Titillium Web';
  src: url('https://ai.valachshop.sk/media/widget/widget-assets/Titillium_Web/TitilliumWeb-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Titillium Web';
  src: url('https://ai.valachshop.sk/media/widget/widget-assets/Titillium_Web/TitilliumWeb-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Titillium Web';
  src: url('https://ai.valachshop.sk/media/widget/widget-assets/Titillium_Web/TitilliumWeb-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ============================================================
   DESIGN TOKENS — z PDF mockupu
   ============================================================ */
:root {
  /* Brand colors */
  --vs-brown:        #3D1410;
  --vs-brown-hover:  #541a15;
  --vs-green:        #77B52C;
  --vs-green-hover:  #85c932;
  --vs-cream:        #FFFAF3;
  --vs-white:        #FFFFFF;

  /* Text */
  --vs-text:         #2A2A2A;
  --vs-text-muted:   #6b6b6b;
  --vs-text-on-brown: #FFFAF3;
  --vs-text-on-green: #FFFFFF;

  /* Borders & shadows */
  --vs-border:       rgba(61, 20, 16, 0.18);
  --vs-border-soft:  rgba(61, 20, 16, 0.10);
  --vs-shadow-modal: 0 16px 48px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(61, 20, 16, 0.08);
  --vs-shadow-card:  0 2px 8px rgba(0, 0, 0, 0.06);
  --vs-shadow-card-hover: 0 8px 24px rgba(61, 20, 16, 0.18);

  /* Geometry */
  --vs-radius-modal: 18px;
  --vs-radius-card:  12px;
  --vs-radius-pill:  999px;
  --vs-radius-input: 14px;

  /* Spacing */
  --vs-gap:          12px;
  --vs-pad:          16px;

  /* Typography */
  --vs-font: 'Titillium Web', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Z-index layers */
  --vs-z-bubble:     2147483645;
  --vs-z-overlay:    2147483646;
  --vs-z-modal:      2147483647;

  /* Asset URLs (jediný zdroj — keby sme niekedy menili CDN) */
  --vs-asset-base: 'https://ai.valachshop.sk/media/widget/widget-assets';
}

/* ============================================================
   RESET — len pre widget elementy (žiadne globálne overrides)
   ============================================================ */
#vs-bubble, #vs-bubble *,
#vs-overlay, #vs-overlay * {
  box-sizing: border-box;
  font-family: var(--vs-font);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   FLOATING BUBBLE — spustí widget
   ============================================================ */
#vs-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 199px;
  height: 199px;
  border: none;
  background: transparent;
  cursor: pointer;
  z-index: var(--vs-z-bubble);
  padding: 0;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.25));
  transition: transform 0.25s ease;
}
#vs-bubble:hover { transform: scale(1.06); }
#vs-bubble:active { transform: scale(0.96); }
#vs-bubble img {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* ============================================================
   OVERLAY (mobile fullscreen)
   ============================================================ */
#vs-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  z-index: var(--vs-z-overlay);
  animation: vs-fade-in 0.2s ease;
  align-items: center;
  justify-content: center;
}
#vs-overlay.vs-active { display: flex; }

@keyframes vs-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============================================================
   MODAL — DESKTOP (centered)
   ============================================================ */
/* ============================================================
   MODAL — DESKTOP (centered)
   ⚠️ WIDTH LOCKED: 680px — overené s klientom, NEMENIŤ bez dôvodu
   Height sa ladí, ratio mockup = 1.109
   ============================================================ */
#vs-modal {
  position: relative;
  width: 680px;           /* LOCKED — nemeniť */
  max-width: calc(100vw - 48px);
  height: 740px;          /* LOCKED — ideálna výška, nemeniť */
  /* Adaptívna výška (v8.9, 2026-05-31): na nízkych oknách (napr. Windows display
     scaling 125% → innerH ~811px) sa modal zmenší tak, aby NAD ním ostalo dosť
     miesta pre postavičku (#vs-postavicka, top:-68px) — inak sa jej hlava oreže
     o horný okraj okna. Modal je centrovaný, takže treba rezervovať 2×68px;
     rezervujeme 160px (≈80px hore+dole, malý buffer). Na normálnych/vysokých
     oknách (innerH ≳ 900px) zostáva modal plných 740px → pixel-identický
     s pôvodným ladením. Mení sa VÝHRADNE max-height, nie width/height/postavička.
     Mobilná aj landscape verzia toto prepisujú vlastným !important (neovplyvnené). */
  max-height: calc(100vh - 160px);
  max-height: calc(100dvh - 160px);
  background-color: #FFFAF4 !important;
  background-image: none !important;
  border-radius: var(--vs-radius-modal);
  box-shadow: var(--vs-shadow-modal);
  display: flex;
  flex-direction: column;
  overflow: visible;
  z-index: var(--vs-z-modal);
  animation: vs-slide-up 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  isolation: isolate;
}

/* Inner clip wrapper — radius + clip pre obsah, ale postavička môže vyčnievať */
#vs-modal-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  border-radius: var(--vs-radius-modal);
  overflow: hidden;
  background-color: #FFFAF4;
}

@keyframes vs-slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   HEADER
   ============================================================ */
/* Postavička — desktop only, vyčnieva nad header */
#vs-postavicka {
  position: absolute;
  top: -68px;           /* LOCKED — nemeniť */
  left: 50%;
  transform: translateX(-50%);
  width: 220px;         /* LOCKED — nemeniť */
  height: auto;
  pointer-events: none;
  z-index: 10;
}

#vs-header {
  position: relative;
  background-color: #FFFAF4 !important;
  background-image: none !important;
  padding: 22px 22px 16px 22px;
  color: var(--vs-brown);
  flex: 0 0 auto;
  flex-shrink: 0;
  border-top-left-radius: var(--vs-radius-modal);
  border-top-right-radius: var(--vs-radius-modal);
  height: 105px;
  min-height: 105px;
  max-height: 105px;
  overflow: visible;
}

/* Pattern overlay na header — 80% viditeľnosti */
#vs-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url('https://ai.valachshop.sk/media/widget/widget-assets/Top_Background.png');
  background-repeat: repeat-x;
  background-position: left top;
  background-size: auto 105px;
  opacity: 0.8;
  pointer-events: none;
  border-top-left-radius: var(--vs-radius-modal);
  border-top-right-radius: var(--vs-radius-modal);
  z-index: 1;
}

#vs-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  position: relative;
  z-index: 3;
  height: 100%;
}

#vs-header-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

#vs-header-title-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.vs-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--vs-green);
  flex-shrink: 0;
  box-shadow: 0 0 0 0 rgba(119, 181, 44, 0.6);
  animation: vs-pulse 2s ease-in-out infinite;
}
@keyframes vs-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(119, 181, 44, 0.6); }
  50%      { box-shadow: 0 0 0 6px rgba(119, 181, 44, 0); }
}

#vs-header h3 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--vs-brown);
}

#vs-header-subtitle {
  margin: 2px 0 0 17px;
  font-size: 12px;
  font-weight: 600;
  color: var(--vs-brown);
  opacity: 1;
  position: relative;
  z-index: 3;
}
.vs-subtitle-short { display: none; }
.vs-subtitle-full { display: inline; }

#vs-reset {
  background: transparent;
  border: 1.2px solid var(--vs-brown);
  color: var(--vs-brown);
  font-family: var(--vs-font);
  font-size: 10px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--vs-radius-pill);
  cursor: pointer;
  transition: background 0.2s ease;
  white-space: nowrap;
}
#vs-reset:hover { background: rgba(61, 20, 16, 0.08); }
#vs-reset:focus,
#vs-reset:active { outline: none; color: var(--vs-brown); }

#vs-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.vs-header-btn {
  background: transparent;
  border: none;
  color: var(--vs-brown);
  cursor: pointer;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.vs-header-btn:hover { opacity: 0.75; transform: scale(1.05); }
.vs-header-btn:focus,
.vs-header-btn:active { outline: none; color: var(--vs-brown); }
.vs-header-btn img {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* ============================================================
   MESSAGES AREA
   ============================================================ */
#vs-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 22px 19px 14px 19px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
  background-color: #FFFAF4 !important;
  background-image: none !important;
  min-height: 0;
}

#vs-messages::-webkit-scrollbar { width: 6px; }
#vs-messages::-webkit-scrollbar-thumb {
  background: rgba(61, 20, 16, 0.2);
  border-radius: 3px;
}
#vs-messages::-webkit-scrollbar-track { background: transparent; }

/* Welcome message — centered */
.vs-welcome {
  text-align: left;
  font-size: 17px;
  font-weight: 400;
  color: var(--vs-brown);
  line-height: 1.45;
  padding: 16px 24px 8px 24px;
  animation: vs-msg-in 0.3s ease;
}

/* Storage availability warning banner (v2.4.2-rf) — keď je localStorage vypnuté.
   Sticky na vrchu messages, non-dismissable, informačné. */
.vs-storage-warning {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 16px 8px 16px;
  padding: 10px 14px;
  background: #FFF4D6;
  border: 1px solid #E8C96A;
  border-radius: 10px;
  color: #6B5418;
  font-size: 12.5px;
  line-height: 1.4;
  animation: vs-msg-in 0.3s ease;
}

/* User message */
.vs-msg-user {
  align-self: flex-end;
  max-width: 80%;
  background: var(--vs-brown);
  color: var(--vs-text-on-brown);
  padding: 10px 18px;
  border-radius: var(--vs-radius-pill);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  word-wrap: break-word;
  animation: vs-msg-in 0.3s ease;
}

/* Bot message — avatar + text bez bubble */
.vs-msg-bot {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: vs-msg-in 0.3s ease;
}
.vs-msg-bot-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--vs-white);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.vs-msg-bot-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.vs-msg-bot-text {
  flex: 1;
  font-size: 15px;
  font-weight: 400;
  color: var(--vs-brown);
  line-height: 1.5;
  padding-top: 6px;
  word-wrap: break-word;
}

/* Markdown elementy v bot správe */
.vs-msg-bot-text p { margin: 0 0 8px 0; }
.vs-msg-bot-text p:last-child { margin-bottom: 0; }
.vs-msg-bot-text strong { font-weight: 700; color: var(--vs-brown); }
.vs-msg-bot-text em { font-style: italic; }
.vs-msg-bot-text code {
  font-family: 'Courier New', monospace;
  background: rgba(61, 20, 16, 0.08);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}
.vs-msg-bot-text h1, .vs-msg-bot-text h2, .vs-msg-bot-text h3 {
  margin: 10px 0 6px 0;
  font-weight: 700;
  color: var(--vs-brown);
  line-height: 1.3;
}
.vs-msg-bot-text h1 { font-size: 17px; }
.vs-msg-bot-text h2 { font-size: 15px; }
.vs-msg-bot-text h3 { font-size: 14px; }
.vs-msg-bot-text ul, .vs-msg-bot-text ol {
  margin: 4px 0 8px 0;
  padding-left: 20px;
}
.vs-msg-bot-text li { margin: 2px 0; }
.vs-msg-bot-text hr {
  border: none;
  border-top: 1px solid var(--vs-border);
  margin: 10px 0;
}
.vs-msg-bot-text a {
  color: var(--vs-green);
  text-decoration: underline;
  font-weight: 600;
}
.vs-msg-bot-text a:hover { color: var(--vs-brown); }

/* Typing indicator */
.vs-typing {
  display: flex;
  align-items: center;
  gap: 10px;
  animation: vs-msg-in 0.3s ease;
}
.vs-typing-dots {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  background: var(--vs-white);
  border: 1px solid var(--vs-border-soft);
  border-radius: var(--vs-radius-pill);
}
.vs-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--vs-brown);
  animation: vs-typing-bounce 1.4s ease-in-out infinite;
}
.vs-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.vs-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

.vs-typing-text {
  font-size: 15px;
  font-weight: 400;
  color: var(--vs-text-muted);
  font-style: italic;
}

@keyframes vs-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

@keyframes vs-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Error message */
.vs-msg-error {
  align-self: center;
  background: rgba(61, 20, 16, 0.06);
  color: var(--vs-brown);
  border: 1px solid var(--vs-border);
  padding: 8px 14px;
  border-radius: var(--vs-radius-pill);
  font-size: 12px;
  font-weight: 400;
}

/* Success / cart toast message */
.vs-msg-success {
  align-self: center;
  background: #d4edda;
  color: #155724;
  border: 1.5px solid var(--vs-green);
  padding: 10px 18px;
  border-radius: var(--vs-radius-pill);
  font-size: 13px;
  font-weight: 600;
  margin: 4px 0;
  animation: vs-msg-in 0.3s ease;
  transition: opacity 0.3s ease;
}

/* ============================================================
   PRODUCT CAROUSEL
   ============================================================ */
.vs-carousel-wrap {
  position: relative;
  margin: 6px 0 10px 0;
  animation: vs-msg-in 0.4s ease;
}

.vs-carousel {
  overflow: hidden;
  border-radius: var(--vs-radius-card);
}

.vs-carousel-track {
  display: flex;
  gap: 9px;              /* LOCKED — nemeniť */
  transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.3, 1);
  will-change: transform;
}

/* DESKTOP: 3 karty viditeľné, card width LOCKED */
.vs-carousel-card {
  flex: 0 0 208px;       /* LOCKED — nemeniť */
  min-width: 0;
}

/* Mobile carousel — natívny scroll-snap */
.vs-carousel-mobile {
  display: none;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  gap: 10px;
  padding-bottom: 10px;
  scrollbar-width: none;
  /* v7 hotfix (2026-05-12): `overflow-x: auto` implicitly sets touch-action
     to pan-x in some WebKit versions. When a finger lands on the carousel
     during a pinch-zoom gesture that started on messages area, Safari
     cancels the gesture due to touch-action conflict (pan-x vs pinch-zoom).
     Same root cause as v6 — extend the fix to carousel layer. */
  touch-action: pan-x pinch-zoom;
}
.vs-carousel-mobile::-webkit-scrollbar { display: none; }
.vs-carousel-mobile .vs-carousel-card {
  flex: 0 0 calc((100% - 20px) / 3);
  scroll-snap-align: start;
  /* v7: bare pinch-zoom. v8 (2026-05-31): added pan-x for native horizontal
     carousel scroll. v8.5 briefly added pan-y as well, but a 2nd pan axis on the
     card made the 2-finger pinch LESS reliable in portrait (iOS more often locks
     to a pan before the arbiter can switch → more "dead spots"). v8.7
     (2026-05-31) reverts to `pan-x pinch-zoom` — the value validated as working.
     Vertical page scroll while touching a card isn't needed in portrait (the
     chat scrolls via the area around the single product row). The arbiter below
     (+ gesturestart) keeps pinch as reliable as this CSS approach allows.
     Landscape handles its own vertical-scroll-on-card via the .vs-product rule
     in the landscape @media block. */
  touch-action: pan-x pinch-zoom;
}
/* v8.1 (2026-05-31): finger-count arbiter. 1 finger → card keeps the
   `pan-x pinch-zoom` above → smooth NATIVE horizontal carousel scroll. The
   moment a 2nd finger lands, JS (attachCarouselZoomArbiter in widget.js) adds
   `.vs-zoom-mode`, which drops the card to bare `pinch-zoom` — removing the
   pan↔pinch ambiguity that otherwise cancels pinch when a finger sits on a card.
   v8.5: arbiter also listens to iOS `gesturestart`/`gestureend` to close most of
   the ~5% "dead spots" where counting touchstart raced the gesture recognizer.
   JS only toggles this class; it never computes scrollLeft → scroll stays
   native and smooth. */
.vs-carousel-mobile.vs-zoom-mode .vs-carousel-card {
  touch-action: pinch-zoom;
}

/* Carousel arrows */
.vs-carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, opacity 0.2s ease;
  padding: 0;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
}
.vs-carousel-arrow:hover {
  transform: translateY(-50%) scale(1.08);
}
.vs-carousel-arrow:focus,
.vs-carousel-arrow:active { outline: none; }
.vs-carousel-arrow:disabled {
  opacity: 0.35;
  cursor: default;
  transform: translateY(-50%);
}
.vs-carousel-arrow img {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}
.vs-carousel-arrow.prev { left: -8px; }
.vs-carousel-arrow.next { right: -8px; }

/* Dots indicator */
.vs-carousel-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
}
.vs-carousel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--vs-border);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s ease, width 0.2s ease;
}
.vs-carousel-dot.active {
  background: var(--vs-green);
  width: 18px;
  border-radius: 3px;
}
.vs-carousel-dot:focus,
.vs-carousel-dot:active { outline: none; }

/* ============================================================
   PRODUCT CARD
   ============================================================ */
.vs-product {
  display: block;
  background: var(--vs-white);
  border: 1.5px solid var(--vs-green);
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--vs-shadow-card);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
  position: relative;
  /* v7 hotfix (2026-05-12): explicit pinch-zoom so a finger landing on a
     product card during pinch-zoom gesture doesn't cancel the gesture.
     This is the same gesture-ambiguity issue solved in v6 for messages
     area, extended to product cards which are dynamically rendered
     inside #vs-messages after [[SHOW_PRODUCTS]] marker. */
  touch-action: pinch-zoom;
}
.vs-product:hover,
.vs-product:focus {
  box-shadow: var(--vs-shadow-card-hover);
  transform: translateY(-3px);
  outline: none;
}

.vs-product-img {
  width: 100%;
  height: 137px;          /* LOCKED — nemeniť */
  background: var(--vs-white);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.vs-product-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}
.vs-product-img-placeholder {
  font-size: 36px;
  opacity: 0.4;
}

/* Footer (zelená sekcia v normal state) */
.vs-product-footer {
  background: var(--vs-green);
  padding: 12px 12px 14px 12px;
  min-height: 126px;      /* LOCKED — nemeniť */
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  transition: background 0.25s ease;
}

.vs-product-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--vs-white);
  line-height: 1.2;
  margin: 0 0 8px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 32px;
  transition: color 0.25s ease;
}

.vs-product-prices {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}
.vs-product-price {
  font-size: 17px;
  font-weight: 700;
  color: var(--vs-white);
  transition: color 0.25s ease;
}
.vs-product-old-price {
  font-size: 13px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: line-through;
  transition: color 0.25s ease;
}

.vs-product-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.vs-product-btn {
  flex: 1;
  background: transparent;
  color: var(--vs-white);
  border: 1.5px solid var(--vs-white);
  border-radius: var(--vs-radius-pill);
  padding: 5px 6px;
  font-family: var(--vs-font);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
  white-space: nowrap;
}
.vs-product-btn:visited,
.vs-product-btn:focus,
.vs-product-btn:active { color: var(--vs-white); outline: none; }

.vs-product-cart {
  width: 42px;
  height: 28px;
  background: var(--vs-white);
  border: none;
  border-radius: var(--vs-radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.25s ease;
}
.vs-product-cart img {
  width: 16px;
  height: 13px;
  display: block;
  pointer-events: none;
}
.vs-product-cart:focus,
.vs-product-cart:active { outline: none; }

/* HOVER STATE — inverzia: footer biely, button green outline + green text, cart zelený */
.vs-product:hover .vs-product-footer {
  background: var(--vs-white);
}
.vs-product:hover .vs-product-name {
  color: var(--vs-text);
}
.vs-product:hover .vs-product-price {
  color: var(--vs-text);
}
.vs-product:hover .vs-product-old-price {
  color: var(--vs-text-muted);
}
.vs-product:hover .vs-product-btn {
  background: var(--vs-white);
  color: var(--vs-green);
  border-color: var(--vs-green);
}
.vs-product:hover .vs-product-cart {
  background: var(--vs-green);
}
.vs-product:hover .vs-product-cart img {
  filter: brightness(0) invert(1);
}

/* ============================================================
   FOOTER (disclaimer)
   ============================================================ */
#vs-footer {
  font-size: 11px;
  font-weight: 400;
  color: var(--vs-text-muted);
  text-align: center;
  padding: 10px 20px 22px 20px;
  line-height: 1.45;
  flex-shrink: 0;
  background-color: #FFFAF4 !important;
  background-image: none !important;
  position: relative;
}
#vs-footer::after {
  content: '';
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  width: 65%;
  height: 1px;
  background: rgba(61, 20, 16, 0.35);
}

/* ============================================================
   INPUT BAR
   ============================================================ */
#vs-input-area {
  padding: 0 20px 18px 20px;
  flex-shrink: 0;
  position: relative;
  background-color: #FFFAF4 !important;
  background-image: none !important;
}

#vs-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--vs-white);
  border: 1.5px solid var(--vs-brown);
  border-radius: var(--vs-radius-pill);
  padding: 6px 8px 6px 22px;
  transition: border-color 0.2s ease;
}
#vs-input-wrap:focus-within { border-color: var(--vs-brown-hover); }

#vs-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--vs-font);
  font-size: 15px;
  font-weight: 400;
  color: var(--vs-text);
  padding: 10px 0;
  outline: none;
  min-width: 0;
  -webkit-appearance: none;  /* v2.4.2-rf: zruš iOS Safari default inset shadow/styling */
  appearance: none;
}

/* v2.4.2-rf: zruš natívne iOS/Safari štýlovanie tlačidiel widgetu (modrý text,
   inset shadow, zaoblenie) — všetky buttony sú custom-stylované. */
#vs-widget-root button {
  -webkit-appearance: none;
  appearance: none;
}
#vs-input::placeholder { color: var(--vs-text-muted); font-style: italic; }
#vs-input:disabled { opacity: 0.5; }
#vs-input:focus,
#vs-input:focus-visible {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}

#vs-mic {
  background: transparent;
  border: none;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  padding: 0;
  transition: background 0.2s ease;
}
#vs-mic:hover { background: rgba(61, 20, 16, 0.06); }
#vs-mic:focus, #vs-mic:active { outline: none; }
#vs-mic img {
  width: 22px;
  height: 22px;
  display: block;
  pointer-events: none;
}

#vs-send {
  background: transparent;
  border: none;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: transform 0.15s ease, opacity 0.2s ease;
}
#vs-send:hover { opacity: 0.85; }
#vs-send:active { transform: scale(0.92); }
#vs-send:focus, #vs-send:active { outline: none; }
#vs-send:disabled { opacity: 0.5; cursor: default; }
#vs-send img {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* ============================================================
   VOICE RECORDING UI
   ============================================================ */
#vs-rec-area {
  display: none;
  align-items: center;
  gap: 10px;
  background: var(--vs-white);
  border: 1px solid var(--vs-border);
  border-radius: var(--vs-radius-input);
  padding: 8px 12px;
  flex: 1;
  min-width: 0;
}
#vs-rec-area.vs-active { display: flex; }

#vs-rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d63333;
  flex-shrink: 0;
  animation: vs-rec-pulse 1.2s ease-in-out infinite;
}
@keyframes vs-rec-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.85); }
}

#vs-rec-timer {
  font-size: 12px;
  font-weight: 600;
  color: var(--vs-brown);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

#vs-rec-waveform {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 22px;
  overflow: hidden;
  min-width: 0;
}
#vs-rec-waveform .vs-bar {
  width: 2px;
  background: var(--vs-green);
  border-radius: 1px;
  flex-shrink: 0;
  transition: height 0.1s linear;
}

#vs-rec-cancel {
  background: transparent;
  border: none;
  color: var(--vs-text-muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 8px;
  flex-shrink: 0;
}
#vs-rec-cancel:hover { color: var(--vs-brown); }
#vs-rec-cancel:focus, #vs-rec-cancel:active { outline: none; }

#vs-rec-send {
  background: transparent;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  padding: 0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, opacity 0.2s ease;
}
#vs-rec-send img {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}
#vs-rec-send:hover { opacity: 0.85; }
#vs-rec-send:active { transform: scale(0.92); }
#vs-rec-send:focus, #vs-rec-send:active { outline: none; }

/* Voice message bubble */
.vs-voice-msg {
  align-self: flex-end;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--vs-brown);
  padding: 8px 12px;
  border-radius: 16px 16px 4px 16px;
  max-width: 80%;
}
.vs-voice-play {
  background: var(--vs-cream);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
}
.vs-voice-play:focus, .vs-voice-play:active { outline: none; }
.vs-voice-play svg { width: 12px; height: 12px; fill: var(--vs-brown); }

.vs-voice-waveform {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 22px;
}
.vs-voice-waveform .vs-bar {
  width: 2px;
  background: var(--vs-cream);
  border-radius: 1px;
  opacity: 0.6;
}
.vs-voice-waveform .vs-bar.played { opacity: 1; background: var(--vs-green); }

.vs-voice-duration {
  font-size: 11px;
  font-weight: 600;
  color: var(--vs-cream);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   MOBILE — fullscreen, žiadna postavička, jeden carousel item
   Fixed: input focus resize, top edge gap, fullscreen stability
   ============================================================ */
@media (max-width: 540px) {
  #vs-bubble {
    width: 99px;
    height: 99px;
    bottom: 18px;
    right: 18px;
  }

  #vs-overlay {
    align-items: stretch;
    justify-content: stretch;
    padding: 0 !important;
    margin: 0 !important;
    /* Prevent scroll propagation to page underneath */
    overflow: hidden !important;
    overscroll-behavior: none !important;
    /* Keyboard gap fill (v8.8, 2026-05-31): keď sa otvorí klávesnica, JS pripne
       #vs-modal na visualViewport.height (oblasť nad klávesnicou) — medzi modalom
       a klávesnicou predtým presvital obsah hostiteľskej stránky cez priehľadný
       backdrop. Cream overlay (rovnaký odtieň ako modal, #FFFAF4) tú medzeru
       vyplní jednotnou farbou. Desktop overlay ostáva rgba(0,0,0,.4). */
    background: #FFFAF4 !important;
    /* v4 hotfix (2026-05-12): changed from `none` to `pinch-zoom` so users
       can zoom widget content for readability. 1-finger scroll bleed is
       still blocked by JS touchmove handler (which now lets 2+ finger
       gestures through). */
    touch-action: pinch-zoom;
  }

  #vs-modal {
    /* Fixed positioning — immune to page scroll and iOS keyboard push */
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    max-height: 100% !important;
    border-radius: 0 !important;
    animation: vs-mobile-slide 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
    margin: 0 !important;
    padding: 0 !important;
    /* Prevent any overflow that could cause bounce-scroll */
    overflow: hidden !important;
  }

  #vs-modal-inner {
    border-radius: 0 !important;
    height: 100% !important;
    min-height: 0;
    overflow: hidden !important;
    overscroll-behavior: none !important;
  }

  @keyframes vs-mobile-slide {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  #vs-header {
    border-radius: 0 !important;
    padding-top: calc(14px + env(safe-area-inset-top)) !important;
    padding-right: 14px !important;
    padding-bottom: 14px !important;
    padding-left: 14px !important;
    height: calc(86px + env(safe-area-inset-top)) !important;
    min-height: calc(86px + env(safe-area-inset-top)) !important;
    max-height: calc(86px + env(safe-area-inset-top)) !important;
  }
  #vs-header::before {
    background-size: auto 86px !important;
    border-radius: 0 !important;
    /* Ensure pattern covers safe-area-inset-top too */
    top: 0;
  }

  /* Žiadna postavička na mobile (fullscreen) */
  #vs-postavicka { display: none !important; }

  #vs-header-top { align-items: center; }
  #vs-header h3 { font-size: 17px; letter-spacing: 0.3px; }
  #vs-header-subtitle { font-size: 11px; margin-top: 1px; }

  /* Subtitle variants */
  .vs-subtitle-full { display: none; }
  .vs-subtitle-short { display: inline; }

  /* Header right: kompaktnejšie */
  #vs-header-right { gap: 10px; }
  #vs-reset { font-size: 10px; padding: 3px 10px; }

  /* Mobile carousel — natívny scroll-snap, bez šípok */
  .vs-carousel-arrow { display: none !important; }

  .vs-carousel { display: none; }
  .vs-carousel-mobile {
    display: flex;
    padding-left: 24px !important;
    padding-right: 40px !important;
  }

  /* Mobile card width — 1 plná + kúsok druhej */
  .vs-carousel-mobile .vs-carousel-card {
    flex: 0 0 66%;
  }

  /* Welcome na mobile — menší font, zachovaj riadky */
  .vs-welcome {
    font-size: 14px;
    padding: 14px 16px 6px 16px;
    line-height: 1.5;
  }

  /* Messages area — mobile padding + flex-shrink to accommodate keyboard */
  #vs-messages {
    padding: 16px 14px 12px 14px !important;
    flex: 1 1 0 !important;
    min-height: 80px !important;
    /* Contain scroll — prevent leaking to page */
    overscroll-behavior: contain !important;
    /* v6 hotfix (2026-05-12): changed from `pan-y` to `pan-y pinch-zoom`.
       Root cause of "primrznuté zoom" bug: iOS Safari tracks each touch
       point separately by element underneath. When user pinch-zooms across
       overlay (touch-action: pinch-zoom) AND messages (touch-action: pan-y),
       Safari loses gesture confidence between conflicting touch-action
       hints and *cancels the gesture entirely*. User-perceived as
       "primrznutý" widget. Allowing pinch-zoom in messages area unifies
       the gesture surface — pinch works regardless of which element each
       finger touches. `pan-y` is preserved so 1-finger vertical scroll
       of chat history still works. */
    touch-action: pan-y pinch-zoom !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Footer disclaimer — menší mobile */
  #vs-footer {
    font-size: 10px !important;
    padding: 8px 16px 10px 16px !important;
    /* Shrink footer when keyboard opens */
    flex-shrink: 1 !important;
  }

  /* v5 hotfix (2026-05-12): hide decorative horizontal line on mobile.
     Desktop footer has padding-bottom 22px → decorative line at bottom:15px
     sits 7px above the bottom edge, above the disclaimer text. On mobile
     padding-bottom shrinks to 10px → same bottom:15px line ends up *over*
     the disclaimer text, crossing it out. Simplest fix: hide on mobile. */
  #vs-footer::after {
    display: none !important;
  }

  /* Input area — fixed at bottom, safe area aware, no resize on focus */
  #vs-input-area {
    padding: 0 14px calc(10px + env(safe-area-inset-bottom)) 14px !important;
    flex-shrink: 0 !important;
    /* v6: explicit pinch-zoom so gesture starting/ending here doesn't
       conflict with overlay's pinch-zoom (avoids "primrznuté" symptom) */
    touch-action: pinch-zoom !important;
  }

  /* Input — prevent zoom on iOS (font-size >= 16px) */
  #vs-input {
    font-size: 16px !important;
  }

  /* v6: ensure pinch-zoom works uniformly across all stable mobile surfaces
     (header, footer). Without this, a finger landing on these elements
     during a pinch gesture causes Safari to cancel the entire gesture
     because of touch-action ambiguity between sibling elements. */
  #vs-header,
  #vs-footer {
    touch-action: pinch-zoom !important;
  }

  /* Messages + user msgs — zachovaj font 15 ale menej paddingu */
  .vs-msg-user { font-size: 14.5px; padding: 9px 16px; }
  .vs-msg-bot-text { font-size: 14.5px; }

  /* Typing — rovnaká veľkosť */
  .vs-typing-text { font-size: 14px; }
}

/* ============================================================
   LANDSCAPE PHONE — single-scroll layout (v8.4, 2026-05-31)
   ------------------------------------------------------------
   A landscape phone has a very short viewport (often <440px, minus iOS Safari's
   URL/tab chrome). Any fixed header + footer + input leaves almost nothing for
   messages. Instead of fighting for a few px, we drop ALL fixed chrome in
   landscape: the WHOLE modal becomes one natural document-flow scroll container
   (header → messages → footer → input stacked, the whole thing scrolls as one).
   This reproduces the original landscape feel and is the most robust answer to
   the tiny-viewport problem (community rec C "auto-collapse", taken to its
   limit — nothing is pinned, so nothing wastes space).
   How: #vs-modal-inner becomes the scroller (display:block + overflow-y:auto);
   #vs-messages stops being its own scroll area (height:auto, overflow:visible);
   the desktop (arrow) carousel is kept (no mobile pan-x/pinch logic in
   landscape). The JS overlay touchmove handler whitelists #vs-modal-inner
   (v8.4) so this scroll isn't blocked.
   Targeting (landscape + coarse pointer + max-height:540px) excludes desktop and
   landscape tablets. We already use 100dvh, so the modal also grows back the
   ~50px when Safari auto-hides its toolbar on scroll (community rec A).
   ============================================================ */
@media (orientation: landscape) and (pointer: coarse) and (max-height: 540px) {
  #vs-overlay {
    align-items: stretch;
    justify-content: stretch;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    background: #FFFAF4 !important;   /* keyboard gap fill (v8.8) — viď portrait blok */
  }

  #vs-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;     /* modal is the frame; modal-inner scrolls */
  }

  /* The whole content stack scrolls as ONE block — no fixed header/footer/input */
  #vs-modal-inner {
    display: block !important;
    height: 100% !important;
    min-height: 0 !important;
    border-radius: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
  }

  /* No desktop character */
  #vs-postavicka { display: none !important; }
  #vs-header { border-radius: 0 !important; }

  /* v8.6 (2026-05-31): landscape uses the DESKTOP (arrow) carousel — no
     horizontal swipe is needed here — so product cards may allow vertical pan.
     Their base touch-action is `pinch-zoom`, which blocked the whole-window
     vertical scroll whenever a finger sat on a card. `pan-y pinch-zoom` lets the
     vertical drag bubble up to the modal-inner scroller AND keeps pinch-zoom.
     No pan-x → no gesture ambiguity → pinch is reliable and NO arbiter is needed
     in landscape (the arbiter only runs on the mobile carousel, hidden here). */
  .vs-product {
    touch-action: pan-y pinch-zoom !important;
  }

  /* Messages no longer a separate scroll area — it just expands to its content */
  #vs-messages {
    flex: 0 0 auto !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    padding-left: calc(19px + env(safe-area-inset-left)) !important;
    padding-right: calc(19px + env(safe-area-inset-right)) !important;
  }

  /* Footer + input scroll along with everything else (not pinned) */
  #vs-footer {
    padding-left: calc(20px + env(safe-area-inset-left)) !important;
    padding-right: calc(20px + env(safe-area-inset-right)) !important;
  }
  #vs-input-area {
    padding-left: calc(20px + env(safe-area-inset-left)) !important;
    padding-right: calc(20px + env(safe-area-inset-right)) !important;
    padding-bottom: calc(14px + env(safe-area-inset-bottom)) !important;
  }
  #vs-input { font-size: 16px !important; }
}




