/* WhatsApp-style chat with the AI version of Osama — on every page of the main site. */
.wa-fab { position: fixed; z-index: 60; bottom: 22px; inset-inline-end: 22px; width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); box-shadow: 0 12px 32px rgba(0,0,0,.35), 0 0 0 0 var(--accent-glow); display: grid; place-items: center;
  transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s; animation: waPulse 3.2s ease-in-out 2s 3; }
.wa-fab:hover { transform: scale(1.06); }
.wa-fab svg { width: 28px; height: 28px; }
.wa-fab img { position: absolute; inset-inline-start: -4px; top: -4px; width: 26px; height: 26px; border-radius: 50%; object-fit: cover; border: 2px solid var(--bg); }
.wa-fab .on { position: absolute; inset-inline-end: 2px; bottom: 2px; width: 14px; height: 14px; border-radius: 50%; background: #3ddc84; border: 2.5px solid var(--accent); }
@keyframes waPulse { 50% { box-shadow: 0 12px 32px rgba(0,0,0,.35), 0 0 0 14px transparent; } 0%, 100% { box-shadow: 0 12px 32px rgba(0,0,0,.35), 0 0 0 0 var(--accent-glow); } }
.wa-open .wa-fab { transform: scale(.85); opacity: 0; pointer-events: none; }

/* the notification that slides in, like a real message arriving */
.wa-toast { position: fixed; z-index: 61; bottom: 96px; inset-inline-end: 22px; width: min(340px, calc(100vw - 32px)); display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px;
  border-radius: 18px; background: var(--surface-glass); -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4); border: 1px solid var(--line-strong);
  box-shadow: 0 18px 50px rgba(0,0,0,.35); cursor: pointer; animation: waToast .55s cubic-bezier(.16,1,.3,1); text-align: start; color: var(--text); font: inherit; }
@keyframes waToast { from { transform: translateY(16px) scale(.96); } }
.wa-toast img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; }
.wa-toast b { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.wa-toast b small { font-weight: 400; font-size: 11.5px; color: var(--text-3); }
.wa-toast span { display: block; margin-top: 2px; font-size: 14px; line-height: 1.5; color: var(--text-2); }
.wa-toast .x { position: absolute; top: -8px; inset-inline-start: -8px; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2); cursor: pointer; font-size: 13px; line-height: 1; }

/* the chat window */
.wa { position: fixed; z-index: 62; bottom: 22px; inset-inline-end: 22px; width: 400px; height: min(660px, calc(100dvh - 44px)); display: flex; flex-direction: column;
  border-radius: 24px; overflow: hidden; background: var(--bg); border: 1px solid var(--line-strong); box-shadow: 0 30px 80px rgba(0,0,0,.5);
  transform-origin: bottom right; animation: waIn .4s cubic-bezier(.16,1,.3,1); color: var(--text); }
html[dir="rtl"] .wa { transform-origin: bottom left; }
@keyframes waIn { from { transform: translateY(20px) scale(.94); } }
.wa[hidden] { display: none !important; }
.wa-head { display: flex; align-items: center; gap: 11px; padding: 12px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.wa-head img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--accent); }
.wa-who { flex: 1; min-width: 0; line-height: 1.3; }
.wa-who b { display: block; font-size: 15.5px; }
.wa-who small { display: block; font-size: 12px; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-who small.t { color: var(--text-2); }
.wa-head button { width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent; color: var(--text-2); cursor: pointer; font-size: 20px; line-height: 1; }
.wa-head button:hover { background: var(--raised); }

.wa-body { flex: 1; overflow-y: auto; padding: 16px 12px 8px; display: flex; flex-direction: column; gap: 4px; overscroll-behavior: contain;
  background-image: radial-gradient(var(--dot, rgba(91,207,165,.10)) 1px, transparent 1.4px); background-size: 18px 18px; }
.wa-day { align-self: center; margin: 2px 0 10px; padding: 4px 12px; border-radius: 8px; background: var(--surface); font-size: 11.5px; color: var(--text-3); }
.wa-note { align-self: center; max-width: 88%; margin-bottom: 10px; padding: 7px 12px; border-radius: 10px; background: rgba(196,151,59,.12); color: var(--second); font-size: 12px; line-height: 1.5; text-align: center; }
.wa-m { position: relative; max-width: 84%; padding: 7px 11px 6px; border-radius: 14px; font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; animation: waM .3s cubic-bezier(.16,1,.3,1); }
@keyframes waM { from { transform: translateY(6px) scale(.98); } }
.wa-m.os { align-self: flex-start; background: var(--surface); border-start-start-radius: 4px; }
.wa-m.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-start-end-radius: 4px; }
.wa-m.os + .wa-m.me, .wa-m.me + .wa-m.os, .wa-card + .wa-m.me { margin-top: 8px; }
.wa-meta { float: inline-end; margin-inline-start: 10px; margin-top: 6px; font-size: 10.5px; line-height: 1; opacity: .65; white-space: nowrap; direction: ltr; }
.wa-m.me .tk { margin-inline-start: 3px; letter-spacing: -3px; }
.wa-m.me .tk.read { color: #0b5ed7; opacity: 1; }
html[data-theme="dark"] .wa-m.me .tk.read { color: #0b3d91; }
.wa-typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 12px 14px; border-radius: 14px; border-start-start-radius: 4px; background: var(--surface); }
.wa-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: waDot 1.1s ease-in-out infinite; }
.wa-typing i:nth-child(2) { animation-delay: .15s; } .wa-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes waDot { 50% { transform: translateY(-3px); opacity: .4; } }

