/* ==========================================================================
   Coral Capital assistant — chat widget
   Inherits the site's brand tokens when the site template plugin is active,
   and falls back to the same values when it is not.
   ========================================================================== */

.cca-root {
	--cca-navy: var(--ccp-navy, #0B2239);
	--cca-navy-900: #071726;
	--cca-coral: var(--ccp-coral, #E2725B);
	--cca-coral-dark: #C4553E;
	--cca-marine: var(--ccp-marine, #0E6E7A);
	--cca-ink: #16232D;
	--cca-muted: #5D6E7B;
	--cca-line: #DCE4EA;
	--cca-mist: #F2F5F8;

	--cca-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--cca-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 99998;
	font-family: var(--cca-body);
	font-size: 15px;
	line-height: 1.55;
}

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

/* The panel sets display:flex, which would otherwise beat the browser's
   [hidden] { display: none } and leave an invisible panel swallowing clicks
   across the page. These rules are more specific, so hidden really hides. */
.cca-root[hidden],
.cca-root [hidden] { display: none !important; }

.cca-root .screen-reader-text {
	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 ---------------------------------------------------------------- */

.cca-launcher {
	position: relative;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	border: 0;
	background: var(--cca-navy);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 12px rgba(11, 34, 57, .22), 0 12px 32px rgba(11, 34, 57, .18);
	transition: transform .2s ease, background-color .2s ease;
	margin-left: auto;
}
.cca-launcher:hover { transform: translateY(-2px); background: #10304d; }
.cca-launcher:focus-visible { outline: 3px solid var(--cca-coral); outline-offset: 3px; }

.cca-launcher svg { width: 26px; height: 26px; }
.cca-launcher__close { display: none; }
.cca-root.is-open .cca-launcher__icon { display: none; }
.cca-root.is-open .cca-launcher__close { display: block; }

/* Teaser ------------------------------------------------------------------ */

.cca-teaser {
	position: absolute;
	right: 74px;
	bottom: 8px;
	width: 236px;
	background: #fff;
	border: 1px solid var(--cca-line);
	border-radius: 10px;
	padding: 14px 30px 14px 16px;
	box-shadow: 0 6px 24px rgba(11, 34, 57, .16);
	cursor: pointer;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity .25s ease, transform .25s ease;
}
.cca-teaser.is-visible { opacity: 1; transform: none; }
.cca-teaser__text { margin: 0; font-size: 14px; color: var(--cca-ink); }
.cca-teaser__dismiss {
	position: absolute;
	top: 4px;
	right: 8px;
	background: none;
	border: 0;
	font-size: 18px;
	line-height: 1;
	color: var(--cca-muted);
	cursor: pointer;
	padding: 2px 4px;
}
.cca-teaser__dismiss:hover { color: var(--cca-ink); }

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

.cca-panel {
	position: absolute;
	right: 0;
	bottom: 76px;
	width: 396px;
	max-width: calc(100vw - 32px);
	height: 580px;
	max-height: calc(100vh - 120px);
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 8px 24px rgba(11, 34, 57, .16), 0 24px 64px rgba(11, 34, 57, .22);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(12px) scale(.98);
	transform-origin: bottom right;
	transition: opacity .22s ease, transform .22s ease;
}
.cca-panel.is-visible { opacity: 1; transform: none; }

.cca-panel__head {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 16px 16px 18px;
	background: var(--cca-navy);
	color: #fff;
	flex: none;
}
.cca-panel__mark { width: 30px; height: 30px; flex: none; color: #fff; }
.cca-panel__mark svg { width: 100%; height: 100%; }
.cca-panel__titles { display: flex; flex-direction: column; line-height: 1.3; margin-right: auto; }
.cca-panel__title { font-weight: 600; font-size: 15px; }
.cca-panel__subtitle { font-size: 12px; color: rgba(255, 255, 255, .66); }
.cca-panel__close {
	background: none;
	border: 0;
	color: rgba(255, 255, 255, .8);
	cursor: pointer;
	padding: 6px;
	border-radius: 4px;
	display: flex;
}
.cca-panel__close:hover { color: #fff; background: rgba(255, 255, 255, .12); }
.cca-panel__close svg { width: 20px; height: 20px; }

/* Log --------------------------------------------------------------------- */

.cca-log {
	flex: 1;
	overflow-y: auto;
	padding: 20px 18px 6px;
	background: var(--cca-mist);
	scroll-behavior: smooth;
}

.cca-msg { margin-bottom: 16px; max-width: 88%; }
.cca-msg--user { margin-left: auto; }

.cca-msg__who {
	display: block;
	font-family: var(--cca-mono);
	font-size: 10px;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--cca-muted);
	margin-bottom: 5px;
}
.cca-msg--user .cca-msg__who { text-align: right; }

.cca-msg__body {
	background: #fff;
	border: 1px solid var(--cca-line);
	border-radius: 10px 10px 10px 2px;
	padding: 12px 14px;
	color: var(--cca-ink);
	font-size: 14.5px;
	overflow-wrap: break-word;
}
.cca-msg--user .cca-msg__body {
	background: var(--cca-navy);
	border-color: var(--cca-navy);
	color: #fff;
	border-radius: 10px 10px 2px 10px;
}

.cca-msg__body p { margin: 0 0 10px; }
.cca-msg__body p:last-child { margin-bottom: 0; }
.cca-msg__body ul { margin: 0 0 10px; padding-left: 18px; }
.cca-msg__body ul:last-child { margin-bottom: 0; }
.cca-msg__body li { margin-bottom: 5px; }
.cca-msg__body a { color: var(--cca-marine); }
.cca-msg--user .cca-msg__body a { color: #fff; }

.cca-dots { display: inline-flex; gap: 4px; align-items: center; padding: 2px 0; }
.cca-dots i {
	width: 6px; height: 6px;
	border-radius: 50%;
	background: var(--cca-muted);
	animation: cca-bounce 1.3s infinite ease-in-out;
}
.cca-dots i:nth-child(2) { animation-delay: .18s; }
.cca-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes cca-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: .45; }
	30% { transform: translateY(-4px); opacity: 1; }
}

.cca-rating {
	display: flex;
	align-items: center;
	gap: 8px;
	justify-content: center;
	font-size: 13px;
	color: var(--cca-muted);
	padding: 8px 0 14px;
}
.cca-rating__btn {
	background: #fff;
	border: 1px solid var(--cca-line);
	border-radius: 6px;
	padding: 4px 9px;
	cursor: pointer;
	font-size: 14px;
	line-height: 1;
}
.cca-rating__btn:hover { border-color: var(--cca-coral); }

/* Chips ------------------------------------------------------------------- */

.cca-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
	padding: 0 18px 12px;
	background: var(--cca-mist);
}
.cca-chips:empty { display: none; }

.cca-chip {
	background: #fff;
	border: 1px solid var(--cca-line);
	border-radius: 999px;
	padding: 7px 13px;
	font-size: 13px;
	font-family: inherit;
	color: var(--cca-navy);
	cursor: pointer;
	transition: border-color .16s ease, background-color .16s ease;
}
.cca-chip:hover { border-color: var(--cca-navy); background: #fff; }

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

.cca-composer {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 12px 14px;
	border-top: 1px solid var(--cca-line);
	background: #fff;
	flex: none;
}

.cca-composer__input {
	flex: 1;
	resize: none;
	border: 1px solid var(--cca-line);
	border-radius: 8px;
	padding: 10px 12px;
	font-family: inherit;
	font-size: 14.5px;
	line-height: 1.45;
	color: var(--cca-ink);
	max-height: 120px;
	background: #fff;
}
.cca-composer__input:focus {
	outline: none;
	border-color: var(--cca-marine);
	box-shadow: 0 0 0 3px rgba(14, 110, 122, .12);
}
.cca-composer__input:disabled { background: var(--cca-mist); }

.cca-composer__send {
	width: 40px;
	height: 40px;
	flex: none;
	border: 0;
	border-radius: 8px;
	background: var(--cca-coral);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color .16s ease;
}
.cca-composer__send:hover:not(:disabled) { background: var(--cca-coral-dark); }
.cca-composer__send:disabled { opacity: .5; cursor: default; }
.cca-composer__send svg { width: 19px; height: 19px; }

.cca-disclaimer {
	margin: 0;
	padding: 0 14px 12px;
	background: #fff;
	font-size: 11px;
	line-height: 1.5;
	color: var(--cca-muted);
	flex: none;
}

/* Responsive -------------------------------------------------------------- */

@media (max-width: 520px) {
	.cca-root { right: 16px; bottom: 16px; }

	.cca-panel {
		position: fixed;
		right: 0;
		left: 0;
		bottom: 0;
		top: 0;
		width: 100%;
		max-width: none;
		height: 100%;
		max-height: none;
		border-radius: 0;
	}

	.cca-teaser { right: 72px; width: 200px; }
}

@media (prefers-reduced-motion: reduce) {
	.cca-root *,
	.cca-root *::before,
	.cca-root *::after {
		animation-duration: .001ms !important;
		transition-duration: .001ms !important;
	}
	.cca-log { scroll-behavior: auto; }
}
