.elementor-504 .elementor-element.elementor-element-eaf29ed{--display:flex;--flex-direction:column;--container-widget-width:100%;--container-widget-height:initial;--container-widget-flex-grow:0;--container-widget-align-self:initial;--flex-wrap-mobile:wrap;--overlay-opacity:0;--padding-top:115px;--padding-bottom:0px;--padding-left:0px;--padding-right:0px;}.elementor-504 .elementor-element.elementor-element-eaf29ed:not(.elementor-motion-effects-element-type-background), .elementor-504 .elementor-element.elementor-element-eaf29ed > .elementor-motion-effects-container > .elementor-motion-effects-layer{background-color:var( --e-global-color-c94d9ab );background-image:url("https://remer.org.br/wp-content/uploads/2026/07/remer-4.png");background-repeat:no-repeat;background-size:cover;}.elementor-504 .elementor-element.elementor-element-eaf29ed::before, .elementor-504 .elementor-element.elementor-element-eaf29ed > .elementor-background-video-container::before, .elementor-504 .elementor-element.elementor-element-eaf29ed > .e-con-inner > .elementor-background-video-container::before, .elementor-504 .elementor-element.elementor-element-eaf29ed > .elementor-background-slideshow::before, .elementor-504 .elementor-element.elementor-element-eaf29ed > .e-con-inner > .elementor-background-slideshow::before, .elementor-504 .elementor-element.elementor-element-eaf29ed > .elementor-motion-effects-container > .elementor-motion-effects-layer::before{--background-overlay:'';}.elementor-504 .elementor-element.elementor-element-8abed22{--display:flex;--min-height:30px;--gap:0px 0px;--row-gap:0px;--column-gap:0px;--margin-top:53px;--margin-bottom:-12px;--margin-left:-157px;--margin-right:0px;}.elementor-504 .elementor-element.elementor-element-18d7338 .elementor-heading-title{font-size:54px;color:var( --e-global-color-text );}.elementor-504 .elementor-element.elementor-element-98005fb{margin:0px 0px calc(var(--kit-widget-spacing, 0px) + -4px) 0px;padding:-7px 0px 0px 0px;}.elementor-504 .elementor-element.elementor-element-98005fb .elementor-heading-title{font-size:54px;color:var( --e-global-color-99cd272 );}.elementor-504 .elementor-element.elementor-element-3e95f2b{width:var( --container-widget-width, 70.27% );max-width:70.27%;margin:0px 0px calc(var(--kit-widget-spacing, 0px) + 0px) -146px;--container-widget-width:70.27%;--container-widget-flex-grow:0;color:var( --e-global-color-text );}.elementor-504 .elementor-element.elementor-element-3e95f2b.elementor-element{--flex-grow:0;--flex-shrink:0;}.elementor-504 .elementor-element.elementor-element-4ba3923{--display:flex;--margin-top:0px;--margin-bottom:0px;--margin-left:-164px;--margin-right:0px;}.elementor-504 .elementor-element.elementor-element-2ddf1df{--display:grid;--e-con-grid-template-columns:repeat(3, 1fr);--e-con-grid-template-rows:repeat(1, 1fr);--grid-auto-flow:row;}.elementor-504 .elementor-element.elementor-element-fef7a0c .elementor-icon-box-wrapper{text-align:start;gap:2px;}.elementor-504 .elementor-element.elementor-element-fef7a0c.elementor-view-stacked .elementor-icon{background-color:var( --e-global-color-99cd272 );}.elementor-504 .elementor-element.elementor-element-fef7a0c.elementor-view-framed .elementor-icon, .elementor-504 .elementor-element.elementor-element-fef7a0c.elementor-view-default .elementor-icon{fill:var( --e-global-color-99cd272 );color:var( --e-global-color-99cd272 );border-color:var( --e-global-color-99cd272 );}.elementor-504 .elementor-element.elementor-element-fef7a0c .elementor-icon{font-size:21px;}.elementor-504 .elementor-element.elementor-element-fef7a0c .elementor-icon i{transform:rotate(0deg);}.elementor-504 .elementor-element.elementor-element-fef7a0c .elementor-icon-box-title, .elementor-504 .elementor-element.elementor-element-fef7a0c .elementor-icon-box-title a{font-size:22px;}.elementor-504 .elementor-element.elementor-element-fef7a0c .elementor-icon-box-title{color:var( --e-global-color-text );}.elementor-504 .elementor-element.elementor-element-fef7a0c .elementor-icon-box-description{font-size:14px;color:var( --e-global-color-text );}.elementor-504 .elementor-element.elementor-element-cd115f9 .elementor-icon-box-wrapper{text-align:start;gap:2px;}.elementor-504 .elementor-element.elementor-element-cd115f9.elementor-view-stacked .elementor-icon{background-color:var( --e-global-color-99cd272 );}.elementor-504 .elementor-element.elementor-element-cd115f9.elementor-view-framed .elementor-icon, .elementor-504 .elementor-element.elementor-element-cd115f9.elementor-view-default .elementor-icon{fill:var( --e-global-color-99cd272 );color:var( --e-global-color-99cd272 );border-color:var( --e-global-color-99cd272 );}.elementor-504 .elementor-element.elementor-element-cd115f9 .elementor-icon{font-size:21px;}.elementor-504 .elementor-element.elementor-element-cd115f9 .elementor-icon i{transform:rotate(0deg);}.elementor-504 .elementor-element.elementor-element-cd115f9 .elementor-icon-box-title, .elementor-504 .elementor-element.elementor-element-cd115f9 .elementor-icon-box-title a{font-size:22px;}.elementor-504 .elementor-element.elementor-element-cd115f9 .elementor-icon-box-title{color:var( --e-global-color-text );}.elementor-504 .elementor-element.elementor-element-cd115f9 .elementor-icon-box-description{font-size:14px;color:var( --e-global-color-text );}.elementor-504 .elementor-element.elementor-element-3938424 .elementor-icon-box-wrapper{text-align:start;gap:2px;}.elementor-504 .elementor-element.elementor-element-3938424.elementor-view-stacked .elementor-icon{background-color:var( --e-global-color-99cd272 );}.elementor-504 .elementor-element.elementor-element-3938424.elementor-view-framed .elementor-icon, .elementor-504 .elementor-element.elementor-element-3938424.elementor-view-default .elementor-icon{fill:var( --e-global-color-99cd272 );color:var( --e-global-color-99cd272 );border-color:var( --e-global-color-99cd272 );}.elementor-504 .elementor-element.elementor-element-3938424 .elementor-icon{font-size:21px;}.elementor-504 .elementor-element.elementor-element-3938424 .elementor-icon i{transform:rotate(0deg);}.elementor-504 .elementor-element.elementor-element-3938424 .elementor-icon-box-title, .elementor-504 .elementor-element.elementor-element-3938424 .elementor-icon-box-title a{font-size:22px;}.elementor-504 .elementor-element.elementor-element-3938424 .elementor-icon-box-title{color:var( --e-global-color-text );}.elementor-504 .elementor-element.elementor-element-3938424 .elementor-icon-box-description{font-size:14px;color:var( --e-global-color-text );}.elementor-504 .elementor-element.elementor-element-488fafdb{--display:flex;--flex-direction:column;--container-widget-width:100%;--container-widget-height:initial;--container-widget-flex-grow:0;--container-widget-align-self:initial;--flex-wrap-mobile:wrap;--overlay-opacity:0.5;--overlay-mix-blend-mode:multiply;--margin-top:0px;--margin-bottom:0px;--margin-left:0px;--margin-right:0px;--padding-top:104px;--padding-bottom:-13px;--padding-left:0px;--padding-right:0px;}.elementor-504 .elementor-element.elementor-element-488fafdb:not(.elementor-motion-effects-element-type-background), .elementor-504 .elementor-element.elementor-element-488fafdb > .elementor-motion-effects-container > .elementor-motion-effects-layer{background-color:transparent;background-image:linear-gradient(135deg, var( --e-global-color-ec3c7a7 ) 0%, var( --e-global-color-c94d9ab ) 100%);}.elementor-504 .elementor-element.elementor-element-488fafdb::before, .elementor-504 .elementor-element.elementor-element-488fafdb > .elementor-background-video-container::before, .elementor-504 .elementor-element.elementor-element-488fafdb > .e-con-inner > .elementor-background-video-container::before, .elementor-504 .elementor-element.elementor-element-488fafdb > .elementor-background-slideshow::before, .elementor-504 .elementor-element.elementor-element-488fafdb > .e-con-inner > .elementor-background-slideshow::before, .elementor-504 .elementor-element.elementor-element-488fafdb > .elementor-motion-effects-container > .elementor-motion-effects-layer::before{background-image:url("https://remer.org.br/wp-content/uploads/2026/07/img_2.jpg");--background-overlay:'';background-position:center center;background-repeat:no-repeat;background-size:cover;}.elementor-504 .elementor-element.elementor-element-488fafdb::before{filter:brightness( 100% ) contrast( 100% ) saturate( 0% ) blur( 0px ) hue-rotate( 0deg );}.elementor-504 .elementor-element.elementor-element-4325b32b{--display:flex;--margin-top:-116px;--margin-bottom:0px;--margin-left:0px;--margin-right:0px;--padding-top:6em;--padding-bottom:8em;--padding-left:2em;--padding-right:2em;}.elementor-504 .elementor-element.elementor-element-3538e9a{text-align:center;}.elementor-504 .elementor-element.elementor-element-3538e9a .elementor-heading-title{font-size:47px;color:var( --e-global-color-text );}.elementor-504 .elementor-element.elementor-element-52fdd55{margin:0px 0px calc(var(--kit-widget-spacing, 0px) + -4px) 0px;padding:-7px 0px 0px 0px;text-align:center;}.elementor-504 .elementor-element.elementor-element-52fdd55 .elementor-heading-title{font-size:45px;color:var( --e-global-color-99cd272 );}.elementor-504 .elementor-element.elementor-element-5eba7a8{width:var( --container-widget-width, 100.102% );max-width:100.102%;margin:0px 0px calc(var(--kit-widget-spacing, 0px) + 0px) 0px;--container-widget-width:100.102%;--container-widget-flex-grow:0;text-align:center;color:var( --e-global-color-text );}.elementor-504 .elementor-element.elementor-element-5eba7a8.elementor-element{--flex-grow:0;--flex-shrink:0;}.elementor-504 .elementor-element.elementor-element-d609993{--display:flex;--margin-top:-54px;--margin-bottom:0px;--margin-left:-33px;--margin-right:0px;--padding-top:-14px;--padding-bottom:0px;--padding-left:0px;--padding-right:0px;}.elementor-504 .elementor-element.elementor-element-d609993.e-con{--flex-grow:0;--flex-shrink:0;}.elementor-504 .elementor-element.elementor-element-f99e166{--display:flex;--margin-top:0px;--margin-bottom:0px;--margin-left:0px;--margin-right:0px;--padding-top:20px;--padding-bottom:0px;--padding-left:23px;--padding-right:0px;}.elementor-504 .elementor-element.elementor-element-f99e166.e-con{--flex-grow:0;--flex-shrink:0;}.elementor-504 .elementor-element.elementor-element-b7b7b41{--display:flex;--margin-top:287px;--margin-bottom:0px;--margin-left:0px;--margin-right:0px;}.elementor-504 .elementor-element.elementor-element-d216666{margin:-318px 0px calc(var(--kit-widget-spacing, 0px) + 0px) 0px;}:root{--page-title-display:none;}@media(min-width:768px){.elementor-504 .elementor-element.elementor-element-eaf29ed{--content-width:960px;}.elementor-504 .elementor-element.elementor-element-488fafdb{--content-width:640px;}.elementor-504 .elementor-element.elementor-element-d609993{--width:103.833%;}.elementor-504 .elementor-element.elementor-element-f99e166{--width:103.151%;}.elementor-504 .elementor-element.elementor-element-b7b7b41{--content-width:1600px;}}@media(max-width:1024px) and (min-width:768px){.elementor-504 .elementor-element.elementor-element-eaf29ed{--content-width:720px;}.elementor-504 .elementor-element.elementor-element-488fafdb{--content-width:512px;}}@media(max-width:1024px){.elementor-504 .elementor-element.elementor-element-eaf29ed{--padding-top:75px;--padding-bottom:0px;--padding-left:0px;--padding-right:0px;}.elementor-504 .elementor-element.elementor-element-2ddf1df{--grid-auto-flow:row;}.elementor-504 .elementor-element.elementor-element-488fafdb{--padding-top:75px;--padding-bottom:0px;--padding-left:0px;--padding-right:0px;}.elementor-504 .elementor-element.elementor-element-4325b32b{--padding-top:6em;--padding-bottom:6em;--padding-left:2em;--padding-right:2em;}}@media(max-width:767px){.elementor-504 .elementor-element.elementor-element-eaf29ed{--padding-top:60px;--padding-bottom:0px;--padding-left:0px;--padding-right:0px;}.elementor-504 .elementor-element.elementor-element-2ddf1df{--e-con-grid-template-columns:repeat(1, 1fr);--grid-auto-flow:row;}.elementor-504 .elementor-element.elementor-element-488fafdb{--margin-top:-69px;--margin-bottom:0px;--margin-left:0px;--margin-right:0px;--padding-top:60px;--padding-bottom:0px;--padding-left:0px;--padding-right:0px;}.elementor-504 .elementor-element.elementor-element-4325b32b{--gap:10px 10px;--row-gap:10px;--column-gap:10px;--padding-top:4em;--padding-bottom:4em;--padding-left:1em;--padding-right:1em;}.elementor-504 .elementor-element.elementor-element-3538e9a{margin:60px 0px calc(var(--kit-widget-spacing, 0px) + 0px) 0px;}.elementor-504 .elementor-element.elementor-element-3538e9a .elementor-heading-title{font-size:37px;}.elementor-504 .elementor-element.elementor-element-52fdd55 .elementor-heading-title{font-size:29px;}.elementor-504 .elementor-element.elementor-element-5eba7a8{font-size:14px;}.elementor-504 .elementor-element.elementor-element-d609993{--width:601px;}}/* Start custom CSS */<?php
/**
 * Página completa de doação da REMER.
 * Produto WooCommerce: ID 432.
 */

