/* =====================================================
   Smart AI Chatbot - Widget Styles
   بخش اول: ظاهر ربات شناور (بدون تغییر نسبت به طرح اصلی)
===================================================== */

#sacWidgetWrapper{
	direction:ltr;
	font-family: inherit !important;
}

#sacWidgetWrapper *{
	font-family: inherit !important;
}

.ai-mini-bot{

	position:fixed !important;

	left:24px !important;
	right:auto !important;

	bottom:75px !important;

	width:var(--sac-icon-size, 92px);
	height:var(--sac-icon-size, 92px);

	display:flex;
	align-items:center;
	justify-content:center;

	z-index:999999 !important;

	text-decoration:none !important;

	cursor:pointer;

	isolation:isolate;

	pointer-events:auto;
}

.ai-bot{

	position:relative;

	flex-shrink:0;

	width:150px;
	height:150px;

	z-index:2;

	transform-origin:center center;

	/* مقیاس‌دهی بدون بهم ریختن چیدمان داخلی که بر اساس px طراحی ۱۵۰px است */
	transform: scale(var(--sac-icon-scale, .613));

	animation: aiBotFloat 4s ease-in-out infinite;

	transition: transform .45s cubic-bezier(.2,.8,.2,1);
}

.ai-mini-bot:hover .ai-bot{
	transform: scale(calc(var(--sac-icon-scale, .613) * 1.06)) translateY(-3px);
}

/* هاله شیشه‌ای پشت ربات - شکل و شعاعش از تنظیمات قابل کنترله (از مربع تا دایره) */
.ai-glass-shell{

	position:absolute;

	inset:-6px;

	border-radius:var(--sac-icon-glass-radius, 50%);

	z-index:1;

	background: linear-gradient(155deg, rgba(255,255,255,.30) 0%, rgba(255,255,255,.06) 55%, rgba(255,255,255,.14) 100%);

	backdrop-filter: blur(var(--sac-glass-blur, 18px)) saturate(180%);
	-webkit-backdrop-filter: blur(var(--sac-glass-blur, 18px)) saturate(180%);

	border:1px solid rgba(255,255,255,.45);

	box-shadow:
		inset 0 1px 1px rgba(255,255,255,.55),
		inset 0 -10px 18px rgba(0,20,60,.10),
		0 10px 26px rgba(0,20,60,.20);

	transition: box-shadow .45s ease, border-color .45s ease, background .45s ease, border-radius .3s ease;

	pointer-events:none;
}

.ai-mini-bot:hover .ai-glass-shell{
	border-color: rgba(230,200,255,.6);
	box-shadow:
		inset 0 1px 1px rgba(255,255,255,.6),
		inset 0 -10px 18px rgba(60,0,100,.14),
		0 12px 30px rgba(139,92,246,.30);
}

/* عکس اختصاصی آیکون - جایگزین شکل انیمیشنی پیش‌فرض ربات */
.ai-custom-icon{

	position:relative;

	z-index:2;

	width: calc(var(--sac-icon-size, 92px) - 16px);
	height: calc(var(--sac-icon-size, 92px) - 16px);

	border-radius: var(--sac-icon-glass-radius, 50%);

	object-fit:cover;

	box-shadow: 0 6px 18px rgba(0,20,60,.28);

	transition: transform .45s cubic-bezier(.2,.8,.2,1), box-shadow .45s ease;
}

.ai-mini-bot:hover .ai-custom-icon{
	transform: scale(1.06) translateY(-3px);
	box-shadow: 0 8px 22px rgba(139,92,246,.35);
}

