/**
 * Wolk Latam Payment — Datáfono POS styles.
 * @package WolkLatamPayment
 * @since   1.4.0
 */

/* ── Reset cuando estamos en standalone ────────────────────────────────── */
body.wlp-datafono-standalone {
	margin: 0;
	padding: 0;
	background: linear-gradient(135deg, var(--wlp-pos-primary-50, #f0f7f5) 0%, var(--wlp-pos-primary-100, #e2efeb) 100%);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
	min-height: 100vh;
	color: #1f2937;
	-webkit-font-smoothing: antialiased;
}

body.wlp-datafono-standalone .wlp-datafono-main {
	display: flex;
	align-items: flex-start;
	justify-content: center;
	min-height: 100vh;
	padding: 16px;
	box-sizing: border-box;
}

/* ── Container principal ───────────────────────────────────────────────── */
.wlp-pos {
	width: 100%;
	max-width: 420px;
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 8px 32px rgba(91, 33, 182, 0.12);
	padding: 24px;
	box-sizing: border-box;
}

.wlp-pos *,
.wlp-pos *::before,
.wlp-pos *::after {
	box-sizing: border-box;
}

/* ── Header ────────────────────────────────────────────────────────────── */
.wlp-pos-header {
	text-align: center;
	margin-bottom: 20px;
}

.wlp-pos-title {
	margin: 0 0 4px;
	font-size: 22px;
	font-weight: 700;
	color: var(--wlp-pos-primary-dark, #0a4a3c);
	letter-spacing: -0.02em;
}

.wlp-pos-subtitle {
	margin: 0;
	font-size: 13px;
	color: #6b7280;
}

/* ── Display del monto ─────────────────────────────────────────────────── */
.wlp-pos-amount-display {
	display: flex;
	align-items: baseline;
	justify-content: center;
	gap: 6px;
	padding: 20px 12px;
	margin-bottom: 16px;
	background: #faf5ff;
	border: 2px solid #e9d5ff;
	border-radius: 12px;
	min-height: 80px;
}

.wlp-pos-currency {
	font-size: 24px;
	font-weight: 600;
	color: var(--wlp-pos-primary, #0e5e4d);
}

.wlp-pos-amount-value {
	font-size: 40px;
	font-weight: 700;
	color: #1f2937;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
	line-height: 1;
}

/* ── Teclado POS ───────────────────────────────────────────────────────── */
.wlp-pos-keypad {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 8px;
	margin-bottom: 20px;
}

.wlp-pos-key {
	-webkit-appearance: none;
	appearance: none;
	background: #f9fafb;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	font-size: 22px;
	font-weight: 600;
	color: #1f2937;
	min-height: 64px;
	cursor: pointer;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
	transition: transform 0.05s ease, background 0.1s ease;
	font-family: inherit;
}

.wlp-pos-key:hover {
	background: #f3f4f6;
}

.wlp-pos-key:active {
	transform: scale(0.95);
	background: var(--wlp-pos-primary-100, #e2efeb);
	border-color: var(--wlp-pos-primary-200, #bcd8d0);
}

.wlp-pos-key-clear {
	color: #dc2626;
}

.wlp-pos-key-back {
	color: #6b7280;
}

/* ── Campos del form ───────────────────────────────────────────────────── */
.wlp-pos-fields {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-bottom: 20px;
}

.wlp-pos-field {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.wlp-pos-field-label {
	font-size: 12px;
	font-weight: 600;
	color: #6b7280;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.wlp-pos-field input[type="text"],
.wlp-pos-field input[type="tel"],
.wlp-pos-field select {
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
	padding: 12px 14px;
	border: 1px solid #d1d5db;
	border-radius: 10px;
	font-size: 16px; /* 16px previene zoom en iOS */
	font-family: inherit;
	background: #fff;
	color: #1f2937;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.wlp-pos-field input:focus,
.wlp-pos-field select:focus {
	outline: none;
	border-color: var(--wlp-pos-primary, #0e5e4d);
	box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.wlp-pos-field select {
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%236b7280' d='M6 8L0 0h12z'/></svg>");
	background-repeat: no-repeat;
	background-position: right 14px center;
	padding-right: 36px;
}

/* ── Phone field (country + number) ────────────────────────────────────── */
.wlp-pos-phone {
	display: flex;
	gap: 6px;
	align-items: stretch;
	border: 1px solid #d1d5db;
	border-radius: 10px;
	padding: 0 8px 0 12px;
	background: #fff;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.wlp-pos-phone:focus-within {
	border-color: var(--wlp-pos-primary, #0e5e4d);
	box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.wlp-pos-plus {
	display: flex;
	align-items: center;
	color: #6b7280;
	font-size: 16px;
	font-weight: 600;
}

.wlp-pos-phone input {
	border: none !important;
	box-shadow: none !important;
	padding: 12px 4px !important;
	background: transparent !important;
	font-size: 16px;
}

.wlp-pos-phone input#wlp-pos-country {
	width: 60px;
	flex-shrink: 0;
}

.wlp-pos-phone input#wlp-pos-number {
	flex: 1;
	min-width: 0;
}

/* ── Botón submit ──────────────────────────────────────────────────────── */
.wlp-pos-submit {
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
	padding: 16px 20px;
	background: linear-gradient(135deg, var(--wlp-pos-primary, #0e5e4d) 0%, var(--wlp-pos-primary-dark, #0a4a3c) 100%);
	color: #fff;
	border: none;
	border-radius: 12px;
	font-size: 17px;
	font-weight: 700;
	cursor: pointer;
	font-family: inherit;
	letter-spacing: 0.01em;
	box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
	transition: transform 0.08s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.wlp-pos-submit:hover:not(:disabled) {
	box-shadow: 0 6px 18px rgba(124, 58, 237, 0.4);
}

.wlp-pos-submit:active:not(:disabled) {
	transform: scale(0.98);
}

.wlp-pos-submit:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* ── Error inline ──────────────────────────────────────────────────────── */
.wlp-pos-error {
	margin-top: 12px;
	padding: 12px 14px;
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: 8px;
	color: #991b1b;
	font-size: 14px;
	line-height: 1.4;
}

.wlp-pos-error-block,
.wlp-pos-locked {
	max-width: 420px;
	margin: 40px auto;
	padding: 20px;
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: 8px;
	color: #991b1b;
	text-align: center;
}

/* ── Result panel ──────────────────────────────────────────────────────── */
.wlp-pos-result {
	text-align: center;
	padding: 8px 0;
}

.wlp-pos-success-icon {
	width: 64px;
	height: 64px;
	margin: 0 auto 16px;
	background: linear-gradient(135deg, #10b981 0%, #059669 100%);
	color: #fff;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 36px;
	font-weight: 700;
	box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.wlp-pos-result-title {
	margin: 0 0 4px;
	font-size: 22px;
	font-weight: 700;
	color: #1f2937;
}

.wlp-pos-result-amount {
	margin: 0 0 20px;
	font-size: 17px;
	color: #6b7280;
	font-weight: 600;
}

.wlp-pos-result-link {
	width: 100%;
	padding: 12px 14px;
	border: 1px solid #d1d5db;
	border-radius: 10px;
	font-size: 13px;
	color: #4b5563;
	background: #f9fafb;
	font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
	margin-bottom: 16px;
}

.wlp-pos-result-link:focus {
	outline: none;
	border-color: var(--wlp-pos-primary, #0e5e4d);
}

.wlp-pos-result-actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-bottom: 16px;
}

.wlp-pos-btn-primary,
.wlp-pos-btn-secondary {
	-webkit-appearance: none;
	appearance: none;
	padding: 14px 18px;
	border-radius: 10px;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	font-family: inherit;
	border: none;
	transition: transform 0.08s ease, opacity 0.15s ease;
}

.wlp-pos-btn-primary {
	background: #25d366; /* WhatsApp green */
	color: #fff;
	box-shadow: 0 3px 10px rgba(37, 211, 102, 0.3);
}

.wlp-pos-btn-secondary {
	background: #f3f4f6;
	color: #1f2937;
	border: 1px solid #e5e7eb;
}

.wlp-pos-btn-primary:active,
.wlp-pos-btn-secondary:active {
	transform: scale(0.97);
}

.wlp-pos-btn-link {
	-webkit-appearance: none;
	appearance: none;
	background: transparent;
	border: none;
	color: var(--wlp-pos-primary, #0e5e4d);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	padding: 8px 12px;
	font-family: inherit;
}

.wlp-pos-btn-link:hover {
	text-decoration: underline;
}

/* ── Toast ─────────────────────────────────────────────────────────────── */
.wlp-pos-toast {
	position: fixed;
	bottom: 24px;
	left: 50%;
	transform: translateX(-50%) translateY(20px);
	background: #1f2937;
	color: #fff;
	padding: 12px 20px;
	border-radius: 10px;
	font-size: 14px;
	font-weight: 600;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
	opacity: 0;
	transition: opacity 0.2s ease, transform 0.2s ease;
	z-index: 9999;
	pointer-events: none;
}

.wlp-pos-toast.is-visible {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

/* ── Mobile tweaks ─────────────────────────────────────────────────────── */
@media (max-width: 380px) {
	.wlp-pos {
		padding: 18px;
	}
	.wlp-pos-amount-value {
		font-size: 34px;
	}
	.wlp-pos-key {
		min-height: 56px;
		font-size: 20px;
	}
}

/* ── Embedded mode (cuando los toggles header/footer están en on) ───────
   El plugin queda embebido en el tema; aplicamos un margin razonable. */
body:not(.wlp-datafono-standalone) .wlp-pos {
	margin: 24px auto;
}

/* ─────────────────────────────────────────────────────────────────────────
   v1.4.2 — Modal QR
   ───────────────────────────────────────────────────────────────────────── */

body.wlp-pos-modal-open {
	overflow: hidden;
}

.wlp-pos-qr-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.wlp-pos-qr-modal[hidden] {
	display: none;
}

.wlp-pos-qr-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.85);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	cursor: pointer;
	animation: wlp-qr-fade-in 0.2s ease-out;
}

.wlp-pos-qr-modal-content {
	position: relative;
	background: #ffffff;
	border-radius: 16px;
	padding: 32px 28px;
	max-width: 360px;
	width: 100%;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
	text-align: center;
	animation: wlp-qr-pop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes wlp-qr-fade-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes wlp-qr-pop {
	from { opacity: 0; transform: scale(0.92) translateY(8px); }
	to   { opacity: 1; transform: scale(1) translateY(0); }
}

.wlp-pos-qr-close {
	position: absolute;
	top: 8px;
	right: 12px;
	background: transparent;
	border: 0;
	font-size: 32px;
	line-height: 1;
	color: #94a3b8;
	cursor: pointer;
	padding: 6px 10px;
	border-radius: 6px;
	transition: background 0.15s, color 0.15s;
}

.wlp-pos-qr-close:hover,
.wlp-pos-qr-close:focus {
	background: #f1f5f9;
	color: #1f2937;
	outline: none;
}

.wlp-pos-qr-title {
	margin: 0 0 4px;
	font-size: 20px;
	font-weight: 700;
	color: #1f2937;
}

.wlp-pos-qr-subtitle {
	margin: 0 0 20px;
	font-size: 14px;
	color: #64748b;
}

.wlp-pos-qr-canvas {
	display: inline-block;
	margin: 0 auto 18px;
	padding: 14px;
	background: #ffffff;
	border: 2px solid #e2e8f0;
	border-radius: 12px;
}

/* La lib qrcodejs renderiza un <canvas> y un <img> — ocultamos el canvas y
   mostramos solo el img (mejor calidad de scan) o viceversa. */
.wlp-pos-qr-canvas img {
	display: block;
	width: 260px;
	height: 260px;
	margin: 0 auto;
}

.wlp-pos-qr-canvas canvas {
	display: none;
}

.wlp-pos-qr-amount {
	margin: 0;
	font-size: 22px;
	font-weight: 700;
	color: var(--wlp-pos-primary, #0e5e4d);
	letter-spacing: 0.3px;
}

@media (max-width: 380px) {
	.wlp-pos-qr-modal-content {
		padding: 24px 20px;
	}
	.wlp-pos-qr-canvas img {
		width: 220px;
		height: 220px;
	}
}

/* ── v1.9.22 — Panel modo SUSCRIPCIÓN en el POS ───────────────────────── */
.wlp-pos-subs {
	margin-top: 10px;
	padding: 12px 14px;
	background: var(--wlp-pos-primary-50, #f0f7f5);
	border: 1px solid var(--wlp-pos-primary-200, #bcd8d0);
	border-radius: 12px;
}
.wlp-pos-subs-badge {
	display: inline-block;
	font-size: 13px;
	font-weight: 700;
	color: var(--wlp-pos-primary-dark, #0a4a3c);
	background: var(--wlp-pos-primary-100, #e2efeb);
	border-radius: 999px;
	padding: 4px 12px;
	margin-bottom: 8px;
}
.wlp-pos-subs-hint {
	margin: 0 0 10px;
	font-size: 12.5px;
	line-height: 1.5;
	color: #4b5563;
}
.wlp-pos-subs-hint strong { color: var(--wlp-pos-primary-dark, #0a4a3c); }
