:root {
  --shop-aiplugin-primary: #6366f1;
  --shop-aiplugin-primary-dark: #4f46e5;
  --shop-aiplugin-primary-light: #818cf8;
  --shop-aiplugin-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
  --shop-aiplugin-focus-ring: rgba(99, 102, 241, 0.22);
  --shop-aiplugin-glow-soft: rgba(99, 102, 241, 0.38);
  --shop-aiplugin-glow-strong: rgba(99, 102, 241, 0.5);
  --shop-aiplugin-bg: #f8fafc;
  --shop-aiplugin-surface: #ffffff;
  --shop-aiplugin-border: #e2e8f0;
  --shop-aiplugin-text: #1e293b;
  --shop-aiplugin-text-secondary: #64748b;
  --shop-aiplugin-radius: 16px;
  --shop-aiplugin-shadow: 0 20px 60px rgba(0,0,0,0.15);
  --shop-aiplugin-font-scale: 1;
  --shop-aiplugin-base-font: 10px;
}

#shop-aiplugin-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  direction: ltr;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: calc(var(--shop-aiplugin-base-font) * var(--shop-aiplugin-font-scale));
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}

#shop-aiplugin-chat-widget.shop-aiplugin-font-theme {
  font-family: inherit;
}

#shop-aiplugin-chat-widget.shop-aiplugin-left {
  right: auto;
  left: 24px;
}

#shop-aiplugin-chat-widget * {
  box-sizing: border-box;
  margin: 0;
}

.shop-aiplugin-toggle-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  direction: ltr;
  width: max-content;
  max-width: min(280px, calc(100vw - 48px));
}

#shop-aiplugin-chat-widget.shop-aiplugin-left .shop-aiplugin-toggle-wrap {
  align-items: flex-start;
}

/* RTL storefronts inherit dir=rtl on <html>; keep launcher pinned to configured corner. */
html[dir="rtl"] #shop-aiplugin-chat-widget,
html[dir="rtl"] #shop-aiplugin-chat-widget .shop-aiplugin-toggle-wrap {
  direction: ltr;
}

html[dir="rtl"] #shop-aiplugin-chat-widget:not(.shop-aiplugin-left) .shop-aiplugin-toggle-wrap {
  align-items: flex-end;
}

html[dir="rtl"] #shop-aiplugin-chat-widget.shop-aiplugin-left .shop-aiplugin-toggle-wrap {
  align-items: flex-start;
}

.shop-aiplugin-widget-teaser {
  position: relative;
  width: fit-content;
  max-width: min(280px, calc(100vw - 48px));
  padding: 10px 30px 10px 14px;
  border-radius: 14px;
  background: var(--shop-aiplugin-surface);
  color: var(--shop-aiplugin-text);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  border: 1px solid var(--shop-aiplugin-border);
  font-size: calc(13px * var(--shop-aiplugin-font-scale));
  line-height: 1.45;
  text-align: start;
  animation: shop-aiplugin-teaser-in 0.35s ease;
}

.shop-aiplugin-toggle-wrap .shop-aiplugin-widget-teaser {
  min-width: 0;
  align-self: flex-end;
}

#shop-aiplugin-chat-widget.shop-aiplugin-left .shop-aiplugin-toggle-wrap .shop-aiplugin-widget-teaser {
  align-self: flex-start;
}

.shop-aiplugin-teaser-body {
  width: fit-content;
  max-width: 100%;
  cursor: pointer;
}

.shop-aiplugin-teaser-text {
  display: block;
  width: max-content;
  max-width: min(calc(280px - 44px), calc(100vw - 92px));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: auto;
  unicode-bidi: plaintext;
}

.shop-aiplugin-widget-teaser.shop-aiplugin-teaser-multiline .shop-aiplugin-teaser-text {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: max-content;
  max-width: min(calc(280px - 44px), calc(100vw - 92px));
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

.shop-aiplugin-teaser-multiline .shop-aiplugin-teaser-line {
  display: block;
  line-height: 1.45;
  white-space: nowrap;
  width: max-content;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shop-aiplugin-teaser-close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--shop-aiplugin-text-secondary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.shop-aiplugin-teaser-close:hover {
  background: rgba(15, 23, 42, 0.06);
  color: var(--shop-aiplugin-text);
}

.shop-aiplugin-teaser-chatbox-bar {
  display: none;
}

/* Style: chat box preview */
.shop-aiplugin-teaser-style-chatbox {
  padding: 0 30px 0 0;
  overflow: hidden;
  border-radius: 12px;
}

.shop-aiplugin-teaser-style-chatbox .shop-aiplugin-teaser-chatbox-bar {
  display: block;
  height: 28px;
  background: var(--shop-aiplugin-gradient);
}

.shop-aiplugin-teaser-style-chatbox .shop-aiplugin-teaser-body {
  padding: 10px 14px 12px;
}

.shop-aiplugin-teaser-style-chatbox .shop-aiplugin-teaser-close {
  top: 34px;
}

/* Style: speech bubble with tail */
.shop-aiplugin-teaser-style-speech {
  border-radius: 18px 18px 6px 18px;
  margin-bottom: 6px;
}

.shop-aiplugin-teaser-style-speech::after {
  content: "";
  position: absolute;
  bottom: -7px;
  right: 22px;
  width: 14px;
  height: 14px;
  background: var(--shop-aiplugin-surface);
  border-right: 1px solid var(--shop-aiplugin-border);
  border-bottom: 1px solid var(--shop-aiplugin-border);
  transform: rotate(45deg);
  pointer-events: none;
}

#shop-aiplugin-chat-widget.shop-aiplugin-left .shop-aiplugin-teaser-style-speech::after {
  right: auto;
  left: 22px;
}

@keyframes shop-aiplugin-teaser-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

#shop-aiplugin-toggle-icon-custom {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 50%;
  display: none;
  pointer-events: none;
}

#shop-aiplugin-chat-toggle.shop-aiplugin-toggle-has-custom-icon {
  background: transparent;
  box-shadow: 0 8px 25px rgba(15, 23, 42, 0.18);
  overflow: visible;
}

#shop-aiplugin-chat-toggle.shop-aiplugin-toggle-has-custom-icon::before {
  display: none;
}

#shop-aiplugin-chat-toggle.shop-aiplugin-toggle-has-custom-icon #shop-aiplugin-toggle-icon-custom {
  display: block;
  width: 60px;
  height: 60px;
}

#shop-aiplugin-chat-toggle.shop-aiplugin-toggle-has-custom-icon .shop-aiplugin-toggle-icon-default {
  display: none !important;
}

#shop-aiplugin-chat-toggle.shop-aiplugin-toggle-has-custom-icon:hover {
  transform: scale(1.06);
}

