Files
recreopay/public/index.html
T

442 lines
32 KiB
HTML

<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>RecreoPay - Tu Soda Escolar Digital</title>
<link rel="manifest" href="/manifest.json">
<meta name="theme-color" content="#0284c7">
<link rel="stylesheet" href="/css/styles.css?v=6.0">
<script>
// Purgar y desactivar service workers y cachés obsoletas en móviles
if ('serviceWorker' in navigator) {
navigator.serviceWorker.getRegistrations().then(function(regs) {
for (var r of regs) { r.unregister(); }
});
}
if ('caches' in window) {
caches.keys().then(function(names) {
for (var n of names) { caches.delete(n); }
});
}
</script>
<style>
/* Transiciones suaves */
.fade-enter { animation: fadeIn 0.2s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
</style>
</head>
<body class="">
<div class="app-container">
<!-- BANNER DE ADVERTENCIA HTTPS PARA TELÉFONOS MÓVILES -->
<div id="bannerHttpsWarning" style="display: none; background: linear-gradient(135deg, #f59e0b, #d97706); color: white; padding: 10px 14px; font-size: 0.78rem; font-weight: 700; text-align: center; border-radius: 12px; margin: 10px 16px 0 16px; box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);">
🔒 Estás en HTTP. Para activar la cámara y pagos QR, tu celular requiere HTTPS:
<div style="margin-top: 6px;">
<a id="linkHttpsRedirect" href="https://recreopay.gammapos.app" style="display: inline-block; padding: 5px 14px; background: white; color: #b45309; border-radius: 20px; font-weight: 900; text-decoration: none; font-size: 0.8rem; box-shadow: 0 2px 5px rgba(0,0,0,0.15);">
🚀 Toca aquí para abrir en HTTPS Seguro
</a>
</div>
</div>
<!-- BARRA SUPERIOR UNIFICADA -->
<header class="top-bar">
<a href="#" class="brand-badge">
<div class="logo-icon">🥪</div>
<div>
<span>Recreo<strong>Pay</strong></span>
<span style="font-size: 0.65rem; display: block; color: var(--text-muted); font-weight: 600;">SODA ESCOLAR CR 🇨🇷</span>
</div>
</a>
<!-- ACCIONES DE CABECERA (TEMA OSCURO/CLARO Y SALIR) -->
<div class="top-actions">
<button id="btnThemeToggle" onclick="toggleTheme()" class="theme-toggle-btn" title="Alternar Modo Oscuro / Modo Claro">
🌙
</button>
<button id="btnModePadres" onclick="toggleParentPanel(true)" class="mode-btn" style="background: var(--bg-main); border: 1.5px solid var(--border); font-size: 0.8rem; font-weight: 800; border-radius: 10px; padding: 7px 11px; cursor: pointer; color: var(--text-main);" title="Acceso al Portal de Padres">
👨‍👩‍👦 Padres
</button>
<button id="btnLogout" onclick="logout()" class="logout-btn" title="Cerrar sesión">
<span>🚪</span>
<span class="logout-text">Salir</span>
</button>
</div>
</header>
<!-- SELECTOR OCULTO PARA COMPATIBILIDAD JS -->
<select id="studentSelector" onchange="onStudentChange(this.value)" style="display: none;"></select>
<!-- TARJETA DIGITAL DE MONEDERO Y SALDO (ESTILO UNIFICADO TEENS) -->
<section class="wallet-card">
<div class="student-info">
<img id="walletAvatar" class="student-avatar" src="" alt="Avatar">
<div class="student-meta">
<h2 id="walletName">Cargando...</h2>
<span id="walletGrade" class="student-grade">Grado y Sección</span>
</div>
</div>
<div class="balance-row">
<div class="balance-col">
<div class="label" id="balanceLabel">SALDO DISPONIBLE</div>
<div class="amount">
<span id="walletBalance">₡0</span>
<span class="kids-coin-icon" id="kidsCoinIcon" style="display: none;">🪙</span>
</div>
</div>
<div style="display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end;">
<button class="qr-toggle-btn" onclick="openQrModal()">
<span>📱</span>
<span id="qrBtnText">Mi QR</span>
</button>
<button class="qr-toggle-btn" style="background: rgba(16, 185, 129, 0.25); border-color: rgba(52, 211, 153, 0.4);" onclick="openTransferModal()">
<span>⚡</span>
<span id="transferBtnText">Transferir ⚡</span>
</button>
</div>
</div>
</section>
<!-- BANNER DE LÍMITE DIARIO Y SALUD (TOCABLE PARA EDITAR) -->
<div class="daily-limit-badge" id="dailyLimitBadge" onclick="openDailyLimitEditor()" style="cursor: pointer;" title="Toca aquí para escribir o ajustar el límite diario">
<div>
<span>Límite diario fijado: </span>
<strong id="dailyLimitText">₡0</strong>
<span style="font-size: 0.72rem; color: #0284c7; background: #e0f2fe; padding: 2px 7px; border-radius: 6px; margin-left: 6px; font-weight: 800;">✏️ Cambiar</span>
</div>
<div style="font-size: 0.76rem; color: var(--text-muted);" id="dailyAvailableText">
Disponible hoy: ₡0
</div>
</div>
<!-- ALERGIAS (SI TIENE) -->
<div id="allergyWarning" style="display:none; margin: 0 16px 12px 16px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px; padding: 8px 12px; font-size: 0.8rem; color: #92400e; align-items: center; gap: 6px;">
⚠️ <strong>Atención médica:</strong> <span id="allergyText"></span>
</div>
<!-- BARRA DE CATEGORÍAS -->
<div class="category-scroll" id="categoriesBar">
<!-- Se llena dinámicamente -->
</div>
<!-- TÍTULO DE SECCIÓN Y FILTRO MEP -->
<div class="section-title">
<span id="catalogTitle">Menú del Recreo</span>
<label style="font-size: 0.75rem; font-weight: 600; color: #166534; display: flex; align-items: center; gap: 4px; cursor: pointer;">
<input type="checkbox" id="chkFilterMep" onchange="renderProducts()">
<span>Solo Saludables MEP 🌿</span>
</label>
</div>
<!-- GRILLA DE PRODUCTOS -->
<div class="products-grid" id="productsGrid">
<!-- Se llena con productos de la soda -->
</div>
<!-- BARRA FLOTANTE DE PRE-ORDEN / CARRITO -->
<div class="floating-cart-bar" id="floatingCart" style="display: none;" onclick="openCartModal()">
<div class="cart-summary">
<span class="cart-count-badge" id="cartCountBadge">0</span>
<div class="cart-total-text" id="cartTotalText">₡0</div>
</div>
<button class="cart-action-btn">Pedir para el Recreo 🛒</button>
</div>
<!-- ENLACES DE ACCESO RÁPIDO PARA DEMO Y REVISIÓN -->
<div style="margin: 30px 16px; padding: 14px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 14px; font-size: 0.82rem; text-align: center;">
<p style="font-weight: 700; margin-bottom: 8px; color: var(--text-main);">Acceso Rápido del Sistema:</p>
<div style="display: flex; justify-content: center; gap: 10px; flex-wrap: wrap;">
<a href="/pos.html" target="_blank" style="color: #0284c7; font-weight: 700; text-decoration: none; padding: 4px 10px; background: #e0f2fe; border-radius: 8px;">📟 Terminal Soda (Caja & QR)</a>
<a href="/carnet.html" target="_blank" style="color: #10b981; font-weight: 700; text-decoration: none; padding: 4px 10px; background: #d1fae5; border-radius: 8px;">🖨️ Carnés Físicos para Imprimir</a>
</div>
</div>
</div>
<!-- MODAL: CÓDIGO QR PARA PRESENTAR EN LA SODA -->
<div class="modal-qr-backdrop" id="modalQr" style="display: none;" onclick="closeQrModal(event)">
<div class="modal-qr-card" onclick="event.stopPropagation()">
<h3 style="color: #0f172a; font-size: 1.2rem; font-weight: 800;">Mi Carné QR RecreoPay</h3>
<p style="font-size: 0.8rem; color: #64748b; margin-top: 4px;">Muéstralo en la ventanilla de la soda para pagar al instante</p>
<img id="qrDisplayImg" class="qr-code-img" src="" alt="Código QR">
<div style="background: #f1f5f9; padding: 8px 12px; border-radius: 8px; font-family: monospace; font-size: 0.9rem; font-weight: 800; color: #0284c7;" id="qrTokenDisplay">
CODIGO-QR
</div>
<p style="font-size: 0.75rem; color: #94a3b8; margin-top: 10px;">
💡 Si no tienes tu celular en la escuela, puedes usar tu carné físico impreso con este mismo código.
</p>
<button onclick="closeQrModal()" style="margin-top: 14px; width: 100%; padding: 10px; background: #0f172a; color: white; border: none; border-radius: 12px; font-weight: 700; cursor: pointer;">
Cerrar
</button>
</div>
</div>
<!-- MODAL: CARRITO Y PRE-ORDEN -->
<div class="modal-qr-backdrop" id="modalCart" style="display: none;" onclick="closeCartModal(event)">
<div class="modal-qr-card" onclick="event.stopPropagation()" style="max-width: 420px; text-align: left;">
<div style="display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #e2e8f0; padding-bottom: 10px; margin-bottom: 12px;">
<h3 style="color: #0f172a; font-size: 1.15rem; font-weight: 800;">Mi Pre-Orden Escolar</h3>
<button onclick="closeCartModal()" style="background: none; border: none; font-size: 1.2rem; cursor: pointer; color: #64748b;">✕</button>
</div>
<div style="margin-bottom: 14px;">
<label style="display: block; font-size: 0.8rem; font-weight: 700; color: #334155; margin-bottom: 4px;">
¿Para cuál recreo deseas tu orden?
</label>
<select id="momentoEntregaSelect" style="width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid #cbd5e1; font-weight: 600;">
<option value="recreo_1">🔔 1er Recreo de la Mañana (9:30 AM)</option>
<option value="almuerzo">🍲 Hora de Almuerzo (11:45 AM)</option>
<option value="recreo_2">🍎 2do Recreo de la Tarde (1:45 PM)</option>
</select>
</div>
<!-- LISTA DE PRODUCTOS EN EL CARRITO -->
<div id="cartItemsList" style="max-height: 220px; overflow-y: auto; margin-bottom: 14px;">
<!-- Se llena dinámicamente -->
</div>
<div style="border-top: 1px solid #e2e8f0; padding-top: 10px; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center;">
<span style="font-weight: 800; color: #334155;">Total a Rebajar de Saldo:</span>
<span id="modalCartTotal" style="font-size: 1.3rem; font-weight: 900; color: #0284c7;">₡0</span>
</div>
<button id="btnConfirmarOrden" onclick="submitPreOrder()" style="width: 100%; padding: 12px; background: #10b981; color: white; border: none; border-radius: 12px; font-weight: 800; font-size: 1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;">
<span>✅ Confirmar y Pagar Pre-Orden</span>
</button>
</div>
</div>
<!-- MODAL: PANEL DE PADRES (RECARGA SINPE Y LÍMITES) -->
<div class="modal-qr-backdrop" id="modalPadres" style="display: none;" onclick="toggleParentPanel(false, event)">
<div class="modal-qr-card" onclick="event.stopPropagation()" style="max-width: 440px; text-align: left;">
<div style="display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #e2e8f0; padding-bottom: 10px; margin-bottom: 14px;">
<div>
<h3 style="color: #0f172a; font-size: 1.15rem; font-weight: 800;">Portal de Padres RecreoPay</h3>
<span style="font-size: 0.75rem; color: #64748b;">Control de meriendas, nutrición y recargas SINPE</span>
</div>
<button onclick="toggleParentPanel(false)" style="background: none; border: none; font-size: 1.2rem; cursor: pointer; color: #64748b;">✕</button>
</div>
<!-- RECARGA SINPE MÓVIL (MONTO ESCRITO Y ACCESOS RÁPIDOS) -->
<div style="background: #f0fdf4; border: 1.5px solid #86efac; border-radius: 14px; padding: 14px; margin-bottom: 16px;">
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px;">
<div style="display: flex; align-items: center; gap: 8px;">
<span style="font-size: 1.4rem;">📱</span>
<div>
<strong style="color: #166534; font-size: 0.95rem;">Recarga por SINPE Móvil</strong>
<p style="font-size: 0.74rem; color: #15803d;">Número de la Soda: <strong>8888-SODA (7632)</strong></p>
</div>
</div>
<span style="font-size: 0.7rem; color: #166534; background: #dcfce7; font-weight: 800; padding: 2px 8px; border-radius: 6px;">Acreditación Inmediata</span>
</div>
<label style="display: block; font-size: 0.78rem; font-weight: 800; color: #166534; margin-bottom: 4px;">
Escribe el monto a recargar:
</label>
<div style="position: relative; margin-bottom: 8px;">
<span style="position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-weight: 900; color: #166534; font-size: 1.1rem;">₡</span>
<input type="tel" inputmode="numeric" pattern="[0-9]*" id="inputCustomSinpe" placeholder="Ej: 3000" style="width: 100%; padding: 10px 10px 10px 30px; border-radius: 10px; border: 1.5px solid #86efac; font-size: 1.15rem; font-weight: 900; color: #166534; background: white;">
</div>
<div style="display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px;">
<button type="button" onclick="setWrittenRechargeAmount(1000)" style="padding: 7px 4px; background: white; border: 1px solid #86efac; border-radius: 8px; font-weight: 800; font-size: 0.76rem; color: #166534; cursor: pointer;">₡1.000</button>
<button type="button" onclick="setWrittenRechargeAmount(2000)" style="padding: 7px 4px; background: white; border: 1px solid #86efac; border-radius: 8px; font-weight: 800; font-size: 0.76rem; color: #166534; cursor: pointer;">₡2.000</button>
<button type="button" onclick="setWrittenRechargeAmount(5000)" style="padding: 7px 4px; background: white; border: 1px solid #86efac; border-radius: 8px; font-weight: 800; font-size: 0.76rem; color: #166534; cursor: pointer;">₡5.000</button>
<button type="button" onclick="setWrittenRechargeAmount(10000)" style="padding: 7px 4px; background: white; border: 1px solid #86efac; border-radius: 8px; font-weight: 800; font-size: 0.76rem; color: #166534; cursor: pointer;">₡10.000</button>
</div>
<button type="button" onclick="customSinpeRecharge()" style="width: 100%; padding: 12px; background: linear-gradient(135deg, #16a34a, #15803d); color: white; border: none; border-radius: 10px; font-weight: 900; font-size: 0.95rem; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 4px 10px rgba(22, 163, 74, 0.3);">
<span>📲</span> Aplicar Recarga de Saldo
</button>
</div>
<!-- CONFIGURACIÓN DE LÍMITE DIARIO (ESCRITO Y DESLIZABLE) -->
<div style="background: #f0f9ff; border: 2px solid #38bdf8; border-radius: 14px; padding: 14px; margin-bottom: 16px; box-shadow: 0 2px 8px rgba(56, 189, 248, 0.15);">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;">
<div>
<strong style="font-size: 0.92rem; color: #0369a1; display: block;">🛡️ Límite de Gasto Máximo Diario</strong>
<span style="font-size: 0.74rem; color: #64748b;">Monto máximo que el estudiante puede gastar por día</span>
</div>
<span id="lblParentDailyLimit" style="font-size: 1.05rem; color: #0284c7; font-weight: 900; background: white; border: 1.5px solid #bae6fd; padding: 3px 10px; border-radius: 8px;">₡3.000</span>
</div>
<label for="inputCustomDailyLimit" style="display: block; font-size: 0.8rem; font-weight: 800; color: #0369a1; margin-bottom: 4px;">
✍️ Digita o escribe el límite en colones:
</label>
<div style="display: flex; gap: 8px; margin-bottom: 8px;">
<div style="position: relative; flex: 1;">
<span style="position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-weight: 900; color: #0284c7; font-size: 1.1rem;">₡</span>
<input type="tel" inputmode="numeric" pattern="[0-9]*" id="inputCustomDailyLimit" placeholder="Ej: 3000" oninput="onCustomDailyLimitInput(this.value)" style="width: 100%; padding: 10px 10px 10px 30px; border-radius: 10px; border: 2px solid #0284c7; font-size: 1.1rem; font-weight: 900; color: #0f172a; background: white; box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);">
</div>
<button type="button" onclick="saveCustomDailyLimit()" style="padding: 10px 16px; background: linear-gradient(135deg, #0284c7, #0369a1); color: white; border: none; border-radius: 10px; font-weight: 900; font-size: 0.85rem; cursor: pointer; white-space: nowrap; box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);">
💾 Guardar
</button>
</div>
<div id="msgDailyLimitFeedback" style="display: none; font-size: 0.76rem; font-weight: 800; margin-bottom: 8px; padding: 4px 8px; border-radius: 6px; background: #dcfce7; color: #166534; text-align: center;"></div>
<!-- ACCESOS RÁPIDOS DE LÍMITES COMUNES -->
<div style="display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-bottom: 10px;">
<button type="button" onclick="setWrittenDailyLimit(1500)" style="padding: 6px 2px; background: white; border: 1.5px solid #cbd5e1; border-radius: 8px; font-size: 0.74rem; font-weight: 800; color: #1e293b; cursor: pointer;">₡1.500</button>
<button type="button" onclick="setWrittenDailyLimit(2500)" style="padding: 6px 2px; background: white; border: 1.5px solid #cbd5e1; border-radius: 8px; font-size: 0.74rem; font-weight: 800; color: #1e293b; cursor: pointer;">₡2.500</button>
<button type="button" onclick="setWrittenDailyLimit(3500)" style="padding: 6px 2px; background: white; border: 1.5px solid #cbd5e1; border-radius: 8px; font-size: 0.74rem; font-weight: 800; color: #1e293b; cursor: pointer;">₡3.500</button>
<button type="button" onclick="setWrittenDailyLimit(5000)" style="padding: 6px 2px; background: white; border: 1.5px solid #cbd5e1; border-radius: 8px; font-size: 0.74rem; font-weight: 800; color: #1e293b; cursor: pointer;">₡5.000</button>
</div>
<div style="font-size: 0.72rem; color: #64748b; margin-bottom: 2px;">O desliza para ajustar rápido:</div>
<input type="range" id="rangeDailyLimit" min="1000" max="10000" step="500" value="3000" oninput="onDailyLimitSlider(this.value)" style="width: 100%;">
<div style="display: flex; justify-content: space-between; font-size: 0.7rem; color: #64748b; margin-top: 2px;">
<span>₡1.000 min</span>
<span>₡10.000 max</span>
</div>
</div>
<!-- CONTROL PARENTAL: PERMITIR O BLOQUEAR TRANSFERENCIAS ENTRE COMPAÑEROS -->
<div style="background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center;">
<div>
<strong style="font-size: 0.85rem; color: #1e293b; display: block;">🤝 RecreoTransfer entre Compas</strong>
<span style="font-size: 0.72rem; color: #64748b;">Permitir transferir saldo a compañeros de clase</span>
</div>
<input type="checkbox" id="chkParentAllowTransfer" onchange="onToggleAllowTransfer(this.checked)" style="width: 22px; height: 22px; cursor: pointer; accent-color: #0284c7;" checked>
</div>
<!-- HISTORIAL RECIENTE -->
<h4 style="font-size: 0.85rem; font-weight: 800; color: #1e293b; margin-bottom: 8px;">Consumos Recientes</h4>
<div id="parentHistoryList" style="max-height: 140px; overflow-y: auto; font-size: 0.78rem;">
<!-- Se llena dinámicamente -->
</div>
</div>
</div>
<!-- MODAL: RECREOTRANSFER (PASAR PLATA A UN COMPAÑERO ESCANEANDO SU QR O CARNÉ) -->
<div class="modal-qr-backdrop" id="modalTransfer" style="display: none;" onclick="closeTransferModal(event)">
<div class="modal-qr-card" onclick="event.stopPropagation()" style="max-width: 420px; text-align: left;">
<div style="display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #e2e8f0; padding-bottom: 10px; margin-bottom: 12px;">
<div>
<h3 style="color: #0f172a; font-size: 1.15rem; font-weight: 800;">🤝 Pasar Plata a un Compa</h3>
<span style="font-size: 0.75rem; color: #64748b;">Escanea el carné o celular de tu amigo</span>
</div>
<button onclick="closeTransferModal()" style="background: none; border: none; font-size: 1.2rem; cursor: pointer; color: #64748b;">✕</button>
</div>
<!-- PASO 1: ESCANEAR CÁMARA O ELEGIR COMPAÑERO DE PRUEBA -->
<div id="transferStepScan">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px;">
<span style="font-size: 0.75rem; color: #64748b; font-weight: 700;" id="transferCameraStatus">Iniciando cámara...</span>
<div style="display: flex; gap: 6px;">
<button id="btnFlipTransferCamera" type="button" onclick="flipTransferCamera()" style="display:none; padding: 3px 8px; background: #334155; color: white; border: none; border-radius: 6px; font-size: 0.72rem; font-weight: 700; cursor: pointer;">🔄 Girar</button>
<button id="btnRetryTransferCamera" type="button" onclick="startTransferCamera(true)" style="display:none; padding: 3px 8px; background: #0284c7; color: white; border: none; border-radius: 6px; font-size: 0.72rem; font-weight: 700; cursor: pointer;">📷 Activar</button>
</div>
</div>
<div style="position: relative; border-radius: 12px; overflow: hidden; background: #000; min-height: 170px; margin-bottom: 10px; display: flex; align-items: center; justify-content: center;">
<video id="transferVideo" style="width: 100%; height: 170px; object-fit: cover;" autoplay playsinline webkit-playsinline muted></video>
<div class="laser-scan-line"></div>
<div id="transferCameraHelp" style="display: none; position: absolute; inset: 0; background: rgba(15, 23, 42, 0.92); padding: 14px; text-align: center; flex-direction: column; justify-content: center; align-items: center; gap: 10px; z-index: 10;">
<span style="font-size: 1.8rem;">📷</span>
<div id="transferCameraHelpText" style="font-size: 0.76rem; color: #f8fafc; line-height: 1.35;">Toca el botón para permitir la cámara</div>
<div id="transferCameraActionContainer" style="display: flex; flex-direction: column; gap: 8px; width: 100%; align-items: center;">
<button id="btnAllowTransferCamera" type="button" onclick="startTransferCamera(true)" style="padding: 8px 18px; background: #0284c7; color: white; border: none; border-radius: 8px; font-weight: 800; font-size: 0.82rem; cursor: pointer; box-shadow: 0 4px 10px rgba(2, 132, 199, 0.3);">
Permitir Cámara
</button>
</div>
</div>
</div>
<!-- ACCESO DIRECTO PARA SUBIR O TOMAR FOTO DEL QR CON LA CÁMARA NATIVA -->
<div style="display: flex; justify-content: center; margin-bottom: 12px;">
<label style="cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; background: #f0fdf4; border: 1.5px dashed #86efac; border-radius: 10px; font-size: 0.78rem; font-weight: 800; color: #166534; box-shadow: 0 1px 3px rgba(0,0,0,0.04);">
<span>📸</span> Tomar foto del QR o carné
<input type="file" accept="image/*" capture="environment" style="display: none;" onchange="handleTransferQrPhoto(event)">
</label>
</div>
<div style="text-align: center; margin-bottom: 12px;">
<span style="font-size: 0.74rem; color: #64748b; font-weight: 700;">O selecciona a un compañero para transferirle:</span>
<div id="quickTransferFriends" style="display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 8px;">
<!-- Se llena dinámicamente con los otros estudiantes -->
</div>
</div>
</div>
<!-- PASO 2: CONFIRMAR COMPAÑERO Y MONTO -->
<div id="transferStepConfirm" style="display: none;">
<!-- Tarjeta del receptor -->
<div style="background: #f0fdf4; border: 1.5px solid #86efac; border-radius: 14px; padding: 12px; display: flex; align-items: center; gap: 12px; margin-bottom: 14px;">
<img id="transferTargetAvatar" src="" style="width: 48px; height: 48px; border-radius: 50%; border: 2px solid #10b981; background: white;">
<div style="flex: 1;">
<div style="font-size: 0.7rem; color: #15803d; font-weight: 800; text-transform: uppercase;">Vas a transferir a:</div>
<h4 id="transferTargetName" style="font-size: 1rem; font-weight: 900; color: #0f172a; line-height: 1.2;">Nombre</h4>
<span id="transferTargetGrade" style="font-size: 0.75rem; color: #64748b;">Grado y Sección</span>
</div>
<button onclick="resetTransferScan()" style="background: #e2e8f0; border: none; padding: 4px 8px; border-radius: 6px; font-size: 0.75rem; font-weight: 700; cursor: pointer;">Cambiar</button>
</div>
<!-- MONTO A PASAR -->
<label style="display: block; font-size: 0.82rem; font-weight: 800; color: #1e293b; margin-bottom: 6px;">
¿Cuánto le vas a pasar?
</label>
<div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px;">
<button type="button" class="mode-btn active" id="btnTransfer500" onclick="setTransferAmount(500, this)" style="padding: 8px; text-align: center; justify-content: center; font-size: 0.85rem;">₡500</button>
<button type="button" class="mode-btn" id="btnTransfer1000" onclick="setTransferAmount(1000, this)" style="padding: 8px; text-align: center; justify-content: center; font-size: 0.85rem;">₡1.000</button>
<button type="button" class="mode-btn" id="btnTransfer1500" onclick="setTransferAmount(1500, this)" style="padding: 8px; text-align: center; justify-content: center; font-size: 0.85rem;">₡1.500</button>
</div>
<div style="margin-bottom: 12px;">
<input type="tel" inputmode="numeric" pattern="[0-9]*" id="inputTransferCustomAmount" placeholder="Otro monto (ej. 750)" style="width: 100%; padding: 10px; border-radius: 10px; border: 1px solid #cbd5e1; font-size: 1rem; font-weight: 800; color: #0284c7;">
</div>
<!-- MOTIVO OPCIONAL -->
<div style="margin-bottom: 12px;">
<label style="display: block; font-size: 0.75rem; font-weight: 700; color: #64748b; margin-bottom: 4px;">Motivo (Opcional):</label>
<input type="text" id="inputTransferMotivo" placeholder="Ej: Mitad de la empanada, fresco..." style="width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid #cbd5e1; font-size: 0.85rem;">
</div>
<!-- PIN DE SEGURIDAD (CON PANEL EXCLUSIVO DE NÚMEROS Y BOTONES TÁCTILES) -->
<div style="background: #f8fafc; border: 1.5px dashed #cbd5e1; border-radius: 12px; padding: 12px; margin-bottom: 14px;">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px;">
<label style="font-size: 0.78rem; font-weight: 800; color: #0f172a;">🔐 Digita tu PIN de 4 dígitos:</label>
<span id="lblTransferPinHint" style="font-size: 0.72rem; color: #166534; font-weight: 800; background: #dcfce7; padding: 2px 8px; border-radius: 6px;">(PIN: 1234)</span>
</div>
<div style="position: relative; margin-bottom: 8px;">
<input type="password" inputmode="numeric" pattern="[0-9]*" maxlength="4" autocomplete="one-time-code" id="inputTransferPin" placeholder="••••" style="width: 100%; text-align: center; font-size: 1.5rem; letter-spacing: 8px; padding: 10px 40px 10px 10px; border-radius: 10px; border: 2px solid #cbd5e1; font-weight: 900; background: white; color: #0f172a;">
<button type="button" id="btnTogglePin" onclick="togglePinVisibility()" style="position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; font-size: 1.15rem; cursor: pointer; color: #64748b; padding: 4px;" title="Ver/Ocultar PIN">👁️</button>
</div>
<!-- TECLADO NUMÉRICO TÁCTIL EN PANTALLA (FACILITA A LOS NIÑOS Y USUARIOS MÓVILES) -->
<div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;">
<button type="button" onclick="appendPinDigit('1')" style="padding: 10px; background: white; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 1.15rem; font-weight: 800; color: #1e293b; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,0.05);">1</button>
<button type="button" onclick="appendPinDigit('2')" style="padding: 10px; background: white; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 1.15rem; font-weight: 800; color: #1e293b; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,0.05);">2</button>
<button type="button" onclick="appendPinDigit('3')" style="padding: 10px; background: white; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 1.15rem; font-weight: 800; color: #1e293b; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,0.05);">3</button>
<button type="button" onclick="appendPinDigit('4')" style="padding: 10px; background: white; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 1.15rem; font-weight: 800; color: #1e293b; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,0.05);">4</button>
<button type="button" onclick="appendPinDigit('5')" style="padding: 10px; background: white; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 1.15rem; font-weight: 800; color: #1e293b; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,0.05);">5</button>
<button type="button" onclick="appendPinDigit('6')" style="padding: 10px; background: white; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 1.15rem; font-weight: 800; color: #1e293b; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,0.05);">6</button>
<button type="button" onclick="appendPinDigit('7')" style="padding: 10px; background: white; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 1.15rem; font-weight: 800; color: #1e293b; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,0.05);">7</button>
<button type="button" onclick="appendPinDigit('8')" style="padding: 10px; background: white; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 1.15rem; font-weight: 800; color: #1e293b; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,0.05);">8</button>
<button type="button" onclick="appendPinDigit('9')" style="padding: 10px; background: white; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 1.15rem; font-weight: 800; color: #1e293b; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,0.05);">9</button>
<button type="button" onclick="fillQuickPin('1234')" style="padding: 10px; background: #e0f2fe; color: #0284c7; border: 1px solid #bae6fd; border-radius: 8px; font-size: 0.74rem; font-weight: 900; cursor: pointer;">⚡ 1234</button>
<button type="button" onclick="appendPinDigit('0')" style="padding: 10px; background: white; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 1.15rem; font-weight: 800; color: #1e293b; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,0.05);">0</button>
<button type="button" onclick="backspacePinDigit()" style="padding: 10px; background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; border-radius: 8px; font-size: 1.15rem; font-weight: 800; cursor: pointer;">⌫</button>
</div>
</div>
<button id="btnConfirmTransfer" onclick="executeP2PTransfer()" style="width: 100%; padding: 14px; background: linear-gradient(135deg, #10b981, #059669); color: white; border: none; border-radius: 14px; font-weight: 900; font-size: 1.05rem; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);">
<span>💸</span> Enviar Dinero al Instante
</button>
</div>
</div>
</div>
<script src="/js/sounds.js?v=6.0"></script>
<script src="/js/jsQR.js"></script>
<script src="/js/app.js?v=6.0"></script>
</body>
</html>