/**
 * WP Live Chat Pro - visitor widget.
 *
 * Everything is scoped under .wplc-widget and uses custom properties that the
 * plugin writes from the appearance settings, so a theme cannot bleed in and
 * the widget never rewrites theme styles.
 */

.wplc-widget {
	--wplc-primary: #4f46e5;
	--wplc-secondary: #0f172a;
	--wplc-on-primary: #ffffff;
	--wplc-bubble: #f1f5f9;
	--wplc-bubble-text: #0f172a;
	--wplc-surface: #ffffff;
	--wplc-surface-2: #f8fafc;
	--wplc-text: #0f172a;
	--wplc-muted: #64748b;
	--wplc-border: #e2e8f0;
	--wplc-danger: #dc2626;
	--wplc-success: #059669;
	--wplc-warning: #d97706;
	--wplc-radius: 16px;
	--wplc-font-size: 14px;
	--wplc-offset-x: 24px;
	--wplc-offset-y: 24px;
	--wplc-panel-width: 380px;
	--wplc-panel-height: 560px;
	--wplc-shadow: 0 20px 50px -12px rgba(15, 23, 42, 0.25), 0 4px 12px -4px rgba(15, 23, 42, 0.12);
	--wplc-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

	position: fixed;
	z-index: 999999;
	bottom: var(--wplc-offset-y);
	font-family: var(--wplc-font);
	font-size: var(--wplc-font-size);

	/*
	 * Pinned rather than inherited: a theme that sets a light body weight or
	 * negative tracking used to reach every label, message and button in the
	 * panel. Kadence alone changed the weight and letter-spacing of fourteen
	 * different parts of the widget.
	 */
	font-weight: 400;
	font-style: normal;
	line-height: 1.5;
	letter-spacing: normal;
	text-align: left;
	text-transform: none;
	color: var(--wplc-text);
	direction: inherit;
}

.wplc-widget--bottom-right {
	right: var(--wplc-offset-x);
	align-items: flex-end;
}

.wplc-widget--bottom-left {
	left: var(--wplc-offset-x);
	align-items: flex-start;
}

.wplc-widget--theme-dark {
	--wplc-surface: #0f172a;
	--wplc-surface-2: #1e293b;
	--wplc-text: #e2e8f0;
	--wplc-muted: #94a3b8;
	--wplc-border: #334155;
	--wplc-bubble: #1e293b;
	--wplc-bubble-text: #e2e8f0;
}

@media (prefers-color-scheme: dark) {
	.wplc-widget--theme-auto {
		--wplc-surface: #0f172a;
		--wplc-surface-2: #1e293b;
		--wplc-text: #e2e8f0;
		--wplc-muted: #94a3b8;
		--wplc-border: #334155;
		--wplc-bubble: #1e293b;
		--wplc-bubble-text: #e2e8f0;
	}
}

.wplc-widget *,
.wplc-widget *::before,
.wplc-widget *::after {
	box-sizing: border-box;
}

/*
 * Themes style `button`, `input` and `select` directly, which outranks the
 * single-class component rules further down. Normalise the controls here and
 * let those rules put the widget's own look back, rather than fighting each
 * theme's selectors one at a time.
 */
.wplc-widget button,
.wplc-widget input,
.wplc-widget select,
.wplc-widget textarea {
	font: inherit;
	font-weight: inherit;
	letter-spacing: inherit;
	text-transform: none;
	box-shadow: none;
	text-shadow: none;
}

/* Storefront gives every form a bottom margin; Astra sets a label line-height. */
.wplc-widget form {
	margin: 0;
}

.wplc-widget label {
	line-height: 1.5;
}

/*
 * `hidden` is only a UA-stylesheet rule, so any author `display` declaration
 * beats it. Several widget parts (the panel, the drop zone, the unread badge)
 * set `display: flex` and are toggled through the attribute, which left them
 * laid out, focusable and read by screen readers while "hidden". Restate the
 * rule for the plugin's own nodes so the attribute means what it says.
 */
.wplc-widget [hidden],
[class*="wplc-"][hidden] {
	display: none !important;
}

.wplc-visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------------------------------------------------------------------
 * Launcher
 * ------------------------------------------------------------------ */

