/**
 * Payment Modal Styles
 */
.envirabox-payment {
	margin-inline-start: auto;
	margin-inline-end: 50px;
	place-content: center;
}

.envira-payment-modal {
	position: relative;
	display: none;
	margin-inline: auto;
	margin-top: 10px;
}

.envira-payment-trigger {
	text-align: center;
}

.envira-justified-gallery .envira-payment-trigger {
	background-color: rgba(0, 0, 0, 0.3);
	padding: 5px 0;
}

.envira-justified-gallery .envira-payment-trigger .envira-current-price {
	color: #fff;
}

/**
 * Boxed grid layouts clip content flowing below the image
 * (.envira-gallery-item-inner is overflow:hidden) — pin the purchase strip
 * over the image bottom instead.
 */
.envira-layout-highlight-grid .envira-gallery-item-inner,
.envira-layout-bnb .envira-gallery-item-inner,
.envira-layout-bnb--overlay .envira-gallery-item-inner {
	position: relative; /* anchor for the pinned strip below */
}

.envira-layout-highlight-grid .envira-gallery-item-inner .envira-payment-modal,
.envira-layout-bnb .envira-gallery-item-inner .envira-payment-modal,
.envira-layout-bnb--overlay .envira-gallery-item-inner .envira-payment-modal {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	margin: 0;
	/* no z-index: it would trap the fixed checkout overlay in this stacking
	   context and let sibling strips paint over it */
}

.envira-layout-highlight-grid .envira-payment-modal .envira-payment-trigger,
.envira-layout-bnb .envira-payment-modal .envira-payment-trigger,
.envira-layout-bnb--overlay .envira-payment-modal .envira-payment-trigger {
	background-color: rgba(0, 0, 0, 0.35);
	padding: 5px 0;
}

.envira-layout-highlight-grid .envira-payment-trigger .envira-current-price,
.envira-layout-bnb .envira-payment-trigger .envira-current-price,
.envira-layout-bnb--overlay .envira-payment-trigger .envira-current-price {
	color: #fff;
}

/* While a checkout modal is open, lift its wrapper above sibling item strips —
   their stacking contexts would otherwise paint over the fixed overlay. */
.envira-payment-modal.envira-payment-modal--open,
.envira-payment-popover.envira-payment-modal--open {
	z-index: 10001;
}

.envira-price-display {
	margin-bottom: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
}

.envira-purchase-btn {
	background: #7cc148;
	color: white;
	border: none;
	padding: 10px 20px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
}

.envira-purchase-btn:hover {
	background: #7cc148;
}

.envira-payment-modal-overlay {
	display: none;
}

.envira-payment-modal-overlay.show {
	display: block;
}

.envira-payment-modal .envira-payment-modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.5);
	z-index: 10000;
	box-sizing: border-box;
}

.envira-payment-modal-content {
	background: white;
	border-radius: 7px;
	width: 100%;
	width: 280px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
	overflow: hidden;
}

.envira-payment-modal .envira-payment-modal-content {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	text-align: left;
}

.envira-payment-modal-content * {
	line-height: 18px;
}

.envira-payment-modal-close {
	font-size: 24px;
	font-weight: bold;
	color: #999;
	cursor: pointer;
	height: 16px;
	width: 16px;
	position: absolute;
	top: 10px;
	right: 10px;
	display: flex;
	place-items: center;
}

.envira-payment-modal-close:hover {
	color: #333;
}

.envira-payment-modal-body {
	padding-inline: 24px;
	padding-block-start: 24px;
}

.envira-payment-section {
	margin-bottom: 20px;
}

.envira-payment-section label {
	display: block;
	font-weight: 600;
	margin-bottom: 8px;
	color: #333;
	font-size: 14px;
}

.envira-payment-price {
	display: flex;
	align-items: center;
	justify-content: flex-start;
}

.envira-current-price {
	font-size: 16px;
	font-weight: 600;
	color: #1d2327;
}

.envira-payment-modal-content .envira-current-price {
	font-size: 22px;
}

