/* =================================================================
   SINAPSE OS + WEB TOTAL HUB - UNIFIED CORE SYSTEM (V3.0 ULTIMATE)
   -----------------------------------------------------------------
   Arquitectura: Premium Glassmorphism, Deep Space & Cyberpunk
   Estándar: EC0249 / Metodología Tariki
   Stack: Supabase + Vanilla JS + UI/UX Polymorphic
   Propósito: ERP, CMS, LMS, Kanban y Catálogo Público
   ================================================================= */

/* =================================================================
   1. CONFIGURACIÓN DE VARIABLES MAESTRAS (DESIGN SYSTEM)
   ================================================================= */
:root {
    /* --- Paleta Principal (Deep Space & Cyber) --- */
    --c-bg-app: #050509;           /* Fondo absoluto del sistema */
    --c-bg-panel: #0a0b14;         /* Fondo secundario (Paneles y Sidebar) */
    --c-bg-input: #0f1019;         /* Fondo para inputs y textareas */
    
    /* --- Acentos Neón & Tecnológicos --- */
    --c-cyan: #00f3ff;             /* Cyan Tecnológico (Principal OS) */
    --c-cyan-dim: rgba(0, 243, 255, 0.15);
    --c-cyan-glow: rgba(0, 243, 255, 0.6);
    --c-purple: #bd00ff;           /* Púrpura IA / Academy / Automatización */
    --c-purple-dim: rgba(189, 0, 255, 0.15);
    
    /* --- Acentos Corporativos (Legado Web Total México) --- */
    --wtm-primario: #C49A2D;       /* Dorado Senda Digital (Legado Directivo) */
    --wtm-primario-light: #E5C06A; 
    --wtm-primario-glow: rgba(196, 154, 45, 0.35);
    --wtm-secundario: #722F37;     /* Vino Corporativo (Peligro/Acción Crítica) */
    
    /* --- Semántica de Datos y Estados --- */
    --c-success: #05ffa1;          /* Verde Neón (Completado/Pagado/Aprobado) */
    --c-danger: #ff2a6d;           /* Rojo Neón (Urgente/Error/Eliminar) */
    --c-warning: #ffb800;          /* Ámbar (Auditoría/Pendiente) */
    --c-info: #0088ff;             /* Azul (Informativo) */

    /* --- Escala de Grises y Textos --- */
    --text-main: #F8FAFC;          /* Blanco Humo (Lectura principal) */
    --text-muted: #94A3B8;         /* Gris Metálico (Subtítulos/Labels) */
    --text-dim: rgba(248, 250, 252, 0.4); /* Placeholder / Inactivo */

    /* --- Bordes y Efecto Vidrio (Glassmorphism) --- */
    --c-border: rgba(255, 255, 255, 0.08);
    --c-glass: rgba(13, 16, 25, 0.65);
    --c-glass-high: rgba(10, 11, 20, 0.85);
    --c-glass-solid: rgba(15, 18, 28, 0.95);
    
    /* Variables de compatibilidad (Heredadas de APPPAS/Interfones) */
    --wtm-bg-global: var(--c-bg-app);
    --wtm-base: var(--c-bg-panel);
    --wtm-card: var(--c-glass);
    --wtm-glass-border: var(--c-border);
    --fondo-app: var(--c-bg-panel);
    --borde-sutil: var(--c-border);
    --texto-suave: var(--text-muted);

    /* --- Tipografía --- */
    --font-title: 'Cinzel', serif;        /* Títulos de Autoridad y Elegancia */
    --font-tech: 'Orbitron', sans-serif;  /* Títulos de Sistema/KPIs/Folios */
    --font-ui: 'Poppins', sans-serif;     /* Interfaz de Usuario/Botones */
    --font-body: 'Outfit', sans-serif;    /* Lectura de Datos/Contenidos/Párrafos */

    /* --- Estructura y Efectos --- */
    --sidebar-width: 280px;
    --topbar-height: 75px;
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --transition: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --transition-slow: 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --shadow-premium: 0 15px 35px rgba(0, 0, 0, 0.5);
    --shadow-cyan: 0 0 25px rgba(0, 243, 255, 0.15);
    --shadow-gold: 0 0 25px rgba(196, 154, 45, 0.15);
}

