/**
 * CabinConnect Pro — Live Chat panel.
 *
 * Two things this file has to survive:
 *
 * 1. THE HOST THEME. This widget is dropped into someone else's stylesheet.
 *    Themes routinely style every `button` and `input` on the page, which is
 *    how the send button ended up tan with an invisible tan icon. Everything
 *    below therefore goes through a reset first, and component rules are
 *    written as `.ccl .ccl-thing` (0,2,0) so an ordinary theme selector like
 *    `.elementor button` (0,1,1) cannot outrank them.
 *
 * 2. THE `hidden` ATTRIBUTE. The browser's own `[hidden] { display: none }`
 *    is a UA rule and loses to ANY author class rule that sets display — so
 *    `.ccl-panel { display: flex }` silently defeated `panel.hidden = true`
 *    and the panel could never be closed. The rule near the top of this file
 *    is what makes hiding work; do not remove it.
 */

/* ── Reset ─────────────────────────────────────────────────────────────── */

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

/* THE FIX for the close button. Must beat every display rule below. */
.ccl [hidden] { display: none !important; }

.ccl button {
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	box-shadow: none;
	font: inherit;
	line-height: inherit;
	letter-spacing: normal;
	text-transform: none;
	text-shadow: none;
	min-width: 0;
	min-height: 0;
	width: auto;
	height: auto;
	color: inherit;
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
}

.ccl input,
.ccl textarea {
	margin: 0;
	font: inherit;
	line-height: inherit;
	letter-spacing: normal;
	text-transform: none;
	box-shadow: none;
	-webkit-appearance: none;
	appearance: none;
}

.ccl p,
.ccl div,
.ccl span { margin: 0; }

/* ── Tokens ────────────────────────────────────────────────────────────── */

.ccl {
	/* --ccl-accent is written inline by chat.js from the admin setting. */
	--ccl-accent: #2f5d4f;
	--ccl-ink: #12181a;
	--ccl-ink-2: #4a5560;
	--ccl-ink-3: #78838d;

	/* Frosted surfaces. Translucent so whatever is behind shows through as a
	   soft wash rather than a flat panel sitting on top of the page. */
	--ccl-glass: rgba(252, 253, 253, .82);
	--ccl-glass-2: rgba(255, 255, 255, .66);
	--ccl-hairline: rgba(16, 24, 28, .09);
	--ccl-inner-light: rgba(255, 255, 255, .9);

	/* Layered rather than one big blur — a close contact shadow for the edge,
	   a wide soft one for lift. A single shadow always reads as cheap. */
	--ccl-shadow:
		0 0 0 .5px rgba(16, 24, 28, .06),
		0 1px 2px rgba(16, 24, 28, .05),
		0 8px 20px -8px rgba(16, 24, 28, .16),
		0 28px 56px -22px rgba(16, 24, 28, .3);

	position: fixed;
	/* Overridden by --ccl-offset-bottom, written inline from the setting. */
	bottom: var(--ccl-offset-bottom, 22px);
	z-index: 99990;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 12px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", sans-serif;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.5;
	letter-spacing: -0.005em;
	color: var(--ccl-ink);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

.ccl-right { right: 22px; }
.ccl-left  { left: 22px; align-items: flex-start; }

/* ── Launcher ──────────────────────────────────────────────────────────── */

.ccl .ccl-launcher {
	position: relative;
	display: inline-flex;
	align-items: center;
	/* 2.68.0: enlarged at the client's request — visitors were missing it.
	   Up from 12/18 padding and 14px text. Kept as a pill with the label
	   rather than growing into a bare circle: "Questions? Chat with us" is
	   what makes people click, and an icon alone reads as decoration. */
	gap: 12px;
	padding: 19px 32px;
	border-radius: 999px;
	background:
		linear-gradient(180deg,
			color-mix(in srgb, var(--ccl-accent) 88%, white) 0%,
			var(--ccl-accent) 100%);
	color: #fff;
	font-size: 17px;
	font-weight: 700;
	letter-spacing: -0.01em;
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, .22),
		0 1px 2px rgba(16, 24, 28, .12),
		0 8px 18px -6px color-mix(in srgb, var(--ccl-accent) 55%, transparent);
	transition: transform .22s cubic-bezier(.2, .9, .3, 1), box-shadow .22s ease;
}

@supports not (background: color-mix(in srgb, red 50%, white)) {
	.ccl .ccl-launcher { background: var(--ccl-accent); }
}

