/* Connectedge Chat - front end widget */

#cc-root {
	position: fixed;
	bottom: 20px;
	z-index: 2147483000;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	color: #1f2937;
	-webkit-font-smoothing: antialiased;
}

#cc-root.cc-right { right: 20px; }
#cc-root.cc-left { left: 20px; }
#cc-root * { box-sizing: border-box; }
#cc-root [hidden] { display: none !important; }

/* Launcher */
.cc-launcher {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 58px;
	height: 58px;
	margin-left: auto;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--cc-primary, #2563eb);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 10px 24px rgba(15, 23, 42, 0.24);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cc-left .cc-launcher { margin-left: 0; margin-right: auto; }
.cc-launcher:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(15, 23, 42, 0.28); }
.cc-launcher:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.4); outline-offset: 2px; }
.cc-launcher-icon { display: flex; }

.cc-badge {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	border-radius: 11px;
	background: #ef4444;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 22px;
	text-align: center;
}

/* Panel */
.cc-panel {
	display: none;
	flex-direction: column;
	position: absolute;
	bottom: 74px;
	width: 360px;
	max-height: min(640px, calc(100vh - 120px));
	overflow: hidden;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 18px;
	box-shadow: 0 24px 48px rgba(15, 23, 42, 0.22);
	transform-origin: bottom right;
	animation: cc-pop 0.18s ease-out;
}

.cc-right .cc-panel { right: 0; }
.cc-left .cc-panel { left: 0; transform-origin: bottom left; }
#cc-root.cc-open .cc-panel { display: flex; }

@keyframes cc-pop {
	from { opacity: 0; transform: translateY(10px) scale(0.98); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

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

/* Header */
.cc-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 10px;
	padding: 16px 18px;
	background: var(--cc-primary, #2563eb);
	color: #fff;
}

.cc-head-text { display: flex; flex-direction: column; gap: 2px; }
.cc-head-text strong { font-size: 16px; }
.cc-status { font-size: 12.5px; opacity: 0.92; }

.cc-close {
	border: 0;
	background: transparent;
	color: #fff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	opacity: 0.85;
	padding: 0 2px;
}

.cc-close:hover { opacity: 1; }

/* Note */
.cc-note {
	margin: 0;
	padding: 14px 18px 8px;
	color: #475569;
	font-size: 14px;
	white-space: pre-wrap;
}

/* Thread */
.cc-thread {
	flex: 1 1 auto;
	min-height: 120px;
	max-height: 320px;
	padding: 6px 16px 12px;
	overflow-y: auto;
	background: #f8fafc;
}

.cc-day {
	margin: 12px auto;
	text-align: center;
	font-size: 11.5px;
	color: #94a3b8;
}

.cc-msg { display: flex; flex-direction: column; margin-bottom: 10px; max-width: 84%; }
.cc-msg-mine { margin-left: auto; align-items: flex-end; }
.cc-msg-them { margin-right: auto; align-items: flex-start; }

.cc-bubble {
	padding: 9px 13px;
	border-radius: 14px;
	white-space: pre-wrap;
	word-break: break-word;
}

.cc-msg-them .cc-bubble { background: #fff; border: 1px solid #e5e7eb; border-bottom-left-radius: 4px; }
.cc-msg-mine .cc-bubble { background: var(--cc-primary, #2563eb); color: #fff; border-bottom-right-radius: 4px; }
.cc-meta { margin-top: 4px; font-size: 11px; color: #94a3b8; }

.cc-msg.cc-pending { opacity: 0.72; }
.cc-msg.cc-failed .cc-bubble { background: #fee2e2; color: #991b1b; border-color: #fecaca; cursor: pointer; }
.cc-msg.cc-failed .cc-meta { color: #b91c1c; }

/* Typing */
.cc-typing {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 18px 10px;
	font-size: 12.5px;
	color: #64748b;
}

.cc-dots { display: inline-flex; gap: 3px; }
.cc-dots i {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #94a3b8;
	animation: cc-blink 1.1s infinite ease-in-out;
}
.cc-dots i:nth-child(2) { animation-delay: 0.15s; }
.cc-dots i:nth-child(3) { animation-delay: 0.3s; }

@keyframes cc-blink {
	0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
	30% { opacity: 1; transform: translateY(-2px); }
}

/* Form */
.cc-form { padding: 12px 16px 8px; border-top: 1px solid #eef2f7; background: #fff; }
.cc-intro { display: flex; flex-direction: column; gap: 10px; }
.cc-field { display: flex; flex-direction: column; gap: 4px; }
.cc-field label { font-size: 12.5px; font-weight: 600; color: #475569; }

.cc-intro input,
.cc-intro textarea,
.cc-composer textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #d7dde5;
	border-radius: 10px;
	font-size: 14.5px;
	font-family: inherit;
	color: inherit;
	background: #fff;
}

.cc-intro input:focus,
.cc-intro textarea:focus,
.cc-composer textarea:focus { outline: none; border-color: var(--cc-primary, #2563eb); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14); }

.cc-composer { display: flex; align-items: flex-end; gap: 8px; }
.cc-composer textarea { resize: none; max-height: 110px; }

.cc-btn {
	border: 0;
	border-radius: 10px;
	padding: 11px 16px;
	font-size: 14.5px;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
}

.cc-btn-primary { background: var(--cc-primary, #2563eb); color: #fff; }
.cc-btn-primary:hover { filter: brightness(0.94); }
.cc-btn[disabled] { opacity: 0.65; cursor: default; }
.cc-btn-send { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; flex: 0 0 auto; }

.cc-error { margin: 8px 0 0; color: #b91c1c; font-size: 12.5px; }
.cc-foot {
	padding: 8px 16px 12px;
	font-size: 11px;
	color: #94a3b8;
	border-top: 1px solid #f1f5f9;
}

/* Mobile */
@media (max-width: 480px) {
	#cc-root.cc-right, #cc-root.cc-left { right: 14px; left: 14px; }
	.cc-panel { position: fixed; left: 12px; right: 12px; width: auto; bottom: 84px; max-height: calc(100vh - 150px); }
	.cc-thread { max-height: none; }
	.cc-launcher { margin: 0 0 0 auto; }
}
