/*
 * Water Power Technology Chatbot - Stylesheet
 * الألوان: أزرق (#0B5FFF) - أبيض (#FFFFFF) - أسود/رمادي غامق (#111827)
 */

#wpt-chatbot-root,
#wpt-chatbot-root * {
	box-sizing: border-box;
	font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
}

#wpt-chatbot-root {
	--wpt-blue: #0B5FFF;
	--wpt-blue-dark: #0847c4;
	--wpt-black: #111827;
	--wpt-white: #ffffff;
	--wpt-gray-light: #f1f4f9;
	--wpt-gray-border: #e2e6ee;

	position: fixed;
	bottom: 24px;
	left: 24px;
	z-index: 999999;
	direction: rtl;
}

/* ===================== */
/* الأيقونة العائمة */
/* ===================== */
#wpt-chatbot-toggle {
	width: 62px;
	height: 62px;
	border-radius: 50%;
	background: var(--wpt-blue);
	color: var(--wpt-white);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 6px 20px rgba(11, 95, 255, 0.4);
	transition: transform 0.25s ease, box-shadow 0.25s ease;
	position: relative;
}

#wpt-chatbot-toggle:hover {
	transform: scale(1.06);
	box-shadow: 0 8px 24px rgba(11, 95, 255, 0.5);
}

#wpt-chatbot-toggle .wpt-icon {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

#wpt-chatbot-toggle .wpt-icon-close {
	opacity: 0;
	transform: scale(0.5) rotate(-90deg);
}

#wpt-chatbot-root.wpt-open #wpt-chatbot-toggle .wpt-icon-chat {
	opacity: 0;
	transform: scale(0.5) rotate(90deg);
}

#wpt-chatbot-root.wpt-open #wpt-chatbot-toggle .wpt-icon-close {
	opacity: 1;
	transform: scale(1) rotate(0deg);
}

/* ===================== */
/* نافذة المحادثة */
/* ===================== */
#wpt-chatbot-window {
	position: absolute;
	bottom: 78px;
	left: 0;
	width: 360px;
	max-width: calc(100vw - 32px);
	height: 520px;
	max-height: calc(100vh - 140px);
	background: var(--wpt-white);
	border-radius: 16px;
	box-shadow: 0 12px 40px rgba(17, 24, 39, 0.25);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	visibility: hidden;
	transform: translateY(20px) scale(0.96);
	transform-origin: bottom left;
	transition: opacity 0.28s ease, transform 0.28s ease, visibility 0.28s;
	border: 1px solid var(--wpt-gray-border);
}

#wpt-chatbot-root.wpt-open #wpt-chatbot-window {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
}

/* ===================== */
/* الهيدر */
/* ===================== */
#wpt-chatbot-header {
	background: linear-gradient(135deg, var(--wpt-black), #1f2937);
	color: var(--wpt-white);
	padding: 14px 16px;
	display: flex;
	align-items: center;
	gap: 10px;
	flex-shrink: 0;
	border-bottom: 3px solid var(--wpt-blue);
}

.wpt-header-avatar {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: var(--wpt-blue);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	color: var(--wpt-white);
}

.wpt-header-info {
	display: flex;
	flex-direction: column;
	flex-grow: 1;
	line-height: 1.3;
}

.wpt-header-info #wpt-chatbot-header-title {
	font-weight: 700;
	font-size: 14.5px;
}

.wpt-header-status {
	font-size: 12px;
	color: #9ca3af;
}

.wpt-header-status::before {
	content: '';
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #22c55e;
	margin-left: 5px;
}

#wpt-chatbot-close-btn {
	background: transparent;
	border: none;
	color: var(--wpt-white);
	font-size: 22px;
	cursor: pointer;
	line-height: 1;
	padding: 4px 8px;
	opacity: 0.85;
}

#wpt-chatbot-close-btn:hover {
	opacity: 1;
}

