#ambey-ai-root {
  --ambey-accent: #1e5bd8;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99990;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
}
#ambey-ai-root *, #ambey-ai-root *::before, #ambey-ai-root *::after { box-sizing: border-box; }

/* Launcher: !important beats theme button styles (WoodMart) */
#ambey-ai-root .ambey-ai-launcher {
  position: relative !important;
  width: 64px !important; height: 64px !important; min-width: 0 !important; min-height: 0 !important;
  padding: 0 !important; margin: 0 !important; border: 0 !important; border-radius: 50% !important;
  line-height: 1 !important; cursor: pointer !important; color: #fff !important;
  background: linear-gradient(135deg, var(--ambey-accent) 0%, #7b3fe4 100%) !important;
  box-shadow: 0 8px 24px rgba(30, 91, 216, .45), 0 2px 6px rgba(0,0,0,.18) !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  transition: transform .2s ease, box-shadow .2s ease !important;
  animation: ambeyAiFloat 3.2s ease-in-out infinite;
  overflow: visible !important;
}
#ambey-ai-root .ambey-ai-launcher:hover {
  transform: scale(1.08) !important;
  box-shadow: 0 12px 30px rgba(123, 63, 228, .5), 0 2px 6px rgba(0,0,0,.2) !important;
  animation-play-state: paused;
}
#ambey-ai-root .ambey-ai-launcher:hover .ambey-ai-icon { transform: rotate(-8deg); }
#ambey-ai-root .ambey-ai-icon { display: flex; transition: transform .25s ease; position: relative; z-index: 2; }
#ambey-ai-root .ambey-ai-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 3px solid var(--ambey-accent); opacity: .6; z-index: 1;
  animation: ambeyAiPulse 2.2s ease-out infinite;
  pointer-events: none;
}
#ambey-ai-root .ambey-ai-online {
  position: absolute; top: 3px; right: 3px; z-index: 3;
  width: 14px; height: 14px; border-radius: 50%;
  background: #22c55e; border: 2px solid #fff;
}
.ambey-ai-open .ambey-ai-launcher, .ambey-ai-open .ambey-ai-teaser { display: none !important; }

