/* Nexus AI Chat — Site Widget styles
 * Scoped under #nac-widget-root to avoid clashing with the host theme.
 */

#nac-widget-root, #nac-widget-root * {
	box-sizing: border-box;
}

/* ---------- floating bubble button ---------- */
.nac-w-bubble {
	position: fixed;
	z-index: 999999;
	bottom: 22px;
	width: 64px;
	height: 64px;
	border-radius: 50%;
	border: none;
	cursor: pointer;
	background: linear-gradient(135deg, var(--nac-w-color, #6366f1) 0%, color-mix(in srgb, var(--nac-w-color, #6366f1) 70%, #000) 100%);
	color: #fff;
	display: flex; align-items: center; justify-content: center;
	box-shadow: 0 12px 30px rgba(0,0,0,.20), 0 4px 10px rgba(0,0,0,.12);
	transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.nac-w-bubble:hover     { transform: scale(1.08) rotate(-2deg); box-shadow: 0 18px 38px rgba(0,0,0,.25); }
.nac-w-bubble:active    { transform: scale(.95); }
.nac-w-bubble svg       { width: 32px; height: 32px; position: relative; z-index: 2; }

.nac-w-pos-bottom-right { right: 22px; }
.nac-w-pos-bottom-left  { left:  22px; }

/* Soft pulse halo around the bubble — draws attention */
.nac-w-pulse {
	position: absolute;
	inset: -4px;
	border-radius: 50%;
	background: var(--nac-w-color, #6366f1);
	opacity: .35;
	animation: nacw-pulse 2.4s ease-out infinite;
	pointer-events: none;
	z-index: 1;
}
@keyframes nacw-pulse {
	0%   { transform: scale(1);    opacity: .35; }
	70%  { transform: scale(1.45); opacity: 0; }
	100% { transform: scale(1.5);  opacity: 0; }
}

/* Online status dot — bottom-right corner of the bubble */
.nac-w-online {
	position: absolute;
	bottom: 4px; right: 4px;
	width: 14px; height: 14px;
	border-radius: 50%;
	background: #22c55e;
	border: 2.5px solid #fff;
	box-shadow: 0 0 0 0 rgba(34,197,94,.6);
	animation: nacw-online 2s ease-in-out infinite;
	z-index: 3;
}
@keyframes nacw-online {
	0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); }
	50%      { box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}

/* Stronger pulse when teaser is shown */
.nac-w-bubble-attention {
	animation: nacw-bounce-attn 1.4s ease-in-out infinite;
}
@keyframes nacw-bounce-attn {
	0%, 100% { transform: translateY(0); }
	50%      { transform: translateY(-6px); }
}

/* unread indicator */
.nac-w-badge {
	position: absolute;
	top: -2px; right: -2px;
	min-width: 20px; height: 20px;
	background: #ef4444;
	color: #fff;
	border-radius: 999px;
	font-size: 11px; font-weight: 700;
	display: flex; align-items: center; justify-content: center;
	padding: 0 6px;
	border: 2px solid #fff;
	z-index: 4;
}

/* ---------- teaser callout above the bubble ---------- */
.nac-w-teaser {
	position: fixed;
	z-index: 999998;
	bottom: 100px;
	max-width: 280px;
	padding: 14px 38px 14px 16px;
	background: #fff;
	color: #1e293b;
	border-radius: 14px;
	box-shadow: 0 12px 30px rgba(0,0,0,.18), 0 4px 12px rgba(0,0,0,.10);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 14px;
	line-height: 1.45;
	cursor: pointer;
	opacity: 0;
	transform: translateY(10px) scale(.92);
	transition: opacity .25s, transform .25s cubic-bezier(.34,1.4,.64,1);
}
.nac-w-teaser.nac-w-teaser-show {
	opacity: 1;
	transform: translateY(0) scale(1);
}
.nac-w-teaser:hover {
	box-shadow: 0 16px 38px rgba(0,0,0,.22);
}
.nac-w-teaser::after {
	content: '';
	position: absolute;
	bottom: -8px;
	width: 0; height: 0;
	border-left: 8px solid transparent;
	border-right: 8px solid transparent;
	border-top: 8px solid #fff;
}
.nac-w-teaser.nac-w-pos-bottom-right        { right: 22px; }
.nac-w-teaser.nac-w-pos-bottom-right::after { right: 22px; }
.nac-w-teaser.nac-w-pos-bottom-left         { left: 22px; }
.nac-w-teaser.nac-w-pos-bottom-left::after  { left: 22px; }
.nac-w-teaser-text { color: #1e293b; }
.nac-w-teaser-close {
	position: absolute;
	top: 4px; right: 4px;
	width: 24px; height: 24px;
	background: transparent;
	border: none;
	color: #94a3b8;
	cursor: pointer;
	border-radius: 6px;
	display: flex; align-items: center; justify-content: center;
}
.nac-w-teaser-close:hover { background: #f1f5f9; color: #475569; }
.nac-w-teaser-close svg   { width: 14px; height: 14px; }

/* ---------- chat panel ---------- */
.nac-w-panel {
	position: fixed;
	z-index: 999999;
	bottom: 95px;
	width: 360px;
	max-width: calc(100vw - 24px);
	height: 540px;
	max-height: calc(100vh - 120px);
	background: #fff;
	border-radius: 18px;
	box-shadow: 0 25px 60px rgba(0,0,0,.25), 0 8px 20px rgba(0,0,0,.12);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	opacity: 0;
	transform: translateY(20px) scale(.95);
	pointer-events: none;
	transition: all .22s cubic-bezier(.34,1.3,.64,1);
}
.nac-w-panel.nac-w-open {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

/* ---------- header ---------- */
.nac-w-head {
	background: var(--nac-w-color, #6366f1);
	color: #fff;
	padding: 18px 18px;
	display: flex; align-items: center; gap: 12px;
	position: relative;
	overflow: hidden;
}
.nac-w-head::before {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(135deg, rgba(255,255,255,.18) 0%, transparent 60%);
	pointer-events: none;
}
.nac-w-head-avatar {
	width: 40px; height: 40px;
	background: rgba(255,255,255,.22);
	border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	font-size: 20px;
	flex-shrink: 0;
}
.nac-w-head-text { flex: 1; min-width: 0; }
.nac-w-head-title    { font-size: 16px; font-weight: 700; }
.nac-w-head-subtitle { font-size: 12px; opacity: .85; margin-top: 2px; }
.nac-w-head-close {
	background: rgba(0,0,0,.22);
	border: none;
	cursor: pointer;
	color: #fff;
	width: 34px; height: 34px;
	border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	font-size: 20px;
	font-weight: 700;
	line-height: 1;
	transition: background .15s, transform .12s;
	position: relative;
	z-index: 3;
	flex-shrink: 0;
}
.nac-w-head-close:hover  { background: rgba(0,0,0,.36); transform: scale(1.08); }
.nac-w-head-close:active { background: rgba(0,0,0,.46); transform: scale(.92); }
.nac-w-head-close svg    {
	width: 18px; height: 18px;
	display: block;
	stroke: #fff;
	stroke-width: 3;
	filter: drop-shadow(0 1px 2px rgba(0,0,0,.25));
}

/* ---------- body / messages ---------- */
.nac-w-body {
	flex: 1;
	overflow-y: auto;
	padding: 18px 14px;
	background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
	display: flex; flex-direction: column; gap: 8px;
}
.nac-w-msg {
	max-width: 80%;
	padding: 10px 14px;
	border-radius: 16px;
	font-size: 14px;
	line-height: 1.5;
	word-wrap: break-word;
	white-space: pre-wrap;
	animation: nacw-pop .25s ease-out;
}
@keyframes nacw-pop {
	from { opacity: 0; transform: translateY(8px) scale(.96); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}
/* Bot's reply → left, white card */
.nac-w-msg.nac-w-bot {
	align-self: flex-start;
	background: #fff;
	border: 1px solid #e2e8f0;
	color: #1e293b;
	border-bottom-left-radius: 4px;
}
/* Visitor's own message → right, brand color */
.nac-w-msg.nac-w-visitor {
	align-self: flex-end;
	background: var(--nac-w-color, #6366f1);
	color: #fff;
	border-bottom-right-radius: 4px;
	box-shadow: 0 4px 12px rgba(99,102,241,.18);
}
/* Inline product images sent by the bot — rendered when a bare image URL
   appears in a reply (e.g. "📸 মেথি মিক্স এর ছবি: https://.../methi.jpg"). */
.nac-w-img-link {
	display: block;
	margin: 8px 0;
	border-radius: 12px;
	overflow: hidden;
	max-width: 280px;
}
.nac-w-img {
	display: block;
	width: 100%;
	max-width: 280px;
	max-height: 320px;
	object-fit: cover;
	border-radius: 12px;
	box-shadow: 0 6px 18px rgba(0,0,0,.12);
	transition: transform .15s ease;
}
.nac-w-img:hover {
	transform: scale(1.02);
}
.nac-w-link {
	color: var(--nac-w-color, #6366f1);
	text-decoration: underline;
	word-break: break-all;
}
.nac-w-msg.nac-w-visitor .nac-w-link {
	color: #fff;
	text-decoration: underline;
}
.nac-w-typing {
	align-self: flex-start;
	background: #fff;
	border: 1px solid #e2e8f0;
	padding: 12px 14px;
	border-radius: 16px;
	border-bottom-left-radius: 4px;
	display: inline-flex; gap: 4px;
}
.nac-w-typing span {
	width: 7px; height: 7px;
	background: #94a3b8;
	border-radius: 50%;
	animation: nacw-bounce 1.4s ease-in-out infinite;
}
.nac-w-typing span:nth-child(2) { animation-delay: .15s; }
.nac-w-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes nacw-bounce {
	0%, 60%, 100% { transform: translateY(0);    opacity: .4; }
	30%           { transform: translateY(-6px); opacity: 1; }
}

/* ---------- footer / composer ---------- */
.nac-w-foot {
	padding: 10px 12px;
	background: #fff;
	border-top: 1px solid #e2e8f0;
	display: flex; gap: 8px; align-items: flex-end;
}
.nac-w-input {
	flex: 1;
	min-height: 40px;
	max-height: 100px;
	border: 1px solid #cbd5e1;
	border-radius: 10px;
	padding: 10px 12px;
	font-size: 14px;
	resize: none;
	font-family: inherit;
	color: #1e293b;
	background: #fff;
	outline: none;
	transition: border-color .15s, box-shadow .15s;
}
.nac-w-input:focus {
	border-color: var(--nac-w-color, #6366f1);
	box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.nac-w-send {
	background: var(--nac-w-color, #6366f1);
	color: #fff;
	border: none;
	width: 42px; height: 42px;
	border-radius: 10px;
	display: flex; align-items: center; justify-content: center;
	cursor: pointer;
	transition: transform .12s, opacity .15s;
	flex-shrink: 0;
}
.nac-w-send:hover  { transform: scale(1.05); }
.nac-w-send:active { transform: scale(.95); }
.nac-w-send:disabled { opacity: .45; cursor: not-allowed; }
.nac-w-send svg { width: 18px; height: 18px; }

/* Attach (📎) and Mic (🎤) buttons — same size as send, neutral palette. */
.nac-w-attach, .nac-w-mic {
	background: #f1f5f9;
	color: #475569;
	border: 1px solid #e2e8f0;
	width: 42px; height: 42px;
	border-radius: 10px;
	font-size: 20px;
	cursor: pointer;
	flex-shrink: 0;
	transition: transform .12s, background .15s;
	display: flex; align-items: center; justify-content: center;
	padding: 0;
}
.nac-w-attach:hover, .nac-w-mic:hover {
	background: #e2e8f0;
	transform: translateY(-1px);
}
.nac-w-attach:active, .nac-w-mic:active {
	transform: scale(.95);
}
/* Mic in recording state — pulsing red. */
.nac-w-mic.nac-w-mic-recording {
	background: #dc2626 !important;
	color: #fff !important;
	border-color: #b91c1c !important;
	animation: nac-w-rec-pulse 1s infinite;
}
@keyframes nac-w-rec-pulse {
	0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,.5); }
	50%     { box-shadow: 0 0 0 8px rgba(220,38,38,0); }
}

/* ---------- powered-by footer ---------- */
.nac-w-powered {
	text-align: center;
	font-size: 10.5px;
	padding: 6px 0 8px;
	background: #fff;
	color: #94a3b8;
	border-top: 1px solid #f1f5f9;
}
.nac-w-powered a {
	color: #94a3b8;
	text-decoration: none;
	font-weight: 600;
}

/* ---------- mobile ---------- */
@media (max-width: 480px) {
	.nac-w-panel {
		bottom: 86px;
		width: calc(100vw - 16px);
		height: calc(100vh - 110px);
		max-height: none;
		border-radius: 14px;
	}
	.nac-w-bubble {
		width: 56px; height: 56px;
		bottom: 18px;
	}
	.nac-w-pos-bottom-right { right: 14px; }
	.nac-w-pos-bottom-left  { left:  14px; }
}
