/* Creet AI Concierge — storefront widget
 *
 * Design mirrors the Creety landing-page widget (creet-landing-page/templates/landing.php)
 * per specs/003-ai-concierge/widget-design-guideline.md. The panel stays dark regardless
 * of brand; only the accent (and its derived alpha tints + contrast ink) come from the
 * merchant's store-design primary color.
 *
 * Tokens injected inline per-merchant by class-creet-ai-widget-renderer.php:
 *   --aic-accent        merchant primary color
 *   --aic-accent-ink    WCAG-derived #000 or #fff for text on accent
 *   --aic-accent-soft   rgba(accent, .18)  — list-row backgrounds, price pills
 *   --aic-accent-ghost  rgba(accent, .06)  — starter chip background
 *   --aic-accent-line   rgba(accent, .22)  — borders and dividers
 *   --aic-accent-glow   rgba(accent, .55)  — launcher pulse rings
 */

#creet-ai-widget-root,
#creet-ai-widget-root * {
  box-sizing: border-box;
}

:root {
  --aic-bg:           #0b0f1a;
  --aic-bg-elev:      #1a1f2e;
  --aic-bg-foot:      #0f1422;
  --aic-text:         #f5f5f7;
  --aic-text-mute:    rgba(255,255,255,.4);
  --aic-radius:       16px;
  --aic-radius-sm:    12px;
  --aic-shadow:       0 24px 60px rgba(0,0,0,.5);
  --aic-wa-green:     #25D366;
  --aic-wa-green-dk:  #1ebe5d;
  --aic-wa-ink:       #ffffff;
}

/* ──────────────────────────────────────────────────────────────
 * LAUNCHER
 * ────────────────────────────────────────────────────────────── */

