/* ── Floating support chat — bottom right ── */
.chat-widget {
	position: fixed;
	bottom: 28px;
	right: 28px;
	z-index: 9995;
	font-family: 'Inter', 'Source Sans Pro', Helvetica, Arial, sans-serif;
}

/* Reset global theme button styles (main.css sets min-width: 9.25em, color: #fff !important) */
.chat-widget button {
	min-width: 0 !important;
	height: auto;
	line-height: 1;
	font-weight: inherit;
	white-space: nowrap;
	text-align: center;
	-moz-appearance: none;
	-webkit-appearance: none;
	appearance: none;
	box-shadow: none !important;
}

.chat-widget .chat-quick-reply {
	color: #1e293b !important;
	background: #f8fafc !important;
	border: 1px solid #cbd5e1 !important;
	box-shadow: none !important;
}

.chat-widget .chat-quick-reply i {
	color: #2196F3 !important;
}

.chat-widget .chat-quick-reply:hover {
	color: #0f172a !important;
	background: #eff6ff !important;
	border-color: #93c5fd !important;
}

.chat-widget .chat-quick-label {
	color: #1e293b !important;
}

.chat-widget .chat-panel-btn {
	color: #ffffff !important;
	background: rgba(255,255,255,0.14) !important;
	box-shadow: none !important;
}

.chat-widget .chat-panel-btn i {
	color: #ffffff !important;
}

.chat-widget .chat-fab {
	color: #1e293b !important;
	background: #ffffff !important;
	border: 1px solid #e2e8f0 !important;
	box-shadow: 0 8px 28px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.06) !important;
}

.chat-widget .chat-fab:hover {
	box-shadow: 0 12px 32px rgba(33, 150, 243, 0.18), 0 4px 12px rgba(15, 23, 42, 0.08) !important;
	border-color: #93c5fd !important;
}

.chat-widget .chat-fab.open {
	background: #334155 !important;
	border-color: #334155 !important;
	color: #ffffff !important;
	box-shadow: 0 6px 20px rgba(51, 65, 85, 0.3) !important;
}

.chat-widget .chat-fab.open .chat-fab-icon-wrap {
	background: rgba(255,255,255,0.15) !important;
}

.chat-widget .chat-fab.open .chat-fab-icon {
	color: #ffffff !important;
}

.chat-widget textarea {
	color: #1e293b !important;
	background: transparent !important;
	border: none !important;
	box-shadow: none !important;
}
.chat-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, 0.25);
	backdrop-filter: blur(2px);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s, visibility 0.3s;
	z-index: -1;
}

.chat-backdrop.show {
	opacity: 1;
	visibility: visible;
}

/* ── FAB button ── */
.chat-fab {
	height: 50px;
	padding: 0 18px 0 8px;
	border: 1px solid #e2e8f0;
	border-radius: 25px;
	background: #ffffff;
	color: #1e293b;
	font-size: 14px;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	min-width: 0 !important;
	box-shadow: 0 8px 28px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.06);
	display: inline-flex;
	align-items: center;
	gap: 10px;
	transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
	position: relative;
	overflow: visible;
}

