/**
 * Structure for the assistant's panel (AB#18902), in the vocabulary every
 * other stylesheet here speaks: --diverp-hairline for separators,
 * --diverp-radius for corners, --diverp-muted for secondary text,
 * --diverp-accent for the one colour, --diverp-small and --diverp-label for
 * the two smaller sizes, --diverp-raise and --diverp-wash for tints,
 * --diverp-good for the presence dot.
 *
 * THE LOOK (founder, 2026-09-20, with the chat window on flyingfish.in as the
 * brief: "this is how I want our assistant to look, following theme, options,
 * message"): a pill launcher with the assistant's face and a presence dot;
 * a window with a gradient head in the theme's colour carrying the name and
 * a status line, a restart and a close; bubbles on a faintly tinted ground;
 * suggested questions as pills; a rounded composer with an icon send; one
 * small line saying it can make mistakes and where a person is.
 *
 * THE THEME'S COLOUR is --diverp-accent. The script reads it off the send
 * button - the ONE control that wears the theme's own button class (the one
 * the sign-in control wears) - so a site with no rule of its own still gets
 * its theme's button colour everywhere here; a site that sets the token
 * wins. The one thing a floating panel cannot inherit is a ground, so
 * --diverp-ground is white unless the site says otherwise - the trade the
 * partner card makes.
 *
 * The send button's colours sit at zero specificity inside :where(), so the
 * theme's rule for its class beats them; everything else is dressed at the
 * doubled root class (0-2-0), because a theme's resets for the button and
 * anchor elements (Bootstrap's `button { border-radius: 0 }`) outrank any
 * zero-specificity rule and would undress it. A part the site's filter gave
 * a class to loses its `--own` marker and wears that class instead. The
 * diverp_widgets_assistant_styles filter turns the whole file off.
 */

.diverp-assistant {
	font: inherit;
	color: inherit;
}

/* ---- the launcher: a pill fixed to the bottom of the window, every page ----
   --diverp-assistant-offset lifts the launcher and the floating panel above
   whatever the site already keeps in that corner (a back-to-top, a sticky bar). */

:where(.diverp-assistant__launcher) {
	background: var(--diverp-ground, #fff);
	color: inherit;
	border: 1px solid var(--diverp-hairline, rgba(127, 127, 127, 0.25));
}

.diverp-assistant.diverp-assistant .diverp-assistant__launcher {
	position: fixed;
	right: 1.25rem;
	bottom: var(--diverp-assistant-offset, 1.25rem);
	z-index: 9999;
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	max-width: calc(100vw - 2.5rem);
	padding: 0.4rem 1.1rem 0.4rem 0.45rem;
	margin: 0;
	border-radius: 999px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
	cursor: pointer;
	font: inherit;
	line-height: 1.25;
	text-align: left;
	text-decoration: none;
}

.diverp-assistant.diverp-assistant .diverp-assistant__launcher[hidden] {
	display: none;
}

.diverp-assistant.diverp-assistant .diverp-assistant__launcher:hover,
.diverp-assistant.diverp-assistant .diverp-assistant__launcher:focus-visible {
	transform: translateY(-1px);
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
}

.diverp-assistant__launcher-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
	max-width: 16rem;
	transition: max-width 0.25s ease, opacity 0.2s ease;
}

/* Folded to the face after three seconds (assistant.js); hover or focus spreads it again. */
.diverp-assistant.diverp-assistant .diverp-assistant__launcher.is-compact:not(:hover):not(:focus-visible) {
	gap: 0;
	padding: 0.4rem;
}

.diverp-assistant__launcher.is-compact:not(:hover):not(:focus-visible) .diverp-assistant__launcher-text {
	max-width: 0;
	opacity: 0;
}

