/* GhaabShop AI Chat — استایل ویجت گفت‌وگو */

#gsc-chat-root {
	direction: rtl;
	font-family: inherit;
}

#gsc-chat-root,
#gsc-chat-root * {
	box-sizing: border-box;
}

/* ── دایره‌ی شناور ── */
.gsc-bubble {
	position: fixed;
	bottom: 22px;
	left: auto;
	right: 22px;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	border: none;
	background: linear-gradient(135deg, #1479c9, #0b5ea8);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 10px 30px rgba(11, 94, 168, 0.35);
	z-index: 2147483000;
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.gsc-bubble:hover {
	transform: translateY(-2px);
	box-shadow: 0 14px 36px rgba(11, 94, 168, 0.42);
}

.gsc-bubble svg {
	width: 26px;
	height: 26px;
	position: absolute;
	transition: opacity 0.15s ease, transform 0.15s ease;
}

.gsc-bubble .gsc-bubble-icon-close {
	opacity: 0;
	transform: scale(0.6) rotate(-45deg);
}

#gsc-chat-root.gsc-open .gsc-bubble .gsc-bubble-icon-chat {
	opacity: 0;
	transform: scale(0.6) rotate(45deg);
}

#gsc-chat-root.gsc-open .gsc-bubble .gsc-bubble-icon-close {
	opacity: 1;
	transform: scale(1) rotate(0deg);
}

/* ── پنل گفت‌وگو ── */
.gsc-panel {
	position: fixed;
	bottom: 96px;
	right: 22px;
	left: auto;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 560px;
	max-height: calc(100vh - 130px);
	background: #ffffff;
	border-radius: 22px;
	box-shadow: 0 24px 70px rgba(10, 30, 60, 0.28);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	z-index: 2147482999;
	opacity: 0;
	transform: translateY(16px) scale(0.98);
	pointer-events: none;
	transition: opacity 0.18s ease, transform 0.18s ease;
	border: 1px solid rgba(20, 121, 201, 0.12);
}

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

/* ── هدر ── */
.gsc-header {
	background: linear-gradient(135deg, #1479c9, #0b5ea8);
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex: 0 0 auto;
}

.gsc-header-title {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	font-weight: 800;
}

.gsc-header-dot {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: #4ade80;
	box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.25);
	flex: 0 0 auto;
}

.gsc-header-actions {
	display: flex;
	align-items: center;
	gap: 6px;
	flex: 0 0 auto;
}

.gsc-header-btn {
	background: rgba(255, 255, 255, 0.18);
	border: none;
	color: #fff;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
}

.gsc-header-btn:hover {
	background: rgba(255, 255, 255, 0.28);
}

.gsc-header-btn svg {
	width: 16px;
	height: 16px;
}

.gsc-header-close {
	font-size: 20px;
}

/* ── بدنه/پیام‌ها ── */
.gsc-body {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 16px;
	background: #f6f9fc;
}

