/* AgentClerk Widget — Public Styles (v5 design system)
 *
 * Brand tokens:
 *   Slate:        #1C2333
 *   Electric:     #00E5C8
 *   Electric-dk:  #0D7A6B
 *   Off-white:    #F0F2F7
 * ───────────────────────────────────────────────── */

/* ── Floating Widget Button ────────────────────── */

.acw-float-btn {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 99999;
	background: #1C2333;
	color: #fff;
	font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
	font-size: 13px;
	font-weight: 500;
	padding: 9px 15px;
	border-radius: 22px;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 7px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18), 0 8px 24px rgba(0, 0, 0, 0.12);
	transition: background 0.2s, box-shadow 0.2s;
	line-height: 1;
}
.acw-float-btn:hover {
	background: #252E42;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22), 0 10px 28px rgba(0, 0, 0, 0.14);
}
.acw-float-btn--left {
	right: auto;
	left: 20px;
}
.acw-float-icon {
	color: #00E5C8;
	display: flex;
	align-items: center;
}

/* ── Theme conflict prevention ───────────────────
 * Many WP themes (Elementor, Astra, Divi, OceanWP) apply
 * aggressive global styles on button, input, svg elements.
 * These resets prevent theme overrides inside our widget.
 */
[class^="acw-"] svg,
[class*=" acw-"] svg {
	display: inline-block !important;
	visibility: visible !important;
	opacity: 1 !important;
	fill: none !important;
	stroke: currentColor !important;
	max-width: none !important;
	max-height: none !important;
	pointer-events: none !important;
}
[class^="acw-"] button,
[class*=" acw-"] button {
	font-family: inherit !important;
	letter-spacing: normal !important;
	text-transform: none !important;
	text-decoration: none !important;
}

/* ── Floating Widget Panel ─────────────────────── */

.acw-panel {
	position: fixed;
	bottom: 80px;
	right: 20px;
	z-index: 99998;
	width: 320px;
	max-height: 500px;
	background: #fff;
	border-radius: 10px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 12px 40px rgba(0, 0, 0, 0.1);
	overflow: hidden;
	border: 1px solid rgba(0, 0, 0, 0.1);
	display: none;
	flex-direction: column;
	font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}
.acw-panel.open {
	display: flex;
}
.acw-panel--left {
	right: auto;
	left: 20px;
}

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

.acw-header {
	background: #1C2333;
	padding: 10px 13px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 9px;
	flex-shrink: 0;
}
.acw-header-left {
	display: flex;
	align-items: center;
	gap: 9px;
}
.acw-avatar {
	width: 23px;
	height: 23px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}
.acw-avatar--electric {
	background: #00E5C8;
	color: #1C2333;
}
.acw-header-info {
	display: flex;
	flex-direction: column;
	gap: 1px;
}
.acw-header-name {
	font-size: 12px;
	font-weight: 500;
	color: #fff;
	line-height: 1.2;
}
.acw-header-status {
	font-size: 10px;
	color: #00E5C8;
	line-height: 1.2;
}
.acw-close-btn {
	background: none;
	border: none;
	color: #8A95A8;
	font-size: 18px;
	cursor: pointer;
	padding: 0 2px;
	line-height: 1;
	transition: color 0.15s;
	margin-left: auto;
}
.acw-close-btn:hover {
	color: #fff;
}

/* ── Compact Header (product embed) ────────────── */

.acw-header--compact {
	padding: 8px 11px;
}
.acw-header--compact .acw-avatar {
	width: 20px;
	height: 20px;
}
.acw-header--compact .acw-header-name {
	font-size: 11px;
}

/* ── Messages Area ─────────────────────────────── */

