/* Smart Client Contact Hub — frontend widget */

.scch-root {
	position: fixed;
	bottom: var(--scch-btn-margin, 24px);
	z-index: var(--scch-z, 99990);
	font-family: var(--scch-font, inherit);
	--scch-surface: #ffffff;
	--scch-text: #111827;
	--scch-muted: #6b7280;
	--scch-line: #e5e7eb;
	--scch-error: #dc2626;
	--scch-success: #16a34a;
}

.scch-pos-right { right: var(--scch-btn-margin, 24px); }
.scch-pos-left  { left: var(--scch-btn-margin, 24px); }

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

.scch-launcher {
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--scch-btn-size, 60px);
	height: var(--scch-btn-size, 60px);
	border: var(--scch-border, 0);
	border-radius: var(--scch-btn-radius, 50%);
	background: var(--scch-btn-bg, #2563eb);
	color: var(--scch-icon-color, #fff);
	box-shadow: var(--scch-shadow, 0 8px 24px rgba(0, 0, 0, .22));
	cursor: pointer;
	padding: 0;
	transition: transform .18s ease, box-shadow .18s ease;
}

.scch-launcher:hover,
.scch-launcher:focus-visible { transform: translateY(-2px) scale(1.04); }

.scch-launcher:focus-visible,
.scch-panel :focus-visible {
	outline: 3px solid var(--scch-primary, #2563eb);
	outline-offset: 2px;
}

.scch-launcher {
	position: relative;
	overflow: hidden;
}

.scch-launcher-icon {
	position: absolute;
	inset: 0;
	display:flex;
	align-items:center;
	justify-content:center;
}

.scch-launcher-icon svg,
.scch-custom-icon {
	width: var(--scch-icon-size, 28px);
	height: var(--scch-icon-size, 28px);
	display:block;
}

.scch-launcher-icon[hidden]{display:none !important;}

/* Launcher animations */
@keyframes scch-fade   { from { opacity: 0; } to { opacity: 1; } }
@keyframes scch-scale  { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes scch-bounce {
	0%, 100% { transform: translateY(0); }
	30%      { transform: translateY(-10px); }
	60%      { transform: translateY(-4px); }
}
@keyframes scch-pulse {
	0%   { box-shadow: 0 0 0 0 rgba(37, 99, 235, .45); }
	70%  { box-shadow: 0 0 0 16px rgba(37, 99, 235, 0); }
	100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.scch-anim-fade   { animation: scch-fade .5s ease both; }
.scch-anim-scale  { animation: scch-scale .35s cubic-bezier(.34, 1.56, .64, 1) both; }
.scch-anim-bounce { animation: scch-bounce 1.6s ease .4s 3; }
.scch-anim-pulse  { animation: scch-pulse 2.2s ease-out infinite; }

/* ---------- Overlay ---------- */

.scch-overlay {
	position: fixed;
	inset: 0;
	background: rgba(17, 24, 39, .35);
	backdrop-filter: blur(2px);
	z-index: -1;
}

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

.scch-panel {
	position: absolute;
	bottom: calc(var(--scch-btn-size, 60px) + 16px);
	width: min(var(--scch-popup-width, 380px), calc(100vw - 32px));
	max-height: min(72vh, 640px);
	overflow-y: auto;
	background: var(--scch-surface);
	color: var(--scch-text);
	border-radius: var(--scch-popup-radius, 16px);
	box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
	animation: scch-panel-in .22s ease both;
}

.scch-pos-right .scch-panel { right: 0; }
.scch-pos-left  .scch-panel { left: 0; }

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

.scch-panel-header {
	position: relative;
	padding: 22px 52px 16px 22px;
	background: var(--scch-heading-bg, linear-gradient(135deg, var(--scch-primary, #2563eb), var(--scch-secondary, #7c3aed)));
	color: var(--scch-heading-text, #fff);
}

.scch-panel-title { margin: 0 0 4px; font-size: 18px; line-height: 1.3; color: var(--scch-heading-text, #fff); }
.scch-panel-intro { margin: 0; font-size: 13px; opacity: .9; }

.scch-close {
	position: absolute;
	top: 14px;
	right: 14px;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, .18);
	border: 0;
	border-radius: 50%;
	color: #fff;
	cursor: pointer;
}
.scch-close svg { width: 16px; height: 16px; }
.scch-close:hover { background: rgba(255, 255, 255, .3); }

.scch-view { padding: 18px 22px 22px; }

/* ---------- Channel buttons ---------- */

.scch-channel {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	margin: 0 0 10px;
	padding: 14px 16px;
	background: var(--scch-surface);
	border: 1px solid var(--scch-line);
	border-radius: 12px;
	color: var(--scch-text);
	font-size: 15px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
	box-sizing: border-box;
}

.scch-channel:hover,
.scch-channel:focus-visible {
	border-color: var(--scch-primary, #2563eb);
	transform: translateY(-1px);
	box-shadow: 0 6px 16px rgba(0, 0, 0, .08);
}

.scch-channel-icon {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 10px;
	background: linear-gradient(135deg, var(--scch-primary, #2563eb), var(--scch-secondary, #7c3aed));
	color: #fff;
}
.scch-channel-icon svg { width: 20px; height: 20px; }

/* ---------- Form ---------- */

.scch-back {
	background: none;
	border: 0;
	padding: 0 0 10px;
	color: var(--scch-primary, #2563eb);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}

.scch-form-title { margin: 0 0 14px; font-size: 16px; }

.scch-field { margin-bottom: 14px; }

.scch-field label {
	display: block;
	margin-bottom: 5px;
	font-size: 13px;
	font-weight: 600;
	color: var(--scch-text);
}

.scch-req { color: var(--scch-error); margin-left: 2px; }

.scch-field input,
.scch-field select,
.scch-field textarea {
	width: 100%;
	box-sizing: border-box;
	padding: 10px 12px;
	font-size: 14px;
	font-family: inherit;
	color: var(--scch-text);
	background: var(--scch-surface);
	border: 1px solid var(--scch-line);
	border-radius: 9px;
	transition: border-color .15s ease, box-shadow .15s ease;
}

.scch-field input:focus,
.scch-field select:focus,
.scch-field textarea:focus {
	border-color: var(--scch-primary, #2563eb);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
	outline: none;
}

.scch-field.scch-invalid input,
.scch-field.scch-invalid select,
.scch-field.scch-invalid textarea { border-color: var(--scch-error); }

.scch-field-error {
	margin: 5px 0 0;
	font-size: 12px;
	color: var(--scch-error);
}

/* CAPTCHA */
.scch-captcha-row { display: flex; align-items: center; gap: 10px; }
.scch-captcha-question {
	flex: 0 0 auto;
	padding: 10px 14px;
	background: var(--scch-line);
	border-radius: 9px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}
.scch-captcha-row input { flex: 1 1 auto; width: auto; }
.scch-captcha-refresh {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	background: none;
	border: 1px solid var(--scch-line);
	border-radius: 9px;
	color: var(--scch-muted);
	cursor: pointer;
}
.scch-captcha-refresh svg { width: 16px; height: 16px; }
.scch-captcha-refresh:hover { color: var(--scch-primary); border-color: var(--scch-primary); }

/* Honeypot: pulled off-screen, not display:none, to look real to bots. */
.scch-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.scch-form-feedback { font-size: 13px; margin: 0 0 10px; color: var(--scch-error); }

.scch-submit {
	width: 100%;
	padding: 13px;
	border: 0;
	border-radius: 10px;
	background: var(--scch-submit-bg, linear-gradient(135deg, var(--scch-primary, #2563eb), var(--scch-secondary, #7c3aed)));
	color: var(--scch-submit-text, #fff);
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	transition: filter .15s ease, transform .15s ease;
}
.scch-submit:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.scch-submit:disabled { opacity: .65; cursor: wait; }

/* Success */
.scch-view-success { text-align: center; padding: 40px 24px; }
.scch-success-icon {
	width: 56px;
	height: 56px;
	margin: 0 auto 14px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: var(--scch-success);
	color: #fff;
	font-size: 26px;
	font-weight: 700;
}
.scch-success-message { font-size: 15px; color: var(--scch-text); }

/* ---------- Dark mode ---------- */

@media (prefers-color-scheme: dark) {
	.scch-root:not([data-forced-light]) {
		--scch-surface: #1f2937;
		--scch-text: #f9fafb;
		--scch-muted: #9ca3af;
		--scch-line: #374151;
	}
}

/* ---------- Mobile ---------- */

@media (max-width: 480px) {
	.scch-panel {
		position: fixed;
		left: 16px !important;
		right: 16px !important;
		bottom: calc(var(--scch-btn-margin, 24px) + var(--scch-btn-size, 60px) + 12px);
		width: auto;
	}
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
	.scch-launcher,
	.scch-panel,
	.scch-channel,
	.scch-submit { animation: none !important; transition: none !important; }
}

/* Hidden field labels: removed visually, kept for screen readers. */
.scch-label-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Dialog container receives focus on external-trigger open; no visible ring. */
.scch-panel:focus { outline: none; }
