/* ==========================================================================
   Ava Delora Concierge — luxury chat widget
   Navy velvet + champagne gold. Crafted, quiet, fast.
   ========================================================================== */

:root {
  --ad-navy: #0b2436;
  --ad-navy-2: #002e48;
  --ad-navy-3: #133850;
  --ad-navy-deep: #071a28;
  --ad-gold: #c8a96a;
  --ad-gold-2: #dbc08a;
  --ad-gold-dim: rgba(200, 169, 106, 0.35);
  --ad-ivory: #fdfcfa;
  --ad-paper: #f6f4ef;
  --ad-ink: #1c2733;
  --ad-ink-soft: #5a6b7a;
  --ad-ink-faint: #8b99a6;
  --ad-line: #e7e2d8;
  --ad-line-soft: #f0ece4;
  --ad-user-bubble: linear-gradient(160deg, #0e2c42 0%, #002e48 60%, #07334e 100%);
  --ad-header: linear-gradient(165deg, #0b2436 0%, #002e48 55%, #0d3350 100%);
  --ad-shadow-window: 0 24px 70px rgba(7, 26, 40, 0.28), 0 4px 18px rgba(7, 26, 40, 0.14);
  --ad-shadow-bubble: 0 10px 32px rgba(7, 26, 40, 0.32);
  --ad-shadow-pop: 0 14px 40px rgba(7, 26, 40, 0.2);
  --ad-r-window: 22px;
  --ad-r-bubble: 16px;
  --ad-r-pill: 999px;
  --ad-ease: cubic-bezier(0.32, 0.72, 0.24, 1);
  --ad-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ad-serif: "Cormorant Garamond", "Playfair Display", Georgia, "Times New Roman", serif;
  --ai-z: 2147483647;
}

/* ==========================================================================
   Launcher
   ========================================================================== */

#ai-chatbot-bubble {
  position: fixed !important;
  right: 40px !important;
  bottom: 40px !important;
  left: auto !important;
  top: auto !important;
  width: 60px !important;
  height: 60px !important;
  border: none;
  border-radius: 50%;
  background:
    radial-gradient(120% 120% at 30% 20%, #14405e 0%, var(--ad-navy-2) 45%, var(--ad-navy-deep) 100%);
  color: var(--ad-gold-2);
  cursor: pointer;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  box-shadow:
    var(--ad-shadow-bubble),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 0 0 1px rgba(200, 169, 106, 0.28);
  z-index: var(--ai-z) !important;
  isolation: isolate;
  margin: 0 !important;
  float: none !important;
  overflow: visible;
  font-family: var(--ad-font);
  transition: transform 280ms var(--ad-ease), box-shadow 280ms var(--ad-ease);
}

#ai-chatbot-bubble:hover {
  transform: translateY(-2px);
  box-shadow:
    0 16px 42px rgba(7, 26, 40, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 0 0 1px rgba(200, 169, 106, 0.55);
}

#ai-chatbot-bubble:active { transform: translateY(0) scale(0.97); }

#ai-chatbot-bubble:focus-visible {
  outline: 2px solid var(--ad-gold);
  outline-offset: 3px;
}

#ai-chatbot-bubble .bubble-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  pointer-events: none;
}

#ai-chatbot-bubble .bubble-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* slow shimmer sweep across the launcher */
#ai-chatbot-bubble::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(115deg, transparent 30%, rgba(219, 192, 138, 0.25) 48%, transparent 62%);
  background-size: 250% 250%;
  animation: ad-shimmer 5.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes ad-shimmer {
  0%, 65%, 100% { background-position: 120% 0; }
  82% { background-position: -40% 0; }
}

/* unread dot */
#ai-chatbot-bubble .bubble-unread {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ad-gold);
  border: 2px solid var(--ad-ivory);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 200ms ease, transform 260ms var(--ad-ease);
  pointer-events: none;
}

#ai-chatbot-bubble.has-unread .bubble-unread {
  opacity: 1;
  transform: scale(1);
}

/* hide (×) control on launcher */
#ai-chatbot-bubble-hide {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(28, 39, 51, 0.78);
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--ai-z) !important;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 180ms ease, transform 220ms var(--ad-ease), background 180ms ease;
}