/* ===================== */
/* جسم المحادثة */
/* ===================== */
#wpt-chatbot-body {
	flex-grow: 1;
	overflow-y: auto;
	padding: 16px;
	background: var(--wpt-gray-light);
	display: flex;
	flex-direction: column;
	gap: 10px;
}

#wpt-chatbot-body::-webkit-scrollbar {
	width: 6px;
}

#wpt-chatbot-body::-webkit-scrollbar-thumb {
	background: #c7cfdd;
	border-radius: 10px;
}

/* فقاعات الرسائل */
.wpt-bubble {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: 14px;
	font-size: 13.5px;
	line-height: 1.7;
	animation: wptFadeIn 0.25s ease;
	word-wrap: break-word;
}

.wpt-bubble-bot {
	background: var(--wpt-white);
	color: var(--wpt-black);
	border: 1px solid var(--wpt-gray-border);
	border-bottom-left-radius: 4px;
	align-self: flex-start;
}

.wpt-bubble-user {
	background: var(--wpt-blue);
	color: var(--wpt-white);
	border-bottom-right-radius: 4px;
	align-self: flex-end;
}

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

/* منطقة أزرار الأسئلة الشائعة */
.wpt-faq-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
	align-self: flex-start;
	max-width: 100%;
	width: 100%;
}

.wpt-faq-btn {
	background: var(--wpt-white);
	border: 1.5px solid var(--wpt-blue);
	color: var(--wpt-blue);
	padding: 9px 14px;
	border-radius: 20px;
	font-size: 13px;
	cursor: pointer;
	text-align: right;
	transition: background 0.2s ease, color 0.2s ease;
}

.wpt-faq-btn:hover {
	background: var(--wpt-blue);
	color: var(--wpt-white);
}

.wpt-faq-btn:disabled {
	opacity: 0.5;
	cursor: default;
}

.wpt-faq-btn.wpt-answered {
	background: var(--wpt-gray-light);
	border-color: var(--wpt-gray-border);
	color: #6b7280;
}

/* مؤشر الكتابة */
.wpt-typing {
	display: flex;
	align-items: center;
	gap: 4px;
	align-self: flex-start;
	background: var(--wpt-white);
	border: 1px solid var(--wpt-gray-border);
	padding: 10px 14px;
	border-radius: 14px;
	border-bottom-left-radius: 4px;
}

.wpt-typing span {
	width: 6px;
	height: 6px;
	background: #9ca3af;
	border-radius: 50%;
	display: inline-block;
	animation: wptTyping 1.2s infinite ease-in-out;
}

.wpt-typing span:nth-child(2) {
	animation-delay: 0.2s;
}

.wpt-typing span:nth-child(3) {
	animation-delay: 0.4s;
}

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

/* ===================== */
/* الفوتر */
/* ===================== */
#wpt-chatbot-footer {
	display: flex;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid var(--wpt-gray-border);
	background: var(--wpt-white);
	flex-shrink: 0;
}

.wpt-footer-btn {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 10px 8px;
	border-radius: 10px;
	font-size: 12.5px;
	font-weight: 600;
	text-decoration: none;
	transition: opacity 0.2s ease, transform 0.15s ease;
}

.wpt-footer-btn:hover {
	opacity: 0.9;
	transform: translateY(-1px);
}

.wpt-whatsapp-btn {
	background: var(--wpt-blue);
	color: var(--wpt-white);
}

.wpt-call-btn {
	background: var(--wpt-black);
	color: var(--wpt-white);
}

/* ===================== */
/* Responsive - الجوال */
/* ===================== */
@media (max-width: 480px) {
	#wpt-chatbot-root {
		bottom: 16px;
		left: 16px;
	}

	#wpt-chatbot-window {
		width: calc(100vw - 24px);
		height: calc(100vh - 130px);
		bottom: 74px;
		left: -8px;
	}

	#wpt-chatbot-toggle {
		width: 56px;
		height: 56px;
	}
}