/* rich cards ("attachments") */
.wa-card { align-self: flex-start; width: 82%; max-width: 300px; margin-top: 2px; border-radius: 14px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); animation: waM .35s cubic-bezier(.16,1,.3,1); text-decoration: none; color: inherit; display: block; }
.wa-card .ph { position: relative; aspect-ratio: 16/9; background: var(--raised); overflow: hidden; }
.wa-card .ph img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.wa-card .ph iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.wa-card .play { position: absolute; inset: 0; margin: auto; width: 54px; height: 54px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 20px; cursor: pointer; display: grid; place-items: center; }
.wa-card .bd { padding: 10px 12px 12px; }
.wa-card .bd b { display: flex; justify-content: space-between; gap: 8px; font-size: 14.5px; line-height: 1.4; }
.wa-card .bd b em { flex: none; font-style: normal; font-size: 11.5px; color: var(--accent); font-weight: 600; }
.wa-card .bd p { margin: 4px 0 0; font-size: 13px; line-height: 1.5; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wa-card .bd small { display: block; margin-top: 6px; font-size: 11.5px; color: var(--text-3); direction: ltr; text-align: start; }
.wa-card .nums { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 8px; text-align: center; }
.wa-card .nums b { display: block; font-size: 17px; color: var(--accent); direction: ltr; }
.wa-card .nums span { font-size: 11px; color: var(--text-3); }
.wa-card.contact { display: flex; align-items: center; gap: 12px; padding: 12px; }
.wa-card.contact .ic { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.wa-card.contact b { display: block; font-size: 14.5px; } .wa-card.contact small { font-size: 12px; color: var(--text-3); }

/* the hand-off to the real Osama */
.wa-intro { align-self: stretch; margin: 8px 0 4px; padding: 14px; border-radius: 16px; border: 1px solid var(--accent); background: var(--surface); animation: waM .35s; }
.wa-intro p { margin: 0; font-size: 14px; line-height: 1.55; }
.wa-intro form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.wa-intro input, .wa-intro textarea { width: 100%; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--text); font: inherit; font-size: 14px; outline: none; resize: none; box-sizing: border-box; }
.wa-intro input:focus, .wa-intro textarea:focus { border-color: var(--accent); }
.wa-intro .row { display: flex; gap: 8px; }
.wa-intro button { height: 36px; padding: 0 14px; border-radius: 999px; border: 0; cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 600; }
.wa-intro .yes { background: var(--accent); color: var(--accent-ink); }
.wa-intro .no { background: transparent; border: 1px solid var(--line-strong); color: var(--text-2); }
.wa-intro small { font-size: 11.5px; color: var(--text-3); }

.wa-quick { display: flex; gap: 6px; padding: 6px 12px 2px; overflow-x: auto; scrollbar-width: none; }
.wa-quick button { flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--accent); background: var(--bg); color: var(--accent); cursor: pointer; font: inherit; font-size: 13px; white-space: nowrap; }
.wa-quick button:hover { background: var(--accent-soft); }
.wa-foot { display: flex; gap: 8px; padding: 10px 10px 12px; background: var(--bg); }
.wa-foot input { flex: 1; min-width: 0; height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 15px; outline: none; }
.wa-foot input:focus { border-color: var(--accent); }
.wa-foot button { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); cursor: pointer; display: grid; place-items: center; }
.wa-foot button svg { width: 20px; height: 20px; }
html[dir="rtl"] .wa-foot button svg { transform: scaleX(-1); }
.wa-foot button:disabled { opacity: .5; }

