/**
 * Front-end styles: the popup, and the referral card in the member dashboard.
 *
 * These are scoped tightly to .frefc-* classes so nothing here can leak into
 * Elementor or WPLMS styling. The trigger element itself is never styled —
 * a button carrying .farida-referral-btn keeps whatever look Elementor gives
 * it, which is the whole point of hooking an existing button by class.
 */

/* ---------------------------------------------------------------------- */
/* Brand tokens                                                            */
/* ---------------------------------------------------------------------- */

/**
 * Pulled from the Elementor global kit so the buttons track the site palette
 * if it is ever retuned. The literal hex values are fallbacks for contexts
 * where the kit stylesheet is not present — custom properties resolve lazily,
 * so it does not matter whether Elementor's CSS loads before or after this.
 *
 * Declared on `body`, not `:root`: Elementor scopes its palette to
 * `.elementor-kit-29`, which sits on the body element. Custom properties only
 * inherit downwards, so tokens defined on `:root` (the html element) would
 * never see the kit and would silently fall back to the hard-coded hex
 * forever. The popup is appended to document.body, so it inherits these.
 */
body {
	--frefc-brand-light: var( --e-global-color-8408221, #8aa9e8 );
	--frefc-brand-dark: var( --e-global-color-f418519, #5079cd );
	--frefc-font: "Roboto Slab", Georgia, "Times New Roman", serif;
	--frefc-radius: 10px;
	--frefc-gradient: linear-gradient( 180deg, var( --frefc-brand-light ) -40%, var( --frefc-brand-dark ) 100% );
}

/* ---------------------------------------------------------------------- */
/* Modal                                                                   */
/* ---------------------------------------------------------------------- */

.frefc-modal-overlay {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba( 15, 23, 42, 0.6 );
	overflow-y: auto;
}

.frefc-modal-overlay[hidden] {
	display: none;
}

.frefc-modal {
	position: relative;
	width: 100%;
	max-width: 460px;
	padding: 28px 26px 24px;
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 18px 50px rgba( 15, 23, 42, 0.25 );
	color: #1f2937;
	font-size: 15px;
	line-height: 1.6;
	text-align: center;
}

.frefc-modal-title {
	margin: 0 0 12px;
	font-family: var( --frefc-font );
	font-size: 22px;
	line-height: 1.3;
	font-weight: 500;
	letter-spacing: 0.2px;
	color: #2c4c8a;
}

.frefc-modal-body p {
	margin: 0 0 14px;
}

.frefc-modal-close {
	position: absolute;
	top: 10px;
	right: 12px;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	background: transparent;
	color: #9ca3af;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
}

.frefc-modal-close:hover,
.frefc-modal-close:focus {
	color: #374151;
}

/* Stop the page behind the dialog from scrolling. */
body.frefc-modal-open {
	overflow: hidden;
}

/* ---------------------------------------------------------------------- */
/* Loading spinner                                                         */
/* ---------------------------------------------------------------------- */

.frefc-loading {
	display: flex;
	align-items: center;
	justify-content: center;

	/* Roughly the height of the content it stands in for, so the dialog does
	   not visibly jump when the real state replaces it. */
	min-height: 78px;
}

.frefc-spinner {
	display: block;
	width: 38px;
	height: 38px;
	border: 3px solid #dfe7f7;
	border-top-color: var( --frefc-brand-dark );
	border-radius: 50%;
	animation: frefc-spin 0.7s linear infinite;
}

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

/*
 * Slowed rather than stopped: a spinner frozen mid-rotation reads as a broken
 * image, where a slow one still says "working".
 */
@media ( prefers-reduced-motion: reduce ) {
	.frefc-spinner {
		animation-duration: 2.4s;
	}
}

/* Visible to screen readers only. */
.frefc-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect( 0, 0, 0, 0 );
	white-space: nowrap;
	border: 0;
}

.frefc-note {
	padding: 10px 12px;
	border-radius: 8px;
	background: #fef3c7;
	color: #92400e;
	font-size: 14px;
}

/* ---------------------------------------------------------------------- */
/* Buttons inside the popup                                                */
/* ---------------------------------------------------------------------- */

.frefc-modal-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: center;
	margin: 18px 0 0;
}

.frefc-btn {
	display: inline-block;
	padding: 12px 26px;
	border: 1px solid transparent;
	border-radius: var( --frefc-radius );
	font-family: var( --frefc-font );
	font-size: 18px;
	font-weight: 500;
	letter-spacing: 0.2px;
	line-height: 1.3;
	text-decoration: none;
	cursor: pointer;
	transition: filter 0.15s ease, background-color 0.15s ease;
}

.frefc-btn:hover,
.frefc-btn:focus {
	text-decoration: none;
	filter: brightness( 1.06 );
}

.frefc-btn-primary {
	background-image: var( --frefc-gradient );
	color: #fff;
}

/* Outlined rather than filled, so the primary action stays dominant. */
.frefc-btn-ghost {
	border-color: var( --frefc-brand-dark );
	background: #fff;
	color: var( --frefc-brand-dark );
}

.frefc-btn-ghost:hover,
.frefc-btn-ghost:focus {
	background: #f4f7fd;
}

/*
 * The login button carries the site's own `open__login_popup` class so it
 * follows site convention, and that class can drag theme styling in with it.
 * These rules pin the two things that must not move: no border, and text that
 * stays white through every state. Scoped under .frefc-modal for a specificity
 * of (0,2,0), which outranks any single-class theme rule.
 *
 * The background still brightens on hover — only the text colour is held.
 */