.ai-body{

	position:absolute;

	width:120px;
	height:90px;

	left:50%;
	top:43px;

	transform: translateX(-50%);

	border-radius: 22px 22px 27px 27px;

	background: linear-gradient(145deg, var(--sac-c1, #35baf0) 0%, var(--sac-c1, #1288d7) 45%, var(--sac-c2, #0759b6) 100%);

	border: 1px solid rgba(100,220,255,.7);

	box-shadow:
		inset 5px 5px 12px rgba(255,255,255,.20),
		inset -7px -9px 13px rgba(0,30,100,.35),
		0 5px 16px rgba(0,80,180,.25);

	z-index:3;

	transition: filter .5s ease, border-color .5s ease, box-shadow .5s ease;
}

.ai-mini-bot:hover .ai-body{

	filter: brightness(1.12) saturate(1.15);

	border-color: rgba(220,190,255,.95);

	box-shadow:
		inset 5px 5px 12px rgba(255,255,255,.22),
		inset -7px -9px 13px rgba(40,0,100,.35),
		0 5px 20px rgba(0,0,0,.25),
		0 0 32px var(--sac-c2, rgba(139,92,246,.35));
}

.ai-core-glow{

	position:absolute;

	width:70px;
	height:70px;

	left:50%;
	top:50%;

	transform: translate(-50%,-50%);

	border-radius:50%;

	background: radial-gradient(circle, rgba(90,220,255,.15), transparent 68%);

	pointer-events:none;

	transition: background .5s ease;
}

.ai-mini-bot:hover .ai-core-glow{
	background: radial-gradient(circle, rgba(220,170,255,.25), transparent 68%);
}

.ai-ear{

	position:absolute;

	width:31px;
	height:36px;

	top:70px;

	border-radius:20px;

	background: linear-gradient(145deg, var(--sac-c1, #1fa8e8), var(--sac-c1, #0870c6));

	border: 1px solid rgba(40,180,255,.45);

	z-index:1;

	transition: filter .5s ease, box-shadow .5s ease;
}

.ai-ear-left{ left:7px; }
.ai-ear-right{ right:7px; }

.ai-mini-bot:hover .ai-ear{
	filter: brightness(1.1) saturate(1.2) hue-rotate(15deg);
	box-shadow: 0 0 15px var(--sac-c2, rgba(139,92,246,.45));
}

.ai-face{

	position:absolute;

	width:85px;
	height:55px;

	left:50%;
	top:50%;

	transform: translate(-50%,-50%);

	border-radius:12px;

	background: linear-gradient(145deg, #075bad, #043a80);

	box-shadow:
		inset 3px 3px 8px rgba(0,0,0,.25),
		inset -2px -2px 7px rgba(0,160,255,.10);

	overflow:hidden;
}

.ai-face-grid{

	position:absolute;

	inset:0;

	opacity:.13;

	background-image:
		linear-gradient(rgba(100,230,255,.5) 1px, transparent 1px),
		linear-gradient(90deg, rgba(100,230,255,.5) 1px, transparent 1px);

	background-size:10px 10px;

	animation: aiGridMove 4s linear infinite;

	pointer-events:none;
}

.ai-mini-bot:hover .ai-face-grid{
	background-image:
		linear-gradient(rgba(220,170,255,.65) 1px, transparent 1px),
		linear-gradient(90deg, rgba(220,170,255,.65) 1px, transparent 1px);
}

.ai-eye{

	position:absolute;

	width:8px;
	height:23px;

	top:16px;

	border-radius:10px;

	background: linear-gradient(180deg, #9cffff 0%, #32e8f7 45%, #08afd9 100%);

	box-shadow:
		0 0 5px rgba(105,255,255,.9),
		0 0 12px rgba(25,225,255,.8),
		0 0 20px rgba(0,190,255,.4);

	will-change:transform;

	overflow:hidden;

	transition: background .4s ease, box-shadow .4s ease;
}

.ai-eye-1{ left:20px; }
.ai-eye-2{ right:20px; }

.ai-mini-bot:hover .ai-eye{
	background: linear-gradient(180deg, #ffffff 0%, #e0b3ff 45%, #a855f7 100%);
	box-shadow:
		0 0 5px rgba(255,230,255,.95),
		0 0 13px rgba(216,160,255,.9),
		0 0 22px rgba(139,92,246,.7);
}

.ai-eyelid{

	position:absolute;

	inset:0;

	width:100%;
	height:100%;

	z-index:5;

	background:#0752a2;

	transform: translateY(-110%);

	animation: eyeBlink 5.2s infinite;
}

.ai-mini-bot:hover .ai-eyelid{ background:#4c1d95; }

@keyframes eyeBlink{
	0%,42%,48%,100%{ transform: translateY(-110%); }
	44%,46%{ transform: translateY(0%); }
}

.ai-antenna{

	position:absolute;

	width:28px;
	height:44px;

	left:50%;
	top:3px;

	transform: translateX(-50%);

	transform-origin: bottom center;

	z-index:5;

	animation: aiAntennaMove 3s ease-in-out infinite;
}

.ai-antenna-line{

	position:absolute;

	width:4px;
	height:31px;

	bottom:0;
	left:50%;

	transform: translateX(-50%);

	border-radius:10px;

	background: linear-gradient(90deg, var(--sac-c1, #0872c8), #58e1ff, var(--sac-c1, #0872c8));

	box-shadow: 0 0 5px rgba(50,220,255,.7);

	transition: filter .5s ease, box-shadow .5s ease;
}

.ai-mini-bot:hover .ai-antenna-line{
	filter: hue-rotate(60deg) saturate(1.2);
	box-shadow: 0 0 8px var(--sac-c2, rgba(190,120,255,.95));
}

.ai-antenna-dot{

	position:absolute;

	width:13px;
	height:13px;

	left:50%;
	top:0;

	transform: translateX(-50%);

	border-radius:50%;

	background: radial-gradient(circle at 35% 30%, #ffffff, #42ddff 40%, #087fd3);

	box-shadow:
		0 0 7px #56e8ff,
		0 0 14px rgba(0,200,255,.7);

	transition: background .5s ease, box-shadow .5s ease;
}

.ai-mini-bot:hover .ai-antenna-dot{
	background: radial-gradient(circle at 35% 30%, #ffffff, #e7b8ff 40%, #8b5cf6);
	box-shadow:
		0 0 8px #e0b0ff,
		0 0 18px rgba(139,92,246,.9);
}

.ai-foot{

	position:absolute;

	width:19px;
	height:9px;

	left:50%;
	top:131px;

	transform: translateX(-50%);

	border-radius: 3px 3px 5px 5px;

	background: linear-gradient(180deg, #5c6878, #222b38);

	box-shadow: 0 2px 4px rgba(0,0,0,.35);

	z-index:6;
}

.ai-particles{
	position:absolute;
	inset:0;
	pointer-events:none;
	opacity:1;
	z-index:-1;
}

.ai-particles span{

	position:absolute;

	font-family: Arial, sans-serif;

	font-size:8px;

	font-weight:700;

	letter-spacing:1px;

	color: rgba(70,220,255,.80);

	text-shadow:
		0 0 7px rgba(30,210,255,.75),
		0 0 14px rgba(30,170,255,.40);

	white-space:nowrap;

	animation: aiTextFloat 3.2s linear infinite;

	transition: color .45s ease, text-shadow .45s ease;

	will-change: transform, opacity;
}

.ai-mini-bot:hover .ai-particles span{
	color: rgba(215,170,255,.98);
	text-shadow:
		0 0 7px rgba(190,120,255,.95),
		0 0 15px rgba(139,92,246,.80),
		0 0 25px rgba(139,92,246,.40);
}

.ai-particles span:nth-child(1){ left:-4px; top:70px; animation-delay:0s; }
.ai-particles span:nth-child(2){ right:-15px; top:75px; animation-delay:.9s; }
.ai-particles span:nth-child(3){ left:-15px; top:88px; animation-delay:1.6s; }
.ai-particles span:nth-child(4){ right:-3px; top:92px; animation-delay:2.2s; }
.ai-particles span:nth-child(5){ left:15px; top:65px; animation-delay:1.1s; }
.ai-particles span:nth-child(6){ right:5px; top:82px; animation-delay:2.7s; }

@keyframes aiTextFloat{
	0%{ transform: translate3d(0,22px,0) scale(.65); opacity:0; }
	12%{ transform: translate3d(0,14px,0) scale(.85); opacity:.8; }
	25%{ transform: translate3d(0,5px,0) scale(1); opacity:1; }
	55%{ transform: translate3d(0,-18px,0) scale(1); opacity:.9; }
	75%{ transform: translate3d(0,-38px,0) scale(.95); opacity:.55; }
	90%{ transform: translate3d(0,-55px,0) scale(.8); opacity:.15; }
	100%{ transform: translate3d(0,-70px,0) scale(.65); opacity:0; }
}

@keyframes aiBotFloat{
	0%,100%{ transform: scale(var(--sac-icon-scale, .613)) translateY(0); }
	50%{ transform: scale(var(--sac-icon-scale, .613)) translateY(-4px); }
}

@keyframes aiAntennaMove{
	0%,100%{ transform: translateX(-50%) rotate(-3deg); }
	50%{ transform: translateX(-50%) rotate(3deg); }
}

@keyframes aiGridMove{
	0%{ background-position:0 0, 0 0; }
	100%{ background-position:10px 10px, 10px 10px; }
}

/* توجه: تنظیمات دقیق موبایل (اندازه/موقعیت) اکنون به‌صورت پویا از پیشخوان ساخته می‌شود */

.elementor-editor-active .ai-mini-bot{ position:fixed !important; }

/* =====================================================
   بخش دوم: پنل چت (طراحی جدید هماهنگ با تم آبی/بنفش ربات)
===================================================== */

.sac-chat-panel{

	all: initial;

	/* all:initial جهت rtl که از attribute="dir" میاد رو ریست می‌کرد؛ اینجا صریحاً برمی‌گردونیم */
	direction:rtl;
	unicode-bidi:isolate;

	position:fixed !important;
	box-sizing:border-box;

	left:24px !important;
	bottom:235px !important;

	width:340px;
	max-width:calc(100vw - 32px);
	height:460px;
	max-height:calc(100vh - 320px);

	/* شیشه‌ای واقعی / Glassmorphism به سبک اپل */
	background: linear-gradient(165deg, var(--sac-panel-bg-1, rgba(30,42,70,.62)) 0%, var(--sac-panel-bg-2, rgba(8,14,30,.62)) 100%);

	backdrop-filter: blur(var(--sac-glass-blur, 28px)) saturate(190%) brightness(1.05);
	-webkit-backdrop-filter: blur(var(--sac-glass-blur, 28px)) saturate(190%) brightness(1.05);

	border:1px solid var(--sac-panel-border, rgba(255,255,255,.18));

	border-radius:var(--sac-panel-radius, 22px);

	box-shadow:
		0 20px 50px rgba(0,10,40,.45),
		0 0 0 1px rgba(255,255,255,.05) inset,
		0 1px 0 rgba(255,255,255,.14) inset;

	display:flex;
	flex-direction:column;

	overflow:hidden;

	opacity:0;
	transform:translateY(16px) scale(.97);
	pointer-events:none;

	transition: opacity .28s ease, transform .28s ease;

	z-index:999998 !important;

	font-family: inherit !important;

	color: var(--sac-text-color, #fff);
}

.sac-chat-panel *{
	font-family: inherit !important;
}

.sac-chat-panel *{
	box-sizing:border-box;
}

.sac-chat-panel.sac-open{
	opacity:1;
	transform:translateY(0) scale(1);
	pointer-events:auto;
}

/* درخشش متحرک روی سطح شیشه - جلوه Liquid Glass */
.sac-chat-panel::after{
	content:"";
	position:absolute;
	top:0;
	left:-60%;
	width:45%;
	height:100%;
	background: linear-gradient(115deg, transparent 0%, rgba(255,255,255,.16) 45%, transparent 100%);
	transform: skewX(-18deg);
	pointer-events:none;
	animation: sacGlassShine 6s ease-in-out infinite;
	z-index:5;
}

@keyframes sacGlassShine{
	0%{ left:-60%; }
	35%{ left:130%; }
	100%{ left:130%; }
}

.sac-chat-header{

	display:flex;
	align-items:center;
	justify-content:space-between;

	padding:14px 16px;

	background: linear-gradient(135deg, color-mix(in srgb, var(--sac-c1, #3096dc) 55%, transparent) 0%, color-mix(in srgb, var(--sac-c2, #145ab4) 55%, transparent) 100%);

	backdrop-filter: blur(14px) saturate(160%);
	-webkit-backdrop-filter: blur(14px) saturate(160%);

	border-bottom:1px solid rgba(255,255,255,.14);

	flex-shrink:0;

	position:relative;
	z-index:6;
}

.sac-chat-title{
	color:#fff;
	font-size:13.5px;
	font-weight:700;
	line-height:1.6;
}

.sac-chat-close{
	all: unset;

	box-sizing:border-box;

	width:26px;
	height:26px;

	display:flex;
	align-items:center;
	justify-content:center;

	background:rgba(255,255,255,.14);

	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);

	border:1px solid rgba(255,255,255,.18);

	border-radius:50%;

	color:#fff;

	cursor:pointer;

	flex-shrink:0;

	transition: background .2s ease, transform .2s ease;
}

.sac-chat-close:hover{
	background:rgba(255,255,255,.26);
	transform:scale(1.06);
}

.sac-chat-close:active{
	transform:scale(.94);
}

.sac-close-icon{
	position:relative;
	display:block;
	width:12px;
	height:12px;
}

.sac-close-icon::before,
.sac-close-icon::after{
	content:"";
	position:absolute;
	top:50%;
	left:50%;
	width:100%;
	height:2px;
	background:#fff;
	border-radius:2px;
}

.sac-close-icon::before{ transform:translate(-50%,-50%) rotate(45deg); }
.sac-close-icon::after{ transform:translate(-50%,-50%) rotate(-45deg); }

.sac-chat-body{

	flex:1;

	overflow-y:auto;

	padding:14px;

	display:flex;
	flex-direction:column;
	gap:10px;
}

.sac-chat-body::-webkit-scrollbar{ width:6px; }
.sac-chat-body::-webkit-scrollbar-thumb{ background:rgba(100,180,255,.35); border-radius:10px; }

.sac-msg{
	max-width:88%;
	font-size:13px;
	line-height:1.9;
	padding:10px 13px;
	border-radius:14px;
	word-wrap:break-word;
}

.sac-msg-bot{
	align-self:flex-end;
	background:rgba(120,150,200,.16);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	color:var(--sac-text-color, #e7f3ff);
	border:1px solid rgba(255,255,255,.16);
	border-bottom-left-radius:4px;
}

.sac-msg-user{
	align-self:flex-start;
	background: linear-gradient(135deg, var(--sac-c1, #7c3aed), var(--sac-c2, #4c1d95));
	color:#fff;
	border-bottom-right-radius:4px;
}

.sac-msg-loading{
	align-self:flex-end;
	display:flex;
	gap:5px;
	padding:12px 14px;
}

.sac-msg-loading span{
	width:6px;
	height:6px;
	border-radius:50%;
	background:rgba(150,210,255,.85);
	animation: sacLoadingBounce 1s infinite ease-in-out;
}

.sac-msg-loading span:nth-child(2){ animation-delay:.15s; }
.sac-msg-loading span:nth-child(3){ animation-delay:.3s; }

@keyframes sacLoadingBounce{
	0%,80%,100%{ transform:translateY(0); opacity:.5; }
	40%{ transform:translateY(-5px); opacity:1; }
}

.sac-results{
	display:flex;
	flex-direction:column;
	gap:8px;
	width:100%;
	max-width:100%;
}

.sac-result-card{

	display:flex;
	gap:10px;

	background:rgba(255,255,255,.06);

	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);

	border:1px solid rgba(255,255,255,.14);

	border-radius:14px;

	padding:9px;

	text-decoration:none;

	transition: border-color .2s ease, background .2s ease, transform .2s ease;
}

.sac-result-card:hover{
	border-color:var(--sac-c2, rgba(200,170,255,.55));
	background:color-mix(in srgb, var(--sac-c2, #8b5cf6) 16%, transparent);
	transform:translateY(-1px);
}

.sac-result-thumb{
	width:52px;
	height:52px;
	border-radius:9px;
	flex-shrink:0;
	object-fit:cover;
	background:rgba(255,255,255,.08);
}

.sac-result-info{
	display:flex;
	flex-direction:column;
	gap:3px;
	min-width:0;
}

.sac-result-badge{
	display:inline-block;
	font-size:10px;
	font-weight:700;
	padding:1px 8px;
	border-radius:20px;
	width:fit-content;
}

.sac-result-badge.post{
	background:rgba(50,180,255,.18);
	color:#7fd6ff;
}

.sac-result-badge.product{
	background:rgba(139,92,246,.2);
	color:#cfa8ff;
}

.sac-result-title{
	color:var(--sac-text-color, #fff);
	font-size:12.5px;
	font-weight:600;
	white-space:nowrap;
	overflow:hidden;
	text-overflow:ellipsis;
}

.sac-result-excerpt{
	color:color-mix(in srgb, var(--sac-text-color, #fff) 70%, transparent);
	font-size:11px;
	line-height:1.6;
	overflow:hidden;
	display:-webkit-box;
	-webkit-line-clamp:2;
	-webkit-box-orient:vertical;
}

.sac-result-price{
	color:#8ee6ff;
	font-size:11px;
	font-weight:700;
}

.sac-chat-input-row{

	display:flex;
	align-items:center;
	gap:8px;

	padding:10px;

	border-top:1px solid rgba(255,255,255,.12);

	background:rgba(255,255,255,.03);

	backdrop-filter: blur(14px);
	-webkit-backdrop-filter: blur(14px);

	flex-shrink:0;
}

.sac-chat-input{

	all: unset;

	box-sizing:border-box;

	flex:1;
	min-width:0;

	background:rgba(255,255,255,.08);

	border:1px solid rgba(255,255,255,.16);

	border-radius:12px;

	color:#fff;

	font-size:13px;

	padding:10px 13px;

	transition: border-color .2s ease, background .2s ease;
}

.sac-chat-input::placeholder{
	color:rgba(220,235,255,.45);
}

.sac-chat-input:focus{
	border-color:var(--sac-c1, rgba(139,180,255,.55));
	background:rgba(255,255,255,.12);
}

.sac-chat-input{
	color:var(--sac-text-color, #fff);
}

.sac-chat-send{

	all: unset;

	box-sizing:border-box;

	width:40px;
	height:40px;

	flex-shrink:0;

	display:flex;
	align-items:center;
	justify-content:center;

	border-radius:12px;

	background: linear-gradient(135deg, var(--sac-c1, #8b5cf6), var(--sac-c2, #6d28d9));

	border:1px solid rgba(255,255,255,.18);

	box-shadow: 0 4px 14px color-mix(in srgb, var(--sac-c2, #7c3aed) 45%, transparent);

	color:#fff;

	cursor:pointer;

	transition: transform .2s ease, filter .2s ease, box-shadow .2s ease;
}

.sac-send-icon{
	display:block;
	width:16px;
	height:16px;
	background:#ffffff;
	/* پیکان ارسال به سمت چپ، هماهنگ با چیدمان راست‌به‌چپ پنل */
	clip-path: polygon(88% 12%, 10% 50%, 88% 88%, 66% 50%);
}

.sac-chat-send:hover{
	filter:brightness(1.12);
	transform:scale(1.05);
	box-shadow: 0 6px 18px rgba(124,58,237,.5);
}

.sac-chat-send:active{
	transform:scale(.95);
}

@media (max-width:600px){

	.sac-chat-panel{
		left:8px !important;
		right:8px !important;
		bottom:200px !important;
		width:auto;
		max-width:calc(100vw - 16px);
		height:420px;
		max-height:calc(100vh - 280px);
	}
}