/* =========================================================
 * CONFIGURAÇÕES PRINCIPAIS
 * ======================================================= */

function remer_donation_settings() {
	return array(
		'product_id' => 432,

		/*
		 * Cole abaixo a URL da imagem principal.
		 * WordPress → Mídia → clique na imagem → Copiar URL.
		 */
		'hero_image' => 'COLE_AQUI_A_URL_DA_IMAGEM',

		/*
		 * Valor mínimo permitido.
		 */
		'minimum_amount' => 10,
	);
}


/* =========================================================
 * SHORTCODE DA PÁGINA
 * Use: [remer_doacao]
 * ======================================================= */

add_shortcode( 'remer_doacao', 'remer_donation_page_shortcode' );

function remer_donation_page_shortcode() {

	if ( ! class_exists( 'WooCommerce' ) ) {
		return '<p>O WooCommerce precisa estar instalado e ativo.</p>';
	}

	$settings   = remer_donation_settings();
	$hero_image = esc_url( $settings['hero_image'] );
	$ajax_url   = admin_url( 'admin-ajax.php' );
	$nonce      = wp_create_nonce( 'remer_donation_nonce' );

	ob_start();
	?>

	<style>
		#remer-donation {
			--remer-blue: #082d56;
			--remer-blue-dark: #061f3d;
			--remer-card-blue: #1e315d;
			--remer-yellow: #ffc233;
			--remer-text: #14264b;
			--remer-muted: #687080;
			--remer-border: #dbe1e9;
			--remer-light: #f7f9fc;
			--remer-white: #ffffff;

			font-family: inherit;
			color: var(--remer-text);
			width: 100%;
			overflow: hidden;
		}

		#remer-donation * {
			box-sizing: border-box;
		}

		#remer-donation button,
		#remer-donation input {
			font: inherit;
		}

		.remer-container {
			width: min(1180px, calc(100% - 40px));
			margin: 0 auto;
		}

		/* HERO */

		.remer-hero {
			min-height: 500px;
			position: relative;
			display: flex;
			align-items: center;
			background:
				linear-gradient(
					90deg,
					rgba(4, 34, 65, 0.98) 0%,
					rgba(4, 34, 65, 0.90) 35%,
					rgba(4, 34, 65, 0.35) 65%,
					rgba(4, 34, 65, 0.08) 100%
				),
				url('<?php echo $hero_image; ?>') center right / cover no-repeat;
			color: #fff;
		}

		.remer-hero-content {
			width: min(600px, 100%);
			padding: 75px 0;
		}

		.remer-hero h1 {
			color: #fff;
			font-size: clamp(42px, 5vw, 68px);
			line-height: 1.02;
			letter-spacing: -2px;
			margin: 0 0 24px;
			font-weight: 800;
		}

		.remer-hero h1 span {
			color: var(--remer-yellow);
			display: block;
		}

		.remer-hero-description {
			font-size: 18px;
			line-height: 1.65;
			max-width: 540px;
			margin: 0 0 34px;
			color: rgba(255,255,255,.94);
		}

		.remer-benefits {
			display: grid;
			grid-template-columns: repeat(3, 1fr);
			gap: 22px;
			max-width: 600px;
		}

		.remer-benefit-icon {
			width: 54px;
			height: 54px;
			display: flex;
			align-items: center;
			justify-content: center;
			border: 2px solid var(--remer-yellow);
			border-radius: 50%;
			color: var(--remer-yellow);
			font-size: 24px;
			margin-bottom: 12px;
		}

		.remer-benefit strong {
			display: block;
			font-size: 17px;
			margin-bottom: 5px;
			color: #fff;
		}

		.remer-benefit span {
			display: block;
			font-size: 13px;
			line-height: 1.45;
			color: rgba(255,255,255,.82);
		}

		/* ÁREA PRINCIPAL */

		.remer-main {
			background: var(--remer-light);
			padding: 55px 0 65px;
		}

		.remer-donation-grid {
			display: grid;
			grid-template-columns: minmax(0, 1.7fr) minmax(290px, .85fr);
			gap: 28px;
			align-items: start;
		}

		.remer-form-card,
		.remer-side-card {
			background: #fff;
			border-radius: 16px;
			box-shadow: 0 12px 35px rgba(15, 42, 75, .09);
		}

		.remer-form-card {
			padding: 32px;
		}

		.remer-title-row {
			display: flex;
			align-items: center;
			gap: 14px;
			margin-bottom: 6px;
		}

		.remer-title-icon {
			width: 55px;
			height: 55px;
			border-radius: 50%;
			background: var(--remer-blue);
			color: #fff;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 26px;
			flex: 0 0 auto;
		}

		.remer-form-card h2 {
			margin: 0;
			font-size: 31px;
			color: var(--remer-text);
			line-height: 1.15;
		}

		.remer-form-intro {
			margin: 0 0 28px 69px;
			color: var(--remer-muted);
			font-size: 15px;
		}

		.remer-label {
			display: block;
			font-weight: 700;
			font-size: 15px;
			margin: 23px 0 10px;
			color: var(--remer-text);
		}

		/* TIPO DE DOAÇÃO */

		.remer-type-grid {
			display: grid;
			grid-template-columns: 1fr 1fr;
			gap: 12px;
		}

		.remer-type-button {
			min-height: 54px;
			border-radius: 7px;
			border: 1px solid var(--remer-border);
			background: #fff;
			color: var(--remer-text);
			font-weight: 600;
			cursor: pointer;
		}

		.remer-type-button.is-active {
			color: #fff;
			background: var(--remer-blue);
			border-color: var(--remer-blue);
		}

		.remer-type-button[disabled] {
			opacity: .52;
			cursor: not-allowed;
		}

		.remer-coming-soon {
			display: block;
			font-size: 10px;
			font-weight: 500;
			margin-top: 2px;
		}

		/* VALORES */

		.remer-amount-grid {
			display: grid;
			grid-template-columns: repeat(4, 1fr);
			gap: 12px;
		}

		.remer-amount-button {
			position: relative;
			min-height: 93px;
			border: 1px solid var(--remer-border);
			background: #fff;
			border-radius: 8px;
			padding: 13px 8px;
			cursor: pointer;
			transition: .2s ease;
			color: var(--remer-text);
		}

		.remer-amount-button:hover {
			transform: translateY(-2px);
			border-color: var(--remer-yellow);
			box-shadow: 0 8px 18px rgba(23, 47, 83, .09);
		}

		.remer-amount-button.is-active {
			border: 2px solid var(--remer-yellow);
			background: #fffdfa;
		}

		.remer-amount-button.is-active::after {
			content: "✓";
			position: absolute;
			top: -9px;
			right: -8px;
			width: 23px;
			height: 23px;
			border-radius: 50%;
			background: var(--remer-yellow);
			color: var(--remer-blue-dark);
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 13px;
			font-weight: 800;
		}

		.remer-amount-value {
			display: block;
			font-size: 18px;
			font-weight: 800;
			margin-bottom: 6px;
		}

		.remer-amount-description {
			display: block;
			font-size: 12px;
			line-height: 1.3;
			color: var(--remer-muted);
		}

		.remer-custom-amount {
			display: grid;
			grid-template-columns: 170px 1fr;
			margin-top: 12px;
			border: 1px solid var(--remer-border);
			border-radius: 7px;
			overflow: hidden;
			background: #fff;
		}

		.remer-custom-label {
			display: flex;
			align-items: center;
			padding: 0 14px;
			border-right: 1px solid var(--remer-border);
			font-size: 14px;
			color: var(--remer-text);
			font-weight: 600;
		}

		.remer-custom-input-wrap {
			display: flex;
			align-items: center;
		}

		.remer-custom-input-wrap span {
			padding-left: 14px;
			color: var(--remer-muted);
		}

		.remer-custom-input {
			width: 100%;
			border: 0 !important;
			outline: 0 !important;
			box-shadow: none !important;
			padding: 14px 12px !important;
			background: transparent !important;
		}

		/* DADOS */

		.remer-fields-grid {
			display: grid;
			grid-template-columns: 1fr 1fr;
			gap: 15px;
		}

		.remer-field label {
			display: block;
			font-size: 13px;
			font-weight: 700;
			margin-bottom: 7px;
		}

		.remer-field input {
			width: 100%;
			height: 48px;
			border: 1px solid var(--remer-border);
			border-radius: 7px;
			padding: 0 13px;
			outline: none;
			background: #fff;
			color: var(--remer-text);
		}

		.remer-field input:focus {
			border-color: var(--remer-blue);
			box-shadow: 0 0 0 3px rgba(8, 45, 86, .08);
		}

		/* PAGAMENTOS */

		.remer-payment-grid {
			display: grid;
			grid-template-columns: repeat(3, 1fr);
			gap: 12px;
		}

		.remer-payment-item {
			border: 1px solid var(--remer-border);
			border-radius: 8px;
			min-height: 105px;
			padding: 17px 10px;
			text-align: center;
			background: #fff;
		}

		.remer-payment-item:first-child {
			border-color: var(--remer-yellow);
		}

		.remer-payment-icon {
			font-size: 27px;
			display: block;
			margin-bottom: 7px;
		}

		.remer-payment-item strong {
			display: block;
			font-size: 13px;
			color: var(--remer-text);
		}

		.remer-payment-item small {
			display: block;
			font-size: 11px;
			line-height: 1.35;
			color: var(--remer-muted);
			margin-top: 4px;
		}

		.remer-secure-note {
			font-size: 12px;
			color: var(--remer-muted);
			margin: 11px 0;
		}

		.remer-submit {
			width: 100%;
			min-height: 57px;
			border: 0;
			border-radius: 8px;
			background: var(--remer-yellow);
			color: var(--remer-blue-dark);
			font-weight: 800;
			font-size: 17px;
			cursor: pointer;
			transition: .2s ease;
		}

		.remer-submit:hover {
			transform: translateY(-1px);
			filter: brightness(.98);
			box-shadow: 0 8px 20px rgba(255, 194, 51, .28);
		}

		.remer-submit:disabled {
			opacity: .65;
			cursor: wait;
		}

		.remer-form-message {
			display: none;
			padding: 12px 14px;
			margin: 15px 0 0;
			border-radius: 7px;
			font-size: 14px;
		}

		.remer-form-message.is-error {
			display: block;
			color: #8d1b1b;
			background: #fff0f0;
			border: 1px solid #f0b9b9;
		}

		/* LATERAL */

		.remer-side-column {
			display: grid;
			gap: 20px;
		}

		.remer-security-card {
			padding: 27px;
			background: #edf5ff;
		}

		.remer-security-heading {
			display: flex;
			gap: 13px;
			align-items: flex-start;
		}

		.remer-security-icon {
			width: 52px;
			height: 52px;
			border: 1px solid #9ebfea;
			border-radius: 50%;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 25px;
			flex: 0 0 auto;
		}

		.remer-side-card h3 {
			margin: 2px 0 9px;
			font-size: 18px;
		}

		.remer-side-card p {
			margin: 0;
			color: var(--remer-muted);
			font-size: 14px;
			line-height: 1.55;
		}

		.remer-destination-card {
			padding: 27px;
		}

		.remer-destination-list {
			margin-top: 19px;
			display: grid;
			gap: 18px;
		}

		.remer-destination-item {
			display: grid;
			grid-template-columns: 42px 1fr;
			gap: 12px;
		}

		.remer-destination-icon {
			width: 42px;
			height: 42px;
			border-radius: 50%;
			background: #fff8e8;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 20px;
		}

		.remer-destination-item strong {
			display: block;
			font-size: 14px;
			margin-bottom: 4px;
		}

		.remer-destination-item span {
			display: block;
			color: var(--remer-muted);
			font-size: 12px;
			line-height: 1.45;
		}

		.remer-quote-card {
			padding: 31px;
			background: var(--remer-blue);
			color: #fff;
		}

		.remer-quote-mark {
			color: var(--remer-yellow);
			font-size: 54px;
			line-height: .8;
			font-weight: 900;
		}

		.remer-quote-card p {
			color: #fff;
			font-size: 19px;
			font-weight: 700;
			line-height: 1.45;
			margin: 13px 0 17px;
		}

		.remer-quote-card strong {
			color: var(--remer-yellow);
			font-size: 17px;
			line-height: 1.4;
			display: block;
		}

		/* IMPACTO */

		.remer-impact {
			background: linear-gradient(115deg, var(--remer-blue), #003c6d);
			color: #fff;
			padding: 40px 0 44px;
		}

		.remer-impact h2 {
			text-align: center;
			color: #fff;
			font-size: 27px;
			margin: 0 0 30px;
		}

		.remer-impact-grid {
			display: grid;
			grid-template-columns: repeat(4, 1fr);
		}

		.remer-impact-item {
			text-align: center;
			padding: 0 20px;
			border-right: 1px solid rgba(255,255,255,.25);
		}

		.remer-impact-item:last-child {
			border-right: 0;
		}

		.remer-impact-number {
			display: block;
			color: var(--remer-yellow);
			font-weight: 800;
			font-size: 27px;
			margin-bottom: 7px;
		}

		.remer-impact-item span:last-child {
			font-size: 13px;
			line-height: 1.4;
			display: block;
		}

		/* RESPONSIVO */

		@media (max-width: 900px) {
			.remer-hero {
				background:
					linear-gradient(rgba(4,34,65,.86), rgba(4,34,65,.91)),
					url('<?php echo $hero_image; ?>') center / cover no-repeat;
			}

			.remer-donation-grid {
				grid-template-columns: 1fr;
			}

			.remer-benefits {
				grid-template-columns: 1fr;
			}

			.remer-impact-grid {
				grid-template-columns: repeat(2, 1fr);
				gap: 25px 0;
			}

			.remer-impact-item:nth-child(2) {
				border-right: 0;
			}
		}

		@media (max-width: 640px) {
			.remer-container {
				width: min(100% - 24px, 1180px);
			}

			.remer-hero {
				min-height: auto;
			}

			.remer-hero-content {
				padding: 60px 0;
			}

			.remer-hero h1 {
				font-size: 43px;
				letter-spacing: -1px;
			}

			.remer-benefits {
				display: none;
			}

			.remer-main {
				padding: 25px 0 38px;
			}

			.remer-form-card {
				padding: 22px 17px;
			}

			.remer-form-intro {
				margin-left: 0;
				margin-top: 12px;
			}

			.remer-title-icon {
				width: 46px;
				height: 46px;
			}

			.remer-form-card h2 {
				font-size: 25px;
			}

			.remer-type-grid,
			.remer-fields-grid {
				grid-template-columns: 1fr;
			}

			.remer-amount-grid {
				grid-template-columns: repeat(2, 1fr);
			}

			.remer-custom-amount {
				grid-template-columns: 120px 1fr;
			}

			.remer-payment-grid {
				grid-template-columns: 1fr;
			}

			.remer-impact-grid {
				grid-template-columns: 1fr;
			}

			.remer-impact-item,
			.remer-impact-item:nth-child(2) {
				border-right: 0;
				border-bottom: 1px solid rgba(255,255,255,.18);
				padding: 17px 0;
			}

			.remer-impact-item:last-child {
				border-bottom: 0;
			}
		}
	</style>

	<div id="remer-donation">

		<section class="remer-hero">
			<div class="remer-container">
				<div class="remer-hero-content">

					<h1>
						Sua doação
						<span>transforma vidas</span>
					</h1>

					<p class="remer-hero-description">
						Com sua contribuição, podemos continuar oferecendo
						educação, proteção e oportunidades para crianças,
						adolescentes e famílias.
					</p>

					<div class="remer-benefits">

						<div class="remer-benefit">
							<div class="remer-benefit-icon">✓</div>
							<strong>Transparência</strong>
							<span>Prestação de contas e responsabilidade.</span>
						</div>

						<div class="remer-benefit">
							<div class="remer-benefit-icon">♡</div>
							<strong>Confiança</strong>
							<span>Mais de 35 anos de atuação social.</span>
						</div>

						<div class="remer-benefit">
							<div class="remer-benefit-icon">♧</div>
							<strong>Impacto real</strong>
							<span>Projetos que geram mudanças verdadeiras.</span>
						</div>

					</div>
				</div>
			</div>
		</section>

		<main class="remer-main">
			<div class="remer-container">

				<div class="remer-donation-grid">

					<section class="remer-form-card">

						<div class="remer-title-row">
							<div class="remer-title-icon">♡</div>
							<h2>Faça sua doação</h2>
						</div>

						<p class="remer-form-intro">
							Escolha o valor e prossiga para o pagamento seguro.
						</p>

						<form id="remer-donation-form">

							<span class="remer-label">Tipo de doação</span>

							<div class="remer-type-grid">
								<button
									type="button"
									class="remer-type-button is-active"
								>
									✓ Doação única
								</button>

								<button
									type="button"
									class="remer-type-button"
									disabled
									title="A doação recorrente será configurada posteriormente"
								>
									Doação mensal
									<span class="remer-coming-soon">Em breve</span>
								</button>
							</div>

							<span class="remer-label">Escolha o valor</span>

							<div class="remer-amount-grid">

								<button
									type="button"
									class="remer-amount-button"
									data-amount="30"
								>
									<span class="remer-amount-value">R$ 30</span>
									<span class="remer-amount-description">Ajuda essencial</span>
								</button>

								<button
									type="button"
									class="remer-amount-button is-active"
									data-amount="60"
								>
									<span class="remer-amount-value">R$ 60</span>
									<span class="remer-amount-description">Faz a diferença</span>
								</button>

								<button
									type="button"
									class="remer-amount-button"
									data-amount="90"
								>
									<span class="remer-amount-value">R$ 90</span>
									<span class="remer-amount-description">Transforma histórias</span>
								</button>

								<button
									type="button"
									class="remer-amount-button"
									data-amount="150"
								>
									<span class="remer-amount-value">R$ 150</span>
									<span class="remer-amount-description">Impacto maior</span>
								</button>

							</div>

							<div class="remer-custom-amount">
								<div class="remer-custom-label">Outro valor</div>

								<div class="remer-custom-input-wrap">
									<span>R$</span>
									<input
										type="number"
										id="remer-custom-amount"
										class="remer-custom-input"
										min="<?php echo esc_attr( $settings['minimum_amount'] ); ?>"
										step="0.01"
										placeholder="Digite o valor"
									>
								</div>
							</div>

							<input
								type="hidden"
								id="remer-donation-amount"
								name="amount"
								value="60"
							>

							<span class="remer-label">Seus dados</span>

							<div class="remer-fields-grid">

								<div class="remer-field">
									<label for="remer-name">Nome completo*</label>
									<input
										id="remer-name"
										name="name"
										type="text"
										placeholder="Digite seu nome"
										required
									>
								</div>

								<div class="remer-field">
									<label for="remer-email">E-mail*</label>
									<input
										id="remer-email"
										name="email"
										type="email"
										placeholder="Digite seu e-mail"
										required
									>
								</div>

								<div class="remer-field">
									<label for="remer-phone">Telefone*</label>
									<input
										id="remer-phone"
										name="phone"
										type="tel"
										placeholder="(00) 00000-0000"
										required
									>
								</div>

								<div class="remer-field">
									<label for="remer-cpf">CPF</label>
									<input
										id="remer-cpf"
										name="cpf"
										type="text"
										placeholder="000.000.000-00"
									>
								</div>

							</div>

							<span class="remer-label">
								Formas disponíveis no checkout
							</span>

							<div class="remer-payment-grid">

								<div class="remer-payment-item">
									<span class="remer-payment-icon">◆</span>
									<strong>Pix</strong>
									<small>Pagamento rápido</small>
								</div>

								<div class="remer-payment-item">
									<span class="remer-payment-icon">▣</span>
									<strong>Cartão de crédito</strong>
									<small>Conforme condições do gateway</small>
								</div>

								<div class="remer-payment-item">
									<span class="remer-payment-icon">▥</span>
									<strong>Boleto bancário</strong>
									<small>Conforme disponibilidade</small>
								</div>

							</div>

							<p class="remer-secure-note">
								🔒 Você será encaminhado ao checkout seguro para escolher
								a forma de pagamento.
							</p>

							<button
								type="submit"
								id="remer-submit-button"
								class="remer-submit"
							>
								♡ &nbsp; DOAR AGORA
							</button>

							<div
								id="remer-form-message"
								class="remer-form-message"
								role="alert"
							></div>

						</form>

					</section>

					<aside class="remer-side-column">

						<section class="remer-side-card remer-security-card">
							<div class="remer-security-heading">
								<div class="remer-security-icon">♢</div>
								<div>
									<h3>Sua doação é segura</h3>
									<p>
										O pagamento será processado por uma plataforma
										segura, protegendo seus dados durante a operação.
									</p>
								</div>
							</div>
						</section>

						<section class="remer-side-card remer-destination-card">

							<h3>Onde sua doação chega</h3>

							<div class="remer-destination-list">

								<div class="remer-destination-item">
									<div class="remer-destination-icon">▣</div>
									<div>
										<strong>Educação</strong>
										<span>
											Atividades educativas e desenvolvimento de habilidades.
										</span>
									</div>
								</div>

								<div class="remer-destination-item">
									<div class="remer-destination-icon">♡</div>
									<div>
										<strong>Proteção Social</strong>
										<span>
											Acolhimento, orientação e fortalecimento de vínculos.
										</span>
									</div>
								</div>

								<div class="remer-destination-item">
									<div class="remer-destination-icon">⚽</div>
									<div>
										<strong>Cultura e Esporte</strong>
										<span>
											Oficinas, atividades culturais e esportivas.
										</span>
									</div>
								</div>

								<div class="remer-destination-item">
									<div class="remer-destination-icon">♧</div>
									<div>
										<strong>Desenvolvimento Humano</strong>
										<span>
											Oportunidades, autonomia e inclusão social.
										</span>
									</div>
								</div>

							</div>
						</section>

						<section class="remer-side-card remer-quote-card">
							<div class="remer-quote-mark">“</div>

							<p>
								A REMER acredita que cada gesto de solidariedade
								tem o poder de transformar realidades.
							</p>

							<strong>
								Obrigado por fazer parte dessa transformação!
							</strong>
						</section>

					</aside>

				</div>
			</div>
		</main>

		<section class="remer-impact">
			<div class="remer-container">

				<h2>Nosso compromisso em números</h2>

				<div class="remer-impact-grid">

					<div class="remer-impact-item">
						<span class="remer-impact-number">Desde 1989</span>
						<span>Promovendo proteção e oportunidades</span>
					</div>

					<div class="remer-impact-item">
						<span class="remer-impact-number">4</span>
						<span>Projetos sociais apresentados no site</span>
					</div>

					<div class="remer-impact-item">
						<span class="remer-impact-number">2 estados</span>
						<span>Atuação no Rio de Janeiro e em Minas Gerais</span>
					</div>

					<div class="remer-impact-item">
						<span class="remer-impact-number">Transparência</span>
						<span>Compromisso com apoiadores e parceiros</span>
					</div>

				</div>
			</div>
		</section>

	</div>

	<script>
		document.addEventListener('DOMContentLoaded', function () {

			const form         = document.getElementById('remer-donation-form');
			const amountInput  = document.getElementById('remer-donation-amount');
			const customInput  = document.getElementById('remer-custom-amount');
			const amountButtons = document.querySelectorAll('.remer-amount-button');
			const submitButton = document.getElementById('remer-submit-button');
			const messageBox   = document.getElementById('remer-form-message');

			if (!form) {
				return;
			}

			amountButtons.forEach(function (button) {
				button.addEventListener('click', function () {

					amountButtons.forEach(function (item) {
						item.classList.remove('is-active');
					});

					button.classList.add('is-active');
					amountInput.value = button.dataset.amount;
					customInput.value = '';
				});
			});

			customInput.addEventListener('input', function () {

				amountButtons.forEach(function (item) {
					item.classList.remove('is-active');
				});

				amountInput.value = customInput.value;
			});

			form.addEventListener('submit', async function (event) {
				event.preventDefault();

				messageBox.className = 'remer-form-message';
				messageBox.textContent = '';

				const amount = parseFloat(amountInput.value);
				const minimum = <?php echo (float) $settings['minimum_amount']; ?>;

				if (!amount || amount < minimum) {
					messageBox.textContent =
						'O valor mínimo da doação é R$ ' +
						minimum.toFixed(2).replace('.', ',') + '.';

					messageBox.classList.add('is-error');
					return;
				}

				if (!form.reportValidity()) {
					return;
				}

				submitButton.disabled = true;
				submitButton.textContent = 'PROCESSANDO...';

				const formData = new FormData();

				formData.append('action', 'remer_add_donation');
				formData.append('nonce', <?php echo wp_json_encode( $nonce ); ?>);
				formData.append('amount', amount.toFixed(2));
				formData.append('name', document.getElementById('remer-name').value);
				formData.append('email', document.getElementById('remer-email').value);
				formData.append('phone', document.getElementById('remer-phone').value);
				formData.append('cpf', document.getElementById('remer-cpf').value);

				try {
					const response = await fetch(
						<?php echo wp_json_encode( $ajax_url ); ?>,
						{
							method: 'POST',
							body: formData,
							credentials: 'same-origin'
						}
					);

					const result = await response.json();

					if (result.success && result.data.checkout_url) {
						window.location.href = result.data.checkout_url;
						return;
					}

					throw new Error(
						result.data && result.data.message
							? result.data.message
							: 'Não foi possível continuar.'
					);

				} catch (error) {
					messageBox.textContent = error.message;
					messageBox.classList.add('is-error');

					submitButton.disabled = false;
					submitButton.innerHTML = '♡ &nbsp; DOAR AGORA';
				}
			});
		});
	</script>

	<?php
	return ob_get_clean();
}


