/* Custom Terms & Conditions Popup - styles */

.ctp-terms-wrapper {
	margin: 0 0 1em;
}

.ctp-terms-row .ctp-terms-link {
	text-decoration: underline;
	cursor: pointer;
}

.ctp-terms-row .ctp-terms-checkbox[disabled] {
	cursor: not-allowed;
	opacity: 0.55;
}

.ctp-terms-row .ctp-terms-checkbox.ctp-accepted {
	opacity: 1;
}

.ctp-error-text {
	color: #d63638;
	font-size: 0.9em;
	margin-top: 4px;
	display: block;
}

.ctp-express-hint {
	color: #6b7280;
	font-size: 0.85em;
	font-style: italic;
	margin: 4px 0 10px;
}

/* Modal */
.ctp-modal {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 100000;
}

.ctp-modal.ctp-modal-open {
	display: block;
}

.ctp-modal-overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.55);
}

.ctp-modal-dialog {
	position: relative;
	width: 92%;
	max-width: 700px;
	margin: 5vh auto;
	background: #fff;
	border-radius: 6px;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
	overflow: hidden;
}

.ctp-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	border-bottom: 1px solid #e2e2e2;
	flex-shrink: 0;
}

.ctp-modal-header h2 {
	margin: 0;
	font-size: 1.25em;
	line-height: 1.3;
}

.ctp-modal-close {
	background: none;
	border: none;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	color: #555;
	padding: 0 4px;
}

.ctp-modal-close:hover {
	color: #000;
}

.ctp-modal-body {
	padding: 20px;
	overflow-y: auto;
	flex: 1 1 auto;
	line-height: 1.6;
}

.ctp-modal-body p {
	margin: 0 0 1em;
}

.ctp-modal-footer {
	padding: 14px 20px;
	border-top: 1px solid #e2e2e2;
	text-align: right;
	display: flex;
	gap: 10px;
	justify-content: flex-end;
	flex-shrink: 0;
}

body.ctp-modal-active {
	overflow: hidden;
}

/* Place order / Proceed to checkout button disabled state (visual only, class toggled by JS) */
#place_order.ctp-disabled,
a.checkout-button.ctp-disabled {
	opacity: 0.5;
	cursor: not-allowed;
	pointer-events: none;
}

.ctp-terms-checkbox-label {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	cursor: default;
}

.ctp-terms-checkbox-label input[type="checkbox"] {
	margin-top: 3px;
	flex-shrink: 0;
}

.ctp-terms-wrapper--cart {
	margin-bottom: 12px;
}

/*
 * Click-blocking overlays.
 *
 * #ctp-checkout-lock-btn covers just the standard "Proceed to checkout"
 * button (.wc-proceed-to-checkout) - rendered server-side so it's active
 * from first paint, no JS delay.
 *
 * #ctp-checkout-lock-express is created dynamically by JS and covers
 * everything BELOW the Terms checkbox down to the bottom of the basket
 * totals box - this catches express payment buttons (Apple Pay / Google
 * Pay / PayPal etc.) wherever the payment gateway happens to render them,
 * without needing to know their exact selector.
 */
.wc-proceed-to-checkout {
	position: relative;
}

.ctp-checkout-lock {
	position: absolute;
	z-index: 9999;
	background: transparent;
}

#ctp-checkout-lock-btn {
	inset: 0;
}

#ctp-checkout-lock-express {
	left: 0;
	right: 0;
	bottom: 0;
	/* "top" is set dynamically via JS, just below the Terms checkbox row */
}

.ctp-checkout-lock.ctp-hidden {
	display: none;
}

/*
 * WooCommerce Stripe Gateway's Express Checkout element (Apple Pay /
 * Google Pay). Hidden by DEFAULT via plain CSS - evaluated at parse time,
 * before any JS runs and before Stripe mounts its button - so there's no
 * timing race/flash regardless of when Stripe's own script finishes
 * initialising. JS adds "ctp-terms-accepted-visible" once terms are
 * accepted. !important guards against Stripe's own inline/JS-set styles.
 */
#wc-stripe-express-checkout-element {
	display: none !important;
}

#wc-stripe-express-checkout-element.ctp-terms-accepted-visible {
	display: block !important;
}

@media (max-width: 480px) {
	.ctp-modal-dialog {
		margin: 0;
		width: 100%;
		height: 100%;
		max-height: 100%;
		border-radius: 0;
	}
}