/* Radius restated on every interactive state. A theme that squares off its
   own buttons on hover/focus would otherwise turn the pill into a box mid
   interaction, which is exactly what it did. */
.ccl .ccl-launcher,
.ccl .ccl-launcher:hover,
.ccl .ccl-launcher:focus,
.ccl .ccl-launcher:focus-visible,
.ccl .ccl-launcher:active { border-radius: 999px; }

.ccl .ccl-launcher:hover {
	/* Warm gold on the label — the site's own accent, so the hover reads as
	   part of the brand rather than a generic lift. */
	color: var(--ccl-launcher-hover, #f2d492);
	transform: translateY(-2px);
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, .28),
		0 2px 4px rgba(16, 24, 28, .12),
		0 14px 28px -8px color-mix(in srgb, var(--ccl-accent) 60%, transparent);
}

/* The icon is currentColor, so it warms with the label. */
.ccl .ccl-launcher:hover svg { color: var(--ccl-launcher-hover, #f2d492); }

.ccl .ccl-launcher:active { transform: translateY(0) scale(.985); }

.ccl .ccl-launcher svg { width: 24px; height: 24px; flex: none; display: block; }

.ccl .ccl-launcher-text { white-space: nowrap; }

.ccl .ccl-launcher:focus-visible,
.ccl .ccl-close:focus-visible,
.ccl .ccl-send:focus-visible,
.ccl .ccl-contact-go:focus-visible,
.ccl .ccl-skip:focus-visible {
	outline: 2px solid var(--ccl-accent);
	outline-offset: 3px;
}

.ccl .ccl-badge {
	position: absolute;
	top: -3px;
	inset-inline-end: -3px;
	min-width: 19px;
	height: 19px;
	padding: 0 5px;
	border-radius: 10px;
	background: #e5484d;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 19px;
	text-align: center;
	box-shadow: 0 0 0 2px rgba(255, 255, 255, .9);
}

/* Once the panel is open the label has done its job. */
.ccl-is-open .ccl-launcher-text { display: none; }
.ccl-is-open .ccl-launcher { padding: 12px; }

/* ── Panel ─────────────────────────────────────────────────────────────── */

.ccl .ccl-panel {
	width: 352px;
	max-width: calc(100vw - 32px);
	height: 468px;
	max-height: calc(100vh - 130px);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: 18px;
	background: var(--ccl-glass);
	box-shadow: var(--ccl-shadow);
	animation: ccl-in .28s cubic-bezier(.2, .9, .3, 1);
	transform-origin: bottom right;
}

.ccl-left .ccl-panel { transform-origin: bottom left; }

/* The frosted effect proper. Behind a @supports so browsers without it get a
   solid panel rather than an unreadable translucent one. */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
	.ccl .ccl-panel {
		background: rgba(250, 252, 252, .72);
		-webkit-backdrop-filter: blur(28px) saturate(180%);
		backdrop-filter: blur(28px) saturate(180%);
	}
}

@keyframes ccl-in {
	from { opacity: 0; transform: translateY(12px) scale(.97); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
	.ccl .ccl-panel { animation: none; }
	.ccl .ccl-launcher { transition: none; }
}

/* ── Header ────────────────────────────────────────────────────────────── */

.ccl .ccl-head {
	position: relative;
	display: flex;
	align-items: center;
	gap: 9px;
	padding: 13px 14px 13px 16px;
	flex: none;
	color: #fff;
	background:
		linear-gradient(180deg,
			color-mix(in srgb, var(--ccl-accent) 92%, white) 0%,
			var(--ccl-accent) 100%);
	box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .06);
}

@supports not (background: color-mix(in srgb, red 50%, white)) {
	.ccl .ccl-head { background: var(--ccl-accent); }
}

.ccl .ccl-head-text { flex: 1; min-width: 0; }

.ccl .ccl-title {
	font-size: 14.5px;
	font-weight: 600;
	letter-spacing: -0.012em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ccl .ccl-sub {
	font-size: 12px;
	font-weight: 400;
	line-height: 1.35;
	margin-top: 1px;
	color: rgba(255, 255, 255, .8);
}

/* Presence dot with a soft halo — reads as "live" rather than decorative. */
.ccl .ccl-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	flex: none;
	background: rgba(255, 255, 255, .4);
}

.ccl .ccl-dot-on {
	background: #4ade80;
	box-shadow: 0 0 0 3px rgba(74, 222, 128, .22);
}

.ccl .ccl-close {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: 8px;
	color: #fff;
	opacity: .78;
	transition: background .16s ease, opacity .16s ease;
}

.ccl .ccl-close:hover {
	opacity: 1;
	background: rgba(255, 255, 255, .16);
}

.ccl .ccl-close svg { width: 16px; height: 16px; display: block; }

/* ── Log ───────────────────────────────────────────────────────────────── */

.ccl .ccl-log {
	flex: 1;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 16px 14px;
	display: flex;
	flex-direction: column;
	gap: 9px;
	background: transparent;
	scrollbar-width: thin;
	scrollbar-color: rgba(16, 24, 28, .18) transparent;
}

.ccl .ccl-log::-webkit-scrollbar { width: 6px; }
.ccl .ccl-log::-webkit-scrollbar-thumb {
	background: rgba(16, 24, 28, .16);
	border-radius: 3px;
}
.ccl .ccl-log::-webkit-scrollbar-track { background: transparent; }

.ccl .ccl-row { display: flex; }
.ccl .ccl-row-guest { justify-content: flex-end; }

.ccl .ccl-bubble {
	max-width: 84%;
	padding: 9px 12px;
	border-radius: 15px;
	font-size: 13.5px;
	line-height: 1.48;
	word-wrap: break-word;
	overflow-wrap: anywhere;
	background: var(--ccl-glass-2);
	border: .5px solid var(--ccl-hairline);
	box-shadow:
		inset 0 .5px 0 var(--ccl-inner-light),
		0 1px 2px rgba(16, 24, 28, .04);
}

.ccl .ccl-row-guest .ccl-bubble {
	background:
		linear-gradient(180deg,
			color-mix(in srgb, var(--ccl-accent) 90%, white) 0%,
			var(--ccl-accent) 100%);
	border-color: transparent;
	color: #fff;
	border-bottom-right-radius: 5px;
	box-shadow:
		inset 0 .5px 0 rgba(255, 255, 255, .2),
		0 1px 3px color-mix(in srgb, var(--ccl-accent) 30%, transparent);
}

@supports not (background: color-mix(in srgb, red 50%, white)) {
	.ccl .ccl-row-guest .ccl-bubble { background: var(--ccl-accent); }
}

.ccl .ccl-row-bot .ccl-bubble,
.ccl .ccl-row-staff .ccl-bubble { border-bottom-left-radius: 5px; }

.ccl .ccl-row-failed .ccl-bubble { opacity: .5; }

.ccl .ccl-author {
	display: block;
	margin-bottom: 2px;
	font-size: 10.5px;
	font-weight: 700;
	letter-spacing: .05em;
	text-transform: uppercase;
	color: var(--ccl-accent);
}

.ccl .ccl-text { white-space: pre-wrap; }

.ccl .ccl-note {
	align-self: center;
	max-width: 90%;
	padding: 5px 11px;
	border-radius: 999px;
	background: rgba(16, 24, 28, .045);
	font-size: 11.5px;
	line-height: 1.4;
	text-align: center;
	color: var(--ccl-ink-3);
}

/* Typing indicator */
.ccl .ccl-typing .ccl-bubble {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 12px 14px;
}

.ccl .ccl-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--ccl-ink-3);
	animation: ccl-blink 1.25s infinite ease-in-out;
}

