a2host/.agents/skills/cpic-ui-design-and-templates/SKILL.md

43 KiB

name description
cpic-ui-design-and-templates Definitive design system, color palette, responsive screen architecture (mobile to ultrawide), glassmorphism tokens, and page templates for CPIC - Conecta (SENA Intranet). Use when creating, refactoring, styling, or structuring pages, layouts, sidebars, modals, chat interfaces, tables, or dashboards.

CPIC - Conecta: Master UI Design System & Page Templates

Guía canónica y definitiva del sistema de diseño visual, paleta cromática, arquitectura responsiva multi-pantalla y plantillas estructurales para el proyecto Chatbot Intranet CPIC ("Conecta") del SENA (Centro de Procesos Industriales y Construcción).


1. Identidad Visual y Principios de Diseño

El sistema visual de CPIC combina elegancia institucional del SENA con una estética Luxury Glassmorphism moderna (estilo Linear / Apple / Vercel), optimizada para modo oscuro por defecto con soporte completo para modo claro y accesibilidad WCAG 2.1 AA/AAA.

Pilares Fundamentales:

  1. Verde Institucional SENA & Acentos Lime: Verde esmeralda institucional (#39A900) y lima eléctrica (#00FF00 / #a3e635) sobre fondos oscuros o alabastro.
  2. Elevación Glassmorphism en 3 Capas (3-Tier Glass Elevation): Jerarquía de profundidad mediante backdrop-blur, transparencias finas, bordes sutiles de 1px e iluminaciones interiores (inset 0 1px 0).
  3. Arquitectura Responsiva Mobile-First Real: Estabilidad con 100dvh, navegación off-canvas en pantallas táctiles, chips deslizables, tablas con scroll horizontal y modales convertibles a hojas inferiores (bottom-sheets).
  4. Micro-interacciones Táctiles y Fluidas: Escalamiento sutil (hover:scale-[1.01], active:scale-[0.98]), anillos de foco de alto contraste y barras de desplazamiento personalizadas de 5px.
  5. Inclusión y Accesibilidad Universal: Cumplimiento WCAG, fuente OpenDyslexic, modo alto contraste, filtros para daltonismo y docks dedicados a Lengua de Señas Colombiana (LSC).

2. Paleta de Colores y Tokens de Diseño

2.1. Acentos Institucionales SENA & Lime

Token / Variable Hex / Valor Uso Principal Modo Oscuro Modo Claro
SENA Verde Oficial #39A900 Marca institucional, títulos clave, viñetas activas #39A900 / #50e93b #39A900 / #166534
--color-lime #00FF00 Acento primario, foco de alto impacto, luces de neón #00FF00 #16a34a / #15803d
--color-lime-dark #00CC00 Estados hover, bordes de acento #00CC00 #15803d
--color-lime-deep #009900 Texto de alto contraste en fondos claros #52ff52 #009900
--color-lime-light #66FF66 Anillos de loaders, bordes secundarios #66FF66 #22c55e
--color-lime-soft #B3FFB3 Fondos de selección suaves rgba(179,255,179,0.15) rgba(179,255,179,0.3)
--color-lime-pale #E6FFE6 Resaltados de advertencias y tablas rgba(230,255,230,0.08) #e6ffe6
Tailwind Lime 400 #a3e635 Textos de acento en dark mode (text-lime) #a3e635 #15803d
Tailwind Lime 500 #84cc16 Sombras resplandecientes, scrollbars activas #84cc16 #16a34a
Emerald 800 #166534 Encabezados Markdown en modo claro #86efac #166534
Emerald 700 #15803d Enlaces y botones de texto en modo claro #4ade80 #15803d

2.2. Sistema de Elevación Glassmorphism (3-Tier Glass)

┌────────────────────────────────────────────────────────────────────────┐
│ TIER 0: App Base Wallpaper (/background.webp + velo oscuro)           │
│   ┌──────────────────────────────────────────────────────────────────┐ │
│   │ TIER 1: Ambient Glow Orbs (blur-[120px] de Lime y Emerald)       │ │
│   │   ┌────────────────────────────────────────────────────────────┐ │ │
│   │   │ TIER 2: Contenedores Estructurales (Cards, Sidebars, Main) │ │ │
│   │   │   ┌──────────────────────────────────────────────────────┐ │ │ │
│   │   │   │ TIER 3: Flotantes (Modales, Popovers, Toasts, Docks) │ │ │ │
│   │   │   └──────────────────────────────────────────────────────┘ │ │ │
│   │   └────────────────────────────────────────────────────────────┘ │ │
│   └──────────────────────────────────────────────────────────────────┘ │
└────────────────────────────────────────────────────────────────────────┘

Tier 0 — Lienzo Base:

  • Fondo General: background-image: var(--app-bg-image, url('/background.webp')) con background-size: cover; background-position: center; background-attachment: fixed;.
  • Velo de Profundidad: body::before { background: rgba(0, 0, 0, 0.2); }.
  • Fondo Fallback Dark: #0a0a0a / #0a160a.
  • Fondo Fallback Light: #f8fafc (Slate 50) / #f3f4f6.

Tier 1 — Ambient Glow Orbs:

Orbes desenfocados que crean atmósfera tridimensional detrás del contenido:

<div className="absolute inset-0 pointer-events-none overflow-hidden -z-10" aria-hidden="true">
  <div className="absolute top-10 left-1/4 w-96 h-96 bg-lime-500/8 dark:bg-lime-500/10 rounded-full blur-[120px]" />
  <div className="absolute bottom-20 right-1/4 w-96 h-96 bg-emerald-500/6 dark:bg-emerald-500/8 rounded-full blur-[140px]" />
</div>

Tier 2 — Tarjetas Estructurales y Barras de Navegación:

  • Modo Oscuro:
    bg-[rgba(10,22,10,0.85)] backdrop-blur-2xl border border-white/10
    shadow-[0_4px_24px_rgba(0,0,0,0.3),inset_0_1px_0_rgba(255,255,255,0.08)]
    
  • Modo Claro:
    bg-white/85 backdrop-blur-2xl border border-black/8
    shadow-[0_4px_24px_rgba(0,0,0,0.06),inset_0_1px_0_rgba(255,255,255,0.7)]
    

Tier 3 — Elementos Flotantes, Modales, Menús y Toasts:

  • Modo Oscuro:
    bg-[rgba(15,28,15,0.94)] backdrop-blur-3xl border border-lime/25
    shadow-[0_16px_48px_rgba(0,0,0,0.5),0_0_24px_rgba(132,204,22,0.12)]
    
  • Modo Claro:
    bg-white/95 backdrop-blur-3xl border border-slate-200/90
    shadow-[0_16px_48px_rgba(0,0,0,0.15)]
    

2.3. Jerarquía Tipográfica y Colores de Texto

  • Fuente Primaria: 'Segoe UI', 'Poppins', 'Roboto', system-ui, sans-serif.
  • Fuente de Accesibilidad: 'OpenDyslexic', 'Comic Sans MS', cursive.
  • Textos en Modo Oscuro:
    • Títulos principales (h1/h2): #ffffff con tracking-tight.
    • Títulos de sección: #86efac o #a3e635.
    • Cuerpo principal: rgba(255, 255, 255, 0.92) (text-white/90).
    • Texto secundario / metadatos: rgba(255, 255, 255, 0.65) (text-white/65).
    • Texto atenuado / timestamps: rgba(255, 255, 255, 0.40) (text-white/40).
  • Textos en Modo Claro:
    • Títulos principales (h1/h2): #0f172a (Slate 900) o #166534 (Emerald 800).
    • Cuerpo principal: #1f2937 (Gray 800).
    • Texto secundario: #4b5563 (Gray 600).
    • Texto atenuado: #9ca3af (Gray 400).

2.4. Badges de Roles y Estados Semánticos

// Superadmin / Root
<span className="bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/25 px-2 py-0.5 rounded-md text-[10px] font-semibold uppercase tracking-wide">
  ROOT
</span>

// Administrador
<span className="bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/25 px-2 py-0.5 rounded-md text-[10px] font-semibold uppercase tracking-wide">
  ADMIN
</span>

// Personal Interno / Instructor
<span className="bg-blue-500/10 text-blue-600 dark:text-blue-400 border border-blue-500/25 px-2 py-0.5 rounded-md text-[10px] font-semibold uppercase tracking-wide">
  INTERNO
</span>

// Usuario General / Aprendiz
<span className="bg-lime/15 text-lime-deep dark:text-lime border border-lime/25 px-2 py-0.5 rounded-md text-[10px] font-semibold uppercase tracking-wide">
  USUARIO
</span>

2.5. Estados de Alerta y Notificación

  • Éxito (Success): bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/30.
  • Advertencia (Warning): bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/30.
  • Peligro / Error (Danger): bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/30.
  • Informativo / Sincronización (Info): bg-cyan-500/10 text-cyan-600 dark:text-cyan-400 border-cyan-500/30.

3. Arquitectura Responsiva para Todo Tipo de Pantallas

El layout debe adaptarse sin saltos bruscos ni desbordes a través de 4 rangos de resolución:

┌─────────────────┬───────────────────┬──────────────────────┬──────────────────────┐
│  MÓVIL (<640px) │ TABLET (640-1023) │ ESCRITORIO (1024-1439│ ULTRAWIDE (1440px+)  │
│  Pantalla 1 col │  2 col adaptable  │  3 col simétrica     │  3 col con max-w     │
│  Drawer lateral │ Sidebar colapsada │  AppSidebar + Main + │  Lectura optimizada  │
│  Barra chips    │ Scroll horizontal │  RightSidebar        │  Alta densidad       │
│  Bottom-sheets  │ Modales centrados │  Snap vertical       │  Cards contenidas    │
└─────────────────┴───────────────────┴──────────────────────┴──────────────────────┘

3.1. Matriz de Adaptabilidad por Pantalla

Pantalla Breakpoint Tailwind Layout Estructural Barra Izquierda (AppSidebar) Barra Derecha (RightSidebar) Navegación Secundaria Modales / Diálogos
Móvil Pequeño 320px - 480px 1 columna vertical fluida Drawer lateral oculto (Z-50) con botón hamburguesa Píldora flotante compacta inferior derecha Barra de chips horizontal deslizable Bottom-Sheet (hoja inferior 90dvh)
Móvil Grande 481px - 639px 1 columna con márgenes p-2.5 Drawer lateral oculto con fondo oscuro translúcido Píldora flotante inferior derecha Chips deslizables centrados automáticamente Bottom-Sheet con arrastre
Tablet Portrait 640px - 767px 1 columna o 2 columnas en tarjetas Drawer lateral o riel flotante Oculta o fusionada en barra inferior Chips deslizables o pestañas Modal centrado max-w-md
Tablet Landscape 768px - 1023px 2 columnas (Sidebar + Main) Riel de iconos colapsado (w-16), expandible en hover Oculta o en menú de cabecera Pestañas fijas o barra de navegación Modal centrado max-w-lg
Escritorio Estándar 1024px - 1439px 3 columnas (AppSidebar + Main + RightSidebar) Colapsada a iconos (w-[72px]), expandible a w-64 Riel estático vertical (w-14 o w-16) Puntos navegadores flotantes a la derecha Modal centrado con fondo desenfocado
Ultrawide / 4K 1440px en adelante 3 columnas con límites de lectura (max-w-7xl) Barra fija expandible Riel estático vertical con herramientas Puntos flotantes + atajos de teclado Modal centrado max-w-2xl

3.2. Reglas Críticas de Estabilidad de Pantalla

  1. Uso Exclusivo de Dynamic Viewport Height (100dvh):
    • NUNCA usar 100vh en contenedores de aplicación completa porque las barras de navegación dinámicas de iOS Safari y Chrome Android causan saltos y recortes.
    • Usar: className="h-[100dvh] max-h-[100dvh] w-full flex flex-col md:flex-row relative z-10 overflow-hidden p-2 sm:p-3 gap-2 sm:gap-3".
  2. Safe Area Insets (Áreas Seguras para Notches y Home Bar):
    • Toda barra inferior o botón flotante debe respetar las áreas seguras:
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    right: max(0.75rem, env(safe-area-inset-right));
    left: max(0.75rem, env(safe-area-inset-left));
    
  3. Áreas Táctiles Mínimas (Touch Targets):
    • Todo botón o enlace interactivo debe tener al menos 44px x 44px (min-h-[44px] min-w-[44px]) o padding generoso.
  4. Prevención de Zoom Automático en iOS:
    • Todo input y textarea debe tener text-sm en desktop pero un tamaño computado de al menos 16px en móvil para evitar que iOS haga zoom indeseado.
  5. Scrollbars Personalizadas y Ocultamiento Táctil:
    • En pantallas móviles (< 768px), las barras de desplazamiento se ocultan para maximizar espacio táctil. En desktop, usan la píldora de 5px (.custom-scrollbar).

4. Plantillas Maestras de Página (Templates)

A continuación se presentan las estructuras exactas para las vistas principales de la aplicación.

4.1. Template 1: Shell Base del Portal / Landing Page (3 Columnas)

Esta plantilla es la base de la pantalla de inicio (/ o /[lang]/index.astro), con AppSidebar colapsable, cabecera móvil, chips deslizables, scroll continuo por secciones con snap vertical, puntos indicadores a la derecha, barra flotante de pie de página retráctil y RightSidebar.

import React, { useRef, useState, useCallback, useEffect } from "react";
import AppSidebar from "./AppSidebar.jsx";
import RightSidebar from "./RightSidebar.jsx";
import Footer from "./Footer.jsx";
import { Link } from "../../utils/navigate.jsx";

const SECCIONES = [
  { id: 'hero', name: 'Inicio', icon: 'fa-house' },
  { id: 'oferta', name: 'Oferta Académica', icon: 'fa-graduation-cap' },
  { id: 'mision', name: 'Misión y Visión', icon: 'fa-compass' },
  { id: 'contacto', name: 'Contacto', icon: 'fa-headset' },
];

export default function PortalLayoutTemplate() {
  const mainRef = useRef(null);
  const chipsNavRef = useRef(null);
  const [activeSection, setActiveSection] = useState(0);
  const [isFooterVisible, setIsFooterVisible] = useState(false);
  const lastScrollTopRef = useRef(0);

  const handleScroll = useCallback((e) => {
    const el = e.target;
    const currentScroll = el.scrollTop;
    const isAtBottom = el.scrollHeight - currentScroll - el.clientHeight < 60;

    // Footer retráctil
    if (isAtBottom || (currentScroll - lastScrollTopRef.current > 10 && currentScroll > 60)) {
      setIsFooterVisible(true);
    } else if (currentScroll - lastScrollTopRef.current < -10) {
      setIsFooterVisible(false);
    }
    lastScrollTopRef.current = currentScroll;

    // Detección de sección activa
    const sections = el.querySelectorAll('section');
    sections.forEach((sec, idx) => {
      const top = sec.offsetTop - el.offsetTop;
      const height = sec.offsetHeight;
      if (currentScroll >= top - height / 3 && currentScroll < top + height / 2) {
        setActiveSection(idx);
      }
    });
  }, []);

  const scrollToSection = (idx) => {
    if (!mainRef.current) return;
    const sections = mainRef.current.querySelectorAll('section');
    if (sections[idx]) {
      sections[idx].scrollIntoView({ behavior: 'smooth', block: 'start' });
      setActiveSection(idx);
    }
  };

  return (
    <div className="h-[100dvh] max-h-[100dvh] w-full flex flex-col md:flex-row relative z-10 overflow-hidden p-2 sm:p-3 gap-2 sm:gap-3">
      {/* 1. Orbes de resplandor ambiental */}
      <div className="absolute inset-0 pointer-events-none overflow-hidden -z-10" aria-hidden="true">
        <div className="absolute top-10 left-1/4 w-96 h-96 bg-lime-500/8 dark:bg-lime-500/10 rounded-full blur-[120px]" />
        <div className="absolute bottom-20 right-1/4 w-96 h-96 bg-emerald-500/6 dark:bg-emerald-500/8 rounded-full blur-[140px]" />
      </div>

      {/* 2. Barra lateral de navegación principal */}
      <AppSidebar />

      {/* 3. Contenedor Central Dinámico */}
      <div className="flex-1 min-w-0 relative flex flex-col h-full overflow-hidden">
        {/* Cabecera y Chips para Móvil (< 768px) */}
        <div className="md:hidden shrink-0 flex flex-col gap-1.5 mb-1.5 z-20">
          <div className="flex items-center justify-between px-3 py-2 bg-white/85 dark:bg-[rgba(10,22,10,0.85)] backdrop-blur-2xl border border-black/8 dark:border-white/10 rounded-2xl shadow-[0_4px_20px_rgba(0,0,0,0.06),inset_0_1px_0_rgba(255,255,255,0.7)] dark:shadow-[0_4px_20px_rgba(0,0,0,0.3),inset_0_1px_0_rgba(255,255,255,0.08)] pl-14">
            <div className="flex items-center gap-2 min-w-0">
              <img src="/Logo.webp" alt="CPIC" className="w-6 h-6 rounded-lg object-cover" />
              <span className="font-bold text-xs text-gray-900 dark:text-white truncate">
                CPIC <span className="text-[#39A900] dark:text-lime">conecta</span>
              </span>
            </div>
            <Link
              href="/chat"
              className="px-2.5 py-1 rounded-xl bg-lime/15 text-lime-deep dark:text-lime border border-lime/30 text-xs font-semibold flex items-center gap-1.5 no-underline hover:bg-lime/25 transition-colors"
            >
              <i className="fa-solid fa-comment-dots text-[11px]" />
              <span>Chat</span>
            </Link>
          </div>

          {/* Chips horizontales deslizables */}
          <div
            ref={chipsNavRef}
            className="w-full overflow-x-auto flex items-center gap-1.5 py-1 px-1 border border-black/8 dark:border-white/10 bg-white/75 dark:bg-[rgba(10,22,10,0.75)] backdrop-blur-2xl rounded-2xl"
            style={{ scrollbarWidth: 'none' }}
          >
            {SECCIONES.map((sec, idx) => (
              <button
                key={sec.id}
                onClick={() => scrollToSection(idx)}
                className={`px-3 py-1.5 rounded-xl text-xs font-semibold whitespace-nowrap transition-all flex items-center gap-1.5 shrink-0 cursor-pointer min-h-[36px] ${
                  activeSection === idx
                    ? "bg-lime text-black shadow-sm font-bold scale-[1.02]"
                    : "bg-black/5 dark:bg-white/5 text-gray-700 dark:text-white/70 hover:bg-black/10 dark:hover:bg-white/10"
                }`}
              >
                <i className={`fa-solid ${sec.icon} text-[10px]` } />
                <span>{sec.name}</span>
              </button>
            ))}
          </div>
        </div>

        {/* Área Principal con Snap Scroll y Máscara de Degradado */}
        <main
          ref={mainRef}
          onScroll={handleScroll}
          tabIndex={0}
          className="flex-1 min-w-0 flex flex-col overflow-y-auto scroll-smooth snap-none md:snap-y md:snap-mandatory custom-scrollbar relative h-full focus:outline-none md:[mask-image:linear-gradient(to_bottom,transparent_0%,black_1.5%,black_98.5%,transparent_100%)]"
        >
          {/* Secciones como tarjetas Tier 2 */}
          <section className="min-h-full snap-start flex flex-col justify-center p-4 sm:p-8 bg-white/85 dark:bg-[rgba(10,22,10,0.85)] backdrop-blur-2xl border border-black/8 dark:border-white/10 rounded-3xl mb-3 shadow-[0_8px_32px_rgba(0,0,0,0.1)]">
            <h1 className="text-2xl sm:text-4xl font-extrabold text-gray-900 dark:text-white tracking-tight">
              Bienvenido a <span className="text-[#39A900] dark:text-lime">CPIC Conecta</span>
            </h1>
            <p className="mt-2 text-sm sm:text-base text-gray-600 dark:text-white/70 max-w-xl">
              Asistente virtual e intranet del Centro de Procesos Industriales y Construcción.
            </p>
          </section>
        </main>

        {/* Navegador de puntos lateral (Desktop lg+) */}
        <nav
          aria-label="Navegación de secciones"
          className="hidden lg:flex absolute right-4 top-1/2 -translate-y-1/2 z-30 flex-col gap-2 p-1.5 rounded-full bg-black/50 dark:bg-black/60 backdrop-blur-xl border border-white/10 shadow-xl"
        >
          {SECCIONES.map((sec, idx) => (
            <button
              key={sec.id}
              onClick={() => scrollToSection(idx)}
              aria-label={`Ir a sección ${sec.name}`}
              className={`w-2.5 rounded-full transition-all duration-300 ${
                activeSection === idx
                  ? 'h-6 bg-lime shadow-[0_0_10px_rgba(132,204,22,0.8)]'
                  : 'h-2.5 bg-white/35 hover:bg-white/80 hover:scale-125'
              }`}
            />
          ))}
        </nav>
      </div>

      {/* 4. Footer Retráctil Flotante */}
      <Footer isVisible={isFooterVisible} onToggle={() => setIsFooterVisible(false)} />

      {/* 5. Barra Lateral Derecha de Herramientas */}
      <RightSidebar />
    </div>
  );
}

4.2. Template 2: Área de Trabajo del Chat con IA (Chat.jsx)

Estructura de la vista de conversación (/chat), con cabecera de estado y modelo, flujo de mensajes con Markdown enriquecido, dock de interpretación LSC, botón flotante de retorno inferior con alerta de nuevos mensajes y barra de entrada multimedia.

import React, { useState, useRef } from "react";
import { motion, AnimatePresence } from 'framer-motion';

export default function ChatTemplate() {
  const [messages, setMessages] = useState([]);
  const [inputValue, setInputValue] = useState('');
  const [isTyping, setIsTyping] = useState(false);
  const [showScrollBottom, setShowScrollBottom] = useState(false);
  const messagesEndRef = useRef(null);

  return (
    <div className="flex-1 h-full flex flex-col bg-white/85 dark:bg-[rgba(10,22,10,0.85)] backdrop-blur-2xl border border-black/8 dark:border-white/10 rounded-2xl md:rounded-3xl shadow-[0_8px_32px_rgba(0,0,0,0.12),inset_0_1px_0_rgba(255,255,255,0.7)] dark:shadow-[0_8px_32px_rgba(0,0,0,0.4),inset_0_1px_0_rgba(255,255,255,0.08)] overflow-hidden relative">

      {/* Cabecera del Chat: Estado de Conexión y Modelo */}
      <header className="px-4 py-3 border-b border-black/8 dark:border-white/10 flex items-center justify-between shrink-0 bg-white/50 dark:bg-white/[0.02]">
        <div className="flex items-center gap-3">
          <div className="w-9 h-9 rounded-xl bg-lime/15 border border-lime/30 flex items-center justify-center text-lime-deep dark:text-lime">
            <i className="fa-solid fa-robot text-base" />
          </div>
          <div>
            <h2 className="font-bold text-sm text-gray-900 dark:text-white flex items-center gap-2">
              <span>Asistente CPIC</span>
              <span className="w-2 h-2 rounded-full bg-lime animate-pulse" />
            </h2>
            <p className="text-[11px] text-gray-500 dark:text-white/50">Gemini Pro • RAG Activo</p>
          </div>
        </div>

        {/* Acciones de Cabecera */}
        <div className="flex items-center gap-1.5">
          <button className="w-8 h-8 rounded-xl hover:bg-black/5 dark:hover:bg-white/8 text-gray-600 dark:text-white/70 flex items-center justify-center transition-colors">
            <i className="fa-solid fa-magnifying-glass text-xs" />
          </button>
          <button className="w-8 h-8 rounded-xl hover:bg-black/5 dark:hover:bg-white/8 text-gray-600 dark:text-white/70 flex items-center justify-center transition-colors">
            <i className="fa-solid fa-clock-rotate-left text-xs" />
          </button>
        </div>
      </header>

      {/* Contenedor de Mensajes con Scroll */}
      <div className="flex-1 min-h-0 overflow-y-auto px-3 py-3 sm:px-6 sm:py-5 flex flex-col gap-3 custom-scrollbar relative">
        {/* Mensaje del Bot */}
        <div className="w-full flex justify-start">
          <div className="max-w-[88%] sm:max-w-[75%] rounded-2xl p-4 bg-white/70 dark:bg-white/[0.05] border border-black/6 dark:border-white/10 backdrop-blur-xl shadow-sm">
            <div className="message-text text-sm text-gray-800 dark:text-white/90 leading-relaxed">
              <p>¡Hola! Soy el asistente virtual del CPIC. ¿En qué puedo orientarte hoy sobre matrículas, programas o trámites?</p>
            </div>
            {/* Acciones de feedback y LSC */}
            <div className="flex items-center gap-2 mt-2 pt-2 border-t border-black/6 dark:border-white/8 text-xs text-gray-400 dark:text-white/40">
              <button className="hover:text-lime transition-colors" title="Me gusta"><i className="fa-regular fa-thumbs-up" /></button>
              <button className="hover:text-red-400 transition-colors" title="No me gusta"><i className="fa-regular fa-thumbs-down" /></button>
              <button className="hover:text-lime transition-colors ml-auto flex items-center gap-1 text-[11px]">
                <i className="fa-solid fa-hands-asl-interpreting" />
                <span>Ver en LSC</span>
              </button>
            </div>
          </div>
        </div>

        {/* Mensaje del Usuario */}
        <div className="w-full flex justify-end">
          <div className="max-w-[88%] sm:max-w-[75%] rounded-2xl p-3.5 bg-lime/15 dark:bg-lime/20 border border-lime/30 text-gray-900 dark:text-white text-sm shadow-sm">
            ¿Cuáles son las fechas de inscripción para la carrera técnica en Construcción?
          </div>
        </div>

        <div ref={messagesEndRef} />
      </div>

      {/* Píldora Flotante "Ir al Final" */}
      {showScrollBottom && (
        <button
          type="button"
          className="absolute bottom-20 right-5 z-20 flex items-center gap-2 px-3.5 py-2 rounded-full bg-white/90 dark:bg-[rgba(10,22,10,0.92)] backdrop-blur-2xl border border-black/10 dark:border-white/15 text-gray-800 dark:text-white shadow-lg text-xs font-semibold cursor-pointer hover:scale-105 active:scale-95 transition-all"
        >
          <i className="fa-solid fa-arrow-down text-[#39A900] dark:text-lime" />
          <span>Ir al final</span>
        </button>
      )}

      {/* Barra Inferior de Entrada (Input Bar) */}
      <footer className="p-3 sm:p-4 border-t border-black/8 dark:border-white/10 bg-white/40 dark:bg-black/20 shrink-0">
        <form onSubmit={(e) => { e.preventDefault(); }} className="flex items-center gap-2">
          <div className="flex-1 relative flex items-center">
            <input
              type="text"
              value={inputValue}
              onChange={(e) => setInputValue(e.target.value)}
              placeholder="Escribe tu consulta aquí..."
              className="w-full px-4 py-3 bg-white/70 dark:bg-black/40 backdrop-blur-xl border border-black/10 dark:border-white/12 rounded-2xl text-sm text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-white/30 focus:outline-none focus:border-[#39A900] focus:ring-2 focus:ring-[#39A900]/20 transition-all"
            />
            <button
              type="button"
              className="absolute right-3 text-gray-400 hover:text-lime transition-colors"
              title="Dictado por voz"
            >
              <i className="fa-solid fa-microphone text-sm" />
            </button>
          </div>

          <button
            type="submit"
            disabled={!inputValue.trim()}
            className="w-11 h-11 rounded-2xl bg-lime text-black flex items-center justify-center font-bold shadow-md hover:scale-105 active:scale-95 disabled:opacity-40 disabled:pointer-events-none transition-all cursor-pointer shrink-0"
            title="Enviar mensaje"
          >
            <i className="fa-solid fa-paper-plane text-sm" />
          </button>
        </form>
      </footer>
    </div>
  );
}

4.3. Template 3: Panel de Administración y Tablas CRUD (AdminApp.jsx)

Plantilla para tableros de gestión, métricas, CRUD de usuarios/categorías y tablas interactivas TanStack.

import React, { useState } from "react";
import AppSidebar from "./AppSidebar.jsx";
import RightSidebar from "./RightSidebar.jsx";

const TABS = [
  { id: 'dashboard', label: 'Métricas', icon: 'fa-chart-pie' },
  { id: 'usuarios', label: 'Usuarios', icon: 'fa-users' },
  { id: 'roles', label: 'Roles y Permisos', icon: 'fa-shield-halved' },
  { id: 'preguntas', label: 'Base de Conocimiento', icon: 'fa-database' },
  { id: 'tickets', label: 'Tickets y Soporte', icon: 'fa-ticket' },
];

export default function AdminAppTemplate() {
  const [currentTab, setCurrentTab] = useState('dashboard');
  const [searchTerm, setSearchTerm] = useState('');

  return (
    <div className="h-[100dvh] max-h-[100dvh] w-full flex flex-col md:flex-row relative z-10 overflow-hidden p-2 sm:p-3 gap-2 sm:gap-3">
      <AppSidebar />

      <div className="flex-1 min-w-0 flex flex-col h-full overflow-hidden bg-white/85 dark:bg-[rgba(10,22,10,0.85)] backdrop-blur-2xl border border-black/8 dark:border-white/10 rounded-2xl md:rounded-3xl shadow-[0_8px_32px_rgba(0,0,0,0.12)]">

        {/* Barra Superior del Panel Admin: Pestañas y Acciones */}
        <header className="px-4 py-3 sm:px-6 sm:py-4 border-b border-black/8 dark:border-white/10 flex flex-wrap items-center justify-between gap-3 shrink-0">
          <div>
            <h1 className="text-lg sm:text-xl font-extrabold text-gray-900 dark:text-white flex items-center gap-2">
              <i className="fa-solid fa-shield-halved text-[#39A900] dark:text-lime" />
              <span>Gestión de Intranet</span>
            </h1>
            <p className="text-xs text-gray-500 dark:text-white/50">Control de acceso, embeddings y métricas</p>
          </div>

          {/* Navegación por pestañas tipo píldora */}
          <div className="flex items-center gap-1 overflow-x-auto max-w-full p-1 bg-black/5 dark:bg-white/5 rounded-2xl border border-black/6 dark:border-white/8">
            {TABS.map((tab) => (
              <button
                key={tab.id}
                onClick={() => setCurrentTab(tab.id)}
                className={`px-3 py-1.5 rounded-xl text-xs font-semibold whitespace-nowrap transition-all flex items-center gap-1.5 cursor-pointer ${
                  currentTab === tab.id
                    ? 'bg-lime text-black shadow-sm font-bold scale-[1.02]'
                    : 'text-gray-600 dark:text-white/60 hover:text-gray-950 dark:hover:text-white'
                }`}
              >
                <i className={`fa-solid ${tab.icon} text-[11px]` } />
                <span>{tab.label}</span>
              </button>
            ))}
          </div>
        </header>

        {/* Contenido Dinámico del Tableros */}
        <main className="flex-1 overflow-y-auto p-4 sm:p-6 custom-scrollbar space-y-6">

          {/* 1. Fila de Tarjetas de Estadísticas (Tier 2 Glass) */}
          <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3 sm:gap-4">
            {[
              { label: 'Consultas Hoy', val: '1,420', change: '+12%', icon: 'fa-comments', color: 'lime' },
              { label: 'Usuarios Activos', val: '384', change: '+5%', icon: 'fa-users', color: 'blue' },
              { label: 'Embeddings Indexados', val: '8,950', change: '100%', icon: 'fa-vector-square', color: 'emerald' },
              { label: 'Tickets Pendientes', val: '6', change: '-2', icon: 'fa-circle-exclamation', color: 'amber' },
            ].map((stat, idx) => (
              <div
                key={idx}
                className="p-4 rounded-2xl bg-white/60 dark:bg-white/[0.04] border border-black/8 dark:border-white/10 backdrop-blur-xl shadow-sm hover:scale-[1.01] transition-transform"
              >
                <div className="flex items-center justify-between text-gray-500 dark:text-white/50 text-xs font-semibold">
                  <span>{stat.label}</span>
                  <i className={`fa-solid ${stat.icon} text-sm text-[#39A900] dark:text-lime`} />
                </div>
                <div className="mt-2 text-2xl font-black text-gray-900 dark:text-white tabular-nums tracking-tight">
                  {stat.val}
                </div>
                <div className="mt-1 text-[11px] font-semibold text-emerald-500 flex items-center gap-1">
                  <span>{stat.change}</span>
                  <span className="text-gray-400 dark:text-white/30 font-normal">vs periodo anterior</span>
                </div>
              </div>
            ))}
          </div>

          {/* 2. Barra de Búsqueda y Botones de Acción */}
          <div className="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-3">
            <div className="relative flex-1 max-w-md">
              <i className="fa-solid fa-magnifying-glass absolute left-3.5 top-1/2 -translate-y-1/2 text-gray-400 dark:text-white/30 text-xs" />
              <input
                type="text"
                value={searchTerm}
                onChange={(e) => setSearchTerm(e.target.value)}
                placeholder="Filtrar por nombre, correo o rol..."
                className="w-full pl-9 pr-4 py-2.5 bg-white/60 dark:bg-black/40 backdrop-blur-xl border border-black/10 dark:border-white/12 rounded-xl text-xs text-gray-900 dark:text-white placeholder-gray-400 focus:outline-none focus:border-[#39A900] focus:ring-2 focus:ring-[#39A900]/20"
              />
            </div>

            <div className="flex items-center gap-2">
              <button className="px-3.5 py-2.5 rounded-xl bg-lime text-black font-bold text-xs flex items-center gap-1.5 shadow-sm hover:scale-105 active:scale-95 transition-all cursor-pointer">
                <i className="fa-solid fa-plus text-xs" />
                <span>Crear Nuevo</span>
              </button>
            </div>
          </div>

          {/* 3. Tabla de Datos Responsive con Scroll Horizontal */}
          <div className="w-full overflow-x-auto rounded-2xl border border-black/8 dark:border-white/10 bg-white/40 dark:bg-black/20 backdrop-blur-xl">
            <table className="w-full text-left text-xs admin-table border-collapse">
              <thead>
                <tr className="border-b border-black/8 dark:border-white/10 text-gray-500 dark:text-white/60 font-semibold uppercase tracking-wider text-[10px]">
                  <th className="p-3.5">Usuario</th>
                  <th className="p-3.5">Rol</th>
                  <th className="p-3.5">Estado</th>
                  <th className="p-3.5">Último Acceso</th>
                  <th className="p-3.5 text-right">Acciones</th>
                </tr>
              </thead>
              <tbody className="divide-y divide-black/6 dark:divide-white/6 text-gray-800 dark:text-white/80">
                <tr className="hover:bg-black/5 dark:hover:bg-white/5 transition-colors">
                  <td className="p-3.5 flex items-center gap-2.5">
                    <div className="w-8 h-8 rounded-xl bg-lime/15 border border-lime/30 flex items-center justify-center font-bold text-lime-deep dark:text-lime">
                      G
                    </div>
                    <div>
                      <div className="font-semibold text-gray-900 dark:text-white">Geronimo Gómez</div>
                      <div className="text-[10px] text-gray-400 dark:text-white/40">geronimo@sena.edu.co</div>
                    </div>
                  </td>
                  <td className="p-3.5">
                    <span className="px-2 py-0.5 rounded-md text-[10px] font-semibold uppercase bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/25">
                      ROOT
                    </span>
                  </td>
                  <td className="p-3.5">
                    <span className="inline-flex items-center gap-1.5 text-emerald-500 font-medium text-[11px]">
                      <span className="w-1.5 h-1.5 rounded-full bg-emerald-500" />
                      Activo
                    </span>
                  </td>
                  <td className="p-3.5 tabular-nums text-gray-400 dark:text-white/40">Hoy, 09:28</td>
                  <td className="p-3.5 text-right">
                    <button className="w-7 h-7 rounded-lg hover:bg-black/10 dark:hover:bg-white/10 text-gray-500 hover:text-lime transition-colors">
                      <i className="fa-solid fa-pen-to-square text-xs" />
                    </button>
                  </td>
                </tr>
              </tbody>
            </table>
          </div>
        </main>
      </div>

      <RightSidebar />
    </div>
  );
}

4.4. Template 4: Autenticación y Diálogos de Seguridad (AuthApp.jsx)

Plantilla centrada de tarjeta de cristal para inicio de sesión, registro y recuperación de contraseña.

import React, { useState } from "react";

export default function AuthTemplate() {
  const [isRegister, setIsRegister] = useState(false);

  return (
    <div className="min-h-[100dvh] w-full flex items-center justify-center p-3 sm:p-6 relative overflow-hidden">
      {/* Resplandor ambiental */}
      <div className="absolute inset-0 pointer-events-none -z-10">
        <div className="absolute top-1/4 left-1/3 w-96 h-96 bg-lime-500/10 rounded-full blur-[140px]" />
      </div>

      {/* Tarjeta de Cristal Centrada */}
      <div className="w-full max-w-md bg-white/85 dark:bg-[rgba(10,22,10,0.88)] backdrop-blur-2xl border border-black/8 dark:border-white/12 rounded-3xl p-6 sm:p-8 shadow-[0_16px_48px_rgba(0,0,0,0.2),inset_0_1px_0_rgba(255,255,255,0.1)]">
        {/* Logo y Encabezado */}
        <div className="flex flex-col items-center text-center mb-6">
          <div className="w-14 h-14 rounded-2xl bg-lime/15 border border-lime/30 flex items-center justify-center text-lime mb-3 shadow-[0_0_20px_rgba(132,204,22,0.25)]">
            <i className="fa-solid fa-shield-halved text-2xl text-[#39A900] dark:text-lime" />
          </div>
          <h1 className="text-xl sm:text-2xl font-black text-gray-900 dark:text-white tracking-tight">
            CPIC <span className="text-[#39A900] dark:text-lime">Conecta</span>
          </h1>
          <p className="text-xs text-gray-500 dark:text-white/50 mt-1">
            Ingresa tus credenciales institucionales del SENA
          </p>
        </div>

        {/* Selector de pestañas Login / Registro */}
        <div className="grid grid-cols-2 p-1 bg-black/5 dark:bg-white/5 rounded-2xl mb-5 border border-black/6 dark:border-white/8">
          <button
            onClick={() => setIsRegister(false)}
            className={`py-2 rounded-xl text-xs font-bold transition-all ${
              !isRegister ? 'bg-lime text-black shadow-sm' : 'text-gray-600 dark:text-white/60'
            }`}
          >
            Iniciar Sesión
          </button>
          <button
            onClick={() => setIsRegister(true)}
            className={`py-2 rounded-xl text-xs font-bold transition-all ${
              isRegister ? 'bg-lime text-black shadow-sm' : 'text-gray-600 dark:text-white/60'
            }`}
          >
            Registrarse
          </button>
        </div>

        {/* Formulario */}
        <form onSubmit={(e) => e.preventDefault()} className="space-y-3.5">
          <div>
            <label className="block text-[11px] font-semibold text-gray-700 dark:text-white/70 uppercase tracking-wider mb-1">
              Correo Institucional
            </label>
            <input
              type="email"
              placeholder="nombre@sena.edu.co"
              className="w-full px-4 py-3 bg-white/60 dark:bg-black/40 backdrop-blur-xl border border-black/10 dark:border-white/12 rounded-2xl text-sm text-gray-900 dark:text-white placeholder-gray-400 focus:outline-none focus:border-[#39A900] focus:ring-2 focus:ring-[#39A900]/20 transition-all"
            />
          </div>

          <div>
            <label className="block text-[11px] font-semibold text-gray-700 dark:text-white/70 uppercase tracking-wider mb-1">
              Contraseña
            </label>
            <input
              type="password"
              placeholder="••••••••"
              className="w-full px-4 py-3 bg-white/60 dark:bg-black/40 backdrop-blur-xl border border-black/10 dark:border-white/12 rounded-2xl text-sm text-gray-900 dark:text-white placeholder-gray-400 focus:outline-none focus:border-[#39A900] focus:ring-2 focus:ring-[#39A900]/20 transition-all"
            />
          </div>

          <button
            type="submit"
            className="w-full py-3.5 mt-2 rounded-2xl bg-lime text-black font-extrabold text-sm shadow-[0_4px_16px_rgba(132,204,22,0.3)] hover:scale-[1.01] active:scale-[0.98] transition-all cursor-pointer"
          >
            {isRegister ? 'Crear Cuenta' : 'Ingresar'}
          </button>
        </form>
      </div>
    </div>
  );
}

5. Micro-Interacciones, Animaciones y Clases Utilitarias

5.1. Reglas de Interacción Táctil

  • Botones y Enlaces:
    • transition-all duration-200 ease-out obligatorio en todos los interactivos.
    • Elevación hover: hover:scale-[1.01] o hover:scale-[1.02].
    • Presión táctil (click/tap): active:scale-[0.98].
    • Anillo de Foco Accesible: focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-lime focus-visible:ring-offset-2 focus-visible:ring-offset-black.

5.2. Clases de Animación y Keyframes (global.css)

  • --animate-slide-in-left: Entrada fluida de cajón lateral.
  • --animate-typing-bounce: Indicador de tres puntos rebotando para el bot escribiendo.
  • --animate-wave: Onda acústica para el panel de dictado por voz.
  • --animate-classify-spin: Spinner de anillo con aceleración para la clasificación RAG.
  • --animate-progress-bar: Barra de cuenta regresiva de 6s para notificaciones Toast.

6. Accesibilidad (WCAG 2.1 AA/AAA)

El sistema soporta por diseño y mediante clases en html:

  1. Contraste Mínimo:
    • Texto normal: ratio >= 4.5:1 contra fondos glassmorphism.
    • Texto grande e iconos clave: ratio >= 3.0:1.
  2. Modo Alto Contraste: html.a11y-high-contrast { filter: contrast(1.4); }.
  3. Reducción de Movimiento: @media (prefers-reduced-motion: reduce) suprime todas las transiciones y animaciones a 0.01ms.
  4. Fuente para Dislexia: html.a11y-dyslexia-font activa 'OpenDyslexic'.
  5. Filtros de Daltonismo: Modos Protanopia, Deuteranopia y Tritanopia vía filtros SVG nativos.
  6. LSC (Lengua de Señas Colombiana): Integración de dock flotante para video interpretativo de preguntas y respuestas.

7. Checklist de Verificación de Diseño para el Desarrollador/Agente

Antes de dar por completado un cambio visual o nueva página, comprobar:

  • Lienzo: ¿Usa h-[100dvh] en el contenedor raíz en vez de 100vh?
  • Modo Oscuro / Claro: ¿Se comprueban ambos temas con dark: y fondos glass legibles?
  • Acentos: ¿Los títulos y acentos principales usan #39A900, var(--color-lime) o #166534 en modo claro?
  • Móvil (< 768px): ¿El menú lateral se convierte en drawer off-canvas con botón flotante?
  • Móvil (< 768px): ¿Las pestañas o categorías usan un contenedor deslizable horizontalmente sin scrollbar visible?
  • Scrollbars: ¿Tienen la clase .custom-scrollbar de 5px?
  • Interacciones: ¿Tienen transition-all duration-200 y active:scale-[0.98]?
  • Accesibilidad: ¿Los elementos interactivos tienen etiquetas aria-label o títulos descriptivos?
  • Áreas Táctiles: ¿Los botones tienen al menos 44px de altura/ancho en móviles?