/* LABIB - Widget (Frontend)
   - Inherit theme font
   - Launcher button styles (works before React loads)
*/
#sy-widget-root { font-family: inherit; direction: rtl; }
#sy-widget-root *, #sy-widget-root input, #sy-widget-root textarea, #sy-widget-root button, #sy-widget-root select { font-family: inherit !important; }
#sy-widget-root, #sy-widget-root * { box-sizing: border-box; }

.sy-launch{
  position:fixed; bottom:24px; right:24px; z-index:999999;
  width:64px; height:64px; border-radius:999px; border:0;
  color:#fff; font-size:26px; cursor:pointer;
  box-shadow:0 20px 35px rgba(0,0,0,.25);
  transition:transform .15s ease;
}
.sy-launch:hover{ transform:scale(1.06); }
.sy-launch:active{ transform:scale(.92); }
.sy-launch:disabled{ opacity:.7; cursor:not-allowed; }

@media (prefers-reduced-motion: reduce) { .sy-launch { transition:none !important; } }

/* ------------------------------
   Lite Widget Styles (no Tailwind)
   Scoped to .syai-lite-* to avoid collisions
---------------------------------*/

:root {
  /* ══════════════════════════════════════════════════════════════
     LABIB — متغيرات الألوان
     ► تُعيَّن تلقائياً من لون القالب عبر JS (widget-lite.js)
     ► المدير يتحكم بها من: LABIB → تخصيص المظهر
     ► هذه القيم = الـ fallback النهائي إذا لم يُحدد شيء
  ══════════════════════════════════════════════════════════════ */

  /* اللون الرئيسي — يُطبَّق على: الهيدر، الأزرار، التمييز */
  --syai-primary:       #4f46e5;

  /* ── الودجت دائماً فاتح لضمان قراءة الرسائل ── */
  --syai-body-bg:       #ffffff;
  --syai-footer-bg:     #f8fafc;
  --syai-input-bg:      #ffffff;
  --syai-input-text:    #1e293b;
  --syai-input-border:  #e2e8f0;

  /* فقاعات الرسائل */
  --syai-bot-bubble:    #f1f5f9;      /* رمادي فاتح — قابل للقراءة دائماً */
  --syai-bot-text:      #1e293b;      /* نص داكن على الفقاعة الفاتحة */
  --syai-user-bubble:   #ede9fe;      /* بنفسجي فاتح افتراضي */
  --syai-user-text:     #3730a3;      /* نص داكن على الفقاعة الفاتحة */

  /* الهيدر يستخدم gradient من --syai-primary */
  --syai-header-bg:     linear-gradient(135deg, #4338ca, #2d2291); /* مُحسَّب من --syai-primary في JS */

  /* الحدود والظلال */
  --syai-border:        rgba(0,0,0,0.08);
  --syai-shadow:        0 18px 50px rgba(0,0,0,0.22);
}

.syai-lite-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 360px;
  max-width: calc(100vw - 48px);
  height: 520px;
  max-height: calc(100vh - 140px);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px;
  box-shadow: var(--syai-shadow, 0 18px 50px rgba(0,0,0,0.22));
  background: var(--syai-body-bg, #ffffff);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 999999;
  font-family: inherit;
}

.syai-lite-panel.syai-open {
  display: flex;
}

.syai-lite-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  color: #fff;
  background: var(--syai-header-bg);
}

.syai-lite-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.syai-lite-botname {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.syai-lite-sub {
  font-size: 12px;
  opacity: 0.9;
}

.syai-lite-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.syai-lite-close {
  appearance: none;
  border: 0;
  background: rgba(255,255,255,0.18);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.syai-lite-close:hover {
  background: rgba(255,255,255,0.26);
}

.syai-lite-clear {
  appearance: none;
  border: 0;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.85);
  padding: 0 10px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: background 0.15s;
  white-space: nowrap;
}

.syai-lite-clear:hover {
  background: rgba(255,255,255,0.22);
  color: #fff;
}

.syai-lite-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  height: 100%;
  min-height: 0;
}

.syai-lite-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.syai-lite-chip {
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.85);
  color: #111827;
  font-size: 12px;
  padding: 7px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.syai-lite-chip:hover {
  border-color: rgba(0,0,0,0.14);
}

.syai-lite-chip-secondary {
  border-color: rgba(79,70,229,0.35);
  color: var(--syai-primary);
}

.syai-lite-messages {
  flex: 1;
  overflow: auto;
  padding: 2px;
}

.syai-lite-msg {
  display: flex;
  margin: 8px 0;
}

.syai-lite-msg.is-user {
  justify-content: flex-end;
}

.syai-lite-msg.is-bot {
  justify-content: flex-start;
}

.syai-lite-bubble {
  max-width: 84%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  /* يجعل النص يضبط اتجاهه تلقائياً (RTL/LTR) حسب المحتوى */
  direction: auto;
  unicode-bidi: plaintext;
  text-align: start;
}

.syai-lite-msg.is-user .syai-lite-bubble {
  background: var(--syai-user-bubble);
  border: 1px solid rgba(79,70,229,0.18);
}

