/* Fajr AI Assistant: voice widget. Scoped under #fajr-ai so it never touches the theme. */
#fajr-ai {
  --fa-espresso: #1F1816;
  --fa-espresso-2: #2A211E;
  --fa-brown: #5E503F;
  --fa-sand: #E7D9CA;
  --fa-ivory: #FBF6EE;
  --fa-gold: #A8875A;
  --fa-gold-2: #E6D3B3;
  --fa-apricot: #C9AD82;
  --fa-ink: #FBF6EE;
  --fa-muted: rgba(251, 246, 238, .66);
  --fa-line: rgba(243, 217, 160, .18);
  --fa-ok: #7FD1A8;
  --fa-end: #E5484D;
  --fa-font: "IBM Plex Sans Arabic", "zawi", "Tajawal", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fa-bottom: 96px;
  font-family: var(--fa-font);
  position: fixed; z-index: 2147483000; bottom: var(--fa-bottom); right: 20px;
  -webkit-font-smoothing: antialiased;
}
#fajr-ai.fa-left { right: auto; left: 20px; }
#fajr-ai *, #fajr-ai *::before, #fajr-ai *::after { box-sizing: border-box; }
#fajr-ai button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; padding: 0; margin: 0; }
#fajr-ai button:focus-visible { outline: 2px solid var(--fa-gold-2); outline-offset: 3px; }

/* ---------- Launcher ---------- */
.fa-launch { display: flex; align-items: center; gap: 12px; flex-direction: row-reverse; }
#fajr-ai.fa-left .fa-launch { flex-direction: row; }
.fa-orb-btn { position: relative; width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center; isolation: isolate;
  box-shadow: 0 14px 34px -10px rgba(43, 34, 26, .65), 0 0 0 1px rgba(255, 255, 255, .06) inset; transition: transform .25s cubic-bezier(.2,.8,.2,1); }
.fa-orb-btn:hover { transform: translateY(-2px) scale(1.04); }
.fa-orb-btn::before { content: ""; position: absolute; inset: -3px; border-radius: 50%; z-index: -2;
  background: conic-gradient(from 0deg, var(--fa-gold), var(--fa-apricot), #fff3d6, var(--fa-gold), var(--fa-brown), var(--fa-gold));
  animation: fa-spin 6s linear infinite; }
.fa-orb-btn::after { content: ""; position: absolute; inset: 2px; border-radius: 50%; z-index: -1;
  background: radial-gradient(120% 120% at 30% 20%, #4A3B2D 0%, var(--fa-espresso) 60%); }
.fa-ping { position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--fa-gold); opacity: 0; animation: fa-ping 3.2s ease-out infinite; z-index: -3; }
.fa-ping.two { animation-delay: 1.6s; }
.fa-bars { display: flex; gap: 3px; align-items: center; height: 26px; }
.fa-bars i { width: 4px; border-radius: 3px; background: linear-gradient(180deg, var(--fa-gold-2), var(--fa-gold)); animation: fa-eq 1.2s ease-in-out infinite; }
.fa-bars i:nth-child(1) { height: 10px; animation-delay: -.2s } .fa-bars i:nth-child(2) { height: 20px; animation-delay: -.5s }
.fa-bars i:nth-child(3) { height: 26px; animation-delay: -.1s } .fa-bars i:nth-child(4) { height: 18px; animation-delay: -.7s }
.fa-bars i:nth-child(5) { height: 11px; animation-delay: -.35s }
.fa-ai-badge { position: absolute; top: -4px; inset-inline-start: -4px; background: var(--fa-apricot); color: var(--fa-espresso); font: 800 10px/1 var(--fa-font);
  padding: 4px 6px; border-radius: 999px; letter-spacing: .04em; box-shadow: 0 4px 10px -4px rgba(0,0,0,.4); }

.fa-pill { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 2px; padding: 10px 16px; border-radius: 16px;
  background: rgba(43, 34, 26, .92); color: var(--fa-ink); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--fa-line); box-shadow: 0 16px 34px -18px rgba(0,0,0,.7); max-width: 240px; text-align: start;
  animation: fa-pill-in .6s .8s cubic-bezier(.2,.8,.2,1) both; }
.fa-pill b { font-size: 15px; font-weight: 800; color: var(--fa-gold-2); }
.fa-pill span { font-size: 12.5px; color: var(--fa-muted); }
.fa-pill::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(243,217,160,.18) 50%, transparent 70%);
  transform: translateX(-120%); animation: fa-shine 4.5s 2s ease-in-out infinite; }
.fa-pill-x { position: absolute; top: 4px; inset-inline-end: 6px; font-size: 14px; color: var(--fa-muted); line-height: 1; padding: 2px 4px !important; }
#fajr-ai.is-open .fa-launch { opacity: 0; pointer-events: none; transform: scale(.9); }
.fa-launch { transition: opacity .25s, transform .25s; }

