/* مساعد العمودي — كل الكلاسات تبدأ بـ aaw- عشان ماتتعارضش مع الثيم
   الخط: بياخد خط WoodMart (--wd-text-font / --wd-title-font) ولو مش موجود بياخد خط الصفحة */
.aaw-root {
  --aaw-c: #e30613;
  --aaw-c-dark: color-mix(in srgb, var(--aaw-c) 78%, #000);
  --aaw-c-soft: color-mix(in srgb, var(--aaw-c) 9%, #fff);
  --aaw-c-line: color-mix(in srgb, var(--aaw-c) 22%, #fff);
  --aaw-ink: #1c1c1e;
  --aaw-muted: #8b8b94;
  --aaw-bg: #f5f5f7;
  --aaw-font: var(--wd-text-font, inherit);
  --aaw-font-title: var(--wd-title-font, var(--aaw-font));
  position: fixed; bottom: 22px; z-index: 99990;
  font-family: var(--aaw-font); color: var(--aaw-ink); direction: rtl; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- عزل عن ستايلات الثيم (WoodMart بيغيّر شكل أي button/input/a) ---------- */
.aaw-root button, .aaw-root input, .aaw-root a {
  text-transform: none; letter-spacing: normal; min-height: 0; min-width: 0; text-shadow: none;
  box-shadow: none; margin: 0; line-height: 1.3; font-family: inherit; vertical-align: middle;
}
.aaw-root button svg, .aaw-root a svg { display: block; flex: 0 0 auto; max-width: none; }
.aaw-root .aaw-btn svg { display: inline-block; }
.aaw-root .aaw-wa svg { fill: currentColor; stroke: none; }
.aaw-root .aaw-list, .aaw-root .aaw-track { scrollbar-color: rgba(0,0,0,.18) transparent; }
.aaw-root .aaw-list::-webkit-scrollbar { width: 5px; }
.aaw-root .aaw-list::-webkit-scrollbar-track { background: transparent; }
.aaw-root .aaw-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,.16); border-radius: 9px; }
.aaw-root .aaw-list::-webkit-scrollbar-button { display: none; height: 0; }

.aaw-root.aaw-left { left: 22px; }
.aaw-root.aaw-right { right: 22px; }
.aaw-root *, .aaw-root *::before, .aaw-root *::after { box-sizing: border-box; }
.aaw-root button, .aaw-root input { font-family: inherit; }
.aaw-root img { max-width: none; }

/* ---------- زرار الفتح = التميمة نفسها (بدون أي مربع أو دائرة) ---------- */
.aaw-root .aaw-launcher {
  position: relative; display: block; width: auto; height: 132px; padding: 0; margin: 0; cursor: pointer;
  border: 0 !important; background: transparent !important; box-shadow: none !important; border-radius: 0; outline: 0;
  min-width: 0; min-height: 0; line-height: 0;
  transform-origin: bottom center; transition: transform .25s ease;
  animation: aaw-float 3.2s ease-in-out infinite;
}
.aaw-root .aaw-launcher:hover { transform: translateY(-4px) scale(1.05); animation-play-state: paused; }
.aaw-root .aaw-launcher:focus-visible { outline: 2px dashed var(--aaw-c); outline-offset: 4px; }
.aaw-root .aaw-launcher-img {
  height: 100%; width: auto; display: block; pointer-events: none;
  /* تلاشي ناعم أسفل الصورة بدل القطع الحاد عند الوسط */
  -webkit-mask-image: linear-gradient(to bottom, #000 78%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 78%, transparent 100%);
}
@keyframes aaw-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.aaw-root.aaw-open .aaw-launcher { animation: none; transform: scale(.9); }
.aaw-root .aaw-online { position: absolute; bottom: 3px; width: 14px; height: 14px; border-radius: 50%; background: #22c55e; border: 2.5px solid #fff; }

/* فقاعة التعريف */
.aaw-root .aaw-tip {
  position: absolute; bottom: 138px; display: flex; align-items: center; gap: 2px;
  background: #fff; border-radius: 16px; padding: 4px 4px 4px 4px; box-shadow: 0 10px 30px rgba(0,0,0,.16);
  opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .3s, transform .3s; white-space: nowrap;
}
.aaw-root.aaw-left .aaw-tip { left: 0; }
.aaw-root.aaw-right .aaw-tip { right: 0; }
.aaw-root .aaw-tip.aaw-show { opacity: 1; transform: none; pointer-events: auto; }
.aaw-root .aaw-tip::after { content: ""; position: absolute; bottom: -6px; width: 14px; height: 14px; background: #fff; transform: rotate(45deg); border-radius: 2px; }
.aaw-root.aaw-left .aaw-tip::after { left: 26px; }
.aaw-root.aaw-right .aaw-tip::after { right: 26px; }
.aaw-root .aaw-tip-text { border: 0; background: none; cursor: pointer; padding: 8px 12px; font-size: 14px; font-weight: 600; color: var(--aaw-ink); }
.aaw-root .aaw-tip-x { border: 0; background: var(--aaw-bg); color: var(--aaw-muted); width: 26px; height: 26px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; padding: 0; position: relative; z-index: 1; }

/* ---------- اللوحة ---------- */
.aaw-root .aaw-panel {
  position: absolute; bottom: 142px; width: 400px; max-width: calc(100vw - 32px);
  height: 640px; max-height: calc(100vh - 176px);
  background: var(--aaw-bg); border-radius: 24px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 70px rgba(0,0,0,.24), 0 4px 14px rgba(0,0,0,.08);
  opacity: 0; transform: translateY(16px) scale(.97); pointer-events: none; visibility: hidden;
  transition: opacity .22s ease, transform .22s ease, visibility 0s .22s;
}
.aaw-root.aaw-left .aaw-panel { left: 0; transform-origin: bottom left; }
.aaw-root.aaw-right .aaw-panel { right: 0; transform-origin: bottom right; }
.aaw-root.aaw-open .aaw-panel { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition: opacity .22s ease, transform .22s ease; }

.aaw-root .aaw-header {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 14px 14px 16px;
  color: #fff; background: linear-gradient(135deg, var(--aaw-c) 0%, var(--aaw-c-dark) 100%);
}
.aaw-root .aaw-header::after { /* لمسة زخرفية خفيفة */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .12;
  background: radial-gradient(circle at 15% 0%, #fff 0, transparent 45%), radial-gradient(circle at 90% 120%, #fff 0, transparent 40%);
}
.aaw-root .aaw-h-avatar { position: relative; flex: 0 0 46px; height: 46px; border-radius: 50%; background: #fff; border: 2px solid rgba(255,255,255,.9); }
.aaw-root .aaw-h-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; object-position: center top; display: block; }
.aaw-root .aaw-h-avatar .aaw-online { bottom: -1px; left: -1px; width: 13px; height: 13px; border-color: var(--aaw-c); }
.aaw-root .aaw-h-text { flex: 1; min-width: 0; position: relative; z-index: 1; }
.aaw-root .aaw-h-title { font-family: var(--aaw-font-title); font-size: 17px; font-weight: 700; line-height: 1.3; }
.aaw-root .aaw-h-status { display: flex; align-items: center; gap: 6px; font-size: 12px; opacity: .92; }
.aaw-root .aaw-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.25); }
.aaw-root .aaw-h-btn { position: relative; z-index: 1; width: 36px; height: 36px; border: 0; border-radius: 12px; background: rgba(255,255,255,.16); color: #fff; cursor: pointer; display: grid; place-items: center; padding: 0; transition: background .15s; }
.aaw-root .aaw-h-btn:hover { background: rgba(255,255,255,.28); }

/* ---------- الرسائل ---------- */
.aaw-root .aaw-list { position: relative; flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px 14px 10px; display: flex; flex-direction: column; gap: 14px; scrollbar-width: thin; }
.aaw-root .aaw-row { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.aaw-root .aaw-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; max-width: 100%; flex: 1; }
.aaw-root .aaw-user { justify-content: flex-end; }          /* العميل على الشمال (RTL) */
.aaw-root .aaw-user .aaw-col { align-items: flex-end; flex: 0 1 auto; max-width: 82%; }
.aaw-root .aaw-bot .aaw-col { align-items: flex-start; }
.aaw-root .aaw-avatar { flex: 0 0 30px; height: 30px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1.5px var(--aaw-c-line); overflow: hidden; align-self: flex-start; }
.aaw-root .aaw-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block; }

.aaw-root .aaw-bubble { padding: 10px 14px; border-radius: 18px; font-size: 14.5px; line-height: 1.65; white-space: pre-line; word-wrap: break-word; max-width: 100%; }
.aaw-root .aaw-bot .aaw-bubble { background: #fff; color: var(--aaw-ink); border-top-right-radius: 6px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.aaw-root .aaw-user .aaw-bubble { background: linear-gradient(135deg, var(--aaw-c), var(--aaw-c-dark)); color: #fff; border-bottom-left-radius: 6px; }

.aaw-root .aaw-typing { display: inline-flex; gap: 5px; padding: 14px 16px; }
.aaw-root .aaw-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--aaw-c); opacity: .35; animation: aaw-bounce 1.2s infinite; }
.aaw-root .aaw-typing span:nth-child(2) { animation-delay: .15s; }
.aaw-root .aaw-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes aaw-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-5px); opacity: 1; } }

