/* IBU Jewels chat widget — scoped to .ibu-chat to avoid clashes with theme CSS. */
.ibu-chat,
.ibu-chat * {
  box-sizing: border-box;
}
.ibu-chat {
  --ibu-primary: #c8967b;
  --ibu-primary-dark: #a87560;
  --ibu-bg: #ffffff;
  --ibu-text: #2a2118;
  --ibu-muted: #7a6f63;
  --ibu-bubble-bot: #f4ece0;
  --ibu-bubble-user: #c8967b;
  --ibu-bubble-user-text: #ffffff;
  --ibu-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  --ibu-radius: 16px;
  position: fixed;
  z-index: 2147483000;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--ibu-text);
}
.ibu-chat--bottom-right { right: 20px; bottom: 90px; }
.ibu-chat--bottom-left  { left: 20px;  bottom: 90px; }

/* --- Launcher bubble ------------------------------------------------------ */
.ibu-chat__launcher {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--ibu-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--ibu-shadow);
  transition: transform .15s ease, background .15s ease;
}
.ibu-chat__launcher:hover { background: var(--ibu-primary-dark); transform: scale(1.05); }
.ibu-chat__launcher svg { width: 26px; height: 26px; }
.ibu-chat__launcher-badge {
  position: absolute;
  top: -2px; right: -2px;
  background: #c0392b;
  color: #fff;
  border-radius: 10px;
  min-width: 18px; height: 18px;
  font-size: 11px; font-weight: 600;
  display: none;
  align-items: center; justify-content: center;
  padding: 0 5px;
}

/* --- Panel ---------------------------------------------------------------- */
.ibu-chat__panel {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 360px;
  max-width: calc(100vw - 24px);
  height: 540px;
  max-height: calc(100vh - 100px);
  background: var(--ibu-bg);
  border-radius: var(--ibu-radius);
  box-shadow: var(--ibu-shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.ibu-chat--bottom-left .ibu-chat__panel { left: 0; right: auto; }
.ibu-chat--open .ibu-chat__panel { display: flex; }
.ibu-chat--open .ibu-chat__launcher { display: none; }

.ibu-chat__header {
  background: var(--ibu-primary);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ibu-chat__avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  letter-spacing: .5px;
}
.ibu-chat__title {
  font-size: 15px;
  font-weight: 600;
  flex: 1;
  line-height: 1.2;
}
.ibu-chat__subtitle {
  font-size: 11px;
  opacity: .85;
  font-weight: 400;
}
.ibu-chat__close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}
.ibu-chat__close:hover { opacity: .8; }

.ibu-chat__body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: #fbf8f3;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ibu-chat__msg {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.45;
}
.ibu-chat__msg--bot {
  background: var(--ibu-bubble-bot);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.ibu-chat__msg--user {
  background: var(--ibu-bubble-user);
  color: var(--ibu-bubble-user-text);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.ibu-chat__msg--system {
  background: transparent;
  align-self: center;
  color: var(--ibu-muted);
  font-size: 12px;
  font-style: italic;
  padding: 4px 8px;
  max-width: 100%;
  text-align: center;
}

.ibu-chat__typing {
  display: inline-flex;
  gap: 4px;
  padding: 12px 14px;
}
.ibu-chat__typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ibu-muted);
  opacity: .4;
  animation: ibu-chat-blink 1.2s infinite ease-in-out;
}
.ibu-chat__typing span:nth-child(2) { animation-delay: .2s; }
.ibu-chat__typing span:nth-child(3) { animation-delay: .4s; }
@keyframes ibu-chat-blink {
  0%, 80%, 100% { opacity: .25; }
  40% { opacity: 1; }
}

.ibu-chat__footer {
  padding: 10px 12px;
  border-top: 1px solid #eee5d6;
  background: #fff;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.ibu-chat__input {
  flex: 1;
  resize: none;
  border: 1px solid #e0d4c3;
  border-radius: 18px;
  padding: 9px 14px;
  font: inherit;
  outline: none;
  max-height: 100px;
  line-height: 1.4;
}
.ibu-chat__input:focus { border-color: var(--ibu-primary); }
.ibu-chat__send {
  background: var(--ibu-primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 36px; height: 36px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ibu-chat__send:disabled { background: #ddd; cursor: not-allowed; }
.ibu-chat__send svg { width: 18px; height: 18px; }

.ibu-chat__handoff {
  padding: 8px 12px;
  border-top: 1px solid #eee5d6;
  background: #fffaf0;
  font-size: 12px;
  color: var(--ibu-muted);
  display: flex;
  justify-content: center;
  gap: 4px;
}
.ibu-chat__handoff a {
  color: var(--ibu-primary-dark);
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
}
.ibu-chat__handoff a:hover { color: var(--ibu-primary); }