/* Toggle Button */
#shop-aiplugin-chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--shop-aiplugin-gradient);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 25px rgba(99,102,241,0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

#shop-aiplugin-chat-toggle::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.2), transparent);
}

#shop-aiplugin-chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 35px var(--shop-aiplugin-glow-strong);
}

#shop-aiplugin-chat-toggle.shop-aiplugin-hidden {
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}

#shop-aiplugin-chat-toggle .shop-aiplugin-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: #ef4444;
  color: #fff;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

/* Chat Window */
#shop-aiplugin-chat-window {
  display: none;
  flex-direction: column;
  width: calc(380px * var(--shop-aiplugin-panel-scale, 1));
  max-width: calc(100vw - 48px);
  height: calc(600px * var(--shop-aiplugin-panel-scale, 1));
  max-height: calc(100vh - 120px);
  background: var(--shop-aiplugin-bg);
  border-radius: 20px;
  box-shadow: var(--shop-aiplugin-shadow);
  overflow: hidden;
  position: absolute;
  bottom: 22px;
  right: 0;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(0,0,0,0.06);
}

.shop-aiplugin-left #shop-aiplugin-chat-window {
  right: auto;
  left: 0;
}

#shop-aiplugin-chat-window.shop-aiplugin-open {
  display: flex;
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Header */
#shop-aiplugin-chat-header {
  background: var(--shop-aiplugin-gradient);
  color: #fff;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: relative;
  overflow: visible;
  z-index: 2;
}

#shop-aiplugin-chat-header::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
}

.shop-aiplugin-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1;
}

.shop-aiplugin-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
}

.shop-aiplugin-brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.shop-aiplugin-brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.shop-aiplugin-widget-footer {
  padding: 6px 16px 10px;
  text-align: center;
  border-top: 1px solid var(--shop-aiplugin-border);
  background: var(--shop-aiplugin-surface);
  flex-shrink: 0;
}

.shop-aiplugin-widget-footer-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--shop-aiplugin-text-muted, #6b7280);
  letter-spacing: 0.02em;
}

.shop-aiplugin-human-quick-btn {
  border: 0;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.shop-aiplugin-human-quick-btn:hover {
  background: rgba(255,255,255,0.3);
}

.shop-aiplugin-human-quick-btn:active {
  transform: translateY(1px);
}

.shop-aiplugin-human-quick-btn.active {
  background: rgba(251, 146, 60, 0.35);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.shop-aiplugin-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.shop-aiplugin-status {
  font-size: 12px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 5px;
}

.shop-aiplugin-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  animation: shop-aiplugin-pulse 2s infinite;
}

.shop-aiplugin-status-dot.offline { background: #fbbf24; animation: none; }
.shop-aiplugin-status-dot.human.online { background: #22c55e; animation: shop-aiplugin-pulse 2s infinite; }
.shop-aiplugin-status-dot.human.offline { background: #9ca3af; animation: none; }
.shop-aiplugin-status-dot.human.connecting { background: #22c55e; animation: shop-aiplugin-pulse 2s infinite; opacity: 0.65; }

@keyframes shop-aiplugin-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.shop-aiplugin-header-actions {
  display: flex;
  gap: 6px;
  z-index: 3;
  align-items: center;
}

.shop-aiplugin-header-cart {
  position: relative;
  text-decoration: none;
  flex-shrink: 0;
}

.shop-aiplugin-header-cart:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 2px;
}

.shop-aiplugin-icon-cart {
  display: block;
  flex-shrink: 0;
  color: inherit;
}

.shop-aiplugin-header-cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  color: #fff;
  background: linear-gradient(135deg, #f97316, #ea580c);
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

#shop-aiplugin-chat-widget.shop-aiplugin-left .shop-aiplugin-header-cart-badge {
  right: auto;
  left: -4px;
}

.shop-aiplugin-header-menu {
  position: relative;
}

.shop-aiplugin-header-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 8px;
  min-width: 200px;
  max-width: calc(100vw - 48px);
  padding: 6px 0;
  margin: 0;
  background: var(--shop-aiplugin-surface);
  border: 1px solid var(--shop-aiplugin-border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
  z-index: 50;
}

#shop-aiplugin-chat-widget.shop-aiplugin-left .shop-aiplugin-header-dropdown {
  right: auto;
  left: 8px;
}

.shop-aiplugin-header-dropdown[hidden] {
  display: none !important;
}

.shop-aiplugin-dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: none;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--shop-aiplugin-text);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.shop-aiplugin-dropdown-item[hidden] {
  display: none !important;
}

#shop-aiplugin-chat-widget.shop-aiplugin-operators-only #shop-aiplugin-menu-human {
  display: none !important;
}

.shop-aiplugin-dropdown-item:hover {
  background: var(--shop-aiplugin-bg);
}

.shop-aiplugin-dropdown-item#shop-aiplugin-menu-end-chat {
  color: #b91c1c;
}

.shop-aiplugin-dropdown-item#shop-aiplugin-menu-end-chat:hover {
  background: #fef2f2;
}

#shop-aiplugin-chat-close, .shop-aiplugin-header-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background 0.2s;
}

#shop-aiplugin-chat-close:hover, .shop-aiplugin-header-btn:hover {
  background: rgba(255,255,255,0.25);
}

#shop-aiplugin-chat-widget .shop-aiplugin-menu-trigger,
#shop-aiplugin-chat-widget .shop-aiplugin-close-btn {
  color: #fff;
}

#shop-aiplugin-chat-widget .shop-aiplugin-icon-menu {
  display: block;
  color: inherit;
  flex-shrink: 0;
}

#shop-aiplugin-chat-widget .shop-aiplugin-icon-close {
  display: block;
  stroke: #fff;
  flex-shrink: 0;
}

#shop-aiplugin-chat-widget .shop-aiplugin-icon-minimize {
  display: none;
  stroke: #fff;
  flex-shrink: 0;
}

/* Queue Bar */
.shop-aiplugin-queue-bar {
  background: #fef3c7;
  color: #92400e;
  padding: 8px 16px;
  font-size: 12px;
  text-align: center;
  font-weight: 500;
  display: none;
  flex-shrink: 0;
  border-bottom: 1px solid #fde68a;
}

.shop-aiplugin-queue-bar.visible { display: block; }

/* Main column: messages + guest overlay */
#shop-aiplugin-chat-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Guest identity gate — same layout as end-chat modal (backdrop + dialog + card) */
#shop-aiplugin-guest-gate {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
}

#shop-aiplugin-guest-gate[hidden] {
  display: none !important;
}

#shop-aiplugin-guest-gate .shop-aiplugin-modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

#shop-aiplugin-guest-gate .shop-aiplugin-end-chat-dialog {
  position: relative;
  z-index: 1;
}

.shop-aiplugin-guest-gate-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--shop-aiplugin-gradient);
}