/* =================================================================
   2. RESET Y BASE LAYOUT
   ================================================================= */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html, body {
    height: 100%;
    width: 100%;
    background-color: var(--c-bg-app);
    color: var(--text-main);
    font-family: var(--font-body);
    overflow: hidden; /* Estructura de Single Page Application (App Feel) */
}

a { 
    text-decoration: none; 
    color: inherit; 
    transition: var(--transition); 
}

button { 
    border: none; 
    background: none; 
    cursor: pointer; 
    font-family: inherit; 
    outline: none;
}

ul, ol { list-style: none; }

img, video {
    max-width: 100%;
    height: auto;
    display: block;
}

/* --- Scrollbars Estilizados (Cyberpunk/Dark Mode) --- */
::-webkit-scrollbar { 
    width: 8px; 
    height: 8px; 
}
::-webkit-scrollbar-track { 
    background: var(--c-bg-app); 
}
::-webkit-scrollbar-thumb { 
    background: var(--c-bg-input); 
    border-radius: 10px; 
    border: 1px solid var(--c-cyan-dim);
}
::-webkit-scrollbar-thumb:hover { 
    background: var(--c-cyan); 
}

/* =================================================================
   3. UTILIDADES CORE Y CLASES GLOBALES
   ================================================================= */
.text-cyan { color: var(--c-cyan) !important; }
.text-purple { color: var(--c-purple) !important; }
.text-gold { color: var(--wtm-primario) !important; }
.text-danger { color: var(--c-danger) !important; }
.text-success { color: var(--c-success) !important; }
.text-warning { color: var(--c-warning) !important; }
.text-muted { color: var(--text-muted) !important; }

.font-tech { font-family: var(--font-tech) !important; }
.font-ui { font-family: var(--font-ui) !important; }
.font-title { font-family: var(--font-title) !important; }

