.chatbot-root {
  position: fixed;
  right: 20px;
  bottom: calc(90px + 38px + 12px);
  z-index: 1080;
  font-family: inherit;
}

.chatbot-fab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: var(--primary, #8e4626);
  color: var(--white, #fff);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 12px 30px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.chatbot-fab:hover {
  transform: translateY(-2px);
  background: #6e3420;
  box-shadow: 0 6px 20px rgba(142, 70, 38, 0.28);
}

.chatbot-fab:focus-visible {
  outline: 2px solid var(--primary, #8e4626);
  outline-offset: 3px;
}

.chatbot-fab-icon {
  display: block;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.chatbot-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 14px);
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 150px));
  display: flex;
  flex-direction: column;
  background: var(--white, #fff);
  border: 1px solid var(--line, #e9e9e9);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(16, 16, 16, 0.16);
  overflow: hidden;
  isolation: isolate;
}

.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  flex: 0 0 auto;
  position: relative;
  z-index: 3;
  top: auto !important;
  background-color: #6e3420;
  background-image: linear-gradient(135deg, #8e4626 0%, #6e3420 100%);
  color: var(--white, #fff);
  transform: translateZ(0);
}

header.chatbot-header,
.chatbot-header.header-sticky {
  top: auto !important;
  background-color: #6e3420 !important;
  background-image: linear-gradient(135deg, #8e4626 0%, #6e3420 100%) !important;
  box-shadow: none !important;
}

.chatbot-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: #6e3420;
}

.chatbot-eyebrow {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.82;
  color: #fff;
  -webkit-text-fill-color: #fff;
}

.chatbot-title {
  margin: 2px 0 0;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 600;
  color: #fff;
  -webkit-text-fill-color: #fff;
}

.chatbot-close {
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.chatbot-close:hover {
  background: rgba(255, 255, 255, 0.24);
}

.chatbot-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  background: var(--bg-7, #f8f4ec);
  position: relative;
  z-index: 1;
}

.chatbot-message {
  display: flex;
  margin-bottom: 12px;
}

.chatbot-message--user {
  justify-content: flex-end;
}

.chatbot-message--bot,
.chatbot-message--products {
  justify-content: flex-start;
}

.chatbot-bubble {
  max-width: 85%;
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
}

.chatbot-message--user .chatbot-bubble {
  background: var(--primary, #8e4626);
  color: var(--white, #fff);
  border-bottom-right-radius: 6px;
}

.chatbot-message--bot .chatbot-bubble {
  background: var(--white, #fff);
  color: var(--text, #101010);
  border: 1px solid var(--line, #e9e9e9);
  border-bottom-left-radius: 6px;
}

.chatbot-message--products .chatbot-bubble {
  max-width: 100%;
  width: 100%;
  padding: 4px 0 0;
  background: transparent;
  border: 0;
}

.chatbot-products {
  display: grid;
  gap: 10px;
}

.chatbot-product-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 14px;
  background: var(--white, #fff);
  border: 1px solid var(--line, #e9e9e9);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chatbot-product-card:hover {
  border-color: rgba(142, 70, 38, 0.35);
  box-shadow: 0 6px 18px rgba(142, 70, 38, 0.1);
}

.chatbot-product-image {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--bg-2, #f6f4f3);
}

.chatbot-product-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.chatbot-product-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #101010);
}

.chatbot-product-price {
  font-size: 13px;
  color: var(--primary, #8e4626);
  font-weight: 600;
}

.chatbot-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line, #e9e9e9);
  background: var(--white, #fff);
  flex: 0 0 auto;
  position: relative;
  z-index: 3;
}

.chatbot-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line, #e9e9e9);
  border-radius: 999px;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text, #101010);
  background: var(--bg, #f7f7f7);
}

.chatbot-input::placeholder {
  color: var(--text-3, #b1b2b7);
}

.chatbot-input:focus {
  outline: none;
  border-color: var(--primary, #8e4626);
  background: var(--white, #fff);
}

.chatbot-send {
  border: 0;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary, #8e4626);
  color: var(--white, #fff);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.chatbot-send:hover:not(:disabled) {
  background: #6e3420;
}

.chatbot-send:disabled,
.chatbot-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.chatbot-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.chatbot-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary, #8e4626);
  opacity: 0.45;
  animation: chatbot-bounce 1.2s infinite ease-in-out;
}

.chatbot-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.chatbot-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes chatbot-bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* Keep chatbot outside page shimmer / skeleton styles */
html.site-loading .chatbot-root,
html.site-loading .chatbot-root * {
  animation: none !important;
  background-image: none !important;
}

html.site-loading .chatbot-header {
  background-color: #6e3420 !important;
  background-image: linear-gradient(135deg, #8e4626 0%, #6e3420 100%) !important;
}

html.site-loading .chatbot-root :is(h1, h2, h3, h4, h5, h6, p, span, a, button, input) {
  color: inherit !important;
  -webkit-text-fill-color: currentColor !important;
  min-width: 0 !important;
  min-height: 0 !important;
}

@media (min-width: 992px) {
  .chatbot-root {
    right: 40px;
  }

  .chatbot-fab {
    width: 48px;
    height: 48px;
  }

  .chatbot-fab-icon {
    width: 22px;
    height: 22px;
  }
}

@media (min-width: 992px) and (max-width: 1199px) {
  .chatbot-root {
    bottom: calc(90px + 48px + 12px);
  }
}

@media (min-width: 1200px) {
  .chatbot-root {
    bottom: calc(40px + 48px + 12px);
  }
}

@media (max-width: 767px) {
  .chatbot-panel {
    position: fixed;
    right: 12px;
    left: 12px;
    bottom: 148px;
    width: auto;
    height: min(68vh, 520px);
  }
}