#shop-aiplugin-guest-gate .shop-aiplugin-guest-gate-title,
#shop-aiplugin-end-chat-modal .shop-aiplugin-guest-gate-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--shop-aiplugin-text);
  margin: 4px 0 8px;
}

#shop-aiplugin-guest-gate .shop-aiplugin-guest-gate-title {
  margin-bottom: 14px;
}

#shop-aiplugin-guest-gate .shop-aiplugin-guest-gate-fields {
  display: flex;
  flex-direction: column;
}

#shop-aiplugin-guest-gate .shop-aiplugin-guest-field {
  margin-bottom: 12px;
}

#shop-aiplugin-guest-gate .shop-aiplugin-guest-field:last-of-type {
  margin-bottom: 6px;
}

#shop-aiplugin-guest-gate .shop-aiplugin-guest-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--shop-aiplugin-text-secondary);
  margin-bottom: 6px;
}

#shop-aiplugin-guest-gate .shop-aiplugin-guest-field input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--shop-aiplugin-border);
  font-size: 14px;
  color: var(--shop-aiplugin-text);
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#shop-aiplugin-guest-gate .shop-aiplugin-guest-field input:focus {
  outline: none;
  border-color: var(--shop-aiplugin-primary);
  box-shadow: 0 0 0 3px var(--shop-aiplugin-focus-ring);
}

#shop-aiplugin-guest-gate .shop-aiplugin-guest-gate-error {
  font-size: 12px;
  color: #dc2626;
  margin: 0 0 10px;
  min-height: 1em;
  line-height: 1.4;
}

#shop-aiplugin-guest-gate .shop-aiplugin-guest-gate-error[hidden] {
  display: none !important;
}

#shop-aiplugin-guest-gate .shop-aiplugin-guest-submit {
  width: 100%;
  margin-top: 4px;
  padding: 11px 14px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  background: var(--shop-aiplugin-gradient);
  box-shadow: 0 4px 14px var(--shop-aiplugin-glow-soft);
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

#shop-aiplugin-guest-gate .shop-aiplugin-guest-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px var(--shop-aiplugin-glow-strong);
}

#shop-aiplugin-guest-gate .shop-aiplugin-guest-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

#shop-aiplugin-chat-input-area.shop-aiplugin-composer-locked {
  opacity: 0.55;
  pointer-events: none;
}

/* Messages */
#shop-aiplugin-chat-messages {
  position: relative;
  z-index: 0;
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 rgba(148, 163, 184, 0.15);
}

@media (min-width: 769px) {
  #shop-aiplugin-chat-messages {
    overflow-y: scroll;
    scrollbar-gutter: stable;
  }
}

#shop-aiplugin-chat-messages::-webkit-scrollbar { width: 10px; }
#shop-aiplugin-chat-messages::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.15);
  border-radius: 10px;
  margin: 4px 0;
}
#shop-aiplugin-chat-messages::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
  min-height: 48px;
}
#shop-aiplugin-chat-messages::-webkit-scrollbar-thumb:hover {
  background: #64748b;
  background-clip: padding-box;
}

