/* Rawleh Assistant — chat pop-up */
.rawleh-ai {
	--ai-blue: var(--wp--preset--color--primary-dark, #0068BD);
	--ai-ink: var(--wp--preset--color--contrast, #0B1B2B);
	--ai-line: var(--wp--preset--color--line, #DCE4EE);
	--ai-surface: var(--wp--preset--color--surface, #F3F7FB);
	position: fixed;
	right: clamp(12px, 2vw, 24px);
	bottom: clamp(12px, 2vw, 24px);
	z-index: 9990;
	font-family: var(--wp--preset--font-family--body, system-ui, sans-serif);
	font-size: 15px;
	line-height: 1.5;
	color: var(--ai-ink);
}
.rawleh-ai .screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.rawleh-ai__launcher {
	display: flex; align-items: center; gap: .5rem;
	margin-left: auto;
	padding: .8rem 1.15rem .8rem .95rem;
	border: 0; border-radius: 999px;
	background: var(--ai-blue); color: #fff;
	font: 600 15px/1 var(--wp--preset--font-family--body, system-ui, sans-serif);
	box-shadow: 0 10px 30px rgba(0, 60, 120, .35);
	cursor: pointer;
	transition: transform .15s ease, background .15s ease;
}
.rawleh-ai__launcher:hover { background: var(--ai-ink); transform: translateY(-2px); }
.rawleh-ai__launcher:focus-visible { outline: 3px solid var(--wp--preset--color--primary, #0096FF); outline-offset: 3px; }
.rawleh-ai-open .rawleh-ai__launcher span { display: none; }
.rawleh-ai-open .rawleh-ai__launcher { padding: .8rem; }

.rawleh-ai__panel {
	width: min(380px, calc(100vw - 24px));
	height: min(600px, calc(100vh - 110px));
	margin-bottom: 12px;
	display: flex; flex-direction: column;
	background: #fff;
	border-radius: 18px;
	box-shadow: 0 24px 60px rgba(11, 27, 43, .28);
	overflow: hidden;
	animation: rawleh-ai-in .2s ease-out;
}
.rawleh-ai__panel[hidden] { display: none; }
@keyframes rawleh-ai-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.rawleh-ai__head {
	display: flex; align-items: center; gap: .7rem;
	padding: .85rem 1rem;
	background: linear-gradient(135deg, #0B1B2B 0%, #16293D 60%, #0068BD 100%);
	color: #fff;
	position: relative;
}
.rawleh-ai__head::after {
	content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
	background: linear-gradient(90deg, #0096FF 0 70%, #FF3131 70% 100%);
}
.rawleh-ai__head img { border-radius: 10px; background: #fff; flex: 0 0 auto; }
.rawleh-ai__head div { flex: 1; display: flex; flex-direction: column; }
.rawleh-ai__head strong { font-family: var(--wp--preset--font-family--heading, inherit); font-size: 16px; }
.rawleh-ai__head span { font-size: 12px; opacity: .85; display: flex; align-items: center; gap: .35rem; }
.rawleh-ai__head i { width: 8px; height: 8px; border-radius: 50%; background: #3ddc84; display: inline-block; }
.rawleh-ai__close { background: transparent; border: 0; color: #fff; cursor: pointer; padding: 6px; border-radius: 8px; }
.rawleh-ai__close:hover { background: rgba(255,255,255,.12); }

.rawleh-ai__log {
	flex: 1; overflow-y: auto;
	padding: 1rem;
	display: flex; flex-direction: column; gap: .6rem;
	background: var(--ai-surface);
	overscroll-behavior: contain;
}
.rawleh-ai__msg {
	max-width: 86%;
	padding: .6rem .85rem;
	border-radius: 14px;
	word-wrap: break-word;
}
.rawleh-ai__msg.is-bot { background: #fff; border: 1px solid var(--ai-line); border-bottom-left-radius: 4px; align-self: flex-start; }
.rawleh-ai__msg.is-user { background: var(--ai-blue); color: #fff; border-bottom-right-radius: 4px; align-self: flex-end; }
.rawleh-ai__msg a { color: var(--ai-blue); font-weight: 600; overflow-wrap: anywhere; }
.rawleh-ai__msg.is-user a { color: #fff; }
.rawleh-ai__msg.is-typing { color: #5B6B7F; font-style: italic; }
.rawleh-ai__cats { margin-top: .5rem; display: flex; flex-wrap: wrap; gap: .35rem; }
.rawleh-ai__cats span { width: 100%; font-size: 12px; color: #5B6B7F; }
.rawleh-ai__cats a {
	font-size: 13px; font-weight: 600; text-decoration: none; word-break: normal;
	padding: .25rem .6rem; border-radius: 999px;
	background: #E6F4FF; color: var(--ai-blue);
}

.rawleh-ai__chips { display: flex; flex-wrap: wrap; gap: .4rem; padding: .6rem 1rem 0; background: var(--ai-surface); }
.rawleh-ai__chips[hidden] { display: none; }
.rawleh-ai__chip {
	border: 1px solid var(--ai-blue); background: #fff; color: var(--ai-blue);
	border-radius: 999px; padding: .35rem .75rem; font: 600 13px/1.2 inherit; cursor: pointer;
}
.rawleh-ai__chip:hover { background: var(--ai-blue); color: #fff; }

.rawleh-ai__actions { display: flex; gap: .4rem; padding: .6rem 1rem; background: var(--ai-surface); overflow-x: auto; }
.rawleh-ai__btn {
	flex: 0 0 auto;
	font-size: 13px; font-weight: 600; text-decoration: none;
	padding: .4rem .75rem; border-radius: 999px;
	border: 1px solid var(--ai-line); background: #fff; color: var(--ai-ink);
}
.rawleh-ai__btn.is-primary { background: #C81E1E; border-color: #C81E1E; color: #fff; }
.rawleh-ai__btn.is-wa { background: #128C4A; border-color: #128C4A; color: #fff; }
.rawleh-ai__btn:hover { filter: brightness(.92); }

.rawleh-ai__form { display: flex; gap: .5rem; padding: .7rem 1rem; border-top: 1px solid var(--ai-line); background: #fff; }
.rawleh-ai__form input {
	flex: 1; min-width: 0;
	border: 1px solid var(--ai-line); border-radius: 999px;
	padding: .6rem .95rem; font: 15px/1.2 inherit; color: var(--ai-ink);
}
.rawleh-ai__form input:focus { outline: 2px solid var(--wp--preset--color--primary, #0096FF); outline-offset: 1px; border-color: transparent; }
.rawleh-ai__form button {
	width: 42px; height: 42px; flex: 0 0 auto;
	border: 0; border-radius: 50%; background: var(--ai-blue); color: #fff; cursor: pointer;
	display: grid; place-items: center;
}
.rawleh-ai__form button:hover { background: var(--ai-ink); }
.rawleh-ai__note { margin: 0; padding: 0 1rem .65rem; font-size: 11px; color: #5B6B7F; background: #fff; }

@media (max-width: 480px) {
	.rawleh-ai-open .rawleh-ai { left: 8px; right: 8px; bottom: 8px; }
	.rawleh-ai-open .rawleh-ai__panel { width: 100%; height: calc(100vh - 90px); height: calc(100dvh - 90px); }
}
@media (prefers-reduced-motion: reduce) {
	.rawleh-ai__panel { animation: none; }
}