.syai-lite-msg.is-bot .syai-lite-bubble {
  background: var(--syai-bot-bubble);
  border: 1px solid rgba(0,0,0,0.06);
}

.syai-lite-link {
  color: var(--syai-primary);
  text-decoration: underline;
}

/* ── [IMP-10] زر الرابط — يظهر كزر أنيق بدلاً من URL خام ── */
.syai-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--syai-primary, #4f46e5);
  color: #fff !important;
  text-decoration: none !important;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px 5px 10px;
  border-radius: 20px;
  margin: 3px 0;
  max-width: 100%;
  overflow: hidden;
  transition: opacity 0.15s, transform 0.1s;
  line-height: 1.4;
  vertical-align: middle;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.syai-link-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.syai-link-btn-icon {
  font-size: 11px;
  flex-shrink: 0;
}

.syai-link-btn-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: ltr;
  unicode-bidi: bidi-override;
}

.syai-link-btn-arrow {
  font-size: 11px;
  flex-shrink: 0;
  opacity: 0.8;
}



.syai-lite-wa {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  text-decoration: none;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 10px 24px rgba(34,197,94,0.25);
}

.syai-lite-wa:hover { filter: brightness(1.02); }
.syai-lite-wa:active { transform: translateY(1px); }
.syai-lite-wa-icon { display: inline-flex; }

.syai-lite-footer {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid rgba(0,0,0,0.06);
  background: var(--syai-footer-bg);
}

.syai-lite-input {
  flex: 1;
  resize: none;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.4;
  outline: none;
  font-family: inherit;
  color: var(--syai-input-text);
  background: var(--syai-input-bg);
  direction: auto;
  unicode-bidi: plaintext;
  text-align: start;
}

.syai-lite-input::placeholder {
  color: color-mix(in srgb, var(--syai-input-text) 40%, transparent);
}

.syai-lite-input:focus {
  border-color: rgba(79,70,229,0.4);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}

.syai-lite-send {
  border: 0;
  border-radius: 14px;
  padding: 10px 14px;
  cursor: pointer;
  color: #fff;
  background: var(--syai-primary);
  font-weight: 700;
  font-family: inherit;
}

.syai-lite-send:disabled {
  opacity: 0.75;
  cursor: not-allowed;
}

.syai-lite-escalation {
  border: 1px solid rgba(0,0,0,0.07);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.78);
}

.syai-lite-esc-title {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #111827;
}

.syai-lite-esc-row {
  display: flex;
  gap: 8px;
}

.syai-lite-esc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border-radius: 12px;
  text-decoration: none;
  font-size: 12px;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(0,0,0,0.03);
  color: #111827;
}

.syai-lite-esc-btn:hover {
  border-color: rgba(0,0,0,0.14);
}


/* Logo in header */
.syai-lite-logo-wrap {
  display: flex;
  align-items: center;
  margin-left: 10px; /* RTL: space before title */
}
.syai-lite-logo-img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: contain;
  background: rgba(255,255,255,0.15);
}

@media (max-width: 520px) {
  .syai-lite-panel {
    right: 12px;
    bottom: 86px;
    width: calc(100vw - 24px);
    height: min(520px, calc(100vh - 120px));
  }
}

/* ── Typing indicator (نقاط الانتظار) ─────────────────── */
.syai-typing-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
}
.syai-typing-bubble span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--syai-primary);
  opacity: 0.5;
  animation: syai-bounce 1.2s ease-in-out infinite;
}
.syai-typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.syai-typing-bubble span:nth-child(3) { animation-delay: 0.4s; }

@keyframes syai-bounce {
  0%, 80%, 100% { transform: translateY(0);   opacity: 0.4; }
  40%           { transform: translateY(-7px); opacity: 1;   }
}


/* ══════════════════════════════════════════════════════════════
   🎉 GREETING BUBBLE — v1.8.1
   ══════════════════════════════════════════════════════════════ */

.syai-greet-wrap {
  position: fixed;
  bottom: 100px;   /* فوق زر البوت مباشرة */
  right: 24px;
  z-index: 999998;
  pointer-events: none;
  opacity: 0;
  transform: translateY(12px) scale(0.95);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.syai-greet-wrap.syai-greet-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.syai-greet-wrap.syai-greet-hiding {
  opacity: 0;
  transform: translateY(8px) scale(0.92);
  pointer-events: none;
}

.syai-greet-bubble {
  position: relative;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 18px 18px 4px 18px;
  padding: 12px 38px 12px 14px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.13);
  max-width: 220px;
  min-width: 140px;
  cursor: pointer;
  direction: rtl;
  font-family: inherit;
  transition: box-shadow 0.2s, transform 0.15s;
}

.syai-greet-bubble:hover {
  box-shadow: 0 12px 36px rgba(0,0,0,0.17);
  transform: translateY(-2px);
}

/* مثلث يشير للأسفل */
.syai-greet-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 18px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #e2e8f0;
}

.syai-greet-bubble::before {
  content: '';
  position: absolute;
  bottom: -7px;
  right: 19px;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 7px solid #fff;
  z-index: 1;
}