.shop-aiplugin-message {
  max-width: 90%;
  animation: shop-aiplugin-slide-in 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes shop-aiplugin-slide-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.shop-aiplugin-message.shop-aiplugin-user { align-self: flex-end; }
.shop-aiplugin-message.shop-aiplugin-bot { align-self: flex-start; }
.shop-aiplugin-message.shop-aiplugin-operator { align-self: flex-start; }

.shop-aiplugin-message-content {
  padding: 14px 18px;
  border-radius: 16px;
  line-height: 1.65;
  word-wrap: break-word;
  word-break: break-word;
  font-size: 13px;
  min-width: 60px;
}

.shop-aiplugin-user .shop-aiplugin-message-content {
  background: var(--shop-aiplugin-gradient);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.shop-aiplugin-bot .shop-aiplugin-message-content {
  background: var(--shop-aiplugin-surface);
  color: var(--shop-aiplugin-text);
  border: 1px solid var(--shop-aiplugin-border);
  border-bottom-left-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.shop-aiplugin-operator .shop-aiplugin-message-content {
  background: var(--shop-aiplugin-surface);
  color: var(--shop-aiplugin-text);
  border: 1px solid var(--shop-aiplugin-border);
  border-bottom-left-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.shop-aiplugin-operator .shop-aiplugin-read-receipt {
  color: var(--shop-aiplugin-text-secondary);
}

.shop-aiplugin-operator .shop-aiplugin-reply-quote,
.shop-aiplugin-reply-quote-operator {
  margin-bottom: 6px;
  padding: 6px 8px;
  border-inline-start: 3px solid var(--shop-aiplugin-primary);
  background: rgba(0, 0, 0, 0.04);
  border-radius: 6px;
  font-size: 12px;
  color: var(--shop-aiplugin-text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

.shop-aiplugin-user .shop-aiplugin-reply-quote {
  background: rgba(255, 255, 255, 0.16);
  border-inline-start-color: rgba(255, 255, 255, 0.75);
  color: rgba(255, 255, 255, 0.92);
}

.shop-aiplugin-reply-quote-author {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 2px;
  opacity: 0.85;
}

.shop-aiplugin-sender-label {
  font-size: 10px;
  font-weight: 600;
  margin-bottom: 4px;
  opacity: 0.7;
}

.shop-aiplugin-operator .shop-aiplugin-sender-label {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 1;
  margin-bottom: 6px;
}

.shop-aiplugin-message-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  min-height: 12px;
}

.shop-aiplugin-user .shop-aiplugin-message-meta {
  padding-right: 2px;
}

.shop-aiplugin-operator .shop-aiplugin-message-meta {
  justify-content: flex-start;
  padding-left: 2px;
}

.shop-aiplugin-read-receipt {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  color: rgba(255, 255, 255, 0.55);
  vertical-align: middle;
}

.shop-aiplugin-read-receipt svg {
  display: block;
}

.shop-aiplugin-read-receipt.read {
  color: #8ed4ff;
}

.shop-aiplugin-edited-label {
  font-size: 10px;
  opacity: 0.75;
  margin-inline-start: 4px;
}

.shop-aiplugin-chat-image {
  display: block;
  max-width: min(240px, 100%);
  max-height: 220px;
  border-radius: 10px;
  margin-top: 6px;
  object-fit: cover;
  cursor: pointer;
}

.shop-aiplugin-image-caption {
  margin-top: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}

.shop-aiplugin-operator-avatar-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.shop-aiplugin-operator-avatar-fallback {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: var(--shop-aiplugin-text);
  background: var(--shop-aiplugin-bg);
  border: 1.5px solid var(--shop-aiplugin-border);
}

.shop-aiplugin-operator-avatar-wrap.show-fallback .shop-aiplugin-operator-avatar-fallback {
  display: inline-flex;
}

.shop-aiplugin-operator-avatar-wrap.show-fallback .shop-aiplugin-operator-avatar {
  display: none !important;
}

.shop-aiplugin-operator-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1.5px solid var(--shop-aiplugin-border);
  background: var(--shop-aiplugin-bg);
}

.shop-aiplugin-operator-name {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  opacity: 0.9;
}

.shop-aiplugin-message-time {
  font-size: 10px;
  opacity: 0.5;
  margin-top: 4px;
}

.shop-aiplugin-bot .shop-aiplugin-message-content ul {
  margin: 6px 0;
  padding-left: 18px;
}

.shop-aiplugin-bot .shop-aiplugin-message-content li {
  margin-bottom: 3px;
}

/* Product Cards - Modern */
.shop-aiplugin-message.shop-aiplugin-products {
  max-width: 95%;
}

.shop-aiplugin-products-inline {
  margin-top: 10px;
}

.shop-aiplugin-bot-intro {
  margin-bottom: 8px;
}

.shop-aiplugin-numbered-item + .shop-aiplugin-numbered-item {
  margin-top: 10px;
}

.shop-aiplugin-numbered-text {
  line-height: 1.65;
}

.shop-aiplugin-product-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0;
}

.shop-aiplugin-product-card {
  background: var(--shop-aiplugin-surface);
  border: 1px solid var(--shop-aiplugin-border);
  border-radius: 14px;
  padding: 0;
  overflow: hidden;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.shop-aiplugin-compare-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid #dbe4f0;
  border-radius: 10px;
  background: #f8fafc;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.shop-aiplugin-compare-toggle:hover {
  border-color: var(--shop-aiplugin-primary-light);
  background: #f1f5ff;
}

.shop-aiplugin-compare-check {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.shop-aiplugin-compare-check-ui {
  width: 16px;
  height: 16px;
  border: 1.5px solid #cbd5e1;
  border-radius: 5px;
  background: #fff;
  position: relative;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.shop-aiplugin-compare-check:checked + .shop-aiplugin-compare-check-ui {
  border-color: var(--shop-aiplugin-primary);
  background: var(--shop-aiplugin-primary);
  box-shadow: 0 0 0 3px var(--shop-aiplugin-focus-ring);
}

.shop-aiplugin-compare-check:checked + .shop-aiplugin-compare-check-ui::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.shop-aiplugin-compare-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  transition: color 0.2s ease, transform 0.2s ease;
}

.shop-aiplugin-compare-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.shop-aiplugin-compare-check:checked ~ .shop-aiplugin-compare-icon {
  color: var(--shop-aiplugin-primary-dark);
  transform: scale(1.05);
}

.shop-aiplugin-compare-bar {
  margin-top: 15px !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.shop-aiplugin-compare-count {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}

.shop-aiplugin-compare-btn {
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  background: var(--shop-aiplugin-gradient);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 6px 14px var(--shop-aiplugin-glow-soft);
}

.shop-aiplugin-compare-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px var(--shop-aiplugin-glow-strong);
}

/*
 * "More …" CTA — visually mirrors the Compare bar on purpose so customers
 * recognise it as part of the same in-message action surface. Lives at
 * the bottom of an assistant message and reveals additional products in
 * place when clicked.
 */
.shop-aiplugin-more-bar {
  margin-top: 15px !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.shop-aiplugin-more-count {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}

.shop-aiplugin-more-btn {
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  background: var(--shop-aiplugin-gradient);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 6px 14px var(--shop-aiplugin-glow-soft);
}

.shop-aiplugin-more-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px var(--shop-aiplugin-glow-strong);
}

/* Visual continuity for the freshly revealed batch of products. */
.shop-aiplugin-products-more {
  margin-top: 12px;
  animation: shop-aiplugin-more-fade-in 0.25s ease-out;
}

@keyframes shop-aiplugin-more-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.shop-aiplugin-product-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border-color: var(--shop-aiplugin-primary-light);
}

.shop-aiplugin-product-card-inner {
  display: flex;
  gap: 12px;
  padding: 12px;
}

.shop-aiplugin-product-image-link {
  flex-shrink: 0;
  display: block;
  width: 80px;
  height: 80px;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: opacity 0.2s;
}

.shop-aiplugin-product-image-link:hover {
  opacity: 0.85;
}

.shop-aiplugin-product-image {
  width: 80px;
  height: 80px;
  border-radius: 10px;
  object-fit: cover;
  background: #f1f5f9;
  flex-shrink: 0;
  display: block;
}

.shop-aiplugin-product-image.is-placeholder {
  object-fit: contain;
  padding: 10px;
  background: #eef2f7;
}

.shop-aiplugin-message-list {
  margin: 8px 0 10px;
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shop-aiplugin-message-list li {
  margin: 0;
  padding: 0;
  line-height: 1.45;
}

.shop-aiplugin-inline-link-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 2px 4px 2px 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.1);
  color: var(--shop-aiplugin-primary, #3b82f6) !important;
  font-weight: 600;
  font-size: 11px;
  text-decoration: none !important;
  border: 1px solid rgba(59, 130, 246, 0.22);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.shop-aiplugin-inline-link-chip:hover {
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(59, 130, 246, 0.35);
  transform: translateY(-1px);
}

.shop-aiplugin-product-info {
  flex: 1;
  min-width: 0;
}

.shop-aiplugin-product-name {
  font-weight: 600;
  color: var(--shop-aiplugin-text);
  font-size: 10px;
  line-height: 1.0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.shop-aiplugin-product-price-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.shop-aiplugin-product-price {
  color: var(--shop-aiplugin-primary);
  font-weight: 700;
  font-size: 15px;
}

.shop-aiplugin-product-original-price {
  color: #94a3b8;
  font-size: 12px;
  text-decoration: line-through;
}

.shop-aiplugin-product-sale-badge {
  background: #fef2f2;
  color: #ef4444;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
}

.shop-aiplugin-product-actions {
  display: flex;
  gap: 8px;
  padding: 0 12px 12px;
}

.shop-aiplugin-product-link {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  font-family: inherit;
}

.shop-aiplugin-btn-share {
  flex: 0 0 36px;
  width: 36px;
  min-width: 36px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  border: 1px solid #dbe4f0;
  background: #ffffff;
  color: #475569;
}

.shop-aiplugin-btn-share:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.shop-aiplugin-btn-view {
  background: #f1f5f9;
  color: var(--shop-aiplugin-text-secondary);
}

.shop-aiplugin-btn-view:hover { background: #e2e8f0; }

.shop-aiplugin-btn-cart {
  background: var(--shop-aiplugin-gradient);
  color: #fff;
}

.shop-aiplugin-btn-cart:hover { opacity: 0.9; }

.shop-aiplugin-btn-outofstock {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.02em;
}

/* Order Info */
.shop-aiplugin-order-card {
  background: var(--shop-aiplugin-surface);
  border: 1px solid var(--shop-aiplugin-border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.shop-aiplugin-order-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--shop-aiplugin-border);
}

.shop-aiplugin-order-number {
  font-weight: 700;
  color: var(--shop-aiplugin-text);
  font-size: 14px;
}

.shop-aiplugin-order-status {
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
}

.shop-aiplugin-order-status.processing { background: #dbeafe; color: #1d4ed8; }
.shop-aiplugin-order-status.completed { background: #dcfce7; color: #166534; }
.shop-aiplugin-order-status.on-hold { background: #fef3c7; color: #92400e; }
.shop-aiplugin-order-status.cancelled { background: #fef2f2; color: #991b1b; }
.shop-aiplugin-order-status.pending { background: #f3f4f6; color: #374151; }

.shop-aiplugin-order-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
}

.shop-aiplugin-order-label { color: var(--shop-aiplugin-text-secondary); }
.shop-aiplugin-order-value { color: var(--shop-aiplugin-text); font-weight: 500; }

/* Order selection chips (customer has multiple orders) */
.shop-aiplugin-order-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shop-aiplugin-order-option-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  background: var(--shop-aiplugin-surface);
  border: 1px solid var(--shop-aiplugin-border);
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  text-align: start;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.shop-aiplugin-order-option-btn:hover {
  border-color: var(--shop-aiplugin-primary, #4f46e5);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.shop-aiplugin-order-option-number {
  font-weight: 700;
  color: var(--shop-aiplugin-text);
  white-space: nowrap;
}

.shop-aiplugin-order-option-date {
  color: var(--shop-aiplugin-text-secondary);
  font-size: 12px;
}

/* Satisfaction */
.shop-aiplugin-satisfaction {
  background: var(--shop-aiplugin-surface);
  border: 1px solid var(--shop-aiplugin-border);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
}

.shop-aiplugin-satisfaction-title {
  font-size: 13px;
  color: var(--shop-aiplugin-text);
  font-weight: 600;
  margin-bottom: 8px;
}

.shop-aiplugin-satisfaction-stars {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.shop-aiplugin-star-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 24px;
  opacity: 0.3;
  transition: all 0.2s;
}

.shop-aiplugin-star-btn:hover, .shop-aiplugin-star-btn.active {
  opacity: 1;
  transform: scale(1.15);
}

/* Typing Indicator */
.shop-aiplugin-typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
  background: var(--shop-aiplugin-surface);
  border: 1px solid var(--shop-aiplugin-border);
  border-radius: 16px;
  border-bottom-left-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.shop-aiplugin-typing-indicator span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--shop-aiplugin-primary-light);
  animation: shop-aiplugin-typing-bounce 1.2s infinite;
}

.shop-aiplugin-typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.shop-aiplugin-typing-indicator span:nth-child(3) { animation-delay: 0.3s; }

@keyframes shop-aiplugin-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Emoji Picker */
.shop-aiplugin-emoji-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  flex-shrink: 0;
  transition: background 0.15s;
  padding: 0;
  line-height: 1;
}
.shop-aiplugin-emoji-btn:hover {
  background: #f1f5f9;
}

.shop-aiplugin-chat-input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: stretch;
  min-width: 0;
}

.shop-aiplugin-input-attach-btn {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
  padding: 0;
  color: var(--shop-aiplugin-text-secondary);
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
}

.shop-aiplugin-input-attach-btn:hover {
  background: #f1f5f9;
  color: var(--shop-aiplugin-primary);
}

.shop-aiplugin-input-attach-btn[hidden] {
  display: none !important;
}

#shop-aiplugin-chat-input-area.shop-aiplugin-has-attach #shop-aiplugin-chat-input {
  padding-left: 38px;
}

.shop-aiplugin-operator-response-hint {
  margin: 0;
  padding: 0 16px 10px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--shop-aiplugin-text-secondary);
  text-align: center;
  background: var(--shop-aiplugin-surface);
  border-top: none;
}

.shop-aiplugin-operator-response-hint[hidden] {
  display: none !important;
}

#shop-aiplugin-chat-widget:not(.shop-aiplugin-human-chat) .shop-aiplugin-operator-response-hint {
  display: none !important;
}

#shop-aiplugin-chat-widget.shop-aiplugin-human-chat .shop-aiplugin-user .shop-aiplugin-message-content,
#shop-aiplugin-chat-widget.shop-aiplugin-human-chat .shop-aiplugin-operator .shop-aiplugin-message-content {
  direction: auto;
  unicode-bidi: plaintext;
  text-align: start;
}

.shop-aiplugin-message-context-menu {
  position: fixed;
  z-index: 100010;
  min-width: 140px;
  background: var(--shop-aiplugin-surface);
  border: 1px solid var(--shop-aiplugin-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.shop-aiplugin-message-context-menu[hidden] {
  display: none !important;
}

.shop-aiplugin-message-context-item {
  border: none;
  background: transparent;
  text-align: start;
  padding: 8px 12px;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  color: var(--shop-aiplugin-text);
  cursor: pointer;
}

.shop-aiplugin-message-context-item:hover {
  background: var(--shop-aiplugin-bg);
}

.shop-aiplugin-reply-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 8px;
  border-radius: 10px;
  background: var(--shop-aiplugin-bg);
  border-inline-start: 3px solid var(--shop-aiplugin-primary);
}

.shop-aiplugin-reply-preview[hidden] {
  display: none !important;
}

.shop-aiplugin-reply-preview-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.shop-aiplugin-reply-preview-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--shop-aiplugin-primary);
}

.shop-aiplugin-reply-preview-text {
  font-size: 12px;
  color: var(--shop-aiplugin-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shop-aiplugin-reply-preview-cancel {
  border: none;
  background: transparent;
  color: var(--shop-aiplugin-text-secondary);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}

#shop-aiplugin-chat-input-area.shop-aiplugin-has-reply {
  flex-wrap: wrap;
}

#shop-aiplugin-chat-input-area.shop-aiplugin-has-reply .shop-aiplugin-reply-preview {
  order: -1;
  flex: 1 1 100%;
}

.shop-aiplugin-emoji-panel {
  display: none;
  position: absolute;
  bottom: 60px;
  left: 12px;
  right: 12px;
  background: #fff;
  border: 1px solid var(--shop-aiplugin-border);
  border-radius: 12px;
  padding: 10px;
  grid-template-columns: repeat(10, 1fr);
  gap: 2px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 10;
  max-height: 140px;
  overflow-y: auto;
}

.shop-aiplugin-emoji-item {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.1s;
  user-select: none;
}
.shop-aiplugin-emoji-item:hover {
  background: #f1f5f9;
  transform: scale(1.15);
}

/* Input Area */
#shop-aiplugin-chat-input-area {
  padding: 14px 16px;
  border-top: 1px solid var(--shop-aiplugin-border);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--shop-aiplugin-surface);
  flex-shrink: 0;
  position: relative;
}

