/* Hawa Center assistant — styles scoped to #dan-ai-root.
   Theme matches hawacenter.com: the site is light (base #fff / #faf5fb) with
   purple primary #91669a + lavender #b98cc2 and the logo's gold #c7bb8b.
   The chat panel is a dark overlay for contrast against the light page, in
   Hawa's deep purple #37103e, with lavender/gold accents.
   Radii and type follow the site (20px panels, IBM Plex Sans Arabic for AR). */
#dan-ai-root {
	--dan-accent: #91669a;          /* site primary (overridden by kb.js accent) */
	--dan-accent-2: #795082;        /* deeper purple for gradients */
	--dan-lav: #b98cc2;             /* site secondary lavender */
	--dan-gold: #c7bb8b;            /* logo gold */
	--dan-on-accent: #ffffff;
	--dan-bg: #37103e;              /* deep purple (site neutral) */
	--dan-panel: #471a51;
	--dan-panel-2: #552160;
	--dan-text: #faf5fb;
	--dan-muted: #d5b9da;
	--dan-dim: #ac80b5;
	--dan-line: rgba(255, 255, 255, .13);
	--dan-radius: 14px;
	position: fixed;
	z-index: 99990;
	bottom: 18px;
	right: 18px;
	font-family: "IBM Plex Sans Arabic", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 15px;
	color: var(--dan-text);
	direction: ltr;
}
#dan-ai-root *, #dan-ai-root *::before, #dan-ai-root *::after { box-sizing: border-box; }

/* ---------- corner placement ----------
   The site already has a floating WhatsApp button at bottom-RIGHT
   (.fixed.bottom-6.right-6). The widget's z-index is far higher, so parking
   the launcher there would COVER the WhatsApp button. The assistant is pinned
   bottom-LEFT instead, and the teaser/panel follow. In RTL they flip to the
   other corner (see the RTL block). */
#dan-ai-root { left: 18px; right: auto; }
#dan-teaser { right: auto; left: 0; }
#dan-teaser::after { right: auto; left: 22px; }
#dan-panel { right: auto; left: 0; }

/* launcher */
#dan-launcher {
	width: 58px; height: 58px;
	border: 1px solid rgba(185, 140, 194, .5);
	border-radius: 50%;
	background: linear-gradient(135deg, var(--dan-accent), var(--dan-accent-2));
	color: var(--dan-on-accent); cursor: pointer;
	display: flex; align-items: center; justify-content: center;
	box-shadow: 0 12px 32px -8px rgba(145, 102, 154, .55);
	position: relative;
	transition: transform .18s ease;
}
#dan-launcher:hover { transform: translateY(-2px); }
#dan-launcher svg { width: 27px; height: 27px; }
#dan-launcher .dan-dot {
	position: absolute; top: 3px; right: 3px;
	width: 11px; height: 11px; border-radius: 50%;
	background: #4ade80; border: 2px solid var(--dan-bg);
}
#dan-launcher.dan-pulsing::after {
	content: "";
	position: absolute; inset: -5px;
	border-radius: 50%;
	border: 2px solid var(--dan-accent);
	animation: dan-pulse 1.8s ease-out infinite;
}
@keyframes dan-pulse {
	0% { transform: scale(.85); opacity: .9; }
	100% { transform: scale(1.35); opacity: 0; }
}

/* teaser */
#dan-teaser {
	position: absolute; bottom: 68px; right: 0;
	max-width: 240px;
	background: var(--dan-panel);
	border: 1px solid var(--dan-line);
	border-radius: var(--dan-radius);
	padding: 10px 14px;
	font-size: .86rem; line-height: 1.4;
	color: var(--dan-text);
	box-shadow: 0 16px 40px -12px rgba(55, 16, 62, .5);
	cursor: pointer;
	opacity: 0; transform: translateY(6px); pointer-events: none;
	transition: opacity .3s ease, transform .3s ease;
}
#dan-teaser.dan-show { opacity: 1; transform: translateY(0); pointer-events: auto; }
#dan-teaser::after {
	content: "";
	position: absolute; bottom: -6px; right: 22px;
	width: 10px; height: 10px;
	background: var(--dan-panel);
	border-right: 1px solid var(--dan-line);
	border-bottom: 1px solid var(--dan-line);
	transform: rotate(45deg);
}

