/* Ranking Discovery Leads — front-end forms
   The primary color is injected as --rdl-primary via wp_add_inline_style. */

.rdl-form-wrap {
	--rdl-primary: #4f46e5;
	--rdl-primary-dark: #3730a3;
	--rdl-radius: 14px;
	--rdl-border: #e2e8f0;
	--rdl-text: #1e293b;
	--rdl-muted: #64748b;
	--rdl-bg: #ffffff;
	max-width: 640px;
	margin: 0 auto;
	box-sizing: border-box;
}

.rdl-form-wrap *,
.rdl-form-wrap *::before,
.rdl-form-wrap *::after {
	box-sizing: border-box;
}

.rdl-form {
	background: var(--rdl-bg);
	border: 1px solid var(--rdl-border);
	border-radius: var(--rdl-radius);
	padding: 32px;
	box-shadow: 0 10px 40px -12px rgba(15, 23, 42, 0.15);
}

.rdl-form-head {
	margin-bottom: 22px;
}

.rdl-form-title {
	margin: 0 0 6px;
	font-size: 24px;
	line-height: 1.2;
	font-weight: 700;
	color: var(--rdl-text);
}

.rdl-form-sub {
	margin: 0;
	font-size: 15px;
	color: var(--rdl-muted);
	line-height: 1.5;
}

.rdl-field {
	margin-bottom: 18px;
}

.rdl-row {
	display: flex;
	gap: 16px;
}

.rdl-row .rdl-field {
	flex: 1 1 0;
	min-width: 0;
}

.rdl-field label {
	display: block;
	font-size: 13.5px;
	font-weight: 600;
	color: var(--rdl-text);
	margin-bottom: 7px;
	letter-spacing: 0.01em;
}

.rdl-req {
	color: var(--rdl-primary);
}

.rdl-field input[type="text"],
.rdl-field input[type="email"],
.rdl-field input[type="tel"],
.rdl-field select,
.rdl-field textarea {
	width: 100%;
	padding: 12px 14px;
	font-size: 15px;
	color: var(--rdl-text);
	background: #f8fafc;
	border: 1.5px solid var(--rdl-border);
	border-radius: 10px;
	transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
	font-family: inherit;
	line-height: 1.4;
}

.rdl-field textarea {
	resize: vertical;
	min-height: 88px;
}

.rdl-field input:focus,
.rdl-field select:focus,
.rdl-field textarea:focus {
	outline: none;
	border-color: var(--rdl-primary);
	background: #fff;
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--rdl-primary) 14%, transparent);
}

.rdl-field input.rdl-error,
.rdl-field select.rdl-error,
.rdl-field textarea.rdl-error {
	border-color: #ef4444;
	background: #fef2f2;
}

.rdl-field select {
	appearance: none;
	-webkit-appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
	padding-right: 38px;
	cursor: pointer;
}

/* Checkbox grid for services */
.rdl-checkgrid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 10px;
}

.rdl-check {
	display: flex;
	align-items: center;
	gap: 9px;
	padding: 11px 13px;
	background: #f8fafc;
	border: 1.5px solid var(--rdl-border);
	border-radius: 10px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	color: var(--rdl-text);
	transition: all 0.16s ease;
	margin: 0;
}

.rdl-check:hover {
	border-color: var(--rdl-primary);
}

.rdl-check input {
	width: 17px;
	height: 17px;
	accent-color: var(--rdl-primary);
	margin: 0;
	cursor: pointer;
	flex-shrink: 0;
}

