/* ==========================================================================
   PopupCheckout Pro — Frontend Popup CSS
   ========================================================================== */

/* --- CSS Custom Properties (set via inline style from PHP) --- */
:root {
	--pcp-button-color:  #16a34a;
	--pcp-button-text:   #ffffff;
	--pcp-button-weight: 700;
	--pcp-radius:        20px;
	--pcp-transition:    0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

/* --- Overlay / Backdrop --- */
.pcp-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	z-index: 99998;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	overscroll-behavior: contain;
}

/* --- Popup Panel --- */
.pcp-popup-panel {
	position: fixed;
	bottom: 0;
	left: 50%;
	transform: translateX(-50%) translateY(100%);
	width: 100%;
	max-width: 480px;
	max-height: 85vh;
	overflow-y: auto;
	background: #ffffff;
	border-radius: var(--pcp-radius) var(--pcp-radius) 0 0;
	z-index: 99999;
	padding: 0 20px 32px;
	box-shadow: 0 -4px 40px rgba(0, 0, 0, 0.18);
	will-change: transform;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
}

.pcp-popup-panel.pcp-is-open {
	animation: pcpSlideUp var(--pcp-transition) forwards;
}

.pcp-popup-panel.pcp-is-closing {
	animation: pcpSlideDown var(--pcp-transition) forwards;
}

/* --- Animations --- */
@keyframes pcpSlideUp {
	from { transform: translateX(-50%) translateY(100%); }
	to   { transform: translateX(-50%) translateY(0);    }
}

@keyframes pcpSlideDown {
	from { transform: translateX(-50%) translateY(0);    }
	to   { transform: translateX(-50%) translateY(100%); }
}

@keyframes pcpShake {
	0%, 100% { transform: scale(1);            }
	10%, 90%  { transform: scale(1) rotate(-1deg); }
	30%, 70%  { transform: scale(1.02) rotate(1deg); }
	50%       { transform: scale(1.02) rotate(-1deg); }
}

.pcp-place-order-btn.pcp-shaking {
	animation: pcpShake 0.5s ease-in-out;
}

/* --- Drag Handle --- */
.pcp-drag-handle {
	width: 40px;
	height: 4px;
	background: #d1d5db;
	border-radius: 2px;
	margin: 12px auto 8px;
}

/* --- Close Button --- */
.pcp-close-btn {
	position: absolute;
	top: 16px;
	right: 16px;
	width: 32px;
	height: 32px;
	background: #f3f4f6;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #6b7280;
	padding: 0;
	transition: background 0.2s;
}
.pcp-close-btn:hover { background: #e5e7eb; }

/* --- Popup Title --- */
.pcp-popup-title {
	font-size: 18px;
	font-weight: 700;
	color: #111827;
	margin: 0 0 16px;
	text-align: center;
}

/* --- Section titles --- */
.pcp-section-title {
	font-size: 14px;
	font-weight: 600;
	color: #374151;
	margin: 16px 0 10px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

/* --- Product Summary --- */
.pcp-product-summary {
	display: flex;
	gap: 12px;
	align-items: center;
	padding: 12px;
	background: #f9fafb;
	border-radius: 12px;
	margin-bottom: 4px;
}
.pcp-product-image {
	width: 64px;
	height: 64px;
	object-fit: cover;
	border-radius: 8px;
	flex-shrink: 0;
}
.pcp-product-name {
	font-size: 15px;
	font-weight: 600;
	color: #111827;
	margin: 0 0 4px;
}
.pcp-product-price {
	font-size: 18px;
	font-weight: 700;
	color: var(--pcp-button-color);
}

/* --- Billing Form --- */
.pcp-billing-form { margin-top: 4px; }

.pcp-field-group {
	margin-bottom: 12px;
}
.pcp-field-group label {
	display: block;
	font-size: 13px;
	font-weight: 500;
	color: #374151;
	margin-bottom: 4px;
}
.pcp-field-group input[type="text"],
.pcp-field-group input[type="email"],
.pcp-field-group input[type="tel"] {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	font-size: 15px;
	color: #111827;
	background: #fff;
	box-sizing: border-box;
	transition: border-color 0.2s;
	-webkit-appearance: none;
	appearance: none;
}
.pcp-field-group input:focus {
	outline: none;
	border-color: var(--pcp-button-color);
	/* Fallback for browsers without color-mix support (Safari ≤16.1, FF ≤112) */
	box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--pcp-button-color) 15%, transparent);
}
.pcp-field-group input.pcp-field-error {
	border-color: #ef4444;
}
.pcp-field-error-msg {
	font-size: 12px;
	color: #ef4444;
	margin-top: 2px;
}