#shop-aiplugin-chat-input {
  width: 100%;
  padding: 10px 16px;
  border: 1.5px solid var(--shop-aiplugin-border);
  border-radius: 12px;
  font-size: small;
  outline: none;
  font-family: inherit;
  transition: all 0.2s;
  background: var(--shop-aiplugin-bg);
  color: var(--shop-aiplugin-text);
  resize: none;
  max-height: 120px;
  line-height: 1.43;
  overflow-y: auto;
  field-sizing: content;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#shop-aiplugin-chat-input::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

#shop-aiplugin-chat-input:focus {
  border-color: var(--shop-aiplugin-primary);
  background: var(--shop-aiplugin-surface);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

#shop-aiplugin-chat-input::placeholder {
  color: #94a3b8;
  font-size: inherit;
}

#shop-aiplugin-chat-send {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--shop-aiplugin-gradient);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  box-shadow: 0 2px 8px var(--shop-aiplugin-glow-soft);
}

#shop-aiplugin-chat-widget #shop-aiplugin-chat-send .shop-aiplugin-icon-send {
  display: block;
  stroke: #fff;
  flex-shrink: 0;
}

#shop-aiplugin-chat-send:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px var(--shop-aiplugin-glow-strong);
}

#shop-aiplugin-chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Voice chat controls — [hidden] must win over display:flex (theme overrides) */
#shop-aiplugin-voice-recording[hidden],
#shop-aiplugin-voice-mic[hidden],
#shop-aiplugin-voice-cancel[hidden],
#shop-aiplugin-voice-tts-stop[hidden] {
  display: none !important;
}

