/**
 * Red Light Rise -- shopping assistant widget (assets/js/chatbot.js).
 *
 * Sits above the header (200) and below drawers (400).
 */

.rlr-chat {
	--chat-brand: var(--rlr-brand, #8b0000);
	--chat-brand-hover: var(--rlr-brand-hover, #6b0000);
	--chat-ink: var(--rlr-ink, #111111);
	--chat-text: #2b2b2b;
	--chat-muted: #6b6b6b;
	--chat-line: #e7e7e7;
	--chat-bg: #f6f6f7;
	position: fixed;
	right: 22px;
	bottom: 22px;
	z-index: 350;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	font-size: 14px;
	line-height: 1.5;
	color: var(--chat-text);
}

.rlr-chat *,
.rlr-chat *::before,
.rlr-chat *::after {
	box-sizing: border-box;
}

.rlr-chat button {
	font: inherit;
	cursor: pointer;
}

/* ===== LAUNCHER ===== */
.rlr-chat__launcher {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 62px;
	height: 62px;
	margin-left: auto;
	border: 0;
	border-radius: 50%;
	background: var(--chat-brand);
	color: #ffffff;
	box-shadow: 0 10px 28px rgba(139, 0, 0, 0.38);
	transition: transform 0.2s ease, background 0.2s ease;
}

.rlr-chat__launcher:hover {
	background: var(--chat-brand-hover);
	transform: scale(1.06);
}

.rlr-chat__launcher::before {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: 2px solid var(--chat-brand);
	animation: rlr-chat-pulse 2.4s ease-out infinite;
}

.rlr-chat.is-open .rlr-chat__launcher::before {
	animation: none;
	opacity: 0;
}

@keyframes rlr-chat-pulse {
	0% { transform: scale(1); opacity: 0.7; }
	100% { transform: scale(1.55); opacity: 0; }
}

.rlr-chat__dot {
	position: absolute;
	top: 3px;
	right: 3px;
	width: 14px;
	height: 14px;
	border: 2px solid #ffffff;
	border-radius: 50%;
	background: #22c55e;
}

.rlr-chat__dot[hidden] {
	display: none;
}

/* ===== WHATSAPP (above the launcher) ===== */
.rlr-chat__wa {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 54px;
	height: 54px;
	margin: 0 4px 12px auto;
	border-radius: 50%;
	background: #25d366;
	color: #ffffff;
	box-shadow: 0 8px 22px rgba(37, 211, 102, 0.4);
	text-decoration: none;
	transition: transform 0.2s ease, background 0.2s ease;
}

.rlr-chat__wa:hover {
	background: #1ebe5b;
	color: #ffffff;
	transform: scale(1.07);
}

.rlr-chat.is-open .rlr-chat__wa {
	display: none;
}

/* WhatsApp links inside answers */
.rlr-chat__text a.rlr-chat__wa-link {
	color: #128c4b;
}

/* ===== TEASER ===== */
.rlr-chat__teaser {
	position: absolute;
	right: 0;
	bottom: 76px;
	display: flex;
	align-items: flex-start;
	gap: 4px;
	width: 270px;
	padding: 4px 4px 4px 0;
	border-radius: 16px 16px 4px 16px;
	background: #ffffff;
	box-shadow: 0 12px 34px rgba(0, 0, 0, 0.18);
	opacity: 0;
	visibility: hidden;
	transform: translateY(10px) scale(0.96);
	transform-origin: bottom right;
	transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}

.rlr-chat.has-wa .rlr-chat__teaser {
	bottom: 142px;
}

.rlr-chat__teaser.is-visible {
	opacity: 1;
	visibility: visible;
	transform: none;
}

.rlr-chat__teaser-text {
	flex: 1;
	padding: 12px 6px 12px 16px;
	border: 0;
	background: none;
	color: var(--chat-ink);
	font-weight: 600;
	text-align: left;
	line-height: 1.4;
}

.rlr-chat__teaser-close {
	display: flex;
	padding: 6px;
	border: 0;
	border-radius: 50%;
	background: none;
	color: var(--chat-muted);
}

.rlr-chat__teaser-close:hover {
	background: var(--chat-bg);
}

/* ===== PANEL ===== */
.rlr-chat__panel {
	position: absolute;
	right: 0;
	bottom: 78px;
	display: flex;
	flex-direction: column;
	width: 380px;
	height: min(620px, calc(100vh - 120px));
	overflow: hidden;
	border-radius: 18px;
	background: #ffffff;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
	animation: rlr-chat-in 0.22s ease;
}

.rlr-chat__panel[hidden] {
	display: none;
}

@keyframes rlr-chat-in {
	from { opacity: 0; transform: translateY(12px); }
	to { opacity: 1; transform: none; }
}

.rlr-chat__head {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 16px 16px 18px;
	background: linear-gradient(135deg, #1a0000 0%, var(--chat-ink) 100%);
	color: #ffffff;
}

.rlr-chat__avatar {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: var(--chat-brand);
}

.rlr-chat__titles {
	flex: 1;
	min-width: 0;
}

.rlr-chat__name {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.25;
}

.rlr-chat__sub {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 2px 0 0;
	font-size: 12px;
	color: rgba(255, 255, 255, 0.75);
}

.rlr-chat__online {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #22c55e;
}

.rlr-chat__close {
	display: flex;
	padding: 8px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.1);
	color: #ffffff;
}

.rlr-chat__close:hover {
	background: rgba(255, 255, 255, 0.2);
}

/* ===== MESSAGES ===== */
.rlr-chat__body {
	flex: 1;
	overflow-y: auto;
	padding: 18px 14px 8px;
	background: var(--chat-bg);
	overscroll-behavior: contain;
}

.rlr-chat__msg {
	display: flex;
	margin-bottom: 10px;
}

.rlr-chat__msg--me {
	justify-content: flex-end;
}

.rlr-chat__bubble {
	max-width: 86%;
	padding: 10px 14px;
	border-radius: 16px;
	word-wrap: break-word;
}

.rlr-chat__msg--bot .rlr-chat__bubble {
	border: 1px solid var(--chat-line);
	border-bottom-left-radius: 4px;
	background: #ffffff;
}

.rlr-chat__msg--me .rlr-chat__bubble {
	border-bottom-right-radius: 4px;
	background: var(--chat-brand);
	color: #ffffff;
}

.rlr-chat__text p {
	margin: 0 0 8px;
}

.rlr-chat__text p:last-child,
.rlr-chat__text ul:last-child {
	margin-bottom: 0;
}

.rlr-chat__text ul {
	margin: 0 0 8px;
	padding-left: 18px;
}

.rlr-chat__text li {
	margin-bottom: 3px;
}

.rlr-chat__text strong {
	color: var(--chat-ink);
}

.rlr-chat__text a {
	color: var(--chat-brand);
	font-weight: 600;
	text-decoration: underline;
}

/* Typing dots */
.rlr-chat__typing .rlr-chat__bubble {
	display: flex;
	gap: 4px;
	padding: 14px 16px;
}

.rlr-chat__typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #b5b5b5;
	animation: rlr-chat-dot 1.2s infinite ease-in-out;
}

.rlr-chat__typing span:nth-child(2) { animation-delay: 0.15s; }
.rlr-chat__typing span:nth-child(3) { animation-delay: 0.3s; }

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

/* ===== PRODUCT CARDS ===== */
.rlr-chat__products {
	display: flex;
	gap: 10px;
	margin: 0 -14px 12px;
	padding: 2px 14px 6px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: thin;
}

.rlr-chat__product {
	display: flex;
	flex: 0 0 152px;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--chat-line);
	border-radius: 14px;
	background: #ffffff;
	color: var(--chat-text);
	text-decoration: none;
	scroll-snap-align: start;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.rlr-chat__product:hover {
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
	transform: translateY(-2px);
}

.rlr-chat__product-img {
	position: relative;
	display: block;
	aspect-ratio: 1;
	background: #f1f1f1;
}

.rlr-chat__product-img img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.rlr-chat__badge {
	position: absolute;
	left: 6px;
	bottom: 6px;
	padding: 2px 7px;
	border-radius: 20px;
	background: rgba(17, 17, 17, 0.82);
	color: #ffffff;
	font-size: 10px;
	font-weight: 600;
}

.rlr-chat__product-title {
	display: -webkit-box;
	margin: 8px 10px 4px;
	overflow: hidden;
	font-size: 12.5px;
	font-weight: 600;
	line-height: 1.35;
	color: var(--chat-ink);
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.rlr-chat__product-price {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 6px;
	margin: 0 10px;
}

.rlr-chat__now {
	font-weight: 700;
	color: var(--chat-brand);
}

.rlr-chat__was {
	font-size: 12px;
	color: var(--chat-muted);
}

.rlr-chat__product-cta {
	margin: auto 10px 10px;
	padding-top: 8px;
	font-size: 12px;
	font-weight: 600;
	color: var(--chat-ink);
}

.rlr-chat__product--more {
	align-items: center;
	justify-content: center;
	padding: 14px;
	border-style: dashed;
	font-weight: 700;
	text-align: center;
	color: var(--chat-brand);
}

/* ===== CHIPS + INPUT ===== */
.rlr-chat__chips {
	display: flex;
	gap: 8px;
	padding: 10px 14px 4px;
	overflow-x: auto;
	border-top: 1px solid var(--chat-line);
	background: #ffffff;
	scrollbar-width: none;
}

.rlr-chat__chips::-webkit-scrollbar {
	display: none;
}

.rlr-chat__chip {
	flex: 0 0 auto;
	padding: 6px 13px;
	border: 1px solid #d9d9d9;
	border-radius: 20px;
	background: #ffffff;
	color: var(--chat-ink);
	font-size: 12.5px;
	font-weight: 500;
	white-space: nowrap;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.rlr-chat__chip:hover {
	border-color: var(--chat-brand);
	background: #fff5f5;
}

.rlr-chat__form {
	display: flex;
	gap: 8px;
	padding: 8px 14px 14px;
	background: #ffffff;
}

.rlr-chat__input {
	flex: 1;
	min-width: 0;
	height: 46px;
	padding: 0 16px;
	border: 1.5px solid #dcdcdc;
	border-radius: 24px;
	background: #ffffff;
	color: var(--chat-ink);
	font: inherit;
	font-size: 16px; /* 16px stops iOS zooming in on focus. */
	outline: none;
}

.rlr-chat__input:focus,
.rlr-chat__input:focus-visible {
	border-color: var(--chat-brand);
	box-shadow: 0 0 0 3px rgba(139, 0, 0, 0.12);
	outline: none;
}

.rlr-chat__send {
	display: flex;
	flex: 0 0 46px;
	align-items: center;
	justify-content: center;
	height: 46px;
	border: 0;
	border-radius: 50%;
	background: var(--chat-ink);
	color: #ffffff;
	transition: background 0.2s ease;
}

.rlr-chat__send:hover {
	background: var(--chat-brand);
}

.rlr-chat :focus-visible {
	outline: 2px solid var(--chat-brand);
	outline-offset: 2px;
}

/* ===== PHONES: full-screen chat ===== */
@media screen and (max-width: 480px) {
	.rlr-chat {
		right: 14px;
		bottom: 14px;
	}

	.rlr-chat__launcher {
		width: 56px;
		height: 56px;
	}

	.rlr-chat__teaser {
		bottom: 68px;
		width: min(270px, calc(100vw - 28px));
	}

	.rlr-chat__wa {
		width: 50px;
		height: 50px;
		margin: 0 3px 10px auto;
	}

	.rlr-chat.has-wa .rlr-chat__teaser {
		bottom: 128px;
	}

	.rlr-chat__panel {
		position: fixed;
		inset: 0;
		width: 100%;
		height: 100%;
		border-radius: 0;
	}

	.rlr-chat.is-open .rlr-chat__launcher {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.rlr-chat *,
	.rlr-chat *::before {
		animation: none !important;
		transition: none !important;
	}
}