/* --- Order Bump --- */
.pcp-order-bump-box {
	border: 2px dashed var(--pcp-button-color);
	border-radius: 12px;
	padding: 12px;
	/* Fallback for browsers without color-mix support */
	background: rgba(22, 163, 74, 0.06);
	background: color-mix(in srgb, var(--pcp-button-color) 6%, white);
	margin: 12px 0;
}
.pcp-order-bump-label {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	cursor: pointer;
}
.pcp-order-bump-check {
	margin-top: 3px;
	accent-color: var(--pcp-button-color);
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}
.pcp-order-bump-content {
	display: flex;
	gap: 10px;
	align-items: center;
}
.pcp-bump-image {
	width: 48px;
	height: 48px;
	object-fit: cover;
	border-radius: 6px;
	flex-shrink: 0;
}
.pcp-bump-headline {
	font-size: 14px;
	font-weight: 700;
	color: #111827;
	display: block;
	margin-bottom: 2px;
}
.pcp-bump-description {
	font-size: 12px;
	color: #6b7280;
	display: block;
	margin-bottom: 4px;
}
.pcp-bump-price {
	font-size: 14px;
	font-weight: 600;
	color: var(--pcp-button-color);
}

/* --- Payment Methods --- */
.pcp-gateway-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-bottom: 10px;
}
.pcp-gateway-card {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px;
	border: 2px solid #e5e7eb;
	border-radius: 10px;
	cursor: pointer;
	transition: border-color 0.2s, background 0.2s;
}
.pcp-gateway-card:hover {
	border-color: var(--pcp-button-color);
}
.pcp-gateway-card.pcp-gateway-selected {
	border-color: var(--pcp-button-color);
	/* Fallback for browsers without color-mix support */
	background: rgba(22, 163, 74, 0.05);
	background: color-mix(in srgb, var(--pcp-button-color) 5%, white);
}
.pcp-gateway-card input[type="radio"] {
	accent-color: var(--pcp-button-color);
	width: 16px;
	height: 16px;
}
.pcp-gateway-title {
	font-size: 14px;
	font-weight: 500;
	color: #111827;
}
.pcp-gateway-description {
	font-size: 13px;
	color: #6b7280;
	margin-top: 6px;
	padding: 8px 12px;
	background: #f9fafb;
	border-radius: 8px;
}

/* --- Place Order Button --- */
.pcp-submit-wrap {
	margin-top: 16px;
}
.pcp-place-order-btn {
	width: 100%;
	padding: 15px 20px;
	border: none;
	border-radius: 12px;
	font-size: 17px;
	font-weight: var(--pcp-button-weight);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	transition: filter 0.2s, transform 0.1s;
	-webkit-appearance: none;
	appearance: none;
}
.pcp-place-order-btn:hover  { filter: brightness(1.08); }
.pcp-place-order-btn:active { transform: scale(0.98); }
.pcp-place-order-btn:disabled {
	opacity: 0.7;
	cursor: not-allowed;
}

.pcp-secure-badge {
	text-align: center;
	font-size: 12px;
	color: #9ca3af;
	margin-top: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
}

/* --- Spinner / Loading --- */
.pcp-loading {
	text-align: center;
	padding: 40px 20px;
}
.pcp-spinner {
	width: 36px;
	height: 36px;
	border: 3px solid #e5e7eb;
	border-top-color: var(--pcp-button-color);
	border-radius: 50%;
	animation: pcpSpin 0.7s linear infinite;
	margin: 0 auto 12px;
}
@keyframes pcpSpin {
	to { transform: rotate(360deg); }
}

/* --- Notice --- */
.pcp-notice {
	padding: 10px 14px;
	border-radius: 8px;
	font-size: 14px;
	margin-bottom: 12px;
}
.pcp-notice-error {
	background: #fef2f2;
	color: #dc2626;
	border: 1px solid #fecaca;
}
.pcp-notice-success {
	background: #f0fdf4;
	color: #16a34a;
	border: 1px solid #bbf7d0;
}

/* --- Redirect / Payment Frame Screens --- */
.pcp-redirect-screen,
.pcp-payment-frame-wrap {
	text-align: center;
	padding: 30px 20px;
}
.pcp-payment-frame-wrap iframe {
	width: 100%;
	min-height: 400px;
	border: none;
	border-radius: 8px;
}

/* --- Quantity Stepper --- */
.pcp-qty-stepper {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 8px;
}

.pcp-qty-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	font-size: 18px;
	line-height: 1;
	background: var(--pcp-surface, #f3f4f6);
	border: 1px solid var(--pcp-border, #e5e7eb);
	border-radius: 6px;
	cursor: pointer;
	transition: background 0.15s;
}

.pcp-qty-btn:hover {
	background: var(--pcp-border, #e5e7eb);
}

.pcp-qty-input {
	width: 52px;
	text-align: center;
	height: 32px;
	border: 1px solid var(--pcp-border, #e5e7eb);
	border-radius: 6px;
	font-size: 14px;
}

/* Hide spin buttons on qty input */
.pcp-qty-input::-webkit-inner-spin-button,
.pcp-qty-input::-webkit-outer-spin-button { -webkit-appearance: none; appearance: none; margin: 0; }
.pcp-qty-input[type=number] { -moz-appearance: textfield; appearance: textfield; }

/* --- Mobile Full-Screen Mode --- */
@media (max-width: 480px) {
	.pcp-popup-panel.pcp-mobile-fullscreen {
		max-width: 100%;
		max-height: calc(100vh - 60px); /* Keep ~60px backdrop visible at top */
		border-radius: var(--pcp-radius) var(--pcp-radius) 0 0;
	}
}
