/* SellChat — chat widget. All rules scoped under #aipa-root. */
#aipa-root {
	--aipa-accent: #7c3aed;
	--aipa-accent-contrast: #ffffff;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

#aipa-toggle {
	position: fixed; bottom: 20px; z-index: 2147483000;
	background: var(--aipa-accent); color: var(--aipa-accent-contrast);
	border: 0; border-radius: 999px; padding: 12px 18px;
	font-size: 14px; font-weight: 600; cursor: pointer;
	box-shadow: 0 4px 16px rgba(0,0,0,.18);
	display: flex; align-items: center; gap: 8px;
	transition: transform .15s, box-shadow .15s;
}
#aipa-toggle:hover { transform: translateY(-2px); box-shadow: 0 6px 22px rgba(0,0,0,.22); }
#aipa-root.aipa-pos-right #aipa-toggle { right: 20px; }
#aipa-root.aipa-pos-left  #aipa-toggle { left: 20px; }

#aipa-panel {
	position: fixed; bottom: 82px; z-index: 2147483001;
	width: 370px; max-width: calc(100vw - 40px);
	height: 560px; max-height: calc(100vh - 120px);
	background: #fff; border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.25);
	display: none; flex-direction: column; overflow: hidden;
}
#aipa-panel.aipa-open { display: flex; }
#aipa-root.aipa-pos-right #aipa-panel { right: 20px; }
#aipa-root.aipa-pos-left  #aipa-panel { left: 20px; }

.aipa-header {
	background: var(--aipa-accent); color: var(--aipa-accent-contrast);
	padding: 13px 15px; display: flex; justify-content: space-between; align-items: center;
}
.aipa-header strong { font-size: 15px; }
#aipa-close { background: transparent; border: 0; color: inherit; font-size: 24px; line-height: 1; cursor: pointer; padding: 0 4px; }

.aipa-messages { flex: 1; overflow-y: auto; padding: 14px; background: #f7f8fa; }
.aipa-msg { margin-bottom: 10px; display: flex; }
.aipa-msg-bot { justify-content: flex-start; }
.aipa-msg-user { justify-content: flex-end; }
.aipa-bubble {
	max-width: 82%; padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.45;
	white-space: pre-wrap; word-wrap: break-word;
}
.aipa-msg-bot .aipa-bubble { background: #fff; border: 1px solid #e6e8ec; color: #1f2328; }
.aipa-msg-user .aipa-bubble { background: var(--aipa-accent); color: var(--aipa-accent-contrast); }

.aipa-typing span {
	display: inline-block; width: 6px; height: 6px; background: #aaa; border-radius: 50%;
	margin: 0 1px; animation: aipa-bounce 1.4s infinite ease-in-out both;
}
.aipa-typing span:nth-child(1) { animation-delay: -.32s; }
.aipa-typing span:nth-child(2) { animation-delay: -.16s; }
@keyframes aipa-bounce { 0%,80%,100% { transform: scale(0); } 40% { transform: scale(1); } }

/* Product recommendation cards */
.aipa-cards { display: flex; flex-direction: column; gap: 8px; margin: 2px 0 10px; }
.aipa-card {
	display: flex; gap: 10px; background: #fff; border: 1px solid #e6e8ec;
	border-radius: 10px; padding: 8px; align-items: center;
}
.aipa-card img { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; flex: 0 0 auto; background: #f0f1f3; }
.aipa-card-body { min-width: 0; flex: 1; }
.aipa-card-title { font-size: 13px; font-weight: 600; color: #1f2328; line-height: 1.3; }
.aipa-card-price { font-size: 13px; color: var(--aipa-accent); font-weight: 700; margin: 1px 0; }
.aipa-card-reason { font-size: 12px; color: #646970; line-height: 1.35; }
.aipa-card-btn {
	display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 600;
	color: var(--aipa-accent); text-decoration: none;
}
.aipa-card-btn:hover { text-decoration: underline; }

.aipa-form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid #eee; align-items: center; }
#aipa-input {
	flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid #d0d5dd; border-radius: 8px;
	font-size: 14px; font-family: inherit; outline: none;
}
#aipa-input:focus { border-color: var(--aipa-accent); box-shadow: 0 0 0 2px rgba(0,0,0,.06); }
#aipa-send {
	background: var(--aipa-accent); color: var(--aipa-accent-contrast); border: 0; border-radius: 8px;
	padding: 0 14px; height: 38px; cursor: pointer; display: flex; align-items: center;
}
#aipa-send:disabled { opacity: .5; cursor: not-allowed; }

.aipa-footer { padding: 4px 10px 10px; text-align: center; }
#aipa-handoff-btn { background: none; border: 0; color: var(--aipa-accent); font-size: 12px; cursor: pointer; text-decoration: underline; }

.aipa-handoff { padding: 16px; border-top: 1px solid #eee; }
.aipa-handoff h4 { margin: 0 0 4px; color: #1f2328; }
.aipa-handoff-intro { font-size: 13px; color: #646970; margin: 0 0 12px; }
.aipa-handoff input, .aipa-handoff textarea {
	width: 100%; padding: 8px 10px; border: 1px solid #d0d5dd; border-radius: 6px;
	margin-bottom: 8px; font-family: inherit; font-size: 14px; box-sizing: border-box;
}
#aipa-handoff-send {
	background: var(--aipa-accent); color: var(--aipa-accent-contrast); border: 0;
	padding: 10px 16px; border-radius: 6px; cursor: pointer; font-weight: 600;
}
#aipa-handoff-result { margin-top: 10px; font-size: 13px; }
#aipa-handoff-result.aipa-ok { color: #16a34a; }
#aipa-handoff-result.aipa-err { color: #dc2626; }

@media (max-width: 480px) {
	#aipa-panel { width: calc(100vw - 20px); height: calc(100vh - 100px); bottom: 78px; }
	#aipa-root.aipa-pos-right #aipa-panel,
	#aipa-root.aipa-pos-left  #aipa-panel { right: 10px; left: 10px; }
	#aipa-toggle .aipa-toggle-label { display: none; }
	#aipa-root.aipa-pos-right #aipa-toggle { right: 12px; }
	#aipa-root.aipa-pos-left  #aipa-toggle { left: 12px; }
}
