/*
 * Ask Las Cruces chat widget styles. Everything is scoped under
 * .clc-chat-launcher and .clc-chat-panel so it cannot leak into the
 * Impreza/WPBakery theme, and inherits the site's font stack.
 */

.clc-chat-launcher,
.clc-chat-panel {
	font-family: inherit;
	box-sizing: border-box;
}

.clc-chat-launcher *,
.clc-chat-panel * {
	box-sizing: border-box;
}

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

.clc-chat-launcher {
	position: fixed;
	right: 100px;
	bottom: 20px;
	width: 56px;
	height: 56px;
	min-width: 48px;
	min-height: 48px;
	border: 0;
	border-radius: 50%;
	background: #17537b;
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 2px 10px rgba( 0, 0, 0, 0.3 );
	z-index: 999999;
	padding: 0;
}

.clc-chat-launcher:hover {
	background: #123f5c;
}

.clc-chat-launcher:active {
	background: #0e3349;
}

.clc-chat-launcher svg {
	width: 26px;
	height: 26px;
	display: block;
	fill: currentColor;
}

.clc-chat-launcher-logo {
	width: 40px;
	height: 40px;
	max-width: none;
	object-fit: contain;
	display: block;
	border-radius: 50%;
	box-shadow: none;
}

.clc-chat-launcher:focus-visible {
	outline: 2px solid #ffffff;
	outline-offset: 2px;
	box-shadow: 0 0 0 4px #17537b, 0 2px 10px rgba( 0, 0, 0, 0.3 );
}

/* ---------- Panel shell and theming ---------- */

.clc-chat-panel {
	--clc-canvas: #1ea7e8;
	--clc-canvas-dark: #0b2f4e;
	--clc-canvas-dark-end: #123c63;
	--clc-bot-bubble: #ffffff;
	--clc-bot-text: #1c4359;
	--clc-user-bubble: #1773ac;
	--clc-user-text: #ffffff;
	--clc-link: #1773ac;
	--clc-link-dark: #7cc8f0;
	--clc-timestamp: #767676;
	--clc-header-bg: #17537b;
	--clc-composer-bg: #f0f4f7;
	--clc-focus: #17537b;

	position: fixed;
	right: 100px;
	bottom: 88px;
	width: 400px;
	height: 600px;
	max-height: calc( 100vh - 108px );
	display: none;
	flex-direction: column;
	background: var( --clc-canvas );
	color: var( --clc-bot-text );
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 8px 30px rgba( 0, 0, 0, 0.35 );
	z-index: 999998;
	font-size: 15px;
}

.clc-chat-panel[data-font-scale="125"] {
	font-size: 18.75px;
}

.clc-chat-panel[data-font-scale="150"] {
	font-size: 22.5px;
}

.clc-chat-panel.is-open {
	display: flex;
}

.clc-chat-panel[data-theme="dark"] {
	--clc-bot-bubble: #1a3a5c;
	--clc-bot-text: #eef4f9;
	--clc-timestamp: #b7c6d3;
	--clc-link: #7cc8f0;
	--clc-focus: #ffffff;
	background: linear-gradient( 180deg, var( --clc-canvas-dark ), var( --clc-canvas-dark-end ) );
}

@media ( max-width: 640px ) {
	.clc-chat-panel {
		right: 0;
		bottom: 0;
		width: 100vw;
		height: 100vh;
		max-height: 100vh;
		border-radius: 0;
	}
}

.clc-chat-panel :focus-visible {
	outline: 2px solid var( --clc-focus );
	outline-offset: 2px;
}

/* ---------- Skip link ---------- */

.clc-chat-skip-link {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect( 1px, 1px, 1px, 1px );
	clip-path: inset( 50% );
}

.clc-chat-skip-link:focus {
	position: static;
	width: auto;
	height: auto;
	overflow: visible;
	clip: auto;
	clip-path: none;
	display: block;
	padding: 8px 16px;
	background: var( --clc-header-bg );
	color: #ffffff;
	text-align: center;
	text-decoration: underline;
}

/* ---------- Header ---------- */

.clc-chat-header {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 10px 12px;
	background: var( --clc-header-bg );
	color: #ffffff;
}

.clc-chat-header h2 {
	margin: 0;
	font-size: 1.05em;
	font-weight: 600;
	line-height: 1.2;
	color: #ffffff !important;
}

.clc-chat-header-controls {
	display: flex;
	align-items: center;
	gap: 2px;
	flex-wrap: nowrap;
}