/* panel */
#dan-panel {
	position: absolute; bottom: 74px; right: 0;
	width: 366px; max-width: calc(100vw - 24px);
	height: 540px; max-height: calc(100vh - 110px);
	background: var(--dan-bg);
	border: 1px solid var(--dan-line);
	border-radius: 20px;
	display: flex; flex-direction: column;
	overflow: hidden;
	box-shadow: 0 24px 60px -16px rgba(55, 16, 62, .6);
	opacity: 0; transform: translateY(14px) scale(.98); pointer-events: none;
	transition: opacity .22s ease, transform .22s ease;
}
#dan-panel.dan-open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

/* header */
.dan-head {
	display: flex; align-items: center; gap: 10px;
	padding: 14px 16px;
	background: var(--dan-panel-2);
	border-bottom: 1px solid var(--dan-line);
}
.dan-ava {
	width: 36px; height: 36px; border-radius: 50%;
	background: linear-gradient(135deg, var(--dan-accent), var(--dan-accent-2));
	display: flex; align-items: center; justify-content: center;
	flex: 0 0 auto;
}
.dan-ava svg { width: 20px; height: 20px; }
.dan-who { flex: 1; min-width: 0; }
.dan-name { font-weight: 700; font-size: .9rem; color: #fff; }
.dan-status { font-size: .74rem; color: var(--dan-muted); }
.dan-x {
	width: 30px; height: 30px;
	background: rgba(255, 255, 255, .06);
	border: 1px solid var(--dan-line);
	border-radius: 9px;
	color: var(--dan-muted); cursor: pointer;
	font-size: .8rem; line-height: 1;
}
.dan-x:hover { color: #fff; background: rgba(255, 255, 255, .12); }

/* messages */
.dan-msgs {
	flex: 1; overflow-y: auto;
	padding: 14px 14px 6px;
	display: flex; flex-direction: column; gap: 8px;
	scrollbar-width: thin; scrollbar-color: var(--dan-panel-2) transparent;
}
.dan-msgs::-webkit-scrollbar { width: 5px; }
.dan-msgs::-webkit-scrollbar-thumb { background: var(--dan-panel-2); border-radius: 3px; }
.dan-msg { max-width: 86%; padding: 10px 13px; border-radius: 16px; font-size: .88rem; line-height: 1.6; }
.dan-msg.bot {
	align-self: flex-start;
	background: var(--dan-panel);
	border: 1px solid var(--dan-line);
	border-bottom-left-radius: 5px;
}
.dan-msg.user {
	align-self: flex-end;
	background: linear-gradient(135deg, var(--dan-accent), var(--dan-accent-2));
	color: var(--dan-on-accent);
	font-weight: 500;
	border-bottom-right-radius: 5px;
}
.dan-msg ul { margin: 6px 0 2px; padding-inline-start: 18px; }
.dan-msg li { margin: 3px 0; }
/* bold = lavender inside bot bubbles, white inside the purple user bubble */
.dan-msg b { color: var(--dan-lav); }
.dan-msg.user b { color: #fff; }

/* typing */
.dan-typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; background: var(--dan-panel); border-radius: 16px; border-bottom-left-radius: 5px; }
.dan-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--dan-dim); animation: dan-blink 1.2s infinite; }
.dan-typing i:nth-child(2) { animation-delay: .2s; }
.dan-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes dan-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* chips */
.dan-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 14px 4px; }
.dan-chip {
	background: rgba(185, 140, 194, .16);
	border: 1px solid rgba(185, 140, 194, .42);
	color: #eed1f3;
	border-radius: 999px;
	padding: 6px 12px;
	font-size: .78rem;
	cursor: pointer;
	transition: background .15s ease;
	font-family: inherit;
}
.dan-chip:hover { background: rgba(185, 140, 194, .28); }