.rdl-check:has(input:checked) {
	border-color: var(--rdl-primary);
	background: color-mix(in srgb, var(--rdl-primary) 8%, #fff);
}

/* Submit button */
.rdl-submit {
	width: 100%;
	padding: 15px 24px;
	font-size: 16px;
	font-weight: 600;
	color: #fff;
	background: var(--rdl-primary);
	border: none;
	border-radius: 10px;
	cursor: pointer;
	transition: background 0.18s ease, transform 0.1s ease, box-shadow 0.18s ease;
	margin-top: 4px;
	font-family: inherit;
	box-shadow: 0 8px 20px -8px var(--rdl-primary);
}

.rdl-submit:hover {
	background: var(--rdl-primary-dark);
	box-shadow: 0 10px 26px -8px var(--rdl-primary);
}

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

.rdl-submit:disabled {
	opacity: 0.65;
	cursor: not-allowed;
}

.rdl-submit.rdl-loading {
	position: relative;
	color: transparent;
}

.rdl-submit.rdl-loading::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 20px;
	height: 20px;
	margin: -10px 0 0 -10px;
	border: 2.5px solid rgba(255, 255, 255, 0.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: rdl-spin 0.7s linear infinite;
}

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

/* Messages */
.rdl-form-msg {
	margin-top: 16px;
	padding: 0;
	font-size: 14.5px;
	line-height: 1.5;
	border-radius: 10px;
	display: none;
}

.rdl-form-msg.show {
	display: block;
	padding: 13px 16px;
}

.rdl-form-msg.success {
	background: #ecfdf5;
	color: #065f46;
	border: 1px solid #a7f3d0;
}

.rdl-form-msg.error {
	background: #fef2f2;
	color: #991b1b;
	border: 1px solid #fecaca;
}

/* Honeypot — hidden from users */
.rdl-hp {
	position: absolute !important;
	left: -9999px !important;
	top: -9999px !important;
	height: 0;
	width: 0;
	overflow: hidden;
}

/* Responsive */
@media (max-width: 560px) {
	.rdl-form {
		padding: 22px;
	}
	.rdl-row {
		flex-direction: column;
		gap: 0;
	}
	.rdl-checkgrid {
		grid-template-columns: 1fr;
	}
	.rdl-form-title {
		font-size: 21px;
	}
}

/* ------------------------------------------------------------------
   Popup trigger button + modal
------------------------------------------------------------------ */

.rdl-trigger-wrap {
	margin: 6px 0;
}

.rdl-trigger-btn {
	display: inline-block;
	padding: 14px 30px;
	font-size: 16px;
	font-weight: 600;
	color: #fff;
	background: var(--rdl-primary, #4f46e5);
	border: none;
	border-radius: 10px;
	cursor: pointer;
	font-family: inherit;
	line-height: 1.2;
	transition: background 0.18s ease, transform 0.1s ease, box-shadow 0.18s ease;
	box-shadow: 0 8px 20px -8px var(--rdl-primary, #4f46e5);
}

.rdl-trigger-btn:hover {
	background: var(--rdl-primary-dark, #3730a3);
	box-shadow: 0 10px 26px -8px var(--rdl-primary, #4f46e5);
}

.rdl-trigger-btn:active {
	transform: translateY(1px);
}

/* Modal shell */
.rdl-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
	align-items: flex-start;
	justify-content: center;
	padding: 5vh 16px;
	overflow-y: auto;
}

.rdl-modal.is-open {
	display: flex;
}

.rdl-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, 0.62);
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
	animation: rdl-fade 0.2s ease;
}

.rdl-modal-dialog {
	position: relative;
	width: 100%;
	max-width: 640px;
	margin: auto;
	z-index: 1;
	animation: rdl-pop 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.rdl-modal-close {
	position: absolute;
	top: -14px;
	right: -14px;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	border: none;
	background: #fff;
	color: #334155;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25);
	transition: transform 0.15s ease, color 0.15s ease;
	z-index: 2;
}

.rdl-modal-close:hover {
	transform: scale(1.08);
	color: #0f172a;
}

/* Form inside a modal: drop the standalone card chrome */
.rdl-form-wrap--in-modal {
	max-width: 100%;
}

.rdl-form-wrap--in-modal .rdl-form {
	box-shadow: none;
	border: none;
}

body.rdl-modal-lock {
	overflow: hidden;
}

@keyframes rdl-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes rdl-pop {
	from { opacity: 0; transform: translateY(14px) scale(0.98); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 560px) {
	.rdl-modal {
		padding: 3vh 10px;
	}
	.rdl-modal-close {
		top: 6px;
		right: 6px;
	}
}

/* ------------------------------------------------------------------
   Dropdown hardening — prevents theme/Elementor conflicts that make
   the <select> or its options appear blank, invisible, or unclickable.
------------------------------------------------------------------ */
.rdl-form-wrap .rdl-field select {
	pointer-events: auto !important;
	opacity: 1 !important;
	visibility: visible !important;
	color: var(--rdl-text, #1e293b) !important;
	-webkit-text-fill-color: var(--rdl-text, #1e293b) !important; /* some themes hide select text via this */
	height: auto !important;
	line-height: 1.4 !important;
	text-indent: 0 !important;
}

/* Force the native option list to be readable regardless of theme colors */
.rdl-form-wrap .rdl-field select option {
	color: #1e293b !important;
	background-color: #ffffff !important;
	-webkit-text-fill-color: #1e293b !important;
}

/* Keep typed text visible in all inputs too */
.rdl-form-wrap .rdl-field input,
.rdl-form-wrap .rdl-field textarea {
	-webkit-text-fill-color: var(--rdl-text, #1e293b);
	opacity: 1;
}

/* ------------------------------------------------------------------
   Custom dropdown (theme-proof replacement for native <select>)
------------------------------------------------------------------ */

.rdl-select {
	position: relative;
}

.rdl-select-trigger {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 12px 14px;
	font-size: 15px;
	font-family: inherit;
	line-height: 1.4;
	text-align: left;
	color: var(--rdl-text, #1e293b);
	background: #f8fafc;
	border: 1.5px solid var(--rdl-border, #e2e8f0);
	border-radius: 10px;
	cursor: pointer;
	transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.rdl-select-trigger:hover {
	border-color: var(--rdl-primary, #4f46e5);
}

.rdl-select.is-open .rdl-select-trigger {
	border-color: var(--rdl-primary, #4f46e5);
	background: #fff;
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--rdl-primary, #4f46e5) 14%, transparent);
}

.rdl-select-value {
	flex: 1 1 auto;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.rdl-select-value[data-empty] {
	color: #94a3b8;
}

.rdl-select-arrow {
	flex-shrink: 0;
	color: #64748b;
	transition: transform 0.2s ease;
}

.rdl-select.is-open .rdl-select-arrow {
	transform: rotate(180deg);
}

.rdl-select-list {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	margin: 0;
	padding: 6px;
	list-style: none;
	background: #fff;
	border: 1.5px solid var(--rdl-border, #e2e8f0);
	border-radius: 10px;
	box-shadow: 0 12px 32px -10px rgba(15, 23, 42, 0.28);
	max-height: 260px;
	overflow-y: auto;
	z-index: 30;
	display: none;
}

.rdl-select.is-open .rdl-select-list {
	display: block;
	animation: rdl-pop 0.16s ease;
}

.rdl-select-option {
	padding: 10px 12px;
	border-radius: 8px;
	font-size: 14.5px;
	color: var(--rdl-text, #1e293b);
	cursor: pointer;
	transition: background 0.12s ease, color 0.12s ease;
}

.rdl-select-option:hover,
.rdl-select-option.is-active {
	background: color-mix(in srgb, var(--rdl-primary, #4f46e5) 10%, #fff);
	color: var(--rdl-primary-dark, #3730a3);
	font-weight: 600;
}

.rdl-select.rdl-error .rdl-select-trigger {
	border-color: #ef4444;
	background: #fef2f2;
}

/* ------------------------------------------------------------------
   Audit form — compact inline bar, no card background
------------------------------------------------------------------ */

.rdl-form--audit {
	max-width: 100%;
}

.rdl-form--audit .rdl-form,
.rdl-form-inline {
	background: transparent;
	border: none;
	box-shadow: none;
	padding: 0;
}

.rdl-form--audit .rdl-inline-fields {
	display: flex;
	gap: 14px;
	align-items: flex-start;
	flex-wrap: wrap;
}

.rdl-form--audit .rdl-field {
	margin-bottom: 0;
	flex: 1 1 240px;
	min-width: 0;
}

.rdl-form--audit .rdl-field input {
	background: #fff;
	height: 100%;
}

.rdl-form--audit .rdl-submit-inline {
	width: auto;
	flex: 0 0 auto;
	margin-top: 0;
	padding: 13px 26px;
	border: 1.5px solid transparent; /* match input height */
	line-height: 1.4;
}

@media (max-width: 640px) {
	.rdl-form--audit .rdl-inline-fields {
		flex-direction: column;
		gap: 12px;
	}
	.rdl-form--audit .rdl-field {
		flex: 1 1 auto;
		width: 100%;
	}
	.rdl-form--audit .rdl-submit-inline {
		width: 100%;
	}
}
