:root {
  --img-chatbot-dark: #03050b;
  --img-chatbot-panel: #ffffff;
  --img-chatbot-soft: #f8fafc;
  --img-chatbot-line: rgba(15, 23, 42, .1);
  --img-chatbot-accent: #ea580c;
  --img-chatbot-green: #25d366;
  --img-chatbot-text: #0f172a;
  --img-chatbot-muted: #64748b;
}

.img-chatbot-hidden {
  display: none !important;
}

#chatbot-container {
  display: none !important;
}

.img-chatbot {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 80;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

.img-chatbot * {
  box-sizing: border-box;
}

.img-chatbot__bubble {
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--img-chatbot-dark), #111827);
  box-shadow: 0 18px 45px rgba(3, 5, 11, .38);
  cursor: pointer;
  transition: transform .2s ease, background-color .2s ease, box-shadow .2s ease;
}

.img-chatbot__bubble:hover {
  transform: translateY(-2px) scale(1.03);
  background: var(--img-chatbot-accent);
  box-shadow: 0 18px 45px rgba(234, 88, 12, .32);
}

.img-chatbot__bubble:focus-visible,
.img-chatbot button:focus-visible,
.img-chatbot a:focus-visible,
.img-chatbot input:focus-visible {
  outline: 3px solid rgba(234, 88, 12, .38);
  outline-offset: 3px;
}

.img-chatbot__bubble svg {
  width: 30px;
  height: 30px;
  fill: currentColor;
}

.img-chatbot__badge {
  position: absolute;
  right: 54px;
  bottom: 42px;
  border-radius: 999px;
  padding: 8px 12px;
  color: #fff;
  background: rgba(3, 5, 11, .92);
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .18);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.img-chatbot__window {
  position: absolute;
  right: 0;
  bottom: 78px;
  width: min(390px, calc(100vw - 32px));
  height: min(650px, calc(100svh - 112px));
  min-height: 480px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 20px;
  background: var(--img-chatbot-panel);
  border: 1px solid var(--img-chatbot-line);
  box-shadow: 0 30px 80px rgba(3, 5, 11, .28);
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(.96);
  transform-origin: bottom right;
  transition: opacity .22s ease, transform .22s ease;
}

.img-chatbot.is-open .img-chatbot__window {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.img-chatbot__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  color: #fff;
  background: radial-gradient(circle at 15% 0, rgba(234, 88, 12, .34), transparent 34%), var(--img-chatbot-dark);
}

.img-chatbot__identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.img-chatbot__logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #fff;
  object-fit: contain;
  flex: 0 0 auto;
}

.img-chatbot__title {
  margin: 0;
  font-size: 15px;
  line-height: 1.1;
  font-weight: 900;
}

.img-chatbot__status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: #86efac;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.img-chatbot__status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #22c55e;
}

.img-chatbot__actions {
  display: flex;
  gap: 6px;
}

.img-chatbot__icon-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: rgba(255, 255, 255, .1);
  cursor: pointer;
}

.img-chatbot__messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  background: var(--img-chatbot-soft);
}

.img-chatbot__message {
  display: flex;
  gap: 9px;
  max-width: 92%;
  opacity: 0;
  transform: translateY(8px);
  animation: imgChatIn .24s ease forwards;
}

.img-chatbot__message--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.img-chatbot__avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--img-chatbot-dark);
  font-size: 10px;
  font-weight: 900;
}

.img-chatbot__bubble-text {
  border-radius: 16px;
  padding: 11px 13px;
  color: var(--img-chatbot-text);
  background: #fff;
  border: 1px solid rgba(15, 23, 42, .08);
  font-size: 13px;
  line-height: 1.48;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .06);
}

.img-chatbot__message--bot .img-chatbot__bubble-text {
  border-top-left-radius: 4px;
}

.img-chatbot__message--user .img-chatbot__bubble-text {
  color: #fff;
  background: var(--img-chatbot-accent);
  border-color: transparent;
  border-top-right-radius: 4px;
}

.img-chatbot__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 14px;
  background: var(--img-chatbot-soft);
}

.img-chatbot__chip {
  min-height: 38px;
  border: 1px solid rgba(234, 88, 12, .22);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--img-chatbot-accent);
  background: #fff;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
  transition: transform .16s ease, background-color .16s ease, color .16s ease;
}

.img-chatbot__chip:hover {
  transform: translateY(-1px);
  color: #fff;
  background: var(--img-chatbot-accent);
}

.img-chatbot__inputbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  background: #fff;
  border-top: 1px solid var(--img-chatbot-line);
}

.img-chatbot__input {
  width: 100%;
  min-height: 44px;
  border-radius: 13px;
  border: 1px solid rgba(15, 23, 42, .13);
  padding: 0 13px;
  color: var(--img-chatbot-text);
  background: #f8fafc;
  font-size: 14px;
}

.img-chatbot__send {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 13px;
  color: #fff;
  background: var(--img-chatbot-dark);
  cursor: pointer;
}

.img-chatbot__summary {
  display: grid;
  gap: 7px;
  margin-top: 6px;
  padding: 12px;
  border-radius: 14px;
  background: #fff7ed;
  border: 1px solid rgba(234, 88, 12, .22);
}

.img-chatbot__summary strong {
  color: #9a3412;
}

.img-chatbot__link {
  color: #c2410c;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.img-chatbot__wa {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  margin-top: 8px;
  border-radius: 12px;
  padding: 10px 13px;
  color: #fff;
  background: var(--img-chatbot-green);
  font-weight: 900;
  text-decoration: none;
}

@keyframes imgChatIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  .img-chatbot {
    right: max(10px, env(safe-area-inset-right));
    bottom: calc(84px + env(safe-area-inset-bottom));
    z-index: 110;
  }

  .img-chatbot__window {
    width: calc(100vw - 20px);
    height: min(610px, calc(100svh - 180px));
    min-height: min(430px, calc(100svh - 180px));
    border-radius: 18px;
  }

  .img-chatbot__badge {
    display: none;
  }

  .img-chatbot__bubble {
    width: 58px;
    height: 58px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .img-chatbot__window,
  .img-chatbot__bubble,
  .img-chatbot__chip,
  .img-chatbot__message {
    animation: none !important;
    transition: none !important;
  }

  .img-chatbot__message {
    opacity: 1;
    transform: none;
  }
}
