/**
 * WP Grounded AI — chat widget styles.
 */
.wpgai-widget {
	max-width: 640px;
	border: 1px solid #d0d5dd;
	border-radius: 10px;
	overflow: hidden;
	font-size: 15px;
	background: #fff;
	color: #1d2327;
}

.wpgai-widget--floating {
	position: fixed;
	right: 20px;
	bottom: 20px;
	width: 360px;
	max-width: calc( 100vw - 40px );
	box-shadow: 0 8px 30px rgba( 0, 0, 0, 0.18 );
	z-index: 9999;
}

.wpgai-widget__header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 16px;
	font-weight: 600;
	background: #1d2327;
	color: #fff;
}

.wpgai-widget__avatar {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	object-fit: cover;
	flex: 0 0 auto;
}

.wpgai-widget__log {
	max-height: 360px;
	min-height: 120px;
	overflow-y: auto;
	padding: 12px 16px;
}

.wpgai-msg {
	margin: 0 0 12px;
}

.wpgai-msg--user .wpgai-msg__body {
	background: #eef2ff;
	padding: 8px 12px;
	border-radius: 8px;
	display: inline-block;
}

.wpgai-msg--assistant .wpgai-msg__body {
	background: #f6f7f7;
	padding: 8px 12px;
	border-radius: 8px;
}

.wpgai-msg--error .wpgai-msg__body {
	background: #fcecec;
	color: #b32d2e;
}

.wpgai-citations {
	margin-top: 8px;
	border-top: 1px dashed #d0d5dd;
	padding-top: 8px;
	font-size: 13px;
}

.wpgai-citations__title {
	font-weight: 600;
	margin-bottom: 4px;
}

.wpgai-citation {
	margin: 0 0 8px;
}

.wpgai-citation__excerpt {
	margin: 4px 0 0;
	padding: 4px 8px;
	border-left: 3px solid #d0d5dd;
	color: #50575e;
	font-style: italic;
}

.wpgai-widget__form {
	display: flex;
	gap: 8px;
	padding: 12px 16px;
	border-top: 1px solid #d0d5dd;
}

.wpgai-widget__input {
	flex: 1;
	resize: vertical;
	border: 1px solid #8c8f94;
	border-radius: 6px;
	padding: 8px;
	font: inherit;
}

.wpgai-widget__send {
	align-self: flex-end;
	background: #2271b1;
	color: #fff;
	border: 0;
	border-radius: 6px;
	padding: 8px 16px;
	cursor: pointer;
}

.wpgai-widget__send:disabled {
	opacity: 0.6;
	cursor: default;
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect( 1px, 1px, 1px, 1px );
}

/* ------------------------------------------------------------------ *
 * Floating launcher (FAB)
 * ------------------------------------------------------------------ */
.wpgai-fab {
	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 99999;
}

.wpgai-fab__button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 60px;
	height: 60px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #2271b1;
	color: #fff;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba( 0, 0, 0, 0.25 );
	overflow: hidden;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.wpgai-fab__button:hover,
.wpgai-fab__button:focus-visible {
	transform: scale( 1.06 );
	box-shadow: 0 8px 26px rgba( 0, 0, 0, 0.3 );
}

/* Hide the launcher bubble while the chat panel is open; it returns on close. */
.wpgai-fab.is-open .wpgai-fab__button {
	display: none;
}

.wpgai-fab__avatar {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	object-fit: cover;
	display: block;
}

.wpgai-fab__glyph {
	display: block;
}

.wpgai-fab__panel {
	position: fixed;
	right: 24px;
	bottom: 96px;
	width: 360px;
	max-width: calc( 100vw - 32px );
	height: 520px;
	max-height: calc( 100vh - 120px );
	display: flex;
	flex-direction: column;
	background: #fff;
	color: #1d2327;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 12px 40px rgba( 0, 0, 0, 0.28 );
}

.wpgai-fab__panel[hidden] {
	display: none;
}

.wpgai-fab__header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	background: #2271b1;
	color: #fff;
	font-weight: 600;
}

.wpgai-fab__header-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	object-fit: cover;
	flex: 0 0 auto;
}

.wpgai-fab__title {
	flex: 1 1 auto;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wpgai-fab__close {
	flex: 0 0 auto;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}

.wpgai-fab__close:hover,
.wpgai-fab__close:focus-visible {
	background: rgba( 255, 255, 255, 0.18 );
}

/* Inside the panel the widget fills the remaining space and drops its own
 * chrome (the panel already provides the frame + header). */
.wpgai-fab__panel .wpgai-widget {
	position: static;
	right: auto;
	bottom: auto;
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	min-height: 0;
	width: auto;
	max-width: none;
	border: 0;
	border-radius: 0;
	box-shadow: none;
}

.wpgai-fab__panel .wpgai-widget__log {
	flex: 1 1 auto;
	max-height: none;
	min-height: 0;
}

@media ( max-width: 480px ) {
	.wpgai-fab__panel {
		right: 8px;
		left: 8px;
		bottom: 88px;
		width: auto;
		max-width: none;
		height: auto;
		max-height: calc( 100vh - 108px );
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.wpgai-fab__button {
		transition: none;
	}

	.wpgai-fab__button:hover,
	.wpgai-fab__button:focus-visible {
		transform: none;
	}
}