/* =========================================================
 * AJAX: ADICIONAR DOAÇÃO AO CARRINHO
 * ======================================================= */

add_action( 'wp_ajax_remer_add_donation', 'remer_ajax_add_donation' );
add_action( 'wp_ajax_nopriv_remer_add_donation', 'remer_ajax_add_donation' );

function remer_ajax_add_donation() {

	check_ajax_referer( 'remer_donation_nonce', 'nonce' );

	if ( ! function_exists( 'WC' ) || ! WC()->cart ) {
		wp_send_json_error(
			array( 'message' => 'O carrinho não está disponível. Atualize a página.' ),
			500
		);
	}

	$settings   = remer_donation_settings();
	$product_id = absint( $settings['product_id'] );
	$minimum    = (float) $settings['minimum_amount'];

	$amount = isset( $_POST['amount'] )
		? (float) wc_format_decimal( wp_unslash( $_POST['amount'] ) )
		: 0;

	if ( $amount < $minimum || $amount > 1000000 ) {
		wp_send_json_error(
			array( 'message' => 'Informe um valor válido para a doação.' ),
			400
		);
	}

	$product = wc_get_product( $product_id );

	if ( ! $product ) {
		wp_send_json_error(
			array( 'message' => 'O produto de doação não foi encontrado.' ),
			404
		);
	}

	$name  = isset( $_POST['name'] )
		? sanitize_text_field( wp_unslash( $_POST['name'] ) )
		: '';

	$email = isset( $_POST['email'] )
		? sanitize_email( wp_unslash( $_POST['email'] ) )
		: '';

	$phone = isset( $_POST['phone'] )
		? sanitize_text_field( wp_unslash( $_POST['phone'] ) )
		: '';

	$cpf = isset( $_POST['cpf'] )
		? sanitize_text_field( wp_unslash( $_POST['cpf'] ) )
		: '';

	if ( empty( $name ) || ! is_email( $email ) || empty( $phone ) ) {
		wp_send_json_error(
			array( 'message' => 'Preencha corretamente nome, e-mail e telefone.' ),
			400
		);
	}

	/*
	 * Evita manter uma doação anterior desse mesmo produto no carrinho.
	 */
	foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
		if ( (int) $cart_item['product_id'] === $product_id ) {
			WC()->cart->remove_cart_item( $cart_item_key );
		}
	}

	$cart_item_data = array(
		'remer_donation_amount' => $amount,
		'remer_unique_key'      => wp_generate_uuid4(),
	);

	$cart_item_key = WC()->cart->add_to_cart(
		$product_id,
		1,
		0,
		array(),
		$cart_item_data
	);

	if ( ! $cart_item_key ) {
		wp_send_json_error(
			array( 'message' => 'Não foi possível adicionar a doação.' ),
			500
		);
	}

	/*
	 * Preenche informações padrão do checkout.
	 */
	if ( WC()->customer ) {
		$name_parts = preg_split( '/\s+/', trim( $name ), 2 );

		$first_name = $name_parts[0] ?? '';
		$last_name  = $name_parts[1] ?? '';

		WC()->customer->set_billing_first_name( $first_name );
		WC()->customer->set_billing_last_name( $last_name );
		WC()->customer->set_billing_email( $email );
		WC()->customer->set_billing_phone( $phone );
		WC()->customer->save();
	}

	WC()->session->set(
		'remer_donor_data',
		array(
			'name'  => $name,
			'email' => $email,
			'phone' => $phone,
			'cpf'   => $cpf,
		)
	);

	WC()->cart->calculate_totals();

	wp_send_json_success(
		array(
			'checkout_url' => wc_get_checkout_url(),
		)
	);
}