/* Recording mode — hide text composer; only voice controls stay visible */
#shop-aiplugin-chat-input-area.shop-aiplugin-voice-active .shop-aiplugin-emoji-btn,
#shop-aiplugin-chat-input-area.shop-aiplugin-voice-active .shop-aiplugin-input-attach-btn,
#shop-aiplugin-chat-input-area.shop-aiplugin-voice-active #shop-aiplugin-chat-input,
#shop-aiplugin-chat-input-area.shop-aiplugin-voice-active #shop-aiplugin-chat-send,
#shop-aiplugin-chat-input-area.shop-aiplugin-voice-active .shop-aiplugin-emoji-panel {
  display: none !important;
}

#shop-aiplugin-chat-input-area.shop-aiplugin-voice-active {
  gap: 10px;
  background: linear-gradient(180deg, var(--shop-aiplugin-surface) 0%, rgba(99, 102, 241, 0.04) 100%);
}

#shop-aiplugin-chat-input-area.shop-aiplugin-voice-active .shop-aiplugin-voice-recording {
  order: 1;
}

#shop-aiplugin-chat-input-area.shop-aiplugin-voice-active .shop-aiplugin-voice-cancel {
  order: 2;
}

#shop-aiplugin-chat-input-area.shop-aiplugin-voice-active .shop-aiplugin-voice-mic.is-voice-send {
  order: 3;
}

.shop-aiplugin-voice-recording:not([hidden]) {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(244, 63, 94, 0.06) 100%);
  border: 1.5px solid rgba(239, 68, 68, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
  font-size: 13px;
  font-weight: 600;
  color: #dc2626;
  pointer-events: none;
}

.shop-aiplugin-voice-recording-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  flex-shrink: 0;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45);
  animation: shop-aiplugin-voice-pulse 1.25s ease-in-out infinite;
}

.shop-aiplugin-voice-recording-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shop-aiplugin-voice-recording-time {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #b91c1c;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
}

@keyframes shop-aiplugin-voice-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45);
  }
  50% {
    opacity: 0.75;
    transform: scale(0.92);
    box-shadow: 0 0 0 7px rgba(239, 68, 68, 0);
  }
}

.shop-aiplugin-voice-mic,
.shop-aiplugin-voice-tts-stop {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1.5px solid var(--shop-aiplugin-border);
  background: var(--shop-aiplugin-bg);
  color: var(--shop-aiplugin-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.2s, color 0.2s, background 0.2s, transform 0.2s, box-shadow 0.2s;
  position: relative;
}

.shop-aiplugin-voice-mic-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  position: relative;
}

.shop-aiplugin-voice-mic .shop-aiplugin-voice-send-icon {
  display: none;
}

.shop-aiplugin-voice-mic .shop-aiplugin-icon-mic {
  display: block;
}

.shop-aiplugin-voice-mic:hover,
.shop-aiplugin-voice-tts-stop:hover {
  border-color: var(--shop-aiplugin-primary);
  color: var(--shop-aiplugin-primary);
}

.shop-aiplugin-voice-mic.is-voice-send {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--shop-aiplugin-gradient);
  color: #fff;
  border: none;
  box-shadow: 0 4px 14px var(--shop-aiplugin-glow-soft);
  animation: shop-aiplugin-voice-send-pulse 1.2s ease-in-out infinite;
}

.shop-aiplugin-voice-mic.is-voice-send::before,
.shop-aiplugin-voice-mic.is-voice-send::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 18px;
  border: 2px solid var(--shop-aiplugin-primary);
  opacity: 0;
  pointer-events: none;
  animation: shop-aiplugin-voice-ring 1.8s ease-out infinite;
}

.shop-aiplugin-voice-mic.is-voice-send::after {
  animation-delay: 0.65s;
}

.shop-aiplugin-voice-mic.is-voice-send .shop-aiplugin-voice-send-icon {
  display: block;
  stroke: #fff;
}

.shop-aiplugin-voice-mic.is-voice-send .shop-aiplugin-icon-mic {
  display: none;
}

.shop-aiplugin-voice-mic.is-voice-send:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 18px var(--shop-aiplugin-glow-strong);
  color: #fff;
}

@keyframes shop-aiplugin-voice-send-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes shop-aiplugin-voice-ring {
  0% {
    transform: scale(0.92);
    opacity: 0.55;
  }
  100% {
    transform: scale(1.18);
    opacity: 0;
  }
}

.shop-aiplugin-voice-cancel {
  height: 42px;
  min-width: 42px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1.5px solid var(--shop-aiplugin-border);
  background: var(--shop-aiplugin-bg);
  color: var(--shop-aiplugin-text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
  white-space: nowrap;
}

.shop-aiplugin-voice-cancel:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
  transform: translateY(-1px);
}

