/* RanchOS chat window. Colors fall back to neutral values; themes set the
   custom properties on :root to match their palette. */
.ranchos-chat {
	--ranchos-chat-accent: var(--wp--preset--color--primary, #2f5d3a);
	--ranchos-chat-accent-text: #fff;
	--ranchos-chat-bg: #fff;
	--ranchos-chat-text: #1f2a24;
	--ranchos-chat-muted: #6b7570;
	--ranchos-chat-bubble: #f1f3f2;
	--ranchos-chat-radius: 14px;
	--ranchos-chat-font: var(--wp--preset--font-family--body, system-ui, -apple-system, "Segoe UI", sans-serif);
	position: fixed;
	right: 16px;
	bottom: 16px;
	z-index: 9000;
	font-family: var(--ranchos-chat-font);
	font-size: 15px;
	line-height: 1.45;
	color: var(--ranchos-chat-text);
}
.ranchos-chat__launch {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 18px;
	border: 0;
	border-radius: 999px;
	background: var(--ranchos-chat-accent);
	color: var(--ranchos-chat-accent-text);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
.ranchos-chat__launch:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 5px var(--ranchos-chat-accent); }
.ranchos-chat__launch-icon {
	width: 18px;
	height: 18px;
	border: 2px solid currentColor;
	border-radius: 9px 9px 9px 2px;
	box-sizing: border-box;
}
.ranchos-chat.is-open .ranchos-chat__launch { display: none; }
.ranchos-chat__panel {
	position: absolute;
	right: 0;
	bottom: 0;
	width: min(380px, calc(100vw - 32px));
	max-height: min(640px, calc(100vh - 32px));
	display: flex;
	flex-direction: column;
	background: var(--ranchos-chat-bg);
	border-radius: var(--ranchos-chat-radius);
	box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
	overflow: hidden;
}
.ranchos-chat__panel[hidden] { display: none; }
.ranchos-chat__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 16px;
	background: var(--ranchos-chat-accent);
	color: var(--ranchos-chat-accent-text);
}
.ranchos-chat__close {
	border: 0;
	background: transparent;
	color: inherit;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
}
.ranchos-chat__log {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	min-height: 220px;
}
.ranchos-chat__msg {
	max-width: 88%;
	padding: 10px 14px;
	border-radius: var(--ranchos-chat-radius);
	background: var(--ranchos-chat-bubble);
}
.ranchos-chat__msg p { margin: 0; }
.ranchos-chat__msg p + p { margin-top: 8px; }
.ranchos-chat__msg--me {
	align-self: flex-end;
	background: var(--ranchos-chat-accent);
	color: var(--ranchos-chat-accent-text);
	border-bottom-right-radius: 4px;
}
.ranchos-chat__msg--bot { align-self: flex-start; border-bottom-left-radius: 4px; }
.ranchos-chat__typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.ranchos-chat__typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--ranchos-chat-muted);
	animation: ranchos-chat-dot 1.2s infinite ease-in-out;
}
.ranchos-chat__typing span:nth-child(2) { animation-delay: .2s; }
.ranchos-chat__typing span:nth-child(3) { animation-delay: .4s; }
@keyframes ranchos-chat-dot { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ranchos-chat__typing span { animation: none; opacity: .6; } }
.ranchos-chat__cards { display: flex; flex-direction: column; gap: 8px; align-self: stretch; }
.ranchos-chat__card {
	display: flex;
	gap: 10px;
	align-items: center;
	padding: 8px;
	border: 1px solid #e3e6e4;
	border-radius: 10px;
	text-decoration: none;
	color: inherit;
	background: var(--ranchos-chat-bg);
}
.ranchos-chat__card:hover, .ranchos-chat__card:focus-visible { border-color: var(--ranchos-chat-accent); }
.ranchos-chat__card img { width: 72px; height: 54px; object-fit: cover; border-radius: 6px; flex: 0 0 auto; }
.ranchos-chat__card-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ranchos-chat__card-body strong { font-size: 14px; }
.ranchos-chat__card-meta { font-size: 13px; color: var(--ranchos-chat-muted); }
.ranchos-chat__form {
	display: flex;
	gap: 8px;
	align-items: flex-end;
	padding: 10px 12px;
	border-top: 1px solid #e3e6e4;
}
.ranchos-chat__input {
	flex: 1 1 auto;
	resize: none;
	min-height: 40px;
	max-height: 120px;
	padding: 9px 12px;
	border: 1px solid #cfd5d1;
	border-radius: 10px;
	font: inherit;
	color: inherit;
	background: var(--ranchos-chat-bg);
}
.ranchos-chat__input:focus { outline: 2px solid var(--ranchos-chat-accent); outline-offset: 1px; border-color: transparent; }
.ranchos-chat__send {
	flex: 0 0 auto;
	padding: 9px 16px;
	border: 0;
	border-radius: 10px;
	background: var(--ranchos-chat-accent);
	color: var(--ranchos-chat-accent-text);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}
.ranchos-chat__send:disabled { opacity: .5; cursor: default; }
.ranchos-chat__hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.ranchos-chat__privacy {
	margin: 0;
	padding: 6px 16px 12px;
	font-size: 12px;
	color: var(--ranchos-chat-muted);
}
@media (max-width: 480px) {
	.ranchos-chat { right: 12px; bottom: 12px; }
	.ranchos-chat__panel { width: calc(100vw - 24px); max-height: calc(100vh - 24px); }
}