#ai-chatbot-bubble:hover #ai-chatbot-bubble-hide,
#ai-chatbot-bubble-hide:focus-visible {
  opacity: 1;
  transform: scale(1);
}

#ai-chatbot-bubble-hide:hover { background: rgba(28, 39, 51, 0.95); }

#ai-chatbot-bubble.hidden { display: none !important; }

/* ==========================================================================
   Proactive teaser
   ========================================================================== */

#ai-chatbot-teaser {
  position: fixed;
  right: 40px;
  bottom: 112px;
  max-width: 250px;
  background: var(--ad-ivory);
  color: var(--ad-ink);
  border: 1px solid var(--ad-line);
  border-radius: 16px 16px 4px 16px;
  padding: 12px 34px 12px 14px;
  font-family: var(--ad-font);
  font-size: 13.5px;
  line-height: 1.45;
  box-shadow: var(--ad-shadow-pop);
  z-index: var(--ai-z);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 320ms var(--ad-ease), transform 320ms var(--ad-ease);
}

#ai-chatbot-teaser.visible { opacity: 1; transform: translateY(0); }

#ai-chatbot-teaser .teaser-title {
  display: block;
  font-weight: 700;
  color: var(--ad-navy-2);
  margin-bottom: 2px;
}

#ai-chatbot-teaser .teaser-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--ad-ink-faint);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#ai-chatbot-teaser .teaser-close:hover { color: var(--ad-ink); background: var(--ad-line-soft); }

/* ==========================================================================
   Window
   ========================================================================== */

#ai-chatbot-window {
  position: fixed !important;
  right: 40px !important;
  bottom: 116px !important;
  left: auto !important;
  top: auto !important;
  width: 372px;
  height: 660px;
  max-height: calc(100vh - 140px);
  display: none;
  flex-direction: column;
  background: var(--ad-ivory);
  border: 1px solid rgba(200, 169, 106, 0.35);
  border-radius: var(--ad-r-window);
  box-shadow: var(--ad-shadow-window);
  overflow: hidden;
  z-index: var(--ai-z) !important;
  isolation: isolate;
  font-family: var(--ad-font);
  transform: translateY(14px) scale(0.97);
  transform-origin: bottom right;
  opacity: 0;
  transition: transform 340ms var(--ad-ease), opacity 280ms ease;
}

#ai-chatbot-window.open {
  display: flex;
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* ==========================================================================
   Header
   ========================================================================== */

#ai-chatbot-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 16px 14px 18px;
  background:
    radial-gradient(140% 180% at 0% 0%, #143d59 0%, var(--ad-navy-2) 48%, var(--ad-navy-deep) 100%);
  color: #fff;
  overflow: hidden;
}

/* hairline gold rule under header */
#ai-chatbot-header::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--ad-gold) 30%, var(--ad-gold-2) 50%, var(--ad-gold) 70%, transparent);
  opacity: 0.85;
}

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

/* monogram avatar */
.header-avatar {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(120% 120% at 30% 25%, #1a4a6b, var(--ad-navy-deep));
  border: 1px solid var(--ad-gold-dim);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
  color: var(--ad-gold-2);
  font-family: var(--ad-serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

#ai-chatbot-header h3 {
  margin: 0;
  font-family: var(--ad-serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#ai-chatbot-header .store-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.75);
}

#ai-chatbot-header .store-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7ad97a;
  box-shadow: 0 0 0 0 rgba(122, 217, 122, 0.6);
  animation: ad-pulse 2.4s ease-out infinite;
}

@keyframes ad-pulse {
  0% { box-shadow: 0 0 0 0 rgba(122, 217, 122, 0.55); }
  70% { box-shadow: 0 0 0 6px rgba(122, 217, 122, 0); }
  100% { box-shadow: 0 0 0 0 rgba(122, 217, 122, 0); }
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

#ai-chatbot-back,
#ai-chatbot-close {
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
  width: 32px;
  height: 32px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 160ms ease, color 160ms ease;
}

#ai-chatbot-back:hover,
#ai-chatbot-close:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

#ai-chatbot-back svg,
#ai-chatbot-close svg {
  width: 15px;
  height: 15px;
  display: block;
}

/* ==========================================================================
   Perks strip
   ========================================================================== */

#ai-chatbot-perks {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 8px 14px;
  background: var(--ad-paper);
  border-bottom: 1px solid var(--ad-line-soft);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ad-ink-soft);
  white-space: nowrap;
  overflow: hidden;
}