.gsc-messages {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.gsc-msg {
	display: flex;
	max-width: 88%;
}

/* توجه: چون .gsc-messages یک فلکس-ستون داخل کانتینر dir="rtl" است، محور عرضی (چپ/راست)
   برخلاف حالت LTR معکوس می‌شود؛ یعنی این‌جا flex-start یعنی «راست» و flex-end یعنی «چپ».
   پیام خودِ کاربر باید مثل تلگرام/واتساپ فارسی سمت راست باشد. */
.gsc-msg-user {
	align-self: flex-start;
}

.gsc-msg-assistant {
	align-self: flex-end;
}

.gsc-msg-bubble {
	padding: 10px 13px;
	border-radius: 16px;
	font-size: 13.5px;
	line-height: 1.9;
	word-break: break-word;
	overflow-wrap: anywhere;
}

.gsc-msg-user .gsc-msg-bubble {
	background: linear-gradient(135deg, #1479c9, #0b5ea8);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.gsc-msg-assistant .gsc-msg-bubble {
	background: #ffffff;
	color: #16324a;
	border: 1px solid #e2ecf6;
	border-bottom-left-radius: 4px;
}

.gsc-msg-assistant.gsc-msg-error .gsc-msg-bubble {
	background: #fff5f5;
	border-color: #fecaca;
	color: #991b1b;
}

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

.gsc-msg-user .gsc-msg-bubble a {
	color: #eaf4ff;
}

/* ── وضعیت «در حال تایپ» ── */
.gsc-typing-dots {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 13px 15px;
}

.gsc-typing-dots span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #9db6cc;
	animation: gsc-typing-bounce 1.1s infinite ease-in-out;
}

.gsc-typing-dots span:nth-child(2) {
	animation-delay: 0.15s;
}

.gsc-typing-dots span:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes gsc-typing-bounce {
	0%, 60%, 100% {
		transform: translateY(0);
		opacity: 0.5;
	}
	30% {
		transform: translateY(-4px);
		opacity: 1;
	}
}

/* ── فوتر/ورودی ── */
.gsc-footer {
	flex: 0 0 auto;
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px;
	background: #ffffff;
	border-top: 1px solid #eef2f7;
}

.gsc-input {
	flex: 1 1 auto;
	resize: none;
	border: 1px solid #dde6f0;
	border-radius: 14px;
	padding: 10px 12px;
	font-size: 13.5px;
	font-family: inherit;
	max-height: 120px;
	min-height: 40px;
	outline: none;
	background: #f8fbff;
	color: #16324a;
}

.gsc-input:focus {
	border-color: #7cc1ff;
	box-shadow: 0 0 0 3px rgba(20, 121, 201, 0.1);
}

.gsc-send {
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: none;
	background: linear-gradient(135deg, #1479c9, #0b5ea8);
	color: #fff;
	font-size: 16px;
	cursor: pointer;
	transform: scaleX(-1);
}

.gsc-send:hover {
	filter: brightness(1.05);
}

.gsc-send:disabled {
	opacity: 0.6;
	cursor: default;
}

/* ── پیام قفل‌شدن گفت‌وگو (بعد از رسیدن به سقف نوبت‌ها) ── */
.gsc-locked-banner {
	display: none;
	flex: 1 1 auto;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 6px 4px;
	flex-wrap: wrap;
}

.gsc-footer.gsc-footer-locked .gsc-input,
.gsc-footer.gsc-footer-locked .gsc-send {
	display: none;
}

.gsc-footer.gsc-footer-locked .gsc-locked-banner {
	display: flex;
}

.gsc-locked-text {
	font-size: 12.5px;
	line-height: 1.8;
	color: #92400e;
	flex: 1 1 200px;
}

.gsc-locked-newchat-btn {
	flex: 0 0 auto;
	border: none;
	border-radius: 12px;
	padding: 9px 14px;
	background: linear-gradient(135deg, #1479c9, #0b5ea8);
	color: #fff;
	font-size: 12.5px;
	font-weight: 700;
	cursor: pointer;
	white-space: nowrap;
}

.gsc-locked-newchat-btn:hover {
	filter: brightness(1.05);
}

/* ── پنل کشویی لیست گفت‌وگوها ── */
.gsc-conv-panel {
	position: absolute;
	inset: 0;
	top: 0;
	background: #fff;
	z-index: 5;
	display: flex;
	flex-direction: column;
	opacity: 0;
	transform: translateY(-8px);
	pointer-events: none;
	transition: opacity 0.16s ease, transform 0.16s ease;
}

.gsc-conv-panel.is-open {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

.gsc-conv-panel-header {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	border-bottom: 1px solid #eef2f7;
}

.gsc-conv-panel-title {
	font-size: 14px;
	font-weight: 800;
	color: #16324a;
}

.gsc-conv-panel-close {
	background: #f1f5f9;
	border: none;
	color: #475569;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

.gsc-conv-panel-close:hover {
	background: #e2e8f0;
}

.gsc-conv-list {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 10px 12px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.gsc-conv-item {
	display: flex;
	flex-direction: column;
	gap: 3px;
	align-items: flex-start;
	text-align: right;
	width: 100%;
	border: 1px solid #e2ecf6;
	background: #f8fbff;
	border-radius: 12px;
	padding: 10px 12px;
	cursor: pointer;
}

.gsc-conv-item:hover {
	background: #eef6ff;
	border-color: #bcdcff;
}

.gsc-conv-item.is-active {
	border-color: #1479c9;
	background: #e6f4ff;
}

.gsc-conv-item-title {
	font-size: 13px;
	font-weight: 700;
	color: #16324a;
}

.gsc-conv-item-meta {
	font-size: 11px;
	color: #7c8ba1;
}

.gsc-conv-empty {
	padding: 18px 10px;
	text-align: center;
	color: #94a3b8;
	font-size: 12.5px;
}

/* ── حالت موبایل: تمام‌صفحه ── */
@media (max-width: 680px) {
	.gsc-panel {
		bottom: 0;
		right: 0;
		left: 0;
		top: 0;
		width: 100%;
		max-width: 100%;
		height: 100%;
		max-height: 100%;
		border-radius: 0;
	}

	.gsc-bubble {
		bottom: 16px;
		right: 16px;
	}

	#gsc-chat-root.gsc-open .gsc-bubble {
		display: none;
	}

	body.gsc-modal-open {
		overflow: hidden;
	}
}
