/**
 * Estilos Frontend para PayPhone Addons en Checkout.
 */

.payphone-payment-fields {
	padding: 0.5rem 0;
}

.payphone-gateway-description {
	font-size: 0.95rem;
	color: #4a5568;
	margin-bottom: 1rem;
	line-height: 1.5;
}

.payphone-badges-container {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-top: 0.5rem;
	flex-wrap: wrap;
}

.payphone-brand-icon {
	max-height: 24px;
	width: auto;
	display: inline-block;
	vertical-align: middle;
}

.payphone-cards-list {
	display: inline-flex;
	gap: 6px;
	align-items: center;
}

.payphone-card-tag {
	font-size: 0.72rem;
	font-weight: 700;
	padding: 2px 6px;
	border-radius: 4px;
	background: #f1f5f9;
	color: #334155;
	border: 1px solid #cbd5e1;
	letter-spacing: 0.02em;
}

.payphone-card-tag.visa { color: #1a1f71; }
.payphone-card-tag.mastercard { color: #eb001b; }
.payphone-card-tag.diners { color: #004a97; }
.payphone-card-tag.discover { color: #f96302; }
.payphone-card-tag.saldo { color: #ff6400; background: #fff7ed; border-color: #ffedd5; }

/* Contenedor de la Addons en Receipt / Checkout */
.payphone-receipt-wrapper {
	max-width: 520px;
	margin: 2rem auto;
	padding: 1.5rem;
	background: #ffffff;
	border-radius: 12px;
	border: 1px solid #e2e8f0;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
	text-align: center;
}

.payphone-receipt-header {
	margin-bottom: 1.5rem;
}

.payphone-receipt-logo {
	max-height: 48px;
	margin-bottom: 0.5rem;
}

.payphone-receipt-order-info {
	background: #f8fafc;
	padding: 1rem;
	border-radius: 8px;
	margin-bottom: 1.5rem;
	text-align: left;
	font-size: 0.95rem;
}

.payphone-receipt-order-info p {
	margin: 0.35rem 0;
	display: flex;
	justify-content: space-between;
}

.payphone-receipt-order-info strong {
	color: #1e293b;
}

#pp-button {
	margin: 1.5rem auto 0.5rem auto;
	min-height: 50px;
	width: 100%;
}

.payphone-secure-notice {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	margin-top: 1.25rem;
	font-size: 0.82rem;
	color: #64748b;
}

/* ==========================================================================
   INTERFAZ DE PAGO PAYPHONE EN CHECKOUT
   ========================================================================== */

body.pp-payment-ui-open {
	overflow: hidden;
}

.pp-payment-ui-container {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/*
 * SweetAlert2 (confirmación de cierre) SIEMPRE por encima del popup de pago,
 * que el JS fija en z-index 2147483647. El clic fuera del popup debe mostrar
 * el diálogo al frente, nunca detrás del overlay.
 */
.swal2-container {
	z-index: 2147483647 !important;
}

/* Fondo oscuro */
.pp-payment-ui-backdrop {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(15, 23, 42, 0.7);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
}

/* Ventana central */
.pp-payment-ui-dialog {
	position: relative;
	z-index: 2;
	background: #ffffff;
	width: 100%;
	max-width: 500px;
	max-height: 92vh;
	border-radius: 16px;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: payphoneModalFadeIn 0.25s ease-out;
	box-sizing: border-box;
}

@keyframes payphoneModalFadeIn {
	from {
		opacity: 0;
		transform: scale(0.96) translateY(10px);
	}
	to {
		opacity: 1;
		transform: scale(1) translateY(0);
	}
}

.payphone-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	border-bottom: 1px solid #e2e8f0;
	background: #ffffff;
}

.payphone-modal-branding {
	display: flex;
	align-items: center;
	gap: 12px;
}

.payphone-modal-logo {
	max-height: 32px;
	width: auto;
	display: block;
}

.payphone-modal-title {
	margin: 0 !important;
	padding: 0 !important;
	font-size: 1.15rem !important;
	font-weight: 700 !important;
	color: #0f172a !important;
	line-height: 1.3 !important;
}

.payphone-modal-close {
	background: transparent;
	border: none;
	font-size: 28px;
	line-height: 1;
	color: #94a3b8;
	cursor: pointer;
	padding: 4px 8px;
	border-radius: 8px;
	transition: all 0.15s ease;
}

.payphone-modal-close:hover {
	color: #0f172a;
	background: #f1f5f9;
}

.payphone-modal-body {
	padding: 20px;
	overflow-y: auto;
	flex: 1 1 auto;
}

.payphone-modal-order-summary {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	padding: 12px 16px;
	margin-bottom: 16px;
}

.payphone-modal-summary-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 0.95rem;
	color: #475569;
	margin-bottom: 6px;
}

.payphone-modal-summary-item:last-child {
	margin-bottom: 0;
}

.payphone-modal-value {
	color: #0f172a;
	font-weight: 600;
}

.payphone-modal-total {
	font-size: 1.1rem;
	color: #ff6400 !important;
	font-weight: 700 !important;
}

#pp-modal-button-container {
	min-height: 70px;
	margin-top: 10px;
	width: 100%;
}

.payphone-modal-loading {
	text-align: center;
	padding: 20px;
	color: #64748b;
	font-size: 0.95rem;
}

.payphone-spinner {
	display: inline-block;
	width: 28px;
	height: 28px;
	border: 3px solid #e2e8f0;
	border-top-color: #ff6400;
	border-radius: 50%;
	animation: payphoneSpin 0.8s linear infinite;
	margin-bottom: 8px;
}

@keyframes payphoneSpin {
	to { transform: rotate(360deg); }
}

.payphone-modal-footer {
	padding: 10px 0 0 0;
	background: transparent;
	border: none;
	text-align: center;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
	margin-top: -10px; /* pull closer to the payphone button */
}

.payphone-security-logos {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

.security-logo {
	max-height: 22px;
	width: auto;
	filter: grayscale(100%);
	vertical-align: middle;
	display: inline-block;
}

.payphone-powered-by {
	display: flex;
	align-items: center;
	gap: 6px;
}

.powered-text {
	font-size: 0.75rem;
	color: #64748b;
	font-weight: 500;
}

.payphone-logo {
	max-height: 20px;
	width: auto;
	display: inline-block;
}

/* Ocultar completamente el footer nativo de PayPhone para usar el nuestro de 4 columnas */
#pp-modal-button-container .ppb-footer-image-container,
#pp-button .ppb-footer-image-container {
	display: none !important;
}

/* Estilos para el nuevo footer personalizado de 4 columnas */
.payphone-custom-footer-grid {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	margin-top: 15px;
	padding-top: 15px;
	border-top: 1px solid #eaeaea;
}

.payphone-custom-footer-item {
	display: flex;
	justify-content: center;
	align-items: center;
	flex: 1;
}

.payphone-custom-footer-item img {
	max-height: 20px;
	width: auto;
	opacity: 0.8;
}

/* ==========================================================================
   RESPONSIVE — una vista por pantalla (móvil / tablet / desktop)
   ========================================================================== */
@media (max-width: 600px) {
	/* Popup de pago: pantalla completa en móvil. El contenedor ya es flex
	   con align-items:center (lo fuerza el JS al abrir), así que el
	   diálogo ocupa toda la ventana de borde a borde. */
	.pp-payment-ui-dialog {
		max-width: 100%;
		height: 100%;
		max-height: 100%;
		border-radius: 0;
	}

	.payphone-modal-header {
		padding: 12px 14px;
	}

	.payphone-modal-title {
		font-size: 1rem !important;
	}

	.payphone-modal-body {
		padding: 16px 14px;
	}

	.payphone-modal-summary-item {
		flex-wrap: wrap;
		gap: 4px 10px;
	}

	.payphone-modal-footer {
		flex-direction: column;
		align-items: stretch;
		gap: 8px;
	}

	.payphone-security-logos {
		justify-content: center;
	}

	/* Footer de logos del botón de pago: en vez de 4 en fila, 2 por fila. */
	.payphone-custom-footer-grid {
		flex-wrap: wrap;
		justify-content: center;
		gap: 10px;
	}

	.payphone-custom-footer-item {
		flex: 1 1 40%;
	}

	/* Receipt / addons */
	.payphone-receipt-wrapper {
		max-width: 100%;
		padding: 1rem;
	}
}

@media (max-width: 380px) {
	.payphone-modal-logo {
		max-height: 24px;
	}
}
