/**
 * @author    Sigmanortec SRL <office@sigmanortec.ro>
 * @copyright 2026 Sigmanortec SRL
 * @license   https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
 */

#sigmachat-root {
  --sgc-color: #0e7f97;
  --sgc-color-text: #ffffff;
  --sgc-bottom: 20px;
  --sgc-side: 20px;
  --sgc-ink: #1f2a37;
  --sgc-muted: #6b7785;
  --sgc-line: #e3e8ee;
  --sgc-soft: #f4f6f9;
  position: fixed;
  bottom: var(--sgc-bottom);
  z-index: 2147482000;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  color: var(--sgc-ink);
  text-align: left;
}
#sigmachat-root.sgc-pos-right { right: var(--sgc-side); }
#sigmachat-root.sgc-pos-left { left: var(--sgc-side); }
#sigmachat-root *,
#sigmachat-root *::before,
#sigmachat-root *::after { box-sizing: border-box; }
#sigmachat-root svg { width: 22px; height: 22px; fill: currentColor; display: block; }
#sigmachat-root button { font-family: inherit; cursor: pointer; }
#sigmachat-root a { color: var(--sgc-color); }

/* Launcher */
#sigmachat-root .sgc-launcher {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: var(--sgc-color);
  color: var(--sgc-color-text);
  box-shadow: 0 6px 20px rgba(16, 24, 40, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
#sigmachat-root .sgc-launcher:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(16, 24, 40, 0.32); }
#sigmachat-root .sgc-launcher:focus-visible { outline: 3px solid rgba(37, 185, 215, 0.55); outline-offset: 3px; }
#sigmachat-root .sgc-launcher svg { width: 28px; height: 28px; }
#sigmachat-root .sgc-ico-close { display: none; }
#sigmachat-root.sgc-open .sgc-ico-open { display: none; }
#sigmachat-root.sgc-open .sgc-ico-close { display: block; }
#sigmachat-root.sgc-pos-left .sgc-launcher { margin-right: auto; }
#sigmachat-root.sgc-pos-right .sgc-launcher { margin-left: auto; }

/* Teaser */
#sigmachat-root .sgc-teaser {
  position: absolute;
  bottom: 70px;
  width: 240px;
  padding: 12px 34px 12px 14px;
  background: #fff;
  border: 1px solid var(--sgc-line);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.16);
  cursor: pointer;
  font-size: 13.5px;
  animation: sgc-pop 0.25s ease;
}
#sigmachat-root.sgc-pos-right .sgc-teaser { right: 0; }
#sigmachat-root.sgc-pos-left .sgc-teaser { left: 0; }
#sigmachat-root .sgc-teaser-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: 0;
  background: transparent;
  color: var(--sgc-muted);
  padding: 3px;
}
#sigmachat-root .sgc-teaser-close svg { width: 16px; height: 16px; }

/* Panel */
#sigmachat-root .sgc-panel {
  position: absolute;
  bottom: 72px;
  width: 380px;
  height: min(640px, calc(100vh - 110px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--sgc-line);
  border-radius: 18px;
  box-shadow: 0 16px 48px rgba(16, 24, 40, 0.24);
  animation: sgc-pop 0.22s ease;
}
#sigmachat-root.sgc-pos-right .sgc-panel { right: 0; }
#sigmachat-root.sgc-pos-left .sgc-panel { left: 0; }

@keyframes sgc-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

#sigmachat-root .sgc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 10px 12px 14px;
  background: var(--sgc-color);
  color: var(--sgc-color-text);
}
#sigmachat-root .sgc-avatar {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}
#sigmachat-root .sgc-titles { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
#sigmachat-root .sgc-titles strong { font-size: 15px; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#sigmachat-root .sgc-titles span { font-size: 12px; opacity: 0.85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#sigmachat-root .sgc-icon-btn {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  padding: 6px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--sgc-color-text);
  opacity: 0.9;
}
#sigmachat-root .sgc-icon-btn:hover { background: rgba(255, 255, 255, 0.16); opacity: 1; }

