/*
 * Socialhero benefits widget (2.1.34).
 *
 * Based on Shopify's extensions/cart-extension/assets/style.css (same
 * classes), with WordPress' own design on top: every button in Socialhero
 * purple (#443370) and a modern status modal with a summary card and token
 * badges (see the "Status modal" section). Other changes:
 * - Shopify's nested rules under .socialhero-container are written flat.
 * - "Theme reset" rules: WordPress themes style bare buttons and inputs more
 *   than Shopify themes do; they put those elements back to what the Shopify
 *   rules assume. Keep them when syncing new Shopify styles.
 */

.socialhero-container {
	display: flex;
	justify-content: flex-end;
	width: 100%;
	max-width: var(--page-width, var(--sh-max-width, 1200px));
	min-width: 0;
	margin: 12px auto 32px;
	padding-inline: var(--page-margin, 1.5rem);
	box-sizing: border-box;
	font-family: Ubuntu, Inter, sans-serif;
}

/* No specificity, so the widget's own margins below (also !important) win over this reset. */
:where(.socialhero-container) :where(p, input, button) {
	margin: 0 !important;
	letter-spacing: 0.05em;
}

.socialhero-container input {
	width: 100%;
}

.socialhero-container .hidden {
	display: none;
}

/* Theme reset (see header). */
.socialhero-container *,
.socialhero-container *::before,
.socialhero-container *::after {
	box-sizing: border-box;
}

.socialhero-container button,
.sh-pay-benefits-button {
	min-height: 0;
	height: auto;
	line-height: normal;
	text-transform: none;
	text-decoration: none;
	text-shadow: none;
	box-shadow: none;
}

.socialhero-container input[type="text"],
.socialhero-container input[type="password"] {
	min-height: 0;
	height: auto;
	line-height: normal;
	box-shadow: none;
}

.socialhero-container input[type="radio"] {
	width: 12px;
	height: auto;
	padding: 0;
	margin: 0 !important;
}

.socialhero-container a {
	color: inherit;
}

.input-error {
	color: crimson;
	font-weight: 600;
	display: none;
	font-size: 12px;
	text-align: center;
}

.socialhero-form {
	font-size: 14px;
	width: 100%;
	max-width: 420px;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 32px;
}

#sh-form-fields {
	display: flex;
	flex-direction: column;
	gap: 32px;
}

.socialhero-form * {
	margin-bottom: 0;
}

.socialhero-form input {
	padding: 8px 16px;
	border: 1px solid #1f4e79;
	border-radius: 4px;
	background-color: #deebf7;
	color: #666;
	font-size: 14px;
	margin-bottom: 14px;
	text-align: center;
}

.socialhero-form input:focus {
	outline: 1px solid #1f4e79;
	box-shadow: none;
}

.socialhero-form button {
	font-size: 14px;
	padding: 8px 16px;
	border: none;
	cursor: pointer;
	font-weight: 600;
	display: flex;
	gap: 14px;
	justify-content: center;
	align-items: center;
}

.socialhero-form button:disabled {
	opacity: .5;
	pointer-events: none;
}

.sh-pay-benefits-button {
	font-family: Arial, Helvetica, sans-serif !important;
	background-color: #443370;
	color: #fff;
	border-radius: 24px;
	padding: 12px 20px;
	font-size: 15px;
	font-weight: 700;
	width: 100%;
	text-align: center;
}

.sh-pay-benefits-button:hover {
	background-color: #352a5c;
}

@keyframes sh-flash-highlight {
	/* No 0%/100% frames: the card keeps its own background and shadow before and after. */
	50% {
		box-shadow: 0 0 0 4px rgba(68, 51, 112, 0.4);
		background-color: rgba(68, 51, 112, 0.06);
	}
}

.sh-flash-highlight {
	animation: sh-flash-highlight 0.6s ease-in-out 3;
	border-radius: 12px;
}

.sh-cancel-button {
	font-size: 14px;
	padding: 8px 16px;
	border: 1px solid #443370;
	border-radius: 4px;
	background: transparent;
	color: #443370;
	cursor: pointer;
	font-weight: 600;
}

.sh-cancel-button:hover {
	background: #f6f3fb;
}

