/* ============================================
   FAIQ Chatbot Popup Styling
   ============================================ */

/* Hide default page content container when using popup */
.page-content-container {
	display: none;
}

/* Floating chatbot button (bottom right) */
.faiq-chatbot-trigger {
	position: fixed;
	bottom: 30px;
	right: 30px;
	width: 60px;
	height: 60px;
	background: linear-gradient(135deg, #f47412 0%, #ff8c3a 100%);
	border-radius: 50%;
	box-shadow: 0 4px 12px rgba(244, 116, 18, 0.4);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 9998;
	transition: all 0.3s ease;
	color: white;
}

.faiq-chatbot-trigger:hover {
	transform: scale(1.1);
	box-shadow: 0 6px 20px rgba(244, 116, 18, 0.6);
}

.faiq-chatbot-trigger svg {
	width: 30px;
	height: 30px;
}

.faiq-chatbot-badge {
	position: absolute;
	top: -5px;
	right: -5px;
	background: #ff4757;
	color: white;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	font-weight: bold;
}

/* Chatbot popup window */
.faiq-chatbot-popup {
	position: fixed;
	bottom: 100px;
	right: 30px;
	width: 400px;
	max-width: calc(100vw - 40px);
	height: 600px;
	max-height: calc(100vh - 150px);
	background: white;
	border-radius: 20px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
	z-index: 9999;
	display: none;
	flex-direction: column;
	overflow: hidden;
	animation: slideUp 0.3s ease;
}

.faiq-chatbot-popup.open {
	display: flex;
}

@keyframes slideUp {
	from {
		opacity: 0;
		transform: translateY(20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Chatbot header */
.faiq-chatbot-header {
	background: linear-gradient(135deg, #f47412 0%, #ff8c3a 100%);
	color: white;
	padding: 20px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	position: relative;
}

.faiq-chatbot-header-content {
	display: flex;
	align-items: center;
	gap: 12px;
	font-size: 16px;
	font-weight: 600;
}

/* Header actions container */
.faiq-chatbot-header-actions {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-shrink: 0;
}

/* Reset button in header - Override plugin styles */
.faiq-chatbot-header .faiq-chatbot-reset,
.faiq-chatbot-header #faiq-plugin-reset {
	background: rgba(255, 255, 255, 0.15);
	border: none;
	color: white;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
	backdrop-filter: blur(10px);
	position: relative !important;
	flex-shrink: 0;
	right: auto !important;
	top: auto !important;
	z-index: 10 !important;
	pointer-events: auto !important;
}

.faiq-chatbot-header .faiq-chatbot-reset i,
.faiq-chatbot-header #faiq-plugin-reset i {
	font-size: 20px;
	pointer-events: none;
	display: inline-block;
}

.faiq-chatbot-header .faiq-chatbot-reset:hover,
.faiq-chatbot-header #faiq-plugin-reset:hover {
	background: rgba(255, 255, 255, 0.25);
}

/* Close button */
.faiq-chatbot-close {
	background: rgba(255, 255, 255, 0.15);
	border: none;
	color: white;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease;
	backdrop-filter: blur(10px);
	flex-shrink: 0;
}

.faiq-chatbot-close:hover {
	background: rgba(255, 255, 255, 0.25);
}

/* Chatbot body */
.faiq-chatbot-body {
	flex: 1;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.faiq-chatbot-body .faiq-plugin-container {
	flex: 1;
	border-radius: 0;
	box-shadow: none;
	padding: 15px;
	min-height: auto;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.faiq-chatbot-body .faiq-plugin-history-list {
	flex: 1;
	height: auto !important;
	overflow-y: auto !important;
	overflow-x: hidden;
}

/* Ensure input controls stay at bottom */
.faiq-chatbot-body .faiq-plugin-inputs-controls {
	flex-shrink: 0;
	margin-top: 10px;
}

/* ============================================
   Lists Fix - Prevent overflow
   ============================================ */

/* Lists in messages */
.faiq-chatbot-body .faiq-plugin-message ul,
.faiq-chatbot-body .faiq-plugin-message ol {
	margin: 8px 0;
	padding-left: 24px;
	list-style-position: inside;
}

.faiq-chatbot-body .faiq-plugin-message ul {
	list-style-type: disc;
}

.faiq-chatbot-body .faiq-plugin-message ol {
	list-style-type: decimal;
}

.faiq-chatbot-body .faiq-plugin-message li {
	margin: 4px 0;
	line-height: 1.5;
	padding-left: 4px;
}

.faiq-chatbot-body .faiq-plugin-message li::marker {
	color: currentColor;
}

/* Nested lists */
.faiq-chatbot-body .faiq-plugin-message ul ul,
.faiq-chatbot-body .faiq-plugin-message ol ol {
	margin-top: 4px;
	margin-bottom: 4px;
}

/* Prevent text overflow and reduce text size */
.faiq-chatbot-body .faiq-plugin-message {
	word-wrap: break-word;
	overflow-wrap: break-word;
	font-size: 0.95rem !important;
}

/* Reduce input placeholder size */
.faiq-chatbot-body .faiq-plugin-inputs-controls input {
	font-size: 0.95rem !important;
}

.faiq-chatbot-body .faiq-plugin-inputs-controls input::placeholder {
	font-size: 0.9rem;
}

/* ============================================
   Rating Modal Improvements
   ============================================ */

.faiq-chatbot-body .faiq-rating-container-dialog {
	backdrop-filter: blur(8px);
	background: rgba(0, 0, 0, 0.6);
	animation: fadeInBackdrop 0.3s ease;
}

@keyframes fadeInBackdrop {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

.faiq-chatbot-body .faiq-rating-container {
	border-radius: 20px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	max-width: 360px;
	padding: 30px;
	animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
	from {
		opacity: 0;
		transform: scale(0.9);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

.faiq-chatbot-body .faiq-rating-container-close {
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: all 0.2s ease;
	right: 15px;
	top: 15px;
}

.faiq-chatbot-body .faiq-rating-container-close:hover {
	background-color: rgba(0, 0, 0, 0.08);
}

.faiq-chatbot-body .faiq-rating-container-text {
	font-size: 18px;
	font-weight: 600;
	color: #1d1d1f;
	margin-top: 10px;
	margin-bottom: 20px;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.faiq-chatbot-body .faiq-rating-container-rating {
	margin-bottom: 20px;
}

.faiq-chatbot-body .faiq-rating-container-comment textarea {
	border: 1.5px solid #e5e5e7;
	border-radius: 12px;
	font-size: 15px;
	height: 100px;
	padding: 12px 16px;
	resize: none;
	width: 100%;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
	transition: all 0.3s ease;
}

.faiq-chatbot-body .faiq-rating-container-comment textarea:focus {
	outline: none;
	border-color: #f47412;
	box-shadow: 0 0 0 4px rgba(244, 116, 18, 0.1);
}

.faiq-chatbot-body .faiq-rating-container-button {
	margin-top: 20px;
	text-align: center;
}

.faiq-chatbot-body .faiq-rating-container-button button {
	padding: 12px 32px;
	border-radius: 12px;
	font-size: 15px;
	font-weight: 600;
	transition: all 0.2s ease;
	text-transform: capitalize;
	box-shadow: 0 2px 8px rgba(244, 116, 18, 0.3);
}

.faiq-chatbot-body .faiq-rating-container-button button:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(244, 116, 18, 0.4);
	filter: brightness(1.05);
}

.faiq-chatbot-body .faiq-rating-container-button button:active {
	transform: translateY(0);
}

/* Mobile responsive */
@media (max-width: 768px) {
	.faiq-chatbot-trigger {
		bottom: 20px;
		right: 20px;
		width: 55px;
		height: 55px;
	}

	.faiq-chatbot-popup {
		bottom: 0;
		right: 0;
		left: 0;
		top: 0;
		width: 100%;
		max-width: 100%;
		height: 100%;
		max-height: 100%;
		border-radius: 0;
		animation: slideUpFullscreen 0.3s ease;
	}

	@keyframes slideUpFullscreen {
		from {
			opacity: 0;
			transform: translateY(100%);
		}
		to {
			opacity: 1;
			transform: translateY(0);
		}
	}

	.faiq-chatbot-header {
		border-radius: 0;
		padding: 25px 20px;
	}

	/* Add swipe indicator */
	.faiq-chatbot-header::before {
		content: '';
		position: absolute;
		top: 8px;
		left: 50%;
		transform: translateX(-50%);
		width: 40px;
		height: 4px;
		background: rgba(255, 255, 255, 0.5);
		border-radius: 2px;
	}

	/* Optimize touch targets */
	.faiq-chatbot-close,
	.faiq-chatbot-reset {
		width: 44px;
		height: 44px;
	}

	.faiq-chatbot-trigger {
		width: 60px;
		height: 60px;
	}

	.faiq-chatbot-body .faiq-plugin-submit-button {
		padding: 12px;
		min-width: 44px;
		min-height: 44px;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.faiq-chatbot-body .faiq-plugin-inputs-controls input {
		font-size: 16px !important;
		padding: 14px;
		/* Disable iOS zoom on focus */
		touch-action: manipulation;
	}

	.faiq-chatbot-body .faiq-plugin-inputs-controls input::placeholder {
		font-size: 15px;
	}

	/* Increase message text size on mobile */
	.faiq-chatbot-body .faiq-plugin-message {
		font-size: 1rem !important;
	}

	/* Better scrolling momentum */
	.faiq-chatbot-body .faiq-plugin-history-list {
		-webkit-overflow-scrolling: touch;
		overscroll-behavior: contain;
	}

	/* Improve message action buttons */
	.faiq-plugin-more-actions-pannel > i {
		padding: 8px;
		min-width: 40px;
		min-height: 40px;
	}

	/* Source navigation buttons */
	.faiq-plugin-message-source-pannel-container i {
		padding: 12px;
		min-width: 44px;
		min-height: 44px;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	/* Prevent text selection during touch interactions */
	.faiq-chatbot-trigger,
	.faiq-chatbot-close,
	.faiq-chatbot-body .faiq-plugin-submit-button {
		-webkit-user-select: none;
		user-select: none;
		-webkit-tap-highlight-color: transparent;
	}

	/* Add safe area padding for notched devices */
	.faiq-chatbot-popup {
		padding-top: env(safe-area-inset-top);
		padding-bottom: env(safe-area-inset-bottom);
	}

	.faiq-chatbot-header {
		padding-top: calc(25px + env(safe-area-inset-top));
	}
}