#ai-chatbot-perks .perk {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

#ai-chatbot-perks .perk svg {
  width: 12px;
  height: 12px;
  color: var(--ad-gold);
  flex: none;
}

#ai-chatbot-perks .perk-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--ad-gold-dim);
  flex: none;
}

/* ==========================================================================
   Messages
   ========================================================================== */

#ai-chatbot-messages {
  flex: 1;
  padding: 18px 16px 12px;
  background: var(--ad-ivory);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

#ai-chatbot-messages::-webkit-scrollbar { width: 6px; }
#ai-chatbot-messages::-webkit-scrollbar-track { background: transparent; }
#ai-chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(139, 153, 166, 0.35);
  border-radius: 999px;
}
#ai-chatbot-messages::-webkit-scrollbar-thumb:hover { background: rgba(139, 153, 166, 0.55); }

/* message rows */
.chatbot-row {
  display: flex;
  flex-direction: column;
  max-width: 100%;
  animation: ad-msg-in 320ms var(--ad-ease) both;
}

@keyframes ad-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chatbot-row.user { align-items: flex-end; }
.chatbot-row.assistant { align-items: flex-start; }
.chatbot-row.system { align-items: center; }

.chatbot-row .row-inner {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 88%;
}

/* small assistant avatar beside bubbles */
.msg-avatar {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(120% 120% at 30% 25%, #1a4a6b, var(--ad-navy-deep));
  border: 1px solid var(--ad-gold-dim);
  color: var(--ad-gold-2);
  font-family: var(--ad-serif);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

/* bubbles */
.chatbot-message {
  padding: 11px 14px;
  font-size: 14px;
  line-height: 1.55;
  border-radius: var(--ad-r-bubble);
  word-wrap: break-word;
  word-break: break-word;
  position: relative;
}

.chatbot-message.user {
  background: var(--ad-user-bubble);
  color: #f4f7f9;
  border-bottom-right-radius: 5px;
  box-shadow: 0 3px 10px rgba(7, 26, 40, 0.22);
  font-weight: 450;
}

.chatbot-message.assistant {
  background: #fff;
  color: var(--ad-ink);
  border: 1px solid var(--ad-line);
  border-bottom-left-radius: 5px;
  box-shadow: 0 2px 8px rgba(28, 39, 51, 0.05);
}

.chatbot-message.system {
  background: var(--ad-paper);
  color: var(--ad-ink-soft);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--ad-r-pill);
  border: 1px solid var(--ad-line-soft);
}

/* timestamp */
.msg-time {
  font-size: 10.5px;
  color: var(--ad-ink-faint);
  margin-top: 4px;
  padding: 0 4px;
  letter-spacing: 0.02em;
}

.chatbot-row.assistant .msg-time { margin-left: 38px; }

/* links inside messages */
.chatbot-link {
  color: #1d5b8c;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(29, 91, 140, 0.4);
  transition: color 150ms ease, border-color 150ms ease;
}

.chatbot-link:hover {
  color: var(--ad-navy-2);
  border-bottom-color: var(--ad-navy-2);
}

.chatbot-message.user .chatbot-link {
  color: var(--ad-gold-2);
  border-bottom-color: var(--ad-gold-dim);
}

.chatbot-message code {
  background: var(--ad-paper);
  border: 1px solid var(--ad-line);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 12.5px;
}

/* ==========================================================================
   Discount code chip (copy to clipboard)
   ========================================================================== */

.ad-code-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 2px 1px;
  padding: 5px 10px 5px 12px;
  background: linear-gradient(160deg, #fbf7ee, #f6efdf);
  border: 1px dashed var(--ad-gold);
  border-radius: 9px;
  color: var(--ad-navy-2);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.08em;
  cursor: pointer;
  user-select: none;
  vertical-align: middle;
  transition: background 160ms ease, transform 160ms var(--ad-ease), border-color 160ms ease;
}

.ad-code-chip:hover {
  background: linear-gradient(160deg, #faf3e3, #f2e8d0);
  transform: translateY(-1px);
  border-color: var(--ad-gold-2);
}

.ad-code-chip svg {
  width: 13px;
  height: 13px;
  color: var(--ad-gold);
  flex: none;
}

.ad-code-chip .chip-hint {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ad-ink-faint);
}

.ad-code-chip.copied {
  background: #eef7ee;
  border-color: #7ab87a;
}

.ad-code-chip.copied .chip-hint { color: #3e8e41; }
.ad-code-chip.copied svg { color: #3e8e41; }

/* ==========================================================================
   Quick replies
   ========================================================================== */

.chatbot-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chatbot-quick-reply-btn {
  background: #fff;
  border: 1px solid var(--ad-gold-dim);
  border-radius: var(--ad-r-pill);
  color: var(--ad-navy-2);
  cursor: pointer;
  font-family: var(--ad-font);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  padding: 8px 14px;
  white-space: nowrap;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 4px rgba(28, 39, 51, 0.06);
  transition: background 180ms ease, border-color 180ms ease, transform 180ms var(--ad-ease), box-shadow 180ms ease;
}

.chatbot-quick-reply-btn:hover {
  background: var(--ad-navy-2);
  border-color: var(--ad-navy-2);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(7, 26, 40, 0.22);
}

.chatbot-quick-reply-btn:active { transform: translateY(0); }

.chatbot-quick-reply-btn:focus-visible {
  outline: 2px solid var(--ad-gold);
  outline-offset: 2px;
}

/* ==========================================================================
   Typing indicator
   ========================================================================== */

.typing-indicator {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  align-self: flex-start;
  animation: ad-msg-in 240ms var(--ad-ease) both;
}

.typing-indicator .typing-bubble {
  background: #fff;
  border: 1px solid var(--ad-line);
  padding: 12px 14px;
  border-radius: var(--ad-r-bubble);
  border-bottom-left-radius: 5px;
}

.typing-dots {
  display: inline-flex;
  gap: 5px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--ad-gold);
  border-radius: 50%;
  display: inline-block;
  animation: ad-bounce 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 0.14s; }
.typing-dots span:nth-child(3) { animation-delay: 0.28s; }

@keyframes ad-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ==========================================================================
   Scroll-to-bottom
   ========================================================================== */

#ai-chatbot-scroll-down {
  position: absolute;
  right: 14px;
  bottom: 86px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--ad-line);
  border-radius: 50%;
  background: #fff;
  color: var(--ad-navy-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(28, 39, 51, 0.16);
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 200ms ease, transform 240ms var(--ad-ease);
  z-index: 2;
}

#ai-chatbot-scroll-down.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#ai-chatbot-scroll-down svg { width: 14px; height: 14px; }

/* ==========================================================================
   Error / retry
   ========================================================================== */

.chatbot-retry-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 7px 14px;
  background: var(--ad-navy-2);
  border: none;
  border-radius: var(--ad-r-pill);
  color: #fff;
  font-family: var(--ad-font);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms var(--ad-ease);
}

