/* ==========================================================================
   Regent Dental Forms — Public CSS
   All rules scoped under .rdf-form-wrapper to prevent theme conflicts.
   ========================================================================== */

/* --- Page-level background -------------------------------------------- */
.rdf-form-page-bg {
	background: #f0f2f5;
	padding: 40px 16px;
}

/* --- Card container ---------------------------------------------------- */
.rdf-form-wrapper {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	box-shadow: 0 2px 16px rgba(0, 0, 0, .06);
	max-width: 760px;
	margin: 0 auto;
	padding: 40px 40px 36px;
	font-family: var(--wp--preset--font-family--body, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
	font-size: 0.9375rem;
	color: #1a1a2e;
	box-sizing: border-box;
}

.rdf-form-wrapper * {
	box-sizing: border-box;
}

/* --- Headings ---------------------------------------------------------- */
.rdf-form-title {
	font-size: 1.375rem;
	font-weight: 700;
	color: #1a1a2e;
	margin: 0 0 6px;
	line-height: 1.3;
}

.rdf-form-subtitle {
	font-size: 0.875rem;
	color: #6b7280;
	margin: 0 0 28px;
	line-height: 1.5;
}

/* --- Section heading --------------------------------------------------- */
.rdf-section-heading {
	font-size: 0.875rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #6b7280;
	border-bottom: 1px solid #e5e7eb;
	padding-bottom: 8px;
	margin: 28px 0 20px;
}

/* --- Grid -------------------------------------------------------------- */
.rdf-field-row {
	display: grid;
	grid-template-columns: 1fr;
	gap: 16px;
	margin-bottom: 16px;
}

@media (min-width: 600px) {
	.rdf-field-row.rdf-cols-2 {
		grid-template-columns: 1fr 1fr;
	}
	.rdf-field-row.rdf-cols-3 {
		grid-template-columns: 1fr 1fr 1fr;
	}
}

.rdf-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

/* --- Labels ------------------------------------------------------------ */
.rdf-label {
	font-size: 0.8125rem;
	font-weight: 600;
	color: #374151;
	display: block;
}

.rdf-label-hint {
	font-size: 0.75rem;
	font-weight: 400;
	color: #9ca3af;
	display: block;
	margin-top: 2px;
}

.rdf-required {
	color: #ef4444;
	margin-left: 2px;
}

/* --- Inputs & selects -------------------------------------------------- */
.rdf-input,
.rdf-select,
.rdf-textarea {
	width: 100%;
	padding: 10px 13px;
	border: 1px solid #d1d5db;
	border-radius: 4px;
	font-size: 0.875rem;
	color: #1a1a2e;
	background: #fff;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	line-height: 1.4;
	-webkit-appearance: none;
	appearance: none;
}

.rdf-input:focus,
.rdf-select:focus,
.rdf-textarea:focus {
	outline: none;
	border-color: #2563eb;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.rdf-input::placeholder,
.rdf-textarea::placeholder {
	color: #9ca3af;
}

.rdf-select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	padding-right: 36px;
}

.rdf-textarea {
	resize: vertical;
	min-height: 120px;
}

/* Input error state */
.rdf-input.rdf-input-error,
.rdf-select.rdf-input-error,
.rdf-textarea.rdf-input-error {
	border-color: #ef4444;
	box-shadow: 0 0 0 3px rgba(239, 68, 68, .1);
}

/* --- Error messages ---------------------------------------------------- */
.rdf-field-error {
	font-size: 0.75rem;
	color: #ef4444;
	margin-top: 4px;
	display: none;
}

.rdf-field-error.rdf-show {
	display: block;
}

/* --- Patient type toggle (New / Existing) ------------------------------ */
.rdf-patient-type {
	display: flex;
	border: 1px solid #d1d5db;
	border-radius: 4px;
	overflow: hidden;
	width: fit-content;
}

.rdf-patient-type-option {
	cursor: pointer;
	position: relative;
}

.rdf-patient-type-option input[type="radio"] {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
	padding: 0;
	margin: -1px;
	opacity: 0;
}

.rdf-patient-type-option span {
	display: block;
	padding: 9px 28px;
	background: #fff;
	color: #374151;
	font-size: 0.875rem;
	font-weight: 500;
	border-right: 1px solid #d1d5db;
	transition: background 0.15s, color 0.15s;
	user-select: none;
}

.rdf-patient-type-option:last-child span {
	border-right: none;
}

.rdf-patient-type-option input:checked + span {
	background: #1a1a2e;
	color: #fff;
}

/* --- Toggle checkbox (GDPR) ------------------------------------------- */
.rdf-toggle-wrap {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	cursor: pointer;
}

.rdf-toggle-switch {
	position: relative;
	flex-shrink: 0;
	width: 44px;
	height: 24px;
	margin-top: 2px;
}

.rdf-toggle-switch input[type="checkbox"] {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	opacity: 0;
}

.rdf-toggle-track {
	position: absolute;
	inset: 0;
	background: #d1d5db;
	border-radius: 24px;
	transition: background 0.2s;
	cursor: pointer;
}

.rdf-toggle-track::before {
	content: '';
	position: absolute;
	width: 18px;
	height: 18px;
	background: #fff;
	border-radius: 50%;
	top: 3px;
	left: 3px;
	transition: transform 0.2s;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}

.rdf-toggle-switch input:checked ~ .rdf-toggle-track {
	background: #2563eb;
}

.rdf-toggle-switch input:checked ~ .rdf-toggle-track::before {
	transform: translateX(20px);
}

.rdf-toggle-switch input:focus ~ .rdf-toggle-track {
	box-shadow: 0 0 0 3px rgba(37, 99, 235, .2);
}

.rdf-toggle-label-text {
	font-size: 0.8125rem;
	color: #374151;
	line-height: 1.5;
}

.rdf-toggle-label-text a {
	color: #2563eb;
	text-decoration: underline;
}

/* --- Checkboxes (specialty, sedation) ---------------------------------- */
.rdf-checkbox-group {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 20px;
}

.rdf-checkbox-label {
	display: flex;
	align-items: center;
	gap: 7px;
	font-size: 0.875rem;
	color: #374151;
	cursor: pointer;
}

.rdf-checkbox-label input[type="checkbox"],
.rdf-checkbox-label input[type="radio"] {
	width: 16px;
	height: 16px;
	accent-color: #2563eb;
	cursor: pointer;
	flex-shrink: 0;
}

/* --- Time field -------------------------------------------------------- */
.rdf-time-wrap {
	display: flex;
	gap: 8px;
	align-items: center;
}

.rdf-time-wrap .rdf-input {
	width: 120px;
	flex-shrink: 0;
}

.rdf-time-wrap .rdf-select {
	width: 90px;
}

/* --- File upload area -------------------------------------------------- */
.rdf-file-upload-area {
	border: 2px dashed #d1d5db;
	border-radius: 6px;
	padding: 28px 20px;
	text-align: center;
	background: #fafafa;
	transition: border-color 0.2s, background 0.2s;
	position: relative;
	cursor: pointer;
}

.rdf-file-upload-area.rdf-dragover {
	border-color: #2563eb;
	background: #eff6ff;
}

.rdf-file-upload-area input[type="file"] {
	position: absolute;
	inset: 0;
	opacity: 0;
	cursor: pointer;
	width: 100%;
	height: 100%;
}

.rdf-file-upload-icon {
	width: 40px;
	height: 40px;
	margin: 0 auto 10px;
	color: #9ca3af;
}

.rdf-file-upload-text {
	font-size: 0.875rem;
	color: #374151;
	margin: 0 0 4px;
}

.rdf-file-upload-text strong {
	color: #2563eb;
}

.rdf-file-upload-hint {
	font-size: 0.75rem;
	color: #9ca3af;
	margin: 0;
}

.rdf-file-list {
	margin-top: 12px;
	text-align: left;
}

.rdf-file-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 7px 10px;
	background: #f3f4f6;
	border-radius: 4px;
	font-size: 0.8125rem;
	margin-bottom: 6px;
}