/* Messages */
#sigmachat-root .sgc-body {
  position: relative;
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 12px 6px;
  background: var(--sgc-soft);
  overscroll-behavior: contain;
}
#sigmachat-root .sgc-msg { display: flex; flex-direction: column; margin: 0 0 10px; }
#sigmachat-root .sgc-user { align-items: flex-end; }
#sigmachat-root .sgc-bot { align-items: flex-start; }
#sigmachat-root .sgc-bubble {
  max-width: 88%;
  padding: 9px 12px;
  border-radius: 14px;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
#sigmachat-root .sgc-bot .sgc-bubble + .sgc-bubble,
#sigmachat-root .sgc-bot .sgc-cards + .sgc-bubble { margin-top: 6px; }
#sigmachat-root .sgc-user .sgc-bubble { background: var(--sgc-color); color: var(--sgc-color-text); border-bottom-right-radius: 4px; }
#sigmachat-root .sgc-bot .sgc-bubble { background: #fff; border: 1px solid var(--sgc-line); border-bottom-left-radius: 4px; }
#sigmachat-root .sgc-bubble p { margin: 0 0 6px; }
#sigmachat-root .sgc-bubble p:last-child { margin-bottom: 0; }
#sigmachat-root .sgc-bubble ul,
#sigmachat-root .sgc-bubble ol { margin: 4px 0 6px; padding-left: 20px; }
#sigmachat-root .sgc-bubble li { margin: 2px 0; }
#sigmachat-root .sgc-bubble code { background: var(--sgc-soft); padding: 0 4px; border-radius: 4px; font-size: 12.5px; }
#sigmachat-root .sgc-notice .sgc-bubble { background: #fff6e5; border-color: #f3d9a4; }
#sigmachat-root .sgc-retry {
  border: 0;
  background: transparent;
  color: var(--sgc-color);
  font-weight: 700;
  padding: 0;
  text-decoration: underline;
}
#sigmachat-root .sgc-sources { font-size: 11.5px; color: var(--sgc-muted); margin-top: 4px; max-width: 88%; }

/* Typing indicator */
#sigmachat-root .sgc-typing .sgc-bubble { display: flex; gap: 4px; padding: 12px 14px; }
#sigmachat-root .sgc-typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sgc-muted);
  opacity: 0.4;
  animation: sgc-blink 1.2s infinite ease-in-out;
}
#sigmachat-root .sgc-typing i:nth-child(2) { animation-delay: 0.2s; }
#sigmachat-root .sgc-typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes sgc-blink {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 0.9; transform: translateY(-3px); }
}

/* Product cards: large is the base look; small and compact adjust it (row class sgc-size-*) */
#sigmachat-root .sgc-cards { display: flex; gap: 8px; width: 100%; margin-top: 6px; }
#sigmachat-root .sgc-cards-scroll {
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
#sigmachat-root .sgc-card {
  flex: 0 0 auto;
  width: 200px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--sgc-line);
  border-radius: 12px;
  overflow: hidden;
  scroll-snap-align: start;
}
#sigmachat-root .sgc-size-large:not(.sgc-cards-scroll) .sgc-card { width: 100%; max-width: 280px; }
#sigmachat-root .sgc-card-img {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  max-height: 170px;
  background: #fff;
  border-bottom: 1px solid var(--sgc-line);
}
#sigmachat-root .sgc-card-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
#sigmachat-root .sgc-card-img.sgc-noimg { aspect-ratio: auto; height: 34px; border-bottom: 0; }
#sigmachat-root .sgc-badges { position: absolute; top: 6px; left: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
#sigmachat-root .sgc-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  color: #fff;
  background: #5a6776;
  white-space: nowrap;
}
#sigmachat-root .sgc-badge-discount { background: #d64545; }
#sigmachat-root .sgc-badge-promoted { background: var(--sgc-color); color: var(--sgc-color-text); }
#sigmachat-root .sgc-badge-best { background: #e8a33d; }
#sigmachat-root .sgc-card-body { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px 10px; flex: 1 1 auto; min-width: 0; }
#sigmachat-root .sgc-card-name {
  color: var(--sgc-ink);
  font-weight: 600;
  font-size: 13px;
  line-height: 1.3;
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
#sigmachat-root .sgc-card-name:hover { color: var(--sgc-color); }
#sigmachat-root .sgc-card-ref { font-size: 11px; color: var(--sgc-muted); }
#sigmachat-root .sgc-card-price { margin-top: 2px; }
#sigmachat-root .sgc-price { font-size: 15px; font-weight: 700; color: var(--sgc-ink); white-space: nowrap; }
#sigmachat-root .sgc-card-price s { font-size: 12px; color: var(--sgc-muted); white-space: nowrap; }
#sigmachat-root .sgc-card-save { font-size: 11.5px; font-weight: 600; color: #d64545; }
#sigmachat-root .sgc-card-foot { display: flex; flex-direction: column; gap: 3px; margin-top: auto; }
#sigmachat-root .sgc-card-stock { font-size: 11.5px; font-weight: 600; }
#sigmachat-root .sgc-stock-in_stock { color: #1e8e3e; }
#sigmachat-root .sgc-stock-low_stock { color: #c46a00; }
#sigmachat-root .sgc-stock-orderable { color: #6b7785; }
#sigmachat-root .sgc-stock-unavailable { color: #b42318; }
#sigmachat-root .sgc-card-add,
#sigmachat-root .sgc-card-choose {
  margin-top: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border: 0;
  border-radius: 9px;
  background: var(--sgc-color);
  color: var(--sgc-color-text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
}
#sigmachat-root .sgc-card-add svg { width: 16px; height: 16px; flex: 0 0 auto; }
#sigmachat-root .sgc-card-choose { background: #fff; color: var(--sgc-color); border: 1px solid var(--sgc-color); }
#sigmachat-root .sgc-card-add:disabled { opacity: 0.65; cursor: default; }
#sigmachat-root .sgc-card-add.sgc-added { background: #1e8e3e; color: #fff; }

