/* =========================================================================
   Rubis FAQ Pop-up Assistant
   Brand: green #285E49 (primary), red #E2322B (accent)
   All selectors are scoped under .rfa to avoid clashing with the theme.
   Font is inherited from the site so it matches the theme automatically.
   ========================================================================= */

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

.rfa {
	/* Brand tokens — change here to re-theme everything at once. */
	--rfa-green: #285E49;
	--rfa-green-dark: #1f4a39;
	--rfa-red: #E2322B;
	--rfa-ink: #1d2521;
	--rfa-muted: #5d6b64;
	--rfa-line: #e7e9e6;
	--rfa-surface: #ffffff;
	--rfa-surface-2: #f5f6f3;
	--rfa-shadow: 0 12px 38px rgba(20, 40, 30, 0.18);

	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 99999;
	font-family: inherit;
	line-height: 1.5;
}

/* ----------------------------------------------------------------- Launcher */
.rfa-launcher {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 60px;
	height: 60px;
	margin-left: auto;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: var(--rfa-green);
	color: #fff;
	cursor: pointer;
	box-shadow: var(--rfa-shadow);
	transition: transform 0.18s ease, background 0.18s ease;
}

.rfa-launcher:hover {
	background: var(--rfa-green-dark);
	transform: translateY(-2px);
}

.rfa-launcher:focus-visible {
	outline: 3px solid var(--rfa-red);
	outline-offset: 3px;
}

.rfa-launcher-icon {
	position: absolute;
	width: 26px;
	height: 26px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
	transition: opacity 0.18s ease, transform 0.18s ease;
}

.rfa-icon-close {
	opacity: 0;
	transform: rotate(-45deg) scale(0.7);
}

.rfa[data-state="open"] .rfa-icon-open {
	opacity: 0;
	transform: rotate(45deg) scale(0.7);
}

.rfa[data-state="open"] .rfa-icon-close {
	opacity: 1;
	transform: rotate(0) scale(1);
}

/* -------------------------------------------------------------------- Panel */
.rfa-panel {
	position: absolute;
	right: 0;
	bottom: 76px;
	width: 370px;
	max-width: calc(100vw - 32px);
	max-height: min(620px, calc(100vh - 120px));
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--rfa-surface);
	border-radius: 14px;
	box-shadow: var(--rfa-shadow);
	transform-origin: bottom right;
}

.rfa-panel[hidden] {
	display: none;
}

.rfa[data-state="open"] .rfa-panel {
	animation: rfa-pop-in 0.22s ease;
}

@keyframes rfa-pop-in {
	from { opacity: 0; transform: translateY(12px) scale(0.97); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ------------------------------------------------------------------- Header */
.rfa-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 18px 16px;
	background: var(--rfa-green);
	color: #fff;
}

.rfa-header .rfa-title {
	margin: 0;
	color: #fff;
	font-size: 17px;
	font-weight: 700;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

.rfa-header .rfa-subtitle {
	margin: 3px 0 0;
	font-size: 12.5px;
	font-weight: 400;
	color: rgba(255, 255, 255, 0.82);
	text-transform: none;
	letter-spacing: 0;
}

.rfa-close {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	padding: 0;
	border: none;
	border-radius: 6px;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	cursor: pointer;
	transition: background 0.15s ease;
}

.rfa-close:hover { background: rgba(255, 255, 255, 0.24); }

.rfa-close:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 1px;
}

.rfa-close svg {
	width: 17px;
	height: 17px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* --------------------------------------------------------------------- List */
.rfa-list {
	margin: 0;
	padding: 6px 0;
	list-style: none;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.rfa-item {
	border-bottom: 1px solid var(--rfa-line);
}

.rfa-item:last-child { border-bottom: none; }

.rfa-question {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 14px 18px;
	border: none;
	background: transparent;
	text-align: left;
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	color: var(--rfa-ink);
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.rfa-question:hover { background: var(--rfa-surface-2); }

.rfa-question:focus-visible {
	outline: 2px solid var(--rfa-green);
	outline-offset: -2px;
}

.rfa-question-text { flex: 1; }

.rfa-chevron {
	flex: none;
	width: 18px;
	height: 18px;
	fill: none;
	stroke: var(--rfa-muted);
	stroke-width: 2.2;
	stroke-linecap: round;
	stroke-linejoin: round;
	transition: transform 0.2s ease, stroke 0.2s ease;
}

.rfa-question[aria-expanded="true"] {
	color: var(--rfa-green);
}

.rfa-question[aria-expanded="true"] .rfa-chevron {
	transform: rotate(180deg);
	stroke: var(--rfa-green);
}

/* ------------------------------------------------------------------- Answer */
.rfa-answer {
	background: var(--rfa-surface-2);
	overflow: hidden;
}

.rfa-answer[hidden] { display: none; }

.rfa-answer-inner {
	padding: 4px 18px 18px;
}

.rfa-answer p {
	margin: 0;
	font-size: 13.5px;
	font-weight: 400;
	color: var(--rfa-muted);
}

.rfa-answer a {
	color: var(--rfa-green);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* Call-to-action button inside an answer */
.rfa-action {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	margin-top: 13px;
	padding: 9px 15px;
	border-radius: 4px;
	background: var(--rfa-green);
	color: #fff !important;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none !important;
	transition: background 0.15s ease, transform 0.15s ease;
}

.rfa-action:hover {
	background: var(--rfa-green-dark);
	transform: translateY(-1px);
}

.rfa-action:focus-visible {
	outline: 3px solid var(--rfa-red);
	outline-offset: 2px;
}

.rfa-action svg {
	width: 15px;
	height: 15px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* ------------------------------------------------------------------- Footer */
.rfa-footer {
	padding: 11px 18px;
	border-top: 1px solid var(--rfa-line);
	background: var(--rfa-surface);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--rfa-muted);
	text-align: center;
}

.rfa-footer span::before {
	content: "";
	display: inline-block;
	width: 7px;
	height: 7px;
	margin-right: 7px;
	border-radius: 50%;
	background: var(--rfa-red);
	vertical-align: middle;
}

/* --------------------------------------------------------------- Responsive */
@media (max-width: 480px) {
	.rfa {
		right: 16px;
		bottom: 16px;
	}

	.rfa-panel {
		width: calc(100vw - 32px);
		max-height: calc(100vh - 110px);
		bottom: 72px;
	}

	.rfa-launcher {
		width: 56px;
		height: 56px;
	}
}

/* ----------------------------------------------------------- Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.rfa-launcher,
	.rfa-launcher-icon,
	.rfa-chevron,
	.rfa-action,
	.rfa[data-state="open"] .rfa-panel {
		transition: none;
		animation: none;
	}
}
