/* Astro AI Chat — themable widget */
.astro-ai-root {
	--astro-primary: #f26100;
	--astro-primary-dark: #d95400;
	--astro-header: #222529;
	--astro-header-text: #ffffff;
	--astro-user: #f26100;
	--astro-bot: #f4f5f7;
	--astro-panel: #ffffff;
	--astro-text: #1f2937;
	--astro-muted: #6b7280;
	--astro-radius: 18px;
	--astro-shadow: 0 16px 50px rgba(17, 24, 39, 0.22);

	position: fixed !important;
	bottom: 24px !important;
	right: 24px !important;
	z-index: 2147483646 !important;
	font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 14px;
	line-height: 1.45;
	color: var(--astro-text);
}
.astro-ai-root.astro-ai-pos-left {
	right: auto !important;
	left: 24px !important;
}
.astro-ai-root[hidden] { display: none !important; }

.astro-ai-toggle {
	position: relative;
	border: 0;
	background: none;
	padding: 0;
	cursor: pointer;
	display: flex;
	align-items: center;
}
.astro-ai-toggle-pulse {
	position: absolute;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--astro-primary);
	opacity: .35;
	animation: astro-pulse 2.2s ease-out infinite;
	pointer-events: none;
}
@keyframes astro-pulse {
	0% { transform: scale(1); opacity: .4; }
	70% { transform: scale(1.55); opacity: 0; }
	100% { transform: scale(1.55); opacity: 0; }
}
.astro-ai-toggle-inner {
	position: relative;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--astro-primary), var(--astro-primary-dark));
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 8px 24px rgba(242, 97, 0, .4);
	z-index: 1;
	overflow: hidden;
}
.astro-ai-toggle-inner svg { width: 26px; height: 26px; }
.astro-ai-icon-x { display: none; }
.astro-ai-toggle.is-open .astro-ai-icon-chat { display: none; }
.astro-ai-toggle.is-open .astro-ai-icon-x { display: block; }
.astro-ai-toggle.is-open .astro-ai-toggle-label,
.astro-ai-toggle.is-open .astro-ai-toggle-pulse { display: none; }
.astro-ai-toggle-img { width: 100%; height: 100%; object-fit: cover; }
.astro-ai-toggle-label {
	position: absolute;
	right: 72px;
	white-space: nowrap;
	background: var(--astro-header);
	color: #fff;
	font-weight: 600;
	font-size: 13px;
	padding: 8px 14px;
	border-radius: 999px;
	box-shadow: var(--astro-shadow);
}
.astro-ai-pos-left .astro-ai-toggle-label {
	right: auto;
	left: 72px;
}