.acw-messages {
	display: flex;
	flex-direction: column;
	gap: 9px;
	padding: 11px;
	background: #F0F2F7;
	height: 280px;
	overflow-y: auto;
	flex: 1;
}
.acw-messages--product {
	height: 200px;
}
.acw-messages--fullpage {
	height: auto;
	min-height: 350px;
	max-height: 450px;
}
.acw-messages--support {
	height: auto;
	min-height: 250px;
	max-height: 400px;
}

/* ── Message Bubbles ───────────────────────────── */

.acw-msg {
	display: flex;
	gap: 7px;
	max-width: 88%;
}
.acw-msg--agent {
	align-self: flex-start;
}
.acw-msg--user {
	align-self: flex-end;
	flex-direction: row-reverse;
}

/* Agent avatar */
.acw-msg-avatar {
	width: 21px;
	height: 21px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	font-family: 'DM Mono', 'Courier New', monospace;
	font-size: 10px;
	font-weight: 500;
	line-height: 1;
}
.acw-msg--agent .acw-msg-avatar {
	background: #1C2333;
	color: #00E5C8;
}
.acw-msg--user .acw-msg-avatar {
	background: #0D7A6B;
	color: #fff;
}

/* Bubbles */
.acw-msg-bubble {
	font-size: 12px;
	line-height: 1.45;
	padding: 8px 11px;
	border-radius: 11px;
	word-wrap: break-word;
	overflow-wrap: break-word;
}
.acw-msg--agent .acw-msg-bubble {
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.1);
	color: #1C2333;
	border-top-left-radius: 3px;
}
.acw-msg--user .acw-msg-bubble {
	background: #1C2333;
	color: #fff;
	border-top-right-radius: 3px;
}

/* Markdown-lite inside bubbles */
.acw-msg-bubble strong {
	font-weight: 600;
}
.acw-msg-bubble a {
	color: #0D7A6B;
	text-decoration: underline;
}
.acw-msg--user .acw-msg-bubble a {
	color: #00E5C8;
}

/* ── Input Area ────────────────────────────────── */

.acw-input-row {
	padding: 7px 9px;
	background: #fff;
	border-top: 1px solid rgba(0, 0, 0, 0.1);
	display: flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
}
.acw-input {
	flex: 1 !important;
	font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif !important;
	font-size: 12px !important;
	padding: 6px 10px !important;
	border-radius: 14px !important;
	border: 1px solid rgba(0, 0, 0, 0.15) !important;
	outline: none !important;
	background: #fff !important;
	color: #1C2333 !important;
	transition: border-color 0.15s !important;
	box-shadow: none !important;
	-webkit-appearance: none !important;
	appearance: none !important;
	margin: 0 !important;
	min-height: auto !important;
	max-width: none !important;
	width: auto !important;
	line-height: normal !important;
}
.acw-input:focus {
	border-color: #0D7A6B;
}
.acw-input::placeholder {
	color: #8A95A8;
}
.acw-send-btn {
	width: 27px !important;
	height: 27px !important;
	min-width: 27px !important;
	min-height: 27px !important;
	border-radius: 50% !important;
	background: #1C2333 !important;
	color: #00E5C8 !important;
	border: none !important;
	cursor: pointer !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	flex-shrink: 0 !important;
	transition: background 0.15s !important;
	padding: 0 !important;
	margin: 0 !important;
	outline: none !important;
	box-shadow: none !important;
	line-height: 1 !important;
	-webkit-appearance: none !important;
	appearance: none !important;
	opacity: 1 !important;
	visibility: visible !important;
	overflow: visible !important;
}
.acw-send-btn:hover {
	background: #252E42 !important;
}
.acw-send-btn:focus {
	outline: none !important;
	box-shadow: none !important;
}
.acw-send-btn svg {
	display: inline-block !important;
	visibility: visible !important;
	opacity: 1 !important;
	width: 13px !important;
	height: 13px !important;
	fill: none !important;
	stroke: currentColor !important;
	stroke-width: 2.5 !important;
	pointer-events: none !important;
	vertical-align: middle !important;
}

/* ── Product Page Embed ────────────────────────── */