@media (max-width: 560px) {
  .wa { inset: 0; width: auto; height: 100dvh; border-radius: 0; border: 0; }
  .wa-fab { bottom: 16px; inset-inline-end: 16px; }
  .wa-toast { bottom: 86px; inset-inline-end: 16px; }
}
@media (prefers-reduced-motion: reduce) { .wa, .wa-toast, .wa-m, .wa-card, .wa-fab { animation: none; } }
/* messages and cards never shrink in the scrolling column (otherwise cards collapse to a thin line) */
.wa-body > * { flex-shrink: 0; }
.wa-card.photo { position: relative; padding: 4px; }
.wa-card.photo img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 11px; }
.wa-card.photo .cap { position: absolute; inset-inline: 12px; bottom: 10px; color: #fff; font-size: 13px; text-shadow: 0 1px 8px rgba(0,0,0,.7); }
.wa-head .wa-new svg { width: 18px; height: 18px; }
/* the floating chat lives in the AI (digital Osama) view only */
html:not([data-view="agent"]) .wa-fab, html:not([data-view="agent"]) .wa-toast { display: none !important; }

/* ---------- the chat as a room: a big window, his face beside the conversation ---------- */
.wa-scrim { position: fixed; inset: 0; z-index: 61; background: rgba(4, 8, 12, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: waFade .3s ease-out; }
.wa-scrim[hidden] { display: none; }
@keyframes waFade { from { opacity: 0; } }
.wa { inset: 0; margin: auto; width: min(1240px, calc(100vw - 64px)); height: min(860px, calc(100dvh - 64px)); border-radius: 28px;
  display: grid; grid-template-columns: 340px minmax(0, 1fr); transform-origin: 50% 50%; animation: waRoom .5s cubic-bezier(.16,1,.3,1); }
html[dir="rtl"] .wa { transform-origin: 50% 50%; }
@keyframes waRoom { from { transform: translateY(24px) scale(.97); opacity: 0; } }
.wa-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.wa-head { padding: 14px 22px; }
.wa-body { padding: 22px max(22px, calc((100% - 780px) / 2)) 10px; gap: 6px; }
.wa-m { font-size: 16px; line-height: 1.65; max-width: 78%; padding: 9px 14px 7px; }
.wa-card { max-width: 340px; }
.wa-quick { padding: 8px max(22px, calc((100% - 780px) / 2)) 2px; flex-wrap: wrap; }
.wa-quick button { font-size: 14px; padding: 8px 14px; }
.wa-foot { padding: 12px max(22px, calc((100% - 780px) / 2)) 18px; }
.wa-foot input { height: 52px; font-size: 16px; }
.wa-foot button { width: 52px; height: 52px; }

.wa-side { display: flex; flex-direction: column; gap: 14px; padding: 26px 24px; background: var(--surface); border-inline-end: 1px solid var(--line); overflow-y: auto; }
.wa-face { position: relative; margin: 0; aspect-ratio: 1; border-radius: 22px; overflow: hidden; background: var(--raised); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent); }
.wa-face img, .wa-face canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.wa-face canvas { clip-path: inset(0 0 0 50%); animation: waCopy 9s cubic-bezier(.16,1,.3,1) infinite; }
.wa-scan { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: var(--accent); box-shadow: 0 0 16px 2px var(--accent); animation: waLine 9s cubic-bezier(.16,1,.3,1) infinite; }
@keyframes waCopy { 0%, 8% { clip-path: inset(0 0 0 100%); } 46%, 62% { clip-path: inset(0 0 0 0); } 92%, 100% { clip-path: inset(0 0 0 100%); } }
@keyframes waLine { 0%, 8% { left: 100%; opacity: 0; } 12% { opacity: 1; } 46% { left: 0; opacity: 1; } 50%, 62% { left: 0; opacity: 0; } 66% { left: 0; opacity: 1; } 92% { left: 100%; opacity: 1; } 96%, 100% { left: 100%; opacity: 0; } }
.wa-tag { position: absolute; top: 12px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.wa-tag.r { left: 12px; background: rgba(0,0,0,.45); color: #fff; }
.wa-tag.d { right: 12px; background: var(--accent-soft); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.wa-s-k { margin-top: 4px; font-size: 13.5px; color: var(--accent); font-weight: 600; }
.wa-s-n { margin-top: -10px; font-size: 24px; line-height: 1.3; }
.wa-s-now { display: flex; gap: 10px; align-items: center; margin: 4px 0 0; padding: 12px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); font-size: 13.5px; line-height: 1.55; color: var(--text-2); }
.wa-s-now img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; }
.wa-s-now b { color: var(--text); font-weight: 600; }
.wa-s-f { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 10px; }
.wa-s-f li { position: relative; padding-inline-start: 20px; font-size: 14px; line-height: 1.6; color: var(--text-2); }
.wa-s-f li::before { content: ""; position: absolute; inset-inline-start: 0; top: .55em; width: 8px; height: 8px; border-radius: 3px; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

@media (max-width: 900px) {
  .wa { grid-template-columns: minmax(0, 1fr); width: calc(100vw - 24px); height: calc(100dvh - 24px); border-radius: 22px; }
  .wa-side { display: none; }
}
@media (max-width: 560px) {
  .wa { inset: 0; margin: 0; width: auto; height: 100dvh; border-radius: 0; border: 0; }
  .wa-scrim { display: none; }
  .wa-body, .wa-quick, .wa-foot { padding-inline: 12px; }
  .wa-m { font-size: 15px; max-width: 86%; }
  .wa-quick { flex-wrap: nowrap; }
}
@media (prefers-reduced-motion: reduce) { .wa-face canvas, .wa-scan, .wa-scrim { animation: none; } }