.success-title {
	color: #239460;
	font-size: 16px;
	font-weight: 600;
	text-align: center;
}

.error-title {
	color: #df7952;
	font-size: 16px;
	font-weight: 600;
	text-align: center;
}

.error-message {
	font-size: 14px;
	text-align: center;
	white-space: pre-line;
}

.success-message {
	font-size: 14px;
	text-align: center;
	white-space: pre-line;
}

#api-otorga-message {
	display: block;
	font-size: 14px;
	padding: 8px 0;
	color: #5E4692!important;
	font-weight: 600;
}

.api-container {
	line-height: 1.2;
}

/* loader */
.container-loader {
	--uib-size: 20px;
	--uib-color: white;
	--uib-speed: 1s;
	--uib-stroke: 4px;
	--mask-size: calc(var(--uib-size) / 2 - var(--uib-stroke));
	position: relative;
	display: none;
	align-items: center;
	justify-content: flex-start;
	height: var(--uib-size);
	width: var(--uib-size);
	-webkit-mask: radial-gradient(
		circle var(--mask-size),
		transparent 99%,
		#000 100%
	);
	mask: radial-gradient(circle var(--mask-size), transparent 99%, #000 100%);
	background-image: conic-gradient(transparent 25%, var(--uib-color));
	animation: spin calc(var(--uib-speed)) linear infinite;
	border-radius: 50%;
}

@keyframes spin {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(360deg);
	}
}

#validation-options input:focus {
	outline: none;
}

.sh-options-fieldset {
	display: flex;
	gap: 12px;
	flex-direction: column;
	font-size: 14px;
	border: none;
	margin: 0;
	padding: 0;
}