/* ---------- شاشة الترحيب ---------- */
.aaw-root .aaw-welcome { display: flex; flex-direction: column; gap: 10px; }
.aaw-root .aaw-hero {
  position: relative; display: flex; align-items: flex-end; gap: 6px; min-height: 150px; padding: 14px 14px 0 0;
  border-radius: 20px; overflow: hidden;
  background: linear-gradient(160deg, var(--aaw-c-soft) 0%, #fff 70%); border: 1px solid var(--aaw-c-line);
}
.aaw-root .aaw-hero-bubble {
  position: relative; z-index: 1; flex: 1; align-self: center; margin-bottom: 14px;
  background: #fff; padding: 12px 14px; border-radius: 16px; border-top-right-radius: 6px;
  font-size: 14px; line-height: 1.7; font-weight: 500; box-shadow: 0 4px 14px rgba(0,0,0,.06);
}
.aaw-root .aaw-hero-img { flex: 0 0 auto; width: 118px; height: auto; display: block; margin-inline-start: -4px; filter: drop-shadow(0 6px 12px rgba(0,0,0,.12)); }
.aaw-root .aaw-sec-title { font-family: var(--aaw-font-title); font-size: 13px; font-weight: 700; color: var(--aaw-muted); margin: 4px 4px 0; }
.aaw-root .aaw-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.aaw-root .aaw-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 12px 6px; border-radius: 16px; border: 1px solid #ececf0; background: #fff; cursor: pointer;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.aaw-root .aaw-tile:hover { border-color: var(--aaw-c); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(227,6,19,.12); }
.aaw-root .aaw-tile-ico { font-size: 24px; line-height: 1; }
.aaw-root .aaw-tile-lbl { font-size: 13px; font-weight: 600; color: var(--aaw-ink); }
.aaw-root .aaw-examples { display: flex; flex-direction: column; gap: 6px; }
.aaw-root .aaw-example { text-align: right; border: 1px dashed var(--aaw-c-line); background: #fff; color: var(--aaw-ink); border-radius: 12px; padding: 9px 12px; font-size: 13.5px; cursor: pointer; transition: border-color .15s, background .15s; }
.aaw-root .aaw-example:hover { border-color: var(--aaw-c); background: var(--aaw-c-soft); }

/* ---------- كروت المنتجات (كاروسيل) ---------- */
.aaw-root .aaw-carousel { position: relative; width: calc(100% + 14px); margin-inline-end: -14px; }
.aaw-root .aaw-track { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 2px 8px 14px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.aaw-root .aaw-track::-webkit-scrollbar { display: none; }
.aaw-root .aaw-card {
  flex: 0 0 200px; scroll-snap-align: start; display: flex; flex-direction: column;
  background: #fff; border-radius: 18px; overflow: hidden; border: 1px solid #ececf0;
  box-shadow: 0 2px 8px rgba(0,0,0,.04); transition: box-shadow .15s, transform .15s;
}
.aaw-root .aaw-card:hover { box-shadow: 0 8px 22px rgba(0,0,0,.09); }
.aaw-root .aaw-card-media { position: relative; display: flex; align-items: center; justify-content: center; height: 140px; background: #fafafa; padding: 10px; }
.aaw-root .aaw-card-media img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.aaw-root .aaw-badge { position: absolute; top: 8px; right: 8px; background: var(--aaw-c); color: #fff; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.aaw-root .aaw-card-body { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px 12px; flex: 1; }
.aaw-root .aaw-brand { font-size: 11.5px; font-weight: 600; color: var(--aaw-muted); text-transform: uppercase; letter-spacing: .02em; }
.aaw-root .aaw-name { font-size: 13.5px; font-weight: 600; color: var(--aaw-ink); text-decoration: none; line-height: 1.5; min-height: 40px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.aaw-root .aaw-name:hover { color: var(--aaw-c); }
.aaw-root .aaw-price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.aaw-root .aaw-now { font-family: var(--aaw-font-title); color: var(--aaw-c); font-size: 18px; font-weight: 800; }
.aaw-root .aaw-now small { font-size: 12px; font-weight: 600; }
.aaw-root .aaw-old { color: #a1a1aa; font-size: 12.5px; text-decoration: line-through; }
.aaw-root .aaw-reason { align-self: flex-start; font-size: 11.5px; font-weight: 600; color: #15803d; background: #f0fdf4; border-radius: 999px; padding: 3px 9px; }
.aaw-root .aaw-actions { display: flex; flex-direction: column; gap: 6px; margin-top: auto; padding-top: 8px; }
.aaw-root .aaw-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%;
  padding: 9px 10px; border-radius: 12px; font-size: 13px; font-weight: 700; cursor: pointer; text-decoration: none; line-height: 1.2;
  border: 1.5px solid var(--aaw-c); transition: filter .15s, background .15s;
}
.aaw-root .aaw-btn-primary { background: var(--aaw-c); color: #fff; }
.aaw-root .aaw-btn-primary:hover { filter: brightness(.94); color: #fff; }
.aaw-root .aaw-btn-ghost { background: #fff; color: var(--aaw-c); }
.aaw-root .aaw-btn-ghost:hover { background: var(--aaw-c-soft); }
.aaw-root .aaw-btn[disabled] { cursor: default; opacity: .75; }
.aaw-root .aaw-btn.aaw-added { background: #16a34a; border-color: #16a34a; color: #fff; opacity: 1; }
.aaw-root .aaw-nav { position: absolute; top: 58px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: #fff; color: var(--aaw-ink); box-shadow: 0 4px 12px rgba(0,0,0,.15); cursor: pointer; display: grid; place-items: center; padding: 0; z-index: 2; }
.aaw-root .aaw-nav-prev { right: -4px; }
.aaw-root .aaw-nav-next { left: 18px; }
.aaw-root .aaw-count { font-size: 11.5px; color: var(--aaw-muted); padding: 0 4px; }

.aaw-root .aaw-wa { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; background: #25d366; color: #fff; font-size: 13.5px; font-weight: 700; text-decoration: none; box-shadow: 0 4px 12px rgba(37,211,102,.3); }
.aaw-root .aaw-wa:hover { color: #fff; filter: brightness(.95); }

/* ---------- الأزرار السريعة والكتابة ---------- */
.aaw-root .aaw-chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 14px 2px; scrollbar-width: none; }
.aaw-root .aaw-chips::-webkit-scrollbar { display: none; }
.aaw-root .aaw-chips:empty { display: none; }
.aaw-root .aaw-chip { flex: 0 0 auto; border: 1px solid var(--aaw-c-line); background: #fff; color: var(--aaw-c); border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s, border-color .15s; }
.aaw-root .aaw-chip:hover { background: var(--aaw-c); border-color: var(--aaw-c); color: #fff; }

.aaw-root .aaw-form { padding: 10px 12px 12px; }
.aaw-root .aaw-field { display: flex; align-items: center; gap: 6px; background: #fff; border-radius: 999px; padding: 5px 5px 5px 5px; padding-inline-start: 16px; box-shadow: 0 2px 10px rgba(0,0,0,.06); border: 1.5px solid transparent; transition: border-color .15s; }
.aaw-root .aaw-field:focus-within { border-color: var(--aaw-c); }
.aaw-root .aaw-input { flex: 1; min-width: 0; border: 0 !important; outline: 0; background: transparent !important; box-shadow: none !important; font-size: 14.5px; color: var(--aaw-ink); padding: 8px 0 !important; height: auto !important; margin: 0 !important; }
.aaw-root .aaw-send { flex: 0 0 40px; height: 40px; border: 0; border-radius: 50%; background: var(--aaw-c); color: #fff; cursor: pointer; display: grid; place-items: center; padding: 0; transition: filter .15s, transform .15s; }
.aaw-root .aaw-send:hover { filter: brightness(.94); }
.aaw-root .aaw-send:active { transform: scale(.94); }
.aaw-root .aaw-send[disabled] { opacity: .5; cursor: default; }
.aaw-root .aaw-send svg { transform: scaleX(-1); }

/* ---------- موبايل ---------- */
@media (max-width: 600px) {
  .aaw-root { bottom: 66px; } /* فوق شريط WoodMart السفلي */
  .aaw-root.aaw-left { left: 14px; }
  .aaw-root.aaw-right { right: 14px; }
  .aaw-root .aaw-launcher { height: 104px; }
  .aaw-root .aaw-tip { bottom: 110px; }
  .aaw-root.aaw-open .aaw-panel { position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; height: 100dvh; max-height: none; border-radius: 0; }
  .aaw-root.aaw-open .aaw-launcher, .aaw-root.aaw-open .aaw-tip { display: none; }
  .aaw-root .aaw-input { font-size: 16px; } /* يمنع zoom في iOS */
  .aaw-root .aaw-nav { display: none; }
  .aaw-root .aaw-card { flex-basis: 72%; }
}
@media (prefers-reduced-motion: reduce) {
  .aaw-root .aaw-launcher, .aaw-root .aaw-typing span { animation: none; }
  .aaw-root .aaw-panel, .aaw-root .aaw-launcher, .aaw-root .aaw-tip { transition: none; }
}