/* Small cards: side by side, about two thirds of the large ones */
#sigmachat-root .sgc-size-small .sgc-card { width: 148px; border-radius: 10px; }
#sigmachat-root .sgc-size-small .sgc-card-img { aspect-ratio: auto; height: 84px; max-height: none; }
#sigmachat-root .sgc-size-small .sgc-card-img img { padding: 4px; box-sizing: border-box; }
#sigmachat-root .sgc-size-small .sgc-card-img.sgc-noimg { height: 26px; }
#sigmachat-root .sgc-size-small .sgc-badges { top: 4px; left: 4px; gap: 3px; }
#sigmachat-root .sgc-size-small .sgc-badge { padding: 1px 6px; font-size: 10px; line-height: 14px; }
#sigmachat-root .sgc-size-small .sgc-card-body { gap: 2px; padding: 6px 8px 8px; }
#sigmachat-root .sgc-size-small .sgc-card-name { font-size: 12px; -webkit-line-clamp: 2; }
#sigmachat-root .sgc-size-small .sgc-card-ref { font-size: 10.5px; }
#sigmachat-root .sgc-size-small .sgc-price { font-size: 13.5px; }
#sigmachat-root .sgc-size-small .sgc-card-price s { font-size: 11px; }
#sigmachat-root .sgc-size-small .sgc-card-save,
#sigmachat-root .sgc-size-small .sgc-card-stock { font-size: 11px; }
#sigmachat-root .sgc-size-small .sgc-card-add,
#sigmachat-root .sgc-size-small .sgc-card-choose { gap: 4px; min-height: 28px; padding: 5px 8px; border-radius: 8px; font-size: 12px; }
#sigmachat-root .sgc-size-small .sgc-card-add svg { width: 14px; height: 14px; }