.wplc-widget .wplc-launcher {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 60px;
	height: 60px;
	padding: 0;
	color: var(--wplc-on-primary);
	background: var(--wplc-primary);
	border: 0;
	border-radius: 50%;
	box-shadow: var(--wplc-shadow);
	cursor: pointer;
	transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.wplc-launcher:hover {
	transform: translateY(-2px);
}

.wplc-launcher:focus-visible {
	outline: 3px solid var(--wplc-primary);
	outline-offset: 3px;
}

.wplc-launcher:active {
	transform: scale(0.96);
}

/* Still the shop's colour, a shade down. Switching to the near-black secondary
 * made the open launcher read as a different control sitting next to the
 * panel rather than as the button that opened it. */
.wplc-launcher.is-open {
	filter: brightness(0.86);
}

.wplc-launcher__badge {
	position: absolute;
	top: -2px;
	right: -2px;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
	color: #fff;
	background: var(--wplc-danger);
	border: 2px solid var(--wplc-surface);
	border-radius: 11px;
}

@keyframes wplc-pulse {
	0% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.55); }
	70% { box-shadow: 0 0 0 16px rgba(79, 70, 229, 0); }
	100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
}

.wplc-launcher.is-pulsing {
	animation: wplc-pulse 1.4s ease-out 2;
}

/* ---------------------------------------------------------------------
 * Proactive bubble
 * ------------------------------------------------------------------ */

.wplc-bubble {
	position: absolute;
	right: 0;
	bottom: 76px;
	width: min(300px, calc(100vw - 48px));
	padding: 14px 16px;
	background: var(--wplc-surface);
	border: 1px solid var(--wplc-border);
	border-radius: var(--wplc-radius);
	box-shadow: var(--wplc-shadow);
	animation: wplc-rise 0.25s ease;
}

.wplc-widget--bottom-left .wplc-bubble {
	right: auto;
	left: 0;
}

.wplc-bubble__text {
	margin: 0 0 10px;
	font-size: 14px;
}

.wplc-bubble__actions {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
}

/* A greeting is one thing to read and one thing to do: read it, or tap it to
 * reply. The close button is there for people who want it gone, deliberately
 * small, because it is an escape hatch and not a choice being put to them. */
.wplc-bubble--greeting {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	padding: 0;
}

.wplc-bubble__open {
	flex: 1;
	margin: 0;
	padding: 14px 4px 14px 16px;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	font-size: 14px;
	line-height: 1.45;
	text-align: left;
	cursor: pointer;
}

.wplc-bubble__open:hover,
.wplc-bubble__open:focus-visible {
	color: var(--wplc-primary);
}