/* ---------- Panel ---------- */
.fa-panel { position: absolute; bottom: 0; right: 0; width: 392px; height: min(640px, calc(100vh - 130px)); border-radius: 28px; overflow: hidden;
  color: var(--fa-ink); display: flex; flex-direction: column;
  background: radial-gradient(140% 90% at 50% -10%, #5A4634 0%, var(--fa-espresso-2) 38%, var(--fa-espresso) 100%);
  box-shadow: 0 40px 80px -30px rgba(20, 14, 9, .85), 0 0 0 1px var(--fa-line) inset;
  transform-origin: bottom right; transform: translateY(16px) scale(.94); opacity: 0; pointer-events: none;
  transition: transform .45s cubic-bezier(.2,.9,.2,1), opacity .3s; }
#fajr-ai.fa-left .fa-panel { right: auto; left: 0; transform-origin: bottom left; }
#fajr-ai.is-open .fa-panel { transform: none; opacity: 1; pointer-events: auto; }
.fa-pattern { position: absolute; inset: 0; opacity: .07; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cg fill='none' stroke='%23F3D9A0' stroke-width='1'%3E%3Cpath d='M28 6l6.4 15.6L50 28l-15.6 6.4L28 50l-6.4-15.6L6 28l15.6-6.4z'/%3E%3Crect x='17' y='17' width='22' height='22' transform='rotate(45 28 28)'/%3E%3Ccircle cx='28' cy='28' r='4'/%3E%3C/g%3E%3C/svg%3E");
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 70%); mask-image: linear-gradient(180deg, #000 0%, transparent 70%); }
.fa-head { position: relative; display: flex; align-items: center; gap: 12px; padding: 18px 18px 12px; }
.fa-mark { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: linear-gradient(145deg, var(--fa-gold-2), var(--fa-gold)); color: var(--fa-espresso); box-shadow: 0 8px 18px -8px rgba(217,178,106,.7); }
.fa-title { flex: 1; min-width: 0; }
.fa-title b { display: block; font-size: 16px; font-weight: 800; }
.fa-title span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--fa-muted); }
.fa-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--fa-ok); box-shadow: 0 0 0 0 rgba(127,209,168,.6); animation: fa-live 2s infinite; }
.fa-icon-btn { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.06);
  border: 1px solid var(--fa-line) !important; color: var(--fa-ink); transition: background .2s; font-weight: 700; font-size: 12.5px; }
.fa-icon-btn:hover { background: rgba(255,255,255,.12); }

.fa-body { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; padding: 6px 22px 0; min-height: 0; }
.fa-stage { position: relative; width: 230px; height: 230px; flex: none; margin-top: 4px; }
.fa-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.fa-stage-core { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.fa-status { margin-top: 2px; font-size: 13px; letter-spacing: .02em; color: var(--fa-gold-2); font-weight: 700; min-height: 20px; text-align: center; }
.fa-timer { font-size: 12px; color: var(--fa-muted); font-variant-numeric: tabular-nums; margin-top: 2px; min-height: 16px; }

.fa-hello { text-align: center; margin-top: 4px; }
.fa-hello h3 { margin: 0 0 6px; font-size: 22px; line-height: 1.35; font-weight: 800; color: var(--fa-ivory); }
.fa-hello p { margin: 0; font-size: 14px; line-height: 1.7; color: var(--fa-muted); }
.fa-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 14px 0 4px; }
.fa-chip { padding: 8px 13px !important; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--fa-ivory) !important;
  background: rgba(243,217,160,.08) !important; border: 1px solid var(--fa-line) !important; transition: transform .2s, background .2s, border-color .2s; }
.fa-chip:hover { transform: translateY(-1px); background: rgba(243,217,160,.16) !important; border-color: rgba(243,217,160,.4) !important; }

.fa-captions { width: 100%; flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; padding: 6px 2px 10px;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 30%); mask-image: linear-gradient(180deg, transparent 0, #000 30%); }
.fa-line { font-size: 15px; line-height: 1.7; animation: fa-rise .35s ease both; }
.fa-line.agent { color: var(--fa-ivory); }
.fa-line.user { color: var(--fa-gold-2); opacity: .85; font-size: 14px; }

.fa-foot { position: relative; padding: 14px 18px 16px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.fa-cta { width: 100%; height: 56px; border-radius: 18px; display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 16.5px; font-weight: 800; color: var(--fa-espresso) !important;
  background: linear-gradient(135deg, var(--fa-gold-2) 0%, var(--fa-gold) 55%, var(--fa-apricot) 100%) !important;
  box-shadow: 0 16px 30px -14px rgba(217,178,106,.8), 0 0 0 1px rgba(255,255,255,.3) inset; position: relative; overflow: hidden; transition: transform .2s, filter .2s; }
.fa-cta:hover { transform: translateY(-1px); filter: brightness(1.04); }
.fa-cta::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,.45) 50%, transparent 65%);
  transform: translateX(-120%); animation: fa-shine 3.8s 1s ease-in-out infinite; }