.chatbot-retry-btn:hover { background: var(--ad-navy-3); transform: translateY(-1px); }
.chatbot-retry-btn svg { width: 12px; height: 12px; }

/* ==========================================================================
   Input
   ========================================================================== */

#ai-chatbot-input {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px;
  background: #fff;
  border-top: 1px solid var(--ad-line-soft);
}

#ai-chatbot-message-input {
  flex: 1;
  resize: none;
  min-height: 22px;
  max-height: 96px;
  padding: 10px 14px;
  border: 1px solid var(--ad-line);
  border-radius: 18px;
  font-family: var(--ad-font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ad-ink);
  background: var(--ad-ivory);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

#ai-chatbot-message-input::placeholder { color: var(--ad-ink-faint); }

#ai-chatbot-message-input:focus {
  border-color: var(--ad-gold);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(200, 169, 106, 0.18);
}

#ai-chatbot-send-button {
  flex: none;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  color: var(--ad-gold-2);
  background: radial-gradient(120% 120% at 30% 25%, #14405e, var(--ad-navy-deep));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(7, 26, 40, 0.25), inset 0 1px 0 rgba(255,255,255,0.12);
  transition: transform 180ms var(--ad-ease), box-shadow 180ms ease, opacity 160ms ease;
}

#ai-chatbot-send-button svg {
  width: 17px;
  height: 17px;
  transform: translateX(1px);
}

