/* =========================================================
   Smart Interactive Chatbot — Frontend Styles
   Fully RTL, Persian (Vazirmatn) typography
   ========================================================= */

#smart-chatbot-widget,
#smart-chatbot-widget * {
	box-sizing: border-box;
}

#smart-chatbot-widget {
	--sic-primary: #7c3aed;
	--sic-primary-dark: color-mix(in srgb, var(--sic-primary) 80%, black);
	--sic-radius: 16px;
	--sic-font: 'Vazirmatn', 'Iranian Sans', Tahoma, sans-serif;

	position: fixed !important;
	bottom: var(--sic-bottom, 88px);
	z-index: 999999;
	direction: rtl;
	text-align: right;
	font-family: var(--sic-font);
	transform: none !important;
}

.smart-chatbot-widget.sic-pos-right { right: 24px; }
.smart-chatbot-widget.sic-pos-left  { left: 24px; }

/* ---------------- Launcher button ---------------- */

.sic-launcher {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--sic-primary), var(--sic-primary-dark));
	border: none;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	position: relative;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sic-launcher:hover {
	transform: scale(1.06);
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

/* Attention-grabbing pulsing halo (toggle in settings) */
.sic-pulse-on .sic-launcher::before {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: var(--sic-primary);
	animation: sicHaloPulse 2.4s ease-out infinite;
	pointer-events: none;
}

.sic-pulse-on .sic-launcher::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: var(--sic-primary);
	animation: sicHaloPulse 2.4s ease-out infinite;
	animation-delay: 0.9s;
	pointer-events: none;
}