.bg-black { background-color: #000 !important; }
.bg-glass { background-color: var(--c-glass) !important; }

/* Truncado de texto */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* =================================================================
   4. ANIMACIONES (THE WOW FACTOR)
   ================================================================= */
@keyframes gridMove {
    from { background-position: 0 0; }
    to { background-position: 50px 50px; }
}

@keyframes pulseCyan {
    0% { box-shadow: 0 0 0 0 rgba(0, 243, 255, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(0, 243, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 243, 255, 0); }
}

@keyframes pulseGold {
    0% { box-shadow: 0 0 0 0 rgba(196, 154, 45, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(196, 154, 45, 0); }
    100% { box-shadow: 0 0 0 0 rgba(196, 154, 45, 0); }
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

/* Fondo Dinámico (Login & Body) */
.bg-grid-animated {
    background-image: 
        linear-gradient(var(--c-cyan-dim) 1px, transparent 1px),
        linear-gradient(90deg, var(--c-cyan-dim) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
    position: relative;
    z-index: 0;
}

/* =================================================================
   5. LAYOUT PRINCIPAL (THE HUB SHELL)
   ================================================================= */
.app-layout {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* --- Sidebar Master --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--c-bg-panel);
    border-right: 1px solid var(--c-border);
    display: flex;
    flex-direction: column;
    padding: 30px 15px;
    z-index: 1100;
    transition: var(--transition);
    box-shadow: 10px 0 30px rgba(0,0,0,0.6);
}

.sidebar-brand {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

.sidebar-brand h2 {
    font-family: var(--font-title);
    font-size: 1.8rem;
    letter-spacing: 2px;
    color: var(--text-main);
    text-shadow: 0 0 15px var(--c-cyan-glow);
    margin-bottom: 2px;
}

.sidebar-brand span {
    font-family: var(--font-tech);
    font-size: 0.65rem;
    color: var(--c-cyan);
    letter-spacing: 4px;
    text-transform: uppercase;
}

/* --- Menú de Navegación (Sidebar) --- */
.nav-menu {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 5px;
}

.nav-divider {
    font-family: var(--font-tech);
    font-size: 0.65rem;
    color: var(--text-dim);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 25px 0 10px 15px;
}

.nav-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 18px;
    margin-bottom: 4px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-family: var(--font-ui);
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid transparent;
}

.nav-btn i { 
    font-size: 1.1rem; 
    width: 24px; 
    text-align: center; 
    transition: var(--transition); 
}

.nav-btn:hover {
    background: rgba(0, 243, 255, 0.05);
    color: var(--text-main);
    border-color: var(--c-cyan-dim);
    transform: translateX(5px);
}

.nav-btn:hover i { color: var(--c-cyan); }

.nav-btn.active {
    background: linear-gradient(90deg, rgba(0, 243, 255, 0.15), transparent);
    color: var(--c-cyan);
    border-left: 3px solid var(--c-cyan);
    font-weight: 700;
}

/* --- Widget Perfil Usuario --- */
.user-profile-widget {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--c-border);
}

/* =================================================================
   6. CONTENIDO PRINCIPAL (VIEWPORT DINÁMICO)
   ================================================================= */
.main-content {
    flex-grow: 1;
    height: 100vh;
    overflow-y: auto;
    padding: 40px 50px;
    position: relative;
    background: radial-gradient(circle at top right, rgba(0, 243, 255, 0.05), transparent 50%);
}

.view-section {
    display: none;
    max-width: 1400px;
    margin: 0 auto;
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.4s ease;
}

.view-section.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.section-header {
    margin-bottom: 40px;
    border-bottom: 1px solid var(--c-border);
    padding-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 20px;
}

.section-header h2 {
    font-family: var(--font-title);
    font-size: 2.2rem;
    color: var(--text-main);
    text-shadow: 0 4px 10px rgba(0,0,0,0.5);
    margin-bottom: 5px;
}

/* =================================================================
   7. COMPONENTES PREMIUM (GLASSMORPHISM CARDS)
   ================================================================= */
.glass-card {
    background: var(--c-glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-premium);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: var(--transition);
}

.glass-card:hover {
    border-color: var(--c-cyan-dim);
    box-shadow: var(--shadow-cyan);
}

.glass-card:hover::before {
    opacity: 1;
}

/* --- KPIs Grid (Dashboard) --- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.kpi-card {
    display: flex;
    align-items: center;
    gap: 20px;
    border-left: 4px solid var(--c-cyan);
    padding: 25px;
}

.kpi-icon {
    width: 60px; height: 60px;
    background: var(--c-cyan-dim);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 15px;
    display: grid; place-items: center;
    font-size: 1.6rem; color: var(--c-cyan);
    box-shadow: inset 0 0 15px rgba(0,243,255,0.1);
}

.kpi-data h3 {
    font-family: var(--font-tech);
    font-size: 2rem;
    line-height: 1.1;
    margin-bottom: 5px;
    color: var(--text-main);
}

/* =================================================================
   8. SISTEMA KANBAN (LABORATORIO & TAREAS)
   ================================================================= */
.kanban-board {
    display: flex; 
    gap: 25px; 
    overflow-x: auto; 
    padding-bottom: 20px; 
    align-items: flex-start;
    min-height: 70vh;
}

.kanban-col {
    flex: 0 0 340px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: var(--radius-md);
    padding: 15px; 
    min-height: 650px;
    border: 1px solid var(--c-border);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

.kanban-header {
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    margin-bottom: 20px; 
    padding-bottom: 15px;
    border-bottom: 2px solid var(--c-cyan);
}

.kanban-header span {
    font-family: var(--font-tech); 
    font-size: 0.85rem; 
    color: var(--c-cyan); 
    letter-spacing: 1px;
}

.badge-count {
    background: var(--c-bg-panel);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-main);
    border: 1px solid var(--c-border);
}

/* Tarjetas de Tarea/Proyecto */
.task-card {
    background: var(--c-bg-input);
    border-radius: var(--radius-sm);
    padding: 18px; 
    margin-bottom: 15px;
    border: 1px solid var(--c-border);
    cursor: grab; 
    transition: var(--transition);
    position: relative;
}

.task-card:hover {
    border-color: var(--c-cyan); 
    transform: translateY(-3px); 
    box-shadow: 0 5px 15px var(--c-cyan-dim);
}

.task-card:active { cursor: grabbing; }

.task-card h5 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--text-main);
    font-family: var(--font-ui);
    font-weight: 600;
}

/* =================================================================
   9. FORMULARIOS, INPUTS Y CONTROLES (REFRIGERADOS & APPPAS)
   ================================================================= */
.input-group { 
    margin-bottom: 20px; 
    position: relative; 
}

.input-group label {
    display: block; 
    font-size: 0.75rem; 
    font-weight: 700; 
    text-transform: uppercase;
    letter-spacing: 1px; 
    color: var(--text-muted); 
    margin-bottom: 8px;
}

.form-control, .form-select, .form-control-color {
    width: 100%;
    background: var(--c-bg-input);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    padding: 12px 15px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    outline: none; 
    border-color: var(--c-cyan); 
    background: rgba(0,0,0,0.8);
    box-shadow: 0 0 15px var(--c-cyan-dim);
}

.form-control::placeholder {
    color: var(--text-dim);
}

textarea.form-control { 
    min-height: 100px; 
    resize: vertical; 
}

/* Switches (Checkbox styling) */
.form-check-input {
    width: 40px;
    height: 20px;
    background-color: var(--c-bg-input);
    border: 1px solid var(--c-border);
    border-radius: 20px;
    appearance: none;
    outline: none;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.form-check-input:checked {
    background-color: var(--c-cyan);
    border-color: var(--c-cyan);
    box-shadow: inset 0 0 5px rgba(0,0,0,0.3);
}

.form-check-input::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text-muted);
    top: 1px;
    left: 2px;
    transition: var(--transition);
}