.frefc-modal .frefc-btn-login {
	border: 0;
	background-color: var( --frefc-brand-dark );
	background-image: var( --frefc-gradient );
	color: #fff;
}

.frefc-modal .frefc-btn-login:hover,
.frefc-modal .frefc-btn-login:focus,
.frefc-modal .frefc-btn-login:active,
.frefc-modal .frefc-btn-login:visited {
	color: #fff;
	text-decoration: none;
}

/* ---------------------------------------------------------------------- */
/* Request form                                                            */
/* ---------------------------------------------------------------------- */

.frefc-form {
	margin: 16px 0 4px;
	text-align: left;
}

.frefc-field {
	display: block;
	margin: 0 0 12px;
}

.frefc-field-label {
	display: block;
	margin: 0 0 4px;
	font-family: var( --frefc-font );
	font-size: 13px;
	font-weight: 500;
	letter-spacing: 0.2px;
	color: #47536b;
}

.frefc-field input {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 11px 13px;
	border: 1px solid #cfd8ea;
	border-radius: var( --frefc-radius );
	background: #fff;
	color: #1f2937;

	/* 16px keeps iOS Safari from zooming the page on focus. */
	font-size: 16px;
	line-height: 1.3;
}

.frefc-field input:focus {
	outline: none;
	border-color: var( --frefc-brand-dark );
	box-shadow: 0 0 0 3px rgba( 80, 121, 205, 0.18 );
}

.frefc-field-hint {
	margin: -4px 0 0;
	font-size: 12px;
	color: #6b7280;
}

.frefc-form-error {
	margin: 10px 0 0;
	padding: 9px 12px;
	border-radius: 8px;
	background: #fee2e2;
	color: #991b1b;
	font-size: 13px;
}

/* ---------------------------------------------------------------------- */
/* Code display                                                            */
/* ---------------------------------------------------------------------- */

.frefc-code-box {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 10px;
	margin: 16px 0;
	padding: 14px 16px;
	border: 2px dashed var( --frefc-brand-dark );
	border-radius: var( --frefc-radius );
	background: #f4f7fd;
}

/*
 * The code itself stays monospaced regardless of the brand font — these get
 * retyped off a phone screen, and a slab serif blurs the distinction between
 * characters that a mono face keeps apart.
 */
.frefc-code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 20px;
	font-weight: 700;
	letter-spacing: 1.5px;
	color: #2c4c8a;
	word-break: break-all;

	/* One tap/click selects the whole code on touch devices. */
	-webkit-user-select: all;
	user-select: all;
}

.frefc-copy-btn {
	padding: 8px 16px;
	border: 1px solid var( --frefc-brand-dark );
	border-radius: var( --frefc-radius );
	background: #fff;
	color: var( --frefc-brand-dark );
	font-family: var( --frefc-font );
	font-size: 14px;
	font-weight: 500;
	letter-spacing: 0.2px;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.frefc-copy-btn:hover {
	background: #e8eefb;
}

/* ---------------------------------------------------------------------- */
/* Shortcode button and inline code                                        */
/* ---------------------------------------------------------------------- */

.frefc-button {
	display: inline-block;
	padding: 12px 26px;
	border: 0;
	border-radius: var( --frefc-radius );
	background-image: var( --frefc-gradient );
	color: #fff;
	font-family: var( --frefc-font );
	font-size: 18px;
	font-weight: 500;
	letter-spacing: 0.2px;
	line-height: 1.3;
	cursor: pointer;
	transition: filter 0.15s ease;
}

.frefc-button:hover {
	filter: brightness( 1.06 );
}

.frefc-inline-code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-weight: 700;
	letter-spacing: 1px;
}

.frefc-inline-code--empty {
	font-family: inherit;
	font-weight: 400;
	letter-spacing: normal;
	color: #6b7280;
}

/* ---------------------------------------------------------------------- */
/* Dashboard card                                                          */
/* ---------------------------------------------------------------------- */

.farida_referral_code_widget .frefc-card {
	font-size: 14px;
	line-height: 1.55;
	text-align: center;
}

.farida_referral_code_widget .frefc-card-intro {
	margin: 0 0 4px;
}

.farida_referral_code_widget .frefc-card-actions {
	margin: 12px 0 0;
}

.farida_referral_code_widget .frefc-share-link {
	display: inline-block;
	padding: 12px 26px;
	border-radius: var( --frefc-radius );
	background-image: var( --frefc-gradient );
	color: #fff;
	font-family: var( --frefc-font );
	font-size: 18px;
	font-weight: 500;
	letter-spacing: 0.2px;
	line-height: 1.3;
	text-decoration: none;
	transition: filter 0.15s ease;
}

.farida_referral_code_widget .frefc-share-link:hover {
	color: #fff;
	filter: brightness( 1.06 );
	text-decoration: none;
}

/* ---------------------------------------------------------------------- */
/* Small screens                                                           */
/* ---------------------------------------------------------------------- */

@media ( max-width: 480px ) {
	.frefc-modal {
		padding: 24px 18px 20px;
	}

	.frefc-modal-title {
		font-size: 19px;
	}

	.frefc-code {
		font-size: 17px;
	}

	.frefc-btn,
	.frefc-button,
	.farida_referral_code_widget .frefc-share-link {
		font-size: 16px;
	}

	.frefc-modal-actions .frefc-btn {
		flex: 1 1 100%;
		text-align: center;
	}
}