/* Each option is a card (WordPress design, 2.1.34); clicking anywhere on it selects it. */
.sh-benefit-card {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 8px;
	padding: 11px 13px;
	border: 2px solid #443370;
	border-radius: 12px;
	background: #fff;
	box-shadow: 0 2px 8px rgba(30, 20, 60, 0.05);
	text-align: left;
	cursor: pointer;
	transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.sh-benefit-card:hover {
	border-color: #352a5c;
	box-shadow: 0 4px 14px rgba(30, 20, 60, 0.08);
}

.sh-benefit-card:has(input:checked) {
	border-color: #443370;
	background: #faf8fd;
	box-shadow: 0 0 0 2px #443370, 0 4px 14px rgba(68, 51, 112, 0.14);
}

.sh-benefit-card:has(input:disabled) {
	cursor: default;
}

.sh-benefit-card:has(input:disabled:not(:checked)) {
	opacity: 0.55;
}

/* Custom radio. */
.socialhero-container .sh-option-radio input[type="radio"] {
	-webkit-appearance: none;
	appearance: none;
	flex: none;
	width: 18px;
	height: 18px;
	padding: 0;
	border: 2px solid #b9aed0;
	border-radius: 50%;
	background: #fff;
	cursor: pointer;
	transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.socialhero-container .sh-option-radio input[type="radio"]:hover {
	border-color: #443370;
}

.socialhero-container .sh-option-radio input[type="radio"]:checked {
	border-color: #443370;
	background: #443370;
	box-shadow: inset 0 0 0 3px #fff;
}

.socialhero-container .sh-option-radio input[type="radio"]:focus-visible {
	outline: none;
	box-shadow: inset 0 0 0 3px #fff, 0 0 0 3px rgba(68, 51, 112, 0.25);
}

.socialhero-container .sh-option-radio input[type="radio"]:disabled {
	cursor: default;
}

.sh-option-radio label {
	font-size: 14px;
	color: #2a2340;
	cursor: pointer;
}

.sh-benefit-card:has(input:disabled) label {
	cursor: default;
}

/* The code input and the submit button slide in when an option is chosen. */
@keyframes sh-reveal {
	from {
		opacity: 0;
		transform: translateY(-6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

#input-option-container:not(.hidden),
#input-option-container input:not(.hidden),
#sh-submit-validation:not(.hidden) {
	animation: sh-reveal 260ms ease-out;
}

@media (prefers-reduced-motion: reduce) {
	#input-option-container:not(.hidden),
	#input-option-container input:not(.hidden),
	#sh-submit-validation:not(.hidden),
	.sh-flash-highlight {
		animation: none;
	}
}

.sh-benefit-card-title {
	font-size: 12px;
	font-weight: 500;
	letter-spacing: 0.03em;
	color: #7c479e;
	text-transform: uppercase;
}

.sh-title-accent {
	font-weight: 800;
	font-size: 14px;
}

.sh-benefit-logos {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 12px;
	width: 100%;
}

.sh-benefit-logos .sh-benefit-logo {
	flex: 1 1 0;
	min-width: 0;
	max-width: 50%;
}

.sh-benefit-logo {
	max-width: 180px;
	max-height: 64px;
	object-fit: contain;
}

.sh-option-radio {
	display: flex;
	align-items: center;
	gap: 8px;
}

/*
 * Status modal and card summary — WordPress design (2.1.34): Shopify's
 * structure with a subtle Socialhero purple, a summary card and token badges.
 */
.sh-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(23, 16, 40, 0.55);
	-webkit-backdrop-filter: blur(2px);
	backdrop-filter: blur(2px);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	/* Above everything, PayPal's express button (an iframe) included: while a modal is open nothing else can be clicked. */
	z-index: 2147483000;
}

.sh-modal-overlay.hidden {
	display: none;
}

.sh-modal {
	position: relative;
	background: #fff;
	border-radius: 16px;
	border-top: 4px solid #443370;
	padding: 26px 24px 22px;
	max-width: 400px;
	width: 100%;
	max-height: calc(100vh - 32px);
	overflow-y: auto;
	box-shadow: 0 24px 60px rgba(30, 20, 60, 0.28);
	font-family: Ubuntu, Inter, sans-serif;
}

.sh-modal.tone-success {
	border-top-color: #239460;
}

.sh-modal.tone-error {
	border-top-color: #df7952;
}

.sh-modal-close {
	position: absolute;
	top: 8px;
	right: 12px;
	background: none;
	border: none;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	color: #9a93ad;
}

.sh-modal-close:hover {
	color: #443370;
}

/* Theme reset (see header): only the close "×", not a filled button. */
.socialhero-container .sh-modal-close {
	padding: 0;
	line-height: 1;
}

.sh-modal-title {
	font-size: 17px;
	font-weight: 700;
	margin: 0 0 8px !important;
	text-align: center;
	color: #443370;
}

.sh-modal-message {
	font-size: 14px;
	line-height: 1.45;
	margin: 0 !important;
	text-align: center;
	color: #4b4b5a;
	white-space: pre-line;
}

.sh-modal.tone-success .sh-modal-title {
	color: #239460;
}

.sh-modal.tone-error .sh-modal-title {
	color: #df7952;
}

.sh-modal.tone-info .sh-modal-title {
	color: #443370;
}

.sh-modal-actions {
	display: flex;
	gap: 10px;
	justify-content: center;
	margin-top: 20px;
}

.sh-modal-actions.hidden {
	display: none;
}

.sh-modal-button {
	font-size: 13px;
	font-weight: 700;
	padding: 9px 22px;
	min-width: 120px;
	border-radius: 10px;
	cursor: pointer;
	transition: background-color 150ms ease, border-color 150ms ease;
}

.sh-modal-button-primary {
	background: #443370;
	color: #fff;
	border: 1px solid #443370;
}

.sh-modal-button-primary:hover {
	background: #352a5c;
	border-color: #352a5c;
}

.sh-modal-button-secondary {
	background: transparent;
	color: #443370;
	border: 1px solid #cfc4e3;
}

.sh-modal-button-secondary:hover {
	background: #f6f3fb;
}

.sh-modal-countdown {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: fit-content;
	margin: 18px auto 0;
	padding: 6px 14px;
	border-radius: 999px;
	background: #f3effa;
}

.sh-modal-countdown.hidden {
	display: none;
}

.sh-modal-spinner {
	width: 16px;
	height: 16px;
	border: 3px solid #e3dcf0;
	border-top-color: #443370;
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

#sh-modal-countdown-text {
	font-size: 13px;
	font-weight: 700;
	color: #443370;
	font-variant-numeric: tabular-nums;
}

#sh-restore-loader {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 8px 0;
	font-size: 13px;
	color: #443370;
}

#sh-restore-loader.hidden {
	display: none;
}

.sh-restore-spinner {
	flex-shrink: 0;
	width: 18px;
	height: 18px;
	border: 3px solid #e3dcf0;
	border-top-color: #443370;
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

/* Card summary: in the modal and under the form (#sh-redemption-summary). */
#sh-redemption-summary {
	font-size: 13px;
	color: #4b4b5a;
}

#sh-redemption-summary.hidden {
	display: none;
}