.shop-aiplugin-voice-mic:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Voice message bubbles — native <audio> player (play / pause / seek) */
.shop-aiplugin-voice-msg .shop-aiplugin-voice-msg-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shop-aiplugin-voice-msg-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.9;
}

.shop-aiplugin-voice-msg-icon {
  font-size: 15px;
  line-height: 1;
}

.shop-aiplugin-voice-audio-holder {
  margin-top: 2px;
}

.shop-aiplugin-voice-audio {
  display: block;
  width: 240px;
  max-width: 100%;
  height: 40px;
}

/* User recording bubble keeps the primary background; make the player legible on it */
.shop-aiplugin-user.shop-aiplugin-voice-msg .shop-aiplugin-message-content {
  background: var(--shop-aiplugin-primary);
  color: #fff;
}

.shop-aiplugin-user.shop-aiplugin-voice-msg .shop-aiplugin-voice-audio {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 20px;
}

.shop-aiplugin-voice-loading {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  opacity: 0.75;
  font-style: italic;
}

.shop-aiplugin-voice-error {
  font-size: 12px;
  color: #c0392b;
  margin-top: 4px;
}

/* End chat confirmation (in-widget modal) */
#shop-aiplugin-end-chat-modal {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
}

#shop-aiplugin-end-chat-modal[hidden] {
  display: none !important;
}

.shop-aiplugin-end-chat-modal .shop-aiplugin-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.shop-aiplugin-end-chat-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 300px;
  animation: shop-aiplugin-modal-in 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes shop-aiplugin-modal-in {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.shop-aiplugin-end-chat-card {
  position: relative;
  background: var(--shop-aiplugin-surface);
  border-radius: 18px;
  padding: 22px 20px 18px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2), 0 0 0 1px rgba(15, 23, 42, 0.06);
  border: 1px solid var(--shop-aiplugin-border);
  overflow: hidden;
}

.shop-aiplugin-guest-gate-accent.shop-aiplugin-end-chat-accent {
  background: linear-gradient(90deg, #f97316 0%, #ef4444 48%, #dc2626 100%);
}

.shop-aiplugin-end-chat-body {
  font-size: 13px;
  color: var(--shop-aiplugin-text-secondary);
  line-height: 1.55;
  margin: 0 0 18px;
}

.shop-aiplugin-end-chat-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.shop-aiplugin-end-chat-btn {
  flex: 1;
  min-width: 108px;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.shop-aiplugin-end-chat-btn-cancel {
  background: #fff;
  color: var(--shop-aiplugin-text);
  border: 1px solid var(--shop-aiplugin-border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.shop-aiplugin-end-chat-btn-cancel:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.shop-aiplugin-end-chat-btn-confirm {
  color: #fff;
  background: linear-gradient(135deg, #f97316 0%, #ef4444 100%);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

.shop-aiplugin-end-chat-btn-confirm:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.45);
}

.shop-aiplugin-end-chat-btn:active {
  transform: translateY(0);
}

/* Responsive — mobile fullscreen chat */
html.shop-aiplugin-mobile-scroll-lock,
body.shop-aiplugin-mobile-scroll-lock {
  overflow: hidden !important;
  height: 100%;
  touch-action: none;
  overscroll-behavior: none;
}

@media (max-width: 768px) {
  #shop-aiplugin-chat-widget {
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    right: max(16px, env(safe-area-inset-right, 0px));
  }

  #shop-aiplugin-chat-widget.shop-aiplugin-left {
    right: auto;
    left: max(16px, env(safe-area-inset-left, 0px));
  }

  #shop-aiplugin-chat-toggle {
    width: 56px;
    height: 56px;
    box-shadow: 0 10px 28px rgba(99, 102, 241, 0.45);
  }

  /* Fullscreen overlay when chat is open on mobile */
  #shop-aiplugin-chat-widget.shop-aiplugin-mobile-open {
    inset: 0;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
  }

  #shop-aiplugin-chat-widget.shop-aiplugin-mobile-open #shop-aiplugin-chat-window {
    position: fixed;
    top: var(--shop-aiplugin-vv-top, 0px);
    right: 0;
    left: 0;
    width: 100%;
    max-width: none;
    /* Match the visual viewport height so the composer sits directly above the
       on-screen keyboard with no white gap; falls back to 100dvh/100vh. */
    height: 100vh;
    height: 100dvh;
    height: var(--shop-aiplugin-vvh, 100dvh);
    max-height: none;
    border-radius: 0;
    border: none;
    transform: none;
    opacity: 1;
    box-shadow: none;
    z-index: 1;
  }

  #shop-aiplugin-chat-widget.shop-aiplugin-mobile-open #shop-aiplugin-chat-header {
    padding-top: max(14px, env(safe-area-inset-top, 0px));
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
    padding-bottom: 14px;
    flex-shrink: 0;
  }

  #shop-aiplugin-chat-widget.shop-aiplugin-mobile-open #shop-aiplugin-chat-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  #shop-aiplugin-chat-widget.shop-aiplugin-mobile-open #shop-aiplugin-chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 12px max(12px, env(safe-area-inset-left, 0px)) 12px max(12px, env(safe-area-inset-right, 0px));
  }

  #shop-aiplugin-chat-widget.shop-aiplugin-mobile-open #shop-aiplugin-chat-input-area {
    padding: 10px max(12px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
    flex-shrink: 0;
    gap: 8px;
  }

  #shop-aiplugin-chat-widget.shop-aiplugin-mobile-open #shop-aiplugin-chat-input {
    font-size: 15px;
    min-width: 0;
  }

  #shop-aiplugin-chat-widget.shop-aiplugin-mobile-open .shop-aiplugin-message {
    max-width: 92%;
  }

  #shop-aiplugin-chat-widget.shop-aiplugin-mobile-open .shop-aiplugin-close-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.28);
    border: 1.5px solid rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
  }

  #shop-aiplugin-chat-widget.shop-aiplugin-mobile-open .shop-aiplugin-icon-close {
    display: none;
  }

  #shop-aiplugin-chat-widget.shop-aiplugin-mobile-open .shop-aiplugin-icon-minimize {
    display: block;
  }

  #shop-aiplugin-chat-widget.shop-aiplugin-mobile-open .shop-aiplugin-header-actions {
    gap: 8px;
  }

  #shop-aiplugin-chat-widget.shop-aiplugin-mobile-open .shop-aiplugin-title {
    font-size: 16px;
  }

  /* Fallback when open on small screens without JS class (e.g. slow paint) */
  #shop-aiplugin-chat-window.shop-aiplugin-open {
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
  }
}

@media (max-width: 480px) {
  #shop-aiplugin-chat-toggle {
    width: 54px;
    height: 54px;
  }
}

/* === Demo mode chrome === */
.shop-aiplugin-demo-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border-bottom: 1px solid #fde68a;
  color: #78350f;
  font-size: 12px;
  line-height: 1.4;
}