.creet-ai-launcher {
  position: fixed;
  bottom: 24px;
  z-index: 99998;
  width: 64px;
  height: 64px;
  border-radius: 50% !important;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0,0,0,.4);
  transition: transform .2s ease;
}
html[dir="rtl"] .creet-ai-launcher { right: 24px; left: auto; }
html:not([dir="rtl"]) .creet-ai-launcher { left: 24px; right: auto; }
.creet-ai-launcher:hover { transform: scale(1.06); }
.creet-ai-launcher img,
.creet-ai-launcher .creet-ai-launcher-icon {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  position: relative; z-index: 2;
  background: var(--aic-bg-elev);
  color: var(--aic-accent, #C3FD73);
  overflow: hidden;
}
.creet-ai-launcher img { display: block; background: transparent; }
.creet-ai-launcher-icon svg { width: 30px; height: 30px; }

.creet-ai-launcher-badge {
  position: absolute;
  top: -4px;
  z-index: 3;
  background: var(--aic-accent, #C3FD73);
  color: var(--aic-accent-ink, #000);
  font-size: 10px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 10px;
  line-height: 1;
  border: 2px solid var(--aic-bg);
}
html[dir="rtl"] .creet-ai-launcher-badge { left: -4px; right: auto; }
html:not([dir="rtl"]) .creet-ai-launcher-badge { right: -4px; left: auto; }

/* Always-on subtle pulse rings around the launcher (suppressed when panel open). */
.creet-ai-launcher::before,
.creet-ai-launcher::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: 50%;
  background: var(--aic-accent-glow, rgba(195,253,115,.55));
  z-index: 1;
  animation: creet-ai-ring 2.6s ease-out infinite;
  pointer-events: none;
}
.creet-ai-launcher::after { animation-delay: 1.3s; }
.creet-ai-launcher.is-open::before,
.creet-ai-launcher.is-open::after,
.creet-ai-launcher.is-paused::before,
.creet-ai-launcher.is-paused::after {
  animation: none;
  opacity: 0;
}
@keyframes creet-ai-ring {
  0%   { transform: scale(1);   opacity: .55; }
  80%  { transform: scale(1.7); opacity: 0; }
  100% { transform: scale(1.7); opacity: 0; }
}

/* Periodic wiggle (JS toggles .is-wiggling every ~9 s). */
.creet-ai-launcher.is-wiggling { animation: creet-ai-wiggle 1s ease-in-out; }
@keyframes creet-ai-wiggle {
  0%, 100% { transform: rotate(0)     scale(1); }
  15%      { transform: rotate(-12deg) scale(1.08); }
  30%      { transform: rotate(10deg)  scale(1.08); }
  45%      { transform: rotate(-8deg)  scale(1.06); }
  60%      { transform: rotate(6deg)   scale(1.04); }
  75%      { transform: rotate(-3deg)  scale(1.02); }
}

/* ──────────────────────────────────────────────────────────────
 * WELCOME TOOLTIP (one-shot, ~4s after load)
 * ────────────────────────────────────────────────────────────── */

.creet-ai-tip {
  position: fixed;
  bottom: 32px;
  z-index: 99997;
  max-width: 260px;
  padding: 12px 36px 12px 14px;
  background: var(--aic-bg) !important;
  color: #ffffff !important;
  border: 1px solid var(--aic-accent-line, rgba(255,255,255,.12));
  border-radius: 14px;
  box-shadow: 0 14px 36px rgba(0,0,0,.45);
  font-family: 'Tajawal','Cairo',system-ui,sans-serif;
  font-size: 13.5px;
  line-height: 1.45;
  font-weight: 500;
  opacity: 0;
  transform: translateY(8px) scale(.96);
  transition: opacity .25s ease, transform .25s ease;
  pointer-events: none;
  cursor: pointer;
}
html[dir="rtl"] .creet-ai-tip {
  right: 100px; left: auto;
  direction: rtl;
}
html:not([dir="rtl"]) .creet-ai-tip {
  left: 100px; right: auto;
  direction: ltr;
  padding: 12px 14px 12px 36px;
  font-family: system-ui,-apple-system,'Inter',sans-serif;
}
.creet-ai-tip.is-show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.creet-ai-tip strong {
  color: var(--aic-accent, #C3FD73) !important;
  font-weight: 800;
  display: block;
  margin-bottom: 3px;
}
.creet-ai-tip::after {
  content: '';
  position: absolute;
  bottom: 20px;
  width: 12px; height: 12px;
  background: var(--aic-bg);
  border: 1px solid var(--aic-accent-line, rgba(255,255,255,.12));
  border-top: 0;
  transform: rotate(45deg);
  box-shadow: 3px 3px 6px rgba(0,0,0,.15);
}
html[dir="rtl"] .creet-ai-tip::after { right: -5px; left: auto; }
html:not([dir="rtl"]) .creet-ai-tip::after { left: -5px; right: auto; }
.creet-ai-tip-close {
  position: absolute;
  top: 6px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.65);
  border: 0;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
html[dir="rtl"] .creet-ai-tip-close { left: 6px; right: auto; }
html:not([dir="rtl"]) .creet-ai-tip-close { right: 6px; left: auto; }
.creet-ai-tip-close:hover { background: rgba(255,255,255,.16); color: #fff; }

/* ──────────────────────────────────────────────────────────────
 * PANEL
 * ────────────────────────────────────────────────────────────── */

.creet-ai-panel {
  position: fixed;
  bottom: 100px;
  z-index: 99999;
  width: 360px;
  height: 540px;
  max-height: calc(100vh - 130px);
  background: var(--aic-bg);
  color: var(--aic-text);
  border-radius: var(--aic-radius);
  border: 1px solid var(--aic-accent-line, rgba(195,253,115,.18));
  box-shadow: var(--aic-shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Tajawal','Cairo',system-ui,sans-serif;
}
html[dir="rtl"] .creet-ai-panel {
  right: 24px; left: auto;
  direction: rtl;
}
html:not([dir="rtl"]) .creet-ai-panel {
  left: 24px; right: auto;
  direction: ltr;
  font-family: system-ui,-apple-system,'Inter',sans-serif;
}
.creet-ai-panel.is-open { display: flex; }

/* Hide site WhatsApp floating button while AI panel is open on mobile (it overlaps the chat) */
@media (max-width: 782px) {
  body.creet-ai-open #creet-whatsapp-btn { display: none !important; }
}

/* ── HEADER ── */
.creet-ai-panel-head {
  background: linear-gradient(135deg, #000, #1a1a2e, #16213e);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.creet-ai-panel-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--aic-accent, #C3FD73);
  background: var(--aic-bg-elev);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--aic-accent, #C3FD73);
}
.creet-ai-panel-avatar img { width: 100%; height: 100%; display: block; }
.creet-ai-panel-avatar svg { width: 22px; height: 22px; }

.creet-ai-panel-head-text { flex: 1; min-width: 0; }
.creet-ai-panel-head-text .creet-ai-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--aic-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.creet-ai-panel-head-text .creet-ai-status {
  font-size: 12px;
  color: var(--aic-accent, #C3FD73);
  display: flex;
  align-items: center;
  gap: 6px;
}
.creet-ai-panel-head-text .creet-ai-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--aic-accent, #C3FD73);
  box-shadow: 0 0 0 0 var(--aic-accent-soft, rgba(195,253,115,.6));
  animation: creet-ai-pulse 1.8s infinite;
}
@keyframes creet-ai-pulse {
  0%   { box-shadow: 0 0 0 0 var(--aic-accent-soft, rgba(195,253,115,.6)); }
  70%  { box-shadow: 0 0 0 8px rgba(195,253,115,0); }
  100% { box-shadow: 0 0 0 0 rgba(195,253,115,0); }
}
.creet-ai-panel-close {
  background: none;
  border: 0;
  color: var(--aic-text);
  cursor: pointer;
  padding: 4px;
  width: 28px; height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}
.creet-ai-panel-close:hover { background: rgba(255,255,255,.08); }
.creet-ai-panel-close svg { width: 20px; height: 20px; }

/* ── BODY (message list) ── */
.creet-ai-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--aic-bg);
}

/* ── MESSAGE BUBBLES ── */
.creet-ai-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: var(--aic-radius);
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.creet-ai-msg.is-bot {
  align-self: flex-start;
  background: var(--aic-bg-elev) !important;
  color: #ffffff !important;
  border: 1px solid var(--aic-accent-line, rgba(195,253,115,.12));
}
html[dir="rtl"] .creet-ai-msg.is-bot {
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: var(--aic-radius);
}
html:not([dir="rtl"]) .creet-ai-msg.is-bot {
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: var(--aic-radius);
}
.creet-ai-msg.is-user {
  align-self: flex-end;
  background: var(--aic-accent, #C3FD73) !important;
  color: var(--aic-accent-ink, #000) !important;
}
html[dir="rtl"] .creet-ai-msg.is-user {
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: var(--aic-radius);
}
html:not([dir="rtl"]) .creet-ai-msg.is-user {
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: var(--aic-radius);
}

/* Mirror message alignment when reply script differs from page direction. */
.creet-ai-msg.script-arabic  { direction: rtl; text-align: right; }
.creet-ai-msg.script-english { direction: ltr; text-align: left; }
.creet-ai-msg.script-arabizi { direction: ltr; text-align: left; }

/* ── RICH BOT CONTENT (lists, prices, links, CTA) ── */
.creet-ai-msg.is-bot.is-rich {
  white-space: normal;
  max-width: 92%;
}
.creet-ai-msg.is-bot.is-rich p { margin: 0 0 8px; }
.creet-ai-msg.is-bot.is-rich p:last-child { margin-bottom: 0; }
.creet-ai-msg.is-bot.is-rich strong {
  color: var(--aic-accent, #C3FD73);
  font-weight: 700;
}

.creet-ai-list,
.creet-ai-step-list {
  list-style: none;
  margin: 8px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.creet-ai-list li,
.creet-ai-step-list li {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 8px 11px;
  border-radius: 10px;
  background: var(--aic-accent-ghost, rgba(195,253,115,.05));
  border: 1px solid var(--aic-accent-line, rgba(195,253,115,.10));
  font-size: 13.5px;
}
html[dir="rtl"] .creet-ai-list li,
html[dir="rtl"] .creet-ai-step-list li { text-align: right; }
html:not([dir="rtl"]) .creet-ai-list li,
html:not([dir="rtl"]) .creet-ai-step-list li { text-align: left; }

.creet-ai-list .creet-ai-check {
  flex-shrink: 0;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--aic-accent-soft, rgba(195,253,115,.18));
  color: var(--aic-accent, #C3FD73);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.creet-ai-list .creet-ai-check svg { width: 11px; height: 11px; }

.creet-ai-step-list { counter-reset: aic-step; }
.creet-ai-step-list li { counter-increment: aic-step; }
.creet-ai-step-list .creet-ai-num {
  flex-shrink: 0;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--aic-accent, #C3FD73);
  color: var(--aic-accent-ink, #000);
  font-weight: 800;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.creet-ai-step-list .creet-ai-num::before { content: counter(aic-step); }

.creet-ai-price {
  display: inline-block;
  padding: 1px 8px;
  margin: 0 2px;
  border-radius: 6px;
  background: var(--aic-accent-soft, rgba(195,253,115,.18));
  color: var(--aic-accent, #C3FD73);
  font-weight: 700;
  font-size: 13px;
  direction: ltr;
  unicode-bidi: isolate;
}

/* Attachments container — block-level wrapper that holds product cards and
 * URL chips below a paragraph. Lets cards stack and chips wrap cleanly. */
.creet-ai-attachments {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.creet-ai-link-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  max-width: 100%;
  padding: 6px 11px;
  border-radius: 10px;
  background: var(--aic-accent-soft, rgba(195,253,115,.10));
  border: 1px solid var(--aic-accent-line, rgba(195,253,115,.25));
  color: var(--aic-accent, #C3FD73);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
  direction: ltr;
  unicode-bidi: isolate;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.creet-ai-link-chip > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* Product card — thumbnail + (title + price) + visit CTA, on one row. */
.creet-ai-product-card {
  display: flex !important;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border-radius: 12px;
  background: var(--aic-bg-elev) !important;
  border: 1px solid var(--aic-accent-line, rgba(255,255,255,.10));
  color: #ffffff !important;
  text-decoration: none !important;
  transition: border-color .12s, transform .12s;
}
.creet-ai-product-card:hover {
  border-color: var(--aic-accent, #C3FD73);
  transform: translateY(-1px);
}
.creet-ai-product-card-img {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(255,255,255,.05);
  display: block;
}
.creet-ai-product-card-img.is-placeholder {
  background: linear-gradient(135deg, rgba(255,255,255,.08), rgba(255,255,255,.02));
}
.creet-ai-product-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: stretch;
}
.creet-ai-product-card-title {
  font-weight: 700;
  font-size: 13px;
  line-height: 1.3;
  color: #ffffff !important;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.creet-ai-product-card-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  direction: ltr;
  unicode-bidi: isolate;
}
html[dir="rtl"] .creet-ai-product-card-price {
  justify-content: flex-end;
  text-align: right;
}
.creet-ai-product-card-price-old {
  color: rgba(255,255,255,.45) !important;
  text-decoration: line-through;
  font-weight: 600;
  font-size: 11.5px;
}
.creet-ai-product-card-price-now {
  color: var(--aic-accent, #C3FD73) !important;
  font-weight: 800;
}
.creet-ai-product-card-cta {
  margin-top: 4px;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--aic-accent, #C3FD73);
  color: var(--aic-accent-ink, #000) !important;
  font-size: 11.5px;
  font-weight: 700;
}
.creet-ai-product-card-cta svg {
  width: 11px;
  height: 11px;
}
html[dir="rtl"] .creet-ai-product-card-cta svg { transform: scaleX(-1); }
.creet-ai-link-chip:hover { background: var(--aic-accent-soft, rgba(195,253,115,.18)); text-decoration: none; }
.creet-ai-link-chip.is-whatsapp,
.creet-ai-link-whatsapp {
  background: var(--aic-wa-green);
  color: var(--aic-wa-ink);
  border-color: var(--aic-wa-green);
}
.creet-ai-link-chip.is-whatsapp:hover,
.creet-ai-link-whatsapp:hover {
  background: var(--aic-wa-green-dk);
  color: var(--aic-wa-ink);
}
.creet-ai-link-chip svg { width: 13px; height: 13px; }

/* In-paragraph plain link (rare; the chip is preferred). */
.creet-ai-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--aic-accent, #C3FD73);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}
.creet-ai-link:hover { text-decoration: none; }
.creet-ai-link-icon { display: inline-flex; align-items: center; }
.creet-ai-link-icon svg { display: block; }

.creet-ai-cta {
  align-self: flex-start;
  max-width: 92%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--aic-accent, #C3FD73);
  color: var(--aic-accent-ink, #000);
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: transform .12s;
}
.creet-ai-cta:hover { transform: translateY(-1px); text-decoration: none; }
.creet-ai-cta svg { width: 14px; height: 14px; }
html[dir="rtl"] .creet-ai-cta svg { transform: scaleX(-1); }

/* ── HANDOFF (WhatsApp) ── */
.creet-ai-handoff {
  align-self: flex-start;
  max-width: 90%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--aic-wa-green);
  color: var(--aic-wa-ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
}
.creet-ai-handoff:hover { background: var(--aic-wa-green-dk); color: var(--aic-wa-ink); text-decoration: none; }
.creet-ai-handoff svg { width: 14px; height: 14px; }

/* ── TYPING DOTS ── */
.creet-ai-typing {
  align-self: flex-start;
  background: var(--aic-bg-elev);
  border-radius: var(--aic-radius);
  padding: 12px 16px;
  display: flex;
  gap: 4px;
}
.creet-ai-typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--aic-accent, #C3FD73);
  opacity: .4;
  animation: creet-ai-bounce 1.2s infinite;
}
.creet-ai-typing span:nth-child(2) { animation-delay: .15s; }
.creet-ai-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes creet-ai-bounce {
  0%, 80%, 100% { opacity: .4; transform: translateY(0); }
  40%           { opacity: 1;  transform: translateY(-4px); }
}

/* ── CONVERSATION STARTERS ── */
.creet-ai-starters {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.creet-ai-starter {
  background: var(--aic-accent-ghost, rgba(195,253,115,.06));
  border: 1px solid var(--aic-accent-line, rgba(195,253,115,.22));
  color: var(--aic-text);
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.5;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .12s;
  display: flex;
  align-items: center;
  gap: 10px;
}
html[dir="rtl"] .creet-ai-starter { text-align: right; }
html:not([dir="rtl"]) .creet-ai-starter { text-align: left; }
.creet-ai-starter:hover {
  background: var(--aic-accent-soft, rgba(195,253,115,.14));
  border-color: var(--aic-accent, rgba(195,253,115,.5));
}
.creet-ai-starter:active { transform: scale(.98); }
.creet-ai-starter svg {
  width: 14px; height: 14px;
  color: var(--aic-accent, #C3FD73);
  flex-shrink: 0;
}
html[dir="rtl"] .creet-ai-starter svg { transform: scaleX(-1); }

/* ── FOOTER (input + send) ── */
.creet-ai-panel-foot {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.06);
  background: var(--aic-bg-foot);
  display: flex;
  gap: 8px;
  align-items: center;
}
.creet-ai-input {
  flex: 1;
  background: var(--aic-bg-elev) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 16px; /* >=16px prevents iOS zoom-on-focus */
  font-family: inherit;
  outline: none;
  line-height: 1.4;
}
html[dir="rtl"] .creet-ai-input { direction: rtl; text-align: right; }
html:not([dir="rtl"]) .creet-ai-input { direction: ltr; text-align: left; }
.creet-ai-input:focus { border-color: var(--aic-accent, #C3FD73) !important; }
.creet-ai-input::placeholder { color: rgba(255,255,255,.45) !important; opacity: 1; }
.creet-ai-input::-webkit-input-placeholder { color: rgba(255,255,255,.45) !important; }
.creet-ai-input::-moz-placeholder { color: rgba(255,255,255,.45) !important; opacity: 1; }

.creet-ai-send {
  background: var(--aic-accent, #C3FD73);
  color: var(--aic-accent-ink, #000);
  border: 0;
  border-radius: 12px;
  width: 44px; height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .15s;
  flex-shrink: 0;
}
.creet-ai-send:hover { transform: scale(1.05); }
.creet-ai-send:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.creet-ai-send svg { width: 18px; height: 18px; }
html[dir="rtl"] .creet-ai-send svg { transform: scaleX(-1); }

/* ── ERROR ROW (inline notice in message list) ── */
.creet-ai-error {
  align-self: stretch;
  background: rgba(245,158,11,.12);
  color: #fcd34d;
  border: 1px solid rgba(245,158,11,.3);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
}

.creet-ai-disclaimer {
  font-size: 11.5px;
  color: var(--aic-text-mute);
  text-align: center;
  padding: 6px 10px 0;
  margin: 0;
}

/* ──────────────────────────────────────────────────────────────
 * FALLBACK CONTACT FORM (rendered when assistant is unavailable)
 * Re-themed to fit dark panel but kept dim — this is a degraded state.
 * ────────────────────────────────────────────────────────────── */

.creet-ai-fallback-note {
  background: rgba(245,158,11,.12);
  color: #fcd34d;
  border: 1px solid rgba(245,158,11,.3);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  text-align: center;
  line-height: 1.5;
}
.creet-ai-fallback-form {
  border-top: 1px solid rgba(255,255,255,.06);
  background: var(--aic-bg-foot);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.creet-ai-fallback-input {
  width: 100%;
  background: var(--aic-bg-elev);
  color: var(--aic-text);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px;
  font-family: inherit;
  outline: none;
}
.creet-ai-fallback-input::placeholder { color: var(--aic-text-mute); }
.creet-ai-fallback-input:focus { border-color: var(--aic-accent, #C3FD73); }
.creet-ai-fallback-textarea { resize: vertical; min-height: 72px; max-height: 160px; }
.creet-ai-fallback-submit {
  background: var(--aic-accent, #C3FD73);
  color: var(--aic-accent-ink, #000);
  border: 0;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.creet-ai-fallback-submit:disabled { opacity: .6; cursor: not-allowed; }
.creet-ai-fallback-submit:hover:not(:disabled) { filter: brightness(1.05); }
.creet-ai-fallback-status {
  font-size: 12px;
  color: var(--aic-text-mute);
  min-height: 14px;
  text-align: center;
}
.creet-ai-fallback-thanks {
  background: var(--aic-accent-soft, rgba(195,253,115,.18));
  color: var(--aic-text);
  border: 1px solid var(--aic-accent-line, rgba(195,253,115,.4));
  border-radius: 10px;
  padding: 14px;
  font-size: 14px;
  text-align: center;
  line-height: 1.5;
}

/* ──────────────────────────────────────────────────────────────
 * MOBILE — full-screen panel below 782 px
 * Selector specificity must match (and beat) the lang-scoped rules
 * above, hence the html[dir="rtl"] / html:not([dir="rtl"]) repeats.
 * ────────────────────────────────────────────────────────────── */
@media (max-width: 782px) {
  .creet-ai-launcher,
  html[dir="rtl"] .creet-ai-launcher,
  html:not([dir="rtl"]) .creet-ai-launcher {
    bottom: 18px;
    width: 58px;
    height: 58px;
  }
  html[dir="rtl"] .creet-ai-launcher { right: 18px; left: auto; }
  html:not([dir="rtl"]) .creet-ai-launcher { left: 18px; right: auto; }

  .creet-ai-panel,
  html[dir="rtl"] .creet-ai-panel,
  html:not([dir="rtl"]) .creet-ai-panel {
    inset: 0;
    bottom: 0; top: 0; left: 0; right: 0;
    width: 100%; height: 100%;
    max-height: 100%;
    border-radius: 0;
    border: 0;
  }

  .creet-ai-tip {
    max-width: calc(100vw - 120px);
  }
}