#ai-chatbot-send-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(7, 26, 40, 0.35), inset 0 1px 0 rgba(255,255,255,0.15);
}

#ai-chatbot-send-button:active:not(:disabled) { transform: scale(0.95); }

#ai-chatbot-send-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* footer note */
#ai-chatbot-footnote {
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ad-ink-faint);
  background: #fff;
  padding: 0 0 8px;
}

/* ==========================================================================
   Accessibility & motion
   ========================================================================== */

#ai-chatbot-window :focus-visible {
  outline: 2px solid var(--ad-gold);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  #ai-chatbot-bubble,
  #ai-chatbot-window,
  #ai-chatbot-teaser,
  #ai-chatbot-send-button,
  .chatbot-row,
  .chatbot-quick-reply-btn,
  .ad-code-chip { transition: none; animation: none; }
  #ai-chatbot-bubble::after { animation: none; }
  #ai-chatbot-header .store-status::before { animation: none; }
  .typing-dots span { animation: none; opacity: 0.7; }
  #ai-chatbot-messages { scroll-behavior: auto; }
}

/* ==========================================================================
   RTL
   ========================================================================== */

[dir="rtl"] #ai-chatbot-window {
  right: auto;
  left: 20px;
}

@media (max-width: 768px) {
  [dir="rtl"] #ai-chatbot-window {
    right: auto !important;
    left: 50% !important;
    transform: translateX(-50%) translateY(14px) scale(0.97);
  }

  [dir="rtl"] #ai-chatbot-window.open {
    transform: translateX(-50%) translateY(0) scale(1);
  }
}
[dir="rtl"] .chatbot-row.user { align-items: flex-start; }
[dir="rtl"] .chatbot-row.assistant { align-items: flex-end; }

/* ==========================================================================
   Responsive — positions preserved
   ========================================================================== */

@media (max-width: 768px) {
  #ai-chatbot-window {
    right: auto !important;
    left: 50% !important;
    bottom: 85px;
    width: calc(100vw - 32px);
    max-width: 420px;
    height: 72vh;
    max-height: 600px;
    min-height: 440px;
    transform: translateX(-50%) translateY(14px) scale(0.97);
    transform-origin: bottom center;
  }

  #ai-chatbot-window.open {
    transform: translateX(-50%) translateY(0) scale(1);
  }

  #ai-chatbot-bubble {
    right: 20px !important;
    bottom: 20px !important;
    left: auto !important;
    top: auto !important;
    width: 54px !important;
    height: 54px !important;
  }

  #ai-chatbot-teaser { right: 20px; bottom: 88px; }

  #ai-chatbot-messages { padding: 14px 12px 10px; gap: 12px; }
  .chatbot-message { font-size: 13.5px; padding: 10px 13px; }
}

@media (max-width: 480px) {
  #ai-chatbot-window {
    right: auto !important;
    left: 50% !important;
    bottom: 80px;
    width: calc(100vw - 24px);
    max-width: none;
    height: 76vh;
    max-height: 540px;
    min-height: 400px;
    border-radius: 18px;
    transform: translateX(-50%) translateY(14px) scale(0.97);
    transform-origin: bottom center;
  }

  #ai-chatbot-window.open {
    transform: translateX(-50%) translateY(0) scale(1);
  }

  #ai-chatbot-header { padding: 13px 12px 12px 14px; }
  #ai-chatbot-header h3 { font-size: 16px; }
  .header-avatar { width: 36px; height: 36px; font-size: 15px; }

  #ai-chatbot-perks { font-size: 10px; gap: 10px; }

  #ai-chatbot-bubble {
    right: 16px !important;
    bottom: 16px !important;
    left: auto !important;
    top: auto !important;
    width: 50px !important;
    height: 50px !important;
  }

  #ai-chatbot-teaser { right: 16px; bottom: 78px; max-width: 215px; }

  #ai-chatbot-bubble-hide {
    width: 20px;
    height: 20px;
    font-size: 12px;
    top: -6px;
    right: -6px;
    opacity: 1;
    transform: scale(1);
  }

  .chatbot-quick-reply-btn { font-size: 12px; padding: 7px 12px; max-width: 170px; }
}