.form-check-input:checked::before {
    background: #000;
    transform: translateX(20px);
}

/* Inputs Dinámicos (Viñetas y Redes Sociales) */
.vineta-row, .social-row {
    display: flex; gap: 10px; align-items: center; margin-bottom: 10px;
    animation: slideInRight 0.3s ease;
}

/* =================================================================
   10. BOTONES Y CALL TO ACTIONS
   ================================================================= */
.btn-primary-gold {
    background: linear-gradient(135deg, var(--wtm-primario), #8a6d20);
    color: #fff; 
    padding: 12px 28px; 
    border-radius: var(--radius-sm);
    font-weight: 700; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    font-size: 0.85rem;
    box-shadow: 0 5px 15px rgba(196, 154, 45, 0.3); 
    transition: var(--transition);
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    border: none;
}

.btn-primary-gold:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 8px 25px rgba(196, 154, 45, 0.6); 
}

.btn-cyan {
    background: linear-gradient(135deg, #00b4d8, var(--c-cyan));
    color: #000; 
    padding: 12px 28px; 
    border-radius: var(--radius-sm);
    font-weight: 800; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    font-size: 0.85rem;
    box-shadow: 0 5px 15px var(--c-cyan-dim); 
    transition: var(--transition);
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    border: none;
}

.btn-cyan:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 8px 25px var(--c-cyan-glow); 
    color: #000; 
}

.btn-outline-wtm {
    background: transparent; 
    border: 1px solid var(--c-border); 
    color: var(--text-main);
    padding: 10px 24px; 
    border-radius: var(--radius-sm); 
    font-weight: 600; 
    font-size: 0.85rem; 
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-outline-wtm:hover { 
    border-color: var(--c-cyan); 
    color: var(--c-cyan); 
    background: var(--c-cyan-dim); 
}

/* Botones de Acción Circular */
.action-btn {
    width: 38px; height: 38px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--c-border);
    color: var(--text-main);
    font-size: 0.9rem;
    transition: var(--transition);
}