@keyframes sicHaloPulse {
	0%   { transform: scale(1);   opacity: 0.45; }
	100% { transform: scale(1.9); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
	.sic-pulse-on .sic-launcher::before,
	.sic-pulse-on .sic-launcher::after {
		animation: none;
		display: none;
	}
}

.sic-launcher-icon {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	object-fit: cover;
	pointer-events: none;
	position: relative;
	z-index: 1;
}

.sic-launcher-badge {
	position: absolute;
	top: -2px;
	right: -2px;
	background: #ef4444;
	color: #fff;
	font-size: 11px;
	line-height: 1;
	min-width: 18px;
	height: 18px;
	border-radius: 999px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 2px solid #fff;
	padding: 0 3px;
}

.sic-pos-left .sic-launcher-badge {
	right: auto;
	left: -2px;
}

.sic-launcher-badge.sic-hidden { display: none; }

.sic-launcher-tooltip {
	position: absolute;
	bottom: 18px;
	right: 76px;
	background: #1f2937;
	color: #fff;
	padding: 6px 12px;
	border-radius: 8px;
	font-size: 13px;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transform: translateY(4px);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.sic-pos-left .sic-launcher-tooltip {
	right: auto;
	left: 76px;
}

.smart-chatbot-widget:not(.sic-open):hover .sic-launcher-tooltip {
	opacity: 1;
	transform: translateY(0);
}

/* ---------------- First-visit hint bubble ---------------- */

.sic-hint {
	position: absolute;
	bottom: 6px;
	right: 76px;
	max-width: 340px;
	width: max-content;
	background: #fff;
	color: #1f2937;
	border-radius: 14px;
	padding: 12px 32px 12px 14px;
	font-size: 13px;
	line-height: 1.8;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
	opacity: 0;
	visibility: hidden;
	transform: translateY(10px) scale(0.95);
	transform-origin: bottom right;
	transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
	pointer-events: none;
}

.sic-hint.sic-hint-visible {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
	pointer-events: auto;
	animation: sicHintBounce 0.45s ease;
}

@keyframes sicHintBounce {
	0%   { transform: translateY(10px) scale(0.9); }
	60%  { transform: translateY(-3px) scale(1.02); }
	100% { transform: translateY(0) scale(1); }
}

.sic-hint::after {
	content: '';
	position: absolute;
	bottom: 14px;
	right: -7px;
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 7px 0 7px 7px;
	border-color: transparent transparent transparent #fff;
}

.sic-pos-left .sic-hint {
	right: auto;
	left: 76px;
	transform-origin: bottom left;
}

.sic-pos-left .sic-hint::after {
	right: auto;
	left: -7px;
	border-width: 7px 7px 7px 0;
	border-color: transparent #fff transparent transparent;
}

.sic-hint-text { display: block; }

.sic-hint-close {
	position: absolute;
	top: 6px;
	left: 6px;
	width: 20px;
	height: 20px;
	border: none;
	border-radius: 50%;
	background: #f3f4f6;
	color: #6b7280;
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: background 0.15s ease, color 0.15s ease;
}

.sic-hint-close:hover {
	background: #e5e7eb;
	color: #374151;
}

/* ---------------- Chat window ---------------- */

.sic-window {
	position: absolute;
	bottom: 80px;
	right: 0;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 560px;
	max-height: calc(100vh - 140px);
	background: #fff;
	border-radius: var(--sic-radius);
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	visibility: hidden;
	transform: translateY(16px) scale(0.98);
	transform-origin: bottom left;
	transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
}

.sic-pos-left .sic-window {
	right: auto;
	left: 0;
	transform-origin: bottom right;
}

.smart-chatbot-widget.sic-open .sic-window {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
}

.sic-header {
	background: linear-gradient(135deg, var(--sic-primary), var(--sic-primary-dark));
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	gap: 10px;
	flex-shrink: 0;
}

.sic-header-avatar {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	object-fit: cover;
	background: rgba(255, 255, 255, 0.25);
}

.sic-header-text {
	display: flex;
	flex-direction: column;
	line-height: 1.4;
	flex-grow: 1;
	min-width: 0;
}

.sic-header-title {
	font-size: 14.5px;
	font-weight: 700;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.sic-header-status {
	font-size: 12px;
	opacity: 0.85;
}

.sic-header-status::before {
	content: '';
	display: inline-block;
	width: 7px;
	height: 7px;
	background: #4ade80;
	border-radius: 50%;
	margin-inline-end: 5px;
}

.sic-close-btn {
	background: rgba(255, 255, 255, 0.18);
	border: none;
	color: #fff;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease;
}
.sic-close-btn:hover { background: rgba(255, 255, 255, 0.32); }

.sic-body {
	flex-grow: 1;
	overflow-y: auto;
	background: #f7f7fb;
	padding: 14px;
	scroll-behavior: smooth;
}

.sic-messages {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

/* ---------------- Message bubbles ---------------- */

.sic-msg { display: flex; flex-direction: column; max-width: 88%; animation: sicFadeIn 0.25s ease; }
.sic-msg-bot { align-self: flex-start; align-items: flex-start; }
.sic-msg-user { align-self: flex-end; align-items: flex-end; }

.sic-bubble {
	padding: 10px 14px;
	border-radius: 14px;
	font-size: 13.5px;
	line-height: 1.9;
	word-wrap: break-word;
}

.sic-msg-bot .sic-bubble {
	background: #fff;
	color: #1f2937;
	border: 1px solid #ececf5;
	border-bottom-right-radius: 4px;
	box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.sic-msg-user .sic-bubble {
	background: var(--sic-primary);
	color: #fff;
	border-bottom-left-radius: 4px;
}

.sic-bubble a { color: inherit; text-decoration: underline; }

/* Typing indicator */
.sic-typing .sic-bubble {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 12px 16px;
}
.sic-typing-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #9ca3af;
	animation: sicBlink 1.2s infinite ease-in-out;
}
.sic-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.sic-typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes sicBlink {
	0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
	40% { opacity: 1; transform: translateY(-2px); }
}

@keyframes sicFadeIn {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* ---------------- Option buttons ---------------- */

.sic-options {
	display: flex;
	flex-direction: column;
	gap: 8px;
	align-self: stretch;
	max-width: 100%;
	margin-top: 2px;
}

.sic-option-btn {
	background: #fff;
	border: 1.5px solid var(--sic-primary);
	color: var(--sic-primary);
	font-family: var(--sic-font);
	font-size: 13px;
	font-weight: 600;
	padding: 9px 14px;
	border-radius: 999px;
	cursor: pointer;
	text-align: center;
	transition: background 0.15s ease, color 0.15s ease;
}

.sic-option-btn:hover {
	background: var(--sic-primary);
	color: #fff;
}

.sic-option-btn.sic-option-back {
	border-style: dashed;
	opacity: 0.85;
}

/* ---------------- Product cards ---------------- */

.sic-product-card {
	display: flex;
	gap: 10px;
	background: #fff;
	border: 1px solid #ececf5;
	border-radius: 12px;
	padding: 10px;
	align-items: flex-start;
}

.sic-product-image {
	flex-shrink: 0;
	width: 64px;
	height: 64px;
	border-radius: 8px;
	overflow: hidden;
	background: #f1f1f5;
	display: block;
}

.sic-product-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.sic-product-info {
	display: flex;
	flex-direction: column;
	gap: 3px;
	min-width: 0;
	flex-grow: 1;
}

.sic-product-title {
	font-size: 13px;
	font-weight: 600;
	color: #1f2937;
	text-decoration: none;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.sic-product-price {
	font-size: 12.5px;
	color: var(--sic-primary);
	font-weight: 700;
}
.sic-product-price ins { text-decoration: none; }
.sic-product-price del { opacity: 0.55; margin-inline-end: 4px; font-weight: 400; }

.sic-product-cta {
	align-self: flex-start;
	margin-top: 2px;
	font-size: 11.5px;
	font-weight: 700;
	background: var(--sic-primary);
	color: #fff !important;
	padding: 5px 12px;
	border-radius: 999px;
	text-decoration: none !important;
	transition: opacity 0.15s ease;
}
.sic-product-cta:hover { opacity: 0.85; }

/* ---------------- Variation swatches ---------------- */

.sic-swatch-groups {
	display: flex;
	flex-direction: column;
	gap: 5px;
	margin-top: 4px;
}

.sic-swatch-group {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
}

.sic-swatch-label {
	font-size: 11px;
	color: #6b7280;
	flex-shrink: 0;
}

.sic-swatch-options {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}

.sic-swatch {
	border: 2px solid #e5e7eb;
	cursor: pointer;
	transition: border-color 0.15s ease, transform 0.15s ease;
	font-family: var(--sic-font);
	background: #fff;
}

.sic-swatch-color {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	padding: 0;
}
.sic-swatch-color.is-active,
.sic-swatch-color:hover {
	border-color: var(--sic-primary);
	transform: scale(1.12);
}

.sic-swatch-text {
	font-size: 11px;
	padding: 4px 10px;
	border-radius: 999px;
	background: #f9fafb;
	color: #374151;
}
.sic-swatch-text.is-active {
	border-color: var(--sic-primary);
	background: var(--sic-primary);
	color: #fff;
}
.sic-swatch-text:hover { border-color: var(--sic-primary); }

/* ---------------- Quantity stepper + add to cart ---------------- */

.sic-qty-row {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 6px;
	flex-wrap: wrap;
}

.sic-qty-stepper {
	display: flex;
	align-items: center;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	overflow: hidden;
	flex-shrink: 0;
}

.sic-qty-minus,
.sic-qty-plus {
	width: 24px;
	height: 26px;
	border: none;
	background: #f9fafb;
	color: #374151;
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
}
.sic-qty-minus:hover,
.sic-qty-plus:hover { background: #f3f4f6; }

.sic-qty-input {
	width: 32px;
	height: 26px;
	border: none;
	border-left: 1px solid #e5e7eb;
	border-right: 1px solid #e5e7eb;
	text-align: center;
	font-size: 12px;
	font-family: var(--sic-font);
	-moz-appearance: textfield;
}
.sic-qty-input::-webkit-outer-spin-button,
.sic-qty-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.sic-add-to-cart-btn {
	flex-grow: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	background: var(--sic-primary);
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 6px 10px;
	font-size: 12px;
	font-weight: 700;
	font-family: var(--sic-font);
	cursor: pointer;
	transition: opacity 0.15s ease;
	min-height: 26px;
	white-space: nowrap;
}
.sic-add-to-cart-btn:hover:not(:disabled) { opacity: 0.88; }
.sic-add-to-cart-btn:disabled {
	background: #d1d5db;
	cursor: not-allowed;
}

.sic-cart-icon { font-size: 13px; line-height: 1; }

.sic-cart-spinner {
	width: 14px;
	height: 14px;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: #fff;
	border-radius: 50%;
	display: inline-block;
	animation: sicCartSpin 0.7s linear infinite;
}
@keyframes sicCartSpin { to { transform: rotate(360deg); } }

.sic-cart-feedback {
	font-size: 11px;
	margin-top: 3px;
	min-height: 14px;
}
.sic-cart-feedback.is-success { color: #16a34a; }
.sic-cart-feedback.is-error { color: #dc2626; }
.sic-cart-feedback a {
	color: var(--sic-primary);
	text-decoration: underline;
	margin-inline-start: 4px;
	font-weight: 600;
}

.sic-products-wrap {
	display: flex;
	flex-direction: column;
	gap: 8px;
	width: 100%;
	max-width: 100%;
}

/* ---------------- Footer ---------------- */

.sic-footer {
	border-top: 1px solid #ececf5;
	padding: 8px 12px;
	flex-shrink: 0;
	background: #fff;
}

.sic-menu-btn {
	width: 100%;
	background: transparent;
	border: none;
	color: #6b7280;
	font-family: var(--sic-font);
	font-size: 12.5px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 6px;
	border-radius: 8px;
	transition: background 0.15s ease;
}
.sic-menu-btn:hover { background: #f3f4f6; color: #374151; }

/* ---------------- Scrollbar ---------------- */

.sic-body::-webkit-scrollbar { width: 6px; }
.sic-body::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 999px; }
.sic-body::-webkit-scrollbar-track { background: transparent; }

/* ---------------- Responsive (mobile) ---------------- */

@media (max-width: 480px) {
	#smart-chatbot-widget { bottom: var(--sic-bottom, 72px); }
	.smart-chatbot-widget.sic-pos-right { right: 16px; }
	.smart-chatbot-widget.sic-pos-left { left: 16px; }

	.sic-window {
		width: calc(100vw - 24px);
		height: calc(100vh - 110px);
		bottom: 76px;
		right: -8px;
	}
	.sic-pos-left .sic-window { right: auto; left: -8px; }

	.sic-launcher { width: 56px; height: 56px; }
	.sic-launcher-icon { width: 32px; height: 32px; }

	.sic-hint {
		max-width: calc(100vw - 120px);
		right: 66px;
		font-size: 12.5px;
	}
	.sic-pos-left .sic-hint { left: 66px; }
}