/* Compact list: one product per row, thumbnail beside the text */
#sigmachat-root .sgc-size-compact { flex-direction: column; gap: 6px; }
#sigmachat-root .sgc-size-compact .sgc-card { width: 100%; flex-direction: row; align-items: stretch; border-radius: 10px; }
#sigmachat-root .sgc-size-compact .sgc-card-img {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  max-height: none;
  aspect-ratio: auto;
  align-self: center;
  margin: 6px 0 6px 6px;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
}
#sigmachat-root .sgc-size-compact .sgc-card-img.sgc-noimg { display: none; }
#sigmachat-root .sgc-size-compact .sgc-card-body { gap: 2px; padding: 6px 8px 7px 10px; }
#sigmachat-root .sgc-size-compact .sgc-card-name { font-size: 12.5px; -webkit-line-clamp: 2; }
#sigmachat-root .sgc-size-compact .sgc-card-ref,
#sigmachat-root .sgc-size-compact .sgc-card-save { display: none; }
#sigmachat-root .sgc-size-compact .sgc-card-price { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 5px; margin-top: 0; }
#sigmachat-root .sgc-size-compact .sgc-price { font-size: 14px; }
#sigmachat-root .sgc-size-compact .sgc-card-price s { font-size: 11px; }
#sigmachat-root .sgc-size-compact .sgc-badges { position: static; display: inline-flex; gap: 3px; }
#sigmachat-root .sgc-size-compact .sgc-badge { padding: 0 6px; font-size: 10px; line-height: 16px; }
#sigmachat-root .sgc-size-compact .sgc-card-foot { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; }
#sigmachat-root .sgc-size-compact .sgc-card-stock { font-size: 11px; }
#sigmachat-root .sgc-size-compact .sgc-card-add,
#sigmachat-root .sgc-size-compact .sgc-card-choose {
  width: auto;
  margin: 0 0 0 auto;
  gap: 4px;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  white-space: nowrap;
}
#sigmachat-root .sgc-size-compact .sgc-card-add svg { width: 14px; height: 14px; }

/* Suggestions */
#sigmachat-root .sgc-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; background: var(--sgc-soft); }
#sigmachat-root .sgc-chip {
  padding: 6px 11px;
  border: 1px solid var(--sgc-color);
  border-radius: 999px;
  background: #fff;
  color: var(--sgc-color);
  font-size: 12.5px;
  font-weight: 600;
}
#sigmachat-root .sgc-chip:hover { background: var(--sgc-color); color: var(--sgc-color-text); }

/* Input */
#sigmachat-root .sgc-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--sgc-line);
  background: #fff;
  margin: 0;
}
#sigmachat-root .sgc-input {
  flex: 1 1 auto;
  min-height: 40px;
  max-height: 120px;
  padding: 9px 12px;
  border: 1px solid var(--sgc-line);
  border-radius: 12px;
  background: #fff;
  color: var(--sgc-ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  resize: none;
  outline: none;
  box-shadow: none;
}
#sigmachat-root .sgc-input:focus { border-color: var(--sgc-color); }
#sigmachat-root .sgc-send {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  padding: 9px;
  border: 0;
  border-radius: 12px;
  background: var(--sgc-color);
  color: var(--sgc-color-text);
}
#sigmachat-root .sgc-send:disabled { opacity: 0.5; cursor: default; }
#sigmachat-root .sgc-foot { padding: 0 12px 8px; background: #fff; font-size: 11px; color: var(--sgc-muted); text-align: center; }

/* Consent */
#sigmachat-root .sgc-consent {
  position: absolute;
  inset: 62px 0 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(244, 246, 249, 0.96);
}
#sigmachat-root .sgc-consent-box {
  max-width: 300px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--sgc-line);
  border-radius: 14px;
  text-align: center;
}
#sigmachat-root .sgc-consent-box p { margin: 0 0 10px; font-size: 13px; }
#sigmachat-root .sgc-accept {
  padding: 9px 18px;
  border: 0;
  border-radius: 10px;
  background: var(--sgc-color);
  color: var(--sgc-color-text);
  font-weight: 700;
}

/* Phones: full screen panel */
@media (max-width: 575px) {
  #sigmachat-root { bottom: 14px; }
  #sigmachat-root.sgc-pos-right { right: 14px; }
  #sigmachat-root.sgc-pos-left { left: 14px; }
  #sigmachat-root .sgc-launcher { width: 54px; height: 54px; }
  #sigmachat-root .sgc-panel {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    border: 0;
  }
  #sigmachat-root.sgc-open .sgc-launcher { display: none; }
  #sigmachat-root .sgc-input { font-size: 16px; }
  #sigmachat-root .sgc-size-large .sgc-card { width: 180px; }
}

@media (prefers-reduced-motion: reduce) {
  #sigmachat-root .sgc-panel,
  #sigmachat-root .sgc-teaser,
  #sigmachat-root .sgc-typing i { animation: none; }
}