.clc-chat-header-controls button,
.clc-chat-close {
	min-width: 32px;
	min-height: 32px;
	padding: 4px;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	font-size: 0.75em;
	font-weight: 700;
	line-height: 1;
}

.clc-chat-header-controls button:hover,
.clc-chat-close:hover {
	background: rgba( 255, 255, 255, 0.15 );
}

.clc-chat-header-controls button:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.clc-chat-header-controls svg,
.clc-chat-close svg {
	width: 18px;
	height: 18px;
	display: block;
}

.clc-chat-lang-toggle {
	min-width: 36px !important;
}

.clc-chat-header-controls button[aria-pressed="true"] {
	background: rgba( 255, 255, 255, 0.25 );
}

/* ---------- Data notice ---------- */

.clc-chat-notice-modal {
	position: absolute;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba( 0, 0, 0, 0.5 );
	padding: 16px;
	z-index: 5;
}

.clc-chat-notice-modal.is-open {
	display: flex;
}

.clc-chat-notice-modal dialog {
	position: static;
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: 340px;
	overflow-y: auto;
	background: #ffffff;
	color: #1c4359;
	border: 0;
	border-radius: 12px;
	padding: 20px;
	box-shadow: 0 10px 40px rgba( 0, 0, 0, 0.4 );
}

.clc-chat-notice-modal h3 {
	margin: 0 0 12px;
	font-size: 1.05em;
	line-height: 1.3;
}

.clc-chat-notice-body {
	font-size: 0.9em;
	line-height: 1.5;
}

.clc-chat-notice-body ul {
	margin: 0.4em 0 0.8em;
	padding-left: 1.4em;
}

.clc-chat-notice-actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 16px;
}

.clc-chat-notice-acknowledge {
	min-height: 44px;
	border: 0;
	border-radius: 8px;
	background: #1773ac;
	color: #ffffff;
	font-size: 0.95em;
	font-weight: 600;
	cursor: pointer;
}

.clc-chat-notice-acknowledge:hover {
	background: #145e8b;
}

.clc-chat-notice-privacy {
	min-height: 24px;
	text-align: center;
	color: #1773ac;
	text-decoration: underline;
	font-size: 0.9em;
	padding: 4px;
}

/* ---------- Message log ---------- */

.clc-chat-messages {
	position: relative;
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 16px;
	background: transparent;
}

.clc-chat-messages::before {
	content: "";
	position: absolute;
	inset: 0;
	background-image: var( --clc-watermark-url, none );
	background-position: center;
	background-repeat: no-repeat;
	background-size: cover;
	opacity: 0.06;
	pointer-events: none;
}

.clc-chat-message-row {
	position: relative;
	display: flex;
	align-items: flex-end;
	gap: 8px;
	margin-bottom: 14px;
}

.clc-chat-message-row--user {
	justify-content: flex-end;
}

.clc-chat-message-row--bot {
	justify-content: flex-start;
}

.clc-chat-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	flex: 0 0 auto;
	display: block;
	object-fit: cover;
}

.clc-chat-avatar-placeholder {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	flex: 0 0 auto;
	background: #ffffff;
	color: #1773ac;
	display: flex;
	align-items: center;
	justify-content: center;
}

.clc-chat-avatar-placeholder svg {
	width: 20px;
	height: 20px;
}

.clc-chat-message-content {
	display: flex;
	flex-direction: column;
	max-width: 75%;
}

.clc-chat-message-row--user .clc-chat-message-content {
	align-items: flex-end;
}

.clc-chat-message-row--bot .clc-chat-message-content {
	align-items: flex-start;
}

.clc-chat-bubble {
	padding: 10px 14px;
	border-radius: 16px;
	line-height: 1.45;
	word-break: break-word;
	font-size: 0.95em;
}

.clc-chat-message-row--bot .clc-chat-bubble {
	background: var( --clc-bot-bubble );
	color: var( --clc-bot-text );
	border-bottom-left-radius: 4px;
}

.clc-chat-message-row--user .clc-chat-bubble {
	background: var( --clc-user-bubble );
	color: var( --clc-user-text );
	border-bottom-right-radius: 4px;
}

.clc-chat-bubble a {
	color: var( --clc-link );
	text-decoration: underline;
	text-decoration-thickness: 1px;
}

.clc-chat-message-row--user .clc-chat-bubble a {
	color: #ffffff;
}

.clc-chat-external-icon {
	width: 12px;
	height: 12px;
	margin-left: 2px;
	vertical-align: middle;
	display: inline-block;
}