.shop-aiplugin-demo-banner-dot {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18);
  animation: shop-aiplugin-demo-pulse 1.6s ease-in-out infinite;
}

@keyframes shop-aiplugin-demo-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18); }
  50%      { box-shadow: 0 0 0 7px rgba(245, 158, 11, 0.05); }
}

.shop-aiplugin-demo-banner-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.shop-aiplugin-demo-banner-text strong {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.shop-aiplugin-demo-banner-text span {
  color: #92400e;
  font-size: 11.5px;
  opacity: 0.9;
}

.shop-aiplugin-demo-activate-bar {
  display: flex;
  justify-content: center;
  padding: 10px 14px 4px;
  background: var(--shop-aiplugin-surface, #fff);
}

.shop-aiplugin-demo-activate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px 18px;
  background: var(--shop-aiplugin-gradient, linear-gradient(135deg, #6366f1, #8b5cf6));
  color: #fff !important;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none !important;
  letter-spacing: 0.01em;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.25);
  transition: transform 120ms ease, box-shadow 200ms ease, filter 200ms ease;
}

.shop-aiplugin-demo-activate-btn:hover,
.shop-aiplugin-demo-activate-btn:focus {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 10px 26px rgba(99, 102, 241, 0.35);
}

.shop-aiplugin-demo-activate-note {
  font-size: 11px;
  color: #64748b;
  text-align: center;
}

/* In demo mode, hide flows that don't apply (human handoff) */
#shop-aiplugin-chat-widget.shop-aiplugin-demo .shop-aiplugin-human-quick-btn,
#shop-aiplugin-chat-widget.shop-aiplugin-demo #shop-aiplugin-menu-human {
  display: none !important;
}

/* ============================================================
   Glass (transparent) panel theme
   Activated by the .shop-aiplugin-theme-glass class on the
   widget root (set from the "Chat panel style" setting).
   The open chat panel becomes translucent with a frosted
   backdrop blur so the page shows through behind it.
   ============================================================ */
#shop-aiplugin-chat-widget.shop-aiplugin-theme-glass {
  /* Base panel opacity (0..1). Overridden inline from the
     "Glass transparency" slider; falls back to 0.16 here. */
  --shop-aiplugin-glass-opacity: 0.16;
  --shop-aiplugin-bg: rgba(255, 255, 255, var(--shop-aiplugin-glass-opacity));
  --shop-aiplugin-surface: rgba(255, 255, 255, min(1, calc(var(--shop-aiplugin-glass-opacity) + 0.26)));
  --shop-aiplugin-border: rgba(255, 255, 255, 0.45);
  --shop-aiplugin-shadow: 0 24px 70px rgba(15, 23, 42, 0.32);
}

#shop-aiplugin-chat-widget.shop-aiplugin-theme-glass #shop-aiplugin-chat-window {
  background: rgba(255, 255, 255, var(--shop-aiplugin-glass-opacity));
  border: 1px solid rgba(255, 255, 255, 0.5);
  -webkit-backdrop-filter: blur(24px) saturate(175%);
  backdrop-filter: blur(24px) saturate(175%);
}

/* The bubble teaser is part of the launcher (outside the panel) and must stay
   solid — the glass effect should never apply to it. */
#shop-aiplugin-chat-widget.shop-aiplugin-theme-glass .shop-aiplugin-widget-teaser {
  background: #ffffff;
  border-color: #e2e8f0;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

#shop-aiplugin-chat-widget.shop-aiplugin-theme-glass .shop-aiplugin-teaser-style-speech::after {
  background: #ffffff;
  border-right-color: #e2e8f0;
  border-bottom-color: #e2e8f0;
}

/* Keep the gradient header readable but let it feel part of the glass. */
#shop-aiplugin-chat-widget.shop-aiplugin-theme-glass #shop-aiplugin-chat-header {
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.25);
}

/* Frosted assistant/operator bubbles. */
#shop-aiplugin-chat-widget.shop-aiplugin-theme-glass .shop-aiplugin-bot .shop-aiplugin-message-content,
#shop-aiplugin-chat-widget.shop-aiplugin-theme-glass .shop-aiplugin-operator .shop-aiplugin-message-content,
#shop-aiplugin-chat-widget.shop-aiplugin-theme-glass .shop-aiplugin-typing-indicator {
  background: rgba(255, 255, 255, min(1, calc(var(--shop-aiplugin-glass-opacity) + 0.39)));
  border-color: rgba(255, 255, 255, 0.6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

/* Translucent composer area + input field. */
#shop-aiplugin-chat-widget.shop-aiplugin-theme-glass #shop-aiplugin-chat-input-area {
  background: rgba(255, 255, 255, min(1, calc(var(--shop-aiplugin-glass-opacity) + 0.12)));
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

#shop-aiplugin-chat-widget.shop-aiplugin-theme-glass #shop-aiplugin-chat-input {
  background: rgba(255, 255, 255, min(1, calc(var(--shop-aiplugin-glass-opacity) + 0.34)));
  border-color: rgba(255, 255, 255, 0.6);
}

#shop-aiplugin-chat-widget.shop-aiplugin-theme-glass .shop-aiplugin-widget-footer {
  background: rgba(255, 255, 255, min(1, calc(var(--shop-aiplugin-glass-opacity) + 0.06)));
}

/* Product cards stay legible: a bit more opaque than the panel. */
#shop-aiplugin-chat-widget.shop-aiplugin-theme-glass .shop-aiplugin-product-card {
  background: rgba(255, 255, 255, min(1, calc(var(--shop-aiplugin-glass-opacity) + 0.46)));
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

/* Dialog cards (end chat, guest gate) must remain fully readable. */
#shop-aiplugin-chat-widget.shop-aiplugin-theme-glass .shop-aiplugin-end-chat-card,
#shop-aiplugin-chat-widget.shop-aiplugin-theme-glass .shop-aiplugin-guest-gate-card,
#shop-aiplugin-chat-widget.shop-aiplugin-theme-glass .shop-aiplugin-guest-gate-card .shop-aiplugin-guest-field input {
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

/* Graceful fallback: when the browser can't blur, fall back to a more
   opaque surface so text never sits on a fully see-through panel. */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  #shop-aiplugin-chat-widget.shop-aiplugin-theme-glass #shop-aiplugin-chat-window {
    background: rgba(248, 250, 252, min(0.96, calc(var(--shop-aiplugin-glass-opacity) + 0.7)));
  }
  #shop-aiplugin-chat-widget.shop-aiplugin-theme-glass #shop-aiplugin-chat-input-area {
    background: rgba(248, 250, 252, min(0.96, calc(var(--shop-aiplugin-glass-opacity) + 0.7)));
  }
}

