/* ===== هوية NUX-T ===== */
:root{
  --nux-primary:   #5a46d6;
  --nux-primary-2: #6f5dff;
  --nux-grad: linear-gradient(135deg, var(--nux-primary), var(--nux-primary-2));
  --nux-ink: #0f142b;
  --glass-dark: rgba(17,21,29,.92);
  --glass-light: rgba(255,255,255,.96);
  --brd-dark:  rgba(255,255,255,.12);
  --brd-light: rgba(0,0,0,.10);
}

/* اقتراح خطوط (اختياري) */
/* @import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;800&display=swap'); 
body{ font-family: "Cairo", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; } */

/* ===== زر الشات (روبوت بنفسجي مضيء) ===== */
.nxchat-fab{
  position: fixed;
  inset-inline-end: 22px;
  inset-block-end: 28px;
  z-index: 1500;
  width: 60px; height: 60px;
  border: 0; border-radius: 50%;
  background: var(--nux-grad);
  color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 12px 30px rgba(90,70,214,.45), 0 0 24px rgba(111,93,255,.35);
  cursor: pointer;
  transition: transform .25s ease, box-shadow .3s ease, filter .3s ease;
  animation: nuxFloat 3.6s ease-in-out infinite;  /* نبضة خفيفة */
}
@keyframes nuxFloat{
  0%,100%{ transform: translateY(0); }
  50%{ transform: translateY(-3px); }
}
.nxchat-fab:hover{ transform: scale(1.08); box-shadow: 0 16px 40px rgba(90,70,214,.6), 0 0 30px rgba(111,93,255,.6); }
.nxchat-fab svg{ width:30px; height:30px; fill:#fff; filter: drop-shadow(0 0 6px rgba(255,255,255,.75)); transition: transform .35s ease; }
.nxchat-fab:hover svg{ transform: rotate(8deg) scale(1.06); }

/* ===== نافذة الشات (مصغّرة كما في الصورة) ===== */
.nxchat-sheet{
  position: fixed;
  inset-inline-end: 18px;
  inset-block-end: 96px; /* فوق الزر */
  width: min(350px, 92vw);
  max-height: min(500px, 72vh);
  display: grid; grid-template-rows: auto 1fr auto;
  border-radius: 18px;
  background: var(--glass-dark);
  color:#f4f6ff;
  border: 1px solid var(--brd-dark);
  box-shadow: 0 22px 60px rgba(0,0,0,.5);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  transform: translateY(16px) scale(.98);
  opacity: 0; pointer-events: none;
  transition: transform .25s ease, opacity .25s ease;
}
html[data-bs-theme="light"] .nxchat-sheet{
  background: var(--glass-light);
  color: var(--nux-ink);
  border-color: var(--brd-light);
}
.nxchat-sheet.is-open{ opacity:1; transform:none; pointer-events:auto; }

/* رأس النافذة */
.nxchat-head{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--brd-dark);
}
html[data-bs-theme="light"] .nxchat-head{ border-color: var(--brd-light); }
.nxchat-title{
  font-weight: 800;
  font-size: 1.02rem;
  letter-spacing: .2px;
}
.nxchat-title .brand{ color: var(--nux-primary-2); }

/* زر الإغلاق (دوران لطيف) */
.nxchat-close{
  border:0; background:transparent; color:inherit;
  inline-size: 34px; block-size: 34px; border-radius:50%;
  display:grid; place-items:center; font-size:1.4rem; cursor:pointer;
  transition: transform .35s cubic-bezier(.22,.61,.36,1), background .25s ease;
}
.nxchat-close:hover{ background: rgba(255,255,255,.08); transform: rotate(180deg); }
html[data-bs-theme="light"] .nxchat-close:hover{ background: rgba(0,0,0,.06); }

/* منطقة الرسائل */
.nxchat-body{
  padding: 12px;
  overflow: auto;
  display: grid; gap: 12px;
}

/* فقاعات الرسائل */
.nx-msg{
  max-width: 86%;
  padding: .6rem .8rem;
  border-radius: 14px;
  font-size: .92rem;
  line-height: 1.75;
}
.nx-msg.user{
  margin-inline-start: auto;
  background: var(--nux-grad);
  color: #fff;
  box-shadow: 0 10px 24px rgba(90,70,214,.28);
}
.nx-msg.bot{
  background: rgba(255,255,255,.08);
  border: 1px solid var(--brd-dark);
}
html[data-bs-theme="light"] .nx-msg.bot{
  background: rgba(0,0,0,.05);
  border-color: var(--brd-light);
}

