/* ── XT Payment Manager ─────────────────────────────── */

/* Tipografía: heredar Nunito del sitio */
.xtpm-payment-methods,
.xtpm-add-method,
.xtpm-edit-method,
.xtpm-modal,
.xtpm-toast {
	font-family: 'Nunito', sans-serif;
}

/* Ocultar edit-payment-method del menú (requiere ID, solo se accede desde botón) */
li:has(> a.urcma-edit-payment-method),
li:has(> a[href*="edit-payment-method"]) {
	display: none !important;
}

/* Agregar tarjeta como sub-item de Métodos de pago */
li:has(> a.urcma-add-payment-method),
li:has(> a[href*="add-payment-method"]) {
	padding-left: 20px !important;
	font-size: 0.9em !important;
}


.xtpm-payment-methods {
	max-width: 800px;
}

/* Header */
.xtpm-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20px;
}

.xtpm-header h3 {
	margin: 0;
}

.xtpm-btn-add {
	background-color: #2d6b4f !important;
	color: #fff !important;
	border: none !important;
	padding: 8px 20px !important;
	border-radius: 4px !important;
	text-decoration: none !important;
	font-size: 14px !important;
}

.xtpm-btn-add:hover {
	background-color: #245a42 !important;
}

/* Empty state */
.xtpm-empty {
	text-align: center;
	padding: 40px 20px;
	background: #f9f9f9;
	border-radius: 8px;
}

.xtpm-empty p {
	margin-bottom: 15px;
	color: #666;
}