/* input */
.dan-input { display: flex; gap: 8px; padding: 10px 14px; }
.dan-input input {
	flex: 1; min-width: 0;
	background: var(--dan-panel-2);
	border: 1px solid var(--dan-line);
	border-radius: 11px;
	padding: 11px 13px;
	color: var(--dan-text);
	font-size: .88rem;
	font-family: inherit;
	outline: none;
}
.dan-input input:focus { border-color: rgba(185, 140, 194, .65); }
.dan-input input::placeholder { color: var(--dan-dim); }
.dan-input button {
	width: 42px;
	background: linear-gradient(135deg, var(--dan-accent), var(--dan-accent-2));
	border: none; border-radius: 11px;
	color: var(--dan-on-accent); cursor: pointer;
	display: flex; align-items: center; justify-content: center;
}
.dan-input button:disabled { opacity: .55; cursor: default; }
.dan-input button svg { width: 18px; height: 18px; }

/* footer */
.dan-foot {
	padding: 8px 14px 11px;
	font-size: .68rem;
	color: var(--dan-dim);
	text-align: center;
	border-top: 1px solid var(--dan-line);
	background: var(--dan-bg);
	line-height: 1.6;
}

/* ---------- handoff card ---------- */
.dan-msg.dan-handoff {
	max-width: 94%;
	background: var(--dan-panel-2);
	border: 1px solid rgba(199, 187, 139, .45);
	padding: 14px;
}
.dan-ho-title { font-weight: 700; font-size: .9rem; color: #fff; margin-bottom: 4px; }
.dan-ho-sub { font-size: .78rem; color: var(--dan-muted); margin-bottom: 10px; }
.dan-ho-form { display: flex; flex-direction: column; gap: 4px; }
.dan-ho-form label { font-size: .72rem; color: var(--dan-dim); margin-top: 4px; }
.dan-ho-form input, .dan-ho-form textarea {
	background: var(--dan-bg);
	border: 1px solid var(--dan-line);
	border-radius: 9px;
	padding: 9px 11px;
	color: var(--dan-text);
	font-size: .84rem;
	font-family: inherit;
	outline: none;
	width: 100%;
}
.dan-ho-form textarea { min-height: 64px; resize: vertical; }
.dan-ho-form input:focus, .dan-ho-form textarea:focus { border-color: rgba(199, 187, 139, .6); }
.dan-ho-send {
	margin-top: 10px;
	background: linear-gradient(135deg, var(--dan-accent), var(--dan-accent-2));
	border: none; border-radius: 10px;
	padding: 10px;
	color: var(--dan-on-accent); font-weight: 700; font-size: .85rem;
	cursor: pointer;
	font-family: inherit;
}
.dan-ho-send:disabled { opacity: .6; cursor: default; }
.dan-ho-ok, .dan-ho-err { display: none; font-size: .8rem; margin-top: 8px; line-height: 1.5; }
.dan-ho-ok.dan-show, .dan-ho-err.dan-show { display: block; }
.dan-ho-err { color: #ff8a95; }

/* ---------- RTL (Arabic UI) ----------
   The launcher is bottom-LEFT in LTR (to leave the site's WhatsApp button
   clear). In Arabic the whole widget mirrors to the opposite corner. */
#dan-ai-root.dan-rtl { direction: rtl; left: auto; right: 18px; }
#dan-ai-root.dan-rtl #dan-panel { left: auto; right: 0; }
#dan-ai-root.dan-rtl #dan-teaser { left: auto; right: 0; }
#dan-ai-root.dan-rtl #dan-teaser::after { left: auto; right: 22px; }
#dan-ai-root.dan-rtl #dan-panel,
#dan-ai-root.dan-rtl .dan-msg,
#dan-ai-root.dan-rtl .dan-ho-form { text-align: right; }
#dan-ai-root.dan-rtl .dan-msg.bot { border-bottom-left-radius: 16px; border-bottom-right-radius: 5px; }
#dan-ai-root.dan-rtl .dan-msg.user { border-bottom-right-radius: 16px; border-bottom-left-radius: 5px; }

/* ---------- mobile ----------
   Both corners used so the launcher clears the site's WhatsApp button. */
@media (max-width: 480px) {
	#dan-ai-root { bottom: 12px; left: 12px; right: 12px; }
	#dan-ai-root.dan-rtl { left: 12px; right: 12px; }
	#dan-panel { width: 100%; left: 0; right: 0; height: calc(100vh - 96px); max-height: none; }
	#dan-teaser { max-width: 200px; }
}