.ccl .ccl-typing .ccl-dot-2 { animation-delay: .16s; }
.ccl .ccl-typing .ccl-dot-3 { animation-delay: .32s; }

@keyframes ccl-blink {
	0%, 60%, 100% { opacity: .22; transform: translateY(0); }
	30%           { opacity: .9; transform: translateY(-2px); }
}

@media (prefers-reduced-motion: reduce) {
	.ccl .ccl-typing span { animation: none; opacity: .5; }
}

/* ── Contact form ──────────────────────────────────────────────────────── */

.ccl .ccl-contact {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 14px;
	border-radius: 14px;
	background: var(--ccl-glass-2);
	border: .5px solid var(--ccl-hairline);
	box-shadow:
		inset 0 .5px 0 var(--ccl-inner-light),
		0 2px 8px -2px rgba(16, 24, 28, .07);
}

.ccl .ccl-field {
	width: 100%;
	padding: 10px 12px;
	border-radius: 10px;
	border: 1px solid var(--ccl-hairline);
	background: rgba(255, 255, 255, .92);
	color: var(--ccl-ink);
	/* 16px stops iOS zooming the whole page when the field takes focus. */
	font-size: 16px;
	line-height: 1.3;
	transition: border-color .16s ease, box-shadow .16s ease;
}