/* Cards list */
.xtpm-cards-list {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

/* Single card */
.xtpm-card {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 16px 20px;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	background: #fff;
	transition: border-color 0.2s;
}

.xtpm-card:hover {
	border-color: #bbb;
}

.xtpm-card--default {
	border-color: #2d6b4f;
	border-width: 2px;
}

.xtpm-card--expired {
	opacity: 0.65;
}

.xtpm-card__main {
	display: flex;
	align-items: center;
	gap: 16px;
	flex: 1;
}

/* Brand icons */
.xtpm-card__brand {
	width: 48px;
	height: 32px;
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center;
	flex-shrink: 0;
}

.xtpm-brand--visa {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 32'%3E%3Crect width='48' height='32' rx='4' fill='%231a1f71'/%3E%3Ctext x='24' y='20' text-anchor='middle' fill='white' font-family='Arial,sans-serif' font-size='12' font-weight='bold' font-style='italic'%3EVISA%3C/text%3E%3C/svg%3E");
}

.xtpm-brand--mastercard {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 32'%3E%3Crect width='48' height='32' rx='4' fill='%23252525'/%3E%3Ccircle cx='19' cy='16' r='9' fill='%23eb001b'/%3E%3Ccircle cx='29' cy='16' r='9' fill='%23f79e1b'/%3E%3Cpath d='M24 9.3a9 9 0 010 13.4 9 9 0 000-13.4z' fill='%23ff5f00'/%3E%3C/svg%3E");
}

.xtpm-brand--amex {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 32'%3E%3Crect width='48' height='32' rx='4' fill='%23006fcf'/%3E%3Ctext x='24' y='20' text-anchor='middle' fill='white' font-family='Arial,sans-serif' font-size='9' font-weight='bold'%3EAMEX%3C/text%3E%3C/svg%3E");
}

.xtpm-brand--generic {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 32'%3E%3Crect width='48' height='32' rx='4' fill='%23ccc'/%3E%3Crect x='6' y='10' width='36' height='4' rx='1' fill='%23999'/%3E%3Crect x='6' y='18' width='20' height='4' rx='1' fill='%23999'/%3E%3C/svg%3E");
}

/* Card info */
.xtpm-card__info {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.xtpm-card__number {
	font-size: 15px;
	font-weight: 600;
	color: #333;
	display: flex;
	align-items: center;
	gap: 8px;
}

.xtpm-card__label {
	font-size: 13px;
	color: #888;
	font-style: italic;
}

.xtpm-card__details {
	font-size: 12px;
	color: #999;
	display: flex;
	gap: 12px;
}

.xtpm-card__billing {
	font-size: 12px;
	color: #999;
	margin-top: 4px;
	display: flex;
	flex-direction: column;
}

/* Badges */
.xtpm-badge-default {
	background: #2d6b4f;
	color: #fff;
	font-size: 10px;
	padding: 2px 8px;
	border-radius: 10px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.xtpm-badge-expired {
	background: #d32f2f;
	color: #fff;
	font-size: 10px;
	padding: 2px 8px;
	border-radius: 10px;
	font-weight: 600;
	text-transform: uppercase;
}

/* Card actions */
.xtpm-card__actions {
	display: flex;
	gap: 8px;
	flex-shrink: 0;
}

.xtpm-btn {
	border: 1px solid #ddd;
	background: #fff;
	padding: 6px 14px;
	border-radius: 4px;
	font-size: 12px;
	cursor: pointer;
	color: #555;
	transition: all 0.2s;
}

.xtpm-btn:hover {
	background: #f5f5f5;
}

.xtpm-btn--default {
	border-color: #2d6b4f;
	color: #2d6b4f;
}

.xtpm-btn--default:hover {
	background: #2d6b4f;
	color: #fff;
}

.xtpm-btn--edit {
	text-decoration: none !important;
	display: inline-flex;
	align-items: center;
}

.xtpm-btn--delete {
	border-color: #d32f2f;
	color: #d32f2f;
}

.xtpm-btn--delete:hover {
	background: #d32f2f;
	color: #fff;
}

/* ── Forms ─────────────────────────────────────────── */

.xtpm-form {
	max-width: 600px;
}

.xtpm-section {
	margin-bottom: 24px;
}

.xtpm-section h4 {
	margin: 0 0 12px;
	padding-bottom: 8px;
	border-bottom: 1px solid #eee;
}

.xtpm-form h4 {
	margin-top: 24px;
	margin-bottom: 12px;
	padding-bottom: 8px;
	border-bottom: 1px solid #eee;
}

.xtpm-form-row {
	margin-bottom: 14px;
}

.xtpm-form-row label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	margin-bottom: 4px;
	color: #444;
}

.xtpm-form-row input[type="text"],
.xtpm-form-row select {
	width: 100%;
	padding: 8px 12px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 14px;
	box-sizing: border-box;
}

.xtpm-form-row input:focus,
.xtpm-form-row select:focus {
	border-color: #2d6b4f;
	outline: none;
	box-shadow: 0 0 0 2px rgba(45, 107, 79, 0.1);
}

.xtpm-form-row--checkbox label {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-weight: 400;
	cursor: pointer;
}

.xtpm-form-row--half {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

.xtpm-form-row--thirds {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	gap: 12px;
}

.xtpm-form-actions {
	display: flex;
	gap: 12px;
	margin-top: 24px;
}

.xtpm-btn-save {
	background-color: #2d6b4f !important;
	color: #fff !important;
	border: none !important;
	padding: 10px 24px !important;
	border-radius: 4px !important;
}

.xtpm-btn-save:hover {
	background-color: #245a42 !important;
}

.xtpm-btn-cancel {
	background: #f5f5f5 !important;
	color: #666 !important;
	border: 1px solid #ddd !important;
	padding: 10px 24px !important;
	border-radius: 4px !important;
	text-decoration: none !important;
}

/* Message */
.xtpm-form-message {
	margin-top: 16px;
	padding: 10px 16px;
	border-radius: 4px;
	font-size: 14px;
}

.xtpm-form-message--success {
	background: #e8f5e9;
	color: #2e7d32;
	border: 1px solid #c8e6c9;
}

.xtpm-form-message--error {
	background: #ffebee;
	color: #c62828;
	border: 1px solid #ffcdd2;
}

/* Edit card summary */
.xtpm-edit-card-summary {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	background: #f5f5f5;
	border-radius: 8px;
	margin-bottom: 24px;
}

.xtpm-edit-card-number {
	font-weight: 600;
	font-size: 15px;
}

.xtpm-edit-card-exp {
	color: #888;
	font-size: 13px;
}

/* ── Renewal section ──────────────────────────────── */
.xtpm-renew-section {
	margin-bottom: 20px;
	padding: 16px;
	background: #fffbf0;
	border: 1px solid #f0e0b0;
	border-radius: 8px;
}

.xtpm-renew-toggle {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	font-weight: 500;
	color: #555;
	cursor: pointer;
}

.xtpm-renew-toggle input[type="checkbox"] {
	width: 16px;
	height: 16px;
	accent-color: #2d6b4f;
}

.xtpm-renew-hint {
	font-size: 13px;
	color: #888;
	margin: 8px 0 12px;
	line-height: 1.4;
}

.xtpm-renew-fields .xtpm-form-row {
	margin-bottom: 12px;
}

/* ── Visibility ────────────────────────────────────── */
.xtpm-hidden {
	display: none !important;
}

/* ── Loading ───────────────────────────────────────── */
.xtpm-loading {
	pointer-events: none;
	opacity: 0.6;
}

/* ── Modal ─────────────────────────────────────────── */
.xtpm-modal {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 999999;
	align-items: center;
	justify-content: center;
}

.xtpm-modal--open {
	display: flex;
}

.xtpm-modal__overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	backdrop-filter: blur(3px);
}

.xtpm-modal__box {
	position: relative;
	background: #fff;
	border-radius: 12px;
	padding: 32px;
	max-width: 420px;
	width: 90%;
	text-align: center;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
	animation: xtpm-modal-in 0.25s ease-out;
}

@keyframes xtpm-modal-in {
	from { opacity: 0; transform: scale(0.9) translateY(10px); }
	to { opacity: 1; transform: scale(1) translateY(0); }
}

.xtpm-modal__icon {
	margin-bottom: 16px;
}

.xtpm-modal__icon svg {
	display: inline-block;
}

.xtpm-modal__text {
	font-size: 15px;
	line-height: 1.5;
	color: #333;
	margin-bottom: 24px;
}

.xtpm-modal__actions {
	display: flex;
	gap: 10px;
	justify-content: center;
}

.xtpm-modal__btn {
	padding: 10px 24px;
	border-radius: 6px;
	border: 1px solid #ddd;
	background: #fff;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.15s;
}

.xtpm-modal__btn:hover {
	background: #f5f5f5;
}

.xtpm-modal__btn--primary {
	background: #2d6b4f;
	color: #fff;
	border-color: #2d6b4f;
}

.xtpm-modal__btn--primary:hover {
	background: #245a42;
}

.xtpm-modal__btn--secondary {
	background: #f5f5f5;
	color: #666;
}

.xtpm-modal__btn--danger {
	background: #d32f2f;
	color: #fff;
	border-color: #d32f2f;
}

.xtpm-modal__btn--danger:hover {
	background: #b71c1c;
}

/* ── Toast ─────────────────────────────────────────── */
.xtpm-toast {
	position: fixed;
	bottom: 30px;
	right: 30px;
	padding: 14px 24px;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 500;
	color: #fff;
	z-index: 1000000;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
	transform: translateY(20px);
	opacity: 0;
	transition: all 0.3s ease;
}

.xtpm-toast--visible {
	transform: translateY(0);
	opacity: 1;
}

.xtpm-toast--success {
	background: #2d6b4f;
}

.xtpm-toast--error {
	background: #d32f2f;
}

/* ── Mobile ────────────────────────────────────────── */
@media (max-width: 600px) {
	.xtpm-header {
		flex-direction: column;
		gap: 10px;
		align-items: flex-start;
	}

	.xtpm-card {
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
	}

	.xtpm-card__actions {
		width: 100%;
		display: flex;
		flex-wrap: wrap;
		gap: 8px;
	}

	.xtpm-card__actions .xtpm-btn--default {
		width: 100%;
		text-align: center;
		order: -1;
	}

	.xtpm-card__actions .xtpm-btn--edit,
	.xtpm-card__actions .xtpm-btn--delete {
		flex: 1;
		text-align: center;
	}

	.xtpm-form-row--half,
	.xtpm-form-row--thirds {
		grid-template-columns: 1fr;
	}

	.xtpm-form-actions {
		flex-direction: column;
	}

	.xtpm-form-actions .button {
		text-align: center;
	}
}

/* ── 3DS Overlay ───────────────────────────────────── */

.xtpm-3ds-method-container {
	position: absolute;
	left: -9999px;
	top: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.xtpm-3ds-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.6);
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
}

.xtpm-3ds-overlay.xtpm-hidden {
	display: none;
}

.xtpm-3ds-overlay__box {
	background: #fff;
	border-radius: 12px;
	padding: 24px;
	max-width: 500px;
	width: 95%;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
	text-align: center;
}

.xtpm-3ds-overlay__title {
	font-size: 18px;
	font-weight: 700;
	margin: 0 0 8px;
	color: #333;
}

.xtpm-3ds-overlay__subtitle {
	font-size: 14px;
	color: #666;
	margin: 0 0 16px;
}

.xtpm-3ds-iframe {
	width: 100%;
	height: 400px;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
}

@media (max-width: 768px) {
	/* En mobile el modal 3DS ocupa toda la pantalla para maximizar el espacio del iframe,
	   evitando que el botón de continuar/enviar del banco quede fuera de vista. */
	.xtpm-3ds-overlay {
		align-items: stretch;
	}

	.xtpm-3ds-overlay__box {
		padding: 12px;
		width: 100%;
		max-width: 100%;
		height: 100vh;
		height: 100dvh;
		max-height: 100vh;
		max-height: 100dvh;
		border-radius: 0;
		display: flex;
		flex-direction: column;
		box-sizing: border-box;
	}

	.xtpm-3ds-overlay__title {
		font-size: 16px;
		margin: 0 0 4px;
		flex-shrink: 0;
	}

	.xtpm-3ds-overlay__subtitle {
		font-size: 12px;
		margin: 0 0 8px;
		flex-shrink: 0;
	}

	.xtpm-3ds-iframe {
		flex: 1 1 auto;
		height: auto;
		min-height: 0;
		width: 100%;
	}
}
