/* =========================================================
   EMAD — Saudi robot assistant
   ========================================================= */
.bot { position: fixed; z-index: 70; bottom: 14px; inset-inline-end: 14px; display: flex; flex-direction: column; align-items: flex-end; pointer-events: none; }
html[dir="rtl"] .bot { align-items: flex-start; }
.bot > * { pointer-events: auto; }
.bot__robot { position: relative; width: 132px; height: 172px; padding: 0; border: 0; background: none; cursor: pointer; filter: drop-shadow(0 18px 30px rgba(0,0,0,.45)); touch-action: manipulation; transition: transform .5s var(--ease, cubic-bezier(.22,1,.36,1)); }
.bot__robot:hover { transform: translateY(-4px) scale(1.03); }
.bot__robot:focus-visible { outline: 2px solid #19b5f0; outline-offset: 4px; border-radius: 24px; }
.bot__robot svg { width: 100%; height: 100%; overflow: visible; }
.bot.is-hidden .bot__robot, .bot.is-hidden .bot__bubble { display: none; }

/* robot parts motion */
.r-float { animation: rFloat 3.6s ease-in-out infinite; transform-origin: 100px 200px; }
.r-shadow { animation: rShadow 3.6s ease-in-out infinite; transform-origin: 100px 252px; transform-box: view-box; }
@keyframes rFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes rShadow { 0%,100% { transform: scaleX(1); opacity: .45; } 50% { transform: scaleX(.78); opacity: .25; } }
.r-head { transform-origin: 100px 130px; transform-box: view-box; transition: transform .6s cubic-bezier(.34,1.56,.64,1); }
.r-arm-wave { transform-origin: 154px 150px; transform-box: view-box; }
.bot.is-waving .r-arm-wave { animation: rWave 1.6s ease-in-out 1; }
@keyframes rWave { 0%,100% { transform: rotate(0); } 15% { transform: rotate(-24deg); } 30% { transform: rotate(14deg); } 45% { transform: rotate(-24deg); } 60% { transform: rotate(14deg); } 75% { transform: rotate(-10deg); } }
.r-arm-rest { transform-origin: 46px 150px; transform-box: view-box; animation: rSway 3.6s ease-in-out infinite; }
@keyframes rSway { 0%,100% { transform: rotate(0); } 50% { transform: rotate(5deg); } }
.r-drape { transform-origin: 100px 40px; transform-box: view-box; animation: rCloth 3.6s ease-in-out infinite; }
@keyframes rCloth { 0%,100% { transform: skewX(0); } 50% { transform: skewX(-1.6deg); } }
.r-eyes { transition: transform .25s ease-out; }
.r-eye { transform-box: fill-box; transform-origin: center; }
.bot.is-blink .r-eye { transform: scaleY(.1); }
.r-eye { transition: transform .09s; }
.r-mouth { opacity: 0; transition: opacity .2s; }
.bot.is-talking .r-mouth { opacity: 1; animation: rTalk .28s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes rTalk { from { transform: scaleY(.3); } to { transform: scaleY(1.2); } }
.r-ear { animation: rEar 2.4s ease-in-out infinite; }
@keyframes rEar { 0%,100% { opacity: .55; } 50% { opacity: 1; } }
.r-glow { animation: rGlow 2.4s ease-in-out infinite; }
@keyframes rGlow { 0%,100% { opacity: .35; } 50% { opacity: .8; } }

/* speech bubble */
.bot__bubble { position: relative; margin-bottom: -18px; margin-inline-end: 96px; padding: 12px 40px 12px 18px; border-radius: 18px 18px 4px 18px; background: #ffd84d; color: #13132b; font-weight: 700; font-size: 15px; box-shadow: 0 14px 30px -12px rgba(0,0,0,.6); white-space: nowrap; cursor: pointer; opacity: 0; transform: translateY(10px) scale(.9); transform-origin: 100% 100%; transition: opacity .35s, transform .5s cubic-bezier(.34,1.56,.64,1); }
html[dir="rtl"] .bot__bubble { padding: 12px 18px 12px 40px; border-radius: 18px 18px 18px 4px; transform-origin: 0 100%; margin-inline-end: 0; margin-inline-start: 96px; }
.bot__bubble.is-on { opacity: 1; transform: none; }
.bot__bubble-x { position: absolute; top: 50%; inset-inline-end: 8px; width: 26px; height: 26px; margin-top: -13px; border-radius: 50%; border: 0; background: rgba(0,0,0,.08); color: #13132b; font-size: 16px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.bot__bubble-x:hover { background: rgba(0,0,0,.16); }

/* minimized launcher */
.bot__mini { display: none; width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer; background: linear-gradient(135deg, #19b5f0, #1475bc 60%, #2a2d7c); box-shadow: 0 12px 30px -8px rgba(25,181,240,.7); place-items: center; }
.bot__mini svg { width: 40px; height: 40px; }
.bot.is-hidden .bot__mini { display: grid; }
.bot__hide { position: absolute; top: -4px; inset-inline-end: -2px; width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); background: rgba(8,10,34,.85); color: #fff; font-size: 14px; display: grid; place-items: center; cursor: pointer; opacity: 0; transition: opacity .3s; z-index: 2; }
.bot:hover .bot__hide, .bot__hide:focus-visible { opacity: 1; }
.bot.is-hidden .bot__hide, .bot.is-open .bot__hide, .bot.is-open .bot__bubble { display: none; }

/* chat panel */
.chat { position: fixed; z-index: 71; bottom: 196px; inset-inline-end: 18px; width: min(390px, calc(100vw - 24px)); height: min(560px, calc(100svh - 230px)); display: flex; flex-direction: column; border-radius: 26px; overflow: hidden;
  background: linear-gradient(170deg, rgba(20,30,80,.92), rgba(7,9,30,.96)); border: 1px solid rgba(160,175,255,.2); backdrop-filter: blur(22px) saturate(1.3); -webkit-backdrop-filter: blur(22px) saturate(1.3);
  box-shadow: 0 40px 90px -20px rgba(0,0,0,.8), 0 0 0 1px rgba(25,181,240,.08) inset;
  opacity: 0; transform: translateY(24px) scale(.94); transform-origin: 100% 100%; pointer-events: none; visibility: hidden; transition: opacity .35s, transform .55s cubic-bezier(.22,1,.36,1), visibility 0s .55s; }
html[dir="rtl"] .chat { transform-origin: 0 100%; }
.chat.is-open { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition: opacity .35s, transform .55s cubic-bezier(.22,1,.36,1), visibility 0s; }
.chat__head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; border-bottom: 1px solid rgba(160,175,255,.14); background: linear-gradient(110deg, rgba(25,181,240,.18), rgba(20,117,188,.08) 60%, transparent); }
.chat__ava { width: 44px; height: 44px; border-radius: 14px; background: #eaf2ff; display: grid; place-items: center; overflow: hidden; flex: none; }
.chat__ava svg { width: 54px; height: 54px; margin-top: 10px; }
.chat__who b { display: block; font-size: 16px; color: #fff; }
.chat__who span { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: #9fe8c4; }
.chat__who span::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #3ddc97; box-shadow: 0 0 0 3px rgba(61,220,151,.2); }
.chat__x { margin-inline-start: auto; width: 40px; height: 40px; border-radius: 12px; border: 1px solid rgba(160,175,255,.18); background: rgba(255,255,255,.04); color: #fff; cursor: pointer; display: grid; place-items: center; }
.chat__x:hover { background: rgba(255,255,255,.1); }
.chat__x svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }
.chat__log { flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; overscroll-behavior: contain; }
.chat__log::-webkit-scrollbar { width: 6px; } .chat__log::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 6px; }
.msg-b, .msg-u { max-width: 86%; padding: 11px 14px; border-radius: 18px; font-size: 14.5px; line-height: 1.6; white-space: pre-line; animation: msgIn .45s cubic-bezier(.22,1,.36,1); overflow-wrap: anywhere; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.msg-b { align-self: flex-start; background: rgba(255,255,255,.07); border: 1px solid rgba(160,175,255,.14); color: #eef1ff; border-end-start-radius: 6px; }
.msg-u { align-self: flex-end; background: linear-gradient(120deg, #19b5f0, #1475bc); color: #fff; border-end-end-radius: 6px; }
.msg-b a { color: #7fd8ff; text-decoration: underline; text-underline-offset: 3px; }
.msg-b.is-guard { border-color: rgba(210,87,122,.45); background: rgba(210,87,122,.1); }
.msg-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.msg-acts a { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 999px; background: #fff; color: #10153a; text-decoration: none; font-weight: 700; font-size: 13px; }
.msg-acts a.wa { background: #19a35a; color: #fff; }
.typing { align-self: flex-start; display: inline-flex; gap: 5px; padding: 14px 16px; border-radius: 18px; background: rgba(255,255,255,.07); border: 1px solid rgba(160,175,255,.14); }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: #9fb3ff; animation: dot 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%,60%,100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
.chat__chips { display: flex; gap: 6px; padding: 8px 12px; overflow-x: auto; scrollbar-width: none; }
.chat__chips::-webkit-scrollbar { display: none; }
.chat__chips button { flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(25,181,240,.4); background: rgba(25,181,240,.08); color: #dff4ff; font-size: 13px; font-weight: 600; cursor: pointer; transition: background-color .2s; }
.chat__chips button:hover { background: rgba(25,181,240,.22); }
.chat__form { display: flex; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid rgba(160,175,255,.12); }
.chat__form input { flex: 1; min-width: 0; min-height: 46px; padding: 0 16px; border-radius: 999px; border: 1px solid rgba(160,175,255,.2); background: rgba(5,6,26,.6); color: #fff; font: inherit; font-size: 16px; }
.chat__form input:focus { outline: none; border-color: #19b5f0; box-shadow: 0 0 0 3px rgba(25,181,240,.18); }
.chat__send { width: 46px; height: 46px; flex: none; border-radius: 50%; border: 0; background: linear-gradient(120deg, #19b5f0, #1475bc); color: #fff; cursor: pointer; display: grid; place-items: center; }
.chat__send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
html[dir="rtl"] .chat__send svg { transform: scaleX(-1); }
.chat__note { margin: 0; padding: 0 16px 10px; font-size: 11px; color: #8e97c4; text-align: center; }
.lead { display: grid; gap: 8px; margin-top: 10px; }
.lead input, .lead textarea { width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 12px; border: 1px solid rgba(160,175,255,.22); background: rgba(5,6,26,.55); color: #fff; font: inherit; font-size: 15px; }
.lead textarea { min-height: 70px; resize: vertical; }
.lead button { min-height: 40px; border-radius: 999px; border: 0; background: #fff; color: #10153a; font-weight: 700; cursor: pointer; }
.lead button:disabled { opacity: .5; }

@media (max-width: 720px) {
  .bot__robot { width: 96px; height: 126px; }
  .bot__bubble { font-size: 13px; margin-inline-end: 64px; }
  html[dir="rtl"] .bot__bubble { margin-inline-start: 64px; }
  .chat { inset-inline: 8px; bottom: 8px; width: auto; height: min(78svh, 620px); border-radius: 22px; }
  .bot.is-open .bot__robot { opacity: 0; pointer-events: none; }
}
@media (prefers-reduced-motion: reduce) {
  .r-float, .r-shadow, .r-arm-rest, .r-drape, .r-ear, .r-glow { animation: none !important; }
  .bot.is-waving .r-arm-wave { animation: none; }
}

/* ---- v2 Saudi robot (thobe + bisht + shemagh) pivots ---- */
.bot__robot { width: 140px; height: 190px; }
.r-float { transform-origin: 110px 220px; transform-box: view-box; }
.r-shadow { transform-origin: 110px 288px; }
.r-head { transform-origin: 110px 150px; }
.r-arm-wave { transform-origin: 152px 170px; }
.r-arm-rest { transform-origin: 70px 164px; }
.r-drape { transform-origin: 110px 90px; }
.bot.is-talking .r-smile { opacity: 0; }
.r-smile { transition: opacity .2s; }
.chat__ava { background: radial-gradient(circle at 50% 35%, #ffffff, #dfe7f5); }
.chat__ava svg { width: 44px; height: 44px; margin: 0; }
.bot__mini svg { width: 48px; height: 48px; }
.bot__bubble { margin-inline-end: 104px; }
html[dir="rtl"] .bot__bubble { margin-inline-start: 104px; }
@media (max-width: 720px) { .bot__robot { width: 100px; height: 136px; } }