.action-btn:hover {
    background: var(--c-cyan);
    color: #000;
    transform: rotate(15deg) scale(1.1);
    box-shadow: 0 0 15px var(--c-cyan-glow);
}

.action-btn.delete:hover {
    background: var(--c-danger);
    color: white;
    box-shadow: 0 0 15px rgba(255, 42, 109, 0.6);
}

/* =================================================================
   11. TABLAS PREMIUM (DATA LISTS APPPAS STYLE)
   ================================================================= */
.table-responsive { 
    width: 100%; 
    overflow-x: auto; 
    border-radius: var(--radius-md); 
}

.wtm-data-list { 
    width: 100%; 
    border-collapse: collapse; 
    text-align: left; 
}

.wtm-data-list th {
    padding: 18px 20px; 
    background: rgba(0,0,0,0.6); 
    color: var(--text-muted);
    font-family: var(--font-tech); 
    font-size: 0.75rem; 
    letter-spacing: 1px;
    border-bottom: 2px solid var(--c-cyan-dim); 
    white-space: nowrap;
}

.wtm-data-list td {
    padding: 16px 20px; 
    border-bottom: 1px solid var(--c-border);
    font-size: 0.9rem; 
    color: var(--text-main);
}

.wtm-data-list tr:hover td { 
    background: rgba(0, 243, 255, 0.05); 
}

/* =================================================================
   12. MODALES & OVERLAYS PREMIUM (GLASSMORPHISM)
   ================================================================= */
.modal-wrapper {
    position: fixed; 
    top: 0; left: 0; 
    width: 100%; height: 100%;
    background: rgba(5, 5, 9, 0.92); 
    backdrop-filter: blur(15px);
    display: none; 
    justify-content: center; 
    align-items: center;
    z-index: 2000; 
    opacity: 0; 
    transition: 0.3s ease;
}

.modal-wrapper.active { 
    display: flex; 
    opacity: 1; 
}

.glass-modal, .modal-card-premium {
    background: var(--c-glass-solid); 
    width: 90%; 
    max-width: 750px; 
    max-height: 90vh;
    overflow-y: auto; 
    padding: 45px; 
    border-radius: var(--radius-lg);
    border: 1px solid var(--c-cyan-dim); 
    position: relative;
    box-shadow: 0 25px 50px rgba(0,0,0,0.9), inset 0 0 20px rgba(0,243,255,0.05);
    transform: translateY(30px); 
    transition: var(--transition-slow);
}

.modal-wrapper.active .glass-modal,
.modal-wrapper.active .modal-card-premium { 
    transform: translateY(0); 
}

.btn-close-modal {
    position: absolute; 
    top: 20px; right: 20px; 
    width: 40px; height: 40px;
    border-radius: 50%; 
    background: rgba(255,255,255,0.05); 
    display: grid; place-items: center;
    color: var(--text-muted); 
    font-size: 1.2rem;
    transition: 0.3s;
    z-index: 10;
}

.btn-close-modal:hover { 
    background: var(--c-danger); 
    color: white; 
    transform: rotate(90deg); 
    box-shadow: 0 0 15px rgba(255, 42, 109, 0.5);
}

/* =================================================================
   13. SELECTOR DE ICONOS (APPPAS CORE)
   ================================================================= */
.icon-picker-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 15px;
    padding: 20px;
    background: rgba(0,0,0,0.3);
    border-radius: var(--radius-sm);
}

.icon-choice {
    width: 100%; aspect-ratio: 1/1; 
    display: grid; place-items: center;
    border: 1px solid var(--c-border); 
    border-radius: 12px;
    cursor: pointer; 
    transition: 0.3s; 
    color: var(--text-muted); 
    background: var(--c-bg-input);
    font-size: 1.5rem;
}

.icon-choice:hover, .icon-choice.active {
    background: var(--c-cyan-dim); 
    color: var(--c-cyan);
    border-color: var(--c-cyan); 
    box-shadow: 0 0 15px var(--c-cyan-glow); 
    transform: scale(1.1);
}