.diverp-assistant__launcher-title {
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.diverp-assistant__launcher-line {
	font-size: var(--diverp-label, 0.72rem);
	opacity: var(--diverp-muted, 0.7);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ---- the face: a photo when the site gave one, the bot icon otherwise ---- */

.diverp-assistant__avatar {
	position: relative;
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.5rem;
	height: 2.5rem;
	border-radius: 50%;
	background: var(--diverp-accent, currentColor);
	color: var(--diverp-ground, #fff);
}

.diverp-assistant__avatar img {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	object-fit: cover;
}

.diverp-assistant__icon {
	display: inline-flex;
	line-height: 0;
}

.diverp-assistant__avatar .diverp-assistant__icon svg {
	width: 1.5rem;
	height: 1.5rem;
}

/* The presence dot: the assistant answers here (good), or it is away. Big
   enough, with its ring, to cover a dot a site's photo may carry painted into
   the same corner (founder 2026-09-20, note 6) - ours is the only one seen,
   and ours is live. */
.diverp-assistant__dot {
	position: absolute;
	right: -3px;
	bottom: -3px;
	width: 1rem;
	height: 1rem;
	border-radius: 50%;
	background: var(--diverp-good, #2f7d4f);
	border: 3px solid var(--diverp-ground, #fff);
	box-sizing: content-box;
}

.diverp-assistant--away .diverp-assistant__dot {
	background: color-mix(in srgb, currentColor 35%, transparent);
}

/* ---- the panel ---- */

.diverp-assistant__panel {
	display: flex;
	flex-direction: column;
	background: var(--diverp-ground, #fff);
	border: 1px solid var(--diverp-hairline, rgba(127, 127, 127, 0.25));
	border-radius: 16px;
	overflow: hidden;
	text-align: left;
}

.diverp-assistant__panel[hidden] {
	display: none;
}

.diverp-assistant--float .diverp-assistant__panel {
	position: fixed;
	right: 1.25rem;
	bottom: var(--diverp-assistant-offset, 1.25rem);
	z-index: 9999;
	width: min(24rem, calc(100vw - 2.5rem));
	height: min(36rem, calc(100vh - 5rem));
	box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
}

.diverp-assistant--inline .diverp-assistant__panel {
	width: 100%;
	max-width: 34rem;
	height: 34rem;
}

@media (max-width: 480px) {
	.diverp-assistant--float .diverp-assistant__panel {
		right: 0;
		bottom: 0;
		width: 100vw;
		height: 88vh;
		border-radius: 16px 16px 0 0;
	}
}

/* ---- the head: the theme's colour, the name, the status, two buttons ---- */

.diverp-assistant__head {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	padding: 0.75rem 0.85rem;
	color: var(--diverp-ground, #fff);
	/* Lighter on the left, the theme's colour on the right (founder 2026-09-20, note 4). */
	background: linear-gradient(
		90deg,
		color-mix(in srgb, var(--diverp-accent, currentColor) 55%, #38bdf8),
		var(--diverp-accent, currentColor)
	);
}

.diverp-assistant__head .diverp-assistant__avatar {
	background: rgba(255, 255, 255, 0.22);
	color: inherit;
}

.diverp-assistant__head .diverp-assistant__dot {
	border-color: var(--diverp-ground, #fff);
}

.diverp-assistant__who {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
}

.diverp-assistant__title {
	font-weight: 700;
	font-size: 1.05em;
	line-height: 1.2;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.diverp-assistant__status {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	font-size: var(--diverp-small, 0.8rem);
	line-height: 1.2;
	opacity: 0.92;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* One circle only (founder 2026-09-20): the presence dot on the face is the
   status; the line beside it is words. */

.diverp-assistant__restart,
.diverp-assistant__close {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.1rem;
	height: 2.1rem;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.2);
	color: inherit;
	font: inherit;
	font-size: 1.15em;
	line-height: 0;
	cursor: pointer;
}

.diverp-assistant__restart:hover,
.diverp-assistant__close:hover,
.diverp-assistant__restart:focus-visible,
.diverp-assistant__close:focus-visible {
	background: rgba(255, 255, 255, 0.32);
}

.diverp-assistant__restart svg {
	width: 1rem;
	height: 1rem;
}

/* ---- the conversation ---- */

.diverp-assistant__messages {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	padding: 1rem 0.85rem 0.5rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	background: linear-gradient(
		180deg,
		color-mix(in srgb, var(--diverp-accent, currentColor) 7%, var(--diverp-ground, #fff)),
		var(--diverp-ground, #fff)
	);
}

.diverp-assistant__bubble {
	max-width: 86%;
	padding: 0.6rem 0.85rem;
	border-radius: 16px;
	overflow-wrap: anywhere;
	line-height: 1.45;
}

/* A reply is drawn as paragraphs, lists, emphasis and links (founder
   2026-09-20, note 2): the script builds these from the text, never from
   markup the platform sent, so nothing here is more than structure. */
.diverp-assistant__bubble p,
.diverp-assistant__bubble ol,
.diverp-assistant__bubble ul {
	margin: 0 0 0.55em;
	padding: 0;
	font: inherit;
	color: inherit;
}

.diverp-assistant__bubble ol,
.diverp-assistant__bubble ul {
	padding-left: 1.3em;
}

.diverp-assistant__bubble li {
	margin: 0 0 0.35em;
}

.diverp-assistant__bubble > :last-child {
	margin-bottom: 0;
}

.diverp-assistant__bubble strong {
	font-weight: 700;
}

.diverp-assistant__bubble a {
	color: inherit;
	font-weight: 600;
	text-decoration: underline;
}

.diverp-assistant__bubble--assistant {
	align-self: flex-start;
	background: var(--diverp-ground, #fff);
	border: 1px solid var(--diverp-hairline, rgba(127, 127, 127, 0.25));
	border-bottom-left-radius: 5px;
}

.diverp-assistant__bubble--guest {
	align-self: flex-end;
	background: var(--diverp-accent, currentColor);
	color: var(--diverp-ground, #fff);
	border-bottom-right-radius: 5px;
}

/* ---- the suggested questions: pills, until the visitor has written ---- */

.diverp-assistant__starters {
	display: flex;
	flex-wrap: wrap;
	gap: 0.45rem;
	padding: 0.25rem 0.85rem 0.6rem;
}

.diverp-assistant__starters[hidden] {
	display: none;
}

/*
 * OUR LOOK UNLESS THE SITE OVERRIDES IT. A pill is dressed at full strength
 * (0-2-0) while it carries the `--own` marker the script adds when the
 * site's filter named no class for it: a theme's reset for the button
 * element - Bootstrap's `button { border-radius: 0 }` - outranks any
 * zero-specificity rule and turned the pills into boxes on the pilot. With
 * a class from the filter the marker is absent and the theme's class rules.
 */
.diverp-assistant__chip {
	cursor: pointer;
	text-align: left;
}

.diverp-assistant .diverp-assistant__chip--own {
	background: var(--diverp-ground, #fff);
	color: var(--diverp-accent, currentColor);
	border: 1px solid var(--diverp-accent, currentColor);
	border-radius: 999px;
	padding: 0.4rem 0.8rem;
	margin: 0;
	font: inherit;
	font-size: var(--diverp-small, 0.8rem);
	line-height: 1.2;
	text-transform: none;
	letter-spacing: normal;
	box-shadow: none;
}

.diverp-assistant .diverp-assistant__chip--own:hover,
.diverp-assistant .diverp-assistant__chip--own:focus-visible {
	background: color-mix(in srgb, var(--diverp-accent, currentColor) 10%, var(--diverp-ground, #fff));
}

/* ---- typing: three dots in a bubble, the poll's word ---- */

.diverp-assistant__typing {
	align-self: flex-start;
	display: inline-flex;
	gap: 0.25rem;
	margin: 0 0.85rem 0.5rem;
	padding: 0.7rem 0.85rem;
	border: 1px solid var(--diverp-hairline, rgba(127, 127, 127, 0.25));
	border-radius: 16px;
	border-bottom-left-radius: 5px;
	background: var(--diverp-ground, #fff);
	width: max-content;
}

.diverp-assistant__typing[hidden] {
	display: none;
}

.diverp-assistant__typing span {
	width: 0.45rem;
	height: 0.45rem;
	border-radius: 50%;
	background: currentColor;
	opacity: var(--diverp-muted, 0.7);
	animation: diverp-assistant-dot 1.2s infinite ease-in-out;
}

.diverp-assistant__typing span:nth-child(2) {
	animation-delay: 0.2s;
}

.diverp-assistant__typing span:nth-child(3) {
	animation-delay: 0.4s;
}

@keyframes diverp-assistant-dot {
	0%, 80%, 100% { transform: translateY(0); }
	40% { transform: translateY(-0.25rem); }
}

/* ---- notes, the handover, the end ---- */

.diverp-assistant__note {
	padding: 0.35rem 0.85rem;
	font-size: var(--diverp-small, 0.8rem);
	opacity: var(--diverp-muted, 0.7);
}

.diverp-assistant__note[hidden] {
	display: none;
}

.diverp-assistant__continued,
.diverp-assistant__closed {
	align-self: stretch;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	padding: 0.75rem;
	border: 1px dashed var(--diverp-hairline, rgba(127, 127, 127, 0.25));
	border-radius: var(--diverp-radius, 10px);
	background: var(--diverp-ground, #fff);
	font-size: var(--diverp-small, 0.8rem);
}

.diverp-assistant__continued-text,
.diverp-assistant__closed p {
	margin: 0;
}

/* Ours at full strength: these wear no theme class, and a theme's resets for
   the button and anchor elements would otherwise undress them. */
.diverp-assistant .diverp-assistant__continue,
.diverp-assistant .diverp-assistant__again {
	align-self: flex-start;
	display: inline-block;
	padding: 0.5rem 0.9rem;
	margin: 0;
	border: 0;
	border-radius: 999px;
	background: var(--diverp-accent, currentColor);
	color: var(--diverp-ground, #fff);
	font: inherit;
	font-weight: 600;
	line-height: 1.3;
	text-decoration: none;
	text-transform: none;
	cursor: pointer;
}

/* ---- the composer ---- */

.diverp-assistant__composer {
	display: flex;
	align-items: flex-end;
	gap: 0.5rem;
	padding: 0.6rem 0.75rem 0.4rem;
	margin: 0;
	border-top: 1px solid var(--diverp-hairline, rgba(127, 127, 127, 0.25));
}

.diverp-assistant__composer[hidden] {
	display: none;
}

.diverp-assistant__input {
	flex: 1;
	min-width: 0;
	resize: none;
	font: inherit;
	color: inherit;
	background: var(--diverp-ground, #fff);
	border: 1px solid var(--diverp-accent, currentColor);
	border-radius: 12px;
	padding: 0.65rem 0.85rem;
	max-height: 6rem;
	line-height: 1.35;
}

.diverp-assistant__input:focus {
	outline: none;
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--diverp-accent, currentColor) 20%, transparent);
}

/* The ONE control that wears the theme's button class: its colour is the
   theme's, read back as the accent; only its shape is ours. */
:where(.diverp-assistant__send) {
	background: var(--diverp-accent, currentColor);
	color: var(--diverp-ground, #fff);
	border: 0;
	font: inherit;
}

.diverp-assistant.diverp-assistant .diverp-assistant__send {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	padding: 0;
	margin: 0;
	border-radius: 12px;
	line-height: 0;
	cursor: pointer;
}

.diverp-assistant__send svg {
	width: 1.25rem;
	height: 1.25rem;
}

.diverp-assistant.diverp-assistant .diverp-assistant__send:disabled {
	opacity: var(--diverp-muted, 0.7);
	cursor: default;
}

/* ---- the one line at the foot ---- */

.diverp-assistant__foot {
	margin: 0;
	padding: 0 0.85rem 0.55rem;
	font-size: var(--diverp-label, 0.72rem);
	line-height: 1.35;
	opacity: var(--diverp-muted, 0.7);
	text-align: center;
}

.diverp-assistant__foot a {
	color: inherit;
	text-decoration: underline;
}