.sh-summary-card {
	margin-top: 14px;
	padding: 10px 14px;
	background: #f8f6fc;
	border: 1px solid #ece6f5;
	border-radius: 12px;
	text-align: left;
	white-space: normal;
}

#sh-redemption-summary .sh-summary-card {
	margin-top: 0;
}

.sh-summary-holder {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 6px;
	margin: 2px 0 6px !important;
	font-size: 12.5px;
	color: #4b4b5a;
}

.sh-summary-holder strong {
	color: #2a2340;
}

.sh-chip {
	display: inline-block;
	padding: 1px 8px;
	border-radius: 999px;
	background: #ece6f5;
	color: #443370;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.04em;
	white-space: nowrap;
}

.sh-summary {
	margin: 0 !important;
	padding: 0;
	list-style: none;
}

.sh-summary li {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 12px;
	margin: 0;
	padding: 6px 0;
	font-size: 13px;
	color: #4b4b5a;
	border-bottom: 1px solid #ece6f5;
}

.sh-summary li strong {
	color: #2a2340;
	white-space: nowrap;
}

.sh-summary li.sh-summary-total {
	padding-top: 8px;
	border-bottom: none;
	font-weight: 700;
	color: #443370;
}

.sh-summary li.sh-summary-total strong {
	font-size: 15px;
	color: #443370;
}

.sh-summary-pending {
	margin-left: 4px;
	padding: 1px 7px;
	border-radius: 999px;
	background: #fff4e5;
	color: #a35a00;
	font-size: 10.5px;
	font-style: normal;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.sh-token-section {
	margin-top: 14px;
	text-align: left;
	white-space: normal;
}

.sh-section-label {
	margin: 0 0 6px !important;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #7a6f93;
}

.sh-section-label strong {
	color: #443370;
}

.sh-token-badges {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0 !important;
	padding: 0;
	list-style: none;
}

.sh-token-badge {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	margin: 0;
	padding: 3px 10px 3px 4px;
	border: 1px solid #e7e1f2;
	border-radius: 999px;
	background: #fff;
	font-size: 12px;
	color: #4b4b5a;
	white-space: nowrap;
}

.sh-token-badge img {
	display: block;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	object-fit: contain;
}

.sh-token-badge strong {
	color: #2a2340;
}

.sh-token-badge--prize {
	background: #f6f0ff;
	border-color: #d9ccef;
}

.sh-token-badge--prize strong {
	color: #443370;
}

.sh-cards-list {
	margin: 0 !important;
	padding: 0;
	list-style: none;
	border: 1px solid #ece6f5;
	border-radius: 12px;
	overflow: hidden;
}

.sh-cards-list li {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 7px 12px;
	font-size: 13px;
	background: #fff;
	border-bottom: 1px solid #f0ecf7;
}

.sh-cards-list li:last-child {
	border-bottom: none;
}

.sh-cards-list li strong,
.sh-cards-list li em {
	margin-left: auto;
	white-space: nowrap;
}

.sh-cards-list li strong {
	color: #2a2340;
}

.sh-cards-list li em {
	font-size: 12px;
	color: #9a93ad;
}

.sh-card-folio {
	font-weight: 700;
	letter-spacing: 0.06em;
	color: #2a2340;
}

.sh-cards-list li.sh-card-unused .sh-card-folio {
	color: #9a93ad;
}

.sh-summary-note {
	margin-top: 8px !important;
	font-size: 12px;
	color: #6b6680;
	text-align: left;
}

.sh-summary-expiry {
	display: inline-block;
	padding: 4px 10px;
	border-radius: 8px;
	background: #f3effa;
	color: #443370;
}

.sh-summary li.sh-summary-total small {
	display: block;
	font-size: 11px;
	font-weight: 500;
	color: #7a6f93;
}

.sh-summary-pending--held {
	background: #e9f6ef;
	color: #1d7a4f;
}

/* Multitarjeta: count + "Ver detalles"; the per-card table opens in a nested modal. */
.sh-cards-summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 10px 12px;
	border: 1px solid #ece6f5;
	border-radius: 12px;
	background: #fff;
}

