Compare commits

...
7 Commits
14 changed files with 3867 additions and 104 deletions
+13 -3
View File
@@ -16,6 +16,7 @@
"imap-simple": "^5.1.0",
"jsqr": "^1.4.0",
"mailparser": "^3.9.36",
"nodemailer": "^10.1.0",
"pg": "^8.23.1",
"puppeteer-core": "^25.12.0",
"qrcode": "^1.5.4",
@@ -1391,6 +1392,15 @@
"node": ">=20.0.0"
}
},
"node_modules/mailparser/node_modules/nodemailer": {
"version": "10.0.14",
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-10.0.14.tgz",
"integrity": "sha512-eJoLFKg55fesSlzUekmfOv/SBXh4KUYT8oiQc2RLP0tfG0rbNMJBK7wgHJwXTJwqyKlSJMz9UzDZ4v+aHEvo8g==",
"license": "MIT-0",
"engines": {
"node": ">=20.0.0"
}
},
"node_modules/math-intrinsics": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
@@ -1541,9 +1551,9 @@
"license": "MIT"
},
"node_modules/nodemailer": {
"version": "10.0.14",
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-10.0.14.tgz",
"integrity": "sha512-eJoLFKg55fesSlzUekmfOv/SBXh4KUYT8oiQc2RLP0tfG0rbNMJBK7wgHJwXTJwqyKlSJMz9UzDZ4v+aHEvo8g==",
"version": "10.1.0",
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-10.1.0.tgz",
"integrity": "sha512-fXW8AulB25aOTuwfRYV6lqHyfz2VM4rr4SGXH03mE7x5znEUpzL5mu6anARUpZN7744Ziwkmr4AxSLPJsBQspg==",
"license": "MIT-0",
"engines": {
"node": ">=20.0.0"
+1
View File
@@ -28,6 +28,7 @@
"imap-simple": "^5.1.0",
"jsqr": "^1.4.0",
"mailparser": "^3.9.36",
"nodemailer": "^10.1.0",
"pg": "^8.23.1",
"puppeteer-core": "^25.12.0",
"qrcode": "^1.5.4",
+878
View File
@@ -0,0 +1,878 @@
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Structured Flow — App de Agenda y Recordatorios Visuales</title>
<script src="https://www.gstatic.com/antigravity/web/dev/tailwindcss.min.js"></script>
<style>
* {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.no-scrollbar::-webkit-scrollbar {
display: none;
}
.no-scrollbar {
-ms-overflow-style: none;
scrollbar-width: none;
}
.theme-transition {
transition: background-color 0.5s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s ease;
}
/* Cápsula móvil estilo Structured */
.structured-pill {
border-radius: 32px;
box-shadow: 0 10px 25px -4px rgba(0, 0, 0, 0.07), inset 0 1.5px 1px rgba(255, 255, 255, 0.85);
transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}
.structured-pill:hover {
transform: translateY(-2px);
box-shadow: 0 14px 30px -4px rgba(0, 0, 0, 0.1), inset 0 1.5px 1px rgba(255, 255, 255, 0.95);
}
.structured-pill:active {
transform: scale(0.98);
}
/* Tarea del Timeline */
.timeline-task {
border-radius: 26px;
box-shadow: 0 6px 20px -3px rgba(0, 0, 0, 0.05), inset 0 1px 1px rgba(255, 255, 255, 0.8);
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.timeline-task.completed {
opacity: 0.65;
filter: saturate(0.7);
}
.timeline-task.completed .task-title {
text-decoration: line-through;
}
/* Conector puzzle */
.puzzle-joint {
width: 26px;
height: 22px;
position: relative;
flex-shrink: 0;
z-index: 10;
display: flex;
align-items: center;
justify-content: center;
}
/* Marco del teléfono */
.iphone-frame {
box-shadow:
0 0 0 12px #0f172a,
0 0 0 14px #334155,
0 25px 60px -15px rgba(0, 0, 0, 0.35);
}
/* Animación de check */
@keyframes check-pop {
0% { transform: scale(0.7); }
50% { transform: scale(1.2); }
100% { transform: scale(1); }
}
.animate-pop {
animation: check-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
</style>
</head>
<body id="pageBody" class="theme-transition min-h-screen bg-[#e8f4fc] text-slate-800 p-3 sm:p-6 md:p-8 flex flex-col items-center justify-start font-sans">
<!-- TOP BAR DEL PROTOTIPO -->
<header class="w-full max-w-5xl mx-auto mb-6 flex flex-col md:flex-row items-center justify-between gap-4 bg-white/70 backdrop-blur-xl p-4 md:px-6 rounded-3xl border border-white/80 shadow-xs">
<div class="flex items-center gap-3">
<div class="w-10 h-10 rounded-2xl bg-gradient-to-tr from-sky-600 via-cyan-500 to-emerald-400 flex items-center justify-center text-white font-extrabold text-xl shadow-md">
⚡
</div>
<div>
<div class="flex items-center gap-2">
<span class="text-xl font-black tracking-tight text-slate-900">flow</span>
<span class="text-[11px] font-bold uppercase tracking-wider px-2.5 py-0.5 rounded-full bg-sky-100 text-sky-800 border border-sky-200">
Agenda & Recordatorios • Estilo Structured
</span>
</div>
<p class="text-xs text-slate-500 font-medium">Timeline visual de tareas y carrusel de rutinas en colores pastel</p>
</div>
</div>
<!-- SELECTOR DE COLOR PASTEL Y VISTA -->
<div class="flex flex-wrap items-center gap-2">
<!-- Selector de fondo de la app -->
<div class="flex items-center gap-1.5 bg-white/90 p-1.5 rounded-2xl border border-slate-200 shadow-xs">
<span class="text-[11px] font-semibold text-slate-500 pl-1.5">Fondo:</span>
<button onclick="changeTheme('#e0f2fe', '#e8f4fc', 'Cielo Pastel')" title="Cielo Pastel" class="w-6 h-6 rounded-full bg-[#e0f2fe] border-2 border-sky-400 hover:scale-110 transition-transform cursor-pointer"></button>
<button onclick="changeTheme('#d1fae5', '#e6f8f0', 'Menta Fresca')" title="Menta Fresca" class="w-6 h-6 rounded-full bg-[#d1fae5] border-2 border-emerald-400 hover:scale-110 transition-transform cursor-pointer"></button>
<button onclick="changeTheme('#ffedd5', '#fef3e7', 'Melocotón')" title="Melocotón" class="w-6 h-6 rounded-full bg-[#ffedd5] border-2 border-orange-400 hover:scale-110 transition-transform cursor-pointer"></button>
<button onclick="changeTheme('#f3e8ff', '#f7f0fe', 'Lavanda')" title="Lavanda" class="w-6 h-6 rounded-full bg-[#f3e8ff] border-2 border-purple-400 hover:scale-110 transition-transform cursor-pointer"></button>
<button onclick="changeTheme('#fef9c3', '#fefde8', 'Vainilla')" title="Vainilla" class="w-6 h-6 rounded-full bg-[#fef9c3] border-2 border-amber-400 hover:scale-110 transition-transform cursor-pointer"></button>
<button onclick="changeTheme('#ffffff', '#f1f5f9', 'Nieve')" title="Blanco Puro" class="w-6 h-6 rounded-full bg-white border-2 border-slate-300 hover:scale-110 transition-transform cursor-pointer"></button>
</div>
<!-- Botón Nueva Tarea en el simulador -->
<button onclick="openNewTaskModal()" class="px-4 py-2 rounded-2xl bg-slate-900 hover:bg-sky-600 text-white text-xs font-bold shadow-sm transition-all flex items-center gap-1.5 cursor-pointer active:scale-95">
<span>+ Nueva Tarea</span>
</button>
</div>
</header>
<!-- CONTENEDOR PRINCIPAL -->
<main class="w-full max-w-5xl flex flex-col lg:flex-row items-center justify-center gap-8 lg:gap-12">
<!-- FRAME DEL CELULAR CON LA APP (IPHONE 16 PRO) -->
<div id="phoneShell" class="iphone-frame relative w-[390px] h-[812px] bg-slate-950 rounded-[52px] p-3 flex flex-col shrink-0 select-none overflow-hidden transition-all duration-500">
<!-- PANTALLA INTERNA DEL SMARTPHONE -->
<div id="appViewport" class="theme-transition relative w-full h-full bg-[#e0f2fe] rounded-[42px] overflow-hidden flex flex-col justify-between">
<!-- STATUS BAR & DYNAMIC ISLAND -->
<div class="relative pt-3 pb-1 px-7 flex items-center justify-between z-40 text-slate-800 font-semibold text-xs tracking-tight">
<span>9:41</span>
<!-- DYNAMIC ISLAND CON NOTIFICACIÓN DE PRÓXIMA TAREA -->
<div onclick="showAppToast('Próxima: Enfoque Profundo a las 10:00 AM')" class="w-28 h-7 bg-black rounded-full flex items-center justify-between px-2.5 shadow-inner cursor-pointer active:scale-95 transition-transform">
<div class="w-2.5 h-2.5 rounded-full bg-emerald-400 animate-pulse"></div>
<span class="text-[10px] text-white/90 font-medium tracking-wide">flow app</span>
<div class="w-2.5 h-2.5 rounded-full bg-sky-400"></div>
</div>
<div class="flex items-center gap-1.5 text-slate-800">
<svg class="w-3.5 h-3.5" viewBox="0 0 24 24" fill="currentColor"><path d="M12 3c-4.97 0-9 4.03-9 9 0 2.12.74 4.07 1.97 5.61L12 22l7.03-4.39C20.26 16.07 21 14.12 21 12c0-4.97-4.03-9-9-9z"/></svg>
<div class="w-5 h-2.5 border border-slate-700 rounded-sm p-0.5 flex items-center">
<div class="w-full h-full bg-slate-800 rounded-2xs"></div>
</div>
</div>
</div>
<!-- CONTENIDO SCROLLABLE DE LA APP -->
<div id="appContentScroll" class="flex-1 overflow-y-auto no-scrollbar pb-24 px-4 pt-1">
<!-- HEADER DE LA APP (DÍA Y PROGRESO) -->
<div class="flex items-center justify-between mb-4">
<div>
<span class="text-[11px] font-bold tracking-wider uppercase text-sky-900/70 block">
viernes, 10 de octubre
</span>
<h1 class="text-xl font-black text-slate-900 tracking-tight lowercase">
mi agenda de hoy
</h1>
</div>
<!-- CHIP DE PROGRESO DEL DÍA -->
<div class="bg-white/80 backdrop-blur-md px-3 py-1.5 rounded-2xl border border-white/90 shadow-xs flex items-center gap-2">
<div class="w-7 h-7 rounded-full bg-sky-100 flex items-center justify-center font-bold text-xs text-sky-800">
<span id="progressPercent">50%</span>
</div>
<div class="flex flex-col text-left">
<span class="text-[9px] uppercase font-bold text-slate-400">completado</span>
<span id="progressCount" class="text-xs font-black text-slate-800">2 de 4</span>
</div>
</div>
</div>
<!-- SELECTOR DE FECHAS EN PÍLDORAS HORIZONTALES (ESTILO STRUCTURED) -->
<div class="flex items-center gap-2 overflow-x-auto no-scrollbar py-1 mb-4 text-xs font-semibold">
<button onclick="selectDate(this, 'Jue 9')" class="px-3.5 py-1.5 rounded-full bg-white/70 hover:bg-white text-slate-700 shrink-0 border border-white/80 lowercase transition-all cursor-pointer">
jue 9
</button>
<button onclick="selectDate(this, 'Hoy 10')" class="px-4 py-1.5 rounded-full bg-slate-900 text-white shadow-xs shrink-0 lowercase cursor-pointer">
hoy 10
</button>
<button onclick="selectDate(this, 'Sáb 11')" class="px-3.5 py-1.5 rounded-full bg-white/70 hover:bg-white text-slate-700 shrink-0 border border-white/80 lowercase transition-all cursor-pointer">
sáb 11
</button>
<button onclick="selectDate(this, 'Dom 12')" class="px-3.5 py-1.5 rounded-full bg-white/70 hover:bg-white text-slate-700 shrink-0 border border-white/80 lowercase transition-all cursor-pointer">
dom 12
</button>
<button onclick="selectDate(this, 'Lun 13')" class="px-3.5 py-1.5 rounded-full bg-white/70 hover:bg-white text-slate-700 shrink-0 border border-white/80 lowercase transition-all cursor-pointer">
lun 13
</button>
</div>
<!-- ========================================================== -->
<!-- EL CARRUSEL DE LA APP: RUTINAS Y PLANTILLAS DE RECORDATORIO -->
<!-- ========================================================== -->
<div class="mb-5">
<div class="flex items-center justify-between mb-2 px-1">
<div>
<span class="text-[10px] font-bold tracking-wider uppercase text-sky-900/80">plantillas & hábitos</span>
<h3 class="text-sm font-extrabold text-slate-900 tracking-tight lowercase">
rutinas conectadas
</h3>
</div>
<!-- Mini botones de navegación del carrusel -->
<div class="flex items-center gap-1.5">
<button onclick="scrollAppCarousel(-1)" class="w-6 h-6 rounded-full bg-white/80 hover:bg-white border border-white flex items-center justify-center text-slate-700 shadow-2xs active:scale-90 transition-all cursor-pointer">
‹
</button>
<button onclick="scrollAppCarousel(1)" class="w-6 h-6 rounded-full bg-white/80 hover:bg-white border border-white flex items-center justify-center text-slate-700 shadow-2xs active:scale-90 transition-all cursor-pointer">
›
</button>
</div>
</div>
<!-- TRACK CON TARJETAS CÁPSULA Y CONECTORES DE ROMPECABEZAS -->
<div class="relative overflow-hidden py-1.5 -mx-4 px-4">
<div id="agendaCarouselTrack" class="flex items-center overflow-x-auto no-scrollbar scroll-smooth snap-x snap-mandatory py-1" style="scroll-padding-left: 16px;">
<!-- ================= TARJETA 1 (PASTEL SKY) ================= -->
<div class="structured-pill snap-start shrink-0 w-[285px] h-[148px] bg-[#e0f2fe] p-4 flex flex-col justify-between relative cursor-pointer border border-sky-200/50" onclick="insertRoutineToTimeline('🌅 Rutina Mañanera', '07:00 AM', '45 min', '#e0f2fe', '☕', 'Café, meditación y lectura de 10 páginas')">
<div class="flex items-center justify-between">
<div class="flex items-center gap-2">
<div class="w-8 h-8 rounded-full bg-white/90 shadow-2xs flex items-center justify-center text-base">
🌅
</div>
<span class="text-[11px] font-bold text-sky-950 uppercase tracking-tight">hábito diario</span>
</div>
<span class="text-[10px] font-black px-2 py-0.5 rounded-full bg-sky-200 text-sky-900 lowercase">
45 min
</span>
</div>
<div>
<h4 class="text-sm font-extrabold text-slate-900 tracking-tight leading-snug lowercase">
rutina mañanera
</h4>
<p class="text-[11px] text-slate-600 line-clamp-1 font-medium mt-0.5">
café, 10 min meditación y journaling
</p>
</div>
<div class="flex items-center justify-between pt-1">
<span class="text-[11px] font-bold text-sky-900">07:00 am</span>
<button class="px-3 py-1 rounded-full bg-slate-900 hover:bg-sky-600 text-white text-[11px] font-bold transition-all shadow-xs flex items-center gap-1">
<span>agendar</span>
<span>+</span>
</button>
</div>
</div>
<!-- CONECTOR PUZZLE 1 (Sky a Mint) -->
<div class="puzzle-joint">
<svg width="26" height="22" viewBox="0 0 26 22" fill="none">
<path d="M0 0 H11 C11 5.5, 16 5.5, 16 11 C16 16.5, 11 16.5, 11 22 H0 Z" fill="#e0f2fe"/>
<path d="M11 0 H26 V22 H11 C11 16.5, 16 16.5, 16 11 C16 5.5, 11 5.5, 11 0 Z" fill="#d1fae5"/>
<path d="M11 0 C11 5.5, 16 5.5, 16 11 C16 16.5, 11 16.5, 11 22" stroke="rgba(0,0,0,0.06)" stroke-width="1.5"/>
</svg>
</div>
<!-- ================= TARJETA 2 (PASTEL MINT) ================= -->
<div class="structured-pill snap-start shrink-0 w-[285px] h-[148px] bg-[#d1fae5] p-4 flex flex-col justify-between relative cursor-pointer border border-emerald-200/50" onclick="insertRoutineToTimeline('⚡ Enfoque Profundo', '10:00 AM', '90 min', '#d1fae5', '💻', 'Bloque de trabajo sin celular ni interrupciones')">
<div class="flex items-center justify-between">
<div class="flex items-center gap-2">
<div class="w-8 h-8 rounded-full bg-white/90 shadow-2xs flex items-center justify-center text-base">
⚡
</div>
<span class="text-[11px] font-bold text-emerald-950 uppercase tracking-tight">productividad</span>
</div>
<span class="text-[10px] font-black px-2 py-0.5 rounded-full bg-emerald-200 text-emerald-900 lowercase">
90 min
</span>
</div>
<div>
<h4 class="text-sm font-extrabold text-slate-900 tracking-tight leading-snug lowercase">
enfoque profundo (deep work)
</h4>
<p class="text-[11px] text-slate-600 line-clamp-1 font-medium mt-0.5">
cero notificaciones, proyecto principal
</p>
</div>
<div class="flex items-center justify-between pt-1">
<span class="text-[11px] font-bold text-emerald-900">10:00 am</span>
<button class="px-3 py-1 rounded-full bg-emerald-900 hover:bg-emerald-800 text-white text-[11px] font-bold transition-all shadow-xs flex items-center gap-1">
<span>agendar</span>
<span>+</span>
</button>
</div>
</div>
<!-- CONECTOR PUZZLE 2 (Mint a Peach) -->
<div class="puzzle-joint">
<svg width="26" height="22" viewBox="0 0 26 22" fill="none">
<path d="M0 0 H11 C11 5.5, 16 5.5, 16 11 C16 16.5, 11 16.5, 11 22 H0 Z" fill="#d1fae5"/>
<path d="M11 0 H26 V22 H11 C11 16.5, 16 16.5, 16 11 C16 5.5, 11 5.5, 11 0 Z" fill="#ffedd5"/>
<path d="M11 0 C11 5.5, 16 5.5, 16 11 C16 16.5, 11 16.5, 11 22" stroke="rgba(0,0,0,0.06)" stroke-width="1.5"/>
</svg>
</div>
<!-- ================= TARJETA 3 (PASTEL PEACH) ================= -->
<div class="structured-pill snap-start shrink-0 w-[285px] h-[148px] bg-[#ffedd5] p-4 flex flex-col justify-between relative cursor-pointer border border-orange-200/50" onclick="insertRoutineToTimeline('🏃‍♂️ Ejercicio & Salud', '05:30 PM', '60 min', '#ffedd5', '🏋️', 'Rutina de pesas o cardio al aire libre')">
<div class="flex items-center justify-between">
<div class="flex items-center gap-2">
<div class="w-8 h-8 rounded-full bg-white/90 shadow-2xs flex items-center justify-center text-base">
🏃‍♂️
</div>
<span class="text-[11px] font-bold text-orange-950 uppercase tracking-tight">bienestar</span>
</div>
<span class="text-[10px] font-black px-2 py-0.5 rounded-full bg-orange-200 text-orange-900 lowercase">
60 min
</span>
</div>
<div>
<h4 class="text-sm font-extrabold text-slate-900 tracking-tight leading-snug lowercase">
sesión de entrenamiento
</h4>
<p class="text-[11px] text-slate-600 line-clamp-1 font-medium mt-0.5">
rutina funcional y estiramiento activo
</p>
</div>
<div class="flex items-center justify-between pt-1">
<span class="text-[11px] font-bold text-orange-900">05:30 pm</span>
<button class="px-3 py-1 rounded-full bg-orange-950 hover:bg-orange-900 text-white text-[11px] font-bold transition-all shadow-xs flex items-center gap-1">
<span>agendar</span>
<span>+</span>
</button>
</div>
</div>
<!-- CONECTOR PUZZLE 3 (Peach a Lavender) -->
<div class="puzzle-joint">
<svg width="26" height="22" viewBox="0 0 26 22" fill="none">
<path d="M0 0 H11 C11 5.5, 16 5.5, 16 11 C16 16.5, 11 16.5, 11 22 H0 Z" fill="#ffedd5"/>
<path d="M11 0 H26 V22 H11 C11 16.5, 16 16.5, 16 11 C16 5.5, 11 5.5, 11 0 Z" fill="#f3e8ff"/>
<path d="M11 0 C11 5.5, 16 5.5, 16 11 C16 16.5, 11 16.5, 11 22" stroke="rgba(0,0,0,0.06)" stroke-width="1.5"/>
</svg>
</div>
<!-- ================= TARJETA 4 (PASTEL LAVENDER) ================= -->
<div class="structured-pill snap-start shrink-0 w-[285px] h-[148px] bg-[#f3e8ff] p-4 flex flex-col justify-between relative cursor-pointer border border-purple-200/50" onclick="insertRoutineToTimeline('🌙 Desconexión Nocturna', '09:30 PM', '30 min', '#f3e8ff', '📖', 'Apagar pantallas, lectura y té relajante')">
<div class="flex items-center justify-between">
<div class="flex items-center gap-2">
<div class="w-8 h-8 rounded-full bg-white/90 shadow-2xs flex items-center justify-center text-base">
🌙
</div>
<span class="text-[11px] font-bold text-purple-950 uppercase tracking-tight">descanso</span>
</div>
<span class="text-[10px] font-black px-2 py-0.5 rounded-full bg-purple-200 text-purple-900 lowercase">
30 min
</span>
</div>
<div>
<h4 class="text-sm font-extrabold text-slate-900 tracking-tight leading-snug lowercase">
rutina de descanso
</h4>
<p class="text-[11px] text-slate-600 line-clamp-1 font-medium mt-0.5">
cero pantallas, preparar el día de mañana
</p>
</div>
<div class="flex items-center justify-between pt-1">
<span class="text-[11px] font-bold text-purple-900">09:30 pm</span>
<button class="px-3 py-1 rounded-full bg-purple-950 hover:bg-purple-900 text-white text-[11px] font-bold transition-all shadow-xs flex items-center gap-1">
<span>agendar</span>
<span>+</span>
</button>
</div>
</div>
</div>
</div>
<!-- Puntos indicadores del carrusel -->
<div class="flex items-center justify-center gap-1.5 mt-2">
<button onclick="jumpToCarousel(0)" class="app-dot w-6 h-1.5 rounded-full bg-slate-900 transition-all cursor-pointer"></button>
<button onclick="jumpToCarousel(1)" class="app-dot w-2 h-1.5 rounded-full bg-slate-300 transition-all cursor-pointer"></button>
<button onclick="jumpToCarousel(2)" class="app-dot w-2 h-1.5 rounded-full bg-slate-300 transition-all cursor-pointer"></button>
<button onclick="jumpToCarousel(3)" class="app-dot w-2 h-1.5 rounded-full bg-slate-300 transition-all cursor-pointer"></button>
</div>
</div>
<!-- ========================================================== -->
<!-- EL TIMELINE VISUAL DE RECORDATORIOS Y TAREAS (STRUCTURED 1:1) -->
<!-- ========================================================== -->
<div class="mb-4">
<div class="flex items-center justify-between mb-3 px-1">
<div>
<span class="text-[10px] font-bold tracking-wider uppercase text-slate-400">línea de tiempo</span>
<h3 class="text-sm font-extrabold text-slate-900 tracking-tight lowercase">
timeline del día
</h3>
</div>
<span class="text-[10px] font-semibold text-slate-500 bg-white/70 px-2.5 py-0.5 rounded-full border border-white">
toca el círculo para tachar
</span>
</div>
<!-- LISTA VERTICAL DE TAREAS CON LÍNEA CENTRAL -->
<div id="timelineTaskList" class="relative pl-7 space-y-3.5">
<!-- Línea vertical continua que une el día -->
<div class="absolute left-2.5 top-3 bottom-3 w-0.5 bg-slate-300/80 rounded-full"></div>
<!-- Tarea 1: Despertar & Desayuno (Completada) -->
<div class="relative timeline-task completed bg-white/90 p-3.5 border border-white flex items-center justify-between cursor-pointer" onclick="toggleTaskCompletion(this)">
<!-- Nodo conector en la línea del tiempo -->
<div class="absolute -left-[27px] top-1/2 -translate-y-1/2 w-4 h-4 rounded-full bg-sky-500 border-2 border-white shadow-xs"></div>
<div class="flex items-center gap-3">
<div class="w-9 h-9 rounded-full bg-[#e0f2fe] flex items-center justify-center text-lg">
☕
</div>
<div>
<div class="flex items-center gap-2">
<span class="text-[10px] font-bold text-sky-800 uppercase tracking-tight">07:30 am • 30m</span>
</div>
<h5 class="task-title text-xs font-bold text-slate-900 lowercase leading-snug">
desayuno & planificar el día
</h5>
<p class="text-[10px] text-slate-500 font-medium">revisar prioridades y tomar café</p>
</div>
</div>
<!-- Checkbox circular de Structured -->
<div class="check-circle w-6 h-6 rounded-full bg-emerald-500 text-white flex items-center justify-center text-xs font-bold shadow-xs">
✓
</div>
</div>
<!-- Tarea 2: Reunión de equipo (Completada) -->
<div class="relative timeline-task completed bg-white/90 p-3.5 border border-white flex items-center justify-between cursor-pointer" onclick="toggleTaskCompletion(this)">
<div class="absolute -left-[27px] top-1/2 -translate-y-1/2 w-4 h-4 rounded-full bg-purple-500 border-2 border-white shadow-xs"></div>
<div class="flex items-center gap-3">
<div class="w-9 h-9 rounded-full bg-[#f3e8ff] flex items-center justify-center text-lg">
💼
</div>
<div>
<div class="flex items-center gap-2">
<span class="text-[10px] font-bold text-purple-800 uppercase tracking-tight">09:00 am • 45m</span>
</div>
<h5 class="task-title text-xs font-bold text-slate-900 lowercase leading-snug">
daily sprint con el equipo
</h5>
<p class="text-[10px] text-slate-500 font-medium">revisión de avances del prototipo</p>
</div>
</div>
<div class="check-circle w-6 h-6 rounded-full bg-emerald-500 text-white flex items-center justify-center text-xs font-bold shadow-xs">
✓
</div>
</div>
<!-- Tarea 3: Enfoque Profundo (EN CURSO) -->
<div class="relative timeline-task bg-[#d1fae5]/90 p-3.5 border border-emerald-200/80 flex items-center justify-between cursor-pointer shadow-xs" onclick="toggleTaskCompletion(this)">
<div class="absolute -left-[27px] top-1/2 -translate-y-1/2 w-4 h-4 rounded-full bg-emerald-500 border-2 border-white shadow-xs animate-pulse"></div>
<div class="flex items-center gap-3">
<div class="w-9 h-9 rounded-full bg-white flex items-center justify-center text-lg shadow-2xs">
💻
</div>
<div>
<div class="flex items-center gap-2">
<span class="text-[10px] font-extrabold text-emerald-950 uppercase tracking-tight">10:00 am • 90m</span>
<span class="text-[9px] font-bold px-1.5 py-0.2 rounded-full bg-emerald-600 text-white">en curso</span>
</div>
<h5 class="task-title text-xs font-extrabold text-emerald-950 lowercase leading-snug">
diseño de la arquitectura & api
</h5>
<p class="text-[10px] text-emerald-800 font-medium">bloque de concentración profunda</p>
</div>
</div>
<div class="check-circle w-6 h-6 rounded-full border-2 border-emerald-600 bg-white flex items-center justify-center text-xs font-bold text-transparent hover:text-emerald-600">
✓
</div>
</div>
<!-- Espacio libre en el Timeline (Structured Gap) -->
<div class="flex items-center gap-2 py-1 text-[10px] font-semibold text-slate-500 italic pl-1">
<span>⏱️ 1h libre para descanso y caminata</span>
</div>
<!-- Tarea 4: Almuerzo & Desconexión (Pendiente) -->
<div class="relative timeline-task bg-white/90 p-3.5 border border-white flex items-center justify-between cursor-pointer" onclick="toggleTaskCompletion(this)">
<div class="absolute -left-[27px] top-1/2 -translate-y-1/2 w-4 h-4 rounded-full bg-orange-400 border-2 border-white shadow-xs"></div>
<div class="flex items-center gap-3">
<div class="w-9 h-9 rounded-full bg-[#ffedd5] flex items-center justify-center text-lg">
🥗
</div>
<div>
<div class="flex items-center gap-2">
<span class="text-[10px] font-bold text-orange-800 uppercase tracking-tight">01:00 pm • 60m</span>
</div>
<h5 class="task-title text-xs font-bold text-slate-900 lowercase leading-snug">
almuerzo saludable & lectura
</h5>
<p class="text-[10px] text-slate-500 font-medium">desconectarse de pantallas</p>
</div>
</div>
<div class="check-circle w-6 h-6 rounded-full border-2 border-slate-300 bg-white flex items-center justify-center text-xs font-bold text-transparent hover:text-slate-400">
✓
</div>
</div>
</div>
</div>
</div>
<!-- BARRA DE NAVEGACIÓN FLOTANTE (BOTTOM DOCK) -->
<div class="absolute bottom-3 left-4 right-4 z-40">
<div class="bg-white/80 backdrop-blur-2xl px-6 py-2.5 rounded-full border border-white/90 shadow-[0_10px_25px_-5px_rgba(0,0,0,0.1)] flex items-center justify-between">
<!-- Tab Timeline (Activo) -->
<button class="flex flex-col items-center gap-0.5 text-slate-900 cursor-pointer">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
<span class="text-[9px] font-extrabold lowercase">timeline</span>
</button>
<!-- Tab Calendario -->
<button onclick="showAppToast('Vista de Calendario Mensual')" class="flex flex-col items-center gap-0.5 text-slate-400 hover:text-slate-800 cursor-pointer transition-colors">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"/></svg>
<span class="text-[9px] font-semibold lowercase">mes</span>
</button>
<!-- BOTÓN CENTRAL "+" DE CREAR TAREA -->
<button onclick="openNewTaskModal()" class="w-12 h-12 -mt-6 rounded-full bg-slate-900 hover:bg-sky-600 text-white flex items-center justify-center shadow-lg active:scale-90 transition-all cursor-pointer">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M12 4v16m8-8H4"/></svg>
</button>
<!-- Tab Inbox (Tareas sin agendar) -->
<button onclick="showAppToast('Buzón: 3 notas rápidas guardadas')" class="flex flex-col items-center gap-0.5 text-slate-400 hover:text-slate-800 cursor-pointer transition-colors">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"/></svg>
<span class="text-[9px] font-semibold lowercase">inbox</span>
</button>
<!-- Tab Ajustes -->
<button onclick="showAppToast('Configuración y sincronización')" class="flex flex-col items-center gap-0.5 text-slate-400 hover:text-slate-800 cursor-pointer transition-colors">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/></svg>
<span class="text-[9px] font-semibold lowercase">ajustes</span>
</button>
</div>
</div>
<!-- HOME BAR DE IPHONE -->
<div class="absolute bottom-1 left-1/2 -translate-x-1/2 w-32 h-1 bg-slate-900/40 rounded-full z-50 pointer-events-none"></div>
<!-- TOAST IN-APP -->
<div id="inAppNotice" class="absolute top-16 left-6 right-6 z-50 bg-slate-900/90 backdrop-blur-md text-white px-4 py-2.5 rounded-2xl text-xs font-semibold shadow-xl flex items-center justify-between transition-all duration-300 opacity-0 -translate-y-4 pointer-events-none">
<span id="inAppNoticeText">¡Rutina añadida a tu agenda!</span>
<span class="text-emerald-400">✓</span>
</div>
</div>
</div>
<!-- PANEL LATERAL: EXPLICACIÓN Y CARACTERÍSTICAS DE LA APP -->
<div class="w-full max-w-md flex flex-col gap-5">
<!-- TARJETA INFORMATIVA -->
<div class="bg-white/80 backdrop-blur-xl p-6 rounded-3xl border border-white/90 shadow-sm">
<div class="inline-flex items-center gap-2 px-3 py-1 rounded-full bg-emerald-100 text-emerald-800 text-[11px] font-bold mb-3">
<span>✨ App Independiente de Agenda & Recordatorios</span>
</div>
<h3 class="text-xl font-extrabold text-slate-900 tracking-tight lowercase mb-2">
¿cómo funciona esta app de recordatorios?
</h3>
<p class="text-xs text-slate-600 font-medium mb-4 leading-relaxed">
Esta aplicación adopta el concepto exacto de <strong>Structured</strong>: transformar listas de tareas aburridas en una <strong>línea de tiempo visual</strong> con colores pasteles, donde cada momento de tu día tiene un espacio claro y conectado.
</p>
<div class="space-y-3 text-xs">
<div class="flex items-start gap-3 p-3 rounded-2xl bg-sky-50/70 border border-sky-100">
<span class="text-lg">🧩</span>
<div>
<strong class="text-slate-900 font-bold block lowercase">1. carrusel de rutinas con conectores puzzle</strong>
<p class="text-slate-600 mt-0.5">Las cápsulas del carrusel son plantillas de hábitos frecuentes (rutina mañanera, deep work, gym). Al tocar cualquiera, se inserta directo en tu timeline.</p>
</div>
</div>
<div class="flex items-start gap-3 p-3 rounded-2xl bg-emerald-50/70 border border-emerald-100">
<span class="text-lg">🕒</span>
<div>
<strong class="text-slate-900 font-bold block lowercase">2. timeline visual interactivo</strong>
<p class="text-slate-600 mt-0.5">Cada tarea tiene su horario y duración. Puedes tocar el círculo verde para marcarla como completada y ver cómo avanza tu porcentaje del día.</p>
</div>
</div>
<div class="flex items-start gap-3 p-3 rounded-2xl bg-orange-50/70 border border-orange-100">
<span class="text-lg">🎨</span>
<div>
<strong class="text-slate-900 font-bold block lowercase">3. paleta pastel relajante</strong>
<p class="text-slate-600 mt-0.5">Usa los colores suaves de SiboPay (Cielo, Menta, Melocotón, Lavanda, Vainilla) que reducen el estrés visual característico de Structured.</p>
</div>
</div>
</div>
</div>
<!-- PRUEBAS RÁPIDAS -->
<div class="bg-white/80 backdrop-blur-xl p-5 rounded-3xl border border-white/90 shadow-sm flex flex-col gap-3">
<h4 class="text-xs font-bold text-slate-400 uppercase tracking-wider">
acciones interactivas de prueba
</h4>
<div class="grid grid-cols-2 gap-2 text-xs font-bold">
<button onclick="insertRoutineToTimeline('☕ Pausa de Café', '03:30 PM', '20 min', '#ffedd5', '☕', 'Desconexión rápida')" class="p-2.5 rounded-2xl bg-orange-500 hover:bg-orange-600 text-white transition-all shadow-xs cursor-pointer text-center">
+ Insertar Pausa
</button>
<button onclick="insertRoutineToTimeline('📖 Lectura Nocturna', '09:00 PM', '45 min', '#f3e8ff', '📖', 'Leer 15 páginas')" class="p-2.5 rounded-2xl bg-purple-600 hover:bg-purple-700 text-white transition-all shadow-xs cursor-pointer text-center">
+ Insertar Lectura
</button>
<button onclick="scrollAppCarousel(1)" class="p-2.5 rounded-2xl bg-slate-900 hover:bg-slate-800 text-white transition-all shadow-xs cursor-pointer text-center">
› Siguiente Rutina
</button>
<button onclick="openNewTaskModal()" class="p-2.5 rounded-2xl bg-sky-600 hover:bg-sky-700 text-white transition-all shadow-xs cursor-pointer text-center">
✏️ Crear Personalizada
</button>
</div>
</div>
</div>
</main>
<!-- MODAL PARA CREAR NUEVA TAREA / RECORDATORIO -->
<div id="newTaskModal" class="fixed inset-0 z-50 bg-black/40 backdrop-blur-xs flex items-center justify-center p-4 opacity-0 pointer-events-none transition-opacity duration-300">
<div class="bg-white rounded-[36px] p-6 max-w-sm w-full shadow-2xl border border-slate-100 flex flex-col gap-4">
<div class="flex items-center justify-between">
<h3 class="text-lg font-black text-slate-900 tracking-tight lowercase">nueva tarea o recordatorio</h3>
<button onclick="closeNewTaskModal()" class="w-8 h-8 rounded-full bg-slate-100 hover:bg-slate-200 text-slate-700 font-bold text-sm flex items-center justify-center cursor-pointer">
✕
</button>
</div>
<!-- Nombre de la tarea -->
<div>
<label class="text-[11px] font-bold text-slate-500 uppercase tracking-wider block mb-1">título de la tarea</label>
<input id="inputTaskTitle" type="text" placeholder="Ej: Llamar al médico, Estudiar..." class="w-full px-4 py-2.5 rounded-2xl bg-slate-50 border border-slate-200 text-xs font-semibold text-slate-800 focus:outline-none focus:border-sky-500">
</div>
<!-- Hora y duración -->
<div class="grid grid-cols-2 gap-2">
<div>
<label class="text-[11px] font-bold text-slate-500 uppercase tracking-wider block mb-1">hora</label>
<input id="inputTaskTime" type="time" value="14:00" class="w-full px-3 py-2 rounded-2xl bg-slate-50 border border-slate-200 text-xs font-semibold text-slate-800 focus:outline-none">
</div>
<div>
<label class="text-[11px] font-bold text-slate-500 uppercase tracking-wider block mb-1">duración</label>
<select id="inputTaskDuration" class="w-full px-3 py-2 rounded-2xl bg-slate-50 border border-slate-200 text-xs font-semibold text-slate-800 focus:outline-none">
<option value="15 min">15 min</option>
<option value="30 min">30 min</option>
<option value="45 min" selected>45 min</option>
<option value="60 min">1 hora</option>
<option value="90 min">1h 30m</option>
</select>
</div>
</div>
<!-- Selector de color pastel -->
<div>
<label class="text-[11px] font-bold text-slate-500 uppercase tracking-wider block mb-1.5">color pastel</label>
<div class="flex items-center gap-2">
<label class="cursor-pointer"><input type="radio" name="colorChoice" value="#e0f2fe" checked class="peer sr-only"><span class="w-7 h-7 rounded-full bg-[#e0f2fe] border-2 border-transparent peer-checked:border-sky-600 block"></span></label>
<label class="cursor-pointer"><input type="radio" name="colorChoice" value="#d1fae5" class="peer sr-only"><span class="w-7 h-7 rounded-full bg-[#d1fae5] border-2 border-transparent peer-checked:border-emerald-600 block"></span></label>
<label class="cursor-pointer"><input type="radio" name="colorChoice" value="#ffedd5" class="peer sr-only"><span class="w-7 h-7 rounded-full bg-[#ffedd5] border-2 border-transparent peer-checked:border-orange-600 block"></span></label>
<label class="cursor-pointer"><input type="radio" name="colorChoice" value="#f3e8ff" class="peer sr-only"><span class="w-7 h-7 rounded-full bg-[#f3e8ff] border-2 border-transparent peer-checked:border-purple-600 block"></span></label>
<label class="cursor-pointer"><input type="radio" name="colorChoice" value="#fef9c3" class="peer sr-only"><span class="w-7 h-7 rounded-full bg-[#fef9c3] border-2 border-transparent peer-checked:border-amber-600 block"></span></label>
</div>
</div>
<!-- Selector de Emoji -->
<div>
<label class="text-[11px] font-bold text-slate-500 uppercase tracking-wider block mb-1.5">icono</label>
<div class="flex items-center gap-1.5">
<button type="button" onclick="selectEmoji(this, '📝')" class="emoji-btn w-8 h-8 rounded-full bg-slate-100 border border-slate-200 text-sm flex items-center justify-center">📝</button>
<button type="button" onclick="selectEmoji(this, '⚡')" class="emoji-btn w-8 h-8 rounded-full bg-slate-100 border border-slate-200 text-sm flex items-center justify-center">⚡</button>
<button type="button" onclick="selectEmoji(this, '📞')" class="emoji-btn w-8 h-8 rounded-full bg-slate-100 border border-slate-200 text-sm flex items-center justify-center">📞</button>
<button type="button" onclick="selectEmoji(this, '🏋️')" class="emoji-btn w-8 h-8 rounded-full bg-slate-100 border border-slate-200 text-sm flex items-center justify-center">🏋️</button>
<button type="button" onclick="selectEmoji(this, '💊')" class="emoji-btn w-8 h-8 rounded-full bg-slate-100 border border-slate-200 text-sm flex items-center justify-center">💊</button>
<button type="button" onclick="selectEmoji(this, '🛒')" class="emoji-btn w-8 h-8 rounded-full bg-slate-100 border border-slate-200 text-sm flex items-center justify-center">🛒</button>
</div>
</div>
<!-- Botón Guardar -->
<div class="pt-2">
<button onclick="saveNewTask()" class="w-full py-3 rounded-full bg-slate-900 hover:bg-sky-600 text-white text-xs font-black uppercase tracking-wider shadow-sm transition-all cursor-pointer">
guardar en el timeline
</button>
</div>
</div>
</div>
<!-- JAVASCRIPT DE LA APLICACIÓN -->
<script>
const carousel = document.getElementById('agendaCarouselTrack');
const dots = document.querySelectorAll('.app-dot');
let selectedEmojiVal = '📝';
// Navegación en el carrusel
function scrollAppCarousel(direction) {
const step = 311; // Ancho tarjeta + conector
carousel.scrollBy({ left: direction * step, behavior: 'smooth' });
setTimeout(updateAppDots, 300);
}
function jumpToCarousel(index) {
const step = 311;
carousel.scrollTo({ left: index * step, behavior: 'smooth' });
setDotActive(index);
}
function updateAppDots() {
const step = 311;
const index = Math.min(3, Math.max(0, Math.round(carousel.scrollLeft / step)));
setDotActive(index);
}
function setDotActive(index) {
dots.forEach((dot, idx) => {
if (idx === index) {
dot.className = 'app-dot w-6 h-1.5 rounded-full bg-slate-900 transition-all cursor-pointer';
} else {
dot.className = 'app-dot w-2 h-1.5 rounded-full bg-slate-300 transition-all cursor-pointer';
}
});
}
carousel.addEventListener('scroll', () => {
clearTimeout(window.appScrollT);
window.appScrollT = setTimeout(updateAppDots, 80);
});
// Marcar/Desmarcar tarea completada estilo Structured
function toggleTaskCompletion(taskElement) {
taskElement.classList.toggle('completed');
const check = taskElement.querySelector('.check-circle');
if (taskElement.classList.contains('completed')) {
check.className = 'check-circle w-6 h-6 rounded-full bg-emerald-500 text-white flex items-center justify-center text-xs font-bold shadow-xs animate-pop';
check.textContent = '✓';
showAppToast('¡Tarea completada!');
} else {
check.className = 'check-circle w-6 h-6 rounded-full border-2 border-slate-300 bg-white flex items-center justify-center text-xs font-bold text-transparent hover:text-slate-400';
check.textContent = '✓';
}
updateProgressStats();
}
// Actualizar porcentaje de productividad
function updateProgressStats() {
const allTasks = document.querySelectorAll('#timelineTaskList .timeline-task');
const completedTasks = document.querySelectorAll('#timelineTaskList .timeline-task.completed');
const total = allTasks.length;
const done = completedTasks.length;
const pct = total === 0 ? 0 : Math.round((done / total) * 100);
document.getElementById('progressPercent').textContent = pct + '%';
document.getElementById('progressCount').textContent = `${done} de ${total}`;
}
// Insertar rutina desde el carrusel directamente al timeline
function insertRoutineToTimeline(title, time, duration, color, emoji, note) {
const list = document.getElementById('timelineTaskList');
const task = document.createElement('div');
task.className = 'relative timeline-task bg-white/95 p-3.5 border border-white flex items-center justify-between cursor-pointer shadow-xs';
task.onclick = function() { toggleTaskCompletion(task); };
task.innerHTML = `
<div class="absolute -left-[27px] top-1/2 -translate-y-1/2 w-4 h-4 rounded-full border-2 border-white shadow-xs" style="background-color: ${color}"></div>
<div class="flex items-center gap-3">
<div class="w-9 h-9 rounded-full flex items-center justify-center text-lg" style="background-color: ${color}">
${emoji}
</div>
<div>
<div class="flex items-center gap-2">
<span class="text-[10px] font-bold text-slate-800 uppercase tracking-tight">${time} • ${duration}</span>
</div>
<h5 class="task-title text-xs font-bold text-slate-900 lowercase leading-snug">
${title}
</h5>
<p class="text-[10px] text-slate-500 font-medium">${note}</p>
</div>
</div>
<div class="check-circle w-6 h-6 rounded-full border-2 border-slate-300 bg-white flex items-center justify-center text-xs font-bold text-transparent hover:text-slate-400">
✓
</div>
`;
list.appendChild(task);
updateProgressStats();
showAppToast(`"${title}" agregada al timeline`);
// Auto-scroll hacia la nueva tarea
task.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
}
// Modal de nueva tarea
function openNewTaskModal() {
const modal = document.getElementById('newTaskModal');
modal.classList.remove('opacity-0', 'pointer-events-none');
modal.classList.add('opacity-100');
}
function closeNewTaskModal() {
const modal = document.getElementById('newTaskModal');
modal.classList.remove('opacity-100');
modal.classList.add('opacity-0', 'pointer-events-none');
}
function selectEmoji(btn, emoji) {
document.querySelectorAll('.emoji-btn').forEach(b => b.classList.remove('bg-sky-200', 'border-sky-500'));
btn.classList.add('bg-sky-200', 'border-sky-500');
selectedEmojiVal = emoji;
}
function saveNewTask() {
const titleInput = document.getElementById('inputTaskTitle');
const title = titleInput.value.trim() || 'Recordatorio rápido';
const timeVal = document.getElementById('inputTaskTime').value || '15:00';
const duration = document.getElementById('inputTaskDuration').value;
const color = document.querySelector('input[name="colorChoice"]:checked').value;
insertRoutineToTimeline(title, timeVal, duration, color, selectedEmojiVal, 'Recordatorio personalizado');
titleInput.value = '';
closeNewTaskModal();
}
// Selector de fecha
function selectDate(btn, label) {
btn.parentElement.querySelectorAll('button').forEach(b => {
b.className = 'px-3.5 py-1.5 rounded-full bg-white/70 hover:bg-white text-slate-700 shrink-0 border border-white/80 lowercase transition-all cursor-pointer';
});
btn.className = 'px-4 py-1.5 rounded-full bg-slate-900 text-white shadow-xs shrink-0 lowercase cursor-pointer';
showAppToast(`Viendo agenda de: ${label}`);
}
// Cambiar paleta de tema
function changeTheme(viewportBg, bodyBg, name) {
document.getElementById('appViewport').style.backgroundColor = viewportBg;
document.getElementById('pageBody').style.backgroundColor = bodyBg;
showAppToast(`Tema cambiado a: ${name}`);
}
// Toast flotante dentro de la app
function showAppToast(msg) {
const notice = document.getElementById('inAppNotice');
const text = document.getElementById('inAppNoticeText');
text.textContent = msg;
notice.classList.remove('opacity-0', '-translate-y-4', 'pointer-events-none');
notice.classList.add('opacity-100', 'translate-y-0');
clearTimeout(window.noticeTimer);
window.noticeTimer = setTimeout(() => {
notice.classList.remove('opacity-100', 'translate-y-0');
notice.classList.add('opacity-0', '-translate-y-4', 'pointer-events-none');
}, 2400);
}
</script>
</body>
</html>
+938
View File
@@ -0,0 +1,938 @@
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SiboPay — Carrusel Estilo Structured en la App</title>
<script src="https://www.gstatic.com/antigravity/web/dev/tailwindcss.min.js"></script>
<style>
/* Tipografía y suavizado idéntico a Structured */
* {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/* Scrollbar oculta para el snap carousel */
.no-scrollbar::-webkit-scrollbar {
display: none;
}
.no-scrollbar {
-ms-overflow-style: none;
scrollbar-width: none;
}
/* Transición suave de temas */
.theme-transition {
transition: background-color 0.6s cubic-bezier(0.4, 0, 0.2, 1), color 0.4s ease;
}
/* Cápsula móvil estilo Structured */
.app-card-pill {
border-radius: 36px;
box-shadow: 0 12px 28px -6px rgba(0, 0, 0, 0.08), inset 0 1.5px 1px rgba(255, 255, 255, 0.85);
transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}
.app-card-pill:hover, .app-card-pill:active {
transform: translateY(-2px) scale(1.01);
box-shadow: 0 16px 32px -6px rgba(0, 0, 0, 0.12), inset 0 1.5px 1px rgba(255, 255, 255, 0.95);
}
/* Efecto puzzle connector entre tarjetas */
.puzzle-connector {
width: 28px;
height: 22px;
position: relative;
flex-shrink: 0;
z-index: 10;
display: flex;
align-items: center;
justify-content: center;
}
/* Discos circulares interactivos estilo Structured */
.explore-disk {
width: 68px;
height: 68px;
border-radius: 9999px;
box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.07), inset 0 1.5px 1px rgba(255, 255, 255, 0.85);
transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.explore-disk:active {
transform: scale(0.92);
}
/* Timeline vertical de Structured */
.timeline-pill {
border-radius: 26px;
box-shadow: 0 6px 18px -4px rgba(0, 0, 0, 0.06), inset 0 1px 1px rgba(255, 255, 255, 0.8);
transition: transform 0.2s ease;
}
.timeline-pill:hover {
transform: translateX(3px);
}
/* Animación de pulso suave */
@keyframes gentle-pulse {
0%, 100% { opacity: 1; transform: scale(1); }
50% { opacity: 0.85; transform: scale(1.05); }
}
.animate-gentle {
animation: gentle-pulse 3s infinite ease-in-out;
}
/* Efecto de marco de iPhone */
.iphone-shell {
box-shadow:
0 0 0 12px #1e293b,
0 0 0 14px #334155,
0 25px 60px -15px rgba(0, 0, 0, 0.35);
}
/* Animación de deslizamiento automático continuo si se activa */
@keyframes marquee-mobile {
0% { transform: translateX(0); }
100% { transform: translateX(-50%); }
}
.track-auto {
animation: marquee-mobile 24s linear infinite;
}
.track-auto:hover {
animation-play-state: paused;
}
</style>
</head>
<body id="mainBody" class="theme-transition min-h-screen font-sans bg-[#e6f4fe] text-slate-800 p-4 md:p-8 flex flex-col items-center justify-start">
<!-- HEADER DEL ESTUDIO / PRESENTACIÓN -->
<header class="w-full max-w-5xl mx-auto mb-6 flex flex-col md:flex-row items-center justify-between gap-4 bg-white/70 backdrop-blur-xl p-4 md:px-6 rounded-3xl border border-white/80 shadow-[0_8px_30px_rgba(0,0,0,0.04)]">
<div class="flex items-center gap-3">
<div class="w-10 h-10 rounded-2xl bg-gradient-to-tr from-sky-600 to-cyan-400 flex items-center justify-center text-white font-extrabold text-xl shadow-md">
S
</div>
<div>
<div class="flex items-center gap-2">
<span class="text-xl font-bold tracking-tight text-slate-900">sibopay</span>
<span class="text-[11px] font-bold uppercase tracking-wider px-2.5 py-0.5 rounded-full bg-sky-100 text-sky-800 border border-sky-200">
Diseño In-App • Structured
</span>
</div>
<p class="text-xs text-slate-500 font-medium">Así luce el carrusel de cápsulas y conectores dentro de la pantalla del celular</p>
</div>
</div>
<!-- CONTROLES DEL PROTOTIPO -->
<div class="flex flex-wrap items-center gap-2">
<!-- Selector de color pastel de la App -->
<div class="flex items-center gap-1.5 bg-white/90 p-1.5 rounded-2xl border border-slate-200/80 shadow-xs">
<span class="text-[11px] font-semibold text-slate-500 pl-1.5">Fondo App:</span>
<button onclick="setTheme('#e0f2fe', '#f0f9ff')" title="Cielo SiboPay" class="w-6 h-6 rounded-full bg-[#e0f2fe] border-2 border-sky-400 hover:scale-110 transition-transform cursor-pointer"></button>
<button onclick="setTheme('#d1fae5', '#ecfdf5')" title="Menta Fresca" class="w-6 h-6 rounded-full bg-[#d1fae5] border-2 border-emerald-400 hover:scale-110 transition-transform cursor-pointer"></button>
<button onclick="setTheme('#ffedd5', '#fff7ed')" title="Melocotón Pastel" class="w-6 h-6 rounded-full bg-[#ffedd5] border-2 border-orange-400 hover:scale-110 transition-transform cursor-pointer"></button>
<button onclick="setTheme('#f3e8ff', '#faf5ff')" title="Lavanda Suave" class="w-6 h-6 rounded-full bg-[#f3e8ff] border-2 border-purple-400 hover:scale-110 transition-transform cursor-pointer"></button>
<button onclick="setTheme('#fef9c3', '#fefce8')" title="Vainilla Cálido" class="w-6 h-6 rounded-full bg-[#fef9c3] border-2 border-amber-400 hover:scale-110 transition-transform cursor-pointer"></button>
<button onclick="setTheme('#f8fafc', '#ffffff')" title="Blanco Minimalista" class="w-6 h-6 rounded-full bg-[#ffffff] border-2 border-slate-300 hover:scale-110 transition-transform cursor-pointer"></button>
</div>
<!-- Selector de Vista -->
<div class="flex items-center bg-slate-100 p-1 rounded-2xl border border-slate-200 text-xs font-semibold">
<button id="btnViewPhone" onclick="setViewMode('phone')" class="px-3 py-1.5 rounded-xl bg-white text-slate-800 shadow-xs transition-all cursor-pointer">
📱 Vista Móvil
</button>
<button id="btnViewComponent" onclick="setViewMode('component')" class="px-3 py-1.5 rounded-xl text-slate-500 hover:text-slate-800 transition-all cursor-pointer">
🔍 Zoom Componente
</button>
</div>
<!-- Botón Autoplay -->
<button id="btnAutoplay" onclick="toggleAutoFlow()" class="px-3.5 py-1.5 rounded-2xl bg-white hover:bg-slate-50 text-slate-700 text-xs font-semibold border border-slate-200 shadow-xs flex items-center gap-1.5 transition-all cursor-pointer">
<span id="autoplayIcon">▶</span>
<span id="autoplayText">Flujo Continuo</span>
</button>
</div>
</header>
<!-- CONTENEDOR PRINCIPAL: VISTA DEL CELULAR (IPHONE 16 PRO FRAME) -->
<main class="w-full max-w-5xl flex flex-col lg:flex-row items-center justify-center gap-10">
<!-- EL TELÉFONO MÓVIL CON LA APP ADENTRO -->
<div id="phoneFrame" class="iphone-shell relative w-[390px] h-[812px] bg-slate-900 rounded-[52px] p-3 flex flex-col shrink-0 select-none overflow-hidden transition-all duration-500">
<!-- Borde interno de pantalla -->
<div id="appScreen" class="theme-transition relative w-full h-full bg-[#e0f2fe] rounded-[42px] overflow-hidden flex flex-col justify-between">
<!-- STATUS BAR & DYNAMIC ISLAND -->
<div class="relative pt-3 pb-1 px-7 flex items-center justify-between z-40 text-slate-800 font-semibold text-xs tracking-tight">
<span>9:41</span>
<!-- DYNAMIC ISLAND DE APPLE -->
<div class="w-28 h-7 bg-black rounded-full flex items-center justify-between px-2.5 shadow-inner">
<div class="w-2.5 h-2.5 rounded-full bg-emerald-500 animate-pulse"></div>
<span class="text-[10px] text-white/90 font-medium tracking-wide">sibopay</span>
<div class="w-2.5 h-2.5 rounded-full bg-sky-400"></div>
</div>
<div class="flex items-center gap-1.5 text-slate-800">
<svg class="w-3.5 h-3.5" viewBox="0 0 24 24" fill="currentColor"><path d="M12 3c-4.97 0-9 4.03-9 9 0 2.12.74 4.07 1.97 5.61L12 22l7.03-4.39C20.26 16.07 21 14.12 21 12c0-4.97-4.03-9-9-9z"/></svg>
<svg class="w-3.5 h-3.5" viewBox="0 0 24 24" fill="currentColor"><path d="M2 17h20v2H2zm1.15-4.05L4 11.47l.85 1.48L6 12.33V17H4v-4.05zM9 17h2v-7H9v7zm5 0h2V7h-2v10zm5 0h2V4h-2v13z"/></svg>
<div class="w-5 h-2.5 border border-slate-700 rounded-sm p-0.5 flex items-center">
<div class="w-full h-full bg-slate-800 rounded-2xs"></div>
</div>
</div>
</div>
<!-- APP BODY SCROLLABLE -->
<div id="appScrollArea" class="flex-1 overflow-y-auto no-scrollbar pb-24 px-4 pt-2">
<!-- APP TOP HEADER CON PERFIL Y SALDO -->
<div class="flex items-center justify-between mb-4 pt-1">
<div class="flex items-center gap-2.5">
<div class="relative">
<img src="https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=100&auto=format&fit=crop&q=80" alt="Avatar" class="w-10 h-10 rounded-full object-cover border-2 border-white shadow-xs">
<div class="absolute -bottom-0.5 -right-0.5 w-3.5 h-3.5 rounded-full bg-emerald-500 border-2 border-white"></div>
</div>
<div>
<div class="flex items-center gap-1 text-[11px] font-semibold text-slate-500 lowercase">
<span>colegio saint paul</span>
<span>•</span>
<span>2° A</span>
</div>
<h2 class="text-sm font-extrabold text-slate-900 tracking-tight leading-tight lowercase">
hola, mateo 👋
</h2>
</div>
</div>
<!-- CHIP DE SALDO CON GLOW SUAVE -->
<div onclick="showToast('Saldo disponible: ₡14.500')" class="flex flex-col items-end bg-white/80 backdrop-blur-md px-3 py-1.5 rounded-2xl border border-white/90 shadow-xs cursor-pointer active:scale-95 transition-transform">
<span class="text-[10px] uppercase font-bold text-slate-400 tracking-wider">saldo disponible</span>
<span class="text-sm font-extrabold text-slate-900">₡14.500</span>
</div>
</div>
<!-- SELECTOR HORIZONTAL DE DÍAS Y RUTINAS (ESTILO STRUCTURED) -->
<div class="flex items-center gap-2 overflow-x-auto no-scrollbar py-1 mb-4 text-xs font-semibold">
<button class="px-3.5 py-1.5 rounded-full bg-slate-900 text-white shadow-sm shrink-0 lowercase">
hoy, 10 oct
</button>
<button class="px-3.5 py-1.5 rounded-full bg-white/70 hover:bg-white text-slate-700 shrink-0 border border-white/80 lowercase transition-colors">
recreo 1
</button>
<button class="px-3.5 py-1.5 rounded-full bg-white/70 hover:bg-white text-slate-700 shrink-0 border border-white/80 lowercase transition-colors">
almuerzo
</button>
<button class="px-3.5 py-1.5 rounded-full bg-white/70 hover:bg-white text-slate-700 shrink-0 border border-white/80 lowercase transition-colors">
recreo 2
</button>
<button class="px-3.5 py-1.5 rounded-full bg-white/70 hover:bg-white text-slate-700 shrink-0 border border-white/80 lowercase transition-colors">
servicios
</button>
</div>
<!-- ======================================================== -->
<!-- SECCIÓN PROTAGONISTA: EL CARRUSEL ESTILO STRUCTURED EN LA APP -->
<!-- ======================================================== -->
<div class="mb-6">
<div class="flex items-center justify-between mb-2.5 px-1">
<div>
<span class="text-[10px] font-bold tracking-wider uppercase text-sky-800/80">combos & promociones</span>
<h3 class="text-base font-extrabold text-slate-900 tracking-tight lowercase">
destacados del día
</h3>
</div>
<!-- Mini Flechas de Navegación -->
<div class="flex items-center gap-1.5">
<button onclick="scrollCarousel(-1)" class="w-7 h-7 rounded-full bg-white/80 hover:bg-white border border-white flex items-center justify-center text-slate-700 shadow-2xs active:scale-90 transition-all cursor-pointer">
‹
</button>
<button onclick="scrollCarousel(1)" class="w-7 h-7 rounded-full bg-white/80 hover:bg-white border border-white flex items-center justify-center text-slate-700 shadow-2xs active:scale-90 transition-all cursor-pointer">
›
</button>
</div>
</div>
<!-- CONTENEDOR DEL CARRUSEL DE CÁPSULAS CONECTADAS -->
<div class="relative overflow-hidden py-2 -mx-4 px-4 mask-fade">
<div id="appCarouselTrack" class="flex items-center overflow-x-auto no-scrollbar scroll-smooth snap-x snap-mandatory py-1" style="scroll-padding-left: 16px;">
<!-- ================= CARD 1 (PASTEL SKY) ================= -->
<div class="app-card-pill snap-start shrink-0 w-[295px] h-[155px] bg-[#e0f2fe] p-4 flex flex-col justify-between relative cursor-pointer border border-sky-200/50" onclick="selectCard('Combo Recreo Saludable', '1.850')">
<!-- Fila superior -->
<div class="flex items-center justify-between">
<div class="flex items-center gap-2">
<div class="w-8 h-8 rounded-full bg-white/90 shadow-2xs flex items-center justify-center text-lg">
🥪
</div>
<span class="text-[11px] font-bold text-sky-900/80 uppercase tracking-wide">
recreo 1 • 09:30 am
</span>
</div>
<span class="text-[10px] font-extrabold px-2 py-0.5 rounded-full bg-sky-200/70 text-sky-900 lowercase">
popular
</span>
</div>
<!-- Título y descripción -->
<div>
<h4 class="text-sm font-extrabold text-slate-900 tracking-tight leading-snug lowercase">
sandwich artesanal & jugo
</h4>
<p class="text-[11px] text-slate-600 line-clamp-1 font-medium mt-0.5">
jamón de pavo, queso suizo y jugo de naranja
</p>
</div>
<!-- Fila inferior: Precio y Botón Rápido -->
<div class="flex items-center justify-between pt-1">
<div class="flex items-baseline gap-1">
<span class="text-xs font-bold text-slate-400">₡</span>
<span class="text-base font-black text-slate-900 tracking-tight">1.850</span>
</div>
<button onclick="event.stopPropagation(); orderItem('Sandwich & Jugo', '1.850')" class="px-3 py-1 rounded-full bg-slate-900 hover:bg-sky-600 active:scale-95 text-white text-[11px] font-bold transition-all shadow-xs flex items-center gap-1 cursor-pointer">
<span>pre-ordenar</span>
<span>+</span>
</button>
</div>
</div>
<!-- CONECTOR PUZZLE 1 (Sky a Mint) -->
<div class="puzzle-connector">
<svg width="28" height="22" viewBox="0 0 28 22" fill="none">
<!-- Base izquierda (Sky) -->
<path d="M0 0 H12 C12 6, 17 6, 17 11 C17 16, 12 16, 12 22 H0 Z" fill="#e0f2fe"/>
<!-- Cabeza encajada derecha (Mint) -->
<path d="M12 0 H28 V22 H12 C12 16, 17 16, 17 11 C17 6, 12 6, 12 0 Z" fill="#d1fae5"/>
<!-- Línea de junta tipo rompecabezas -->
<path d="M12 0 C12 6, 17 6, 17 11 C17 16, 12 16, 12 22" stroke="rgba(0,0,0,0.06)" stroke-width="1.5" stroke-linecap="round"/>
</svg>
</div>
<!-- ================= CARD 2 (PASTEL MINT) ================= -->
<div class="app-card-pill snap-start shrink-0 w-[295px] h-[155px] bg-[#d1fae5] p-4 flex flex-col justify-between relative cursor-pointer border border-emerald-200/50" onclick="selectCard('Recarga Inmediata SINPE', 'Personalizado')">
<!-- Fila superior -->
<div class="flex items-center justify-between">
<div class="flex items-center gap-2">
<div class="w-8 h-8 rounded-full bg-white/90 shadow-2xs flex items-center justify-center text-lg">
⚡
</div>
<span class="text-[11px] font-bold text-emerald-950/80 uppercase tracking-wide">
sinpe móvil directo
</span>
</div>
<span class="text-[10px] font-extrabold px-2 py-0.5 rounded-full bg-emerald-200/80 text-emerald-900 lowercase">
inmediato
</span>
</div>
<!-- Título y descripción -->
<div>
<h4 class="text-sm font-extrabold text-slate-900 tracking-tight leading-snug lowercase">
recarga de saldo en 1 toque
</h4>
<p class="text-[11px] text-slate-600 line-clamp-1 font-medium mt-0.5">
acreditación sin comisión al número 8888-7777
</p>
</div>
<!-- Fila inferior: Precio y Botón Rápido -->
<div class="flex items-center justify-between pt-1">
<div class="text-[11px] font-extrabold text-emerald-900">
0% comisiones
</div>
<button onclick="event.stopPropagation(); openSinpeModal()" class="px-3 py-1 rounded-full bg-emerald-900 hover:bg-emerald-800 active:scale-95 text-white text-[11px] font-bold transition-all shadow-xs flex items-center gap-1 cursor-pointer">
<span>recargar</span>
<span>⚡</span>
</button>
</div>
</div>
<!-- CONECTOR PUZZLE 2 (Mint a Peach) -->
<div class="puzzle-connector">
<svg width="28" height="22" viewBox="0 0 28 22" fill="none">
<path d="M0 0 H12 C12 6, 17 6, 17 11 C17 16, 12 16, 12 22 H0 Z" fill="#d1fae5"/>
<path d="M12 0 H28 V22 H12 C12 16, 17 16, 17 11 C17 6, 12 6, 12 0 Z" fill="#ffedd5"/>
<path d="M12 0 C12 6, 17 6, 17 11 C17 16, 12 16, 12 22" stroke="rgba(0,0,0,0.06)" stroke-width="1.5" stroke-linecap="round"/>
</svg>
</div>
<!-- ================= CARD 3 (PASTEL PEACH) ================= -->
<div class="app-card-pill snap-start shrink-0 w-[295px] h-[155px] bg-[#ffedd5] p-4 flex flex-col justify-between relative cursor-pointer border border-orange-200/50" onclick="selectCard('Casado Gourmet del Chef', '2.600')">
<!-- Fila superior -->
<div class="flex items-center justify-between">
<div class="flex items-center gap-2">
<div class="w-8 h-8 rounded-full bg-white/90 shadow-2xs flex items-center justify-center text-lg">
🍛
</div>
<span class="text-[11px] font-bold text-orange-950/80 uppercase tracking-wide">
almuerzo • 11:45 am
</span>
</div>
<span class="text-[10px] font-extrabold px-2 py-0.5 rounded-full bg-orange-200/80 text-orange-900 lowercase">
menú chef
</span>
</div>
<!-- Título y descripción -->
<div>
<h4 class="text-sm font-extrabold text-slate-900 tracking-tight leading-snug lowercase">
casado completo con pollo
</h4>
<p class="text-[11px] text-slate-600 line-clamp-1 font-medium mt-0.5">
arroz, frijoles, plátano maduro, ensalada y té frío
</p>
</div>
<!-- Fila inferior: Precio y Botón Rápido -->
<div class="flex items-center justify-between pt-1">
<div class="flex items-baseline gap-1">
<span class="text-xs font-bold text-slate-400">₡</span>
<span class="text-base font-black text-slate-900 tracking-tight">2.600</span>
</div>
<button onclick="event.stopPropagation(); orderItem('Casado Gourmet', '2.600')" class="px-3 py-1 rounded-full bg-orange-950 hover:bg-orange-900 active:scale-95 text-white text-[11px] font-bold transition-all shadow-xs flex items-center gap-1 cursor-pointer">
<span>reservar</span>
<span>+</span>
</button>
</div>
</div>
<!-- CONECTOR PUZZLE 3 (Peach a Lavender) -->
<div class="puzzle-connector">
<svg width="28" height="22" viewBox="0 0 28 22" fill="none">
<path d="M0 0 H12 C12 6, 17 6, 17 11 C17 16, 12 16, 12 22 H0 Z" fill="#ffedd5"/>
<path d="M12 0 H28 V22 H12 C12 16, 17 16, 17 11 C17 6, 12 6, 12 0 Z" fill="#f3e8ff"/>
<path d="M12 0 C12 6, 17 6, 17 11 C17 16, 12 16, 12 22" stroke="rgba(0,0,0,0.06)" stroke-width="1.5" stroke-linecap="round"/>
</svg>
</div>
<!-- ================= CARD 4 (PASTEL LAVENDER) ================= -->
<div class="app-card-pill snap-start shrink-0 w-[295px] h-[155px] bg-[#f3e8ff] p-4 flex flex-col justify-between relative cursor-pointer border border-purple-200/50" onclick="selectCard('Aviso: Viernes de Pizza Artesanal', 'Cupos Limitados')">
<!-- Fila superior -->
<div class="flex items-center justify-between">
<div class="flex items-center gap-2">
<div class="w-8 h-8 rounded-full bg-white/90 shadow-2xs flex items-center justify-center text-lg">
📢
</div>
<span class="text-[11px] font-bold text-purple-950/80 uppercase tracking-wide">
aviso cafeteria
</span>
</div>
<span class="text-[10px] font-extrabold px-2 py-0.5 rounded-full bg-purple-200/80 text-purple-900 lowercase">
especial
</span>
</div>
<!-- Título y descripción -->
<div>
<h4 class="text-sm font-extrabold text-slate-900 tracking-tight leading-snug lowercase">
viernes de pizza horneada
</h4>
<p class="text-[11px] text-slate-600 line-clamp-1 font-medium mt-0.5">
pre-órdenes abiertas hasta el jueves 4:00 pm
</p>
</div>
<!-- Fila inferior: Botón Informativo -->
<div class="flex items-center justify-between pt-1">
<span class="text-[11px] font-bold text-purple-900">
cupos 48/80
</span>
<button onclick="event.stopPropagation(); showToast('Aviso: Puedes apartar tu porción desde la pestaña Menú')" class="px-3 py-1 rounded-full bg-purple-950 hover:bg-purple-900 active:scale-95 text-white text-[11px] font-bold transition-all shadow-xs flex items-center gap-1 cursor-pointer">
<span>ver aviso</span>
<span>›</span>
</button>
</div>
</div>
<!-- CONECTOR PUZZLE 4 (Lavender a Lemon) -->
<div class="puzzle-connector">
<svg width="28" height="22" viewBox="0 0 28 22" fill="none">
<path d="M0 0 H12 C12 6, 17 6, 17 11 C17 16, 12 16, 12 22 H0 Z" fill="#f3e8ff"/>
<path d="M12 0 H28 V22 H12 C12 16, 17 16, 17 11 C17 6, 12 6, 12 0 Z" fill="#fef9c3"/>
<path d="M12 0 C12 6, 17 6, 17 11 C17 16, 12 16, 12 22" stroke="rgba(0,0,0,0.06)" stroke-width="1.5" stroke-linecap="round"/>
</svg>
</div>
<!-- ================= CARD 5 (PASTEL LEMON) ================= -->
<div class="app-card-pill snap-start shrink-0 w-[295px] h-[155px] bg-[#fef9c3] p-4 flex flex-col justify-between relative cursor-pointer border border-amber-200/50" onclick="selectCard('Bowl de Fruta & Granola', '1.200')">
<!-- Fila superior -->
<div class="flex items-center justify-between">
<div class="flex items-center gap-2">
<div class="w-8 h-8 rounded-full bg-white/90 shadow-2xs flex items-center justify-center text-lg">
🍎
</div>
<span class="text-[11px] font-bold text-amber-950/80 uppercase tracking-wide">
snack saludable
</span>
</div>
<span class="text-[10px] font-extrabold px-2 py-0.5 rounded-full bg-amber-200/80 text-amber-950 lowercase">
100% natural
</span>
</div>
<!-- Título y descripción -->
<div>
<h4 class="text-sm font-extrabold text-slate-900 tracking-tight leading-snug lowercase">
bowl de frutas & miel
</h4>
<p class="text-[11px] text-slate-600 line-clamp-1 font-medium mt-0.5">
fresas, banano, piña, yogurt griego y avena
</p>
</div>
<!-- Fila inferior -->
<div class="flex items-center justify-between pt-1">
<div class="flex items-baseline gap-1">
<span class="text-xs font-bold text-slate-400">₡</span>
<span class="text-base font-black text-slate-900 tracking-tight">1.200</span>
</div>
<button onclick="event.stopPropagation(); orderItem('Bowl de Frutas', '1.200')" class="px-3 py-1 rounded-full bg-amber-950 hover:bg-amber-900 active:scale-95 text-white text-[11px] font-bold transition-all shadow-xs flex items-center gap-1 cursor-pointer">
<span>pedir</span>
<span>+</span>
</button>
</div>
</div>
</div>
</div>
<!-- INDICADORES DE PÍLDORA (STRUCTURED DOTS) -->
<div class="flex items-center justify-center gap-1.5 mt-2">
<button onclick="goToSlide(0)" class="carousel-dot w-6 h-1.5 rounded-full bg-slate-900 transition-all cursor-pointer"></button>
<button onclick="goToSlide(1)" class="carousel-dot w-2 h-1.5 rounded-full bg-slate-300 transition-all cursor-pointer"></button>
<button onclick="goToSlide(2)" class="carousel-dot w-2 h-1.5 rounded-full bg-slate-300 transition-all cursor-pointer"></button>
<button onclick="goToSlide(3)" class="carousel-dot w-2 h-1.5 rounded-full bg-slate-300 transition-all cursor-pointer"></button>
<button onclick="goToSlide(4)" class="carousel-dot w-2 h-1.5 rounded-full bg-slate-300 transition-all cursor-pointer"></button>
</div>
</div>
<!-- ======================================================== -->
<!-- DISCOS CIRCULARES DE ACCIÓN RÁPIDA (ESTILO STRUCTURED) -->
<!-- ======================================================== -->
<div class="mb-6">
<div class="flex items-center justify-between mb-3 px-1">
<h3 class="text-xs font-bold text-slate-700 tracking-tight lowercase">
accesos directos
</h3>
<span class="text-[10px] text-slate-400 font-semibold lowercase">toca para abrir</span>
</div>
<div class="grid grid-cols-4 gap-2 text-center">
<!-- Disco 1 -->
<div onclick="openSinpeModal()" class="flex flex-col items-center gap-1.5 cursor-pointer group">
<div class="explore-disk bg-[#d1fae5] flex items-center justify-center text-2xl group-hover:scale-105 transition-transform border border-emerald-200/60">
⚡
</div>
<span class="text-[11px] font-bold text-slate-700 lowercase">recarga</span>
</div>
<!-- Disco 2 -->
<div onclick="showToast('Carné Escolar QR listo para presentar')" class="flex flex-col items-center gap-1.5 cursor-pointer group">
<div class="explore-disk bg-[#e0f2fe] flex items-center justify-center text-2xl group-hover:scale-105 transition-transform border border-sky-200/60">
📱
</div>
<span class="text-[11px] font-bold text-slate-700 lowercase">mi qr</span>
</div>
<!-- Disco 3 -->
<div onclick="showToast('Mostrando menú completo de la soda escolar')" class="flex flex-col items-center gap-1.5 cursor-pointer group">
<div class="explore-disk bg-[#ffedd5] flex items-center justify-center text-2xl group-hover:scale-105 transition-transform border border-orange-200/60">
🥪
</div>
<span class="text-[11px] font-bold text-slate-700 lowercase">menú</span>
</div>
<!-- Disco 4 -->
<div onclick="showToast('Perfil nutricional: Sin alergias registradas')" class="flex flex-col items-center gap-1.5 cursor-pointer group">
<div class="explore-disk bg-[#f3e8ff] flex items-center justify-center text-2xl group-hover:scale-105 transition-transform border border-purple-200/60">
❤️
</div>
<span class="text-[11px] font-bold text-slate-700 lowercase">nutrición</span>
</div>
</div>
</div>
<!-- ======================================================== -->
<!-- AGENDA DEL DÍA: TIMELINE VISUAL EN CÁPSULAS CONECTADAS -->
<!-- ======================================================== -->
<div class="mb-4">
<div class="flex items-center justify-between mb-3 px-1">
<div>
<span class="text-[10px] font-bold tracking-wider uppercase text-slate-400">horario estructurado</span>
<h3 class="text-sm font-extrabold text-slate-900 tracking-tight lowercase">
timeline de hoy
</h3>
</div>
<span class="text-[11px] font-semibold text-sky-800 bg-white/80 px-2 py-0.5 rounded-full border border-sky-100">
4 eventos
</span>
</div>
<!-- Contenedor con línea vertical continua estilo Structured -->
<div class="relative pl-6 space-y-3">
<!-- Línea vertical conectora -->
<div class="absolute left-2.5 top-3 bottom-3 w-0.5 bg-slate-300/70 rounded-full"></div>
<!-- Item 1: Entrada y desayuno -->
<div class="relative timeline-pill bg-white/85 p-3.5 border border-white flex items-center justify-between cursor-pointer">
<div class="absolute -left-6 top-1/2 -translate-y-1/2 w-3.5 h-3.5 rounded-full bg-sky-500 border-2 border-white shadow-xs"></div>
<div class="flex items-center gap-2.5">
<div class="w-8 h-8 rounded-full bg-[#e0f2fe] flex items-center justify-center text-sm">
🥛
</div>
<div>
<h5 class="text-xs font-bold text-slate-900 lowercase leading-tight">desayuno ligero</h5>
<p class="text-[10px] text-slate-500 font-medium">07:15 am • cafetería principal</p>
</div>
</div>
<span class="text-[10px] font-bold px-2 py-0.5 rounded-full bg-slate-100 text-slate-500">completado</span>
</div>
<!-- Item 2: Primer recreo (activo) -->
<div class="relative timeline-pill bg-[#d1fae5]/90 p-3.5 border border-emerald-200/80 flex items-center justify-between cursor-pointer shadow-xs">
<div class="absolute -left-6 top-1/2 -translate-y-1/2 w-3.5 h-3.5 rounded-full bg-emerald-500 border-2 border-white shadow-xs animate-gentle"></div>
<div class="flex items-center gap-2.5">
<div class="w-8 h-8 rounded-full bg-white flex items-center justify-center text-sm shadow-2xs">
🥪
</div>
<div>
<div class="flex items-center gap-1.5">
<h5 class="text-xs font-extrabold text-emerald-950 lowercase leading-tight">primer recreo: retiro combo</h5>
<span class="w-1.5 h-1.5 rounded-full bg-emerald-600 animate-ping"></span>
</div>
<p class="text-[10px] text-emerald-800 font-medium">09:30 am • ventanilla rápida #2</p>
</div>
</div>
<span class="text-[10px] font-black px-2 py-0.5 rounded-full bg-emerald-600 text-white shadow-2xs">en curso</span>
</div>
<!-- Item 3: Almuerzo -->
<div class="relative timeline-pill bg-white/85 p-3.5 border border-white flex items-center justify-between cursor-pointer">
<div class="absolute -left-6 top-1/2 -translate-y-1/2 w-3.5 h-3.5 rounded-full bg-slate-300 border-2 border-white"></div>
<div class="flex items-center gap-2.5">
<div class="w-8 h-8 rounded-full bg-[#ffedd5] flex items-center justify-center text-sm">
🍛
</div>
<div>
<h5 class="text-xs font-bold text-slate-900 lowercase leading-tight">almuerzo en comedor</h5>
<p class="text-[10px] text-slate-500 font-medium">11:45 am • casado con pollo</p>
</div>
</div>
<span class="text-[10px] font-bold px-2 py-0.5 rounded-full bg-orange-100 text-orange-800">reservado</span>
</div>
<!-- Item 4: Segundo Recreo -->
<div class="relative timeline-pill bg-white/85 p-3.5 border border-white flex items-center justify-between cursor-pointer">
<div class="absolute -left-6 top-1/2 -translate-y-1/2 w-3.5 h-3.5 rounded-full bg-slate-300 border-2 border-white"></div>
<div class="flex items-center gap-2.5">
<div class="w-8 h-8 rounded-full bg-[#f3e8ff] flex items-center justify-center text-sm">
🍎
</div>
<div>
<h5 class="text-xs font-bold text-slate-900 lowercase leading-tight">segundo recreo: snack</h5>
<p class="text-[10px] text-slate-500 font-medium">01:45 pm • bowl de frutas</p>
</div>
</div>
<span class="text-[10px] font-bold px-2 py-0.5 rounded-full bg-purple-100 text-purple-800">pendiente</span>
</div>
</div>
</div>
</div>
<!-- BARRA INFERIOR FLOTANTE LIQUID GLASS (BOTTOM DOCK) -->
<div class="absolute bottom-3 left-4 right-4 z-40">
<div class="bg-white/80 backdrop-blur-2xl px-5 py-2.5 rounded-full border border-white/90 shadow-[0_10px_25px_-5px_rgba(0,0,0,0.1)] flex items-center justify-between">
<!-- Tab Inicio (Activo) -->
<button class="flex flex-col items-center gap-0.5 text-sky-800 cursor-pointer">
<div class="w-5 h-5 flex items-center justify-center font-bold">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"/></svg>
</div>
<span class="text-[9px] font-extrabold lowercase">inicio</span>
</button>
<!-- Tab Menú -->
<button onclick="showToast('Sección Menú y Pedidos')" class="flex flex-col items-center gap-0.5 text-slate-400 hover:text-slate-800 cursor-pointer transition-colors">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h7"/></svg>
<span class="text-[9px] font-semibold lowercase">menú</span>
</button>
<!-- Botón Central Destacado (Pagar QR) -->
<button onclick="showToast('Activando lector QR para pagar en caja')" class="w-11 h-11 -mt-5 rounded-full bg-slate-900 hover:bg-sky-600 text-white flex items-center justify-center shadow-lg active:scale-90 transition-all cursor-pointer">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v1m6 11h2m-6 0h-2v4m0-11v3m0 0h.01M12 12h4.01M16 20h4M4 12h4m12 0h.01M5 8h2a1 1 0 001-1V5a1 1 0 00-1-1H5a1 1 0 00-1 1v2a1 1 0 001 1zm12 0h2a1 1 0 001-1V5a1 1 0 00-1-1h-2a1 1 0 00-1 1v2a1 1 0 001 1zM5 20h2a1 1 0 001-1v-2a1 1 0 00-1-1H5a1 1 0 00-1 1v2a1 1 0 001 1z"/></svg>
</button>
<!-- Tab Agenda -->
<button onclick="showToast('Vista de Timeline completo')" class="flex flex-col items-center gap-0.5 text-slate-400 hover:text-slate-800 cursor-pointer transition-colors">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"/></svg>
<span class="text-[9px] font-semibold lowercase">agenda</span>
</button>
<!-- Tab Perfil -->
<button onclick="showToast('Perfil y ajustes de cuenta')" class="flex flex-col items-center gap-0.5 text-slate-400 hover:text-slate-800 cursor-pointer transition-colors">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/></svg>
<span class="text-[9px] font-semibold lowercase">perfil</span>
</button>
</div>
</div>
<!-- HOME INDICATOR (BARRA INFERIOR DE IPHONE) -->
<div class="absolute bottom-1 left-1/2 -translate-x-1/2 w-32 h-1 bg-slate-900/40 rounded-full z-50 pointer-events-none"></div>
<!-- TOAST FLOTANTE IN-APP -->
<div id="inAppToast" class="absolute top-16 left-6 right-6 z-50 bg-slate-900/90 backdrop-blur-md text-white px-4 py-2.5 rounded-2xl text-xs font-semibold shadow-xl flex items-center justify-between transition-all duration-300 opacity-0 -translate-y-4 pointer-events-none">
<span id="inAppToastText">¡Pre-orden agregada con éxito!</span>
<span class="text-emerald-400">✓</span>
</div>
</div>
</div>
<!-- PANEL LATERAL EXPLICATIVO Y DETALLES DE DISEÑO -->
<div class="w-full max-w-md flex flex-col gap-5">
<!-- TARJETA EXPLICATIVA DE CÓMO SE ADAPTÓ STRUCTURED A LA APP -->
<div class="bg-white/80 backdrop-blur-xl p-6 rounded-3xl border border-white/90 shadow-sm">
<div class="inline-flex items-center gap-2 px-3 py-1 rounded-full bg-sky-100 text-sky-800 text-[11px] font-bold mb-3">
<span>✨ Claves del Diseño Structured en la App</span>
</div>
<h3 class="text-xl font-extrabold text-slate-900 tracking-tight lowercase mb-2">
¿por qué se ve exactamente como structured?
</h3>
<p class="text-sm text-slate-600 font-medium mb-4 leading-relaxed">
Structured destaca por tres elementos gráficos inconfundibles que fueron trasladados a la escala real de una pantalla móvil (390px):
</p>
<div class="space-y-3 text-xs">
<!-- Punto 1 -->
<div class="flex items-start gap-3 p-3 rounded-2xl bg-sky-50/70 border border-sky-100">
<span class="text-lg">🧩</span>
<div>
<strong class="text-slate-900 font-bold block lowercase">1. conectores de rompecabezas vectoriales</strong>
<p class="text-slate-600 mt-0.5">En lugar de tarjetas sueltas, cada cápsula se encaja con la siguiente mediante juntas de rompecabezas con colores que coinciden exactamente con ambas tarjetas.</p>
</div>
</div>
<!-- Punto 2 -->
<div class="flex items-start gap-3 p-3 rounded-2xl bg-emerald-50/70 border border-emerald-100">
<span class="text-lg">🎨</span>
<div>
<strong class="text-slate-900 font-bold block lowercase">2. paleta pastel de alto contraste</strong>
<p class="text-slate-600 mt-0.5">Cielo SiboPay (<code class="bg-white px-1 py-0.5 rounded text-[10px]">#e0f2fe</code>), Menta (<code class="bg-white px-1 py-0.5 rounded text-[10px]">#d1fae5</code>), Melocotón (<code class="bg-white px-1 py-0.5 rounded text-[10px]">#ffedd5</code>) y Lavanda con texto legible y oscuro.</p>
</div>
</div>
<!-- Punto 3 -->
<div class="flex items-start gap-3 p-3 rounded-2xl bg-orange-50/70 border border-orange-100">
<span class="text-lg">📱</span>
<div>
<strong class="text-slate-900 font-bold block lowercase">3. snap swipe + micro-interacciones</strong>
<p class="text-slate-600 mt-0.5">El usuario puede deslizar con el dedo en el móvil (touch snap) y cada combo se pre-ordena con un solo toque, sincronizado con el timeline escolar del día.</p>
</div>
</div>
</div>
</div>
<!-- TARJETA DE PRUEBA INTERACTIVA RÁPIDA -->
<div class="bg-white/80 backdrop-blur-xl p-5 rounded-3xl border border-white/90 shadow-sm flex flex-col gap-3">
<h4 class="text-xs font-bold text-slate-400 uppercase tracking-wider">
acciones interactivas para probar ahora
</h4>
<div class="grid grid-cols-2 gap-2 text-xs font-bold">
<button onclick="orderItem('Sandwich de Pavo', '1.850')" class="p-2.5 rounded-2xl bg-sky-500 hover:bg-sky-600 text-white transition-all shadow-xs cursor-pointer text-center">
🥪 Pre-ordenar Combo
</button>
<button onclick="openSinpeModal()" class="p-2.5 rounded-2xl bg-emerald-600 hover:bg-emerald-700 text-white transition-all shadow-xs cursor-pointer text-center">
⚡ Simular Recarga
</button>
<button onclick="scrollCarousel(1)" class="p-2.5 rounded-2xl bg-slate-900 hover:bg-slate-800 text-white transition-all shadow-xs cursor-pointer text-center">
› Siguiente Cápsula
</button>
<button onclick="toggleAutoFlow()" class="p-2.5 rounded-2xl bg-amber-500 hover:bg-amber-600 text-white transition-all shadow-xs cursor-pointer text-center">
🔄 Desplazamiento
</button>
</div>
</div>
</div>
</main>
<!-- MODAL DE SIMULACIÓN SINPE DENTRO DE LA EXPERIENCIA -->
<div id="sinpeModal" class="fixed inset-0 z-50 bg-black/40 backdrop-blur-xs flex items-center justify-center p-4 opacity-0 pointer-events-none transition-opacity duration-300">
<div class="bg-white rounded-3xl p-6 max-w-sm w-full shadow-2xl border border-slate-100 flex flex-col items-center text-center">
<div class="w-14 h-14 rounded-full bg-[#d1fae5] text-emerald-700 flex items-center justify-center text-2xl mb-3 shadow-inner">
⚡
</div>
<h3 class="text-lg font-black text-slate-900 tracking-tight lowercase">recarga rápida sinpe móvil</h3>
<p class="text-xs text-slate-500 font-medium mt-1 mb-4">Envía tu comprobante al <strong class="text-slate-800">8888-7777</strong> o digita el monto a abonar a la cuenta de Mateo.</p>
<div class="w-full flex items-center justify-center gap-2 mb-4">
<button onclick="executeReload(2000)" class="flex-1 py-2 rounded-2xl bg-slate-100 hover:bg-emerald-100 text-xs font-bold text-slate-800 transition-colors">₡2.000</button>
<button onclick="executeReload(5000)" class="flex-1 py-2 rounded-2xl bg-slate-100 hover:bg-emerald-100 text-xs font-bold text-slate-800 transition-colors">₡5.000</button>
<button onclick="executeReload(10000)" class="flex-1 py-2 rounded-2xl bg-slate-100 hover:bg-emerald-100 text-xs font-bold text-slate-800 transition-colors">₡10.000</button>
</div>
<div class="w-full flex items-center gap-2">
<button onclick="closeSinpeModal()" class="flex-1 py-2.5 rounded-full bg-slate-100 text-slate-700 text-xs font-bold hover:bg-slate-200 transition-colors cursor-pointer">
Cancelar
</button>
<button onclick="executeReload(5000)" class="flex-1 py-2.5 rounded-full bg-emerald-600 text-white text-xs font-bold hover:bg-emerald-700 transition-colors shadow-sm cursor-pointer">
Acreditar ya
</button>
</div>
</div>
</div>
<!-- JAVASCRIPT INTERACTIVO -->
<script>
const carouselTrack = document.getElementById('appCarouselTrack');
const dots = document.querySelectorAll('.carousel-dot');
let autoFlowInterval = null;
let isAutoFlowing = false;
// Cambiar color de fondo general y de la app
function setTheme(appBg, bodyBg) {
document.getElementById('appScreen').style.backgroundColor = appBg;
document.getElementById('mainBody').style.backgroundColor = bodyBg;
}
// Navegación con mini flechas
function scrollCarousel(direction) {
const cardWidth = 323; // Ancho tarjeta + conector
carouselTrack.scrollBy({ left: direction * cardWidth, behavior: 'smooth' });
setTimeout(updateActiveDot, 300);
}
function goToSlide(index) {
const cardWidth = 323;
carouselTrack.scrollTo({ left: index * cardWidth, behavior: 'smooth' });
updateDots(index);
}
// Actualizar indicador activo
function updateActiveDot() {
const scrollPos = carouselTrack.scrollLeft;
const cardWidth = 323;
const activeIndex = Math.min(4, Math.max(0, Math.round(scrollPos / cardWidth)));
updateDots(activeIndex);
}
function updateDots(activeIndex) {
dots.forEach((dot, idx) => {
if (idx === activeIndex) {
dot.classList.remove('w-2', 'bg-slate-300');
dot.classList.add('w-6', 'bg-slate-900');
} else {
dot.classList.remove('w-6', 'bg-slate-900');
dot.classList.add('w-2', 'bg-slate-300');
}
});
}
carouselTrack.addEventListener('scroll', () => {
clearTimeout(window.scrollTimeout);
window.scrollTimeout = setTimeout(updateActiveDot, 100);
});
// Activar o desactivar flujo automático
function toggleAutoFlow() {
const btn = document.getElementById('btnAutoplay');
const icon = document.getElementById('autoplayIcon');
const text = document.getElementById('autoplayText');
if (isAutoFlowing) {
clearInterval(autoFlowInterval);
isAutoFlowing = false;
icon.textContent = '▶';
text.textContent = 'Flujo Continuo';
btn.classList.remove('bg-emerald-100', 'text-emerald-900');
btn.classList.add('bg-white', 'text-slate-700');
} else {
isAutoFlowing = true;
icon.textContent = '⏸';
text.textContent = 'Pausar Flujo';
btn.classList.remove('bg-white', 'text-slate-700');
btn.classList.add('bg-emerald-100', 'text-emerald-900');
autoFlowInterval = setInterval(() => {
const maxScroll = carouselTrack.scrollWidth - carouselTrack.clientWidth;
if (carouselTrack.scrollLeft >= maxScroll - 10) {
carouselTrack.scrollTo({ left: 0, behavior: 'smooth' });
} else {
scrollCarousel(1);
}
}, 3200);
}
}
// Mostrar Toast dentro de la pantalla del móvil
function showToast(message) {
const toast = document.getElementById('inAppToast');
const text = document.getElementById('inAppToastText');
text.textContent = message;
toast.classList.remove('opacity-0', '-translate-y-4', 'pointer-events-none');
toast.classList.add('opacity-100', 'translate-y-0');
clearTimeout(window.toastTimer);
window.toastTimer = setTimeout(() => {
toast.classList.remove('opacity-100', 'translate-y-0');
toast.classList.add('opacity-0', '-translate-y-4', 'pointer-events-none');
}, 2600);
}
function orderItem(name, price) {
showToast(`¡Pre-orden: ${name} (₡${price}) agendada para el recreo!`);
}
function selectCard(title, price) {
showToast(`Detalle: ${title} • ₡${price}`);
}
// Modal de SINPE Móvil
function openSinpeModal() {
const modal = document.getElementById('sinpeModal');
modal.classList.remove('opacity-0', 'pointer-events-none');
modal.classList.add('opacity-100');
}
function closeSinpeModal() {
const modal = document.getElementById('sinpeModal');
modal.classList.remove('opacity-100');
modal.classList.add('opacity-0', 'pointer-events-none');
}
function executeReload(amount) {
closeSinpeModal();
showToast(`¡Recarga de ₡${amount.toLocaleString()} aplicada con éxito!`);
}
// Modo de Vista: Teléfono vs Zoom de Componente
function setViewMode(mode) {
const frame = document.getElementById('phoneFrame');
const btnPhone = document.getElementById('btnViewPhone');
const btnComp = document.getElementById('btnViewComponent');
if (mode === 'component') {
frame.classList.remove('w-[390px]', 'h-[812px]', 'rounded-[52px]', 'p-3');
frame.classList.add('w-full', 'max-w-xl', 'h-[640px]', 'rounded-3xl', 'p-1', 'scale-105');
btnComp.classList.add('bg-white', 'text-slate-800', 'shadow-xs');
btnComp.classList.remove('text-slate-500');
btnPhone.classList.remove('bg-white', 'text-slate-800', 'shadow-xs');
btnPhone.classList.add('text-slate-500');
} else {
frame.classList.add('w-[390px]', 'h-[812px]', 'rounded-[52px]', 'p-3');
frame.classList.remove('w-full', 'max-w-xl', 'h-[640px]', 'rounded-3xl', 'p-1', 'scale-105');
btnPhone.classList.add('bg-white', 'text-slate-800', 'shadow-xs');
btnPhone.classList.remove('text-slate-500');
btnComp.classList.remove('bg-white', 'text-slate-800', 'shadow-xs');
btnComp.classList.add('text-slate-500');
}
}
</script>
</body>
</html>
+47
View File
@@ -2680,6 +2680,53 @@ body.dark-mode .floating-cart-bar {
box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}
/* Envoltorio para alternar visualización de contraseñas */
.password-input-wrapper {
position: relative;
display: flex;
align-items: center;
width: 100%;
}
.password-input-wrapper input {
padding-right: 44px !important;
}
.btn-toggle-password {
position: absolute;
right: 6px;
top: 50%;
transform: translateY(-50%);
background: none;
border: none;
padding: 8px;
cursor: pointer;
color: #64748b;
display: flex;
align-items: center;
justify-content: center;
border-radius: 8px;
transition: all 0.15s ease;
z-index: 2;
}
.btn-toggle-password:hover,
.btn-toggle-password:focus-visible {
color: #0284c7;
background: rgba(2, 132, 199, 0.1);
outline: none;
}
body.dark-mode .btn-toggle-password {
color: #94a3b8;
}
body.dark-mode .btn-toggle-password:hover,
body.dark-mode .btn-toggle-password:focus-visible {
color: #38bdf8;
background: rgba(56, 189, 248, 0.15);
}
.login-submit-btn {
width: 100%;
padding: 13px;
+5 -2
View File
@@ -616,21 +616,24 @@
<span class="text-lg font-black text-white">Sibo<span class="text-sky-500">Pay</span></span>
<span class="text-[10px] bg-slate-800 text-slate-300 px-2 py-0.5 rounded-full ml-2">Costa Rica 🇨🇷</span>
</div>
<div class="flex items-center gap-6 font-bold text-slate-300">
<div class="flex items-center gap-6 font-bold text-slate-300 flex-wrap justify-center">
<a href="#sodas" class="hover:text-white transition">Sodas</a>
<a href="#familias" class="hover:text-white transition">Familias</a>
<a href="#mep" class="hover:text-white transition">Normativa MEP</a>
<button onclick="window.location.href='/app'" class="hover:text-white transition cursor-pointer">Iniciar Sesión</button>
<a href="/carnet.html" target="_blank" class="hover:text-white transition">Carnés QR</a>
<a href="/eliminar-cuenta" class="hover:text-white transition">Eliminar Cuenta</a>
</div>
</div>
<div class="flex flex-col sm:flex-row items-center justify-between gap-4 pt-6 text-[11px] text-slate-500">
<p>© 2026 SiboPay Costa Rica. Sistema inteligente de billetera online.</p>
<div class="flex items-center gap-4">
<div class="flex items-center gap-4 flex-wrap justify-center sm:justify-end">
<a href="/terminos" class="hover:text-slate-300 transition underline-offset-2 hover:underline">Términos y Condiciones</a>
<span>•</span>
<a href="/privacidad" class="hover:text-slate-300 transition underline-offset-2 hover:underline">Política de Privacidad</a>
<span>•</span>
<a href="/eliminar-cuenta" class="hover:text-slate-300 transition underline-offset-2 hover:underline text-rose-400">Eliminación de Cuenta</a>
<span>•</span>
<span>SINPE Móvil 🇨🇷</span>
</div>
</div>
+400 -31
View File
@@ -11,15 +11,32 @@
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="apple-mobile-web-app-title" content="SiboPay">
<link rel="preload" href="/css/styles.css?v=19.9" as="style">
<link rel="preload" href="/js/app.js?v=20.5" as="script">
<link rel="stylesheet" href="/css/styles.css?v=19.9">
<link rel="preload" href="/css/styles.css?v=20.0" as="style">
<link rel="preload" href="/js/app.js?v=20.9" as="script">
<link rel="stylesheet" href="/css/styles.css?v=20.0">
<link rel="stylesheet" href="/css/desktop.css?v=2.2">
<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>
<script>
function togglePasswordVisibility(inputId, btn) {
var input = document.getElementById(inputId);
if (!input) return;
var isPassword = input.type === 'password';
input.type = isPassword ? 'text' : 'password';
if (btn) {
btn.title = isPassword ? 'Ocultar contraseña' : 'Ver contraseña';
btn.setAttribute('aria-label', btn.title);
btn.style.color = isPassword ? '#0284c7' : '';
btn.innerHTML = isPassword
? '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9.88 9.88a3 3 0 1 0 4.24 4.24"/><path d="M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"/><path d="M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"/><line x1="2" x2="22" y1="2" y2="22"/></svg>'
: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg>';
}
}
window.togglePasswordVisibility = togglePasswordVisibility;
</script>
</head>
<body class="">
@@ -51,9 +68,11 @@
<p class="splash-disclaimer">
Al iniciar sesión y registrarse, acepta nuestros
<a href="/terminos" target="_blank" rel="noopener noreferrer">Términos y Condiciones</a>
y nuestra
<a href="/privacidad" target="_blank" rel="noopener noreferrer">Política de Privacidad</a>.
<a href="/terminos" target="_blank" rel="noopener noreferrer">Términos y Condiciones</a>,
nuestra
<a href="/privacidad" target="_blank" rel="noopener noreferrer">Política de Privacidad</a>
y
<a href="/eliminar-cuenta" target="_blank" rel="noopener noreferrer">Eliminación de Cuenta</a>.
</p>
</div>
</div>
@@ -79,9 +98,18 @@
<input type="text" id="loginUsername" class="login-input" placeholder="Ej: padre, carlos_papa, 8888-1122 o mateo" required autocomplete="username">
</div>
<div class="login-form-group">
<div class="login-form-group" style="margin-bottom: 8px;">
<label id="lblLoginPass" for="loginPassword">Contraseña o PIN:</label>
<input type="password" id="loginPassword" class="login-input" placeholder="••••••••" required autocomplete="current-password">
<div class="password-input-wrapper">
<input type="password" id="loginPassword" class="login-input" placeholder="••••••••" required autocomplete="current-password">
<button type="button" class="btn-toggle-password" onclick="togglePasswordVisibility('loginPassword', this)" title="Ver contraseña" aria-label="Ver contraseña">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg>
</button>
</div>
</div>
<div style="display: flex; justify-content: flex-end; margin-top: -2px; margin-bottom: 14px;">
<button type="button" onclick="switchSheetView('forgot')" style="background: none; border: none; color: #0284c7; font-weight: 700; cursor: pointer; text-decoration: underline; font-size: 0.8rem; padding: 0;">¿Olvidaste tu contraseña?</button>
</div>
<div id="loginErrorMsg" style="display: none; background: #fee2e2; border: 1px solid #fca5a5; color: #991b1b; padding: 9px 12px; border-radius: 10px; font-size: 0.82rem; font-weight: 700; margin-bottom: 12px; text-align: center;"></div>
@@ -95,7 +123,7 @@
<div style="text-align: center; margin-top: 14px;">
<p style="font-size: 0.82rem; color: #64748b; margin: 0;">
¿Aún no tienes cuenta?
<button type="button" onclick="switchSheetView('register')" style="background: none; border: none; color: #0284c7; font-weight: 800; cursor: pointer; text-decoration: underline; font-size: 0.82rem; padding: 0;">Regístrate como Padre aquí</button>
<button type="button" onclick="switchSheetView('register')" style="background: none; border: none; color: #0284c7; font-weight: 800; cursor: pointer; text-decoration: underline; font-size: 0.82rem; padding: 0;">Regístrate aquí</button>
</p>
</div>
@@ -127,9 +155,51 @@
</details>
</div>
<!-- CONTENIDO 2: REGISTRO DE PADRES -->
<!-- CONTENIDO 2: MODAL DE SELECCIÓN DE TIPO DE REGISTRO -->
<div id="sheetContentRegisterChoose" style="display: none; padding: 4px 0 8px;">
<div style="text-align: center; margin-bottom: 18px;">
<h4 style="margin: 0 0 6px; font-size: 1.15rem; font-weight: 800; color: #0f172a;">¿Cómo deseas registrarte?</h4>
<p style="margin: 0; font-size: 0.82rem; color: #64748b;">Elige tu perfil para continuar con el registro</p>
</div>
<div style="display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px;">
<!-- BOTÓN 1: PADRE DE FAMILIA -->
<button type="button" onclick="selectRegisterType('padre')" style="display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 16px; border: 2px solid #bae6fd; background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%); cursor: pointer; text-align: left; transition: all 0.2s ease; box-shadow: 0 2px 8px rgba(2, 132, 199, 0.08); width: 100%;">
<div style="width: 48px; height: 48px; border-radius: 12px; background: white; border: 1.5px solid #7dd3fc; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0; box-shadow: 0 2px 6px rgba(0,0,0,0.04);">
👨‍👩‍👧
</div>
<div style="flex: 1;">
<strong style="display: block; font-size: 1rem; font-weight: 800; color: #0369a1; margin-bottom: 2px;">Padre de familia</strong>
<span style="display: block; font-size: 0.76rem; color: #475569; line-height: 1.35;">Crea tu cuenta para vincular a tus hijos y recargarles saldo en SINPE Móvil.</span>
</div>
<div style="color: #0284c7; font-weight: 800; font-size: 1.3rem;">›</div>
</button>
<!-- BOTÓN 2: ALUMNO GENERAL -->
<button type="button" onclick="selectRegisterType('alumno')" style="display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 16px; border: 2px solid #e2e8f0; background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%); cursor: pointer; text-align: left; transition: all 0.2s ease; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); width: 100%;">
<div style="width: 48px; height: 48px; border-radius: 12px; background: #f1f5f9; border: 1.5px solid #cbd5e1; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0;">
🎓
</div>
<div style="flex: 1;">
<strong style="display: block; font-size: 1rem; font-weight: 800; color: #1e293b; margin-bottom: 2px;">Alumno general</strong>
<span style="display: block; font-size: 0.76rem; color: #64748b; line-height: 1.35;">Para estudiantes y compras personales en la soda estudiantil.</span>
</div>
<div style="color: #94a3b8; font-weight: 800; font-size: 1.3rem;">›</div>
</button>
</div>
<div style="text-align: center; border-top: 1px solid #f1f5f9; padding-top: 14px;">
<p style="font-size: 0.82rem; color: #64748b; margin: 0;">
¿Ya tienes cuenta registrada?
<button type="button" onclick="switchSheetView('login')" style="background: none; border: none; color: #0284c7; font-weight: 800; cursor: pointer; text-decoration: underline; font-size: 0.82rem; padding: 0;">Inicia sesión aquí</button>
</p>
</div>
</div>
<!-- CONTENIDO 2.1: FORMULARIO DE REGISTRO (PADRE O ALUMNO) -->
<div id="sheetContentRegister" style="display: none;">
<div style="background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%); border: 1.5px solid #bae6fd; border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; display: flex; align-items: center; gap: 10px;">
<!-- BANNER PADRE (visible solo para rol padre) -->
<div id="bannerPadreRegister" style="background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%); border: 1.5px solid #bae6fd; border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; display: flex; align-items: center; gap: 10px;">
<div style="width: 36px; height: 36px; border-radius: 10px; background: white; border: 1px solid #bae6fd; display: flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 4px;">
<img src="/img/sibopay-emblem.png" alt="SiboPay" style="width: 100%; height: 100%; object-fit: contain;">
</div>
@@ -139,20 +209,38 @@
</div>
</div>
<!-- BANNER ALUMNO (visible solo para rol alumno) -->
<div id="bannerAlumnoRegister" style="display: none; background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%); border: 1.5px solid #e2e8f0; border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; align-items: center; gap: 10px;">
<div style="width: 36px; height: 36px; border-radius: 10px; background: white; border: 1px solid #cbd5e1; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 1.25rem;">
🎓
</div>
<div>
<strong style="color: #1e293b; font-size: 0.86rem; display: block; font-weight: 800;">Registro de Alumno General</strong>
<span style="font-size: 0.72rem; color: #64748b; display: block;">Crea tu cuenta personal para acceder a tu carné y monedero digital.</span>
</div>
</div>
<form id="formRegisterPadre" onsubmit="handleRegisterPadreSubmit(event)">
<input type="hidden" id="regTargetRol" value="padre">
<div class="login-form-group">
<label for="regNombre">Nombre y Apellidos:</label>
<input type="text" id="regNombre" class="login-input" placeholder="Ej: Carlos Alvarado Castro" required autocomplete="name">
</div>
<div class="login-form-group">
<label for="regFechaNacimiento">Fecha de Nacimiento:</label>
<input type="date" id="regFechaNacimiento" class="login-input" required>
</div>
<div class="login-form-group">
<label for="regTelefono">Teléfono o Celular (para SINPE):</label>
<input type="tel" id="regTelefono" class="login-input" placeholder="Ej: 8888-1122" required autocomplete="tel">
</div>
<div class="login-form-group">
<label for="regEmail">Correo Electrónico <span style="font-size: 0.72rem; color: #64748b;">(Opcional)</span>:</label>
<input type="email" id="regEmail" class="login-input" placeholder="Ej: [email protected]" autocomplete="email">
<label for="regEmail">Correo Electrónico:</label>
<input type="email" id="regEmail" class="login-input" placeholder="Ej: [email protected]" required autocomplete="email">
</div>
<div class="login-form-group">
@@ -162,22 +250,96 @@
<div class="login-form-group">
<label for="regPassword">Contraseña:</label>
<input type="password" id="regPassword" class="login-input" placeholder="Mínimo 4 caracteres" required autocomplete="new-password">
<div class="password-input-wrapper">
<input type="password" id="regPassword" class="login-input" placeholder="Mínimo 6 caracteres" minlength="6" required autocomplete="new-password">
<button type="button" class="btn-toggle-password" onclick="togglePasswordVisibility('regPassword', this)" title="Ver contraseña" aria-label="Ver contraseña">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg>
</button>
</div>
</div>
<div id="registerErrorMsg" style="display: none; background: #fee2e2; border: 1px solid #fca5a5; color: #991b1b; padding: 8px 12px; border-radius: 10px; font-size: 0.8rem; font-weight: 700; margin-bottom: 12px; text-align: center;"></div>
<button type="submit" id="btnRegisterSubmit" class="login-submit-btn" style="display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 48px; border-radius: 12px; font-weight: 800; font-size: 1rem; background: linear-gradient(135deg, #0284c7, #0369a1); color: white; border: none; cursor: pointer; box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="9" cy="7" r="3.5"/><path d="M3 20v-1.5A4.5 4.5 0 0 1 7.5 14h3A4.5 4.5 0 0 1 15 18.5V20"/><circle cx="17.5" cy="7.5" r="2.5"/><path d="M15 14a3.5 3.5 0 0 1 5.5 3v3"/></svg>
<span>Crear Cuenta de Padre y Entrar</span>
<span id="lblBtnRegisterSubmit">Crear Cuenta y Entrar</span>
</button>
</form>
<div style="display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: 0.82rem;">
<button type="button" onclick="switchSheetView('register-choose')" style="background: none; border: none; color: #0284c7; font-weight: 700; cursor: pointer; text-decoration: underline; padding: 0;">← Cambiar tipo de cuenta</button>
<button type="button" onclick="switchSheetView('login')" style="background: none; border: none; color: #64748b; font-weight: 700; cursor: pointer; text-decoration: underline; padding: 0;">Iniciar sesión</button>
</div>
</div>
<!-- CONTENIDO 3: RESTABLECER CONTRASEÑA -->
<div id="sheetContentForgot" style="display: none;">
<div style="background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%); border: 1.5px solid #bae6fd; border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; display: flex; align-items: center; gap: 10px;">
<div style="width: 36px; height: 36px; border-radius: 10px; background: white; border: 1px solid #bae6fd; display: flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 4px;">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#0284c7" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>
</div>
<div>
<strong style="color: #0369a1; font-size: 0.86rem; display: block; font-weight: 800;">Restablecer Contraseña</strong>
<span style="font-size: 0.72rem; color: #475569; display: block;">Te enviaremos un código de seguridad a tu correo para crear una nueva clave.</span>
</div>
</div>
<!-- PASO 1: ENVIAR CÓDIGO AL CORREO -->
<div id="forgotStep1">
<form id="formForgotRequest" onsubmit="handleForgotRequestSubmit(event)">
<div class="login-form-group">
<label for="forgotEmail">Correo Electrónico Registrado:</label>
<input type="email" id="forgotEmail" class="login-input" placeholder="Ej: [email protected]" required autocomplete="email">
</div>
<div id="forgotMsgStep1" style="display: none; padding: 9px 12px; border-radius: 10px; font-size: 0.82rem; font-weight: 700; margin-bottom: 12px; text-align: center;"></div>
<button type="submit" id="btnForgotSendCode" class="login-submit-btn" style="display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 48px; border-radius: 12px; font-weight: 800; font-size: 1rem; background: linear-gradient(135deg, #0284c7, #0369a1); color: white; border: none; cursor: pointer; box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 2L11 13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/></svg>
<span id="lblBtnForgotSend">Enviar Código al Correo</span>
</button>
</form>
</div>
<!-- PASO 2: INGRESAR CÓDIGO Y NUEVA CONTRASEÑA -->
<div id="forgotStep2" style="display: none;">
<form id="formForgotConfirm" onsubmit="handleForgotConfirmSubmit(event)">
<div class="login-form-group">
<label for="forgotCode">Código de Verificación (6 dígitos):</label>
<input type="text" id="forgotCode" class="login-input" placeholder="Ej: 123456" maxlength="6" pattern="[0-9]{6}" required style="letter-spacing: 4px; font-size: 1.15rem; text-align: center; font-weight: 800;">
</div>
<div class="login-form-group">
<label for="forgotNewPass">Nueva Contraseña:</label>
<div class="password-input-wrapper">
<input type="password" id="forgotNewPass" class="login-input" placeholder="Mínimo 6 caracteres" minlength="6" required autocomplete="new-password">
<button type="button" class="btn-toggle-password" onclick="togglePasswordVisibility('forgotNewPass', this)" title="Ver contraseña" aria-label="Ver contraseña">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg>
</button>
</div>
</div>
<div class="login-form-group">
<label for="forgotConfirmPass">Confirmar Nueva Contraseña:</label>
<div class="password-input-wrapper">
<input type="password" id="forgotConfirmPass" class="login-input" placeholder="Repite la contraseña" minlength="6" required autocomplete="new-password">
<button type="button" class="btn-toggle-password" onclick="togglePasswordVisibility('forgotConfirmPass', this)" title="Ver contraseña" aria-label="Ver contraseña">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg>
</button>
</div>
</div>
<div id="forgotMsgStep2" style="display: none; padding: 9px 12px; border-radius: 10px; font-size: 0.82rem; font-weight: 700; margin-bottom: 12px; text-align: center;"></div>
<button type="submit" id="btnForgotResetPass" class="login-submit-btn" style="display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 48px; border-radius: 12px; font-weight: 800; font-size: 1rem; background: linear-gradient(135deg, #10b981, #059669); color: white; border: none; cursor: pointer; box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>
<span id="lblBtnForgotReset">Cambiar Contraseña y Entrar</span>
</button>
</form>
</div>
<div style="text-align: center; margin-top: 14px;">
<p style="font-size: 0.82rem; color: #64748b; margin: 0;">
¿Ya tienes cuenta registrada?
<button type="button" onclick="switchSheetView('login')" style="background: none; border: none; color: #0284c7; font-weight: 800; cursor: pointer; text-decoration: underline; font-size: 0.82rem; padding: 0;">Inicia sesión aquí</button>
</p>
<button type="button" onclick="switchSheetView('login')" style="background: none; border: none; color: #0284c7; font-weight: 800; cursor: pointer; text-decoration: underline; font-size: 0.82rem; padding: 0;">← Volver a Iniciar Sesión</button>
</div>
</div>
</div>
@@ -3089,14 +3251,34 @@
</div>
</section>
<!-- BANNER DE LÍMITE DIARIO Y DISPONIBILIDAD (SÓLO LECTURA INFORMATIVA PARA EL ESTUDIANTE) -->
<div class="daily-limit-badge" id="dailyLimitBadge" style="cursor: default;" title="Límite diario establecido por tus padres">
<div>
<span>Límite diario fijado: </span>
<strong id="dailyLimitText">₡0</strong>
<!-- ACCIONES RÁPIDAS DEL MONEDERO DEL ESTUDIANTE (AUTORECARGA SINPE Y PRESUPUESTO) -->
<div class="wallet-student-quick-actions" id="walletStudentQuickActions" style="display: flex; gap: 8px; margin: 0 auto 12px auto; max-width: 440px; width: calc(100% - 24px); box-sizing: border-box;">
<button type="button" class="btn-wallet-quick-action" id="btnStudentSinpeRecharge" onclick="abrirModalRecargaSinpeEstudiante()" style="flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 12px; background: linear-gradient(135deg, #0284c7, #0369a1); border: none; border-radius: 12px; color: #ffffff; font-weight: 800; font-size: 0.8rem; cursor: pointer; box-shadow: 0 4px 12px rgba(2, 132, 199, 0.22); transition: transform 0.15s ease;">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.3" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><line x1="12" x2="12.01" y1="18" y2="18"/></svg>
<span>Recargar SINPE</span>
</button>
<button type="button" class="btn-wallet-quick-action" id="btnStudentPresupuesto" onclick="abrirModalPresupuestoPersonal()" style="flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 12px; background: var(--card-bg, #ffffff); border: 1.5px solid var(--border, #cbd5e1); border-radius: 12px; color: var(--text-main, #0f172a); font-weight: 800; font-size: 0.8rem; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); transition: transform 0.15s ease;">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#0284c7" stroke-width="2.3" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="m10 15 5-3-5-3v6Z"/></svg>
<span id="btnStudentPresupuestoLabel">Mi Presupuesto</span>
</button>
</div>
<!-- BANNER DE LÍMITE DIARIO Y DISPONIBILIDAD (INTERACTIVO PARA ESTUDIANTES) -->
<div class="daily-limit-badge" id="dailyLimitBadge" style="cursor: pointer; flex-direction: column; align-items: stretch; gap: 5px; margin: 0 auto 14px auto; max-width: 440px; width: calc(100% - 24px); box-sizing: border-box;" onclick="handleDailyLimitBadgeClick()" title="Toca para ver o ajustar tu presupuesto">
<div style="display: flex; justify-content: space-between; align-items: center; width: 100%;">
<div>
<span id="dailyLimitBadgeTitle">Límite diario fijado: </span>
<strong id="dailyLimitText">₡0</strong>
</div>
<span id="dailyLimitEditHint" style="font-size: 0.72rem; color: #0284c7; font-weight: 800; background: #e0f2fe; padding: 2px 8px; border-radius: 6px; display: none;">🎯 Ajustar</span>
</div>
<div style="font-size: 0.76rem; color: var(--text-muted);" id="dailyAvailableText">
Disponible hoy: ₡0
<div style="font-size: 0.76rem; color: var(--text-muted); display: flex; justify-content: space-between; align-items: center; width: 100%;">
<span id="dailyAvailableText">Disponible hoy: ₡0</span>
<span id="dailyGastadoText" style="font-size: 0.72rem; color: #64748b;">Gastado hoy: ₡0</span>
</div>
<!-- Barra de progreso visual del presupuesto para el estudiante -->
<div id="studentBudgetProgressBarContainer" style="display: none; width: 100%; height: 6px; background: #e2e8f0; border-radius: 6px; overflow: hidden; margin-top: 2px;">
<div id="studentBudgetProgressBar" style="width: 0%; height: 100%; background: #10b981; border-radius: 6px; transition: width 0.3s ease, background 0.3s ease;"></div>
</div>
</div>
@@ -3797,7 +3979,12 @@
<div style="margin-bottom: 10px;">
<label style="display: block; font-size: 0.78rem; font-weight: 800; color: var(--text-main); margin-bottom: 3px;" id="lblStaffPassword">Contraseña de Acceso *:</label>
<input type="password" id="adminStaffPassword" placeholder="••••••••" style="width: 100%; padding: 9px 12px; border-radius: 8px; border: 1.5px solid var(--border); font-weight: 700; box-sizing: border-box; background: var(--card-bg); color: var(--text-main);">
<div class="password-input-wrapper">
<input type="password" id="adminStaffPassword" placeholder="••••••••" style="width: 100%; padding: 9px 12px; border-radius: 8px; border: 1.5px solid var(--border); font-weight: 700; box-sizing: border-box; background: var(--card-bg); color: var(--text-main);">
<button type="button" class="btn-toggle-password" onclick="togglePasswordVisibility('adminStaffPassword', this)" title="Ver contraseña" aria-label="Ver contraseña">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg>
</button>
</div>
<small id="hintStaffPassword" style="display: none; font-size: 0.7rem; color: var(--text-muted); margin-top: 3px;">Deja en blanco para conservar la contraseña actual.</small>
</div>
@@ -4241,7 +4428,12 @@
<label style="display: block; font-size: 0.74rem; font-weight: 800; color: var(--text-main); margin-bottom: 4px;">
Contraseña o palabra de confirmación:
</label>
<input type="password" id="inputConfirmarPassEliminar" placeholder="Contraseña o escribe ELIMINAR" style="width: 100%; height: 40px; padding: 0 12px; border: 1.5px solid #cbd5e1; border-radius: 9px; font-size: 0.88rem; box-sizing: border-box; background: var(--bg-main); color: var(--text-main);">
<div class="password-input-wrapper">
<input type="password" id="inputConfirmarPassEliminar" placeholder="Contraseña o escribe ELIMINAR" style="width: 100%; height: 40px; padding: 0 12px; border: 1.5px solid #cbd5e1; border-radius: 9px; font-size: 0.88rem; box-sizing: border-box; background: var(--bg-main); color: var(--text-main);">
<button type="button" class="btn-toggle-password" onclick="togglePasswordVisibility('inputConfirmarPassEliminar', this)" title="Ver contraseña" aria-label="Ver contraseña">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg>
</button>
</div>
</div>
<div style="display: flex; gap: 8px; justify-content: flex-end;">
@@ -4459,7 +4651,12 @@
<div id="devPasswordRow" style="margin-bottom: 12px;">
<label id="devPasswordLabel" style="font-size: 0.8rem; font-weight: 800; color: var(--text-main); display: block; margin-bottom: 4px;">Contraseña:</label>
<input type="password" id="devInputPassword" placeholder="Contraseña de acceso" style="width: 100%; padding: 9px 12px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--bg-main); color: var(--text-main); font-weight: 700; box-sizing: border-box;">
<div class="password-input-wrapper">
<input type="password" id="devInputPassword" placeholder="Contraseña de acceso" style="width: 100%; padding: 9px 12px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--bg-main); color: var(--text-main); font-weight: 700; box-sizing: border-box;">
<button type="button" class="btn-toggle-password" onclick="togglePasswordVisibility('devInputPassword', this)" title="Ver contraseña" aria-label="Ver contraseña">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg>
</button>
</div>
<small id="devPasswordHelp" style="font-size: 0.72rem; color: var(--text-muted); display: none;">Dejar en blanco si no deseas cambiar la contraseña actual.</small>
</div>
@@ -4507,7 +4704,12 @@
<div style="margin-bottom: 16px;">
<label style="font-size: 0.82rem; font-weight: 800; color: var(--text-main); display: block; margin-bottom: 6px;">Nueva Contraseña:</label>
<input type="password" id="devInputNewPassword" required minlength="4" placeholder="Mínimo 4 caracteres" style="width: 100%; padding: 11px 12px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--bg-main); color: var(--text-main); font-weight: 700; box-sizing: border-box; font-size: 0.95rem;">
<div class="password-input-wrapper">
<input type="password" id="devInputNewPassword" required minlength="4" placeholder="Mínimo 4 caracteres" style="width: 100%; padding: 11px 12px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--bg-main); color: var(--text-main); font-weight: 700; box-sizing: border-box; font-size: 0.95rem;">
<button type="button" class="btn-toggle-password" onclick="togglePasswordVisibility('devInputNewPassword', this)" title="Ver contraseña" aria-label="Ver contraseña">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg>
</button>
</div>
</div>
<div style="display: flex; justify-content: flex-end; gap: 10px; border-top: 1.5px solid var(--border); padding-top: 14px;">
@@ -5169,6 +5371,173 @@
</div>
</div>
<!-- MODAL: AUTORECARGA DE SALDO CON SINPE MÓVIL PARA ESTUDIANTES -->
<div class="modal-qr-backdrop modal-sinpe-backdrop" id="modalRecargaSinpeEstudiante" style="display: none;" onclick="handleModalRecargaSinpeEstudianteBackdrop(event)">
<div class="modal-qr-card" onclick="event.stopPropagation()" style="max-width: 440px; width: 92%; padding: 22px 20px; border-radius: 22px; box-shadow: 0 20px 40px rgba(0,0,0,0.25); text-align: left; background: var(--card-bg, #ffffff); max-height: 90vh; overflow-y: auto; box-sizing: border-box;">
<!-- Encabezado con Botón Cerrar -->
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; border-bottom: 1.5px solid var(--border, #e2e8f0); padding-bottom: 10px;">
<div style="display: flex; align-items: center; gap: 10px;">
<div style="width: 40px; height: 40px; border-radius: 12px; background: #e0f2fe; display: flex; align-items: center; justify-content: center; font-size: 1.25rem;">
📲
</div>
<div>
<h3 style="margin: 0; font-size: 1.1rem; font-weight: 800; color: var(--text-main, #0f172a);">Recargar con SINPE</h3>
<span style="font-size: 0.74rem; color: var(--text-muted, #64748b);">Acredita saldo a tu monedero escolar</span>
</div>
</div>
<button type="button" onclick="cerrarModalRecargaSinpeEstudiante()" style="background: none; border: none; font-size: 1.4rem; color: #94a3b8; cursor: pointer; padding: 4px; line-height: 1;" title="Cerrar">✕</button>
</div>
<!-- Banner si SINPE suspendido en la escuela -->
<div id="studentSinpeSuspendedBanner" style="display: none; background: #fef2f2; border: 1.5px solid #fecaca; border-radius: 12px; padding: 10px 12px; font-size: 0.8rem; color: #991b1b; margin-bottom: 12px;">
⚠️ <span id="studentSinpeSuspendedMsg">Las recargas SINPE se encuentran temporalmente en pausa técnica.</span>
</div>
<div id="studentSinpeFormContainer">
<!-- PASO 1: DATOS BANCARIOS DE LA SODA -->
<div style="background: linear-gradient(135deg, #0284c7, #0369a1); border-radius: 16px; padding: 14px 16px; color: #ffffff; margin-bottom: 14px; box-shadow: 0 4px 14px rgba(2, 132, 199, 0.25);">
<div style="font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.8px; opacity: 0.88; margin-bottom: 4px;">Envía tu SINPE Móvil al número:</div>
<div style="display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px;">
<div style="font-size: 1.45rem; font-weight: 900; letter-spacing: 1px;" id="studentSinpeNumeroDisplay">8888-8888</div>
<button type="button" id="btnCopiarTelSinpeEstudiante" onclick="copiarTelefonoSinpeEstudiante()" style="background: rgba(255,255,255,0.22); border: 1px solid rgba(255,255,255,0.35); color: #fff; padding: 6px 12px; border-radius: 8px; font-size: 0.75rem; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 5px; backdrop-filter: blur(4px);">
<span id="lblCopiarTelSinpeEstudiante">📋 Copiar</span>
</button>
</div>
<div style="border-top: 1px solid rgba(255,255,255,0.2); padding-top: 8px; display: flex; flex-direction: column; gap: 3px; font-size: 0.75rem; opacity: 0.95;">
<div>Titular: <strong id="studentSinpeTitularDisplay">Soda Escolar</strong></div>
<div>Escuela: <span id="studentSinpeEscuelaDisplay">Centro Educativo</span></div>
</div>
</div>
<!-- PASO 2: CÓDIGO DE DETALLE PARA EL BANCO -->
<div style="background: #f8fafc; border: 1.5px dashed #cbd5e1; border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between;">
<div>
<span style="font-size: 0.7rem; color: #64748b; font-weight: 700; text-transform: uppercase; display: block;">Código de Detalle (Motivo SINPE):</span>
<strong id="studentSinpeCodigoDisplay" style="font-family: monospace; font-size: 1.05rem; color: #0284c7; letter-spacing: 1px;">SIBO-CARGANDO</strong>
</div>
<button type="button" id="btnCopiarCodSinpeEstudiante" onclick="copiarCodigoSinpeEstudiante()" style="background: #e0f2fe; border: 1px solid #bae6fd; color: #0284c7; padding: 6px 10px; border-radius: 8px; font-size: 0.74rem; font-weight: 800; cursor: pointer;">
<span id="lblCopiarCodSinpeEstudiante">Copiar</span>
</button>
</div>
<!-- PASO 3: MONTO A RECARGAR -->
<div style="margin-bottom: 12px;">
<label style="display: block; font-size: 0.78rem; font-weight: 700; color: var(--text-main, #334155); margin-bottom: 6px;">
1. ¿Cuánto transferiste? (Monto en Colones)
</label>
<!-- Botones rápidos de monto -->
<div style="display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px;">
<button type="button" class="btn-monto-quick" onclick="setStudentSinpeMonto(1000)" style="padding: 7px 4px; border-radius: 8px; border: 1.5px solid var(--border, #cbd5e1); background: var(--bg-main, #ffffff); font-size: 0.78rem; font-weight: 800; color: var(--text-main, #334155); cursor: pointer;">₡1.000</button>
<button type="button" class="btn-monto-quick" onclick="setStudentSinpeMonto(2000)" style="padding: 7px 4px; border-radius: 8px; border: 1.5px solid var(--border, #cbd5e1); background: var(--bg-main, #ffffff); font-size: 0.78rem; font-weight: 800; color: var(--text-main, #334155); cursor: pointer;">₡2.000</button>
<button type="button" class="btn-monto-quick" onclick="setStudentSinpeMonto(3000)" style="padding: 7px 4px; border-radius: 8px; border: 1.5px solid var(--border, #cbd5e1); background: var(--bg-main, #ffffff); font-size: 0.78rem; font-weight: 800; color: var(--text-main, #334155); cursor: pointer;">₡3.000</button>
<button type="button" class="btn-monto-quick" onclick="setStudentSinpeMonto(5000)" style="padding: 7px 4px; border-radius: 8px; border: 1.5px solid var(--border, #cbd5e1); background: var(--bg-main, #ffffff); font-size: 0.78rem; font-weight: 800; color: var(--text-main, #334155); cursor: pointer;">₡5.000</button>
</div>
<input type="number" id="inputStudentSinpeMonto" min="500" step="500" placeholder="Escribe el monto en colones (ej. 2500)" style="width: 100%; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--border, #cbd5e1); background: var(--bg-main, #ffffff); color: var(--text-main, #0f172a); font-size: 0.92rem; font-weight: 700; box-sizing: border-box;">
</div>
<!-- PASO 4: NÚMERO DE COMPROBANTE -->
<div style="margin-bottom: 16px;">
<label style="display: block; font-size: 0.78rem; font-weight: 700; color: var(--text-main, #334155); margin-bottom: 6px;">
2. Número de Comprobante / Referencia Bancaria
</label>
<input type="text" id="inputStudentSinpeComprobante" placeholder="Ej. 123456789 (del SMS o app del banco)" style="width: 100%; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--border, #cbd5e1); background: var(--bg-main, #ffffff); color: var(--text-main, #0f172a); font-size: 0.92rem; font-weight: 700; box-sizing: border-box;">
<span style="display: block; font-size: 0.7rem; color: #64748b; margin-top: 4px;">Asegúrate de ingresar el número que te brindó tu banco al completar el SINPE.</span>
</div>
<!-- BOTÓN PRINCIPAL DE ENVÍO -->
<button type="button" id="btnEnviarRecargaSinpeEstudiante" onclick="enviarRecargaSinpeEstudiante()" class="btn-saas btn-saas-primary" style="width: 100%; height: 44px; font-size: 0.92rem; font-weight: 800; border-radius: 12px; justify-content: center; cursor: pointer;">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.3" stroke-linecap="round" stroke-linejoin="round"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></svg>
<span id="btnEnviarRecargaSinpeEstudianteTxt">Validar y Recargar Saldo</span>
</button>
</div>
</div>
</div>
<!-- MODAL: PRESUPUESTO PERSONAL / CONTROL DE GASTOS PARA ESTUDIANTES -->
<div class="modal-qr-backdrop modal-sinpe-backdrop" id="modalPresupuestoEstudiante" style="display: none;" onclick="handleModalPresupuestoEstudianteBackdrop(event)">
<div class="modal-qr-card" onclick="event.stopPropagation()" style="max-width: 440px; width: 92%; padding: 22px 20px; border-radius: 22px; box-shadow: 0 20px 40px rgba(0,0,0,0.25); text-align: left; background: var(--card-bg, #ffffff); max-height: 90vh; overflow-y: auto; box-sizing: border-box;">
<!-- Encabezado con Botón Cerrar -->
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; border-bottom: 1.5px solid var(--border, #e2e8f0); padding-bottom: 10px;">
<div style="display: flex; align-items: center; gap: 10px;">
<div style="width: 40px; height: 40px; border-radius: 12px; background: #fef3c7; display: flex; align-items: center; justify-content: center; font-size: 1.25rem;">
🎯
</div>
<div>
<h3 style="margin: 0; font-size: 1.1rem; font-weight: 800; color: var(--text-main, #0f172a);">Mi Presupuesto Diario</h3>
<span style="font-size: 0.74rem; color: var(--text-muted, #64748b);">Controla tus gastos diarios del recreo</span>
</div>
</div>
<button type="button" onclick="cerrarModalPresupuestoEstudiante()" style="background: none; border: none; font-size: 1.4rem; color: #94a3b8; cursor: pointer; padding: 4px; line-height: 1;" title="Cerrar">✕</button>
</div>
<!-- TARJETA RESUMEN DE PROGRESO DE HOY -->
<div style="background: var(--bg-main, #f8fafc); border: 1.5px solid var(--border, #e2e8f0); border-radius: 16px; padding: 14px 16px; margin-bottom: 14px;">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;">
<span style="font-size: 0.76rem; font-weight: 700; color: var(--text-muted, #64748b); text-transform: uppercase;">Consumo de hoy:</span>
<strong id="modalPresupuestoPorcentaje" style="font-size: 0.88rem; color: #10b981; font-weight: 800;">0%</strong>
</div>
<!-- Barra de progreso visual -->
<div style="width: 100%; height: 10px; background: #e2e8f0; border-radius: 10px; overflow: hidden; margin-bottom: 10px;">
<div id="modalPresupuestoBar" style="width: 0%; height: 100%; background: #10b981; border-radius: 10px; transition: width 0.3s ease, background 0.3s ease;"></div>
</div>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 0.8rem;">
<div style="background: var(--card-bg, #ffffff); padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border, #e2e8f0);">
<span style="display: block; font-size: 0.7rem; color: var(--text-muted, #64748b);">Gastado hoy</span>
<strong id="modalPresupuestoGastado" style="font-size: 0.95rem; color: var(--text-main, #334155);">₡0</strong>
</div>
<div style="background: var(--card-bg, #ffffff); padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border, #e2e8f0);">
<span style="display: block; font-size: 0.7rem; color: var(--text-muted, #64748b);">Disponible hoy</span>
<strong id="modalPresupuestoDisponible" style="font-size: 0.95rem; color: #0284c7;">₡0</strong>
</div>
</div>
</div>
<!-- SECCIÓN DE CONFIGURACIÓN DE META DIARIA -->
<div id="studentPresupuestoEditorSection">
<label style="display: block; font-size: 0.78rem; font-weight: 700; color: var(--text-main, #334155); margin-bottom: 6px;">
Fija o ajusta tu meta diaria de consumo:
</label>
<!-- Botones rápidos de presupuesto -->
<div id="studentPresupuestoQuickButtons" style="display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px;">
<button type="button" class="btn-budget-quick" onclick="setStudentBudgetMonto(1500)" style="padding: 7px 4px; border-radius: 8px; border: 1.5px solid var(--border, #cbd5e1); background: var(--bg-main, #ffffff); font-size: 0.78rem; font-weight: 800; color: var(--text-main, #334155); cursor: pointer;">₡1.500</button>
<button type="button" class="btn-budget-quick" onclick="setStudentBudgetMonto(2000)" style="padding: 7px 4px; border-radius: 8px; border: 1.5px solid var(--border, #cbd5e1); background: var(--bg-main, #ffffff); font-size: 0.78rem; font-weight: 800; color: var(--text-main, #334155); cursor: pointer;">₡2.000</button>
<button type="button" class="btn-budget-quick" onclick="setStudentBudgetMonto(3000)" style="padding: 7px 4px; border-radius: 8px; border: 1.5px solid var(--border, #cbd5e1); background: var(--bg-main, #ffffff); font-size: 0.78rem; font-weight: 800; color: var(--text-main, #334155); cursor: pointer;">₡3.000</button>
<button type="button" class="btn-budget-quick" onclick="setStudentBudgetMonto(5000)" style="padding: 7px 4px; border-radius: 8px; border: 1.5px solid var(--border, #cbd5e1); background: var(--bg-main, #ffffff); font-size: 0.78rem; font-weight: 800; color: var(--text-main, #334155); cursor: pointer;">₡5.000</button>
</div>
<div style="position: relative; margin-bottom: 12px;">
<input type="number" id="inputStudentPresupuestoMonto" min="500" step="500" placeholder="Escribe tu límite diario en colones..." style="width: 100%; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--border, #cbd5e1); background: var(--bg-main, #ffffff); color: var(--text-main, #0f172a); font-size: 0.95rem; font-weight: 700; box-sizing: border-box;">
</div>
<!-- MENSAJE EDUCATIVO -->
<div style="background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 12px; padding: 10px 12px; font-size: 0.74rem; color: #065f46; line-height: 1.4; margin-bottom: 14px;">
💡 <strong>Tip financiero:</strong> Fijar un presupuesto voluntario te ayuda a no gastar todo tu saldo en un solo recreo y asegurar tus meriendas toda la semana escolar.
</div>
<!-- AVISO SI ES CONTROLADO POR PADRES -->
<div id="modalPresupuestoParentLockedNotice" style="display: none; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 12px; padding: 10px 12px; font-size: 0.75rem; color: #1e40af; margin-bottom: 14px;">
ℹ️ <strong>Control Parental:</strong> Este límite fue establecido por tu encargado de familia. Si necesitas modificarlo, coordina con él o ella para que lo actualice desde su portal.
</div>
<!-- BOTÓN GUARDAR -->
<button type="button" id="btnGuardarPresupuestoEstudiante" onclick="guardarPresupuestoPersonalEstudiante()" class="btn-saas btn-saas-primary" style="width: 100%; height: 44px; font-size: 0.92rem; font-weight: 800; border-radius: 12px; justify-content: center; cursor: pointer;">
Guardar Presupuesto
</button>
</div>
</div>
</div>
<!-- MODAL: RECHAZAR RECARGA SINPE CON MOTIVO Y TRAZABILIDAD -->
<div class="modal-qr-backdrop" id="modalRechazarSinpe" style="display: none; z-index: 99999;">
<div class="modal-qr-card" onclick="event.stopPropagation()" style="max-width: 440px; text-align: left; padding: 22px; border-radius: 18px;">
@@ -5357,6 +5726,6 @@
<script src="/js/sounds.js?v=19.4"></script>
<script src="/js/jsQR.js" defer></script>
<script src="/js/food-icons.js?v=19.4" defer></script>
<script src="/js/app.js?v=20.5"></script>
<script src="/js/app.js?v=20.9"></script>
</body>
</html>
+703 -49
View File
@@ -331,20 +331,62 @@ function closeLoginSheet(e) {
function switchSheetView(view) {
const loginContent = document.getElementById('sheetContentLogin');
const registerChooseContent = document.getElementById('sheetContentRegisterChoose');
const registerContent = document.getElementById('sheetContentRegister');
const forgotContent = document.getElementById('sheetContentForgot');
const title = document.getElementById('bottomSheetTitle');
if (view === 'register') {
if (loginContent) loginContent.style.display = 'none';
if (loginContent) loginContent.style.display = 'none';
if (registerChooseContent) registerChooseContent.style.display = 'none';
if (registerContent) registerContent.style.display = 'none';
if (forgotContent) forgotContent.style.display = 'none';
if (view === 'register' || view === 'register-choose') {
if (registerChooseContent) registerChooseContent.style.display = 'block';
if (title) title.textContent = 'Crear Cuenta';
} else if (view === 'register-form') {
if (registerContent) registerContent.style.display = 'block';
if (title) title.textContent = 'Registro de Padres';
} else if (view === 'forgot') {
if (forgotContent) forgotContent.style.display = 'block';
if (title) title.textContent = 'Restablecer Contraseña';
const step1 = document.getElementById('forgotStep1');
const step2 = document.getElementById('forgotStep2');
if (step1) step1.style.display = 'block';
if (step2) step2.style.display = 'none';
const msg1 = document.getElementById('forgotMsgStep1');
if (msg1) msg1.style.display = 'none';
const msg2 = document.getElementById('forgotMsgStep2');
if (msg2) msg2.style.display = 'none';
} else {
if (loginContent) loginContent.style.display = 'block';
if (registerContent) registerContent.style.display = 'none';
if (title) title.textContent = 'Iniciar Sesión';
}
}
function selectRegisterType(type) {
const bannerPadre = document.getElementById('bannerPadreRegister');
const bannerAlumno = document.getElementById('bannerAlumnoRegister');
const rolInput = document.getElementById('regTargetRol');
const title = document.getElementById('bottomSheetTitle');
const btnLabel = document.getElementById('lblBtnRegisterSubmit');
if (rolInput) rolInput.value = type;
if (type === 'padre') {
if (bannerPadre) bannerPadre.style.display = 'flex';
if (bannerAlumno) bannerAlumno.style.display = 'none';
if (title) title.textContent = 'Registro de Padres';
if (btnLabel) btnLabel.textContent = 'Crear Cuenta de Padre y Entrar';
} else {
if (bannerPadre) bannerPadre.style.display = 'none';
if (bannerAlumno) bannerAlumno.style.display = 'flex';
if (title) title.textContent = 'Registro de Alumno';
if (btnLabel) btnLabel.textContent = 'Crear Cuenta de Alumno y Entrar';
}
switchSheetView('register-form');
}
function openTerminosModal() {
window.open('/terminos', '_blank');
}
@@ -407,23 +449,44 @@ function selectRegisterRole(role) {
async function handleRegisterPadreSubmit(event) {
if (event) event.preventDefault();
const nombre = document.getElementById('regNombre').value.trim();
const fechaNacInput = document.getElementById('regFechaNacimiento');
const fecha_nacimiento = fechaNacInput ? fechaNacInput.value.trim() : '';
const telefono = document.getElementById('regTelefono').value.trim();
const emailInput = document.getElementById('regEmail');
const email = emailInput ? emailInput.value.trim() : '';
const username = document.getElementById('regUsername').value.trim();
const password = document.getElementById('regPassword').value.trim();
const rolInput = document.getElementById('regTargetRol');
const rol = (rolInput && rolInput.value === 'alumno') ? 'estudiante' : 'padre';
const errorMsg = document.getElementById('registerErrorMsg');
const btnSubmit = document.getElementById('btnRegisterSubmit');
if (errorMsg) errorMsg.style.display = 'none';
if (!email) {
if (errorMsg) {
errorMsg.textContent = 'El correo electrónico es requerido.';
errorMsg.style.display = 'block';
}
return;
}
if (password.length < 6) {
if (errorMsg) {
errorMsg.textContent = 'La contraseña debe tener al menos 6 caracteres.';
errorMsg.style.display = 'block';
}
return;
}
btnSubmit.disabled = true;
btnSubmit.textContent = 'Creando cuenta de padre...';
btnSubmit.textContent = 'Creando cuenta...';
try {
const res = await fetch('/api/auth/register-padre', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ nombre, telefono, email, username, password })
body: JSON.stringify({ nombre, fecha_nacimiento, telefono, email, username, password, rol })
});
const data = await res.json();
if (!res.ok) throw new Error(data.error || 'Error al registrar la cuenta');
@@ -432,15 +495,23 @@ async function handleRegisterPadreSubmit(event) {
...data.user,
hijos: []
};
if (data.estudiante) {
currentStudent = data.estudiante;
safeSetItem('recreopay_estudiante', JSON.stringify(data.estudiante));
}
try {
safeSetItem('sibopay_user', JSON.stringify(currentUser));
safeSetItem('recreopay_user', JSON.stringify(currentUser));
} catch (_) {}
const welcomeMsg = (data.user.rol === 'padre')
? `Hola ${data.user.nombre}, tu cuenta de padre fue creada exitosamente.\n\nYa puedes vincular a tus hijos y recargarles saldo con SINPE Móvil.`
: `Hola ${data.user.nombre}, tu cuenta de estudiante fue creada exitosamente.\n\nYa puedes acceder a tu carné digital y tus compras en la soda.`;
if (window.sounds) window.sounds.playSuccess();
await showAppAlert({
title: '¡Bienvenido(a) a SiboPay!',
message: `Hola ${data.user.nombre}, tu cuenta de padre fue creada exitosamente.\n\nYa puedes vincular a tus hijos, asignar límites diarios y realizar recargas por SINPE Móvil de forma segura.`,
message: welcomeMsg,
type: 'success',
confirmText: 'Entrar a mi Panel'
});
@@ -453,7 +524,140 @@ async function handleRegisterPadreSubmit(event) {
if (window.sounds) window.sounds.playError();
} finally {
btnSubmit.disabled = false;
btnSubmit.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" style="margin-right:6px;"><circle cx="9" cy="7" r="3.5"/><path d="M3 20v-1.5A4.5 4.5 0 0 1 7.5 14h3A4.5 4.5 0 0 1 15 18.5V20"/><circle cx="17.5" cy="7.5" r="2.5"/><path d="M15 14a3.5 3.5 0 0 1 5.5 3v3"/></svg> Crear Cuenta de Padre y Entrar';
btnSubmit.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" style="margin-right:6px;"><circle cx="9" cy="7" r="3.5"/><path d="M3 20v-1.5A4.5 4.5 0 0 1 7.5 14h3A4.5 4.5 0 0 1 15 18.5V20"/><circle cx="17.5" cy="7.5" r="2.5"/><path d="M15 14a3.5 3.5 0 0 1 5.5 3v3"/></svg> Crear Cuenta y Entrar';
}
}
let pendingForgotEmail = '';
async function handleForgotRequestSubmit(event) {
if (event) event.preventDefault();
const emailInput = document.getElementById('forgotEmail');
const email = emailInput ? emailInput.value.trim() : '';
const msg = document.getElementById('forgotMsgStep1');
const btn = document.getElementById('btnForgotSendCode');
if (!email) return;
if (msg) msg.style.display = 'none';
btn.disabled = true;
btn.innerHTML = '<span style="display:inline-block; animation: pulse 1s infinite;">⏳</span> Enviando código...';
try {
const res = await fetch('/api/auth/forgot-password', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email })
});
const data = await res.json();
if (!res.ok) throw new Error(data.error || 'No se pudo enviar el código de recuperación.');
pendingForgotEmail = email;
document.getElementById('forgotStep1').style.display = 'none';
document.getElementById('forgotStep2').style.display = 'block';
const msg2 = document.getElementById('forgotMsgStep2');
if (msg2) {
msg2.textContent = `Código enviado a ${email}. Revisa tu bandeja de entrada o spam e ingrésalo abajo.`;
msg2.style.background = '#dcfce7';
msg2.style.borderColor = '#86efac';
msg2.style.color = '#166534';
msg2.style.border = '1px solid #86efac';
msg2.style.display = 'block';
}
const inputCode = document.getElementById('forgotCode');
if (inputCode) inputCode.focus();
} catch (err) {
if (msg) {
msg.textContent = err.message;
msg.style.background = '#fee2e2';
msg.style.borderColor = '#fca5a5';
msg.style.color = '#991b1b';
msg.style.border = '1px solid #fca5a5';
msg.style.display = 'block';
}
if (window.sounds) window.sounds.playError();
} finally {
btn.disabled = false;
btn.innerHTML = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 2L11 13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/></svg> <span id="lblBtnForgotSend">Enviar Código al Correo</span>';
}
}
async function handleForgotConfirmSubmit(event) {
if (event) event.preventDefault();
const email = pendingForgotEmail || (document.getElementById('forgotEmail') ? document.getElementById('forgotEmail').value.trim() : '');
const code = document.getElementById('forgotCode') ? document.getElementById('forgotCode').value.trim() : '';
const newPass = document.getElementById('forgotNewPass') ? document.getElementById('forgotNewPass').value.trim() : '';
const confirmPass = document.getElementById('forgotConfirmPass') ? document.getElementById('forgotConfirmPass').value.trim() : '';
const msg = document.getElementById('forgotMsgStep2');
const btn = document.getElementById('btnForgotResetPass');
if (msg) msg.style.display = 'none';
if (newPass.length < 6) {
if (msg) {
msg.textContent = 'La nueva contraseña debe tener al menos 6 caracteres.';
msg.style.background = '#fee2e2';
msg.style.borderColor = '#fca5a5';
msg.style.color = '#991b1b';
msg.style.border = '1px solid #fca5a5';
msg.style.display = 'block';
}
return;
}
if (newPass !== confirmPass) {
if (msg) {
msg.textContent = 'Las contraseñas no coinciden. Por favor verifícalas.';
msg.style.background = '#fee2e2';
msg.style.borderColor = '#fca5a5';
msg.style.color = '#991b1b';
msg.style.border = '1px solid #fca5a5';
msg.style.display = 'block';
}
return;
}
btn.disabled = true;
btn.innerHTML = '<span style="display:inline-block; animation: pulse 1s infinite;">⏳</span> Guardando nueva contraseña...';
try {
const res = await fetch('/api/auth/reset-password', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email, code, new_password: newPass })
});
const data = await res.json();
if (!res.ok) throw new Error(data.error || 'Error al restablecer la contraseña.');
if (window.sounds) window.sounds.playSuccess();
await showAppAlert({
title: '¡Contraseña Restablecida!',
message: 'Tu contraseña ha sido actualizada exitosamente. Ya puedes iniciar sesión con tu nueva contraseña.',
type: 'success',
confirmText: 'Iniciar Sesión'
});
switchSheetView('login');
const loginUserInput = document.getElementById('loginUsername');
if (loginUserInput) loginUserInput.value = email;
const loginPassInput = document.getElementById('loginPassword');
if (loginPassInput) {
loginPassInput.value = '';
loginPassInput.focus();
}
} catch (err) {
if (msg) {
msg.textContent = err.message;
msg.style.background = '#fee2e2';
msg.style.borderColor = '#fca5a5';
msg.style.color = '#991b1b';
msg.style.border = '1px solid #fca5a5';
msg.style.display = 'block';
}
if (window.sounds) window.sounds.playError();
} finally {
btn.disabled = false;
btn.innerHTML = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg> <span id="lblBtnForgotReset">Cambiar Contraseña y Entrar</span>';
}
}
@@ -473,6 +677,22 @@ function quickFillLogin(username, password) {
handleLoginSubmit();
}
function togglePasswordVisibility(inputId, btn) {
const input = document.getElementById(inputId);
if (!input) return;
const isPassword = input.type === 'password';
input.type = isPassword ? 'text' : 'password';
if (btn) {
btn.title = isPassword ? 'Ocultar contraseña' : 'Ver contraseña';
btn.setAttribute('aria-label', btn.title);
btn.style.color = isPassword ? '#0284c7' : '';
btn.innerHTML = isPassword
? '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9.88 9.88a3 3 0 1 0 4.24 4.24"/><path d="M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"/><path d="M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"/><line x1="2" x2="22" y1="2" y2="22"/></svg>'
: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg>';
}
}
window.togglePasswordVisibility = togglePasswordVisibility;
async function handleLoginSubmit(event) {
if (event) event.preventDefault();
const username = document.getElementById('loginUsername').value.trim();
@@ -963,6 +1183,45 @@ function updateStudentUI() {
? currentStudent.disponible_hoy
: Math.max(0, limiteDiario - gastadoHoy - saldoRetenido);
const isSelfManaged = !currentStudent.padre_usuario_id;
const badgeTitleEl = document.getElementById('dailyLimitBadgeTitle');
const editHintEl = document.getElementById('dailyLimitEditHint');
const badgeEl = document.getElementById('dailyLimitBadge');
const gastadoEl = document.getElementById('dailyGastadoText');
const progressContainer = document.getElementById('studentBudgetProgressBarContainer');
const progressBar = document.getElementById('studentBudgetProgressBar');
const btnPresupuestoLabel = document.getElementById('btnStudentPresupuestoLabel');
if (badgeTitleEl) {
badgeTitleEl.textContent = isSelfManaged ? 'Mi Presupuesto Diario: ' : 'Límite diario fijado: ';
}
if (btnPresupuestoLabel) {
btnPresupuestoLabel.textContent = isSelfManaged ? 'Mi Presupuesto' : 'Ver Presupuesto';
}
if (editHintEl) {
editHintEl.style.display = isSelfManaged ? 'inline-block' : 'none';
}
if (badgeEl) {
badgeEl.title = isSelfManaged ? 'Toca para ajustar tu meta diaria de gasto' : 'Límite diario establecido por tus padres';
}
if (gastadoEl) {
gastadoEl.textContent = `Gastado hoy: ₡${gastadoHoy.toLocaleString('es-CR')}`;
}
// Barra de progreso del presupuesto
if (progressContainer && progressBar) {
progressContainer.style.display = 'block';
const pct = limiteDiario > 0 ? Math.min(100, Math.round((gastadoHoy / limiteDiario) * 100)) : 0;
progressBar.style.width = `${pct}%`;
if (pct >= 100) {
progressBar.style.background = '#ef4444';
} else if (pct >= 70) {
progressBar.style.background = '#f59e0b';
} else {
progressBar.style.background = '#10b981';
}
}
document.getElementById('dailyLimitText').textContent = `₡${limiteDiario.toLocaleString('es-CR')}`;
document.getElementById('dailyAvailableText').textContent = `Disponible hoy: ₡${disponibleHoy.toLocaleString('es-CR')}`;
@@ -978,7 +1237,9 @@ function updateStudentUI() {
if (msgEl) {
msgEl.textContent = tienePreordenes
? 'Has alcanzado tu límite diario de consumo. Tu código QR solo podrá ser escaneado en la soda para retirar tu Pre-Orden.'
: `Has alcanzado tu límite diario de ₡${limiteDiario.toLocaleString('es-CR')} asignado por tus padres. La generación del código QR para compras está bloqueada hasta mañana.`;
: (isSelfManaged
? `Has consumido tu presupuesto diario de ₡${limiteDiario.toLocaleString('es-CR')}. Si necesitas realizar más compras hoy, puedes ajustar tu presupuesto personal tocando "Mi Presupuesto".`
: `Has alcanzado tu límite diario de ₡${limiteDiario.toLocaleString('es-CR')} asignado por tus padres. La generación del código QR para compras está bloqueada hasta mañana.`);
}
} else {
bannerLimitBlocked.style.display = 'none';
@@ -1833,6 +2094,25 @@ async function submitPreOrder() {
cantidad: item.cantidad
}));
// Verificación preventiva de presupuesto personal para alumnos autoadministrados
const totalCart = cart.reduce((acc, it) => acc + (it.product.precio_colones * it.cantidad), 0);
const limiteDiario = targetStudent.limite_diario_colones || 0;
const gastadoHoy = targetStudent.gastado_hoy || 0;
const retenido = targetStudent.saldo_retenido || 0;
const disponibleHoy = Math.max(0, limiteDiario - gastadoHoy - retenido);
if (limiteDiario > 0 && totalCart > disponibleHoy) {
const isSelfManaged = !targetStudent.padre_usuario_id;
if (isSelfManaged && (!currentUser || currentUser.rol === 'estudiante')) {
const respAjustar = confirm(`⚠️ Aviso de Presupuesto Personal:\n\nEste pedido suma ₡${totalCart.toLocaleString('es-CR')} y tu presupuesto disponible para hoy es de ₡${disponibleHoy.toLocaleString('es-CR')}.\n\nComo estudiante independiente, ¿deseas ajustar tu presupuesto diario personal antes de realizar este pedido?`);
if (respAjustar) {
closeCartModal();
abrirModalPresupuestoPersonal();
return;
}
}
}
const btn = document.getElementById('btnConfirmarOrden');
btn.disabled = true;
btn.textContent = 'Procesando en la soda...';
@@ -2419,10 +2699,11 @@ function toggleParentPanel(show, e) {
}
function openDailyLimitEditor() {
// SEGURIDAD: Los estudiantes no pueden modificar su límite diario
if (!currentUser || currentUser.rol === 'estudiante') {
if (currentUser && currentUser.rol === 'estudiante') {
abrirModalPresupuestoPersonal();
return;
}
if (!currentUser) return;
toggleParentPanel(true);
setTimeout(() => {
const input = document.getElementById('inputCustomDailyLimit');
@@ -5062,19 +5343,32 @@ async function executeParentSinpeRecharge() {
`;
}
currentSinpePollingData = {
await ejecutarSondeoValidacionSinpe({
studentId: currentParentChild.id,
studentName: currentParentChild.nombre_completo,
monto,
codigo,
comprobante
comprobante,
isStudentMode: false,
btn
});
}
async function ejecutarSondeoValidacionSinpe({ studentId, studentName, monto, codigo, comprobante, isStudentMode, btn }) {
currentSinpePollingData = {
studentId,
studentName,
monto,
codigo,
comprobante,
isStudentMode: Boolean(isStudentMode)
};
// Abrir modal con estado LOADING (sin barra ni contador de segundos)
showSinpeModal('loading', {
studentName: currentParentChild.nombre_completo,
monto: monto,
codigo: codigo
studentName,
monto,
codigo
});
const pollIntervalMs = 3000; // Consulta cada 3 segundos
@@ -5116,8 +5410,8 @@ async function executeParentSinpeRecharge() {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
estudiante_id: currentParentChild.id,
padre_usuario_id: currentUser ? currentUser.id : null,
estudiante_id: studentId,
padre_usuario_id: currentUser && currentUser.rol === 'padre' ? currentUser.id : null,
monto,
codigo,
comprobante: comprobante || null
@@ -5155,28 +5449,47 @@ async function executeParentSinpeRecharge() {
if (verifiedData && verifiedData.verificado) {
if (window.sounds) window.sounds.playCoin();
const baseSaldo = (currentParentChild && currentParentChild.id === studentId)
? (currentParentChild.saldo_colones || 0)
: ((currentStudent && currentStudent.id === studentId) ? (currentStudent.saldo_colones || 0) : 0);
const nuevoSaldo = typeof verifiedData.saldo_nuevo === 'number'
? verifiedData.saldo_nuevo
: (currentParentChild.saldo_colones + monto);
: (baseSaldo + monto);
currentParentChild.saldo_colones = nuevoSaldo;
renderActiveChildDetails(currentParentChild);
if (currentParentChild && currentParentChild.id === studentId) {
currentParentChild.saldo_colones = nuevoSaldo;
renderActiveChildDetails(currentParentChild);
}
if (currentStudent && currentStudent.id === studentId) {
currentStudent.saldo_colones = nuevoSaldo;
updateStudentUI();
}
if (inputMonto) inputMonto.value = '';
if (inputComp) inputComp.value = '';
const inputParentMonto = document.getElementById('inputParentSinpeMonto');
const inputParentComp = document.getElementById('inputParentSinpeComprobante');
if (inputParentMonto) inputParentMonto.value = '';
if (inputParentComp) inputParentComp.value = '';
const inputStudentMonto = document.getElementById('inputStudentSinpeMonto');
const inputStudentComp = document.getElementById('inputStudentSinpeComprobante');
if (inputStudentMonto) inputStudentMonto.value = '';
if (inputStudentComp) inputStudentComp.value = '';
showSinpeModal('success', {
studentName: currentParentChild.nombre_completo,
monto: monto,
studentName,
monto,
banco: verifiedData.banco || 'Bancario',
comprobante: verifiedData.comprobante || verifiedData.codigo || codigo,
codigo: codigo,
nuevoSaldo: nuevoSaldo
codigo,
nuevoSaldo
});
await loadParentSinpeRequests(currentParentChild.id);
clearSinpeSession();
obtenerNuevoCodigoSinpe();
if (currentParentChild && currentParentChild.id === studentId) {
await loadParentSinpeRequests(currentParentChild.id);
clearSinpeSession();
obtenerNuevoCodigoSinpe();
}
return;
}
@@ -5198,9 +5511,9 @@ async function executeParentSinpeRecharge() {
// ============================================
if (window.sounds) window.sounds.playTap();
showSinpeModal('timeout', {
studentName: currentParentChild.nombre_completo,
monto: monto,
codigo: codigo
studentName,
monto,
codigo
});
} catch (err) {
@@ -5214,10 +5527,15 @@ async function executeParentSinpeRecharge() {
} finally {
if (btn) {
btn.disabled = false;
btn.innerHTML = `
<svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.3" stroke-linecap="round" stroke-linejoin="round"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></svg>
<span id="btnParentValidarSinpeText">Validar SINPE</span>
`;
if (isStudentMode) {
const btnTxt = document.getElementById('btnEnviarRecargaSinpeEstudianteTxt');
if (btnTxt) btnTxt.textContent = 'Validar y Recargar Saldo';
} else {
btn.innerHTML = `
<svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.3" stroke-linecap="round" stroke-linejoin="round"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></svg>
<span id="btnParentValidarSinpeText">Validar SINPE</span>
`;
}
}
}
}
@@ -5301,22 +5619,36 @@ async function retrySinpeWaitMore() {
if (verifiedData && verifiedData.verificado) {
if (window.sounds) window.sounds.playCoin();
const baseSaldo = (currentParentChild && currentParentChild.id === studentId)
? (currentParentChild.saldo_colones || 0)
: ((currentStudent && currentStudent.id === studentId) ? (currentStudent.saldo_colones || 0) : 0);
const nuevoSaldo = typeof verifiedData.saldo_nuevo === 'number'
? verifiedData.saldo_nuevo
: ((currentParentChild ? currentParentChild.saldo_colones : 0) + monto);
: (baseSaldo + monto);
if (currentParentChild) {
if (currentParentChild && currentParentChild.id === studentId) {
currentParentChild.saldo_colones = nuevoSaldo;
renderActiveChildDetails(currentParentChild);
}
if (currentStudent && currentStudent.id === studentId) {
currentStudent.saldo_colones = nuevoSaldo;
updateStudentUI();
}
const inputMonto = document.getElementById('inputParentSinpeMonto');
const inputComp = document.getElementById('inputParentSinpeComprobante');
if (inputMonto) inputMonto.value = '';
if (inputComp) inputComp.value = '';
const inputStudentMonto = document.getElementById('inputStudentSinpeMonto');
const inputStudentComp = document.getElementById('inputStudentSinpeComprobante');
if (inputStudentMonto) inputStudentMonto.value = '';
if (inputStudentComp) inputStudentComp.value = '';
showSinpeModal('success', {
studentName: studentName || (currentParentChild ? currentParentChild.nombre_completo : ''),
studentName: studentName || (currentParentChild ? currentParentChild.nombre_completo : (currentStudent ? currentStudent.nombre_completo : '')),
monto,
banco: verifiedData.banco || 'Bancario',
comprobante: verifiedData.comprobante || verifiedData.codigo || codigo,
@@ -5324,11 +5656,11 @@ async function retrySinpeWaitMore() {
nuevoSaldo
});
if (currentParentChild) {
if (currentParentChild && currentParentChild.id === studentId) {
await loadParentSinpeRequests(currentParentChild.id);
clearSinpeSession();
obtenerNuevoCodigoSinpe();
}
clearSinpeSession();
obtenerNuevoCodigoSinpe();
return;
}
@@ -5370,11 +5702,13 @@ async function confirmSinpeSendManualReview() {
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
estudiante_id: studentId,
padre_usuario_id: currentUser ? currentUser.id : null,
padre_usuario_id: currentUser && currentUser.rol === 'padre' ? currentUser.id : null,
monto,
comprobante: comprobante || `SINPE-${codigo}`,
codigo_detalle: codigo,
notas: `Portal de Padres - Código: ${codigo}`
notas: (currentUser && currentUser.rol === 'padre')
? `Portal de Padres - Código: ${codigo}`
: `Autorecarga estudiante: ${studentName || ''}`
})
});
} catch (solErr) {
@@ -5386,19 +5720,339 @@ async function confirmSinpeSendManualReview() {
if (inputMonto) inputMonto.value = '';
if (inputComp) inputComp.value = '';
const inputStudentMonto = document.getElementById('inputStudentSinpeMonto');
const inputStudentComp = document.getElementById('inputStudentSinpeComprobante');
if (inputStudentMonto) inputStudentMonto.value = '';
if (inputStudentComp) inputStudentComp.value = '';
showSinpeModal('pending', {
studentName: studentName || (currentParentChild ? currentParentChild.nombre_completo : ''),
studentName: studentName || (currentParentChild ? currentParentChild.nombre_completo : (currentStudent ? currentStudent.nombre_completo : '')),
monto,
codigo
});
if (currentParentChild) {
if (currentParentChild && currentParentChild.id === studentId) {
await loadParentSinpeRequests(currentParentChild.id);
clearSinpeSession();
obtenerNuevoCodigoSinpe();
}
if (currentStudent && currentStudent.id === studentId) {
updateStudentUI();
}
clearSinpeSession();
obtenerNuevoCodigoSinpe();
}
// ==========================================
// AUTORECARGA SINPE PARA ESTUDIANTES AUTOADMINISTRADOS
// ==========================================
let currentStudentSinpeCode = null;
async function abrirModalRecargaSinpeEstudiante() {
if (!currentStudent) return;
const modal = document.getElementById('modalRecargaSinpeEstudiante');
if (!modal) return;
const numEl = document.getElementById('studentSinpeNumeroDisplay');
const titEl = document.getElementById('studentSinpeTitularDisplay');
const escEl = document.getElementById('studentSinpeEscuelaDisplay');
const codEl = document.getElementById('studentSinpeCodigoDisplay');
const bannerSusp = document.getElementById('studentSinpeSuspendedBanner');
const msgSusp = document.getElementById('studentSinpeSuspendedMsg');
const formBox = document.getElementById('studentSinpeFormContainer');
if (codEl) codEl.textContent = 'GENERANDO...';
try {
const res = await fetch('/api/sinpe/generar-codigo', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ estudiante_id: currentStudent.id })
});
const data = await res.json();
if (data.suspended) {
if (bannerSusp) bannerSusp.style.display = 'block';
if (msgSusp && data.mensaje_suspension) msgSusp.textContent = data.mensaje_suspension;
if (formBox) {
formBox.style.opacity = '0.4';
formBox.style.pointerEvents = 'none';
}
} else {
if (bannerSusp) bannerSusp.style.display = 'none';
if (formBox) {
formBox.style.opacity = '1';
formBox.style.pointerEvents = 'auto';
}
}
if (numEl && data.telefono_sinpe) numEl.textContent = data.telefono_sinpe;
if (titEl && data.titular_sinpe) titEl.textContent = data.titular_sinpe;
if (escEl && data.escuela_nombre) escEl.textContent = data.escuela_nombre;
currentStudentSinpeCode = data.codigo || `SIBO-${currentStudent.codigo_estudiante || ''}`;
if (codEl) codEl.textContent = currentStudentSinpeCode;
} catch (e) {
console.warn('Error cargando datos SINPE para estudiante:', e);
currentStudentSinpeCode = `SIBO-${currentStudent.codigo_estudiante || ''}`;
if (codEl) codEl.textContent = currentStudentSinpeCode;
}
const inpMonto = document.getElementById('inputStudentSinpeMonto');
const inpComp = document.getElementById('inputStudentSinpeComprobante');
if (inpMonto) inpMonto.value = '';
if (inpComp) inpComp.value = '';
modal.style.display = 'flex';
if (window.sounds) window.sounds.playTap();
}
function cerrarModalRecargaSinpeEstudiante() {
const modal = document.getElementById('modalRecargaSinpeEstudiante');
if (modal) modal.style.display = 'none';
}
function handleModalRecargaSinpeEstudianteBackdrop(event) {
if (event && event.target && event.target.id === 'modalRecargaSinpeEstudiante') {
cerrarModalRecargaSinpeEstudiante();
}
}
function copiarTelefonoSinpeEstudiante() {
const tel = (document.getElementById('studentSinpeNumeroDisplay')?.textContent || '').trim();
if (!tel) return;
const lbl = document.getElementById('lblCopiarTelSinpeEstudiante');
const onDone = () => {
if (window.sounds) window.sounds.playTap();
if (lbl) lbl.textContent = '¡Copiado! ✓';
setTimeout(() => { if (lbl) lbl.textContent = '📋 Copiar'; }, 2000);
};
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(tel.replace(/\D/g, '')).then(onDone).catch(() => fallbackCopyText(tel.replace(/\D/g, ''), onDone));
} else {
fallbackCopyText(tel.replace(/\D/g, ''), onDone);
}
}
function copiarCodigoSinpeEstudiante() {
const cod = currentStudentSinpeCode || (document.getElementById('studentSinpeCodigoDisplay')?.textContent || '').trim();
if (!cod || cod.includes('GENERANDO')) return;
const lbl = document.getElementById('lblCopiarCodSinpeEstudiante');
const onDone = () => {
if (window.sounds) window.sounds.playTap();
if (lbl) lbl.textContent = '¡Copiado! ✓';
setTimeout(() => { if (lbl) lbl.textContent = 'Copiar'; }, 2000);
};
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(cod).then(onDone).catch(() => fallbackCopyText(cod, onDone));
} else {
fallbackCopyText(cod, onDone);
}
}
function setStudentSinpeMonto(monto) {
const inp = document.getElementById('inputStudentSinpeMonto');
if (inp) {
inp.value = monto;
inp.focus();
}
if (window.sounds) window.sounds.playCoin();
}
async function enviarRecargaSinpeEstudiante() {
if (!currentStudent) return;
const bannerSusp = document.getElementById('studentSinpeSuspendedBanner');
if (bannerSusp && bannerSusp.style.display !== 'none') {
alert('Las recargas por SINPE Móvil se encuentran temporalmente en pausa técnica en esta sede.');
return;
}
const inpMonto = document.getElementById('inputStudentSinpeMonto');
const inpComp = document.getElementById('inputStudentSinpeComprobante');
const monto = parseInt(inpMonto ? inpMonto.value : 0, 10);
const comprobante = inpComp ? inpComp.value.trim() : '';
const codigo = currentStudentSinpeCode || `SIBO-${currentStudent.codigo_estudiante || ''}`;
if (isNaN(monto) || monto <= 0) {
alert('Por favor ingresa un monto válido mayor a ₡0 para procesar tu recarga SINPE.');
if (inpMonto) inpMonto.focus();
return;
}
if (!comprobante) {
alert('Por favor escribe el número de comprobante o referencia que te brindó el banco.');
if (inpComp) inpComp.focus();
return;
}
const btn = document.getElementById('btnEnviarRecargaSinpeEstudiante');
if (btn) {
btn.disabled = true;
const btnTxt = document.getElementById('btnEnviarRecargaSinpeEstudianteTxt');
if (btnTxt) btnTxt.textContent = 'Validando con el banco...';
}
cerrarModalRecargaSinpeEstudiante();
await ejecutarSondeoValidacionSinpe({
studentId: currentStudent.id,
studentName: currentStudent.nombre_completo,
monto,
codigo,
comprobante,
isStudentMode: true,
btn
});
}
// ==========================================
// PRESUPUESTO PERSONAL / CONTROL DE GASTOS PARA ESTUDIANTES
// ==========================================
function abrirModalPresupuestoPersonal() {
if (!currentStudent) return;
const modal = document.getElementById('modalPresupuestoEstudiante');
if (!modal) return;
const limiteDiario = currentStudent.limite_diario_colones || 0;
const gastadoHoy = currentStudent.gastado_hoy || 0;
const saldoRetenido = currentStudent.saldo_retenido || 0;
const disponibleHoy = (typeof currentStudent.disponible_hoy === 'number')
? currentStudent.disponible_hoy
: Math.max(0, limiteDiario - gastadoHoy - saldoRetenido);
const pct = limiteDiario > 0 ? Math.min(100, Math.round((gastadoHoy / limiteDiario) * 100)) : 0;
const gastadoEl = document.getElementById('modalPresupuestoGastado');
const dispEl = document.getElementById('modalPresupuestoDisponible');
const pctEl = document.getElementById('modalPresupuestoPorcentaje');
const barEl = document.getElementById('modalPresupuestoBar');
const inputEl = document.getElementById('inputStudentPresupuestoMonto');
const lockedNotice = document.getElementById('modalPresupuestoParentLockedNotice');
const quickButtons = document.getElementById('studentPresupuestoQuickButtons');
const btnGuardar = document.getElementById('btnGuardarPresupuestoEstudiante');
if (gastadoEl) gastadoEl.textContent = `₡${gastadoHoy.toLocaleString('es-CR')}`;
if (dispEl) dispEl.textContent = `₡${disponibleHoy.toLocaleString('es-CR')}`;
if (pctEl) pctEl.textContent = `${pct}%`;
if (barEl) {
barEl.style.width = `${pct}%`;
if (pct >= 100) {
barEl.style.background = '#ef4444';
if (pctEl) pctEl.style.color = '#ef4444';
} else if (pct >= 70) {
barEl.style.background = '#f59e0b';
if (pctEl) pctEl.style.color = '#f59e0b';
} else {
barEl.style.background = '#10b981';
if (pctEl) pctEl.style.color = '#10b981';
}
}
if (inputEl) inputEl.value = limiteDiario;
const isSelfManaged = !currentStudent.padre_usuario_id;
if (isSelfManaged) {
if (lockedNotice) lockedNotice.style.display = 'none';
if (quickButtons) quickButtons.style.display = 'grid';
if (btnGuardar) btnGuardar.style.display = 'flex';
if (inputEl) inputEl.disabled = false;
} else {
if (lockedNotice) lockedNotice.style.display = 'block';
if (quickButtons) quickButtons.style.display = 'none';
if (btnGuardar) btnGuardar.style.display = 'none';
if (inputEl) inputEl.disabled = true;
}
modal.style.display = 'flex';
if (window.sounds) window.sounds.playTap();
}
function cerrarModalPresupuestoEstudiante() {
const modal = document.getElementById('modalPresupuestoEstudiante');
if (modal) modal.style.display = 'none';
}
function handleModalPresupuestoEstudianteBackdrop(event) {
if (event && event.target && event.target.id === 'modalPresupuestoEstudiante') {
cerrarModalPresupuestoEstudiante();
}
}
function setStudentBudgetMonto(monto) {
const inputEl = document.getElementById('inputStudentPresupuestoMonto');
if (inputEl) {
inputEl.value = monto;
inputEl.focus();
}
if (window.sounds) window.sounds.playCoin();
}
async function guardarPresupuestoPersonalEstudiante() {
if (!currentStudent) return;
const inputEl = document.getElementById('inputStudentPresupuestoMonto');
const val = parseInt(inputEl ? inputEl.value : 0, 10);
if (isNaN(val) || val < 500) {
alert('Por favor ingresa un presupuesto válido (mínimo ₡500).');
if (inputEl) inputEl.focus();
return;
}
const btn = document.getElementById('btnGuardarPresupuestoEstudiante');
if (btn) {
btn.disabled = true;
btn.textContent = 'Guardando meta...';
}
try {
const res = await fetch(`/api/estudiantes/${currentStudent.id}/limite`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ limite_diario_colones: val })
});
const data = await res.json();
if (!res.ok) throw new Error(data.error || 'Error al actualizar presupuesto');
currentStudent.limite_diario_colones = val;
currentStudent.disponible_hoy = Math.max(0, val - (currentStudent.gastado_hoy || 0) - (currentStudent.saldo_retenido || 0));
updateStudentUI();
cerrarModalPresupuestoEstudiante();
if (window.sounds) window.sounds.playSuccess();
alert(`🎯 ¡Presupuesto Actualizado!\n\nTu meta diaria de gasto ahora es de ₡${val.toLocaleString('es-CR')}.\n\nPodrás monitorear tu barra de consumo en tu monedero escolar.`);
} catch (err) {
if (window.sounds) window.sounds.playError();
alert(`No se pudo guardar el presupuesto: ${err.message}`);
} finally {
if (btn) {
btn.disabled = false;
btn.textContent = 'Guardar Presupuesto';
}
}
}
function handleDailyLimitBadgeClick() {
abrirModalPresupuestoPersonal();
}
window.abrirModalRecargaSinpeEstudiante = abrirModalRecargaSinpeEstudiante;
window.cerrarModalRecargaSinpeEstudiante = cerrarModalRecargaSinpeEstudiante;
window.handleModalRecargaSinpeEstudianteBackdrop = handleModalRecargaSinpeEstudianteBackdrop;
window.copiarTelefonoSinpeEstudiante = copiarTelefonoSinpeEstudiante;
window.copiarCodigoSinpeEstudiante = copiarCodigoSinpeEstudiante;
window.setStudentSinpeMonto = setStudentSinpeMonto;
window.enviarRecargaSinpeEstudiante = enviarRecargaSinpeEstudiante;
window.abrirModalPresupuestoPersonal = abrirModalPresupuestoPersonal;
window.cerrarModalPresupuestoEstudiante = cerrarModalPresupuestoEstudiante;
window.handleModalPresupuestoEstudianteBackdrop = handleModalPresupuestoEstudianteBackdrop;
window.setStudentBudgetMonto = setStudentBudgetMonto;
window.guardarPresupuestoPersonalEstudiante = guardarPresupuestoPersonalEstudiante;
window.handleDailyLimitBadgeClick = handleDailyLimitBadgeClick;
async function loadParentSinpeRequests(studentId) {
const box = document.getElementById('parentSinpePendingBox');
const list = document.getElementById('parentSinpePendingList');
+4 -2
View File
@@ -345,7 +345,7 @@
En conformidad con la Ley N° 8968, los titulares pueden ejercer en todo momento sus derechos de <strong>Acceso, Rectificación, Cancelación y Oposición (ARCO)</strong>.
</p>
<p>
Para actualizar información errónea o solicitar la eliminación total de la cuenta y los registros históricos de un alumno al concluir el ciclo escolar, el tutor legal puede remitir la solicitud a <strong>[email protected]</strong>. Las solicitudes de eliminación se procesan en un plazo no mayor a cinco (5) días hábiles.
Para actualizar información errónea o solicitar la eliminación total de la cuenta y los registros históricos de un alumno al concluir el ciclo escolar, el tutor legal puede remitir la solicitud a <strong>[email protected]</strong> o utilizar nuestro canal directo automatizado de <strong><a href="/eliminar-cuenta" class="text-sky-600 font-bold underline hover:text-sky-800">Solicitud Web de Eliminación de Cuenta y Datos</a></strong> (o desde los Ajustes de la App Móvil). Las solicitudes de eliminación se procesan de forma inmediata o en un plazo no mayor a cinco (5) días hábiles.
</p>
</section>
@@ -368,12 +368,14 @@
<span class="txtRetornoApp">Regresar a la Aplicación SiboPay</span>
</a>
</div>
<div class="flex items-center justify-center gap-3 font-medium text-slate-600">
<div class="flex items-center justify-center gap-3 font-medium text-slate-600 flex-wrap">
<span>SiboPay Costa Rica</span>
<span>•</span>
<span>Cumplimiento Ley N° 8968</span>
<span>•</span>
<span>Google Play Data Safety</span>
<span>•</span>
<a href="/eliminar-cuenta" class="text-rose-600 font-bold hover:underline">Eliminación de Cuenta</a>
</div>
<p>© 2026 SiboPay. Sistema inteligente de billetera online. Todos los derechos reservados.</p>
<p class="text-slate-400">Canal de atención y soporte: <a href="mailto:[email protected]" class="text-slate-600 font-semibold hover:underline">[email protected]</a></p>
+627
View File
@@ -0,0 +1,627 @@
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SiboPay — Carrusel Idéntico a Structured.app</title>
<script src="https://www.gstatic.com/antigravity/web/dev/tailwindcss.min.js"></script>
<style>
@keyframes marquee-left {
0% { transform: translateX(0); }
100% { transform: translateX(-50%); }
}
@keyframes marquee-right {
0% { transform: translateX(-50%); }
100% { transform: translateX(0); }
}
.track-left {
display: flex;
align-items: center;
width: max-content;
animation: marquee-left 48s linear infinite;
}
.track-right {
display: flex;
align-items: center;
width: max-content;
animation: marquee-right 52s linear infinite;
}
.marquee-row:hover .track-left,
.marquee-row:hover .track-right {
animation-play-state: paused;
}
.mask-fade {
-webkit-mask-image: linear-gradient(to right, transparent 0%, black 6%, black 94%, transparent 100%);
mask-image: linear-gradient(to right, transparent 0%, black 6%, black 94%, transparent 100%);
}
.bg-smooth-transition {
transition: background-color 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Structured Card Glow */
.structured-card {
width: 646px;
height: 193px;
border-radius: 100px;
position: relative;
flex-shrink: 0;
box-shadow: 0 16px 36px -8px rgba(0, 0, 0, 0.12), inset 0 1px 1px rgba(255, 255, 255, 0.6);
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}
.structured-card:hover {
transform: scale(1.02);
box-shadow: 0 20px 42px -6px rgba(0, 0, 0, 0.18), inset 0 1px 1px rgba(255, 255, 255, 0.8);
}
</style>
</head>
<body id="pageBody" class="bg-smooth-transition antialiased text-slate-800 m-0 p-0 selection:bg-sky-200 overflow-x-hidden" style="background-color: #e0f2fe;">
<!-- NAVEGACIÓN FLOTANTE LIQUID GLASS -->
<nav class="fixed top-0 left-0 w-full z-50 flex items-center justify-center px-4 py-3 pointer-events-none">
<div class="w-full max-w-5xl pointer-events-auto flex items-center justify-between px-6 py-2.5 rounded-full bg-white/45 backdrop-blur-2xl border border-white/60 shadow-[0_8px_30px_rgba(0,0,0,0.06)]">
<div class="flex items-center gap-2.5">
<div class="w-9 h-9 rounded-full bg-gradient-to-tr from-sky-600 to-cyan-400 flex items-center justify-center text-white font-extrabold text-lg shadow-sm">
S
</div>
<span class="text-xl font-bold tracking-tight text-slate-900">sibopay</span>
<span class="text-[12px] font-semibold px-2.5 py-0.5 rounded-full bg-white/80 text-sky-800 border border-sky-200/60 ml-1">Structured 1:1</span>
</div>
<div class="hidden md:flex items-center gap-6 text-[15px] font-medium text-slate-700 lowercase">
<a href="#reviews" class="hover:text-sky-600 transition-colors">carrusel de cápsulas</a>
<a href="#features" class="hover:text-sky-600 transition-colors">discos interactivos</a>
<a href="#timeline" class="hover:text-sky-600 transition-colors">agenda visual</a>
</div>
<div class="flex items-center gap-2">
<button onclick="toggleBackground()" class="px-3.5 py-1.5 rounded-full bg-white/70 hover:bg-white text-slate-700 text-xs font-semibold border border-white/80 shadow-xs transition-all flex items-center gap-1.5 cursor-pointer">
<span>🎨 Cambiar Fondo</span>
</button>
<button class="px-5 py-2 rounded-full bg-slate-900 hover:bg-sky-600 text-white text-sm font-semibold transition-all duration-300 shadow-sm cursor-pointer">
Probar en vivo
</button>
</div>
</div>
</nav>
<!-- HERO TITLE -->
<section class="pt-32 pb-8 px-6 text-center max-w-4xl mx-auto">
<div class="inline-flex items-center gap-2 px-4 py-1.5 rounded-full bg-white/70 backdrop-blur-md border border-white shadow-xs text-xs font-bold text-sky-800 mb-6">
<span class="w-2 h-2 rounded-full bg-sky-500 animate-pulse"></span>
CARRUSEL DE CÁPSULAS Y CONECTORES DE STRUCTURED.APP
</div>
<h1 class="text-4xl sm:text-6xl font-light text-slate-900 lowercase tracking-tight leading-none mb-4">
el carrusel idéntico de <br/>
<span class="font-extrabold text-sky-800" id="heroTitleSpan">structured con los colores de sibopay</span>
</h1>
<p class="text-base sm:text-lg text-slate-600 font-medium max-w-2xl mx-auto mb-6">
Cápsulas gigantes de <strong class="text-slate-900">646px × 193px</strong> con <strong class="text-slate-900">radio de curvatura de 100px</strong>, estrellas doradas, conectores visuales tipo rompecabezas y dos filas que se desplazan de forma continua en sentidos opuestos.
</p>
<!-- PALETA DE COLOR ACTIVA -->
<div class="flex flex-wrap items-center justify-center gap-2 mb-2">
<button onclick="setTheme('#e0f2fe')" class="px-3.5 py-1 rounded-full text-xs font-bold bg-white text-sky-800 shadow-xs cursor-pointer border border-sky-200">🧊 Cielo SiboPay</button>
<button onclick="setTheme('#d1fae5')" class="px-3.5 py-1 rounded-full text-xs font-bold bg-white/70 hover:bg-white text-emerald-800 shadow-xs cursor-pointer border border-emerald-200">🍃 Menta Recargas</button>
<button onclick="setTheme('#ffedd5')" class="px-3.5 py-1 rounded-full text-xs font-bold bg-white/70 hover:bg-white text-orange-800 shadow-xs cursor-pointer border border-orange-200">🍑 Melocotón Pastel</button>
<button onclick="setTheme('#f3e8ff')" class="px-3.5 py-1 rounded-full text-xs font-bold bg-white/70 hover:bg-white text-purple-800 shadow-xs cursor-pointer border border-purple-200">💜 Lavanda Relax</button>
<button onclick="setTheme('#fef08a')" class="px-3.5 py-1 rounded-full text-xs font-bold bg-white/70 hover:bg-white text-amber-800 shadow-xs cursor-pointer border border-amber-200">🌻 Vainilla Cálido</button>
</div>
</section>
<!-- ============================================================ -->
<!-- SECCIÓN: EL CARRUSEL EXACTO DE STRUCTURED (COMMUNITY REVIEWS) -->
<!-- ============================================================ -->
<section id="reviews" class="py-10 overflow-hidden relative">
<div class="text-center lowercase mx-auto px-5 mb-8">
<div class="text-slate-600 text-lg sm:text-2xl font-light tracking-tight">más de 50.000 clientes satisfechos</div>
<div class="text-slate-900 text-3xl sm:text-5xl font-extrabold tracking-tight">experiencias en tiempo real</div>
</div>
<div class="flex flex-col gap-6 mask-fade marquee-row">
<!-- ======================================================== -->
<!-- FILA 1: MOVIMIENTO CONTINUO HACIA LA IZQUIERDA (48s) -->
<!-- ======================================================== -->
<div class="overflow-hidden w-full h-[205px]">
<div class="track-left flex items-center gap-0">
<!-- CÁPSULA 1: SIBOPAY CYAN / AZUL CIELO (646px x 193px, border-radius 100px) -->
<div class="structured-card flex flex-col items-center justify-center text-center text-white" style="background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);">
<div class="flex flex-col items-center justify-center px-12 py-5" style="transform: translateY(-4px);">
<!-- 5 Estrellas Doradas -->
<div class="flex items-center gap-1 mb-2 text-amber-300 text-lg">
★ ★ ★ ★ ★
</div>
<p class="text-[18px] font-medium leading-[1.35] tracking-[-0.4px] text-white/95 max-w-[520px]">
“La recarga por SINPE Móvil entra en 2 segundos y a mi hijo le llega el saldo de inmediato. Cero filas en la soda.”
</p>
<div class="flex items-center gap-2 mt-2.5">
<span class="w-5 h-5 rounded-full bg-white/20 flex items-center justify-center text-[10px]">💬</span>
<span class="text-xs font-bold text-white/90">Reseña WhatsApp de Padres</span>
</div>
</div>
</div>
<!-- CONECTOR 1 (Puzzle Link entre Cápsula 1 y 2) -->
<div class="flex-shrink-0 flex items-center justify-center relative z-0" style="width: 32px; height: 20px;">
<div style="width: 52px; height: 16px; border-radius: 9999px; background: rgba(255,255,255,0.7); box-shadow: 0 4px 10px rgba(0,0,0,0.1); border: 2px solid white;"></div>
</div>
<!-- CÁPSULA 2: VIOLETA / LAVANDA STRUCTURED -->
<div class="structured-card flex flex-col items-center justify-center text-center text-white" style="background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);">
<div class="flex flex-col items-center justify-center px-12 py-5" style="transform: translateY(-4px);">
<div class="flex items-center gap-1 mb-2 text-amber-300 text-lg">
★ ★ ★ ★ ★
</div>
<p class="text-[18px] font-medium leading-[1.35] tracking-[-0.4px] text-white/95 max-w-[520px]">
“Cuando alguien agenda un servicio en mi página, le llega el WhatsApp con la ruta de Waze al instante. Espectacular.”
</p>
<div class="flex items-center gap-2 mt-2.5">
<span class="w-5 h-5 rounded-full bg-white/20 flex items-center justify-center text-[10px]">📸</span>
<span class="text-xs font-bold text-white/90">Instagram Comment</span>
</div>
</div>
</div>
<!-- CONECTOR 2 -->
<div class="flex-shrink-0 flex items-center justify-center relative z-0" style="width: 32px; height: 20px;">
<div style="width: 52px; height: 16px; border-radius: 9999px; background: rgba(255,255,255,0.7); box-shadow: 0 4px 10px rgba(0,0,0,0.1); border: 2px solid white;"></div>
</div>
<!-- CÁPSULA 3: MENTA / VERDE SALVIA -->
<div class="structured-card flex flex-col items-center justify-center text-center text-white" style="background: linear-gradient(135deg, #10b981 0%, #047857 100%);">
<div class="flex flex-col items-center justify-center px-12 py-5" style="transform: translateY(-4px);">
<div class="flex items-center gap-1 mb-2 text-amber-300 text-lg">
★ ★ ★ ★ ★
</div>
<p class="text-[18px] font-medium leading-[1.35] tracking-[-0.4px] text-white/95 max-w-[520px]">
“Tengo dos páginas web con el mismo número de WhatsApp enviando recordatorios automáticos sin pagar líneas extra.”
</p>
<div class="flex items-center gap-2 mt-2.5">
<span class="w-5 h-5 rounded-full bg-white/20 flex items-center justify-center text-[10px]">⭐</span>
<span class="text-xs font-bold text-white/90">Google Business Review</span>
</div>
</div>
</div>
<!-- CONECTOR 3 -->
<div class="flex-shrink-0 flex items-center justify-center relative z-0" style="width: 32px; height: 20px;">
<div style="width: 52px; height: 16px; border-radius: 9999px; background: rgba(255,255,255,0.7); box-shadow: 0 4px 10px rgba(0,0,0,0.1); border: 2px solid white;"></div>
</div>
<!-- CÁPSULA 4: MELOCOTÓN / CORAL CÁLIDO -->
<div class="structured-card flex flex-col items-center justify-center text-center text-white" style="background: linear-gradient(135deg, #f97316 0%, #c2410c 100%);">
<div class="flex flex-col items-center justify-center px-12 py-5" style="transform: translateY(-4px);">
<div class="flex items-center gap-1 mb-2 text-amber-300 text-lg">
★ ★ ★ ★ ★
</div>
<p class="text-[18px] font-medium leading-[1.35] tracking-[-0.4px] text-white/95 max-w-[520px]">
“Los banners de aviso en tiempo real nos salvaron cuando tuvimos que pausar el comedor. Todos los papás lo vieron.”
</p>
<div class="flex items-center gap-2 mt-2.5">
<span class="w-5 h-5 rounded-full bg-white/20 flex items-center justify-center text-[10px]">🍎</span>
<span class="text-xs font-bold text-white/90">App Store Review</span>
</div>
</div>
</div>
<!-- CONECTOR 4 -->
<div class="flex-shrink-0 flex items-center justify-center relative z-0" style="width: 32px; height: 20px;">
<div style="width: 52px; height: 16px; border-radius: 9999px; background: rgba(255,255,255,0.7); box-shadow: 0 4px 10px rgba(0,0,0,0.1); border: 2px solid white;"></div>
</div>
<!-- DUPLICACIÓN EXACTA DE FILA 1 PARA LOOP INFINITO PERFECTO -->
<div class="structured-card flex flex-col items-center justify-center text-center text-white" style="background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);">
<div class="flex flex-col items-center justify-center px-12 py-5" style="transform: translateY(-4px);">
<div class="flex items-center gap-1 mb-2 text-amber-300 text-lg">
★ ★ ★ ★ ★
</div>
<p class="text-[18px] font-medium leading-[1.35] tracking-[-0.4px] text-white/95 max-w-[520px]">
“La recarga por SINPE Móvil entra en 2 segundos y a mi hijo le llega el saldo de inmediato. Cero filas en la soda.”
</p>
<div class="flex items-center gap-2 mt-2.5">
<span class="w-5 h-5 rounded-full bg-white/20 flex items-center justify-center text-[10px]">💬</span>
<span class="text-xs font-bold text-white/90">Reseña WhatsApp de Padres</span>
</div>
</div>
</div>
<div class="flex-shrink-0 flex items-center justify-center relative z-0" style="width: 32px; height: 20px;">
<div style="width: 52px; height: 16px; border-radius: 9999px; background: rgba(255,255,255,0.7); box-shadow: 0 4px 10px rgba(0,0,0,0.1); border: 2px solid white;"></div>
</div>
<div class="structured-card flex flex-col items-center justify-center text-center text-white" style="background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);">
<div class="flex flex-col items-center justify-center px-12 py-5" style="transform: translateY(-4px);">
<div class="flex items-center gap-1 mb-2 text-amber-300 text-lg">
★ ★ ★ ★ ★
</div>
<p class="text-[18px] font-medium leading-[1.35] tracking-[-0.4px] text-white/95 max-w-[520px]">
“Cuando alguien agenda un servicio en mi página, le llega el WhatsApp con la ruta de Waze al instante. Espectacular.”
</p>
<div class="flex items-center gap-2 mt-2.5">
<span class="w-5 h-5 rounded-full bg-white/20 flex items-center justify-center text-[10px]">📸</span>
<span class="text-xs font-bold text-white/90">Instagram Comment</span>
</div>
</div>
</div>
<div class="flex-shrink-0 flex items-center justify-center relative z-0" style="width: 32px; height: 20px;">
<div style="width: 52px; height: 16px; border-radius: 9999px; background: rgba(255,255,255,0.7); box-shadow: 0 4px 10px rgba(0,0,0,0.1); border: 2px solid white;"></div>
</div>
<div class="structured-card flex flex-col items-center justify-center text-center text-white" style="background: linear-gradient(135deg, #10b981 0%, #047857 100%);">
<div class="flex flex-col items-center justify-center px-12 py-5" style="transform: translateY(-4px);">
<div class="flex items-center gap-1 mb-2 text-amber-300 text-lg">
★ ★ ★ ★ ★
</div>
<p class="text-[18px] font-medium leading-[1.35] tracking-[-0.4px] text-white/95 max-w-[520px]">
“Tengo dos páginas web con el mismo número de WhatsApp enviando recordatorios automáticos sin pagar líneas extra.”
</p>
<div class="flex items-center gap-2 mt-2.5">
<span class="w-5 h-5 rounded-full bg-white/20 flex items-center justify-center text-[10px]">⭐</span>
<span class="text-xs font-bold text-white/90">Google Business Review</span>
</div>
</div>
</div>
<div class="flex-shrink-0 flex items-center justify-center relative z-0" style="width: 32px; height: 20px;">
<div style="width: 52px; height: 16px; border-radius: 9999px; background: rgba(255,255,255,0.7); box-shadow: 0 4px 10px rgba(0,0,0,0.1); border: 2px solid white;"></div>
</div>
<div class="structured-card flex flex-col items-center justify-center text-center text-white" style="background: linear-gradient(135deg, #f97316 0%, #c2410c 100%);">
<div class="flex flex-col items-center justify-center px-12 py-5" style="transform: translateY(-4px);">
<div class="flex items-center gap-1 mb-2 text-amber-300 text-lg">
★ ★ ★ ★ ★
</div>
<p class="text-[18px] font-medium leading-[1.35] tracking-[-0.4px] text-white/95 max-w-[520px]">
“Los banners de aviso en tiempo real nos salvaron cuando tuvimos que pausar el comedor. Todos los papás lo vieron.”
</p>
<div class="flex items-center gap-2 mt-2.5">
<span class="w-5 h-5 rounded-full bg-white/20 flex items-center justify-center text-[10px]">🍎</span>
<span class="text-xs font-bold text-white/90">App Store Review</span>
</div>
</div>
</div>
<div class="flex-shrink-0 flex items-center justify-center relative z-0" style="width: 32px; height: 20px;">
<div style="width: 52px; height: 16px; border-radius: 9999px; background: rgba(255,255,255,0.7); box-shadow: 0 4px 10px rgba(0,0,0,0.1); border: 2px solid white;"></div>
</div>
</div>
</div>
<!-- ======================================================== -->
<!-- FILA 2: MOVIMIENTO CONTINUO HACIA LA DERECHA (52s) -->
<!-- ======================================================== -->
<div class="overflow-hidden w-full h-[205px]">
<div class="track-right flex items-center gap-0">
<!-- CÁPSULA B1: ROSA EMPOVRADO PASTEL -->
<div class="structured-card flex flex-col items-center justify-center text-center text-white" style="background: linear-gradient(135deg, #f43f5e 0%, #be123c 100%);">
<div class="flex flex-col items-center justify-center px-12 py-5" style="transform: translateY(-4px);">
<div class="flex items-center gap-1 mb-2 text-amber-300 text-lg">
★ ★ ★ ★ ★
</div>
<p class="text-[18px] font-medium leading-[1.35] tracking-[-0.4px] text-white/95 max-w-[520px]">
“Poder bloquear alimentos chatarra y alergenos en caja desde mi celular me da una tranquilidad inmensa como mamá.”
</p>
<div class="flex items-center gap-2 mt-2.5">
<span class="w-5 h-5 rounded-full bg-white/20 flex items-center justify-center text-[10px]">🛡️</span>
<span class="text-xs font-bold text-white/90">Comentario Portal Padres</span>
</div>
</div>
</div>
<!-- CONECTOR B1 -->
<div class="flex-shrink-0 flex items-center justify-center relative z-0" style="width: 32px; height: 20px;">
<div style="width: 52px; height: 16px; border-radius: 9999px; background: rgba(255,255,255,0.7); box-shadow: 0 4px 10px rgba(0,0,0,0.1); border: 2px solid white;"></div>
</div>
<!-- CÁPSULA B2: AMBAR / MIEL PASTEL -->
<div class="structured-card flex flex-col items-center justify-center text-center text-white" style="background: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);">
<div class="flex flex-col items-center justify-center px-12 py-5" style="transform: translateY(-4px);">
<div class="flex items-center gap-1 mb-2 text-amber-300 text-lg">
★ ★ ★ ★ ★
</div>
<p class="text-[18px] font-medium leading-[1.35] tracking-[-0.4px] text-white/95 max-w-[520px]">
“Mi peluquería ahora llena la agenda sola. Los clientes reservan a la medianoche y les llega la confirmación por correo y WhatsApp.”
</p>
<div class="flex items-center gap-2 mt-2.5">
<span class="w-5 h-5 rounded-full bg-white/20 flex items-center justify-center text-[10px]">✂️</span>
<span class="text-xs font-bold text-white/90">Testimonio de Comercio</span>
</div>
</div>
</div>
<!-- CONECTOR B2 -->
<div class="flex-shrink-0 flex items-center justify-center relative z-0" style="width: 32px; height: 20px;">
<div style="width: 52px; height: 16px; border-radius: 9999px; background: rgba(255,255,255,0.7); box-shadow: 0 4px 10px rgba(0,0,0,0.1); border: 2px solid white;"></div>
</div>
<!-- CÁPSULA B3: AZUL ACERO PASTEL -->
<div class="structured-card flex flex-col items-center justify-center text-center text-white" style="background: linear-gradient(135deg, #0ea5e9 0%, #0369a1 100%);">
<div class="flex flex-col items-center justify-center px-12 py-5" style="transform: translateY(-4px);">
<div class="flex items-center gap-1 mb-2 text-amber-300 text-lg">
★ ★ ★ ★ ★
</div>
<p class="text-[18px] font-medium leading-[1.35] tracking-[-0.4px] text-white/95 max-w-[520px]">
“El interruptor en caliente para pausar SINPE Móvil nos permitió hacer mantenimiento sin que ningún padre tuviera errores.”
</p>
<div class="flex items-center gap-2 mt-2.5">
<span class="w-5 h-5 rounded-full bg-white/20 flex items-center justify-center text-[10px]">⚙️</span>
<span class="text-xs font-bold text-white/90">Panel de Administración</span>
</div>
</div>
</div>
<!-- CONECTOR B3 -->
<div class="flex-shrink-0 flex items-center justify-center relative z-0" style="width: 32px; height: 20px;">
<div style="width: 52px; height: 16px; border-radius: 9999px; background: rgba(255,255,255,0.7); box-shadow: 0 4px 10px rgba(0,0,0,0.1); border: 2px solid white;"></div>
</div>
<!-- CÁPSULA B4: VERDE ESMERALDA DEEP -->
<div class="structured-card flex flex-col items-center justify-center text-center text-white" style="background: linear-gradient(135deg, #059669 0%, #064e3b 100%);">
<div class="flex flex-col items-center justify-center px-12 py-5" style="transform: translateY(-4px);">
<div class="flex items-center gap-1 mb-2 text-amber-300 text-lg">
★ ★ ★ ★ ★
</div>
<p class="text-[18px] font-medium leading-[1.35] tracking-[-0.4px] text-white/95 max-w-[520px]">
“Comprar con carné digital por QR es más rápido que pagar con efectivo. Despachamos 300 estudiantes en 15 minutos.”
</p>
<div class="flex items-center gap-2 mt-2.5">
<span class="w-5 h-5 rounded-full bg-white/20 flex items-center justify-center text-[10px]">🥪</span>
<span class="text-xs font-bold text-white/90">Cajero Soda Escolar</span>
</div>
</div>
</div>
<!-- CONECTOR B4 -->
<div class="flex-shrink-0 flex items-center justify-center relative z-0" style="width: 32px; height: 20px;">
<div style="width: 52px; height: 16px; border-radius: 9999px; background: rgba(255,255,255,0.7); box-shadow: 0 4px 10px rgba(0,0,0,0.1); border: 2px solid white;"></div>
</div>
<!-- DUPLICACIÓN EXACTA DE FILA 2 PARA LOOP INFINITO PERFECTO -->
<div class="structured-card flex flex-col items-center justify-center text-center text-white" style="background: linear-gradient(135deg, #f43f5e 0%, #be123c 100%);">
<div class="flex flex-col items-center justify-center px-12 py-5" style="transform: translateY(-4px);">
<div class="flex items-center gap-1 mb-2 text-amber-300 text-lg">
★ ★ ★ ★ ★
</div>
<p class="text-[18px] font-medium leading-[1.35] tracking-[-0.4px] text-white/95 max-w-[520px]">
“Poder bloquear alimentos chatarra y alergenos en caja desde mi celular me da una tranquilidad inmensa como mamá.”
</p>
<div class="flex items-center gap-2 mt-2.5">
<span class="w-5 h-5 rounded-full bg-white/20 flex items-center justify-center text-[10px]">🛡️</span>
<span class="text-xs font-bold text-white/90">Comentario Portal Padres</span>
</div>
</div>
</div>
<div class="flex-shrink-0 flex items-center justify-center relative z-0" style="width: 32px; height: 20px;">
<div style="width: 52px; height: 16px; border-radius: 9999px; background: rgba(255,255,255,0.7); box-shadow: 0 4px 10px rgba(0,0,0,0.1); border: 2px solid white;"></div>
</div>
<div class="structured-card flex flex-col items-center justify-center text-center text-white" style="background: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);">
<div class="flex flex-col items-center justify-center px-12 py-5" style="transform: translateY(-4px);">
<div class="flex items-center gap-1 mb-2 text-amber-300 text-lg">
★ ★ ★ ★ ★
</div>
<p class="text-[18px] font-medium leading-[1.35] tracking-[-0.4px] text-white/95 max-w-[520px]">
“Mi peluquería ahora llena la agenda sola. Los clientes reservan a la medianoche y les llega la confirmación por correo y WhatsApp.”
</p>
<div class="flex items-center gap-2 mt-2.5">
<span class="w-5 h-5 rounded-full bg-white/20 flex items-center justify-center text-[10px]">✂️</span>
<span class="text-xs font-bold text-white/90">Testimonio de Comercio</span>
</div>
</div>
</div>
<div class="flex-shrink-0 flex items-center justify-center relative z-0" style="width: 32px; height: 20px;">
<div style="width: 52px; height: 16px; border-radius: 9999px; background: rgba(255,255,255,0.7); box-shadow: 0 4px 10px rgba(0,0,0,0.1); border: 2px solid white;"></div>
</div>
<div class="structured-card flex flex-col items-center justify-center text-center text-white" style="background: linear-gradient(135deg, #0ea5e9 0%, #0369a1 100%);">
<div class="flex flex-col items-center justify-center px-12 py-5" style="transform: translateY(-4px);">
<div class="flex items-center gap-1 mb-2 text-amber-300 text-lg">
★ ★ ★ ★ ★
</div>
<p class="text-[18px] font-medium leading-[1.35] tracking-[-0.4px] text-white/95 max-w-[520px]">
“El interruptor en caliente para pausar SINPE Móvil nos permitió hacer mantenimiento sin que ningún padre tuviera errores.”
</p>
<div class="flex items-center gap-2 mt-2.5">
<span class="w-5 h-5 rounded-full bg-white/20 flex items-center justify-center text-[10px]">⚙️</span>
<span class="text-xs font-bold text-white/90">Panel de Administración</span>
</div>
</div>
</div>
<div class="flex-shrink-0 flex items-center justify-center relative z-0" style="width: 32px; height: 20px;">
<div style="width: 52px; height: 16px; border-radius: 9999px; background: rgba(255,255,255,0.7); box-shadow: 0 4px 10px rgba(0,0,0,0.1); border: 2px solid white;"></div>
</div>
<div class="structured-card flex flex-col items-center justify-center text-center text-white" style="background: linear-gradient(135deg, #059669 0%, #064e3b 100%);">
<div class="flex flex-col items-center justify-center px-12 py-5" style="transform: translateY(-4px);">
<div class="flex items-center gap-1 mb-2 text-amber-300 text-lg">
★ ★ ★ ★ ★
</div>
<p class="text-[18px] font-medium leading-[1.35] tracking-[-0.4px] text-white/95 max-w-[520px]">
“Comprar con carné digital por QR es más rápido que pagar con efectivo. Despachamos 300 estudiantes en 15 minutos.”
</p>
<div class="flex items-center gap-2 mt-2.5">
<span class="w-5 h-5 rounded-full bg-white/20 flex items-center justify-center text-[10px]">🥪</span>
<span class="text-xs font-bold text-white/90">Cajero Soda Escolar</span>
</div>
</div>
</div>
<div class="flex-shrink-0 flex items-center justify-center relative z-0" style="width: 32px; height: 20px;">
<div style="width: 52px; height: 16px; border-radius: 9999px; background: rgba(255,255,255,0.7); box-shadow: 0 4px 10px rgba(0,0,0,0.1); border: 2px solid white;"></div>
</div>
</div>
</div>
</div>
</section>
<!-- ============================================================ -->
<!-- SECCIÓN 2: DISCOS REDONDOS PASTEL ("EXPLORE MORE FEATURES") -->
<!-- ============================================================ -->
<section id="features" class="py-16 px-6 max-w-5xl mx-auto">
<div class="text-center lowercase mx-auto mb-12">
<div class="text-slate-600 text-lg sm:text-2xl font-light tracking-tight">explora todas las</div>
<div class="text-slate-900 text-3xl sm:text-5xl font-extrabold tracking-tight">funcionalidades</div>
</div>
<!-- FILA DE DISCOS CIRCULARES DE 178px IDÉNTICOS A STRUCTURED.APP -->
<div class="flex items-center justify-center flex-wrap gap-8 sm:gap-12">
<!-- Disco 1: Pagos SINPE -->
<div class="flex flex-col items-center gap-3 cursor-pointer group" onclick="setTheme('#e0f2fe')">
<div class="w-40 h-40 sm:w-44 sm:h-44 rounded-full bg-gradient-to-tr from-sky-400 to-cyan-200 p-1 shadow-lg group-hover:scale-105 group-hover:shadow-xl transition-all duration-300 flex items-center justify-center">
<div class="w-full h-full rounded-full bg-white/30 backdrop-blur-md flex flex-col items-center justify-center text-slate-900">
<span class="text-4xl mb-1">💳</span>
<span class="text-xs font-bold uppercase tracking-wider text-sky-950">sinpe móvil</span>
</div>
</div>
<div class="text-center lowercase text-slate-800 text-xl font-bold leading-tight">
pagos<br/><span class="font-light text-slate-600">instantáneos</span>
</div>
</div>
<!-- Disco 2: WhatsApp Meta API -->
<div class="flex flex-col items-center gap-3 cursor-pointer group" onclick="setTheme('#d1fae5')">
<div class="w-40 h-40 sm:w-44 sm:h-44 rounded-full bg-gradient-to-tr from-emerald-400 to-teal-200 p-1 shadow-lg group-hover:scale-105 group-hover:shadow-xl transition-all duration-300 flex items-center justify-center">
<div class="w-full h-full rounded-full bg-white/30 backdrop-blur-md flex flex-col items-center justify-center text-slate-900">
<span class="text-4xl mb-1">💬</span>
<span class="text-xs font-bold uppercase tracking-wider text-emerald-950">meta api</span>
</div>
</div>
<div class="text-center lowercase text-slate-800 text-xl font-bold leading-tight">
whatsapp<br/><span class="font-light text-slate-600">automático</span>
</div>
</div>
<!-- Disco 3: Agenda 24/7 -->
<div class="flex flex-col items-center gap-3 cursor-pointer group" onclick="setTheme('#f3e8ff')">
<div class="w-40 h-40 sm:w-44 sm:h-44 rounded-full bg-gradient-to-tr from-purple-400 to-violet-200 p-1 shadow-lg group-hover:scale-105 group-hover:shadow-xl transition-all duration-300 flex items-center justify-center">
<div class="w-full h-full rounded-full bg-white/30 backdrop-blur-md flex flex-col items-center justify-center text-slate-900">
<span class="text-4xl mb-1">🗓️</span>
<span class="text-xs font-bold uppercase tracking-wider text-purple-950">turnos 24/7</span>
</div>
</div>
<div class="text-center lowercase text-slate-800 text-xl font-bold leading-tight">
reservas<br/><span class="font-light text-slate-600">sin llamadas</span>
</div>
</div>
<!-- Disco 4: Banners Globales -->
<div class="flex flex-col items-center gap-3 cursor-pointer group" onclick="setTheme('#ffedd5')">
<div class="w-40 h-40 sm:w-44 sm:h-44 rounded-full bg-gradient-to-tr from-orange-400 to-amber-200 p-1 shadow-lg group-hover:scale-105 group-hover:shadow-xl transition-all duration-300 flex items-center justify-center">
<div class="w-full h-full rounded-full bg-white/30 backdrop-blur-md flex flex-col items-center justify-center text-slate-900">
<span class="text-4xl mb-1">📢</span>
<span class="text-xs font-bold uppercase tracking-wider text-amber-950">difusión</span>
</div>
</div>
<div class="text-center lowercase text-slate-800 text-xl font-bold leading-tight">
avisos<br/><span class="font-light text-slate-600">en caliente</span>
</div>
</div>
<!-- Disco 5: Control Total -->
<div class="flex flex-col items-center gap-3 cursor-pointer group" onclick="setTheme('#fef08a')">
<div class="w-40 h-40 sm:w-44 sm:h-44 rounded-full bg-gradient-to-tr from-yellow-400 to-amber-100 p-1 shadow-lg group-hover:scale-105 group-hover:shadow-xl transition-all duration-300 flex items-center justify-center">
<div class="w-full h-full rounded-full bg-white/30 backdrop-blur-md flex flex-col items-center justify-center text-slate-900">
<span class="text-4xl mb-1">🛡️</span>
<span class="text-xs font-bold uppercase tracking-wider text-yellow-950">seguridad</span>
</div>
</div>
<div class="text-center lowercase text-slate-800 text-xl font-bold leading-tight">
control<br/><span class="font-light text-slate-600">parental</span>
</div>
</div>
</div>
</section>
<!-- ============================================================ -->
<!-- SECCIÓN 3: AGENDA TIMELINE VISUAL DE STRUCTURED -->
<!-- ============================================================ -->
<section id="timeline" class="py-12 px-6 max-w-3xl mx-auto">
<div class="text-center lowercase mx-auto mb-8">
<div class="text-slate-600 text-lg sm:text-2xl font-light tracking-tight">una sola línea de tiempo</div>
<div class="text-slate-900 text-3xl sm:text-5xl font-extrabold tracking-tight">tu día organizado bloque a bloque</div>
</div>
<div class="relative pl-6 sm:pl-8 border-l-2 border-sky-400/60 flex flex-col gap-4 my-6">
<!-- Bloque 1 -->
<div class="p-5 rounded-[28px] bg-white/80 backdrop-blur-md border border-white shadow-xs flex items-center justify-between gap-4">
<div class="flex items-center gap-3.5">
<span class="w-12 h-12 rounded-2xl bg-sky-100 text-sky-700 flex items-center justify-center text-2xl shrink-0">💳</span>
<div>
<div class="text-xs font-bold text-sky-700">08:00 AM • Pagos</div>
<h4 class="text-base font-extrabold text-slate-900">Recarga SINPE de ₡10,000 confirmada</h4>
<p class="text-xs text-slate-500">Comprobante #9412 verificado automáticamente</p>
</div>
</div>
<span class="px-3 py-1 rounded-full bg-emerald-100 text-emerald-800 text-xs font-bold">Completado ✅</span>
</div>
<!-- Bloque 2 -->
<div class="p-5 rounded-[28px] bg-white/80 backdrop-blur-md border border-white shadow-xs flex items-center justify-between gap-4">
<div class="flex items-center gap-3.5">
<span class="w-12 h-12 rounded-2xl bg-purple-100 text-purple-700 flex items-center justify-center text-2xl shrink-0">✂️</span>
<div>
<div class="text-xs font-bold text-purple-700">11:30 AM • Cita de Servicio</div>
<h4 class="text-base font-extrabold text-slate-900">Corte & Tratamiento Capilar</h4>
<p class="text-xs text-slate-500">Recordatorio de WhatsApp enviado al cliente</p>
</div>
</div>
<span class="px-3 py-1 rounded-full bg-purple-100 text-purple-800 text-xs font-bold">En 45 min</span>
</div>
<!-- Bloque 3 -->
<div class="p-5 rounded-[28px] bg-white/80 backdrop-blur-md border border-white shadow-xs flex items-center justify-between gap-4">
<div class="flex items-center gap-3.5">
<span class="w-12 h-12 rounded-2xl bg-amber-100 text-amber-700 flex items-center justify-center text-2xl shrink-0">🥪</span>
<div>
<div class="text-xs font-bold text-amber-700">01:45 PM • Comedor</div>
<h4 class="text-base font-extrabold text-slate-900">Despacho de Pre-órdenes</h4>
<p class="text-xs text-slate-500">Alergias validadas: 0 incidentes reportados</p>
</div>
</div>
<span class="px-3 py-1 rounded-full bg-amber-100 text-amber-800 text-xs font-bold">Programado ☕</span>
</div>
</div>
</section>
<!-- PIE DE PÁGINA -->
<footer class="py-12 px-6 border-t border-white/60 text-center text-xs text-slate-600 font-medium">
<div class="max-w-4xl mx-auto flex flex-col sm:flex-row items-center justify-between gap-4">
<div class="flex items-center gap-2">
<div class="w-6 h-6 rounded-full bg-sky-600 text-white flex items-center justify-center font-bold text-xs">S</div>
<span class="font-bold text-slate-900 text-sm">SiboPay</span>
<span>• Réplica 1:1 Carrusel Structured.app</span>
</div>
<div>646px × 193px Pills • Border Radius 100px • Interlocking Connectors</div>
</div>
</footer>
<script>
const themes = ['#e0f2fe', '#d1fae5', '#ffedd5', '#f3e8ff', '#fef08a'];
let themeIdx = 0;
function setTheme(hex) {
const body = document.getElementById('pageBody');
if (body) body.style.backgroundColor = hex;
}
function toggleBackground() {
themeIdx = (themeIdx + 1) % themes.length;
setTheme(themes[themeIdx]);
}
</script>
</body>
</html>
+4 -4
View File
@@ -1,5 +1,5 @@
// SiboPay PWA Service Worker v20.5 - Ultra Fast Startup & Stale-While-Revalidate
const CACHE_NAME = 'sibopay-v20.5';
// SiboPay PWA Service Worker v20.9 - Ultra Fast Startup & Stale-While-Revalidate
const CACHE_NAME = 'sibopay-v20.9';
const STATIC_ASSETS = [
'/',
'/index.html',
@@ -8,10 +8,10 @@ const STATIC_ASSETS = [
'/pistola.html',
'/carnet.html',
'/manifest.json',
'/css/styles.css?v=19.9',
'/css/styles.css?v=20.0',
'/css/desktop.css?v=2.2',
'/js/dialogs.js?v=19.4',
'/js/app.js?v=20.5',
'/js/app.js?v=20.9',
'/js/pos.js?v=20.5',
'/js/sounds.js?v=19.4',
'/js/food-icons.js?v=19.4',
+40 -1
View File
@@ -216,6 +216,16 @@ function initDatabase() {
db.exec('ALTER TABLE transacciones_saldo ADD COLUMN IF NOT EXISTS revertido_en TIMESTAMP;');
db.exec('ALTER TABLE transacciones_saldo ADD COLUMN IF NOT EXISTS escuela_id INTEGER DEFAULT 1 REFERENCES escuelas(id);');
db.exec('ALTER TABLE usuarios ADD COLUMN IF NOT EXISTS escuela_id INTEGER DEFAULT 1 REFERENCES escuelas(id);');
db.exec('ALTER TABLE usuarios ADD COLUMN IF NOT EXISTS fecha_nacimiento VARCHAR(50);');
db.exec(`
CREATE TABLE IF NOT EXISTS password_resets (
id SERIAL PRIMARY KEY,
email VARCHAR(150) NOT NULL,
code VARCHAR(10) NOT NULL,
expires_at TIMESTAMP NOT NULL,
creado_en TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
`);
db.exec('ALTER TABLE estudiantes ADD COLUMN IF NOT EXISTS escuela_id INTEGER DEFAULT 1 REFERENCES escuelas(id);');
db.exec('ALTER TABLE estudiantes ADD COLUMN IF NOT EXISTS card_theme VARCHAR(50);');
db.exec('ALTER TABLE estudiantes ADD COLUMN IF NOT EXISTS bloqueo_qr_biometrico INTEGER DEFAULT 0;');
@@ -265,6 +275,7 @@ function initDatabase() {
nombre TEXT NOT NULL,
telefono TEXT,
email TEXT,
fecha_nacimiento TEXT,
creado_en DATETIME DEFAULT CURRENT_TIMESTAMP
);
@@ -435,8 +446,19 @@ function initDatabase() {
try { db.exec('ALTER TABLE ordenes ADD COLUMN observaciones TEXT'); } catch (e) {}
try { db.exec('ALTER TABLE ordenes ADD COLUMN escuela_id INTEGER DEFAULT 1'); } catch (e) {}
try { db.exec('ALTER TABLE estudiantes ADD COLUMN card_theme TEXT'); } catch (e) {}
try { db.exec('ALTER TABLE usuarios ADD COLUMN card_theme TEXT'); } catch (e) {}
try { db.exec('ALTER TABLE estudiantes ADD COLUMN bloqueo_qr_biometrico INTEGER DEFAULT 0'); } catch (e) {}
try { db.exec('ALTER TABLE usuarios ADD COLUMN fecha_nacimiento TEXT'); } catch (e) {}
try {
db.exec(`
CREATE TABLE IF NOT EXISTS password_resets (
id INTEGER PRIMARY KEY AUTOINCREMENT,
email TEXT NOT NULL,
code TEXT NOT NULL,
expires_at DATETIME NOT NULL,
creado_en DATETIME DEFAULT CURRENT_TIMESTAMP
);
`);
} catch (e) {}
// 10. Diseños de Tarjetas Virtuales para Estudiantes
try {
@@ -617,6 +639,23 @@ function seedUsuarios() {
db.prepare("INSERT INTO usuarios (username, password_hash, rol, nombre, telefono, email, activo) VALUES ('cajero', 'cajero123', 'cajero', 'Cajero de la Soda', '+506 8888-0000', '[email protected]', 1)").run();
}
} catch (e) {}
// Asegurar cuentas para revisión de Google Play Console
try {
const gTester = db.prepare("SELECT id FROM usuarios WHERE username = 'google_tester'").get();
if (!gTester) {
const uRes = db.prepare("INSERT INTO usuarios (username, password_hash, rol, nombre, telefono, email, activo, fecha_nacimiento, escuela_id) VALUES ('google_tester', 'SiboPay2026!', 'estudiante', 'Google Play Reviewer', '+506 8888-0001', '[email protected]', 1, '2008-05-15', 1)").run();
db.prepare("INSERT INTO estudiantes (usuario_id, codigo_estudiante, nombre_completo, edad, grado, seccion, qr_token, pin_seguridad, foto_url, saldo_colones, limite_diario_colones, alergias, padre_nombre, padre_telefono, padre_usuario_id, permitir_transferencias, tarjeta_bloqueada, activo, escuela_id) VALUES (?, 'EST-GOOGLE-001', 'Google Play Reviewer', 16, 'Secundaria', '10-A', 'QR-GOOGLE-REVIEWER-2026', '1234', NULL, 25000, 50000, 'Ninguna conocida', '', '', NULL, 1, 0, 1, 1)").run(uRes.lastInsertRowid);
}
} catch (e) {}
try {
const gPadre = db.prepare("SELECT id FROM usuarios WHERE username = 'google_padre'").get();
if (!gPadre) {
const pRes = db.prepare("INSERT INTO usuarios (username, password_hash, rol, nombre, telefono, email, activo, fecha_nacimiento, escuela_id) VALUES ('google_padre', 'SiboPay2026!', 'padre', 'Google Reviewer (Padre)', '+506 8888-0002', '[email protected]', 1, '1985-04-20', 1)").run();
db.prepare("INSERT INTO padres_estudiantes (padre_usuario_id, estudiante_id) VALUES (?, 1)").run(pRes.lastInsertRowid);
}
} catch (e) {}
}
}
+75
View File
@@ -0,0 +1,75 @@
const nodemailer = require('nodemailer');
/**
* Servicio de envío de correos electrónicos transaccionales para SiboPay
*/
function getTransporter() {
const user = process.env.SMTP_USER || process.env.SINPE_EMAIL_USER || '[email protected]';
const rawPass = process.env.SMTP_PASSWORD || process.env.SINPE_EMAIL_PASSWORD || 'aeguiflzmskmaswq';
const pass = String(rawPass).replace(/\s+/g, '');
return nodemailer.createTransport({
host: process.env.SMTP_HOST || 'smtp.gmail.com',
port: parseInt(process.env.SMTP_PORT || '465', 10),
secure: (process.env.SMTP_PORT || '465') === '465', // true para 465, false para 587
auth: {
user: user,
pass: pass
}
});
}
/**
* Envía el código numérico de 6 dígitos para restablecer contraseña
*/
async function enviarCodigoRecuperacion(destinatario, codigo, nombreUsuario = 'Usuario') {
const transporter = getTransporter();
const remitente = process.env.SMTP_FROM || `SiboPay Soporte <${process.env.SMTP_USER || '[email protected]'}>`;
const mailOptions = {
from: remitente,
to: destinatario,
subject: `🔐 SiboPay - Código para restablecer contraseña: ${codigo}`,
text: `Hola ${nombreUsuario},\n\nTu código de verificación para restablecer tu contraseña en SiboPay es: ${codigo}\n\nEste código es válido durante 15 minutos. Si no solicitaste este cambio, puedes ignorar este mensaje.\n\nAtentamente,\nEquipo SiboPay`,
html: `
<div style="font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; background-color: #f8fafc; padding: 30px 15px; color: #1e293b;">
<div style="max-width: 520px; margin: 0 auto; background: #ffffff; border-radius: 16px; overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,0.06); border: 1px solid #e2e8f0;">
<div style="background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%); padding: 26px 20px; text-align: center; color: white;">
<h1 style="margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.5px;">SiboPay</h1>
<p style="margin: 6px 0 0; font-size: 13px; opacity: 0.9;">Recuperación Segura de Cuenta</p>
</div>
<div style="padding: 28px 24px; text-align: center;">
<h2 style="font-size: 18px; color: #0f172a; margin-top: 0; margin-bottom: 12px; font-weight: 700;">Restablecer tu Contraseña</h2>
<p style="font-size: 14px; color: #64748b; line-height: 1.5; margin: 0 0 24px;">
Hola <strong>${nombreUsuario}</strong>, recibimos una solicitud para restablecer la contraseña de tu cuenta. Ingresa el siguiente código de verificación en la aplicación:
</p>
<div style="background: #f0f9ff; border: 2px dashed #0284c7; border-radius: 12px; padding: 18px 10px; margin-bottom: 24px; display: inline-block; min-width: 200px;">
<span style="font-family: monospace; font-size: 34px; font-weight: 800; letter-spacing: 8px; color: #0369a1;">${codigo}</span>
</div>
<p style="font-size: 12px; color: #94a3b8; line-height: 1.4; margin: 0;">
⏳ Este código vencerá en <strong>15 minutos</strong>.<br>
Si no solicitaste este cambio, haz caso omiso a este correo.
</p>
</div>
<div style="background: #f1f5f9; padding: 14px 20px; text-align: center; border-top: 1px solid #e2e8f0;">
<p style="margin: 0; font-size: 11px; color: #64748b;">
&copy; SiboPay - Sistema Inteligente de Billetera Online. Todos los derechos reservados.
</p>
</div>
</div>
</div>
`
};
return transporter.sendMail(mailOptions);
}
module.exports = {
enviarCodigoRecuperacion
};
+132 -12
View File
@@ -53,6 +53,7 @@ const {
const { checkSinpeEmailsOnce, simularSinpeEmail } = require('./sinpeImapService');
const { normalizarCodigoDetalle, parseSinpeEmail } = require('./sinpeParser');
const { simpleParser } = require('mailparser');
const { enviarCodigoRecuperacion } = require('./emailService');
const webpush = require('web-push');
@@ -533,25 +534,30 @@ app.post('/api/auth/login', (req, res) => {
}
});
// Registro de nuevos padres desde la pantalla de bienvenida
// Registro de nuevos usuarios (Padres o Alumnos) desde la pantalla de bienvenida
app.post('/api/auth/register-padre', (req, res) => {
try {
const { nombre, telefono, email, username, password } = req.body;
if (!nombre || !username || !password) {
return res.status(400).json({ error: 'Nombre completo, usuario y contraseña son requeridos' });
const { nombre, telefono, email, username, password, fecha_nacimiento, rol } = req.body;
if (!nombre || !username || !password || !email) {
return res.status(400).json({ error: 'Nombre completo, correo electrónico, usuario y contraseña son requeridos' });
}
const cleanUser = String(username).trim().toLowerCase();
const cleanPass = String(password).trim();
const cleanNombre = String(nombre).trim();
const cleanTel = telefono ? String(telefono).trim() : '';
const cleanEmail = email ? String(email).trim().toLowerCase() : '';
const cleanEmail = String(email).trim().toLowerCase();
const cleanFechaNac = fecha_nacimiento ? String(fecha_nacimiento).trim() : '';
const targetRol = (rol === 'estudiante' || rol === 'alumno') ? 'estudiante' : 'padre';
if (cleanUser.length < 3) {
return res.status(400).json({ error: 'El nombre de usuario debe tener al menos 3 caracteres' });
}
if (cleanPass.length < 4) {
return res.status(400).json({ error: 'La contraseña debe tener al menos 4 caracteres' });
if (cleanPass.length < 6) {
return res.status(400).json({ error: 'La contraseña debe tener al menos 6 caracteres' });
}
if (!cleanEmail.includes('@') || !cleanEmail.includes('.')) {
return res.status(400).json({ error: 'Ingresa un correo electrónico válido' });
}
// Comprobar si el usuario ya existe
@@ -560,24 +566,49 @@ app.post('/api/auth/register-padre', (req, res) => {
return res.status(400).json({ error: 'Ese nombre de usuario ya está en uso. Por favor elige otro.' });
}
// Comprobar si el correo ya está registrado
const emailExists = db.prepare('SELECT id FROM usuarios WHERE LOWER(email) = ?').get(cleanEmail);
if (emailExists) {
return res.status(400).json({ error: 'Ese correo electrónico ya está registrado. Puedes iniciar sesión o restablecer tu contraseña.' });
}
const insert = db.prepare(`
INSERT INTO usuarios (username, password_hash, rol, nombre, telefono, email)
VALUES (?, ?, 'padre', ?, ?, ?)
INSERT INTO usuarios (username, password_hash, rol, nombre, telefono, email, fecha_nacimiento)
VALUES (?, ?, ?, ?, ?, ?, ?)
`);
const result = insert.run(cleanUser, cleanPass, cleanNombre, cleanTel, cleanEmail);
const result = insert.run(cleanUser, cleanPass, targetRol, cleanNombre, cleanTel, cleanEmail, cleanFechaNac);
const newUser = {
id: result.lastInsertRowid,
username: cleanUser,
rol: 'padre',
rol: targetRol,
nombre: cleanNombre,
telefono: cleanTel,
email: cleanEmail
email: cleanEmail,
fecha_nacimiento: cleanFechaNac
};
let estudiante = null;
if (targetRol === 'estudiante') {
try {
const codEst = `EST-${Date.now().toString().slice(-6)}`;
const qrToken = `QR-${Date.now()}-${Math.random().toString(36).substring(2, 7).toUpperCase()}`;
const resEst = db.prepare(`
INSERT INTO estudiantes
(usuario_id, codigo_estudiante, nombre_completo, edad, grado, seccion, qr_token, pin_seguridad, foto_url, saldo_colones, limite_diario_colones, alergias, padre_nombre, padre_telefono, permitir_transferencias, tarjeta_bloqueada, activo, escuela_id)
VALUES (?, ?, ?, 12, 'General', '1', ?, ?, NULL, 0, 3000, 'Ninguna conocida', '', '', 1, 0, 1, 1)
`).run(newUser.id, codEst, cleanNombre, qrToken, cleanPass.slice(0, 4));
estudiante = db.prepare('SELECT * FROM estudiantes WHERE id = ?').get(resEst.lastInsertRowid);
} catch (errEst) {
console.warn('[AUTH] Error al crear ficha de estudiante automática:', errEst);
}
}
res.json({
success: true,
user: newUser,
estudiante: estudiante,
hijos: []
});
} catch (err) {
@@ -585,6 +616,95 @@ app.post('/api/auth/register-padre', (req, res) => {
}
});
// ==========================================
// RESTABLECIMIENTO DE CONTRASEÑA VÍA CORREO
// ==========================================
// 1. Enviar código de 6 dígitos al correo
app.post('/api/auth/forgot-password', async (req, res) => {
try {
const { email } = req.body;
if (!email) {
return res.status(400).json({ error: 'Por favor ingresa tu correo electrónico' });
}
const cleanEmail = String(email).trim().toLowerCase();
const user = db.prepare('SELECT id, username, nombre, email FROM usuarios WHERE LOWER(email) = ?').get(cleanEmail);
if (!user) {
return res.status(404).json({ error: 'No encontramos ninguna cuenta asociada a este correo electrónico.' });
}
// Generar código numérico de 6 dígitos
const code = Math.floor(100000 + Math.random() * 900000).toString();
const expiresAt = new Date(Date.now() + 15 * 60 * 1000).toISOString();
// Guardar código en la base de datos (eliminar previos para este correo)
try {
db.prepare('DELETE FROM password_resets WHERE LOWER(email) = ?').run(cleanEmail);
} catch (_) {}
db.prepare('INSERT INTO password_resets (email, code, expires_at) VALUES (?, ?, ?)').run(cleanEmail, code, expiresAt);
// Enviar código por correo electrónico vía SMTP
await enviarCodigoRecuperacion(cleanEmail, code, user.nombre || user.username);
res.json({
success: true,
message: 'Hemos enviado un código de 6 dígitos a tu correo electrónico.'
});
} catch (err) {
console.error('[AUTH] ❌ Error en forgot-password:', err);
res.status(500).json({ error: 'Error al enviar el código de recuperación: ' + (err.message || 'Error de conexión') });
}
});
// 2. Validar código y asignar nueva contraseña
app.post('/api/auth/reset-password', (req, res) => {
try {
const { email, code, new_password } = req.body;
if (!email || !code || !new_password) {
return res.status(400).json({ error: 'Correo, código y nueva contraseña son requeridos' });
}
const cleanEmail = String(email).trim().toLowerCase();
const cleanCode = String(code).trim();
const cleanPass = String(new_password).trim();
if (cleanPass.length < 6) {
return res.status(400).json({ error: 'La nueva contraseña debe tener al menos 6 caracteres' });
}
const resetEntry = db.prepare('SELECT id, code, expires_at FROM password_resets WHERE LOWER(email) = ? ORDER BY id DESC LIMIT 1').get(cleanEmail);
if (!resetEntry || resetEntry.code !== cleanCode) {
return res.status(400).json({ error: 'El código de verificación es inválido. Verifícalo e intenta de nuevo.' });
}
const now = new Date();
const expires = new Date(resetEntry.expires_at);
if (now > expires) {
return res.status(400).json({ error: 'El código de verificación ha expirado (validez de 15 minutos). Solicita uno nuevo.' });
}
// Actualizar contraseña del usuario
const update = db.prepare('UPDATE usuarios SET password_hash = ? WHERE LOWER(email) = ?').run(cleanPass, cleanEmail);
if (update.changes === 0) {
return res.status(404).json({ error: 'No se pudo encontrar la cuenta para actualizar la contraseña.' });
}
// Eliminar código utilizado
try {
db.prepare('DELETE FROM password_resets WHERE LOWER(email) = ?').run(cleanEmail);
} catch (_) {}
res.json({
success: true,
message: '¡Contraseña actualizada exitosamente! Ya puedes iniciar sesión con tu nueva contraseña.'
});
} catch (err) {
console.error('[AUTH] ❌ Error en reset-password:', err);
res.status(500).json({ error: 'Error al restablecer la contraseña: ' + (err.message || 'Error interno') });
}
});
// ==========================================
// ELIMINACIÓN DE CUENTA Y SUPRESIÓN DE DATOS (GOOGLE PLAY & APPLE COMPLIANCE)
// ==========================================