/* RO HUB Disclaimer — frontend modal */
.rhd-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: none;
	font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
	color: #111;
}
.rhd-modal.is-open { display: block; }
body.rhd-modal-open { overflow: hidden; }

.rhd-modal__backdrop {
	position: absolute; inset: 0;
	background: rgba(15, 23, 42, .65);
	backdrop-filter: blur(2px);
}
.rhd-modal__dialog {
	position: relative;
	max-width: 780px;
	width: calc(100% - 32px);
	max-height: calc(100vh - 40px);
	margin: 20px auto;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}
.rhd-modal__close {
	position: absolute;
	top: 8px; right: 10px;
	background: transparent; border: 0;
	font-size: 26px; line-height: 1;
	color: #6b7280;
	cursor: pointer;
	padding: 4px 8px;
}
.rhd-modal__close:hover { color: #111; }

.rhd-modal__header {
	padding: 16px 28px 12px;
	background: #f8fafc;
}
.rhd-modal__title { margin: 0 0 4px; font-size: 17px; font-weight: 700; color: #0f172a; }
.rhd-modal__intro { color: #334155; font-size: 12.5px; line-height: 1.45; }
.rhd-modal__header-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-top: 8px;
	flex-wrap: wrap;
}
.rhd-modal__read-hint {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 4px 9px;
	font-size: 11.5px; font-weight: 600;
	color: #92400e;
	background: #fef3c7;
	border: 1px solid #fde68a;
	border-radius: 999px;
}
.rhd-modal__read-hint svg { flex: 0 0 auto; }

/* Language toggle */
.rhd-lang-toggle {
	display: flex;
	gap: 0;
	flex-shrink: 0;
	border: 2px solid #4f46e5;
	border-radius: 7px;
	overflow: hidden;
}
.rhd-lang-btn {
	padding: 5px 18px;
	border: none;
	background: #fff;
	font: inherit;
	font-size: 12.5px;
	font-weight: 800;
	letter-spacing: .8px;
	color: #4f46e5;
	cursor: pointer;
	transition: background .13s, color .13s;
	line-height: 1;
}
.rhd-lang-btn + .rhd-lang-btn {
	border-left: 2px solid #4f46e5;
}
.rhd-lang-btn:hover:not(.is-active) { background: #ede9fe; }
.rhd-lang-btn.is-active {
	background: #4f46e5;
	color: #fff;
}

/* Dual language body — use !important to beat theme overrides */
.rhd-modal .rhd-lang-body { display: none !important; }
.rhd-modal .rhd-lang-body.is-active { display: block !important; }

.rhd-modal__body {
	position: relative;
	padding: 14px 28px;
	overflow-y: auto;
	flex: 0 1 auto;
	min-height: 140px;
	max-height: 32vh;
	background: #fff;
	border-top: 1px solid #e2e8f0;
	border-bottom: 1px solid #e2e8f0;
	color: #0f172a;
	font-size: 13.5px;
	line-height: 1.55;
	scrollbar-width: thin;
}
.rhd-modal__body::-webkit-scrollbar { width: 10px; }
.rhd-modal__body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 6px; }
.rhd-modal__body::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.rhd-modal__body p { margin: 0 0 12px; }
.rhd-modal__body p:last-child { margin-bottom: 0; }
.rhd-modal__body strong { color: #111827; font-weight: 700; }
.rhd-modal__body h1,
.rhd-modal__body h2,
.rhd-modal__body h3,
.rhd-modal__body h4 {
	color: #111827;
	margin: 16px 0 8px;
	font-weight: 700;
	line-height: 1.35;
}
.rhd-modal__body h2 { font-size: 15.5px; }
.rhd-modal__body h3 { font-size: 14.5px; }
.rhd-modal__body ul,
.rhd-modal__body ol { margin: 0 0 12px 20px; padding: 0; }
.rhd-modal__body li { margin: 0 0 4px; }
.rhd-modal__body a { color: #2563eb; text-decoration: underline; }

/* Scroll-hint shadows so the user sees there's more to read. */
.rhd-modal__body::before,
.rhd-modal__body::after {
	content: '';
	position: sticky;
	left: 0;
	right: 0;
	display: block;
	height: 16px;
	pointer-events: none;
	margin: 0 -28px;
}
.rhd-modal__body::before {
	top: 0;
	background: linear-gradient(to bottom, rgba(255,255,255,0) 0, rgba(255,255,255,0) 100%);
}
.rhd-modal__body::after {
	bottom: 0;
	margin-top: -16px;
	background: linear-gradient(to top, rgba(15,23,42,.10), rgba(15,23,42,0));
}

.rhd-form {
	padding: 12px 28px 14px;
	display: grid;
	gap: 10px;
}
.rhd-form__row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}
.rhd-form__field { display: grid; gap: 4px; min-width: 0; }
.rhd-form__label { font-size: 12px; font-weight: 600; color: #374151; }
.rhd-form__label em { color: #dc2626; font-style: normal; }
.rhd-form input[type="text"],
.rhd-form input[type="email"] {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	font: inherit;
	font-size: 13px;
	background: #fff;
	box-sizing: border-box;
}
.rhd-form input:focus { outline: 2px solid #6366f1; outline-offset: 1px; }
@media (max-width: 540px) {
	.rhd-form__row { grid-template-columns: 1fr; }
}

.rhd-form__check {
	display: flex; gap: 8px; align-items: flex-start;
	font-size: 12.5px; color: #1f2937;
	padding: 6px 10px;
	background: #f1f5f9;
	border-radius: 6px;
}
.rhd-form__check input { margin-top: 3px; }

.rhd-form__sig { display: grid; gap: 6px; }
.rhd-form__sig-label {
	display: flex; justify-content: space-between; align-items: center;
	font-size: 12px; font-weight: 600; color: #374151;
}
.rhd-form__sig-label em { color: #dc2626; font-style: normal; }
.rhd-form__sig-clear {
	background: transparent; border: 0;
	font-size: 12px; color: #2563eb; cursor: pointer; padding: 2px 6px;
}
.rhd-form__sig-clear:hover { text-decoration: underline; }

.rhd-form__sig-pad {
	border: 1px dashed #94a3b8;
	border-radius: 8px;
	background: #fff;
	overflow: hidden;
}
.rhd-signature {
	display: block;
	width: 100%;
	height: 110px;
	touch-action: none;
	cursor: crosshair;
}

.rhd-status {
	min-height: 18px;
	font-size: 12.5px;
	color: #16a34a;
}
.rhd-status.is-error { color: #dc2626; }

.rhd-modal__footer {
	padding: 10px 28px;
	background: #fff;
	border-top: 1px solid #f1f5f9;
	display: flex;
	gap: 10px;
	justify-content: flex-end;
	position: sticky;
	bottom: 0;
}
.rhd-btn {
	padding: 9px 16px;
	border-radius: 8px;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	border: 1px solid transparent;
}
.rhd-btn--ghost {
	background: #fff;
	color: #374151;
	border-color: #cbd5e1;
}
.rhd-btn--ghost:hover { background: #f8fafc; }
.rhd-btn--primary {
	background: #4f46e5;
	color: #fff;
}
.rhd-btn--primary:hover { background: #4338ca; }
.rhd-btn--primary:disabled {
	background: #cbd5e1;
	cursor: not-allowed;
}
.rhd-btn.is-loading { opacity: .7; }

/* Desktop: scroll-area is transparent — footer joins the flex column and sticks */
.rhd-modal__scroll-area { display: contents; }
.rhd-modal__footer {
	position: sticky;
	bottom: 0;
	z-index: 1;
}

@media (max-width: 540px) {
	/* Full-height modal sheet on mobile */
	.rhd-modal__dialog {
		margin: 0;
		width: 100%;
		max-height: 100dvh;
		height: 100dvh;
		border-radius: 14px 14px 0 0;
		display: flex;
		flex-direction: column;
		overflow: hidden;
	}

	/* Header: fixed at top, never scrolls away */
	.rhd-modal__header {
		flex-shrink: 0;
		padding: 14px 16px 10px;
	}
	.rhd-modal__title  { font-size: 15px; }
	.rhd-modal__intro  { font-size: 12px; }

	/* Scroll area: body + form + footer all scroll together */
	.rhd-modal__scroll-area {
		display: block;
		flex: 1 1 auto;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		padding: 0;
	}

	/* Body: no max-height cap — flows naturally */
	.rhd-modal__body {
		max-height: none;
		overflow-y: visible;
		border-bottom: none;
		padding: 12px 16px;
		min-height: 0;
		font-size: 13px;
	}

	/* Form: compact */
	.rhd-form {
		gap: 8px;
		padding: 10px 16px 14px;
	}
	.rhd-form__row {
		grid-template-columns: 1fr 1fr;
		gap: 8px;
	}
	/* 16px prevents iOS auto-zoom on focus */
	.rhd-form input[type="text"],
	.rhd-form input[type="email"] {
		font-size: 16px;
		padding: 7px 9px;
	}
	.rhd-form__label { font-size: 11.5px; }
	.rhd-form__check { font-size: 12px; padding: 6px 9px; }
	.rhd-signature    { height: 110px; }

	/* Footer: sticky inside the scroll area so it's always reachable,
	   even in WebView environments where the viewport is cropped by app chrome. */
	.rhd-modal__footer {
		position: sticky;
		bottom: 0;
		padding: 10px 16px calc(16px + env(safe-area-inset-bottom, 0px));
		gap: 8px;
	}
	.rhd-btn { padding: 10px 14px; font-size: 13.5px; }
}

/* Very narrow phones: stack name + email */
@media (max-width: 380px) {
	.rhd-form__row { grid-template-columns: 1fr; }
}

/* Pulse animation — prompts user to tap Place Order after disclaimer signed */
@keyframes rhd-pulse {
	0%   { box-shadow: 0 0 0 0 rgba(79, 70, 229, .55); }
	60%  { box-shadow: 0 0 0 10px rgba(79, 70, 229, 0); }
	100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
}
.rhd-pulse {
	animation: rhd-pulse .6s ease-out 3;
}

/* Express payment lock overlay */
.rhd-express-lock {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	padding: 14px 16px;
	background: #fef3c7;
	border: 1px solid #fde68a;
	border-radius: 10px;
	text-align: center;
	margin-bottom: 8px;
}
.rhd-express-lock__msg {
	margin: 0;
	font-size: 13px;
	line-height: 1.5;
	color: #92400e;
}
.rhd-express-lock__msg em {
	display: block;
	margin-top: 3px;
	font-style: normal;
	color: #78350f;
	font-size: 12px;
}
.rhd-express-lock__btn {
	font-size: 13px;
	padding: 8px 20px;
}