.fa-cta[disabled] { opacity: .65; cursor: progress; }
.fa-controls { display: flex; align-items: center; justify-content: center; gap: 18px; width: 100%; }
.fa-ctrl { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.08) !important;
  border: 1px solid var(--fa-line) !important; color: var(--fa-ink); transition: background .2s, transform .2s; }
.fa-ctrl:hover { transform: translateY(-1px); background: rgba(255,255,255,.14) !important; }
.fa-ctrl.is-on { background: rgba(243,217,160,.22) !important; color: var(--fa-gold-2); }
.fa-ctrl.end { width: 68px; height: 68px; background: var(--fa-end) !important; border-color: transparent !important; color: #fff;
  box-shadow: 0 14px 28px -12px rgba(229,72,77,.8); }
.fa-ctrl.end:hover { background: #d63b40 !important; }
.fa-note { font-size: 11.5px; color: var(--fa-muted); text-align: center; line-height: 1.6; }
.fa-note a, .fa-wa { color: var(--fa-gold-2) !important; text-decoration: none; font-weight: 700; }
.fa-wa { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }

.fa-msg { text-align: center; margin: auto 0; padding: 0 6px; }
.fa-msg h3 { margin: 0 0 8px; font-size: 20px; font-weight: 800; color: var(--fa-ivory); }
.fa-msg p { margin: 0 0 14px; font-size: 14px; line-height: 1.7; color: var(--fa-muted); }
.fa-row { display: flex; gap: 10px; width: 100%; }
.fa-ghost { flex: 1; height: 50px; border-radius: 16px; font-weight: 800; font-size: 14.5px; background: rgba(255,255,255,.07) !important;
  border: 1px solid var(--fa-line) !important; color: var(--fa-ivory) !important; display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.fa-ghost.wa { background: #1FAF5A !important; border-color: transparent !important; color: #fff !important; }

[data-view] { display: none !important; }
#fajr-ai[data-state="idle"] [data-view~="idle"],
#fajr-ai[data-state="connecting"] [data-view~="connecting"],
#fajr-ai[data-state="live"] [data-view~="live"],
#fajr-ai[data-state="ended"] [data-view~="ended"],
#fajr-ai[data-state="blocked"] [data-view~="blocked"] { display: flex !important; }
#fajr-ai .fa-hello[data-view], #fajr-ai .fa-msg[data-view] { flex-direction: column; }

/* ---------- Phones: bottom sheet ---------- */
@media (max-width: 520px) {
  #fajr-ai { right: 14px; --fa-bottom: 86px; }
  #fajr-ai.fa-left { left: 14px; }
  .fa-pill { max-width: 190px; padding: 9px 13px; }
  .fa-pill b { font-size: 14px; }
  #fajr-ai.is-open { inset: 0; right: 0 !important; left: 0 !important; bottom: 0; }
  .fa-panel { position: fixed; inset: auto 0 0 0; width: 100%; height: min(88vh, 720px); border-radius: 28px 28px 0 0; transform-origin: bottom center; transform: translateY(40px); }
  #fajr-ai.is-open::before { content: ""; position: fixed; inset: 0; background: rgba(20,14,9,.45); backdrop-filter: blur(3px); }
  .fa-stage { width: 210px; height: 210px; }
}
@media (max-width: 520px) and (max-height: 640px) { .fa-stage { width: 170px; height: 170px; } .fa-hello h3 { font-size: 19px; } }

@keyframes fa-spin { to { transform: rotate(360deg); } }
@keyframes fa-ping { 0% { transform: scale(1); opacity: .55; } 80%, 100% { transform: scale(1.55); opacity: 0; } }
@keyframes fa-eq { 0%, 100% { transform: scaleY(.45); } 50% { transform: scaleY(1); } }
@keyframes fa-shine { 0% { transform: translateX(-120%); } 30%, 100% { transform: translateX(120%); } }
@keyframes fa-pill-in { from { opacity: 0; transform: translateX(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes fa-live { 0% { box-shadow: 0 0 0 0 rgba(127,209,168,.55); } 70% { box-shadow: 0 0 0 7px rgba(127,209,168,0); } 100% { box-shadow: 0 0 0 0 rgba(127,209,168,0); } }
@keyframes fa-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { #fajr-ai *, #fajr-ai *::before, #fajr-ai *::after { animation: none !important; transition: none !important; } }

/* polish */
#fajr-ai[data-state="idle"] .fa-note[data-view] { display: block !important; }
.fa-foot { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
#fajr-ai[data-state="live"] [data-act="lang"], #fajr-ai[data-state="connecting"] [data-act="lang"] { opacity: .35; pointer-events: none; }
@media (max-width: 520px) { .fa-pill.is-tucked { animation: none; opacity: 0; transform: translateX(10px); pointer-events: none; transition: opacity .4s, transform .4s; } }

/* match the site identity */
.fa-title b { font-family: "Amiri", var(--fa-font); font-size: 20px; font-weight: 700; letter-spacing: 0; }
.fa-hello h3, .fa-msg h3 { font-family: "Amiri", var(--fa-font); font-weight: 700; font-size: 26px; }
.fa-pill b { font-family: "Amiri", var(--fa-font); font-size: 17px; font-weight: 700; }
.fa-mark { background: transparent; color: var(--fa-gold-2); box-shadow: none; border: 1px solid var(--fa-line); width: 46px; height: 46px; border-radius: 14px; }
.fa-cta { color: #fff !important; background: linear-gradient(135deg, #C9AD82, #A8875A 55%, #7A5C38) !important; box-shadow: 0 16px 34px -16px rgba(168,135,90,.85), 0 0 0 1px rgba(255,255,255,.18) inset; }
.fa-ai-badge { background: linear-gradient(135deg, #E6D3B3, #C9AD82); }
#fajr-ai.fa-aside:not(.is-open) .fa-launch { opacity: 0; transform: translateY(14px) scale(.9); pointer-events: none; }

/* fit any panel height: the middle scrolls if needed, and the orb scales with the viewport */
.fa-body { overflow-y: auto; overflow-x: hidden; scrollbar-width: none; overscroll-behavior: contain; }
.fa-body::-webkit-scrollbar { display: none; }
.fa-stage { width: clamp(120px, 26vh, 230px); height: clamp(120px, 26vh, 230px); }
.fa-foot { flex: none; }
.fa-head { flex: none; }
@media (max-height: 760px) {
  .fa-panel { height: calc(100vh - 110px); }
  .fa-head { padding: 14px 16px 8px; }
  .fa-hello h3 { font-size: 22px; margin-bottom: 4px; }
  .fa-hello p { font-size: 13.5px; line-height: 1.6; }
  .fa-chips { margin: 10px 0 2px; gap: 6px; }
  .fa-chip { padding: 6px 11px !important; font-size: 12.5px; }
  .fa-foot { padding: 10px 16px 12px; gap: 8px; }
  .fa-cta { height: 50px; font-size: 15.5px; }
}
@media (max-height: 600px) { .fa-hello p { display: none; } .fa-stage { width: 110px; height: 110px; } }
@media (max-width: 520px) { .fa-panel { height: min(88vh, 720px); } .fa-stage { width: clamp(120px, 24vh, 210px); height: clamp(120px, 24vh, 210px); } }
@media (min-height: 860px) and (min-width: 521px) { .fa-panel { height: min(700px, calc(100vh - 130px)); } }
@media (max-height: 820px) and (min-width: 521px) { .fa-stage { width: clamp(110px, 24vh, 190px); height: clamp(110px, 24vh, 190px); } }

/* Always fit, never scroll: the orb takes only the space left after the text, chips and button. */
.fa-body { overflow: hidden !important; justify-content: flex-start; }
.fa-body > *:not(.fa-stage) { flex: none; }
#fajr-ai .fa-stage { flex: 1 1 0; min-height: 84px; max-height: 236px; height: auto !important; width: auto !important; aspect-ratio: 1 / 1; margin-top: 4px; }
#fajr-ai[data-state="live"] .fa-stage, #fajr-ai[data-state="connecting"] .fa-stage { max-height: 250px; }
#fajr-ai[data-state="live"] .fa-captions, #fajr-ai[data-state="connecting"] .fa-captions { flex: 0 1 auto; min-height: 60px; max-height: 40%; }

/* ---------- In the mobile app (?fajr_ai=app): the panel is the whole screen ---------- */
#fajr-ai.fa-app { inset: 0; bottom: 0; right: 0; }
#fajr-ai.fa-app .fa-launch { display: none; }
#fajr-ai.fa-app .fa-panel { position: fixed; inset: 0; width: auto; height: auto !important; border-radius: 0; box-shadow: none;
  transform: none; opacity: 1; pointer-events: auto; transition: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
#fajr-ai.fa-app .fa-head { padding-top: 14px; }
#fajr-ai.fa-app .fa-stage { max-height: 300px; }
#fajr-ai.fa-app[data-state="live"] .fa-stage, #fajr-ai.fa-app[data-state="connecting"] .fa-stage { max-height: 320px; }
