/**
 * CELSYN Concierge — sitewide widget. Deep navy / white / restrained blue
 * accent, Inter body type, compact. No cartoon avatar, no bounce/pulse
 * animation loops — one quiet open/close transition, disabled entirely
 * under prefers-reduced-motion.
 *
 * @package Celsyn360
 */

.celsyn-cc {
	position: fixed;
	right: 1.25rem;
	bottom: 1.25rem;
	z-index: 9000;
	font-family: var( --wp--preset--font-family--body );
}

.celsyn-cc__launcher {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.85em 1.2em;
	background: var( --wp--preset--color--ink );
	color: var( --wp--preset--color--paper );
	border: 1px solid var( --wp--preset--color--ink );
	border-radius: 999px;
	font-family: var( --wp--preset--font-family--body );
	font-size: var( --wp--preset--font-size--small );
	font-weight: 600;
	letter-spacing: 0.01em;
	cursor: pointer;
	box-shadow: 0 6px 20px rgb( 18 22 31 / 0.22 );
	transition: background-color 180ms ease, transform 180ms ease;
}
.celsyn-cc__launcher:hover,
.celsyn-cc__launcher:focus-visible {
	background: var( --wp--preset--color--accent );
	border-color: var( --wp--preset--color--accent );
	transform: translateY( -1px );
}
.celsyn-cc__launcher:focus-visible {
	outline: 2px solid var( --wp--preset--color--accent-cyan );
	outline-offset: 2px;
}
.celsyn-cc__launcher-icon {
	display: inline-flex;
	color: var( --wp--preset--color--accent-cyan );
}
.celsyn-cc.is-open .celsyn-cc__launcher {
	display: none;
}

.celsyn-cc__panel {
	position: fixed;
	right: 1.25rem;
	bottom: 1.25rem;
	width: min( 380px, calc( 100vw - 2rem ) );
	max-height: min( 640px, calc( 100vh - 2rem ) );
	display: flex;
	flex-direction: column;
	background: var( --wp--preset--color--paper );
	color: var( --wp--preset--color--ink );
	border: 1px solid var( --celsyn-hairline-strong, rgb( 18 22 31 / 0.16 ) );
	border-radius: 10px;
	box-shadow: 0 20px 60px rgb( 18 22 31 / 0.28 );
	overflow: hidden;
	animation: celsyn-cc-in 180ms ease;
}
/* The [hidden] attribute drives open/close (celsyn-cc.js toggles it) — this
   must win over the unconditional `display: flex` above, since an author
   class selector otherwise overrides the UA [hidden] rule at equal
   specificity and the panel would stay visibly in flow. */
.celsyn-cc__panel[hidden] {
	display: none;
}
@media ( prefers-reduced-motion: reduce ) {
	.celsyn-cc__panel { animation: none; }
}
@keyframes celsyn-cc-in {
	from { opacity: 0; transform: translateY( 8px ); }
	to   { opacity: 1; transform: translateY( 0 ); }
}

.celsyn-cc__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.9rem 1.1rem;
	background: var( --wp--preset--color--ink );
	color: var( --wp--preset--color--paper );
	flex: 0 0 auto;
}
.celsyn-cc__title {
	margin: 0;
	font-family: var( --wp--preset--font-family--display );
	font-size: var( --wp--preset--font-size--medium );
}
.celsyn-cc__close {
	appearance: none;
	background: none;
	border: 0;
	color: var( --wp--preset--color--paper );
	font-size: 1.4rem;
	line-height: 1;
	cursor: pointer;
	padding: 0.2rem 0.4rem;
	border-radius: 4px;
}
.celsyn-cc__close:hover,
.celsyn-cc__close:focus-visible {
	color: var( --wp--preset--color--accent-cyan );
}
.celsyn-cc__close:focus-visible {
	outline: 2px solid var( --wp--preset--color--accent-cyan );
	outline-offset: 2px;
}

.celsyn-cc__intro {
	margin: 0;
	padding: 0.85rem 1.1rem 0;
	font-size: var( --wp--preset--font-size--small );
	color: var( --wp--preset--color--warm-grey );
	flex: 0 0 auto;
}