.sh-cards-summary p {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	color: #2a2340;
}

.sh-cards-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: #443370;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
}

.sh-link-button,
.socialhero-container .socialhero-form .sh-link-button {
	flex: none;
	display: inline-block;
	padding: 5px 12px;
	border: 1px solid #cfc4e3;
	border-radius: 999px;
	background: transparent;
	color: #443370;
	font-size: 12px;
	font-weight: 700;
	cursor: pointer;
	white-space: nowrap;
}

.sh-link-button:hover {
	background: #f6f3fb;
}

.sh-modal-overlay--nested {
	z-index: 2147483001;
	background: rgba(23, 16, 40, 0.35);
}

.sh-modal--detail .sh-cards-list {
	margin-top: 14px !important;
	text-align: left;
}

.sh-cards-list li.sh-cards-list-total {
	background: #f8f6fc;
	font-weight: 700;
	color: #443370;
}

.sh-cards-list li.sh-cards-list-total strong {
	color: #443370;
}

/* REDIME password form inside the modal */
.sh-modal-input {
	width: 100%;
	box-sizing: border-box;
	margin-top: 12px !important;
	padding: 10px 12px;
	border: 1px solid #ccc;
	border-radius: 8px;
	font-size: 14px;
}

/* Theme reset (see header): .socialhero-form input would otherwise win over .sh-modal-input. */
.socialhero-container .sh-modal .sh-modal-input {
	padding: 10px 12px;
	border: 1px solid #ccc;
	border-radius: 8px;
	background-color: #fff;
	color: inherit;
	text-align: left;
	margin-top: 12px !important;
}

.sh-modal-error {
	margin-top: 8px !important;
	color: crimson;
	font-weight: 600;
	font-size: 13px;
}

.sh-modal-error.hidden,
.sh-modal-inline-loader.hidden {
	display: none;
}

.sh-modal-inline-loader {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 12px;
	color: #443370;
	font-weight: 600;
}

/*
 * WordPress only.
 */

/*
 * Cart/Checkout Blocks: the widget sits inside the order-summary box. Its own
 * margins (not a width + padding) keep the same gap on both sides of the
 * cards, and the form fills that width instead of being pushed to the right.
 */
.wc-block-components-sidebar .socialhero-container,
.wp-block-woocommerce-cart-order-summary-block .socialhero-container,
.wp-block-woocommerce-checkout-order-summary-block .socialhero-container {
	justify-content: center;
	width: auto;
	max-width: none;
	margin: 12px 24px 32px;
	padding-inline: 0;
}

.wc-block-components-sidebar .socialhero-form,
.wp-block-woocommerce-cart-order-summary-block .socialhero-form,
.wp-block-woocommerce-checkout-order-summary-block .socialhero-form {
	max-width: none;
}

/*
 * The checkout's own "Pagar y obtener beneficios Socialhero" button (manual
 * block). It replaces the widget's own on that page and goes away once a
 * benefit is applied.
 */
.socialhero-payment-pointer {
	display: block;
	border: none;
	cursor: pointer;
	margin: 0 0 1.5rem;
}

.socialhero-payment-pointer:focus-visible {
	background-color: #352a5c;
}

body:has(.socialhero-payment-pointer) #sh-pay-benefits {
	display: none;
}

.socialhero-benefits-applied .socialhero-payment-pointer {
	display: none;
}

/* Multitarjeta (2.1.22): per-card detail under the card fee in the classic cart totals. */
.socialhero-cards-breakdown__fee {
	list-style: none;
	margin: 4px 0 0;
	padding: 0;
	font-size: 0.85em;
	opacity: 0.8;
}
