/* WooCommerce AI Assistance Bot - Frontend Styles */

.wcaib-root {
	--wcaib-z: 999999;
	position: fixed;
	z-index: var(--wcaib-z);
	font-family: var(--wcaib-font-family, inherit);
	font-size: var(--wcaib-base-font-size, 14px);
	line-height: 1.5;
	box-sizing: border-box;
}

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

.wcaib-pos-bottom-right { bottom: 20px; right: 20px; }
.wcaib-pos-bottom-left { bottom: 20px; left: 20px; }
.wcaib-pos-custom { margin: 0; }

.wcaib-launcher {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 16px;
	background: var(--wcaib-launcher-bg, #4f46e5);
	color: var(--wcaib-launcher-icon, #fff);
	border: none;
	border-radius: 50px;
	cursor: grab;
	box-shadow: 0 4px 20px rgba(0,0,0,.15);
	transition: transform .2s, box-shadow .2s;
	font-size: 14px;
	font-weight: 600;
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
}

.wcaib-launcher-draggable { cursor: grab; }
.wcaib-launcher:hover { transform: scale(1.05); }
.wcaib-launcher:focus { outline: 2px solid var(--wcaib-primary, #4f46e5); outline-offset: 2px; }
.wcaib-launcher.wcaib-is-dragging {
	cursor: grabbing;
	transform: scale(1.08);
	box-shadow: 0 8px 28px rgba(0,0,0,.25);
	animation: none !important;
	transition: none;
}
.wcaib-launcher.wcaib-is-dragging:hover { transform: scale(1.08); }

.wcaib-root img { max-width: none; }
.wcaib-root .wcaib-launcher-avatar { width: calc(var(--wcaib-avatar-size, 40px) * 0.9); height: calc(var(--wcaib-avatar-size, 40px) * 0.9); object-fit: cover; flex-shrink: 0; }
.wcaib-avatar-shape-circle { border-radius: 50%; }
.wcaib-avatar-shape-rounded { border-radius: 8px; }
.wcaib-avatar-shape-square { border-radius: 0; }
.wcaib-launcher.pulse { animation: wcaib-pulse 2s infinite; }

@keyframes wcaib-pulse {
	0%, 100% { box-shadow: 0 4px 20px rgba(79,70,229,.3); }
	50% { box-shadow: 0 4px 30px rgba(79,70,229,.6); }
}

@media (prefers-reduced-motion: reduce) {
	.wcaib-launcher.pulse { animation: none; }
	.wcaib-window { transition: none !important; }
}

.wcaib-greeting {
	position: absolute;
	bottom: 70px;
	right: 0;
	background: #fff;
	color: #1f2937;
	padding: 12px 16px;
	border-radius: 12px;
	box-shadow: 0 4px 20px rgba(0,0,0,.12);
	max-width: 240px;
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-size: 13px;
}

.wcaib-pos-bottom-left .wcaib-greeting { right: auto; left: 0; }

.wcaib-greeting-close {
	background: none;
	border: none;
	font-size: 18px;
	cursor: pointer;
	color: #6b7280;
	padding: 0;
	line-height: 1;
}

.wcaib-window {
	position: absolute;
	bottom: 70px;
	right: 0;
	width: var(--wcaib-chat-width, 380px);
	height: var(--wcaib-chat-height, 520px);
	max-height: calc(100vh - 100px);
	background: #fff;
	border-radius: var(--wcaib-border-radius, 12px);
	box-shadow: 0 8px 40px rgba(0,0,0,.15);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	visibility: hidden;
	transform: translateY(20px);
	transition: opacity .3s, transform .3s, visibility .3s;
}

.wcaib-pos-bottom-left .wcaib-window,
.wcaib-anchor-left .wcaib-window { right: auto; left: 0; }
.wcaib-anchor-right .wcaib-window { left: auto; right: 0; }
.wcaib-anchor-bottom .wcaib-window { bottom: 70px; top: auto; }
.wcaib-anchor-top .wcaib-window {
	bottom: auto;
	top: 70px;
	transform: translateY(-20px);
}
.wcaib-anchor-top .wcaib-window.is-open { transform: translateY(0); }
.wcaib-window.is-open { opacity: 1; visibility: visible; transform: translateY(0); }

.wcaib-pos-bottom-left .wcaib-greeting,
.wcaib-anchor-left .wcaib-greeting { right: auto; left: 0; }
.wcaib-anchor-right .wcaib-greeting { left: auto; right: 0; }
.wcaib-anchor-top .wcaib-greeting { bottom: auto; top: 70px; }

.wcaib-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 16px;
	background: var(--wcaib-header-bg, #4f46e5);
	color: var(--wcaib-header-text, #fff);
	min-height: 56px;
}

.wcaib-header-info { display: flex; align-items: center; gap: 10px; }
.wcaib-root .wcaib-header-avatar { width: var(--wcaib-avatar-size, 40px); height: var(--wcaib-avatar-size, 40px); object-fit: cover; flex-shrink: 0; }
.wcaib-header-name { display: block; font-size: var(--wcaib-header-font-size, 16px); }
.wcaib-header-status { font-size: 12px; opacity: .85; }
.wcaib-header-actions { display: flex; gap: 4px; }

.wcaib-btn-icon {
	background: rgba(255,255,255,.15);
	border: none;
	color: inherit;
	width: 32px;
	height: 32px;
	border-radius: 6px;
	cursor: pointer;
	font-size: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	line-height: 1;
}

.wcaib-btn-icon:hover { background: rgba(255,255,255,.25); }

.wcaib-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.wcaib-message { display: flex; gap: 8px; max-width: 90%; }
.wcaib-message-user { align-self: flex-end; flex-direction: row-reverse; }
.wcaib-message-bot { align-self: flex-start; }
.wcaib-root .wcaib-msg-avatar { width: calc(var(--wcaib-avatar-size, 40px) * 0.8); height: calc(var(--wcaib-avatar-size, 40px) * 0.8); object-fit: cover; flex-shrink: 0; align-self: flex-start; }

.wcaib-bubble {
	padding: 10px 14px;
	border-radius: 12px;
	font-size: var(--wcaib-message-font-size, 14px);
	word-break: break-word;
}

.wcaib-message-bot .wcaib-bubble {
	background: var(--wcaib-bot-message-bg, #f3f4f6);
	color: var(--wcaib-bot-text, #1f2937);
}

.wcaib-message-user .wcaib-bubble {
	background: var(--wcaib-user-message-bg, #4f46e5);
	color: var(--wcaib-user-text, #fff);
}

.wcaib-bubble a { color: inherit; text-decoration: underline; }

.wcaib-typing { display: flex; gap: 4px; padding: 12px 16px !important; }
.wcaib-typing span {
	width: 8px; height: 8px; background: #9ca3af; border-radius: 50%;
	animation: wcaib-typing 1.4s infinite;
}
.wcaib-typing span:nth-child(2) { animation-delay: .2s; }
.wcaib-typing span:nth-child(3) { animation-delay: .4s; }

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

.wcaib-suggestions { padding: 0 16px 8px; display: flex; flex-wrap: wrap; gap: 6px; }

.wcaib-suggestion {
	background: #f3f4f6;
	border: 1px solid var(--wcaib-border, #e5e7eb);
	border-radius: 20px;
	padding: 6px 12px;
	font-size: 12px;
	cursor: pointer;
	color: #374151;
}

.wcaib-suggestion:hover { background: #e5e7eb; }

.wcaib-support-bar {
	padding: 8px 16px 10px;
	border-top: 1px solid var(--wcaib-border, #e5e7eb);
	background: #f8fafc;
}

.wcaib-support-heading {
	margin: 0 0 6px;
	font-size: 12px;
	font-weight: 600;
	color: #374151;
}

.wcaib-support-links {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.wcaib-support-link {
	display: inline-flex;
	align-items: center;
	padding: 6px 10px;
	border-radius: 6px;
	border: 1px solid var(--wcaib-border, #e5e7eb);
	background: #fff;
	color: var(--wcaib-primary, #4f46e5);
	text-decoration: none;
	font-size: 12px;
	font-weight: 600;
}

.wcaib-support-link:hover {
	background: #eef2ff;
}

.wcaib-support-link:focus {
	outline: 2px solid var(--wcaib-primary, #4f46e5);
	outline-offset: 2px;
}

.wcaib-handoff {
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px dashed var(--wcaib-border, #e5e7eb);
}

.wcaib-handoff-msg {
	margin: 0 0 6px;
	font-size: 12px;
	color: #4b5563;
}

.wcaib-input-area {
	display: flex;
	gap: 8px;
	padding: 12px 16px;
	border-top: 1px solid var(--wcaib-border, #e5e7eb);
	background: var(--wcaib-input-bg, #fff);
}

.wcaib-input {
	flex: 1;
	border: 1px solid var(--wcaib-border, #e5e7eb);
	border-radius: 8px;
	padding: 10px 14px;
	font-size: 14px;
	color: var(--wcaib-input-text, #1f2937);
	background: var(--wcaib-input-bg, #fff);
	outline: none;
}

.wcaib-input:focus { border-color: var(--wcaib-primary, #4f46e5); }

.wcaib-send {
	background: var(--wcaib-primary, #4f46e5);
	color: #fff;
	border: none;
	border-radius: 8px;
	width: 44px;
	height: 44px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	padding: 0;
	line-height: 1;
}

.wcaib-send svg { flex-shrink: 0; }

.wcaib-products { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }

.wcaib-product-card {
	display: flex;
	gap: 10px;
	background: #fff;
	border: 1px solid var(--wcaib-border, #e5e7eb);
	border-radius: 8px;
	padding: 8px;
}

.wcaib-root .wcaib-product-card img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.wcaib-product-info { flex: 1; min-width: 0; }
.wcaib-product-info strong { display: block; font-size: 13px; margin-bottom: 2px; }
.wcaib-price { color: var(--wcaib-primary, #4f46e5); font-weight: 600; font-size: 13px; }
.wcaib-rating { font-size: 12px; color: #f59e0b; margin-left: 4px; }
.wcaib-product-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.wcaib-variation-select {
	flex: 1 1 100%;
	max-width: 100%;
	font-size: 12px;
	padding: 5px 6px;
	border: 1px solid var(--wcaib-border, #e5e7eb);
	border-radius: 6px;
	background: #fff;
}
.wcaib-variation-select.wcaib-variation-needed { border-color: #dc2626; }

.wcaib-coupons { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }

.wcaib-coupon-card {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	background: linear-gradient(135deg, #fff7ed, #ffffff);
	border: 1px dashed #fdba74;
	border-radius: 10px;
	padding: 10px;
}

.wcaib-coupon-badge {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: #f97316;
	color: #fff;
	font-weight: 700;
	font-size: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.wcaib-coupon-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.wcaib-coupon-code {
	font-size: 15px;
	letter-spacing: 0.04em;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.wcaib-coupon-label { font-size: 12px; color: #9a3412; font-weight: 600; }
.wcaib-coupon-expiry,
.wcaib-coupon-desc { font-size: 11px; color: #6b7280; }
.wcaib-coupon-actions { margin-top: 6px; }
.wcaib-copy-coupon.is-copied { background: #16a34a !important; }

.wcaib-btn {
	padding: 4px 10px;
	border-radius: 6px;
	font-size: 12px;
	cursor: pointer;
	text-decoration: none;
	border: none;
	font-weight: 500;
}

.wcaib-btn-outline { background: transparent; border: 1px solid var(--wcaib-border, #e5e7eb); color: #374151; }
.wcaib-btn-primary { background: var(--wcaib-primary, #4f46e5); color: #fff; }

.wcaib-orders { margin-top: 8px; }
.wcaib-order-card {
	background: #fff;
	border: 1px solid var(--wcaib-border, #e5e7eb);
	border-radius: 8px;
	padding: 10px;
	font-size: 13px;
}

.wcaib-order-card p { margin: 4px 0 0; }
.wcaib-order-items { color: #6b7280; font-size: 12px; }

@media (max-width: 480px) {
	.wcaib-window {
		position: fixed;
		bottom: 0; right: 0; left: 0;
		width: 100% !important;
		height: 100% !important;
		max-height: 100vh;
		border-radius: 0;
	}
	.wcaib-pos-bottom-right, .wcaib-pos-bottom-left { bottom: 16px; right: 16px; left: auto; }
	.wcaib-launcher-text { display: none; }
}