/* نموذج الإدخال */
.nxchat-form{
  display:grid; grid-template-columns: 1fr auto; gap:10px;
  padding: 10px;
  border-top: 1px solid var(--brd-dark);
}
html[data-bs-theme="light"] .nxchat-form{ border-color: var(--brd-light); }

.nxchat-input{
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  padding: .6rem 1rem;
  color: inherit; outline: none;
}
html[data-bs-theme="light"] .nxchat-input{
  background: rgba(0,0,0,.04);
  border-color: var(--brd-light);
}

.nxchat-send{
  width: 42px; height: 42px;
  border-radius: 50%; border: 0; cursor: pointer;
  display:grid; place-items:center;
  background: var(--nux-grad); color: #fff;
  box-shadow: 0 10px 24px rgba(90,70,214,.30);
  transition: transform .2s ease, filter .2s ease;
}
.nxchat-send:hover{ transform: translateY(-2px); filter: brightness(1.06); }

/* موبايل: مسافة آمنة من الحواف */
@media (max-width: 420px){
  .nxchat-sheet{ inset-inline-end: 12px; inset-block-end: 88px; }
  .nxchat-fab{ inset-inline-end: 16px; inset-block-end: 20px; }
}
/* ===== زر الشات (يسار الصفحة) ===== */
.nxchat-fab {
  position: fixed;
  inset-inline-start: 22px; /* يسار */
  inset-inline-end: auto;   /* إلغاء اليمين */
  inset-block-end: 28px;    /* أسفل الصفحة */
}

/* ===== نافذة الشات (يسار الصفحة) ===== */
.nxchat-sheet {
  position: fixed;
  inset-inline-start: 18px; /* يسار */
  inset-inline-end: auto;
  inset-block-end: 96px; /* فوق الزر قليلاً */
}
/* تخصيص شريط تمرير زجاجي */
.nxchat-body::-webkit-scrollbar {
  width: 6px;
}
.nxchat-body::-webkit-scrollbar-thumb {
  background: rgba(111,93,255,0.4);
  border-radius: 8px;
}


.nxchat-sheet {
  width: min(320px, 90vw);   /* عرض أقل من السابق (350px → 320px) */
  max-height: min(460px, 70vh);
  border-radius: 16px;
}

/* ===== جعل حواف خانة الإدخال مضيئة بالبنفسجي ===== */
.nxchat-input {
  border: 1px solid rgba(111,93,255,.55);
  box-shadow: 0 0 10px rgba(111,93,255,.35), inset 0 0 6px rgba(111,93,255,.25);
  transition: box-shadow .3s ease, border-color .3s ease;
}







/* منع أي تمرير أفقي داخل نافذة الشات بالكامل */
.nxchat-sheet{
  max-width: calc(100vw - 24px);
  overflow-x: hidden;     /* مهم */
}

/* منطقة الرسائل: تمرير عمودي فقط، لا أفقي */
.nxchat-body{
  overflow-y: auto;
  overflow-x: hidden;     /* يمنع الشريط السفلي */
  overscroll-behavior: contain;
}

/* الفقاعات تتكيّف وتلتف ولا تكسر التخطيط */
.nx-msg{
  max-width: 86%;
  word-break: break-word;     /* يكسر الكلمات الطويلة */
  overflow-wrap: anywhere;    /* يلفّ الروابط والكلمات */
  white-space: normal;        /* يضمن التفاف السطور */
  box-sizing: border-box;
}

/* صور/ميديا داخل الرسائل لا تتعدى عرض الفقاعة */
.nx-msg img,
.nx-msg video,
.nx-msg iframe{
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
}

/* حقل الإدخال لا يُسبب تمددًا عرضيًا */
.nxchat-input{
  min-width: 0;
}

/* إزالة أي شريط تمرير أفقي مُخصص (إن وُجد سابقًا) */
.nxchat-body::-webkit-scrollbar:horizontal{ display:none; height:0; }