/* AI Commerce Suite — Frontend Widget (Premium Glassmorphism) */

#ai-cs-widget-root * { box-sizing: border-box; }

.aics-fab {
	position: fixed;
	bottom: 24px;
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--aics-color, #2c5282), color-mix(in srgb, var(--aics-color, #2c5282) 70%, #000));
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 8px 30px rgba(0,0,0,.25), 0 0 0 0 var(--aics-color, #2c5282);
	z-index: 999998;
	transition: transform .25s, box-shadow .25s;
	animation: aics-pulse 2.5s infinite;
}

.aics-fab:hover { transform: scale(1.08); }
.aics-fab-icon { font-size: 28px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.2)); }

.aics-pos-bottom-right { right: 24px; }
.aics-pos-bottom-left  { left: 24px; }

@keyframes aics-pulse {
	0%   { box-shadow: 0 8px 30px rgba(0,0,0,.25), 0 0 0 0 rgba(44,82,130,.5); }
	70%  { box-shadow: 0 8px 30px rgba(0,0,0,.25), 0 0 0 14px rgba(44,82,130,0); }
	100% { box-shadow: 0 8px 30px rgba(0,0,0,.25), 0 0 0 0 rgba(44,82,130,0); }
}

.aics-panel {
	position: fixed;
	bottom: 100px;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 560px;
	max-height: 75vh;
	background: rgba(255,255,255,0.85);
	backdrop-filter: blur(20px) saturate(180%);
	-webkit-backdrop-filter: blur(20px) saturate(180%);
	border: 1px solid rgba(255,255,255,0.3);
	border-radius: 20px;
	box-shadow: 0 20px 60px rgba(0,0,0,.2);
	display: flex;
	flex-direction: column;
	z-index: 999999;
	opacity: 0;
	transform: translateY(20px) scale(.95);
	pointer-events: none;
	transition: opacity .25s, transform .25s;
	overflow: hidden;
	direction: rtl;
	font-family: "Vazirmatn", Tahoma, sans-serif;
}

.aics-panel-open {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: all;
}

.aics-panel-header {
	background: linear-gradient(135deg, var(--aics-color, #2c5282), color-mix(in srgb, var(--aics-color, #2c5282) 70%, #000));
	color: #fff;
	padding: 16px 20px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.aics-panel-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.aics-panel-icon { font-size: 18px; }

.aics-close-btn {
	background: rgba(255,255,255,.2);
	border: none;
	color: #fff;
	width: 28px; height: 28px;
	border-radius: 50%;
	cursor: pointer;
	font-size: 14px;
	display: flex; align-items: center; justify-content: center;
	transition: background .15s;
}
.aics-close-btn:hover { background: rgba(255,255,255,.35); }

.aics-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	background: linear-gradient(180deg, rgba(248,250,252,.5), rgba(255,255,255,.3));
}

.aics-msg { display: flex; }
.aics-msg-user { justify-content: flex-end; }
.aics-msg-bot  { justify-content: flex-start; }

.aics-bubble {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: 14px;
	font-size: 13px;
	line-height: 1.6;
}

.aics-msg-user .aics-bubble {
	background: var(--aics-color, #2c5282);
	color: #fff;
	border-bottom-left-radius: 4px;
}

.aics-msg-bot .aics-bubble {
	background: rgba(255,255,255,.9);
	color: #1e293b;
	border-bottom-right-radius: 4px;
	box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.aics-typing { display: flex; gap: 4px; padding: 14px; }
.aics-typing span {
	width: 6px; height: 6px;
	background: #94a3b8;
	border-radius: 50%;
	animation: aics-bounce 1.2s infinite;
}
.aics-typing span:nth-child(2) { animation-delay: .15s; }
.aics-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes aics-bounce { 0%,60%,100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* Product cards */
.aics-products-wrap {
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: 100%;
	max-width: 100%;
}

.aics-product-card {
	background: rgba(255,255,255,.95);
	border-radius: 14px;
	overflow: hidden;
	box-shadow: 0 2px 10px rgba(0,0,0,.08);
	position: relative;
	display: flex;
	border: 1px solid rgba(0,0,0,.04);
}

.aics-match-badge {
	position: absolute;
	top: 8px;
	left: 8px;
	background: linear-gradient(135deg, #10b981, #059669);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	padding: 3px 8px;
	border-radius: 20px;
	z-index: 2;
	box-shadow: 0 2px 6px rgba(0,0,0,.15);
}

.aics-product-img {
	width: 90px;
	height: 90px;
	object-fit: cover;
	flex-shrink: 0;
}

.aics-product-body { padding: 10px 12px; flex: 1; min-width: 0; }

.aics-product-name {
	font-size: 12.5px;
	font-weight: 600;
	color: #1e293b;
	margin-bottom: 3px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.aics-product-price { font-size: 13px; font-weight: 700; color: var(--aics-color, #2c5282); margin-bottom: 2px; }
.aics-product-rating { font-size: 11px; color: #f59e0b; margin-bottom: 4px; }
.aics-product-why { font-size: 10.5px; color: #64748b; margin-bottom: 8px; font-style: italic; }

.aics-product-actions { display: flex; gap: 6px; }

.aics-btn-view, .aics-btn-cart {
	flex: 1;
	text-align: center;
	padding: 6px 8px;
	border-radius: 8px;
	font-size: 11px;
	font-weight: 600;
	text-decoration: none;
	transition: opacity .15s;
}

.aics-btn-view { background: #f1f5f9; color: #334155; }
.aics-btn-cart { background: var(--aics-color, #2c5282); color: #fff; }
.aics-btn-view:hover, .aics-btn-cart:hover { opacity: .85; }

.aics-input-area {
	display: flex;
	gap: 8px;
	padding: 12px 16px;
	background: rgba(255,255,255,.7);
	border-top: 1px solid rgba(0,0,0,.06);
}

.aics-input-area input {
	flex: 1;
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	padding: 9px 12px;
	font-size: 13px;
	outline: none;
	background: #fff;
	font-family: inherit;
}

.aics-input-area input:focus { border-color: var(--aics-color, #2c5282); }

.aics-send-btn {
	background: var(--aics-color, #2c5282);
	color: #fff;
	border: none;
	border-radius: 10px;
	padding: 9px 16px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: opacity .15s;
}
.aics-send-btn:hover { opacity: .9; }
.aics-send-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Mobile */
@media (max-width: 480px) {
	.aics-panel {
		width: calc(100vw - 24px);
		right: 12px !important;
		left: 12px !important;
		bottom: 90px;
		height: 70vh;
	}
	.aics-fab { bottom: 16px; right: 16px !important; left: auto !important; }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
	.aics-panel { background: rgba(20,20,30,.9); border-color: rgba(255,255,255,.1); }
	.aics-messages { background: linear-gradient(180deg, rgba(15,15,25,.5), rgba(20,20,30,.3)); }
	.aics-msg-bot .aics-bubble { background: rgba(40,40,55,.9); color: #e2e8f0; }
	.aics-product-card { background: rgba(35,35,48,.95); border-color: rgba(255,255,255,.08); }
	.aics-product-name { color: #e2e8f0; }
	.aics-input-area { background: rgba(25,25,35,.7); border-top-color: rgba(255,255,255,.08); }
	.aics-input-area input { background: rgba(35,35,48,.9); border-color: rgba(255,255,255,.1); color: #e2e8f0; }
	.aics-btn-view { background: rgba(255,255,255,.08); color: #cbd5e1; }
}