.ccl .ccl-field::placeholder { color: var(--ccl-ink-3); }

.ccl .ccl-field:focus {
	outline: none;
	border-color: var(--ccl-accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--ccl-accent) 16%, transparent);
}

.ccl .ccl-contact-go {
	padding: 10px 14px;
	border-radius: 10px;
	background: var(--ccl-accent);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	box-shadow: 0 1px 2px rgba(16, 24, 28, .1);
	transition: filter .16s ease;
}

.ccl .ccl-contact-go:hover { filter: brightness(1.08); }
.ccl .ccl-contact-go[disabled] { opacity: .55; cursor: default; }

.ccl .ccl-skip {
	align-self: center;
	padding: 2px;
	color: var(--ccl-ink-3);
	font-size: 12.5px;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.ccl .ccl-error {
	color: #c62828;
	font-size: 12.5px;
	line-height: 1.4;
}

/* ── Composer ──────────────────────────────────────────────────────────── */

.ccl .ccl-composer {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 11px;
	flex: none;
	background: rgba(255, 255, 255, .55);
	box-shadow: inset 0 .5px 0 rgba(16, 24, 28, .07);
}

.ccl .ccl-input {
	flex: 1;
	min-width: 0;
	resize: none;
	max-height: 104px;
	padding: 10px 13px;
	border-radius: 13px;
	border: 1px solid var(--ccl-hairline);
	background: rgba(255, 255, 255, .95);
	color: var(--ccl-ink);
	font-size: 16px;   /* see note on .ccl-field */
	line-height: 1.4;
	transition: border-color .16s ease, box-shadow .16s ease;
}

.ccl .ccl-input::placeholder { color: var(--ccl-ink-3); }

.ccl .ccl-input:focus {
	outline: none;
	border-color: color-mix(in srgb, var(--ccl-accent) 55%, transparent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--ccl-accent) 13%, transparent);
}

.ccl .ccl-send {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 12px;
	/* Explicit, and specific enough to beat a theme's own button colours —
	   this is what made the icon invisible: tan on tan. */
	background: var(--ccl-accent);
	color: #fff;
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, .18),
		0 1px 3px color-mix(in srgb, var(--ccl-accent) 35%, transparent);
	transition: filter .16s ease, transform .12s ease;
}

.ccl .ccl-send,
.ccl .ccl-send:hover,
.ccl .ccl-send:focus,
.ccl .ccl-send:active { border-radius: 12px; }

.ccl .ccl-send:hover { filter: brightness(1.1); }
.ccl .ccl-send:active { transform: scale(.94); }
.ccl .ccl-send[disabled] { opacity: .45; cursor: default; }

.ccl .ccl-send svg {
	width: 17px;
	height: 17px;
	display: block;
	/* Belt and braces: the icon must never inherit a theme text colour. */
	fill: #fff;
	stroke: none;
}

/* ── Phones ────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
	.ccl { bottom: 14px; gap: 10px; }
	.ccl-right { right: 14px; }
	.ccl-left  { left: 14px; }

	.ccl .ccl-panel {
		width: calc(100vw - 24px);
		height: min(72vh, 500px);
		border-radius: 16px;
	}

	.ccl .ccl-launcher-text { display: none; }
	.ccl .ccl-launcher { padding: 13px; }
}

/* ── Dark host pages ───────────────────────────────────────────────────── */
/* The panel floats over whatever the site is. On a site that opts into dark
   mode the frosted white would glare, so the glass darkens instead. */
@media (prefers-color-scheme: dark) {
	.ccl {
		--ccl-ink: #eef2f3;
		--ccl-ink-2: #b3bdc4;
		--ccl-ink-3: #8b959c;
		--ccl-glass: rgba(28, 33, 36, .88);
		--ccl-glass-2: rgba(255, 255, 255, .07);
		--ccl-hairline: rgba(255, 255, 255, .12);
		--ccl-inner-light: rgba(255, 255, 255, .06);
	}

	@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
		.ccl .ccl-panel { background: rgba(24, 29, 32, .74); }
	}

	.ccl .ccl-field,
	.ccl .ccl-input {
		background: rgba(255, 255, 255, .07);
		color: var(--ccl-ink);
	}

	.ccl .ccl-composer { background: rgba(255, 255, 255, .04); }
	.ccl .ccl-note { background: rgba(255, 255, 255, .07); }
	.ccl .ccl-author { color: color-mix(in srgb, var(--ccl-accent) 45%, white); }
}