.syai-greet-text {
  font-size: 13px;
  line-height: 1.5;
  color: #1e293b;
  font-weight: 500;
  display: block;
}

.syai-greet-close {
  position: absolute;
  top: 7px;
  left: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 0;
  background: #f1f5f9;
  color: #64748b;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}

.syai-greet-close:hover {
  background: #e2e8f0;
  color: #1e293b;
}

@media (max-width: 520px) {
  .syai-greet-wrap {
    right: 12px;
    bottom: 96px;
  }
  .syai-greet-bubble {
    max-width: calc(100vw - 90px);
  }
}

/* ══════════════════════════════════════════════════════════════
   👁 HIDE / SHOW BOT TOGGLE BUTTON — v1.8.1
   ══════════════════════════════════════════════════════════════ */

.syai-hide-toggle {
  position: fixed;
  bottom: 24px;
  right: 90px;          /* يسار زر البوت (RTL) */
  z-index: 999998;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.12);
  background: rgba(255,255,255,0.9);
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  transition: background 0.18s, color 0.18s, transform 0.18s;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.syai-hide-toggle:hover {
  background: #fff;
  color: #1e293b;
  transform: scale(1.12);
  box-shadow: 0 4px 14px rgba(0,0,0,0.16);
}

/* عندما يكون البوت مخفياً — يصبح الزر أكثر وضوحاً */
.syai-hide-toggle[title="إظهار المساعد الذكي"] {
  background: rgba(79,70,229,0.1);
  color: #4f46e5;
  border-color: rgba(79,70,229,0.25);
}

@media (max-width: 520px) {
  .syai-hide-toggle {
    right: 80px;
    bottom: 20px;
  }
}

/* تحريك زر الإطلاق عند الإخفاء */
#sy-widget-launch {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.25s ease !important;
}

/* ══════════════════════════════════════════════════════════════
   🛍 PRODUCT FULL CARDS — v2.0.0
   بطاقة منتج كاملة: صورة + اسم + سعر + وصف + أزرار
   ألوان البطاقات تتبع --syai-primary من القالب تلقائياً
   ══════════════════════════════════════════════════════════════ */

.syai-products-intro {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

/* شبكة البطاقات: عمود واحد لكل بطاقة بعرض كامل */
.syai-products-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

/* البطاقة الواحدة */
.syai-product-card {
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: flex-start;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.07);
  background: rgba(255, 255, 255, 0.95);
  overflow: hidden;
  transition: box-shadow 0.18s, transform 0.15s;
}

.syai-product-card:hover {
  box-shadow: 0 4px 18px rgba(0,0,0,0.10);
  transform: translateY(-1px);
}

/* ── حاوية الصورة ── */
.syai-product-card-img-wrap {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: 10px 0 0 10px;
  overflow: hidden;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.syai-product-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.syai-product-card-icon {
  font-size: 32px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.03);
}

/* ── جسم البطاقة: اسم + سعر + وصف + أزرار ── */
.syai-product-card-body {
  flex: 1;
  padding: 8px 10px 8px 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.syai-product-card-name {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.syai-product-card-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--syai-primary, #4f46e5);
  direction: ltr;
  text-align: right;
}

.syai-product-card-desc {
  font-size: 11px;
  color: #64748b;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── أزرار الإجراء ── */
.syai-product-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.syai-product-ask-btn {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: var(--syai-primary, #4f46e5);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.12s;
  font-family: inherit;
  white-space: nowrap;
}

.syai-product-ask-btn:hover {
  opacity: 0.88;
  transform: scale(1.03);
}

.syai-product-detail-btn {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--syai-primary, #4f46e5);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--syai-primary, #4f46e5);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.syai-product-detail-btn:hover {
  background: var(--syai-primary, #4f46e5);
  color: #fff;
}

/* ── اتجاه RTL للبطاقة ── */
.syai-lite-panel[dir="rtl"] .syai-product-card-img-wrap,
.syai-lite-panel .syai-product-card-img-wrap {
  border-radius: 0 10px 10px 0;
}

/* ── تحجيم مناسب على الشاشات الصغيرة ── */
@media (max-width: 360px) {
  .syai-product-card-img-wrap {
    width: 64px;
    height: 64px;
  }
  .syai-product-card-body {
    padding: 6px 8px 6px 0;
  }
}

/* ══════════════════════════════════════════════════════════════
   [IMP] بطاقة "اسألني عنه" — تظهر في فقاعة المستخدم
   ══════════════════════════════════════════════════════════════ */

.syai-product-ask-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.18);
  border-radius: 10px;
  padding: 8px 10px;
  min-width: 180px;
  max-width: 240px;
  border: 1px solid rgba(255,255,255,0.35);
  backdrop-filter: blur(4px);
}

.syai-product-ask-card-img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.3);
}

.syai-product-ask-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.syai-product-ask-card-name {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.syai-product-ask-card-name:hover {
  text-decoration: underline;
}

.syai-product-ask-card-price {
  font-size: 11px;
  color: rgba(255,255,255,0.85);
  font-weight: 600;
}

.syai-product-ask-card-label {
  font-size: 10px;
  color: rgba(255,255,255,0.7);
  margin-top: 2px;
}