.rdf-file-remove {
	background: none;
	border: none;
	color: #ef4444;
	cursor: pointer;
	font-size: 1rem;
	padding: 0;
	line-height: 1;
}

/* --- hCaptcha ---------------------------------------------------------- */
.rdf-captcha-wrap {
	margin-top: 8px;
}

/* --- Submit button ----------------------------------------------------- */
.rdf-submit-btn {
	display: block;
	width: 100%;
	padding: 13px 24px;
	background: #1a1a2e;
	color: #fff;
	border: none;
	border-radius: 4px;
	font-size: 0.9375rem;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s, opacity 0.2s;
	margin-top: 24px;
	letter-spacing: 0.02em;
}

.rdf-submit-btn:hover {
	background: #2d2d4e;
}

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

/* --- Progress overlay -------------------------------------------------- */
.rdf-loading-overlay {
	display: none;
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, .75);
	z-index: 10;
	border-radius: 8px;
	align-items: center;
	justify-content: center;
}

.rdf-loading-overlay.rdf-show {
	display: flex;
}

.rdf-spinner {
	width: 40px;
	height: 40px;
	border: 3px solid #e5e7eb;
	border-top-color: #1a1a2e;
	border-radius: 50%;
	animation: rdf-spin 0.75s linear infinite;
}

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

.rdf-form-wrapper {
	position: relative;
}

/* --- Global form error banner ----------------------------------------- */
.rdf-form-error-banner {
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: 4px;
	padding: 12px 16px;
	font-size: 0.875rem;
	color: #b91c1c;
	margin-bottom: 20px;
	display: none;
}

.rdf-form-error-banner.rdf-show {
	display: block;
}

/* --- Success message --------------------------------------------------- */
.rdf-success-message {
	display: none;
	text-align: center;
	padding: 40px 20px;
}

.rdf-success-message.rdf-show {
	display: block;
}

.rdf-success-icon {
	width: 56px;
	height: 56px;
	background: #dcfce7;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 auto 16px;
}

.rdf-success-icon svg {
	width: 28px;
	height: 28px;
	color: #16a34a;
}

.rdf-success-heading {
	font-size: 1.25rem;
	font-weight: 700;
	color: #1a1a2e;
	margin: 0 0 8px;
}

.rdf-success-text {
	font-size: 0.9375rem;
	color: #6b7280;
	margin: 0;
}

.rdf-reference-number {
	font-size: 1rem;
	font-weight: 600;
	color: #1a1a2e;
	margin-top: 12px;
	padding: 10px 20px;
	background: #f0f2f5;
	border-radius: 4px;
	display: inline-block;
}

/* --- Responsive -------------------------------------------------------- */
@media (max-width: 600px) {
	.rdf-form-wrapper {
		padding: 24px 18px;
		border-radius: 0;
		border-left: none;
		border-right: none;
	}
}
