/* Nova AI — website assistant («اسأل نوفا» / "Ask Nova")
   Self-contained. Uses the site tokens from main.css: --black --ink --violet --cyan --white --gray --line --grad --ar --en --ease.
   Markup is injected by assets/js/assistant.js. */

.nova-ai { font-family: var(--ar, "IBM Plex Sans Arabic", system-ui, sans-serif); color: var(--white, #F5F7FF); font-size: 15px; line-height: 1.6; }
html[lang="en"] .nova-ai { font-family: var(--en, "Manrope", system-ui, sans-serif); }
.nova-ai *, .nova-ai *::before, .nova-ai *::after { box-sizing: border-box; }
.nova-ai [hidden] { display: none !important; }
:where(.nova-ai) button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; } /* low specificity: component classes win */
.nova-ai :focus-visible { outline: 2px solid var(--cyan, #00D5FF); outline-offset: 2px; border-radius: 10px; }
.nova-ai .sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.nova-ai svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- launcher ---------- */
.nova-ai__launcher {
  position: fixed; z-index: 50; bottom: max(20px, env(safe-area-inset-bottom)); inset-inline-start: 20px;
  display: inline-flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 20px 0 16px; border-radius: 999px;
  background: rgba(13, 16, 32, .82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  color: var(--white, #F5F7FF); font-weight: 600; font-size: 15px; letter-spacing: .01em;
  box-shadow: inset 0 0 0 1px rgba(108, 99, 255, .55), 0 14px 40px -14px rgba(108, 99, 255, .8);
  transition: box-shadow .4s, transform .5s var(--ease, ease), opacity .4s;
}
[dir="rtl"] .nova-ai__launcher { padding: 0 16px 0 20px; }
.nova-ai__launcher:hover { box-shadow: inset 0 0 0 1px var(--cyan, #00D5FF), 0 18px 48px -14px rgba(0, 213, 255, .7); transform: translateY(-2px); }
.nova-ai__launcher svg { width: 20px; height: 20px; color: var(--cyan, #00D5FF); }
.nova-ai__launcher .nova-ai__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan, #00D5FF); box-shadow: 0 0 0 0 rgba(0, 213, 255, .6); animation: nova-pulse 2.4s infinite; }
.nova-ai.is-open .nova-ai__launcher { opacity: 0; pointer-events: none; transform: translateY(8px) scale(.96); }
@keyframes nova-pulse { 0% { box-shadow: 0 0 0 0 rgba(0, 213, 255, .55); } 70% { box-shadow: 0 0 0 10px rgba(0, 213, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(0, 213, 255, 0); } }

/* ---------- panel ---------- */
.nova-ai__panel {
  position: fixed; z-index: 60; bottom: max(20px, env(safe-area-inset-bottom)); inset-inline-start: 20px;
  width: min(392px, calc(100vw - 32px)); height: min(620px, calc(100dvh - 40px));
  display: grid; grid-template-rows: auto 1fr auto auto; overflow: hidden;
  background: var(--ink, #0D1020); border-radius: 22px;
  box-shadow: inset 0 0 0 1px var(--line, rgba(150, 162, 189, .14)), 0 30px 80px -20px rgba(0, 0, 0, .7), 0 0 0 1px rgba(108, 99, 255, .12);
  transform-origin: bottom left; opacity: 0; transform: translateY(14px) scale(.97); visibility: hidden;
  transition: opacity .35s var(--ease, ease), transform .45s var(--ease, ease), visibility .45s;
}
[dir="rtl"] .nova-ai__panel { transform-origin: bottom right; }
.nova-ai.is-open .nova-ai__panel { opacity: 1; transform: none; visibility: visible; }

.nova-ai__head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line, rgba(150, 162, 189, .14)); background: linear-gradient(180deg, rgba(108, 99, 255, .12), transparent); }
.nova-ai__mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--grad, linear-gradient(120deg, #00D5FF, #3F7BFF 45%, #6C4DFF)); color: #fff; flex: none; }
.nova-ai__mark svg { width: 20px; height: 20px; stroke: #fff; }
.nova-ai__titles { min-width: 0; flex: 1; }
.nova-ai__title { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.2; }
.nova-ai__sub { margin: 2px 0 0; font-size: 12px; color: var(--gray, #96A2BD); line-height: 1.3; }
.nova-ai__icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--gray, #96A2BD); transition: background .3s, color .3s; }
.nova-ai__icon:hover { background: rgba(245, 247, 255, .06); color: var(--white, #F5F7FF); }

/* ---------- messages ---------- */
.nova-ai__log { overflow-y: auto; overscroll-behavior: contain; padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.nova-ai__msg { max-width: 86%; padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; animation: nova-in .35s var(--ease, ease); }
.nova-ai__msg--bot { align-self: flex-start; background: rgba(245, 247, 255, .05); box-shadow: inset 0 0 0 1px var(--line, rgba(150, 162, 189, .14)); border-start-start-radius: 6px; }
.nova-ai__msg--user { align-self: flex-end; background: rgba(108, 99, 255, .22); box-shadow: inset 0 0 0 1px rgba(108, 99, 255, .4); border-end-end-radius: 6px; }
.nova-ai__msg--error { align-self: flex-start; background: rgba(255, 99, 132, .1); box-shadow: inset 0 0 0 1px rgba(255, 99, 132, .35); color: #ffd3dc; }
.nova-ai__msg--bot.is-streaming::after { content: ""; display: inline-block; width: 7px; height: 15px; margin-inline-start: 2px; vertical-align: -2px; background: var(--cyan, #00D5FF); animation: nova-caret .9s steps(2) infinite; }
/* «Not helpful» under the latest answer (feeds the learning loop) */
.nova-ai__down { align-self: flex-start; margin-top: -4px; padding: 2px 8px; border: 0; border-radius: 8px; background: none; color: var(--gray, #96A2BD); font: inherit; font-size: .75rem; cursor: pointer; opacity: .75; transition: opacity .2s, color .2s; }
.nova-ai__down:hover, .nova-ai__down:focus-visible { opacity: 1; color: var(--white, #F5F7FF); }
.nova-ai__down:focus-visible { outline: 2px solid var(--cyan, #00D5FF); outline-offset: 2px; }
.nova-ai__down:disabled { cursor: default; opacity: .9; color: var(--cyan, #00D5FF); }
.nova-ai__typing { align-self: flex-start; display: inline-flex; gap: 5px; padding: 12px 14px; border-radius: 16px; background: rgba(245, 247, 255, .05); box-shadow: inset 0 0 0 1px var(--line, rgba(150, 162, 189, .14)); }
.nova-ai__typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--gray, #96A2BD); animation: nova-bounce 1.2s infinite; }
.nova-ai__typing i:nth-child(2) { animation-delay: .15s; }
.nova-ai__typing i:nth-child(3) { animation-delay: .3s; }
@keyframes nova-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
@keyframes nova-caret { 50% { opacity: 0; } }
@keyframes nova-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- starters + composer ---------- */
.nova-ai__chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 16px 10px; }
.nova-ai__chip { padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; background: rgba(0, 213, 255, .08); box-shadow: inset 0 0 0 1px rgba(0, 213, 255, .3); color: var(--white, #F5F7FF); transition: background .3s, box-shadow .3s; text-align: start; }
.nova-ai__chip:hover { background: rgba(0, 213, 255, .16); box-shadow: inset 0 0 0 1px var(--cyan, #00D5FF); }

.nova-ai__form { display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px 10px; border-top: 1px solid var(--line, rgba(150, 162, 189, .14)); }
.nova-ai__input {
  flex: 1; min-height: 44px; max-height: 120px; padding: 11px 14px; border-radius: 14px; border: 0; resize: none; overflow-y: hidden;
  background: rgba(245, 247, 255, .05); box-shadow: inset 0 0 0 1px var(--line, rgba(150, 162, 189, .14));
  color: var(--white, #F5F7FF); font: inherit; font-size: 15px; line-height: 1.45; transition: box-shadow .3s;
}
.nova-ai__input::placeholder { color: var(--gray, #96A2BD); }
.nova-ai__input:focus { outline: none; box-shadow: inset 0 0 0 1px var(--cyan, #00D5FF); }
.nova-ai__send { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--cyan, #00D5FF); color: var(--black, #090B13); transition: transform .3s var(--ease, ease), filter .3s; flex: none; }
.nova-ai__send svg { stroke: var(--black, #090B13); stroke-width: 2.2; }
.nova-ai__send:hover { filter: brightness(1.08); transform: translateY(-1px); }
.nova-ai__send:disabled { opacity: .45; cursor: default; transform: none; filter: none; }
[dir="rtl"] .nova-ai__send svg { transform: scaleX(-1); }

/* ---------- footer: WhatsApp handoff + disclaimer ---------- */
.nova-ai__foot { padding: 0 12px 12px; display: grid; gap: 8px; }
.nova-ai__wa {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 999px;
  background: rgba(108, 99, 255, .14); box-shadow: inset 0 0 0 1px rgba(108, 99, 255, .5); color: var(--white, #F5F7FF); font-weight: 600; font-size: 14px; text-decoration: none;
  transition: background .3s, box-shadow .3s;
}
.nova-ai__wa:hover { background: rgba(108, 99, 255, .26); box-shadow: inset 0 0 0 1px var(--violet, #6C63FF); }
.nova-ai__wa.is-pulse { animation: nova-wa 1.4s var(--ease, ease) 1; }
@keyframes nova-wa { 30% { box-shadow: inset 0 0 0 1px var(--cyan, #00D5FF), 0 0 0 6px rgba(0, 213, 255, .12); } }
.nova-ai__note { margin: 0; text-align: center; font-size: 11.5px; color: var(--gray, #96A2BD); }

/* ---------- phones ---------- */
@media (max-width: 480px) {
  .nova-ai__launcher { inset-inline-start: 14px; bottom: max(14px, env(safe-area-inset-bottom)); }
  .nova-ai__panel { inset-inline: 0; bottom: 0; width: 100%; height: min(86dvh, 680px); border-radius: 22px 22px 0 0; transform-origin: bottom center; }
  .nova-ai__msg { max-width: 92%; }
  .nova-ai__input { font-size: 16px; } /* no iOS zoom */
}

/* ---------- motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  .nova-ai__launcher, .nova-ai__panel, .nova-ai__msg, .nova-ai__wa, .nova-ai__send { transition: none; animation: none; }
  .nova-ai__launcher .nova-ai__dot, .nova-ai__typing i, .nova-ai__msg--bot.is-streaming::after { animation: none; }
  .nova-ai__log { scroll-behavior: auto; }
}
