/* Self-hosted live chat widget (Crisp replacement).
   Everything is scoped under #cc-chat-root so the legacy site CSS + Bootstrap
   can't bleed in, and so we never need !important. */

/* svg/path are excluded from the reset -- `all: revert` resets `fill` on a path
   to the UA default, which kills icon inheritance and renders them invisible. */
#cc-chat-root,
#cc-chat-root *:not(svg):not(path),
#cc-chat-root *::before,
#cc-chat-root *::after {
	all: revert;
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	line-height: 1.45;
	letter-spacing: normal;
	text-transform: none;
	float: none;
}

#cc-chat-root {
	position: fixed;
	z-index: 2147483000;
	bottom: 0;
	right: 0;
	width: 0;
	height: 0;
	font-size: 15px;
	color: #1f2937;
}

/* ---------------------------------------------------------- launcher */

#cc-chat-root .cc-chat__launcher {
	position: fixed;
	bottom: 20px;
	right: 20px;
	width: 60px;
	height: 60px;
	border: 0;
	border-radius: 50%;
	background: #6366f1;
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.24);
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}

#cc-chat-root .cc-chat__launcher:hover {
	transform: scale(1.06);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

#cc-chat-root .cc-chat__launcher svg {
	width: 28px;
	height: 28px;
	display: block;
}

#cc-chat-root svg path {
	fill: currentColor;
}

#cc-chat-root .cc-chat__launcher .cc-chat__icon-close {
	display: none;
}

#cc-chat-root.cc-chat--open .cc-chat__launcher .cc-chat__icon-open {
	display: none;
}

#cc-chat-root.cc-chat--open .cc-chat__launcher .cc-chat__icon-close {
	display: block;
}

/* ---------------------------------------------------------- panel */

#cc-chat-root .cc-chat__panel {
	position: fixed;
	bottom: 92px;
	right: 20px;
	width: 370px;
	height: 520px;
	max-height: calc(100vh - 120px);
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(12px);
	pointer-events: none;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

#cc-chat-root.cc-chat--open .cc-chat__panel {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

#cc-chat-root .cc-chat__header {
	background: #6366f1;
	color: #fff;
	padding: 16px 18px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex: 0 0 auto;
}

#cc-chat-root .cc-chat__title {
	font-size: 16px;
	font-weight: 600;
	color: #fff;
}

#cc-chat-root .cc-chat__subtitle {
	font-size: 12px;
	opacity: 0.85;
	color: #fff;
}

#cc-chat-root .cc-chat__close {
	background: none;
	border: 0;
	color: #fff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
	opacity: 0.85;
}

#cc-chat-root .cc-chat__close:hover {
	opacity: 1;
}

/* ---------------------------------------------------------- messages */

#cc-chat-root .cc-chat__list {
	flex: 1 1 auto;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 16px;
	background: #f6f7fb;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

#cc-chat-root .cc-chat__bubble {
	max-width: 82%;
	padding: 10px 13px;
	border-radius: 14px;
	font-size: 14px;
	white-space: pre-wrap;
	overflow-wrap: break-word;
	word-break: break-word;
}

#cc-chat-root .cc-chat__bubble--bot {
	align-self: flex-start;
	background: #fff;
	color: #1f2937;
	border-bottom-left-radius: 4px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

#cc-chat-root .cc-chat__bubble--user {
	align-self: flex-end;
	background: #6366f1;
	color: #fff;
	border-bottom-right-radius: 4px;
}

#cc-chat-root .cc-chat__bubble a {
	color: inherit;
	text-decoration: underline;
}

#cc-chat-root .cc-chat__bubble--bot a {
	color: #4f46e5;
}

/* typing indicator */

#cc-chat-root .cc-chat__typing {
	display: flex;
	gap: 4px;
	align-items: center;
}

#cc-chat-root .cc-chat__typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #b6bcc9;
	display: block;
	animation: cc-chat-bounce 1.2s infinite ease-in-out;
}

#cc-chat-root .cc-chat__typing span:nth-child(2) {
	animation-delay: 0.15s;
}

#cc-chat-root .cc-chat__typing span:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes cc-chat-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
	30% { transform: translateY(-5px); opacity: 1; }
}

/* ---------------------------------------------------------- composer */

#cc-chat-root .cc-chat__form {
	flex: 0 0 auto;
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px;
	background: #fff;
	border-top: 1px solid #e6e8ee;
}

#cc-chat-root .cc-chat__input {
	flex: 1 1 auto;
	resize: none;
	border: 1px solid #dfe2ea;
	border-radius: 10px;
	padding: 9px 11px;
	font-size: 14px;
	max-height: 96px;
	min-height: 38px;
	background: #fff;
	color: #1f2937;
	outline: none;
}

#cc-chat-root .cc-chat__input:focus {
	border-color: #6366f1;
}

#cc-chat-root .cc-chat__send {
	flex: 0 0 auto;
	width: 38px;
	height: 38px;
	border: 0;
	border-radius: 50%;
	background: #6366f1;
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

#cc-chat-root .cc-chat__send:disabled {
	opacity: 0.45;
	cursor: default;
}

#cc-chat-root .cc-chat__send svg {
	width: 17px;
	height: 17px;
	display: block;
}

/* ---------------------------------------------------------- mobile */

@media (max-width: 480px) {
	#cc-chat-root .cc-chat__panel {
		inset: 0;
		width: 100%;
		height: 100%;
		max-height: none;
		border-radius: 0;
	}

	#cc-chat-root.cc-chat--open .cc-chat__launcher {
		display: none;
	}
}
