.dzb-chat {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1080;
  font-family: 'Open Sans', sans-serif;
}

.dzb-chat__launcher {
  position: relative;
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 50%;
  background: var(--grad-brand, #C8391A);
  color: #fff;
  font-size: 24px;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 24px rgba(200, 57, 26, .35);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}
.dzb-chat__launcher::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--brand, #C8391A);
  animation: dzbChatPulse 2.6s ease-out infinite;
  pointer-events: none;
}
.dzb-chat.is-open .dzb-chat__launcher::before { display: none; }
.dzb-chat__launcher:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(200, 57, 26, .45); }
.dzb-chat__launcher:focus-visible { outline: 3px solid var(--secondary, #1e3c87); outline-offset: 3px; }
.dzb-chat__icon-open { display: grid; place-items: center; width: 42px; height: 42px; }
.dzb-chat__icon-open .dzb-robot { animation: dzbRobotBob 3s ease-in-out infinite; }
.dzb-chat__icon-close { display: none; font-size: 20px; }
.dzb-chat.is-open .dzb-chat__icon-open { display: none; }
.dzb-chat.is-open .dzb-chat__icon-close { display: inline-block; }

.dzb-chat__ai-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 24px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--secondary, #1e3c87);
  border: 2px solid #fff;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  line-height: 16px;
  font-family: 'Bricolage Grotesque', sans-serif;
}
.dzb-chat.is-open .dzb-chat__ai-badge { display: none; }

@keyframes dzbChatPulse {
  0% { transform: scale(1); opacity: .55; }
  70%, 100% { transform: scale(1.35); opacity: 0; }
}

/* ── Robot ─────────────────────────────────────────── */
.dzb-robot { width: 100%; height: 100%; overflow: visible; }
.dzb-robot__antenna { stroke: #fff; stroke-width: 3; stroke-linecap: round; }
.dzb-robot__antenna-tip { fill: #FFD25A; animation: dzbRobotGlow 1.6s ease-in-out infinite; }
.dzb-robot__ear { fill: #fff; opacity: .85; }
.dzb-robot__head { fill: #fff; }
.dzb-robot__face { fill: var(--secondary, #1e3c87); }
.dzb-robot__eyes circle { fill: #7FE3FF; }
.dzb-robot__eyes { transform-origin: 32px 32px; animation: dzbRobotBlink 4.5s infinite; }
.dzb-robot__mouth { fill: none; stroke: #7FE3FF; stroke-width: 2.4; stroke-linecap: round; }

@keyframes dzbRobotBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}
@keyframes dzbRobotBlink {
  0%, 92%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(.1); }
}
@keyframes dzbRobotGlow {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}

/* ── Hint bubble (home) ────────────────────────────── */
.dzb-chat__hint {
  position: absolute;
  right: 0;
  bottom: 80px;
  width: 260px;
  max-width: calc(100vw - 40px);
  background: #fff;
  border: 1px solid var(--border, #E8E4DF);
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .16);
  opacity: 0;
  transform: translateY(8px) scale(.96);
  transform-origin: bottom right;
  transition: opacity .25s ease, transform .25s ease;
}
.dzb-chat__hint.is-visible { opacity: 1; transform: translateY(0) scale(1); }
.dzb-chat__hint[hidden] { display: none; }
.dzb-chat.is-open .dzb-chat__hint { display: none; }
.dzb-chat__hint::after {
  content: "";
  position: absolute;
  right: 24px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-right: 1px solid var(--border, #E8E4DF);
  border-bottom: 1px solid var(--border, #E8E4DF);
  transform: rotate(45deg);
}
.dzb-chat__hint-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 14px 32px 14px 15px;
  border: 0;
  background: transparent;
  text-align: start;
  color: var(--ink, #1A1A1A);
  cursor: pointer;
  font-family: inherit;
}
.dzb-chat__hint-body strong { font-family: 'Bricolage Grotesque', sans-serif; font-size: 15px; }
.dzb-chat__hint-body > span:last-child { font-size: 13px; line-height: 1.45; color: var(--muted, #6B6B6B); }
.dzb-chat__hint-tag {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--secondary-light, #E7F0FF);
  color: var(--secondary, #1e3c87);
  font-size: 11px;
  font-weight: 700;
}
.dzb-chat__hint-close {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted, #6B6B6B);
  font-size: 18px;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.dzb-chat__hint-close:hover { background: #f2f0ed; color: var(--ink, #1A1A1A); }

@media (prefers-reduced-motion: reduce) {
  .dzb-chat__launcher::before,
  .dzb-robot,
  .dzb-robot__eyes,
  .dzb-robot__antenna-tip { animation: none !important; }
}

.dzb-chat__panel {
  position: absolute;
  right: 0;
  bottom: 78px;
  width: 370px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 110px);
  background: #fff;
  border: 1px solid var(--border, #E8E4DF);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: dzbChatIn .2s ease-out;
}
.dzb-chat__panel[hidden] { display: none; }

@keyframes dzbChatIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.dzb-chat__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 14px 16px;
  background: var(--grad-secondary, #1e3c87);
  color: #fff;
}
.dzb-chat__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  display: grid;
  place-items: center;
  padding: 5px;
  flex-shrink: 0;
}
.dzb-chat__heading { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.dzb-chat__heading strong { font-family: 'Bricolage Grotesque', sans-serif; font-size: 15px; }
.dzb-chat__heading span { font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dzb-chat__icon-btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.dzb-chat__icon-btn:hover { background: rgba(255, 255, 255, .14); }

.dzb-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  background: var(--bg, #FAFAF8);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dzb-chat__msg { display: flex; flex-direction: column; max-width: 88%; }
.dzb-chat__msg--user { align-self: flex-end; align-items: flex-end; }
.dzb-chat__msg--bot { align-self: flex-start; }

.dzb-chat__bubble {
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.dzb-chat__msg--bot .dzb-chat__bubble {
  background: #fff;
  color: var(--ink, #1A1A1A);
  border: 1px solid var(--border, #E8E4DF);
  border-bottom-left-radius: 4px;
}
.dzb-chat__msg--user .dzb-chat__bubble {
  background: var(--brand, #C8391A);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.dzb-chat__bubble a { color: var(--secondary, #1e3c87); font-weight: 600; }

.dzb-chat__typing .dzb-chat__bubble { display: flex; gap: 4px; padding: 13px 14px; }
.dzb-chat__typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted, #6B6B6B);
  animation: dzbChatDot 1.2s infinite ease-in-out;
}
.dzb-chat__typing span:nth-child(2) { animation-delay: .15s; }
.dzb-chat__typing span:nth-child(3) { animation-delay: .3s; }
@keyframes dzbChatDot {
  0%, 80%, 100% { opacity: .3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.dzb-chat__cards { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; width: 100%; }
.dzb-chat__card {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 7px;
  background: #fff;
  border: 1px solid var(--border, #E8E4DF);
  border-radius: 12px;
  text-decoration: none;
  color: var(--ink, #1A1A1A);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.dzb-chat__card:hover { border-color: var(--brand, #C8391A); box-shadow: var(--shadow-sm, 0 1px 4px rgba(0,0,0,.07)); }
.dzb-chat__card img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 8px;
  background: #f4f2ef;
  flex-shrink: 0;
}
.dzb-chat__card-body { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.dzb-chat__card-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.dzb-chat__card-price { font-size: 13px; font-weight: 700; color: var(--brand, #C8391A); }
.dzb-chat__card-badge { font-size: 11px; color: var(--muted, #6B6B6B); }

.dzb-chat__suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 14px 0;
  background: var(--bg, #FAFAF8);
}
.dzb-chat__suggestions[hidden] { display: none; }
.dzb-chat__suggestions button {
  border: 1px solid var(--border, #E8E4DF);
  background: #fff;
  color: var(--secondary, #1e3c87);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
}
.dzb-chat__suggestions button:hover { border-color: var(--secondary, #1e3c87); background: var(--secondary-light, #E7F0FF); }

.dzb-chat__form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border, #E8E4DF);
  background: #fff;
}
.dzb-chat__form textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--border, #E8E4DF);
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 14px;
  line-height: 1.4;
  max-height: 110px;
  outline: none;
  font-family: inherit;
}
.dzb-chat__form textarea:focus { border-color: var(--secondary, #1e3c87); }
.dzb-chat__send {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: var(--brand, #C8391A);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.dzb-chat__send:disabled { opacity: .5; cursor: wait; }

.dzb-chat__disclaimer {
  margin: 0;
  padding: 0 12px 9px;
  font-size: 11px;
  color: var(--muted, #6B6B6B);
  background: #fff;
  text-align: center;
}

@media (max-width: 768px) {
  body:has(.sticky-buy-bar) .dzb-chat:not(.is-open) { bottom: 88px; }
}

@media (max-width: 575.98px) {
  .dzb-chat { right: 14px; bottom: 14px; }
  .dzb-chat__launcher { width: 56px; height: 56px; font-size: 22px; }
  .dzb-chat__icon-open { width: 36px; height: 36px; }
  .dzb-chat__hint { bottom: 70px; width: 240px; }
  .dzb-chat.is-open { inset: 0; right: 0; bottom: 0; }
  .dzb-chat.is-open .dzb-chat__launcher { display: none; }
  .dzb-chat__panel {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    border-radius: 0;
    border: 0;
  }
}
