/**
 * Royal Collection WhatsApp Support widget.
 * Floating button + expandable chat panel. Palette from the brand design
 * system; everything namespaced under .rcwa.
 */
.rcwa {
	--rcwa-bg: #51483E;
	--rcwa-bg-soft: #665748;
	--rcwa-header-bg: #F1ECE6;
	--rcwa-panel-bg: #FAF8F5;
	--rcwa-text: #51483E;
	--rcwa-border: #DDD5CC;
	--rcwa-radius: 16px;
	--rcwa-sa: env(safe-area-inset-bottom, 0px);
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
	color: var(--rcwa-text);
	box-sizing: border-box;
}
.rcwa *,
.rcwa *::before,
.rcwa *::after { box-sizing: border-box; }

/* ============ Floating button ============ */
.rcwa__fab {
	position: fixed;
	right: max(22px, env(safe-area-inset-right, 0px));
	bottom: max(24px, var(--rcwa-sa));
	z-index: 99980;
	width: 58px;
	height: 58px;
	border-radius: 50%;
	border: none;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--rcwa-bg);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 12px 28px -8px rgba(81, 72, 62, 0.5), 0 4px 10px rgba(81, 72, 62, 0.28);
	transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
	-webkit-tap-highlight-color: transparent;
	padding: 0;
}
.rcwa__fab:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 16px 32px -8px rgba(81, 72, 62, 0.55); }
.rcwa__fab:active { transform: translateY(0) scale(0.97); }
.rcwa__fab:focus-visible { outline: 3px solid rgba(81, 72, 62, 0.4); outline-offset: 2px; }
.rcwa__fab svg { width: 30px; height: 30px; display: block; }
.rcwa__close-icon svg { width: 22px; height: 22px; }

/* ============ Panel ============ */
.rcwa__panel {
	position: fixed;
	right: max(20px, env(safe-area-inset-right, 0px));
	bottom: max(96px, calc(78px + var(--rcwa-sa)));
	z-index: 99985;
	width: 372px;
	max-width: calc(100vw - 24px);
	background: var(--rcwa-panel-bg);
	border: 1px solid var(--rcwa-border);
	border-radius: var(--rcwa-radius);
	box-shadow: 0 32px 64px -20px rgba(81, 72, 62, 0.4);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	max-height: min(620px, calc(100vh - 120px - var(--rcwa-sa)));
	animation: rcwa-rise 0.22s cubic-bezier(0.2, 0.9, 0.3, 1);
	transform-origin: bottom right;
}
.rcwa__panel[hidden] { display: none; }

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

/* Header */
.rcwa__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	background: var(--rcwa-header-bg);
	border-bottom: 1px solid var(--rcwa-border);
}
.rcwa__brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.rcwa__brand-icon {
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--rcwa-bg);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
}
.rcwa__brand-icon svg { width: 22px; height: 22px; }
.rcwa__brand-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.rcwa__brand-name {
	font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
	font-size: 17px;
	font-weight: 600;
	color: var(--rcwa-text);
	letter-spacing: 0.01em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.rcwa__brand-status {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: #7a6f5f;
	font-weight: 500;
}
.rcwa__dot { width: 7px; height: 7px; border-radius: 50%; background: #3aa05a; display: inline-block; }

.rcwa__close {
	flex: 0 0 auto;
	width: 32px;
	height: 32px;
	border: none;
	background: transparent;
	color: var(--rcwa-text);
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease;
}
.rcwa__close:hover { background: rgba(81, 72, 62, 0.08); }
.rcwa__close:focus-visible { outline: 2px solid var(--rcwa-bg); outline-offset: 2px; }
.rcwa__close svg { width: 18px; height: 18px; }

/* Body */
.rcwa__body {
	padding: 18px 16px 16px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 12px;
}
.rcwa__title {
	font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
	font-size: 22px;
	line-height: 1.2;
	font-weight: 600;
	color: var(--rcwa-text);
	margin: 0;
}
.rcwa__text {
	font-size: 13.5px;
	line-height: 1.5;
	color: #6f6555;
	margin: 0;
}

/* Option buttons */
.rcwa__options { display: flex; flex-direction: column; gap: 8px; }
.rcwa__option {
	text-align: left;
	padding: 11px 13px;
	border: 1px solid var(--rcwa-border);
	border-radius: 11px;
	background: #fff;
	color: var(--rcwa-text);
	font-family: inherit;
	font-size: 13.5px;
	font-weight: 500;
	cursor: pointer;
	transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.rcwa__option:hover { border-color: var(--rcwa-bg); box-shadow: 0 4px 14px -6px rgba(81, 72, 62, 0.25); }
.rcwa__option:active { background: var(--rcwa-panel-bg); }
.rcwa__option:focus-visible { outline: 2px solid var(--rcwa-bg); outline-offset: 2px; }
.rcwa__option[hidden] { display: none; }

/* Textarea */
.rcwa__label {
	font-size: 12.5px;
	font-weight: 600;
	color: #7a6f5f;
	letter-spacing: 0.02em;
	margin-top: 2px;
}
.rcwa__textarea {
	width: 100%;
	resize: vertical;
	min-height: 84px;
	border: 1px solid var(--rcwa-border);
	border-radius: 11px;
	padding: 11px 12px;
	font-family: inherit;
	font-size: 13.5px;
	line-height: 1.5;
	color: var(--rcwa-text);
	background: #fff;
}
.rcwa__textarea:focus { outline: none; border-color: var(--rcwa-bg); box-shadow: 0 0 0 3px rgba(81, 72, 62, 0.12); }

/* Primary CTA */
.rcwa__cta {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 9px;
	width: 100%;
	padding: 13px 16px;
	border-radius: 12px;
	background: var(--rcwa-bg);
	color: #fff;
	font-family: inherit;
	font-size: 14.5px;
	font-weight: 600;
	text-decoration: none;
	border: 1px solid var(--rcwa-bg);
	transition: background 0.16s ease, transform 0.12s ease, box-shadow 0.16s ease;
	cursor: pointer;
}
.rcwa__cta:hover { background: var(--rcwa-bg-soft); box-shadow: 0 10px 22px -10px rgba(81, 72, 62, 0.5); transform: translateY(-1px); }
.rcwa__cta:active { transform: translateY(0); }
.rcwa__cta:focus-visible { outline: 3px solid rgba(81, 72, 62, 0.4); outline-offset: 2px; }
.rcwa__cta.is-disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }
.rcwa__cta svg { width: 18px; height: 18px; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.rcwa__fab,
	.rcwa__option,
	.rcwa__cta { transition: none; }
	.rcwa__panel { animation: none; }
}

/* ============ Responsive ============ */
@media (max-width: 768px) {
	.rcwa__fab {
		width: 54px;
		height: 54px;
		right: max(16px, env(safe-area-inset-right, 0px));
		bottom: max(18px, var(--rcwa-sa));
	}
	.rcwa__fab svg { width: 27px; height: 27px; }
	.rcwa__panel {
		right: max(12px, env(safe-area-inset-right, 0px));
		bottom: max(86px, calc(70px + var(--rcwa-sa)));
		width: min(372px, calc(100vw - 24px));
		max-height: calc(100vh - 120px - var(--rcwa-sa));
	}
}

/* Small phones: keep panel fully visible and scrollable internally. */
@media (max-width: 420px) {
	.rcwa__panel {
		right: max(10px, env(safe-area-inset-right, 0px));
		bottom: max(80px, calc(66px + var(--rcwa-sa)));
		width: calc(100vw - 20px);
		max-height: calc(100vh - 110px - var(--rcwa-sa));
	}
}
