/* Pharaohms AI chat (ALF-1186) — from brand/chat (ALF-1185). Logical properties only; physical flips: send icon. */
.phm-chat {
	--c-l700: #1f3f84; --c-l800: #183167; --c-l200: #c1d0f0; --c-l50: #f5f6fa; --c-l100: #e7ebf3;
	--c-s50: #f8f7f7; --c-s100: #eeedec; --c-s200: #ddd9d4; --c-s300: #c5bfb5; --c-s600: #72695a; --c-s900: #332f29;
	--c-ok: #2a7947; --c-f600: #2e9e98; --c-w50: #fbf8f4; --c-w200: #f7debb; --c-w800: #71480e;
	font-family: "IBM Plex Sans Arabic", "IBM Plex Sans", system-ui, sans-serif;
	font-size: 15px; line-height: 24px; color: var(--c-s900);
}
.phm-chat *, .phm-chat *::before, .phm-chat *::after { box-sizing: border-box; }

/* Launcher: 12px above the 48px WhatsApp bubble (bottom 16px) = 76px, same side as WhatsApp. */
.phm-chat__launcher {
	position: fixed; z-index: 99000; inline-size: 48px; block-size: 48px; border-radius: 50%; padding: 0;
	right: var(--phm-chat-r, 16px); left: auto; inset-block-end: var(--phm-chat-b, calc(76px + env(safe-area-inset-bottom)));
	display: grid; place-items: center; border: 0; background: var(--c-l700); cursor: pointer;
	box-shadow: 0 2px 8px rgba(31, 29, 25, .28); transition: transform .2s ease, background .15s;
}
.phm-chat__launcher:hover { background: var(--c-l800); }
.phm-chat__launcher:focus-visible { outline: 3px solid #fff; box-shadow: 0 0 0 6px var(--c-l700); }
.phm-chat__dot {
	position: absolute; inset-block-start: -3px; inset-inline-end: -3px; inline-size: 14px; block-size: 14px;
	border-radius: 50%; background: var(--c-f600); border: 2px solid #fff;
}
.phm-chat__dot[hidden], .phm-chat__tip[hidden], .phm-chat [hidden] { display: none !important; }
.phm-chat__tip {
	position: fixed; z-index: 99000; right: var(--phm-chat-r, 16px); inset-block-end: calc(var(--phm-chat-b, 76px) + 60px);
	background: #fff; border: 1px solid var(--c-s200); border-radius: 10px; padding: 0 14px; block-size: 40px;
	display: flex; align-items: center; font-weight: 500; font-size: 14px; white-space: nowrap;
	box-shadow: 0 4px 14px rgba(31, 29, 25, .14); cursor: pointer;
}
.phm-chat.is-open .phm-chat__tip { display: none; }
/* hide whenever the WhatsApp bubble hides (ALF-577 scroll, sticky ATC, mobile menu open) */
.phm-chat.is-wa-hidden .phm-chat__launcher { transform: translateY(calc(100% + 100px)); }
body.phm-sticky-atc-on .phm-chat,
body.ast-main-header-nav-open .phm-chat { display: none !important; }
@media (min-width: 768px) {
	.phm-chat.is-wa-hidden .phm-chat__launcher { transform: none; }
}
@media (max-width: 767px) {
	/* ALF-1272: on a phone the WhatsApp bubble is the ONLY floating control (owner
	   review, ALF-1272 A1/A2). The chat is not removed — the drawer carries a row
	   that opens this panel (A5); on desktop the launcher is unchanged. Hiding the
	   launcher also hides its unread dot, and the tip never shows (A4). */
	.phm-chat__launcher { display: none !important; }
	.phm-chat__tip { display: none !important; } /* mobile: no caption next to any bubble */
	/* panel is full-screen: the injected WhatsApp bubble must not sit over Send, even before place() runs */
	body.phm-chat-open .qlwapp__container { display: none !important; }
	html body { padding-block-end: 88px; }
}
/* ALF-1277 V6: a fixed launcher overlaps content in every available corner
   on tablet/mobile layouts (forms, product actions, and short-page footers).
   Keep the panel reachable through the navigation drawer on phones and expose
   the floating launcher only where the desktop layout provides a safe gutter. */
@media (max-width: 1280px) {
	.phm-chat__launcher, .phm-chat__tip { display: none !important; }
}
@media (prefers-reduced-motion: reduce) { .phm-chat__launcher { transition: none; } }

/* Panel */
.phm-chat__panel {
	position: fixed; z-index: 99001; background: #fff; display: flex; flex-direction: column; overflow: hidden;
	inset: 0; border-radius: 0;
}
@media (min-width: 768px) {
	.phm-chat__panel {
		inset: auto; right: var(--phm-chat-r, 16px); inset-block-end: calc(var(--phm-chat-b, 76px) + 60px);
		inline-size: 380px; block-size: min(700px, calc(100vh - var(--phm-chat-b, 76px) - 76px)); border-radius: 16px;
		border: 1px solid var(--c-s200); box-shadow: 0 12px 40px rgba(31, 29, 25, .22);
	}
}
/* A menu entry at 768–1280 opens an intentional modal, not the old small
   floating panel over a form or product action. The close control remains in
   the panel header, and the launcher/prompt stay hidden at this range. */
@media (min-width: 768px) and (max-width: 1280px) {
	.phm-chat__panel {
		inset: 0;
		inline-size: auto;
		block-size: auto;
		border: 0;
		border-radius: 0;
	}
}
.phm-chat__head { background: var(--c-l700); color: #fff; display: flex; align-items: center; gap: 12px; padding-block: 12px; padding-inline: 16px 8px; min-block-size: 68px; flex: none; }
.phm-chat__avatar { inline-size: 40px; block-size: 40px; border-radius: 50%; background: #fff; display: grid; place-items: center; flex: none; }
.phm-chat__titles { flex: 1; min-inline-size: 0; }
.phm-chat__titles h2 { margin: 0; font-size: 16px; font-weight: 600; line-height: 22px; color: #fff; }
.phm-chat__titles p { margin: 0; font-size: 13px; line-height: 18px; color: #d3dff6; }
.phm-chat__x { inline-size: 44px; block-size: 44px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; }
.phm-chat__x:focus-visible, .phm-chat__chip:focus-visible, .phm-chat__add:focus-visible, .phm-chat__addall:focus-visible, .phm-chat__send:focus-visible, .phm-chat__wa:focus-visible, .phm-chat__more:focus-visible {
	outline: 3px solid var(--c-l700); outline-offset: 2px;
}
.phm-chat__x:focus-visible { outline-color: #fff; }
.phm-chat__list { flex: 1; overflow-y: auto; background: var(--c-s50); padding: 16px; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; }
.phm-chat__list > * { flex: none; }
.phm-chat__msg { max-inline-size: 86%; padding: 10px 14px; border-radius: 14px; overflow-wrap: anywhere; }
.phm-chat__msg--bot { background: #fff; border: 1px solid var(--c-s200); align-self: flex-start; border-start-start-radius: 4px; }
.phm-chat__msg--user { background: var(--c-l700); color: #fff; align-self: flex-end; border-start-end-radius: 4px; }
.phm-chat__typing { display: flex; gap: 5px; align-items: center; padding-block: 14px; }
.phm-chat__typing i { inline-size: 7px; block-size: 7px; border-radius: 50%; background: var(--c-s600); animation: phm-chat-dot 1s infinite ease-in-out; }
.phm-chat__typing i:nth-child(2) { animation-delay: .15s; } .phm-chat__typing i:nth-child(3) { animation-delay: .3s; }
@keyframes phm-chat-dot { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .phm-chat__typing i { animation: none; opacity: .7; } }
.phm-chat__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.phm-chat__chip { min-block-size: 40px; padding: 8px 14px; border: 1px solid var(--c-l200); border-radius: 20px; background: #fff; color: var(--c-l700); font-weight: 500; font-size: 14px; line-height: 1.3; font-family: inherit; cursor: pointer; text-align: start; }
.phm-chat__cards { background: #fff; border: 1px solid var(--c-s200); border-radius: 12px; overflow: hidden; }
.phm-chat__card { display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-block-end: 1px solid var(--c-s100); }
.phm-chat__thumb { inline-size: 48px; block-size: 48px; border-radius: 8px; background: var(--c-s100); object-fit: cover; }
.phm-chat__name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; font-weight: 500; line-height: 20px; color: var(--c-s900); text-decoration: none; }
.phm-chat__meta { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.phm-chat__sku { font: 500 12px "IBM Plex Mono", monospace; color: var(--c-s600); direction: ltr; unicode-bidi: isolate; }
.phm-chat__price { font-size: 14px; font-weight: 700; color: var(--c-l700); }
.phm-chat__stock { font-size: 12px; color: var(--c-ok); font-weight: 500; }
.phm-chat__why { font-size: 12px; line-height: 18px; color: var(--c-s600); }
.phm-chat__add { min-block-size: 40px; padding: 0 14px; border: 1.5px solid var(--c-l700); border-radius: 8px; color: var(--c-l700); background: #fff; font-weight: 600; font-size: 14px; line-height: 1; font-family: inherit; cursor: pointer; }
.phm-chat__add:disabled, .phm-chat__addall:disabled { opacity: .6; cursor: progress; }
.phm-chat__more { inline-size: 100%; min-block-size: 44px; border: 0; border-block-end: 1px solid var(--c-s100); background: #fff; color: var(--c-l700); font-weight: 600; font-size: 14px; line-height: 1; font-family: inherit; text-align: start; padding-inline: 12px; cursor: pointer; }
.phm-chat__sum { padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--c-l50); }
.phm-chat__count { font-size: 14px; color: #5b5448; }
.phm-chat__addall { min-block-size: 48px; border: 0; border-radius: 8px; background: var(--c-l700); color: #fff; font-weight: 600; font-size: 16px; line-height: 1; font-family: inherit; cursor: pointer; }
.phm-chat__note { font-size: 12px; line-height: 18px; color: var(--c-s600); padding-inline: 4px; }
.phm-chat__cartlink { align-self: flex-start; color: var(--c-l700); font-weight: 600; font-size: 14px; }
.phm-chat__unavail, .phm-chat__limit { border: 1px solid var(--c-w200); background: var(--c-w50); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 6px; color: var(--c-w800); font-size: 14px; line-height: 22px; }
.phm-chat__limit h3 { margin: 0; font-size: 15px; font-weight: 600; color: var(--c-w800); }
.phm-chat__limit p { margin: 0; color: var(--c-s900); }
.phm-chat__wa { margin-block-start: 6px; min-block-size: 48px; border-radius: 8px; background: var(--c-ok); color: #fff; font-weight: 600; font-size: 15px; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.phm-chat__wa.is-outline { background: #fff; color: var(--c-ok); border: 1.5px solid var(--c-ok); }
.phm-chat__composer { flex: none; background: #fff; border-block-start: 1px solid var(--c-s200); padding: 10px 12px; display: flex; gap: 8px; align-items: center; }
.phm-chat input.phm-chat__input { flex: 1; min-inline-size: 0; block-size: 44px; border: 1px solid var(--c-s300); border-radius: 22px; box-shadow: none; padding: 0 16px; font: inherit; font-size: 16px; color: var(--c-s900); background: #fff; }
.phm-chat button.phm-chat__send { inline-size: 44px; padding: 0; block-size: 44px; border-radius: 50%; border: 0; background: var(--c-l700); display: grid; place-items: center; flex: none; cursor: pointer; }
[dir="rtl"] .phm-chat__plane, .phm-chat[data-rtl] .phm-chat__plane { transform: scaleX(-1); }
.phm-chat__composer.is-off input.phm-chat__input { background: var(--c-s100); border-color: var(--c-s200); }
.phm-chat__composer.is-off .phm-chat__send { background: var(--c-s300); cursor: not-allowed; }
/* one focus style on the composer: the pill border changes colour, no extra outline (ALF-1199) */
.phm-chat input.phm-chat__input:focus, .phm-chat input.phm-chat__input:focus-visible { outline: none; border-color: var(--c-l700); box-shadow: 0 0 0 1px var(--c-l700); }