/* =========================================================
 * APLICAR O VALOR PERSONALIZADO NO CARRINHO
 * ======================================================= */

add_action(
	'woocommerce_before_calculate_totals',
	'remer_apply_donation_price',
	20
);

function remer_apply_donation_price( $cart ) {

	if ( is_admin() && ! wp_doing_ajax() ) {
		return;
	}

	if ( ! $cart ) {
		return;
	}

	$settings   = remer_donation_settings();
	$product_id = absint( $settings['product_id'] );

	foreach ( $cart->get_cart() as $cart_item ) {

		if (
			(int) $cart_item['product_id'] === $product_id &&
			isset( $cart_item['remer_donation_amount'] )
		) {
			$cart_item['data']->set_price(
				(float) $cart_item['remer_donation_amount']
			);
		}
	}
}


/* =========================================================
 * MOSTRAR "VALOR DA DOAÇÃO" NO CARRINHO E PEDIDO
 * ======================================================= */

add_filter(
	'woocommerce_get_item_data',
	'remer_display_donation_cart_data',
	10,
	2
);

function remer_display_donation_cart_data( $item_data, $cart_item ) {

	if ( isset( $cart_item['remer_donation_amount'] ) ) {
		$item_data[] = array(
			'key'   => 'Contribuição',
			'value' => wc_price(
				(float) $cart_item['remer_donation_amount']
			),
		);
	}

	return $item_data;
}