.wplc-bubble__close {
	flex: none;
	width: 28px;
	height: 28px;
	margin: 6px 6px 0 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: none;
	color: var(--wplc-muted);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

.wplc-bubble__close:hover,
.wplc-bubble__close:focus-visible {
	background: var(--wplc-bubble);
	color: var(--wplc-text);
}

/* ---------------------------------------------------------------------
 * Asking who they are, without stopping the conversation
 * ------------------------------------------------------------------ */

.wplc-ask {
	flex: none;
	margin: 0 16px 12px;
	padding: 12px 14px;
	background: var(--wplc-surface-2);
	border: 1px solid var(--wplc-border);
	border-radius: 12px;
	animation: wplc-message-in 0.22s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.wplc-ask__text {
	margin: 0 0 8px;
	color: var(--wplc-muted);
	font-size: 12.5px;
	line-height: 1.4;
}

.wplc-ask__fields {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}

.wplc-ask__actions {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
	margin-top: 8px;
}

@media (max-width: 400px) {
	.wplc-ask__fields {
		grid-template-columns: 1fr;
	}
}

@keyframes wplc-rise {
	from { opacity: 0; transform: translateY(12px); }
	to { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------------------
 * Panel
 * ------------------------------------------------------------------ */

.wplc-panel {
	position: absolute;
	right: 0;
	bottom: 76px;
	display: flex;
	flex-direction: column;
	width: var(--wplc-panel-width);
	max-width: calc(100vw - 32px);
	height: var(--wplc-panel-height);
	max-height: calc(100vh - 120px);
	overflow: hidden;
	background: var(--wplc-surface);
	border: 1px solid var(--wplc-border);
	border-radius: var(--wplc-radius);
	box-shadow: var(--wplc-shadow);
	opacity: 0;
	transform: translateY(16px) scale(0.98);
	transform-origin: bottom right;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.wplc-widget--bottom-left .wplc-panel {
	right: auto;
	left: 0;
	transform-origin: bottom left;
}

.wplc-panel.is-open {
	opacity: 1;
	transform: translateY(0) scale(1);
}

/* Somebody who has asked their system for less motion gets none of it. The
 * list is deliberately broad: every animated thing in the widget belongs
 * here, and a new one that forgets to be added is the bug this guards. */
@media (prefers-reduced-motion: reduce) {
	.wplc-panel,
	.wplc-launcher,
	.wplc-bubble,
	.wplc-message,
	.wplc-ask,
	.wplc-typing__dots i {
		transition: none;
		animation: none;
	}
}

.wplc-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	color: var(--wplc-on-primary);
	background: var(--wplc-primary);
}

.wplc-header__brand {
	display: flex;
	gap: 10px;
	align-items: center;
	min-width: 0;
}

.wplc-header__logo {
	width: 36px;
	height: 36px;
	object-fit: cover;
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.2);
}

.wplc-header__identity {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.wplc-header__title {
	overflow: hidden;
	font-size: 15px;
	font-weight: 600;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wplc-header__status {
	display: flex;
	gap: 6px;
	align-items: center;
	font-size: 12px;
	opacity: 0.9;
}

.wplc-status-dot {
	width: 8px;
	height: 8px;
	background: #94a3b8;
	border-radius: 50%;
	flex: none;
}

.wplc-status-dot--online { background: #34d399; }
.wplc-status-dot--away { background: #fbbf24; }
.wplc-status-dot--pending { background: #a5b4fc; }
.wplc-status-dot--error { background: #f87171; }

.wplc-header__actions {
	display: flex;
	gap: 2px;
	align-items: center;
}

.wplc-header__button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	color: inherit;
	background: transparent;
	border: 0;
	border-radius: 8px;
	cursor: pointer;
	opacity: 0.85;
}

.wplc-header__button:hover {
	background: rgba(255, 255, 255, 0.16);
	opacity: 1;
}

.wplc-header__button:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 1px;
}

.wplc-panel__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-height: 0;
	overflow: hidden;
	background: var(--wplc-surface);
}

.wplc-panel__footer {
	border-top: 1px solid var(--wplc-border);
	background: var(--wplc-surface);
}

.wplc-notice {
	padding: 8px 16px;
	font-size: 13px;
	color: var(--wplc-text);
	background: var(--wplc-surface-2);
	border-bottom: 1px solid var(--wplc-border);
}

.wplc-notice--error {
	color: #fff;
	background: var(--wplc-danger);
}

.wplc-branding {
	padding: 6px 16px;
	font-size: 11px;
	color: var(--wplc-muted);
	text-align: center;
	background: var(--wplc-surface-2);
	border-top: 1px solid var(--wplc-border);
}

/* ---------------------------------------------------------------------
 * Messages
 * ------------------------------------------------------------------ */

.wplc-messages {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-height: 0;
	padding: 16px;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
}

.wplc-messages__list {
	display: flex;
	flex: 1;
	flex-direction: column;
	/* A conversation grows downwards from the top. `auto` here pushes a short
	 * one to the bottom of the panel, which left a greeting stranded under
	 * half a screen of white on a phone -- the panel looked broken rather than
	 * new. Once there is enough to fill the panel this has no effect and the
	 * list scrolls as before. */
	justify-content: flex-start;
	gap: 10px;

	/*
	 * A new chat has two or three messages in a panel tall enough for thirty,
	 * and left to itself the conversation floats at the top under a large gap.
	 * The auto margin settles a short thread down onto the composer the way
	 * every messaging app does, and collapses to nothing once the thread is
	 * long enough to scroll, so it costs the overflow case nothing.
	 */
	margin-top: auto;
}

.wplc-day {
	margin: 8px auto;
	padding: 3px 10px;
	font-size: 11px;
	color: var(--wplc-muted);
	background: var(--wplc-surface-2);
	border-radius: 999px;
}

.wplc-system {
	margin: 4px auto;
	padding: 4px 12px;
	font-size: 12px;
	color: var(--wplc-muted);
	text-align: center;
}

.wplc-message {
	display: flex;
	gap: 8px;
	/* The avatar labels who is speaking, so it sits beside the top of what
	 * they said. Bottom-aligned it ended up level with the timestamp under
	 * the bubble, floating clear of the message it belonged to. */
	align-items: flex-start;
	max-width: 88%;
	/* Short and slight. A message that appears fully formed reads as a page
	 * redraw; one that rises a few pixels reads as something arriving. */
	animation: wplc-message-in 0.22s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.wplc-message--mine {
	align-self: flex-end;
	flex-direction: row-reverse;
}

.wplc-message--theirs {
	align-self: flex-start;
}

.wplc-message__body {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.wplc-message__author {
	margin-bottom: 2px;
	font-size: 11px;
	font-weight: 600;
	color: var(--wplc-muted);
}

@keyframes wplc-message-in {
	from { opacity: 0; transform: translateY(6px); }
	to { opacity: 1; transform: none; }
}

.wplc-message__bubble {
	padding: 9px 13px;
	overflow-wrap: anywhere;
	background: var(--wplc-bubble);
	color: var(--wplc-bubble-text);
	border-radius: 14px 14px 14px 4px;
}

.wplc-message--mine .wplc-message__bubble {
	color: var(--wplc-on-primary);
	background: var(--wplc-primary);
	border-radius: 14px 14px 4px 14px;
}

.wplc-message__text {
	white-space: pre-wrap;
}

.wplc-message__meta {
	display: flex;
	gap: 4px;
	align-items: center;
	margin-top: 3px;
	font-size: 11px;
	color: var(--wplc-muted);
}

.wplc-message--mine .wplc-message__meta {
	justify-content: flex-end;
}

.wplc-message__status--read { color: var(--wplc-success); }
.wplc-message__status--failed { color: var(--wplc-danger); }
.wplc-message__status--sending { opacity: 0.6; }

.wplc-message--failed .wplc-message__bubble {
	border: 1px solid var(--wplc-danger);
}

.wplc-message__retry {
	align-self: flex-end;
	margin-top: 4px;
	padding: 0;
	font-size: 12px;
	color: var(--wplc-danger);
	text-decoration: underline;
	background: none;
	border: 0;
	cursor: pointer;
}

.wplc-avatar {
	flex: none;
	width: 28px;
	height: 28px;
	object-fit: cover;
	border-radius: 50%;
	background: var(--wplc-surface-2);
}

.wplc-avatar--initial {
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	font-weight: 700;
	color: var(--wplc-on-primary);
	/* The shop's own colour. A near-black disc next to a coloured panel read
	 * as a missing image rather than as somebody's stand-in. */
	background: var(--wplc-primary);
}

.wplc-attachment {
	display: flex;
	gap: 8px;
	align-items: center;
	margin-top: 6px;
	color: inherit;
	text-decoration: none;
}

.wplc-attachment--image {
	display: block;
	margin: 0;
}

.wplc-attachment--image img {
	display: block;
	max-width: 220px;
	max-height: 220px;
	border-radius: 10px;
}

.wplc-attachment--file {
	padding: 8px 10px;
	background: rgba(15, 23, 42, 0.06);
	border-radius: 10px;
}

.wplc-message--mine .wplc-attachment--file {
	background: rgba(255, 255, 255, 0.18);
}

.wplc-attachment__name {
	overflow: hidden;
	font-size: 13px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wplc-attachment__size {
	flex: none;
	font-size: 11px;
	opacity: 0.75;
}

.wplc-typing {
	display: flex;
	gap: 8px;
	align-items: center;
	padding: 8px 4px 0;
	font-size: 12px;
	color: var(--wplc-muted);
}

.wplc-typing__dots {
	display: inline-flex;
	gap: 3px;
}

.wplc-typing__dots i {
	width: 6px;
	height: 6px;
	background: var(--wplc-muted);
	border-radius: 50%;
	animation: wplc-blink 1.2s infinite ease-in-out;
}

.wplc-typing__dots i:nth-child(2) { animation-delay: 0.15s; }
.wplc-typing__dots i:nth-child(3) { animation-delay: 0.3s; }

@keyframes wplc-blink {
	0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
	40% { opacity: 1; transform: translateY(-2px); }
}

/* ---------------------------------------------------------------------
 * Composer
 * ------------------------------------------------------------------ */

.wplc-composer {
	position: relative;
	padding: 10px 12px;
}

.wplc-composer__row {
	display: flex;
	gap: 6px;
	align-items: flex-end;
}

.wplc-composer__actions {
	display: flex;
	gap: 2px;
}

.wplc-composer__action {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	color: var(--wplc-muted);
	background: transparent;
	border: 0;
	border-radius: 8px;
	cursor: pointer;
}

.wplc-composer__action:hover {
	color: var(--wplc-primary);
	background: var(--wplc-surface-2);
}

.wplc-composer__action:focus-visible,
.wplc-composer__send:focus-visible,
.wplc-composer__input:focus-visible {
	outline: 2px solid var(--wplc-primary);
	outline-offset: 1px;
}

.wplc-composer__input {
	flex: 1;
	max-height: 140px;
	min-height: 34px;
	padding: 7px 12px;
	font: inherit;
	color: var(--wplc-text);
	resize: none;
	background: var(--wplc-surface-2);
	border: 1px solid var(--wplc-border);
	border-radius: 18px;
}

.wplc-composer__input:focus {
	border-color: var(--wplc-primary);
	outline: none;
}

.wplc-composer__send {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	color: var(--wplc-on-primary);
	background: var(--wplc-primary);
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	transition: opacity 0.15s ease;
}

.wplc-composer__send[disabled] {
	cursor: not-allowed;
	opacity: 0.45;
}

.wplc-composer__emoji-host {
	position: absolute;
	bottom: 100%;
	left: 8px;
	right: 8px;
}

.wplc-emoji {
	max-height: 220px;
	padding: 10px;
	overflow-y: auto;
	background: var(--wplc-surface);
	border: 1px solid var(--wplc-border);
	border-radius: 12px;
	box-shadow: var(--wplc-shadow);
}

.wplc-emoji__label {
	margin: 6px 0 4px;
	font-size: 11px;
	font-weight: 600;
	color: var(--wplc-muted);
	text-transform: uppercase;
}

.wplc-emoji__row {
	display: flex;
	flex-wrap: wrap;
	gap: 2px;
}

.wplc-emoji__item {
	width: 32px;
	height: 32px;
	font-size: 18px;
	line-height: 1;
	background: transparent;
	border: 0;
	border-radius: 6px;
	cursor: pointer;
}

.wplc-emoji__item:hover {
	background: var(--wplc-surface-2);
}

/* ---------------------------------------------------------------------
 * Forms and states
 * ------------------------------------------------------------------ */

.wplc-form {
	display: flex;
	flex-direction: column;
	gap: 12px;

	/*
	 * The bottom inset is the submit button's own margin rather than padding on
	 * the form, so the sticky rule below can pin the button's margin box flush
	 * to the scroll port and still leave that inset visible.
	 */
	padding: 16px 16px 0;
	overflow-y: auto;
}

/*
 * A pre-chat or offline form with a department picker and a message box is
 * taller than the panel, so the form scrolls - which left the primary action
 * sliced across the bottom edge until the visitor thought to scroll. Pin it to
 * the foot of the scroll port instead. The margin is what keeps the inset
 * visible once it sticks, and it stays in normal flow while the form fits.
 */
.wplc-form > .wplc-button--primary {
	position: sticky;
	bottom: 0;
	z-index: 1;
	margin-bottom: 16px;
}

/*
 * Mask only the form's bottom padding, so a field scrolling under the pinned
 * button does not peek out beneath it. A ring around the whole button would
 * paint over the field above it even when nothing is stuck.
 */
.wplc-form > .wplc-button--primary::after {
	content: "";
	position: absolute;
	right: -16px;
	bottom: -16px;
	left: -16px;
	height: 16px;
	background: var(--wplc-surface);
}

.wplc-form__intro {
	margin: 0;
	font-size: 14px;
	color: var(--wplc-muted);
}

.wplc-field {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.wplc-field__label {
	font-size: 12px;
	font-weight: 600;
	color: var(--wplc-muted);
}

/*
 * Themes style form controls with selectors like `input[type="email"]`, which
 * outrank a single class, so the widget's fields used to inherit the host's
 * padding, radius, font size, background and border. Astra pushed them to 16px
 * text with 12px/16px padding and Storefront gave them a grey inset fill, which
 * changes how much of the form fits in the panel. Qualify by element inside the
 * widget so the plugin's own look wins wherever it is installed.
 */
.wplc-widget input.wplc-field__input,
.wplc-widget textarea.wplc-field__input,
.wplc-widget select.wplc-field__input {
	box-sizing: border-box;
	width: 100%;

	/* Astra sets a fixed height on text inputs; size from the content instead. */
	height: auto;
	min-height: 0;
	margin: 0;
	padding: 9px 12px;
	font: inherit;
	line-height: 1.5;
	letter-spacing: normal;
	text-transform: none;
	color: var(--wplc-text);
	background: var(--wplc-surface);
	border: 1px solid var(--wplc-border);
	border-radius: 10px;
	box-shadow: none;
}

.wplc-widget input.wplc-field__input:focus,
.wplc-widget textarea.wplc-field__input:focus,
.wplc-widget select.wplc-field__input:focus {
	border-color: var(--wplc-primary);
	outline: 2px solid color-mix(in srgb, var(--wplc-primary) 25%, transparent);
	outline-offset: 0;
	box-shadow: none;
}

.wplc-widget .wplc-field__input--invalid {
	border-color: var(--wplc-danger);
}

.wplc-field__error {
	margin: 0;
	font-size: 12px;
	color: var(--wplc-danger);
}

.wplc-widget .wplc-button {
	padding: 10px 16px;
	font: inherit;
	font-weight: 600;
	border: 1px solid transparent;
	border-radius: 10px;
	cursor: pointer;
	transition: filter 0.15s ease;
}

.wplc-button:hover { filter: brightness(0.95); }
.wplc-button:focus-visible { outline: 2px solid var(--wplc-primary); outline-offset: 2px; }
.wplc-button[disabled] { cursor: progress; opacity: 0.6; }

.wplc-button--primary {
	color: var(--wplc-on-primary);
	background: var(--wplc-primary);
}

.wplc-button--ghost {
	color: var(--wplc-text);
	background: transparent;
	border-color: var(--wplc-border);
}

/* Scoped to .wplc-widget to match the base rule above. Without it the base
 * rule wins on specificity alone and every "small" button in the widget --
 * the greeting's dismiss, the details prompt's Not now and Save -- was drawn
 * full size. */
.wplc-widget .wplc-button--small {
	padding: 6px 12px;
	font-size: 13px;
}

.wplc-empty,
.wplc-loading {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 12px;
	align-items: center;
	justify-content: center;
	padding: 32px 24px;
	text-align: center;
	color: var(--wplc-muted);
}

.wplc-empty__title {
	margin: 0;
	font-size: 14px;
}

.wplc-closed {
	display: flex;
	flex-direction: column;
	gap: 10px;
	align-items: center;
	padding: 16px;
	font-size: 13px;
	color: var(--wplc-muted);
	text-align: center;
}

.wplc-consent {
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: 20px;
}

.wplc-consent__actions {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
}

.wplc-rating {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 20px;
}

.wplc-rating__title {
	margin: 0;
	font-weight: 600;
	text-align: center;
}

.wplc-rating__stars {
	display: flex;
	gap: 6px;
	justify-content: center;
}

.wplc-rating__star {
	padding: 4px;
	color: var(--wplc-border);
	background: none;
	border: 0;
	cursor: pointer;
}

.wplc-rating__star.is-active { color: #f59e0b; }
.wplc-rating__star:focus-visible { outline: 2px solid var(--wplc-primary); }

.wplc-rating__actions {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
}

.wplc-dropzone {
	position: fixed;
	inset: 0;
	z-index: 999998;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	font-weight: 600;
	color: var(--wplc-on-primary);
	background: color-mix(in srgb, var(--wplc-primary) 82%, transparent);
	pointer-events: none;
}

.wplc-open-chat {
	padding: 10px 18px;
	font: inherit;
	font-weight: 600;
	color: #fff;
	background: var(--wplc-primary, #4f46e5);
	border: 0;
	border-radius: 8px;
	cursor: pointer;
}

/* ---------------------------------------------------------------------
 * Mobile
 * ------------------------------------------------------------------ */

@media (max-width: 640px) {
	.wplc-widget {
		bottom: 16px;
	}

	.wplc-widget--bottom-right { right: 16px; }
	.wplc-widget--bottom-left { left: 16px; }

	.wplc-panel {
		position: fixed;
		inset: 0;
		width: 100vw;
		max-width: 100vw;
		height: 100dvh;
		max-height: 100dvh;
		border: 0;
		border-radius: 0;
	}

	/* The panel covers the screen and closes from its own header. */
	.wplc-launcher.is-open {
		display: none;
	}

	.wplc-message { max-width: 92%; }

	.wplc-composer {
		padding-bottom: max(10px, env(safe-area-inset-bottom));
	}

	.wplc-header {
		padding-top: max(14px, env(safe-area-inset-top));
	}

	.wplc-bubble {
		bottom: 72px;
		width: min(280px, calc(100vw - 32px));
	}

}

/* Timestamps, the day divider and the author line are secondary, but 11px is
   too small to read comfortably on a device held at arm's length. Desktop
   keeps 11px, where it reads as ordinary chat metadata. */
@media (max-width: 640px), (pointer: coarse) {
	.wplc-day,
	.wplc-message__author,
	.wplc-message__meta,
	.wplc-attachment__size,
	.wplc-branding {
		font-size: 12px;
	}
}

/* Safari on iOS zooms the whole page when it focuses a control whose text is
   under 16px. That throws the layout sideways mid-sentence and is awkward to
   undo one-handed, so lift the controls to 16px wherever a touch keyboard is
   in play. The configured font size still drives everything else, and a mouse
   and keyboard keep the designed sizing. */
@media (max-width: 640px), (pointer: coarse) {
	/* Qualified with the element on purpose: the theme-bleed guard above is
	   `.wplc-widget textarea`, which outranks a bare class and would otherwise
	   put `font: inherit` back. */
	.wplc-widget input.wplc-field__input,
	.wplc-widget textarea.wplc-field__input,
	.wplc-widget select.wplc-field__input,
	.wplc-widget textarea.wplc-composer__input {
		font-size: 16px;
	}
}

@media (forced-colors: active) {
	.wplc-panel,
	.wplc-launcher,
	.wplc-message__bubble {
		border: 1px solid CanvasText;
	}
}

/* Product and discount cards an agent sends into the chat. */
.wplc-card {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 8px;
	padding: 8px;
	border: 1px solid var(--wplc-border, rgba(0, 0, 0, 0.12));
	border-radius: 10px;
	background: var(--wplc-surface, #fff);
}

.wplc-card__image {
	flex: 0 0 auto;
	width: 56px;
	height: 56px;
	object-fit: cover;
	border-radius: 8px;
}

.wplc-card__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.wplc-card__title {
	font-weight: 600;
	overflow-wrap: anywhere;
}

.wplc-card__price {
	font-weight: 600;
}

.wplc-card__code {
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 16px;
	font-weight: 700;
	letter-spacing: 0.06em;
	overflow-wrap: anywhere;
}

.wplc-card__note,
.wplc-card__stock {
	font-size: 12px;
	opacity: 0.75;
}

.wplc-card__stock.is-out {
	color: #b42318;
	opacity: 1;
}

.wplc-card__action {
	flex: 0 0 auto;
	align-self: center;
	padding: 6px 12px;
	border-radius: 999px;
	background: var(--wplc-primary, #4f46e5);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}

.wplc-card--coupon {
	border-style: dashed;
}

@media (max-width: 380px) {
	.wplc-card {
		flex-wrap: wrap;
	}

	.wplc-card__action {
		width: 100%;
		text-align: center;
	}
}