.envira-size-options {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

label.envira-size-option {
	display: flex;
	align-items: center;
	cursor: pointer;
	font-size: 14px;
	color: #333;
}

.envira-size-option input[type="checkbox"] {
	display: none;
}

.envira-checkmark {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid #ddd;
	border-radius: 4px;
	margin-right: 8px;
	position: relative;
}

.envira-size-option input[type="checkbox"]:checked + .envira-checkmark {
	background: #7cc148;
	border-color: #7cc148;
}

.envira-size-option input[type="checkbox"]:checked + .envira-checkmark:after {
	content: "✓";
	color: white;
	font-size: 12px;
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
}

.envira-payment-modal-footer {
	padding: 0 24px 30px;
	background: #f9f9f9;
	text-align: center;
}

.envira-purchase-final-btn {
	background: #7cc148;
	color: white;
	border: none;
	padding: 12px 30px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 16px;
	font-weight: 600;
}

.envira-purchase-final-btn:hover {
	background: #7cc148;
}

/**
 * Payment Popover Styles
 */
.envira-payment-popover {
	position: relative;
}

.envira-payment-popover .envira-payment-trigger {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 24px;
}

.envira-payment-popover .envira-price-display .envira-current-price {
	color: white;
}

.envira-payment-popover .envira-price-display {
	margin-bottom: 0px;
}

.envira-payment-popover .envira-payment-modal-overlay {
	position: absolute;
	top: calc(100% + 6px);
	right: 0;
}

/**
 * Injected lightbox placeholder — themes whose template lacks the static
 * .envirabox-payment container (legacy, infinity, classical families).
 */
.envirabox-payment--injected {
	margin: 0;
}

.envirabox-image-wrap .envirabox-payment--injected {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 10;
	margin: 0;
	pointer-events: none;
}

.envirabox-image-wrap .envirabox-payment--injected .envira-payment-popover {
	position: static;
}

.envirabox-image-wrap .envirabox-payment--injected .envira-payment-trigger {
	position: absolute;
	right: 0;
	bottom: 0;
	padding: 8px 12px;
	background: rgba(0, 0, 0, 0.4);
	border-radius: 4px 0 0 0;
	cursor: auto;
	pointer-events: auto;
}

/* The open modal dims the image and centers the checkout inside it, so it can
   never overflow a narrow (portrait) image or slide under the nav arrows. */
.envirabox-image-wrap .envirabox-payment--injected .envira-payment-modal-overlay {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	background-color: rgba(0, 0, 0, 0.35);
	pointer-events: auto;
}

.envirabox-image-wrap .envirabox-payment--injected .envira-payment-modal-overlay.show {
	display: flex;
	align-items: flex-end;
	justify-content: flex-end;
	/* bottom padding keeps the modal clear of the purchase badge */
	padding: 8px 8px 56px;
	box-sizing: border-box;
}

.envirabox-image-wrap .envirabox-payment--injected .envira-payment-modal-content {
	position: relative; /* anchors the close × to the modal, not the overlay */
	max-width: 100%;
	max-height: 100%;
	overflow-y: auto;
}

/* Arrows overlap the image edges on several themes and stack above anything
   inside the image wrap — hide them while the checkout modal is open. */
/* display (not visibility): themes force visibility:visible on the arrow
   spans, which would punch through an inherited visibility:hidden. */
.envirabox-container.envira-payment-checkout-open .envirabox-navigation,
.envirabox-container.envira-payment-checkout-open .envirabox-navigation-inside {
	display: none;
}

/* Light top-bar placements (infinity/classical) have no dark backdrop — the
   default white price text would be invisible. */
.envirabox-theme-infinity_light .envirabox-payment--injected .envira-current-price,
.envirabox-theme-classical_light .envirabox-payment--injected .envira-current-price {
	color: #1d2327;
}

/* Top placements sit in full-width containers (infinity title-wrap spans the
   viewport) — shrink the popover to the trigger so the modal anchors to the
   button instead of the container's far-right edge. */
.envirabox-woocommerce-container .envirabox-payment--injected {
	text-align: center;
}

.envirabox-woocommerce-container .envirabox-payment--injected .envira-payment-popover {
	display: inline-block;
}

/* Don't let the trigger centering above bleed into the checkout modal. */
.envirabox-payment--injected .envira-payment-modal-content {
	text-align: left;
}

/**
 * Payment Success Modal Styles
 */
.envira-success-modal {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100vh;
	z-index: 10000;
	background: rgba(0, 0, 0, 0.2);
}

.envira-success-modal * {
	min-width: 0;
}

.envira-success-content {
	background: white;
	width: 400px;
	max-width: 100%;
	padding: 40px 30px 30px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
	text-align: center;
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
}

.envira-success-icon {
	width: 35px;
	height: 35px;
	background: transparent;
	border: 3px solid #22c55e;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 auto 20px;
	font-size: 24px;
	color: #22c55e;
	font-weight: bold;
}

.envira-success-content h2 {
	font-size: 24px;
	font-weight: 800;
	color: #1a1a1a;
	margin-bottom: 15px;
}

.envira-success-content p {
	font-size: 14px;
	color: #666;
	margin-bottom: 40px;
}

.envira-success-content h3 {
	font-size: 18px;
	font-weight: 600;
	color: #1a1a1a;
	margin-bottom: 30px;
	text-align: left;
}

.envira-details {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 30px;
	text-align: left;
	margin-bottom: 40px;
}

.envira-details > div {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.envira-details span:first-child {
	font-size: 14px;
	color: #666;
	font-weight: 500;
}

.envira-details span:last-child {
	font-size: 16px;
	color: #1a1a1a;
	font-weight: 600;
	word-break: break-word;
}

.envira-success-content button {
	background: #1a1a1a;
	color: white;
	border: none;
	padding: 12px 24px;
	border-radius: 6px;
	cursor: pointer;
	font-size: 16px;
	font-weight: 600;
	transition: background-color 0.2s ease;
	min-width: 160px;
}

.envira-success-content button:hover {
	background: #232323;
}

@media (max-width: 480px) {
	.envira-success-content {
		padding: 30px 20px 20px;
	}

	.envira-details {
		grid-template-columns: 1fr;
		gap: 15px;
	}
}