.clc-chat-timestamp {
	display: block;
	font-size: 0.72em;
	color: var( --clc-timestamp );
	margin-top: 4px;
	text-align: right;
}

.clc-chat-message-row--user .clc-chat-timestamp {
	color: rgba( 255, 255, 255, 0.85 );
	margin-top: 2px;
}

.clc-chat-notice {
	margin: 0 0 14px;
	padding: 10px 12px;
	border-radius: 10px;
	background: rgba( 255, 255, 255, 0.9 );
	color: #7a1f1f;
	font-size: 0.88em;
	line-height: 1.4;
}

.clc-chat-notice-retry {
	margin-top: 8px;
	min-height: 32px;
	padding: 4px 12px;
	border: 1px solid #7a1f1f;
	border-radius: 6px;
	background: transparent;
	color: #7a1f1f;
	cursor: pointer;
	font-size: 0.9em;
}

/* ---------- Typing indicator ---------- */

.clc-chat-typing {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 0 16px 8px;
}

.clc-chat-typing[hidden] {
	display: none;
}

.clc-chat-typing-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var( --clc-bot-bubble );
	opacity: 0.5;
	animation: clc-chat-typing-bounce 1.1s ease-in-out infinite;
}

.clc-chat-typing-dot:nth-child( 2 ) {
	animation-delay: 0.15s;
}

.clc-chat-typing-dot:nth-child( 3 ) {
	animation-delay: 0.3s;
}

@keyframes clc-chat-typing-bounce {
	0%, 80%, 100% {
		opacity: 0.35;
	}
	40% {
		opacity: 1;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.clc-chat-typing-dot {
		animation: none;
		opacity: 0.8;
	}
}

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

.clc-chat-composer {
	flex: 0 0 auto;
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 12px;
	background: var( --clc-composer-bg );
}

.clc-chat-input {
	flex: 1 1 auto;
	resize: none;
	max-height: 120px;
	min-height: 40px;
	border: 1px solid rgba( 0, 0, 0, 0.15 );
	border-radius: 20px;
	padding: 10px 16px;
	font: inherit;
	font-size: 0.95em;
	color: #1c4359;
	background: #ffffff;
}

.clc-chat-input:disabled {
	background: #e6ebee;
	color: #7a8896;
}

.clc-chat-send {
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 10px;
	background: var( --clc-user-bubble );
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

.clc-chat-send:hover {
	background: #145e8b;
}

.clc-chat-send:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.clc-chat-send svg {
	width: 18px;
	height: 18px;
	fill: #ffffff !important;
	display: block;
}

.clc-chat-privacy-row {
	flex: 0 0 auto;
	text-align: center;
	padding: 4px 0 8px;
	background: var( --clc-composer-bg );
}

.clc-chat-privacy-row button {
	min-height: 24px;
	border: 0;
	background: transparent;
	color: #1773ac;
	text-decoration: underline;
	font-size: 0.8em;
	cursor: pointer;
}

.clc-chat-panel[data-theme="dark"] .clc-chat-privacy-row,
.clc-chat-panel[data-theme="dark"] .clc-chat-composer {
	background: #0e2c47;
}

.clc-chat-panel[data-theme="dark"] .clc-chat-privacy-row button {
	color: var( --clc-link-dark );
}

.clc-chat-panel[data-theme="dark"] .clc-chat-input {
	background: #16344f;
	color: #eef4f9;
	border-color: rgba( 255, 255, 255, 0.2 );
}

.clc-chat-panel[data-theme="dark"] .clc-chat-input:disabled {
	background: #0e2c47;
	color: #7d93a5;
}

/* ---------- Contact footer ---------- */

.clc-chat-contact {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	padding: 8px 12px;
	background: var( --clc-header-bg );
	color: #ffffff;
	font-size: 0.85em;
}

.clc-chat-contact-links {
	display: flex;
	align-items: center;
	gap: 4px;
	flex-wrap: wrap;
}

.clc-chat-contact-links a {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #ffffff;
	background: rgba( 255, 255, 255, 0.12 );
}

.clc-chat-contact-links a:hover {
	background: rgba( 255, 255, 255, 0.25 );
}

.clc-chat-contact-links svg {
	width: 18px;
	height: 18px;
}

/* ---------- Utility ---------- */

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect( 1px, 1px, 1px, 1px );
	clip-path: inset( 50% );
	word-wrap: normal !important;
}