.chat-fab-icon-wrap {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: linear-gradient(135deg, #1565C0, #2196F3);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	box-shadow: 0 2px 8px rgba(33, 150, 243, 0.35);
}

.chat-fab-icon {
	font-size: 15px;
	color: #ffffff;
	line-height: 1;
}

.chat-fab-text {
	white-space: nowrap;
	letter-spacing: -0.01em;
	color: #1e293b;
	padding-right: 2px;
}

.chat-fab:hover {
	transform: translateY(-3px);
	box-shadow: 0 12px 32px rgba(33, 150, 243, 0.18), 0 4px 12px rgba(15, 23, 42, 0.08);
	border-color: #93c5fd;
}

.chat-fab:active {
	transform: translateY(-1px);
}

.chat-fab.open {
	width: 50px !important;
	height: 50px !important;
	min-width: 50px !important;
	padding: 0 !important;
	border-radius: 50%;
	justify-content: center;
	background: #334155 !important;
	border-color: #334155 !important;
	box-shadow: 0 6px 20px rgba(51, 65, 85, 0.3);
}

.chat-fab.open .chat-fab-icon-wrap {
	width: 100%;
	height: 100%;
	background: transparent !important;
	box-shadow: none;
	border-radius: 50%;
}

.chat-fab.open .chat-fab-text { display: none; }

.chat-fab.open:hover {
	transform: translateY(-3px);
	box-shadow: 0 8px 24px rgba(51, 65, 85, 0.35);
}

.chat-fab-pulse {
	position: absolute;
	inset: -5px;
	border-radius: 30px;
	border: 2px solid rgba(33, 150, 243, 0.45);
	animation: chatPulse 2.5s ease-out infinite;
	pointer-events: none;
}

.chat-fab.open .chat-fab-pulse,
.chat-fab.no-pulse .chat-fab-pulse { display: none; }

@keyframes chatPulse {
	0% { transform: scale(1); opacity: 0.6; }
	70% { transform: scale(1.1); opacity: 0; }
	100% { transform: scale(1.1); opacity: 0; }
}

/* ── Chat panel ── */
.chat-panel {
	position: absolute;
	bottom: 66px;
	right: 0;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 560px;
	max-height: calc(100vh - 110px);
	background: #fff;
	border-radius: 20px;
	box-shadow: 0 20px 60px rgba(15, 23, 42, 0.15), 0 0 0 1px rgba(15, 23, 42, 0.06);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	visibility: hidden;
	transform: translateY(16px) scale(0.95);
	transform-origin: bottom right;
	transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1),
		transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
		visibility 0.28s;
}

.chat-panel.open {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
}

/* ── Header ── */
.chat-panel-header {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 12px 11px 14px;
	background: linear-gradient(135deg, #1565C0 0%, #1976D2 40%, #2196F3 100%);
	color: #fff;
}

.chat-panel-avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: rgba(255,255,255,0.18);
	border: 2px solid rgba(255,255,255,0.25);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 15px;
	flex-shrink: 0;
	position: relative;
}

.chat-panel-avatar::after {
	content: '';
	position: absolute;
	bottom: 1px;
	right: 1px;
	width: 10px;
	height: 10px;
	background: #4ade80;
	border: 2px solid #1976D2;
	border-radius: 50%;
}

.chat-panel-title h3 {
	margin: 0;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: -0.02em;
}

.chat-panel-status {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin-top: 2px;
	font-size: 11px;
	opacity: 0.92;
	font-weight: 500;
}

.chat-panel-status-dot {
	width: 6px;
	height: 6px;
	background: #4ade80;
	border-radius: 50%;
	animation: statusBlink 2s ease infinite;
}

@keyframes statusBlink {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.5; }
}

.chat-panel-actions {
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 4px;
	flex-shrink: 0;
}

.chat-panel-btn {
	width: 26px !important;
	height: 26px !important;
	min-width: 26px !important;
	padding: 0 !important;
	border: none;
	border-radius: 6px;
	background: rgba(255,255,255,0.14);
	color: #fff;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	transition: background 0.15s;
}

.chat-panel-btn i {
	font-size: 11px;
	line-height: 1;
	pointer-events: none;
}

.chat-panel-btn:hover { background: rgba(255,255,255,0.26); }

/* ── Messages area ── */
.chat-panel-body {
	flex: 1 1 auto;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	background: #f1f5f9;
	min-height: 0;
}

.chat-panel-messages {
	flex: 1 1 auto;
	overflow-x: hidden;
	overflow-y: auto;
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	min-height: 0;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	scroll-behavior: smooth;
}

.chat-panel-messages::-webkit-scrollbar { width: 5px; }
.chat-panel-messages::-webkit-scrollbar-track { background: transparent; }
.chat-panel-messages::-webkit-scrollbar-thumb {
	background: #cbd5e1;
	border-radius: 4px;
}

.chat-msg {
	display: flex;
	gap: 7px;
	max-width: 92%;
	min-width: 0;
	flex-shrink: 0;
	animation: chatFadeIn 0.3s ease;
}

@keyframes chatFadeIn {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}

.chat-msg.bot { align-self: flex-start; }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }

.chat-msg-avatar {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 10px;
	margin-top: 1px;
}

.chat-msg.bot .chat-msg-avatar {
	background: linear-gradient(135deg, #dbeafe, #bfdbfe);
	color: #1d4ed8;
}

.chat-msg.user .chat-msg-avatar {
	background: #64748b;
	color: #fff;
}

.chat-msg-content {
	min-width: 0;
	flex: 1;
	max-width: calc(100% - 32px);
}

.chat-msg-bubble {
	padding: 8px 11px;
	border-radius: 14px;
	font-size: 13px;
	line-height: 1.45;
	word-break: break-word;
	overflow-wrap: anywhere;
}

.chat-msg.bot .chat-msg-bubble {
	background: #fff;
	color: #1e293b;
	border: 1px solid #e2e8f0;
	border-bottom-left-radius: 4px;
	box-shadow: 0 1px 3px rgba(15,23,42,0.04);
}

.chat-msg.bot .chat-msg-bubble strong {
	color: #0f172a;
	font-weight: 600;
}

.chat-msg.bot .chat-msg-bubble a {
	color: #1565C0;
	font-weight: 600;
	text-decoration: none;
	border-bottom: 1px solid rgba(21, 101, 192, 0.35);
	transition: color 0.15s, border-color 0.15s;
}

.chat-msg.bot .chat-msg-bubble a:hover {
	color: #0d47a1;
	border-bottom-color: #0d47a1;
}

.chat-msg.user .chat-msg-bubble {
	background: linear-gradient(135deg, #1976D2, #2196F3);
	color: #ffffff;
	border-bottom-right-radius: 4px;
	box-shadow: 0 2px 8px rgba(33, 150, 243, 0.25);
}

.chat-msg-time {
	font-size: 10px;
	color: #64748b;
	margin-top: 4px;
	padding: 0 4px;
}

.chat-msg.user .chat-msg-time {
	text-align: right;
	color: #94a3b8;
}

/* Typing indicator — lives inside messages scroll area */
.chat-typing {
	display: none;
	align-items: flex-start;
	gap: 7px;
	flex-shrink: 0;
}

.chat-typing.show { display: flex; }

.chat-typing-avatar {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: linear-gradient(135deg, #dbeafe, #bfdbfe);
	color: #1d4ed8;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 10px;
	flex-shrink: 0;
}

.chat-typing-bubble {
	display: flex;
	gap: 4px;
	padding: 10px 13px;
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 14px;
	border-bottom-left-radius: 4px;
}

.chat-typing-bubble span {
	width: 7px;
	height: 7px;
	background: #94a3b8;
	border-radius: 50%;
	animation: chatBounce 1.2s infinite;
}

.chat-typing-bubble span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing-bubble span:nth-child(3) { animation-delay: 0.3s; }

@keyframes chatBounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
	30% { transform: translateY(-5px); opacity: 1; }
}

/* ── Quick replies ── */
.chat-quick-replies-wrap {
	flex-shrink: 0;
	padding: 8px 12px 10px;
	background: #fff;
	border-top: 1px solid #f1f5f9;
	max-height: 96px;
	overflow-y: auto;
}

.chat-quick-replies-wrap.hidden {
	display: none;
}

.chat-quick-label {
	margin: 0 0 8px;
	font-size: 11px;
	font-weight: 600;
	color: #1e293b;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.chat-quick-replies {
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
}

.chat-quick-reply {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 6px 12px;
	border: 1px solid #cbd5e1;
	border-radius: 16px;
	background: #f8fafc;
	color: #1e293b;
	font-size: 11.5px;
	font-weight: 600;
	cursor: pointer;
	font-family: inherit;
	min-width: 0 !important;
	height: auto !important;
	line-height: 1.3;
	white-space: nowrap;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.chat-quick-reply i {
	font-size: 11px;
	color: #2196F3;
}

.chat-quick-reply:hover {
	background: #eff6ff;
	border-color: #93c5fd;
	color: #0f172a;
}

.chat-quick-reply:active { transform: none; }

/* ── Input bar — unified modern pill ── */
.chat-panel-input {
	flex-shrink: 0;
	padding: 10px 12px 12px;
	background: #fff;
	border-top: 1px solid #eef2f6;
}

.chat-input-wrap {
	flex: 1;
	min-width: 0;
	display: flex;
	align-items: flex-end;
	gap: 6px;
	background: #f8fafc;
	border: 1.5px solid #e2e8f0;
	border-radius: 22px;
	padding: 5px 5px 5px 14px;
	transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.chat-input-wrap:focus-within {
	background: #fff;
	border-color: #2196F3;
	box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.12);
}

.chat-panel-input textarea {
	flex: 1;
	min-width: 0;
	border: none !important;
	background: transparent !important;
	font-size: 13.5px;
	font-family: inherit;
	outline: none !important;
	resize: none;
	max-height: 80px;
	line-height: 1.45;
	padding: 7px 0;
	color: #1e293b !important;
	box-shadow: none !important;
}

.chat-panel-input textarea::placeholder {
	color: #94a3b8;
	font-weight: 400;
}

.chat-send-btn {
	width: 34px !important;
	height: 34px !important;
	min-width: 34px !important;
	padding: 0 !important;
	margin-bottom: 1px;
	border: none !important;
	border-radius: 50% !important;
	background: linear-gradient(135deg, #1565C0, #2196F3) !important;
	color: #ffffff !important;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	flex-shrink: 0;
	transition: transform 0.15s, background 0.15s, box-shadow 0.15s, opacity 0.15s;
	box-shadow: 0 2px 6px rgba(33, 150, 243, 0.3);
}

.chat-send-btn i {
	font-size: 13px;
	line-height: 1;
	color: #ffffff !important;
	pointer-events: none;
	transform: translateX(1px);
}

.chat-send-btn:not(:disabled):hover {
	background: linear-gradient(135deg, #0d47a1, #1976D2) !important;
	box-shadow: 0 3px 10px rgba(33, 150, 243, 0.4);
	transform: scale(1.05);
}

.chat-send-btn:not(:disabled):active {
	transform: scale(0.95);
}

.chat-send-btn:disabled {
	background: #dbeafe !important;
	color: #ffffff !important;
	box-shadow: none !important;
	cursor: not-allowed;
	opacity: 0.65;
	transform: none;
}

.chat-send-btn:disabled i {
	color: #ffffff !important;
	opacity: 0.85;
}

/* ── Full-page mode (chatbot.html) ── */
.chat-page {
	height: 100%;
	margin: 0;
	display: flex;
	flex-direction: column;
	background: #f1f5f9;
	color: #1e293b;
	-webkit-font-smoothing: antialiased;
}

.chat-page .chat-widget {
	position: static;
	width: 100%;
	height: 100%;
	max-width: 480px;
	margin: 0 auto;
}

.chat-page .chat-panel {
	position: static;
	width: 100%;
	max-width: 100%;
	height: 100%;
	max-height: none;
	border-radius: 0;
	box-shadow: none;
	opacity: 1;
	visibility: visible;
	transform: none;
}

.chat-page .chat-fab,
.chat-page .chat-backdrop { display: none; }

/* ── Mobile ── */
@media (max-width: 736px) {
	.chat-widget.on-portal {
		bottom: 0;
		right: 0;
		left: 0;
		top: auto;
	}

	.chat-widget.on-portal .chat-panel {
		position: fixed;
		bottom: 0;
		right: 0;
		left: 0;
		width: 100%;
		max-width: 100%;
		height: min(85vh, 620px);
		max-height: 85vh;
		border-radius: 20px 20px 0 0;
		transform: translateY(100%);
		transform-origin: bottom center;
	}

	.chat-widget.on-portal .chat-panel.open {
		transform: translateY(0);
	}

	.chat-widget.on-portal .chat-fab {
		position: fixed;
		bottom: 20px;
		right: 16px;
		z-index: 1;
	}

	.chat-widget.on-portal .chat-fab.open {
		bottom: 20px;
		right: 16px;
	}

	.chat-backdrop.show {
		z-index: 0;
	}
}

@media (max-width: 736px) {
	.store-bar-fixed {
		bottom: 88px !important;
	}
}