/* =================================================================
   14. WTM ACADEMY (LMS INTERFACE)
   ================================================================= */
.academy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

.module-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
    overflow: hidden;
}

.module-img {
    height: 180px;
    background: linear-gradient(135deg, var(--c-bg-panel), #000);
    display: grid;
    place-items: center;
    font-size: 4rem;
    color: var(--c-cyan-dim);
    border-bottom: 1px solid var(--c-border);
    transition: var(--transition);
}

.module-card:hover .module-img {
    color: var(--c-cyan);
    text-shadow: 0 0 20px var(--c-cyan-glow);
}

/* Academy Player (Modal Fullscreen) */
.player-container {
    width: 100vw; height: 100vh;
    display: flex; flex-direction: column;
}

.glass-header {
    background: rgba(10, 11, 20, 0.95);
    backdrop-filter: blur(10px);
    z-index: 10;
}

/* =================================================================
   15. OVERRIDES QUILL.JS (DARK MODE / CYBER)
   ================================================================= */
.ql-toolbar.ql-snow {
    background: var(--c-bg-input) !important;
    border: 1px solid var(--c-border) !important;
    border-bottom: none !important;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0 !important;
    padding: 12px !important;
}

.ql-toolbar.ql-snow .ql-stroke { stroke: var(--text-muted) !important; }
.ql-toolbar.ql-snow .ql-fill { fill: var(--text-muted) !important; }
.ql-toolbar.ql-snow .ql-picker { color: var(--text-muted) !important; }
.ql-toolbar.ql-snow .ql-picker-options { background: var(--c-bg-panel) !important; border: 1px solid var(--c-border) !important; }

.ql-container.ql-snow {
    background: rgba(0,0,0,0.5) !important;
    border: 1px solid var(--c-border) !important;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm) !important;
    color: var(--text-main) !important;
    font-family: var(--font-body) !important;
    font-size: 0.95rem !important;
    min-height: 200px;
}

.ql-editor.ql-blank::before { 
    color: var(--text-dim) !important; 
    font-style: italic;
}

/* =================================================================
   16. MÓDULO DE INTELIGENCIA ARTIFICIAL (RESTORED LEGACY)
   ================================================================= */
#aiConsultantTool {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: transparent;
    border: none;
}

#ai-chat-box {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(0,0,0,0.2);
    border-radius: var(--radius-md);
    border: 1px solid var(--c-border);
    margin-bottom: 20px;
}

.chat-msg {
    max-width: 85%;
    padding: 15px 20px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    animation: fadeIn 0.3s ease;
}

.msg-user {
    align-self: flex-end;
    background: var(--c-cyan-dim);
    color: var(--text-main);
    border: 1px solid var(--c-cyan);
    border-bottom-right-radius: 4px;
}

.msg-ai {
    align-self: flex-start;
    background: var(--c-glass);
    color: var(--text-main);
    border: 1px solid var(--c-border);
    border-bottom-left-radius: 4px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.msg-ai strong {
    color: var(--c-purple);
    font-weight: 700;
}

#ai-chat-input-container {
    display: flex;
    gap: 15px;
    position: relative;
}

#ai-input {
    flex-grow: 1;
    background: rgba(13, 16, 25, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--c-border);
    border-radius: 50px; 
    padding: 15px 25px;
    color: white;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    transition: 0.3s;
}

#ai-input:focus {
    box-shadow: 0 0 25px var(--c-cyan-dim), 0 5px 20px rgba(0,0,0,0.3);
    border-color: var(--c-cyan);
    outline: none;
}

#btn-send-ai {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--c-cyan), var(--c-purple));
    color: white;
    display: grid;
    place-items: center;
    font-size: 1.2rem;
    box-shadow: 0 0 15px var(--c-purple-dim);
    transition: 0.3s;
}

#btn-send-ai:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 0 25px var(--c-cyan-glow);
}