.acw-product-embed {
	margin-top: 15px;
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 10px;
	overflow: hidden;
	max-height: 400px;
	display: flex;
	flex-direction: column;
	font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Full Page (/clerk) Layout ─────────────────── */

.acw-fullpage {
	max-width: 680px;
	margin: 30px auto;
	border-radius: 10px;
	border: 1px solid rgba(0, 0, 0, 0.1);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 8px 32px rgba(0, 0, 0, 0.06);
	overflow: hidden;
	min-height: 500px;
	display: flex;
	flex-direction: column;
	font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Support Page ──────────────────────────────── */

.acw-support-wrap {
	max-width: 680px;
	margin: 20px auto;
	font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}
.acw-support-heading {
	font-family: 'Syne', 'DM Sans', sans-serif;
	font-size: 24px;
	font-weight: 700;
	color: #1C2333;
	margin: 0 0 6px 0;
}
.acw-support-subtext {
	font-size: 13px;
	color: #4A5568;
	margin: 0 0 18px 0;
	line-height: 1.5;
}
.acw-support-chat {
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 10px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

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

.acw-escalation {
	background: #FFFBEB;
	border: 1px solid #FCD34D;
	border-radius: 10px;
	padding: 13px;
	margin: 10px;
}
.acw-escalation-title {
	font-size: 12px;
	font-weight: 600;
	color: #92400E;
	margin: 0 0 8px 0;
}
.acw-escalation-text {
	font-size: 11px;
	color: #92400E;
	margin: 0 0 8px 0;
	line-height: 1.4;
}
.acw-escalation-input {
	width: 100%;
	border: 1px solid #FCD34D;
	border-radius: 6px;
	padding: 6px 10px;
	font-size: 12px;
	font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
	outline: none;
	box-sizing: border-box;
	margin-bottom: 8px;
	background: #fff;
	color: #1C2333;
}
.acw-escalation-input:focus {
	border-color: #F59E0B;
}
.acw-escalation-confirm {
	background: #1C2333;
	color: #00E5C8;
	border: none;
	border-radius: 6px;
	padding: 6px 14px;
	cursor: pointer;
	font-size: 12px;
	font-weight: 500;
	font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
	transition: background 0.15s;
}
.acw-escalation-confirm:hover {
	background: #252E42;
}

/* ── Typing Indicator ──────────────────────────── */

.acw-typing {
	display: flex;
	align-items: center;
	gap: 7px;
	align-self: flex-start;
}
.acw-typing-dots {
	display: flex;
	gap: 3px;
	padding: 10px 12px;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 11px;
	border-top-left-radius: 3px;
}
.acw-typing-dot {
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: #8A95A8;
	animation: acwBounce 1.2s infinite;
}
.acw-typing-dot:nth-child(2) {
	animation-delay: 0.15s;
}
.acw-typing-dot:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes acwBounce {
	0%, 60%, 100% {
		transform: translateY(0);
		opacity: 0.4;
	}
	30% {
		transform: translateY(-4px);
		opacity: 1;
	}
}

/* ── Scrollbar ─────────────────────────────────── */

.acw-messages::-webkit-scrollbar {
	width: 4px;
}
.acw-messages::-webkit-scrollbar-track {
	background: transparent;
}
.acw-messages::-webkit-scrollbar-thumb {
	background: rgba(0, 0, 0, 0.15);
	border-radius: 4px;
}

/* ── Responsive — below 400px ──────────────────── */

@media (max-width: 400px) {
	.acw-panel {
		width: 100%;
		bottom: 0;
		right: 0;
		left: 0;
		max-height: 100vh;
		border-radius: 0;
	}
	.acw-panel--left {
		right: 0;
		left: 0;
	}
	.acw-float-btn {
		bottom: 12px;
		right: 12px;
	}
	.acw-float-btn--left {
		right: auto;
		left: 12px;
	}
}