.celsyn-cc__thread {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 0.85rem 1.1rem;
	display: flex;
	flex-direction: column;
	gap: 0.7rem;
	min-height: 80px;
}
.celsyn-cc__msg p {
	margin: 0;
	font-size: var( --wp--preset--font-size--small );
	line-height: 1.5;
	padding: 0.6em 0.85em;
	border-radius: 8px;
	max-width: 88%;
}
.celsyn-cc__msg--visitor {
	display: flex;
	justify-content: flex-end;
}
.celsyn-cc__msg--visitor p {
	background: var( --wp--preset--color--ink );
	color: var( --wp--preset--color--paper );
	border-bottom-right-radius: 2px;
}
.celsyn-cc__msg--concierge p {
	background: var( --celsyn-product-surface, #F8F7F4 );
	color: var( --wp--preset--color--ink );
	border-bottom-left-radius: 2px;
}
.celsyn-cc__links {
	margin: 0.35rem 0 0;
	font-size: var( --wp--preset--font-size--x-small );
}
.celsyn-cc__links a {
	color: var( --wp--preset--color--accent );
}
.celsyn-cc__offer {
	display: block;
	margin-top: 0.5rem;
	padding: 0.5em 0.9em;
	background: var( --wp--preset--color--paper );
	color: var( --wp--preset--color--ink );
	border: 1px solid var( --celsyn-hairline-strong );
	border-radius: 4px;
	font-family: var( --wp--preset--font-family--body );
	font-size: var( --wp--preset--font-size--x-small );
	font-weight: 600;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	cursor: pointer;
}
.celsyn-cc__offer:hover,
.celsyn-cc__offer:focus-visible {
	background: var( --wp--preset--color--ink );
	color: var( --wp--preset--color--paper );
}

.celsyn-cc__lead {
	flex: 0 0 auto;
	max-height: 60vh;
	overflow-y: auto;
	padding: 0.85rem 1.1rem;
	border-top: 1px solid var( --celsyn-hairline );
	background: #fff;
}
.celsyn-cc__lead .celsyn-form {
	max-width: none;
	gap: 0.6rem;
}
.celsyn-cc__lead .celsyn-form__row label {
	font-size: var( --wp--preset--font-size--x-small );
}
.celsyn-cc__lead .celsyn-form__row input,
.celsyn-cc__lead .celsyn-form__row select,
.celsyn-cc__lead .celsyn-form__row textarea {
	font-size: var( --wp--preset--font-size--small );
	padding: 0.55em 0.7em;
}
.celsyn-cc__lead-status {
	margin: 0.6rem 0 0;
	font-size: var( --wp--preset--font-size--x-small );
}
.celsyn-cc__lead-status--ok {
	color: var( --wp--preset--color--accent );
}
.celsyn-cc__lead-status--error {
	color: var( --celsyn-error );
}

.celsyn-cc__composer {
	flex: 0 0 auto;
	display: flex;
	gap: 0.5rem;
	padding: 0.75rem 1.1rem 1rem;
	border-top: 1px solid var( --celsyn-hairline );
}
.celsyn-cc__composer input {
	flex: 1 1 auto;
	padding: 0.6em 0.8em;
	border: 1px solid var( --celsyn-hairline-strong );
	border-radius: 6px;
	font-family: var( --wp--preset--font-family--body );
	font-size: var( --wp--preset--font-size--small );
}
.celsyn-cc__composer input:focus-visible {
	outline: 2px solid var( --wp--preset--color--accent );
	outline-offset: 1px;
}
.celsyn-cc__composer button {
	appearance: none;
	padding: 0.6em 1.1em;
	background: var( --wp--preset--color--ink );
	color: var( --wp--preset--color--paper );
	border: 0;
	border-radius: 6px;
	font-family: var( --wp--preset--font-family--body );
	font-size: var( --wp--preset--font-size--small );
	font-weight: 600;
	cursor: pointer;
}
.celsyn-cc__composer button:hover,
.celsyn-cc__composer button:focus-visible {
	background: var( --wp--preset--color--accent );
}
.celsyn-cc__composer button:focus-visible {
	outline: 2px solid var( --wp--preset--color--accent-cyan );
	outline-offset: 2px;
}

@media ( max-width: 479.98px ) {
	.celsyn-cc {
		right: 0.75rem;
		bottom: 0.75rem;
	}
	.celsyn-cc__panel {
		right: 0.5rem;
		left: 0.5rem;
		bottom: 0.5rem;
		width: auto;
		max-height: calc( 100vh - 1rem );
	}
	.celsyn-cc__launcher-label {
		display: none;
	}
	.celsyn-cc__launcher {
		padding: 0.85em;
		border-radius: 50%;
	}
}

/* UI/UX polish (2026-09-13): on a PDP, the mobile sticky Add-to-Cart bar
   (.celsyn-sticky-cart, assets/css/woocommerce.css) sits fixed along the
   very bottom edge too — lift the launcher clear of it below the breakpoint
   where that bar is actually visible, so neither ever covers the other. */
@media ( max-width: 899.98px ) {
	body:has( .celsyn-sticky-cart ) .celsyn-cc {
		bottom: calc( 1.25rem + 64px + env( safe-area-inset-bottom, 0px ) );
	}
}
@media ( max-width: 479.98px ) {
	body:has( .celsyn-sticky-cart ) .celsyn-cc {
		bottom: calc( 0.75rem + 64px + env( safe-area-inset-bottom, 0px ) );
	}
}