/* =========================================================
 * SALVAR O VALOR NO PEDIDO
 * ======================================================= */

add_action(
	'woocommerce_checkout_create_order_line_item',
	'remer_save_donation_order_data',
	10,
	4
);

function remer_save_donation_order_data(
	$item,
	$cart_item_key,
	$values,
	$order
) {
	if ( isset( $values['remer_donation_amount'] ) ) {
		$item->add_meta_data(
			'Valor da contribuição',
			wc_price( (float) $values['remer_donation_amount'] ),
			true
		);
	}
}


/* =========================================================
 * TENTAR PREENCHER CPF EM CHECKOUTS BRASILEIROS
 * ======================================================= */

add_filter(
	'woocommerce_checkout_get_value',
	'remer_prefill_checkout_values',
	10,
	2
);

function remer_prefill_checkout_values( $value, $input ) {

	if ( ! function_exists( 'WC' ) || ! WC()->session ) {
		return $value;
	}

	$data = WC()->session->get( 'remer_donor_data' );

	if ( empty( $data ) || ! is_array( $data ) ) {
		return $value;
	}

	$mapping = array(
		'billing_email'    => $data['email'] ?? '',
		'billing_phone'    => $data['phone'] ?? '',
		'billing_cpf'      => $data['cpf'] ?? '',
		'billing_cpf_cnpj' => $data['cpf'] ?? '',
	);

	if ( isset( $mapping[ $input ] ) && ! empty( $mapping[ $input ] ) ) {
		return $mapping[ $input ];
	}

	return $value;
}/* End custom CSS */