/* ==============================================================
 * RD Tools — feedback widget
 *
 * Faint warning-triangle button that lives in the corner of a tool
 * header and pops a modal containing the feedback form.
 *
 * Tools opt in via <?php echo rd_feedback_button(); ?>. The wrapper
 * owns its own positioning when 'corner' placement is used —
 * make sure the *parent* element has position:relative (most card
 * headers / cards already do).
 * ============================================================== */

.rd-feedback,
.rd-feedback *,
.rd-feedback *::before,
.rd-feedback *::after {
	box-sizing: border-box;
}

/* ----- Trigger ----- */

.rd-feedback--corner {
	position: absolute;
	top: 10px;
	right: 12px;
	z-index: 5;
	line-height: 0;
}

.rd-feedback--inline {
	display: inline-block;
	line-height: 0;
}

.rd-feedback-trigger {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0;
	margin: 0;
	background: transparent;
	border: 0;
	border-radius: 6px;
	color: currentColor;
	opacity: 0.45;
	cursor: pointer;
	transition: opacity 140ms ease, background-color 140ms ease, transform 140ms ease;
	-webkit-appearance: none;
	appearance: none;
}

.rd-feedback-trigger:hover,
.rd-feedback-trigger:focus-visible {
	opacity: 1;
	background-color: rgba(255, 255, 255, 0.18);
}

.rd-feedback-trigger:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.rd-feedback-trigger:active {
	transform: translateY(1px);
}

.rd-feedback-icon {
	width: 18px;
	height: 18px;
	fill: currentColor;
	display: block;
}

/* Visually hidden but available to screen readers (the title attribute
   handles sighted-user hover; this duplicates for AT). */
.rd-feedback-trigger__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

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

.rd-feedback-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.rd-feedback-modal[hidden] {
	display: none !important;
}

.rd-feedback-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(16, 36, 58, 0.55);
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
	animation: rd-feedback-fade 140ms ease;
}

.rd-feedback-modal__dialog {
	position: relative;
	width: 100%;
	max-width: 560px;
	max-height: calc(100vh - 32px);
	background: #ffffff;
	color: #1c3344;
	border-radius: 12px;
	box-shadow: 0 8px 32px rgba(16, 36, 58, 0.30),
	            0 2px 6px rgba(16, 36, 58, 0.10);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	font-family: var(--rd-font-stack, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
	animation: rd-feedback-pop 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.rd-feedback-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	border-bottom: 1px solid #e2eaf1;
	background: #f5f9fd;
}

.rd-feedback-modal__title {
	margin: 0;
	font-size: 1.1rem;
	font-weight: 700;
	color: #1c3344;
	line-height: 1.3;
}

.rd-feedback-modal__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	margin: 0;
	background: transparent;
	border: 1px solid transparent;
	border-radius: 6px;
	color: #46586a;
	cursor: pointer;
	transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
	-webkit-appearance: none;
	appearance: none;
}

.rd-feedback-modal__close:hover {
	background: #ffffff;
	color: #1c3344;
	border-color: #d6e3eb;
}

.rd-feedback-modal__close:focus-visible {
	outline: 2px solid #3a8ee0;
	outline-offset: 2px;
}

.rd-feedback-modal__close svg {
	width: 16px;
	height: 16px;
	fill: currentColor;
}

.rd-feedback-modal__body {
	padding: 16px 18px 20px;
	overflow-y: auto;
	font-size: 0.95rem;
	line-height: 1.5;
}

.rd-feedback-modal__intro {
	margin: 0 0 12px;
	color: #46586a;
}

/* Light, neutral defaults for CF7 markup so it inherits cleanly into
   the modal regardless of the host page's typography. */
.rd-feedback-modal__form .wpcf7 { font: inherit; color: inherit; }
.rd-feedback-modal__form label { display: block; font-weight: 600; margin-bottom: 4px; color: #1c3344; }
.rd-feedback-modal__form input[type="text"],
.rd-feedback-modal__form input[type="email"],
.rd-feedback-modal__form input[type="url"],
.rd-feedback-modal__form input[type="tel"],
.rd-feedback-modal__form select,
.rd-feedback-modal__form textarea {
	width: 100%;
	padding: 9px 12px;
	font: inherit;
	color: inherit;
	background: #ffffff;
	border: 1px solid #cdd8e2;
	border-radius: 8px;
	transition: border-color 140ms ease, box-shadow 140ms ease;
}
.rd-feedback-modal__form input[type="text"]:focus,
.rd-feedback-modal__form input[type="email"]:focus,
.rd-feedback-modal__form input[type="url"]:focus,
.rd-feedback-modal__form input[type="tel"]:focus,
.rd-feedback-modal__form select:focus,
.rd-feedback-modal__form textarea:focus {
	border-color: #3a8ee0;
	box-shadow: 0 0 0 3px rgba(58, 142, 224, 0.30);
	outline: none;
}
.rd-feedback-modal__form textarea { min-height: 110px; resize: vertical; }
.rd-feedback-modal__form .wpcf7-form-control-wrap { display: block; margin-bottom: 12px; }
.rd-feedback-modal__form input[type="submit"],
.rd-feedback-modal__form .wpcf7-submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	padding: 9px 18px;
	font: inherit;
	font-weight: 600;
	color: #ffffff;
	background: linear-gradient(180deg, #4ea0ea 0%, #3a8ee0 100%);
	border: 1px solid #2872c0;
	border-radius: 8px;
	cursor: pointer;
	transition: filter 140ms ease;
}
.rd-feedback-modal__form input[type="submit"]:hover,
.rd-feedback-modal__form .wpcf7-submit:hover {
	filter: brightness(1.06);
}
.rd-feedback-modal__form input[type="submit"]:focus-visible,
.rd-feedback-modal__form .wpcf7-submit:focus-visible {
	outline: 2px solid #3a8ee0;
	outline-offset: 2px;
}
.rd-feedback-modal__form .wpcf7-response-output {
	margin: 12px 0 0;
	padding: 8px 12px;
	border-radius: 6px;
	font-size: 0.9rem;
}

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

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

@media (prefers-reduced-motion: reduce) {
	.rd-feedback-trigger,
	.rd-feedback-modal__backdrop,
	.rd-feedback-modal__dialog,
	.rd-feedback-modal__close,
	.rd-feedback-modal__form input[type="submit"],
	.rd-feedback-modal__form .wpcf7-submit {
		transition: none !important;
		animation: none !important;
	}
}

@media (max-width: 480px) {
	.rd-feedback-modal { padding: 8px; }
	.rd-feedback-modal__dialog { max-height: calc(100vh - 16px); border-radius: 10px; }
	.rd-feedback-modal__header { padding: 12px 14px; }
	.rd-feedback-modal__body { padding: 14px 14px 18px; }
}
