/**
 * RoofHelp Popup Form - front-end styles.
 * Brand palette: green #4CAF21, yellow #F5C518, red #D8403A.
 *
 * This stylesheet is loaded INSIDE the popup's Shadow DOM (see popup.js).
 * That means no theme CSS can reach these elements, and these rules cannot
 * leak out to the theme. The :host block below re-establishes a neutral
 * baseline so inherited properties (font, color, line-height) coming from
 * the page do not change the popup's appearance from one theme to the next.
 */

:host {
	/* Hard reset of the host element so the theme can't inherit into the popup. */
	all: initial;

	/* Brand tokens live on :host so they resolve inside the shadow tree. */
	--rhpf-green: #4caf21;
	--rhpf-green-dark: #3d9119;
	--rhpf-yellow: #f5c518;
	--rhpf-red: #d8403a;
	--rhpf-text: #2b2b2b;
	--rhpf-muted: #6b7280;
	--rhpf-border: #e2e5e9;

	/* Neutral, self-contained typographic baseline. */
	display: block;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 16px;
	font-weight: 400;
	font-style: normal;
	line-height: 1.5;
	letter-spacing: normal;
	text-transform: none;
	text-align: left;
	color: var(--rhpf-text);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* Within the shadow tree, normalize the few things UA styles still apply. */
*,
*::before,
*::after {
	box-sizing: border-box;
}

button,
input,
select,
textarea {
	font: inherit;
	color: inherit;
	letter-spacing: inherit;
}

img {
	max-width: 100%;
	height: auto;
}

.rhpf-overlay {
	position: fixed;
	inset: 0;
	background: rgba(17, 24, 18, 0.62);
	backdrop-filter: blur(2px);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 999999;
	padding: 20px;
	opacity: 0;
	transition: opacity 0.25s ease;
}

.rhpf-overlay.rhpf-visible {
	display: flex;
	opacity: 1;
}

.rhpf-modal {
	position: relative;
	background: #ffffff;
	width: 100%;
	max-width: 440px;
	border-radius: 16px;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
	transform: translateY(18px) scale(0.98);
	transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
	overflow: hidden;
}

.rhpf-overlay.rhpf-visible .rhpf-modal {
	transform: translateY(0) scale(1);
}

/* Inline (shortcode) variant: the card is embedded in the page, not in an overlay. */
.rhpf-modal--inline {
	margin: 24px auto;
	transform: none;
	transition: none;
}

/* Top accent bar in brand colors */
.rhpf-modal::before {
	content: "";
	display: block;
	height: 6px;
	background: linear-gradient(90deg, var(--rhpf-green) 0%, var(--rhpf-green) 60%, var(--rhpf-yellow) 60%, var(--rhpf-yellow) 100%);
}

.rhpf-modal-inner {
	padding: 28px 32px 32px;
	text-align: center;
}

.rhpf-close {
	position: absolute;
	top: 12px;
	right: 14px;
	width: 34px;
	height: 34px;
	border: none;
	background: rgba(0, 0, 0, 0.05);
	border-radius: 50%;
	font-size: 22px;
	line-height: 1;
	color: var(--rhpf-muted);
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
	z-index: 2;
}

.rhpf-close:hover {
	background: var(--rhpf-red);
	color: #fff;
}

.rhpf-logo-wrap {
	margin: 6px 0 14px;
}

.rhpf-logo {
	max-height: 70px;
	width: auto;
	display: inline-block;
}

.rhpf-heading {
	font-size: 23px;
	line-height: 1.25;
	margin: 0 0 8px;
	color: var(--rhpf-text);
	font-weight: 700;
}

.rhpf-subheading {
	font-size: 15px;
	line-height: 1.5;
	color: var(--rhpf-muted);
	margin: 0 0 20px;
}

.rhpf-message {
	border-radius: 8px;
	padding: 10px 14px;
	font-size: 14px;
	margin-bottom: 16px;
	text-align: left;
}

.rhpf-message.rhpf-error {
	background: #fdecec;
	color: var(--rhpf-red);
	border: 1px solid #f6c9c7;
}

/* Honeypot: visually and physically removed from real users. */
.rhpf-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.rhpf-field {
	text-align: left;
	margin-bottom: 14px;
}

.rhpf-field label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: var(--rhpf-text);
	margin-bottom: 6px;
}

.rhpf-field input {
	width: 100%;
	box-sizing: border-box;
	padding: 12px 14px;
	font-size: 15px;
	border: 1.5px solid var(--rhpf-border);
	border-radius: 9px;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	background: #fbfcfb;
	color: var(--rhpf-text);
}

.rhpf-field input:focus {
	outline: none;
	border-color: var(--rhpf-green);
	box-shadow: 0 0 0 3px rgba(76, 175, 33, 0.15);
	background: #fff;
}

.rhpf-field input.rhpf-invalid {
	border-color: var(--rhpf-red);
	box-shadow: 0 0 0 3px rgba(216, 64, 58, 0.12);
}

.rhpf-submit {
	width: 100%;
	margin-top: 6px;
	padding: 14px 18px;
	font-size: 16px;
	font-weight: 700;
	color: #fff;
	background: var(--rhpf-green);
	border: none;
	border-radius: 10px;
	cursor: pointer;
	position: relative;
	transition: background 0.18s ease, transform 0.05s ease;
}

.rhpf-submit:hover {
	background: var(--rhpf-green-dark);
}

.rhpf-submit:active {
	transform: translateY(1px);
}

.rhpf-submit:disabled {
	opacity: 0.75;
	cursor: not-allowed;
}

.rhpf-spinner {
	display: none;
	width: 18px;
	height: 18px;
	margin-left: 8px;
	border: 2.5px solid rgba(255, 255, 255, 0.45);
	border-top-color: #fff;
	border-radius: 50%;
	vertical-align: middle;
	animation: rhpf-spin 0.7s linear infinite;
}

.rhpf-submit.rhpf-loading .rhpf-spinner {
	display: inline-block;
}

@keyframes rhpf-spin {
	to { transform: rotate(360deg); }
}

/* Inline success state */
.rhpf-success {
	padding: 10px 0 4px;
}

.rhpf-success-icon {
	width: 64px;
	height: 64px;
	margin: 0 auto 14px;
	border-radius: 50%;
	background: var(--rhpf-green);
	color: #fff;
	font-size: 34px;
	line-height: 64px;
	font-weight: 700;
}

.rhpf-success h3 {
	margin: 0 0 6px;
	font-size: 21px;
	color: var(--rhpf-text);
}

.rhpf-success p {
	margin: 0;
	color: var(--rhpf-muted);
	font-size: 15px;
}

/* Small screens */
@media (max-width: 480px) {
	.rhpf-modal-inner {
		padding: 24px 20px 26px;
	}
	.rhpf-heading {
		font-size: 20px;
	}
}