.astro-ai-panel {
	position: absolute;
	bottom: 76px;
	right: 0;
	width: min(400px, calc(100vw - 24px));
	height: min(640px, calc(100vh - 120px));
	background: var(--astro-panel);
	border-radius: var(--astro-radius);
	box-shadow: var(--astro-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}
.astro-ai-pos-left .astro-ai-panel { right: auto; left: 0; }
.astro-ai-panel[hidden] { display: none !important; }

.astro-ai-header {
	background: var(--astro-header);
	color: var(--astro-header-text);
	padding: 14px 14px 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}
.astro-ai-header-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.astro-ai-avatar {
	width: 38px; height: 38px; border-radius: 50%;
	background: var(--astro-primary); color: #fff;
	display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0;
}
.astro-ai-avatar img { width: 100%; height: 100%; object-fit: cover; }
.astro-ai-name { display: block; font-size: 15px; }
.astro-ai-status { display: block; font-size: 12px; opacity: .8; }
.astro-ai-header-actions { display: flex; gap: 4px; }
.astro-ai-icon-btn {
	border: 0; background: transparent; color: inherit; width: 34px; height: 34px;
	border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.astro-ai-icon-btn:hover { background: rgba(255,255,255,.12); }

.astro-ai-messages {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	background: linear-gradient(180deg, #fafafa 0%, var(--astro-panel) 48px);
}

.astro-ai-msg { margin-bottom: 12px; }
.astro-ai-msg-row { display: flex; gap: 8px; align-items: flex-start; }
.astro-ai-msg-avatar {
	width: 26px; height: 26px; border-radius: 50%; background: var(--astro-primary); color: #fff;
	display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; margin-top: 2px;
}
.astro-ai-msg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.astro-ai-msg-content { min-width: 0; flex: 1; }
.astro-ai-bubble {
	display: inline-block;
	padding: 10px 12px;
	border-radius: 14px;
	background: var(--astro-bot);
	max-width: 100%;
	word-wrap: break-word;
}
.astro-ai-msg-user { display: flex; justify-content: flex-end; }
.astro-ai-msg-user .astro-ai-bubble {
	background: var(--astro-user);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.astro-ai-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.astro-ai-chip {
	border: 1px solid #e5e7eb;
	background: #fff;
	border-radius: 999px;
	padding: 6px 10px;
	font-size: 12px;
	cursor: pointer;
	color: var(--astro-text);
}
.astro-ai-chip:hover { border-color: var(--astro-primary); color: var(--astro-primary); }

.astro-ai-products { display: grid; gap: 8px; margin-top: 8px; }
.astro-ai-product {
	border: 1px solid #ececec;
	border-radius: 14px;
	background: #fff;
	overflow: hidden;
}
.astro-ai-product-top { display: flex; gap: 10px; padding: 10px; }
.astro-ai-product-img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; background: #f3f4f6; }
.astro-ai-product-info { min-width: 0; flex: 1; }
.astro-ai-product-info strong { display: block; font-size: 13px; margin-bottom: 2px; }
.astro-ai-product-price { color: var(--astro-primary); font-weight: 700; font-size: 14px; }
.astro-ai-rating { color: #f59e0b; font-size: 12px; }
.astro-ai-oos { color: #b91c1c; font-size: 12px; display: block; }
.astro-ai-qty {
	display: inline-flex; align-items: center; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; margin: 0 10px 8px;
}
.astro-ai-qty button {
	width: 28px; height: 28px; border: 0; background: #f9fafb; cursor: pointer; font-size: 16px;
}
.astro-ai-qty span { min-width: 24px; text-align: center; font-size: 13px; }
.astro-ai-product-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 0 10px 10px; }
.astro-ai-product-btns .astro-ai-btn-ghost { grid-column: 1 / -1; }

.astro-ai-btn {
	display: inline-flex; align-items: center; justify-content: center;
	border-radius: 10px; padding: 8px 10px; font-size: 12px; font-weight: 650;
	text-decoration: none; border: 0; cursor: pointer; line-height: 1.2;
}
.astro-ai-btn-primary { background: var(--astro-primary); color: #fff; }
.astro-ai-btn-secondary { background: var(--astro-header); color: #fff; }
.astro-ai-btn-ghost { background: #fff; color: var(--astro-text); border: 1px solid #e5e7eb; }
.astro-ai-btn:disabled { opacity: .6; cursor: wait; }
.astro-ai-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.astro-ai-escalate {
	margin-top: 8px;
	border: 1px solid #fed7aa;
	background: #fff7ed;
	border-radius: 14px;
	padding: 12px;
}
.astro-ai-escalate p { margin: 0 0 10px; font-size: 13px; }
.astro-ai-escalate-btns { display: grid; gap: 6px; }
.astro-ai-escalate .astro-ai-phone { font-size: 12px; color: var(--astro-muted); margin-top: 6px; }

.astro-ai-tracking {
	margin-top: 8px; border: 1px solid #e5e7eb; border-radius: 14px; padding: 12px; background: #fff;
}
.astro-ai-tracking-header { display: flex; gap: 8px; align-items: center; font-weight: 700; margin-bottom: 8px; }
.astro-ai-tracking-status {
	display: inline-block; background: #ecfdf5; color: #047857; border-radius: 999px; padding: 2px 8px; font-size: 12px; margin-bottom: 8px;
}
.astro-ai-tracking-row { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.astro-ai-tracking-label { color: var(--astro-muted); }

.astro-ai-typing-bubble { display: flex; align-items: center; gap: 8px; }
.astro-ai-dots span {
	width: 6px; height: 6px; border-radius: 50%; background: var(--astro-muted);
	display: inline-block; animation: astro-dot 1.1s infinite ease-in-out;
}
.astro-ai-dots span:nth-child(2) { animation-delay: .15s; }
.astro-ai-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes astro-dot {
	0%, 80%, 100% { opacity: .3; transform: translateY(0); }
	40% { opacity: 1; transform: translateY(-3px); }
}

.astro-ai-footer { border-top: 1px solid #eee; padding: 10px 12px 8px; background: #fff; }
.astro-ai-form { display: flex; gap: 8px; align-items: center; }
.astro-ai-input {
	flex: 1; border: 1px solid #e5e7eb; border-radius: 999px; padding: 10px 14px; outline: none; font: inherit;
}
.astro-ai-input:focus { border-color: var(--astro-primary); }
.astro-ai-send {
	width: 40px; height: 40px; border: 0; border-radius: 50%;
	background: var(--astro-primary); color: #fff; cursor: pointer;
	display: flex; align-items: center; justify-content: center;
}
.astro-ai-legal { margin: 6px 2px 0; font-size: 10px; color: var(--astro-muted); text-align: center; }

.astro-ai-toast {
	position: absolute; left: 16px; right: 16px; bottom: 86px;
	background: var(--astro-header); color: #fff; padding: 10px 12px; border-radius: 10px;
	font-size: 13px; box-shadow: var(--astro-shadow); z-index: 2;
}

@media (max-width: 480px) {
	.astro-ai-root { bottom: 16px !important; right: 12px !important; left: 12px !important; }
	.astro-ai-panel {
		position: fixed;
		inset: 0 0 0 0;
		width: 100%;
		height: 100%;
		border-radius: 0;
		bottom: 0;
	}
	.astro-ai-toggle-label { display: none; }
}