/* =================================================================
   17. CATÁLOGO DE PRODUCTOS PUBLIC (INTERFONES LEGACY)
   ================================================================= */
.product-card {
    background: var(--c-glass);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    background: #fff; /* Fondo blanco para imágenes de catálogo */
    padding: 10px;
}

.product-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-info h4 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: var(--text-main);
}

/* =================================================================
   18. TOASTS & NOTIFICACIONES PREMIUM
   ================================================================= */
.toast-premium {
    position: relative; 
    padding: 15px 25px; 
    background: rgba(10, 11, 20, 0.95);
    backdrop-filter: blur(10px); 
    border-left: 4px solid var(--c-cyan); 
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8); 
    z-index: 5000; 
    margin-top: 12px;
    display: flex; 
    align-items: center; 
    gap: 15px; 
    color: #fff;
    border-top: 1px solid var(--c-border); 
    border-right: 1px solid var(--c-border); 
    border-bottom: 1px solid var(--c-border);
    min-width: 280px;
}

.toast-premium i { font-size: 1.4rem; }
.toast-premium.success { border-left-color: var(--c-success); }
.toast-premium.success i { color: var(--c-success); }
.toast-premium.danger { border-left-color: var(--c-danger); }
.toast-premium.danger i { color: var(--c-danger); }
.toast-premium.warning { border-left-color: var(--c-warning); }
.toast-premium.warning i { color: var(--c-warning); }

.badge { 
    padding: 5px 10px; 
    border-radius: 6px; 
    font-size: 0.7rem; 
    font-weight: 700; 
    letter-spacing: 1px; 
}

/* =================================================================
   19. RESPONSIVE MASTER PATCH (ADAPTACIÓN TOTAL)
   ================================================================= */

/* --- Desktop Medium --- */
@media (max-width: 1200px) {
    :root { --sidebar-width: 250px; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .main-content { padding: 30px; }
}

/* --- Tablets --- */
@media (max-width: 992px) {
    .sidebar { 
        position: fixed; 
        left: -100%; 
        height: 100vh; 
        width: 280px; 
        z-index: 2000;
    }
    
    .sidebar.active, .sidebar.show, .sidebar.mobile-active { 
        left: 0; 
    }
    
    .main-content { 
        padding: 25px 20px; 
    }
    
    .kpi-grid { 
        grid-template-columns: 1fr 1fr; 
    }

    .video-section {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }
    
    .technical-content {
        border-left: none;
        border-top: 1px solid var(--c-border);
    }
}

/* --- Mobiles --- */
@media (max-width: 768px) {
    .section-header h2 { font-size: 1.8rem; }
    
    .kpi-grid { grid-template-columns: 1fr; }
    
    .kanban-board { 
        flex-direction: column; 
        overflow-x: hidden; 
    }
    
    .kanban-col { 
        width: 100%; 
        min-height: auto; 
        margin-bottom: 20px; 
        flex: none; 
    }
    
    .glass-modal, .modal-card-premium { 
        padding: 25px; 
        width: 95%; 
    }
    
    .btn-close-modal {
        top: 10px; right: 10px;
    }
    
    .action-btn { width: 32px; height: 32px; font-size: 0.8rem; }
}

/* --- Ajustes de Accesibilidad y Lectura --- */
@media (prefers-reduced-motion: reduce) {
    * { 
        animation-duration: 0.01ms !important; 
        transition-duration: 0.01ms !important; 
    }
}

/* --- Impresión (Reportes / Auditoría) --- */
@media print {
    .sidebar, .top-bar, .nav-menu, .btn-primary-gold, .btn-cyan, .action-btn { 
        display: none !important; 
    }
    body, .main-content { 
        background: #fff !important; 
        color: #000 !important; 
        padding: 0; 
        overflow: visible; 
    }
    .glass-card, .kanban-col { 
        border: 1px solid #ccc; 
        box-shadow: none !important; 
        background: transparent !important;
        page-break-inside: avoid;
    }
    .text-cyan, .text-gold, .text-purple { color: #000 !important; }
}