@keyframes ambeyAiPulse { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes ambeyAiFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* Greeting bubble */
#ambey-ai-root .ambey-ai-teaser {
  position: absolute; right: 0; bottom: 78px; width: 230px;
  background: #fff; color: #1f2937; border-radius: 14px; padding: 11px 30px 11px 13px;
  font-size: 13.5px; line-height: 1.4; cursor: pointer;
  box-shadow: 0 8px 26px rgba(0,0,0,.18);
  animation: ambeyAiPop .35s ease-out;
}
#ambey-ai-root .ambey-ai-teaser[hidden] { display: none !important; }
#ambey-ai-root .ambey-ai-teaser::after {
  content: ""; position: absolute; right: 24px; bottom: -7px; width: 14px; height: 14px;
  background: #fff; transform: rotate(45deg); box-shadow: 3px 3px 6px rgba(0,0,0,.06);
}
#ambey-ai-root .ambey-ai-teaser strong { color: var(--ambey-accent); }
#ambey-ai-root .ambey-ai-teaser-x {
  position: absolute !important; top: 4px !important; right: 6px !important;
  width: 22px !important; height: 22px !important; min-height: 0 !important; padding: 0 !important;
  background: transparent !important; border: 0 !important; color: #9ca3af !important;
  font-size: 18px !important; line-height: 1 !important; cursor: pointer !important; box-shadow: none !important;
}
@keyframes ambeyAiPop { from { opacity: 0; transform: translateY(8px) scale(.95); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  #ambey-ai-root .ambey-ai-launcher, #ambey-ai-root .ambey-ai-ring { animation: none !important; }
}

.ambey-ai-panel {
  width: 370px; max-width: calc(100vw - 24px);
  height: 560px; max-height: calc(100vh - 40px);
  background: #fff; border-radius: 16px; overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
  display: flex; flex-direction: column;
}
.ambey-ai-panel[hidden] { display: none; }

.ambey-ai-head {
  background: linear-gradient(135deg, var(--ambey-accent) 0%, #7b3fe4 100%); color: #fff;
  padding: 14px 16px; display: flex; align-items: center; justify-content: space-between;
}
.ambey-ai-title { font-weight: 700; font-size: 15px; }
.ambey-ai-sub { font-size: 12px; opacity: .85; }
#ambey-ai-root .ambey-ai-close {
  background: transparent !important; border: 0 !important; color: #fff !important; font-size: 26px !important; line-height: 1 !important;
  cursor: pointer; padding: 0 4px !important; min-height: 0 !important; width: auto !important; height: auto !important; box-shadow: none !important;
}

.ambey-ai-body {
  flex: 1; overflow-y: auto; padding: 14px; background: #f5f7fb;
  display: flex; flex-direction: column; gap: 8px;
}
.ambey-ai-msg {
  max-width: 86%; padding: 9px 12px; border-radius: 14px; word-wrap: break-word; overflow-wrap: anywhere;
}
.ambey-ai-model { background: #fff; color: #1f2937; align-self: flex-start; border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.ambey-ai-user { background: var(--ambey-accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.ambey-ai-error { background: #fff4f4; color: #8a1c1c; }
.ambey-ai-msg a { color: var(--ambey-accent); text-decoration: underline; font-weight: 600; }
.ambey-ai-user a { color: #fff; }

.ambey-ai-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; background: #f5f7fb; }
#ambey-ai-root .ambey-ai-chips button {
  min-height: 0 !important; line-height: 1.3 !important; text-transform: none !important; box-shadow: none !important;
  border: 1px solid var(--ambey-accent); color: var(--ambey-accent); background: #fff;
  border-radius: 999px; padding: 5px 10px; font-size: 12.5px; cursor: pointer;
}
.ambey-ai-chips button:hover { background: var(--ambey-accent); color: #fff; }

.ambey-ai-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid #e5e7eb; background: #fff; }
.ambey-ai-input {
  flex: 1; border: 1px solid #d1d5db; border-radius: 999px; padding: 9px 14px; font-size: 14px; outline: none;
  min-height: 40px;
}
.ambey-ai-input:focus { border-color: var(--ambey-accent); }
#ambey-ai-root .ambey-ai-send {
  width: 40px !important; height: 40px !important; min-height: 0 !important; padding: 0 !important; border-radius: 50% !important; border: 0 !important; cursor: pointer;
  background: linear-gradient(135deg, var(--ambey-accent), #7b3fe4) !important; color: #fff !important; font-size: 16px !important; flex: 0 0 40px; line-height: 1 !important;
}

.ambey-ai-foot { font-size: 11.5px; color: #6b7280; text-align: center; padding: 0 10px 9px; background: #fff; }
.ambey-ai-foot a { color: #128c4a; font-weight: 600; text-decoration: none; }

.ambey-ai-dots { display: inline-flex; gap: 4px; padding: 3px 0; }
.ambey-ai-dots i { width: 7px; height: 7px; border-radius: 50%; background: #9ca3af; animation: ambeyAiBlink 1.2s infinite both; }
.ambey-ai-dots i:nth-child(2) { animation-delay: .2s; }
.ambey-ai-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes ambeyAiBlink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

@media (max-width: 480px) {
  #ambey-ai-root { right: 12px; bottom: 12px; }
  .ambey-ai-open#ambey-ai-root { right: 0; bottom: 0; left: 0; top: 0; }
  .ambey-ai-panel { width: 100vw; max-width: 100vw; height: 100%; max-height: 100%; border-radius: 0; }
}

/* Sit above WoodMart's sticky mobile toolbar (Wishlist / Compare bar) */
@media (max-width: 1024px) {
  body:has(.wd-toolbar) #ambey-ai-root:not(.ambey-ai-open) { bottom: 74px; }
}
@media (max-width: 480px) {
  #ambey-ai-root .ambey-ai-launcher { width: 56px !important; height: 56px !important; }
  #ambey-ai-root .ambey-ai-teaser { bottom: 68px; width: 210px; font-size: 12.5px; }
}
