/* 
 * EduSystem Theme System
 * Variables CSS para 4 temas: Normal, Mate, Glassmorphism, Gradient
 */

/* ===== TEMA NORMAL (Default) ===== */
:root {
    /* Colores de fondo */
    --bg-primary: #ffffff;
    --bg-secondary: #f3f4f6;
    --bg-tertiary: #e5e7eb;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    
    /* Colores de texto */
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --text-inverse: #ffffff;
    
    /* Colores de borde */
    --border-color: #e5e7eb;
    --border-focus: #3b82f6;
    --border-hover: #d1d5db;
    
    /* Colores primarios */
    --primary: #1e3a8a;
    --primary-light: #3b82f6;
    --primary-dark: #1e40af;
    --primary-hover: #2563eb;
    
    /* Colores de estado */
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;
    
    /* Spacing (valores por defecto - comfortable) */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Sombras */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* Bordes */
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-full: 9999px;
    
    /* Transiciones */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 300ms ease-in-out;
    --transition-slow: 500ms ease-in-out;
    
    /* Gradientes */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-success: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    
    /* Backdrop */
    --backdrop-blur: 0px;
    --backdrop-opacity: 1;
}

/* ===== MODO OSCURO ===== */
.dark {
    --bg-primary: #1f2937;
    --bg-secondary: #374151;
    --bg-tertiary: #4b5563;
    --bg-card: #1f2937;
    --bg-input: #374151;

    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-tertiary: #9ca3af;
    --text-inverse: #111827;

    --border-color: #4b5563;
    --border-focus: #60a5fa;
    --border-hover: #6b7280;

    --primary: #60a5fa;
    --primary-light: #93c5fd;
    --primary-dark: #3b82f6;
    --primary-hover: #3b82f6;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

/* ===== PATRONES DE FONDO ===== */
[data-pattern="dots"]::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle, rgba(0, 0, 0, 0.15) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: -1;
}

[data-pattern="dots"].dark::before {
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.15) 1px, transparent 1px);
}

[data-pattern="dots-blur"]::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle, rgba(0, 0, 0, 0.1) 2px, transparent 2px);
    background-size: 30px 30px;
    filter: blur(0.5px);
    pointer-events: none;
    z-index: -1;
}

[data-pattern="dots-blur"].dark::before {
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.1) 2px, transparent 2px);
}

[data-pattern="waves"]::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='20' viewBox='0 0 100 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21.184 20c.357-.13.72-.264 1.088-.402l1.768-.661C33.64 15.347 39.647 14 50 14c10.271 0 15.362 1.222 24.629 4.928.955.383 1.869.74 2.75 1.072h6.225c-2.51-.73-5.139-1.691-8.233-2.928C65.888 13.278 60.562 12 50 12c-10.626 0-16.855 1.397-26.66 5.063l-1.767.662c-2.475.923-4.66 1.674-6.724 2.275h6.335zm0-20C13.258 2.892 8.077 4 0 4V2c5.744 0 9.951-.574 14.85-2h6.334zM77.38 0C85.239 2.966 90.502 4 100 4V2c-6.842 0-11.386-.542-16.396-2h-6.225zM0 14c8.44 0 13.718-1.21 22.272-4.402l1.768-.661C33.64 5.347 39.647 4 50 4c10.271 0 15.362 1.222 24.629 4.928C84.112 12.722 89.438 14 100 14v-2c-10.271 0-15.362-1.222-24.629-4.928C65.888 3.278 60.562 2 50 2 39.374 2 33.145 3.397 23.34 7.063l-1.767.662C13.223 9.669 8.077 11.017 0 11v3z' fill='%239C92AC' fill-opacity='0.15' fill-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: repeat-x;
    background-position: top;
    pointer-events: none;
    z-index: -1;
}

[data-pattern="waves"].dark::before {
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='20' viewBox='0 0 100 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21.184 20c.357-.13.72-.264 1.088-.402l1.768-.661C33.64 15.347 39.647 14 50 14c10.271 0 15.362 1.222 24.629 4.928.955.383 1.869.74 2.75 1.072h6.225c-2.51-.73-5.139-1.691-8.233-2.928C65.888 13.278 60.562 12 50 12c-10.626 0-16.855 1.397-26.66 5.063l-1.767.662c-2.475.923-4.66 1.674-6.724 2.275h6.335zm0-20C13.258 2.892 8.077 4 0 4V2c5.744 0 9.951-.574 14.85-2h6.334zM77.38 0C85.239 2.966 90.502 4 100 4V2c-6.842 0-11.386-.542-16.396-2h-6.225zM0 14c8.44 0 13.718-1.21 22.272-4.402l1.768-.661C33.64 5.347 39.647 4 50 4c10.271 0 15.362 1.222 24.629 4.928C84.112 12.722 89.438 14 100 14v-2c-10.271 0-15.362-1.222-24.629-4.928C65.888 3.278 60.562 2 50 2 39.374 2 33.145 3.397 23.34 7.063l-1.767.662C13.223 9.669 8.077 11.017 0 11v3z' fill='%23ffffff' fill-opacity='0.08' fill-rule='evenodd'/%3E%3C/svg%3E");
}

[data-pattern="noise"]::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.08'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: -1;
}

[data-pattern="noise"].dark::before {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
}

/* ===== TEMA MATE (Matte) ===== */
.theme-mate {
    --bg-primary: #e8e8e8;
    --bg-secondary: #d4d4d4;
    --bg-tertiary: #c0c0c0;
    --bg-card: #e8e8e8;
    --bg-input: #d4d4d4;
    
    --text-primary: #2d2d2d;
    --text-secondary: #5a5a5a;
    --text-tertiary: #808080;
    
    --border-color: #b0b0b0;
    --border-focus: #7a7a7a;
    --border-hover: #a0a0a0;
    
    --primary: #5a5a5a;
    --primary-light: #808080;
    --primary-dark: #404040;
    --primary-hover: #606060;
    
    --success: #6b8e6b;
    --success-light: #c8e6c8;
    --warning: #b8956b;
    --warning-light: #f0e6c8;
    --danger: #b86b6b;
    --danger-light: #f0c8c8;
    --info: #6b8eb8;
    --info-light: #c8d8f0;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.15);
}

.theme-mate.dark {
    --bg-primary: #2a2a2a;
    --bg-secondary: #3a3a3a;
    --bg-tertiary: #4a4a4a;
    --bg-card: #2a2a2a;
    --bg-input: #3a3a3a;
    
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-tertiary: #808080;
    
    --border-color: #505050;
    --border-focus: #909090;
    --border-hover: #606060;
}

/* ===== TEMA GLASSMORPHISM ===== */
.theme-glass {
    --bg-primary: rgba(255, 255, 255, 0.7);
    --bg-secondary: rgba(243, 244, 246, 0.5);
    --bg-tertiary: rgba(229, 231, 235, 0.4);
    --bg-card: rgba(255, 255, 255, 0.6);
    --bg-input: rgba(255, 255, 255, 0.8);
    
    --border-color: rgba(229, 231, 235, 0.5);
    --border-focus: rgba(59, 130, 246, 0.6);
    --border-hover: rgba(209, 213, 219, 0.6);
    
    --backdrop-blur: 20px;
    --backdrop-opacity: 0.7;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(255, 255, 255, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(255, 255, 255, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(255, 255, 255, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.theme-glass.dark {
    --bg-primary: rgba(31, 41, 55, 0.7);
    --bg-secondary: rgba(55, 65, 81, 0.5);
    --bg-tertiary: rgba(75, 85, 99, 0.4);
    --bg-card: rgba(31, 41, 55, 0.6);
    --bg-input: rgba(55, 65, 81, 0.8);
    
    --border-color: rgba(75, 85, 99, 0.5);
    --border-focus: rgba(96, 165, 250, 0.6);
    --border-hover: rgba(107, 114, 128, 0.6);
}

/* ===== TEMA GRADIENT ===== */
.theme-gradient {
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-success: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-text: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    
    --primary: #667eea;
    --primary-light: #8b9ef5;
    --primary-dark: #4c5db8;
    --primary-hover: #764ba2;
    
    --bg-primary: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --bg-secondary: rgba(255, 255, 255, 0.8);
    --bg-card: rgba(255, 255, 255, 0.9);
    
    --border-color: rgba(102, 126, 234, 0.2);
    --border-focus: #667eea;
    --border-hover: rgba(102, 126, 234, 0.4);
}

.theme-gradient.dark {
    --bg-primary: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --bg-secondary: rgba(31, 41, 55, 0.8);
    --bg-card: rgba(31, 41, 55, 0.9);
    
    --border-color: rgba(102, 126, 234, 0.3);
    --border-focus: #8b9ef5;
    --border-hover: rgba(102, 126, 234, 0.5);
}

/* ===== DENSIDAD DE UI ===== */
/* Escalado global via font-size root. Tailwind usa rem para spacing, por lo que
   padding, gap, margin, border-radius, width, height se escalan proporcionalmente. */
html {
    transition: font-size 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

html[data-ui-density="compact"] {
    font-size: 12px;
}

html[data-ui-density="comfortable"] {
    font-size: 16px;
}

html[data-ui-density="spacious"] {
    font-size: 20px;
}

/* ===== TAMAÑOS DE FUENTE ===== */
/* Van DESPUES de densidad para que override cuando el usuario lo active */
html[data-font-size="small"] {
    font-size: 14px;
}

html[data-font-size="medium"] {
    font-size: 16px;
}

html[data-font-size="large"] {
    font-size: 18px;
}

html[data-font-size="xlarge"] {
    font-size: 20px;
}

/* ===== ALTO CONTRASTE ===== */
[data-high-contrast="true"] {
    --bg-primary: #ffffff;
    --bg-secondary: #000000;
    --bg-card: #ffffff;
    
    --text-primary: #000000;
    --text-secondary: #000000;
    
    --border-color: #000000;
    --border-focus: #000000;
    
    --primary: #000000;
    --success: #006400;
    --warning: #b8860b;
    --danger: #8b0000;
    --info: #00008b;
}

[data-high-contrast="true"].dark {
    --bg-primary: #000000;
    --bg-secondary: #ffffff;
    --bg-card: #000000;
    
    --text-primary: #ffffff;
    --text-secondary: #ffffff;
    
    --border-color: #ffffff;
    --border-focus: #ffffff;
    
    --primary: #ffffff;
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

[data-reduced-motion="true"] *,
[data-reduced-motion="true"] *::before,
[data-reduced-motion="true"] *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}

/* ===== ANIMACIONES ===== */
[data-animations="false"] *,
[data-animations="false"] *::before,
[data-animations="false"] *::after {
    animation: none !important;
    transition: none !important;
}

/* ===== UTILIDADES ===== */
.glass-effect {
    background: var(--bg-card);
    backdrop-filter: blur(var(--backdrop-blur));
    -webkit-backdrop-filter: blur(var(--backdrop-blur));
    border: 1px solid var(--border-color);
}

.gradient-text {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-bg {
    background: var(--gradient-primary);
}

/* ===== TRANSICIONES SUAVES ===== */
body, div, section, article, aside, header, footer, nav, main, span, p, h1, h2, h3, h4, h5, h6, a, button, input, textarea, select, label, table, tr, td, th, ul, ol, li {
    transition: background-color var(--transition-normal),
                color var(--transition-normal),
                border-color var(--transition-normal),
                box-shadow var(--transition-normal);
}

/* Transiciones adicionales para elementos interactivos */
aside, .sidebar-transition, .nav-item-transition,
.notif-dropdown, .nav-drawer-panel, .nav-dock,
.mobile-bottom-nav, .app-launcher-dropdown {
    transition: transform var(--transition-normal),
                opacity var(--transition-normal),
                width var(--transition-normal),
                height var(--transition-normal),
                max-width var(--transition-normal),
                max-height var(--transition-normal),
                background-color var(--transition-normal),
                backdrop-filter var(--transition-normal);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-md);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* Sidebar scrollbar — thin and minimal */
aside ::-webkit-scrollbar {
    width: 3px;
    height: 3px;
}

aside ::-webkit-scrollbar-track {
    background: transparent;
}

aside ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 9999px;
}

aside ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
}

aside .flex-1::-webkit-scrollbar {
    width: 3px;
}

/* Firefox scrollbar for sidebar */
aside {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

/* ===== LAYOUT OPTIONS ===== */
/* Navigation Style */
/* Sidebar visibility with smooth transition */
aside {
    opacity: 0;
    pointer-events: none;
    max-width: 0;
    transform: translateX(-1rem);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), max-width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-navigation-style="sidebar"] aside {
    opacity: 1;
    pointer-events: auto;
    max-width: 20rem;
    transform: translateX(0);
}

[data-navigation-style="sidebar"] .navbar-only {
    display: none;
}

[data-navigation-style="navbar"] .navbar-only {
    display: none !important;
}

[data-navigation-style="navbar"] .fab-nav-bottom {
    display: flex;
}

[data-navigation-style="bottombar"] .navbar-only {
    display: none !important;
}

[data-navigation-style="bottombar"] .fab-nav-bottom {
    display: flex;
}

[data-navigation-style="bottombar"] .nav-dock {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

[data-navigation-style="bottombar"] body,
[data-navigation-style="bottombar"] {
    padding-bottom: 6rem;
}

@media (max-width: 767px) {
    [data-navigation-style="bottombar"] body,
    [data-navigation-style="bottombar"] {
        padding-bottom: 5rem;
    }
}

[data-navigation-style="dropdown"] .navbar-only {
    display: none !important;
}

/* Visibility helpers for navigation modes */
[data-navigation-style="sidebar"] .dropdown-only {
    display: none !important;
}

[data-navigation-style="dropdown"] .sidebar-only {
    display: none !important;
}

[data-navigation-style="navbar"] .dropdown-only {
    display: none !important;
}

[data-navigation-style="navbar"] .sidebar-only {
    display: none !important;
}

[data-navigation-style="bottombar"] .dropdown-only {
    display: none !important;
}

[data-navigation-style="bottombar"] .sidebar-only {
    display: none !important;
}

/* Sidebar Position */
[data-sidebar-position="right"] aside {
    order: 2;
}

[data-sidebar-position="left"] aside {
    order: 0;
}

/* Sidebar Width */
:where([data-sidebar-width="narrow"]) aside {
    width: 14rem;
}

:where([data-sidebar-width="medium"]) aside {
    width: 16rem;
}

:where([data-sidebar-width="wide"]) aside {
    width: 20rem;
}

/* Drawer panel width (dropdown mode) */
[data-sidebar-width="narrow"] .nav-drawer-panel {
    width: 16rem;
}

[data-sidebar-width="medium"] .nav-drawer-panel {
    width: 20rem;
}

[data-sidebar-width="wide"] .nav-drawer-panel {
    width: 24rem;
}

/* Bottom dock sizing (navbar mode) */
[data-sidebar-width="narrow"] .nav-dock {
    padding: 0.25rem;
    gap: 0.125rem;
}

[data-sidebar-width="narrow"] .nav-dock a,
[data-sidebar-width="narrow"] .nav-dock button {
    padding: 0.375rem 0.5rem;
    min-width: 3rem;
}

[data-sidebar-width="narrow"] .nav-dock a svg,
[data-sidebar-width="narrow"] .nav-dock button svg {
    width: 1rem;
    height: 1rem;
}

[data-sidebar-width="wide"] .nav-dock {
    padding: 0.75rem;
    gap: 0.5rem;
}

[data-sidebar-width="wide"] .nav-dock a,
[data-sidebar-width="wide"] .nav-dock button {
    padding: 0.75rem 1rem;
    min-width: 4rem;
}

[data-sidebar-width="wide"] .nav-dock a svg,
[data-sidebar-width="wide"] .nav-dock button svg {
    width: 1.5rem;
    height: 1.5rem;
}

/* Mobile bottom nav sizing */
[data-sidebar-width="narrow"] .mobile-bottom-nav a,
[data-sidebar-width="narrow"] .mobile-bottom-nav button {
    padding: 0.25rem 0.375rem;
    min-width: 2.5rem;
}

[data-sidebar-width="narrow"] .mobile-bottom-nav a svg,
[data-sidebar-width="narrow"] .mobile-bottom-nav button svg {
    width: 1.25rem;
    height: 1.25rem;
}

[data-sidebar-width="wide"] .mobile-bottom-nav a,
[data-sidebar-width="wide"] .mobile-bottom-nav button {
    padding: 0.5rem 0.75rem;
    min-width: 3.5rem;
}

[data-sidebar-width="wide"] .mobile-bottom-nav a svg,
[data-sidebar-width="wide"] .mobile-bottom-nav button svg {
    width: 1.75rem;
    height: 1.75rem;
}

/* Compact Mode */
[data-compact-mode="true"] {
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 0.75rem;
    --spacing-lg: 1rem;
    --spacing-xl: 1.5rem;
    --spacing-2xl: 2rem;
}

[data-compact-mode="true"] .p-6 {
    padding: 1rem;
}

[data-compact-mode="true"] .py-4 {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

[data-compact-mode="true"] .space-y-6 > * + * {
    margin-top: 1rem;
}

[data-compact-mode="true"] .space-y-4 > * + * {
    margin-top: 0.75rem;
}

/* Header Style */
[data-header-style="minimal"] header {
    box-shadow: none;
    border-bottom: 1px solid transparent;
}

[data-header-style="transparent"] header {
    background: transparent;
    box-shadow: none;
    border-bottom: 1px solid transparent;
}

[data-header-style="transparent"] header:hover {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

[data-header-style="transparent"].dark header:hover {
    background: rgba(31, 41, 55, 0.95);
}

/* ===== ANIMACIONES DE ENTRADA ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.fade-in-up {
    animation: fadeInUp 0.5s ease-out forwards;
}

.fade-in-left {
    animation: fadeInLeft 0.4s ease-out forwards;
}

.fade-in-right {
    animation: fadeInRight 0.4s ease-out forwards;
}

.scale-in {
    animation: scaleIn 0.4s ease-out forwards;
}

/* Delay escalonado para cascada */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }

/* Reduced motion fallback */
@media (prefers-reduced-motion: reduce) {
    .fade-in-up, .fade-in-left, .fade-in-right, .scale-in {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
    }
}

/* ===== SKELETON LOADERS ===== */
@keyframes skeletonShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton {
    background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

/* ===== BOTTOM FLOATING NAVIGATION (FAB) ===== */
.fab-nav-bottom {
    display: none;
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 50;
    flex-direction: column;
    align-items: flex-end;
}

.fab-nav-bottom .fab-btn {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 9999px;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px -5px rgba(79, 70, 229, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
}

.fab-nav-bottom .fab-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 20px 25px -5px rgba(79, 70, 229, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.15);
}

.fab-nav-bottom .fab-btn:active {
    transform: scale(0.95);
}

.fab-nav-bottom .fab-menu {
    position: absolute;
    bottom: 4.5rem;
    right: 0;
    width: 16rem;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid #e5e7eb;
    overflow: hidden;
    max-height: 70vh;
    overflow-y: auto;
}

.dark .fab-nav-bottom .fab-menu {
    background: #1e293b;
    border-color: #334155;
}

.fab-nav-bottom .fab-menu a {
    display: block;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: #374151;
    text-decoration: none;
    transition: background 0.15s ease;
}

.dark .fab-nav-bottom .fab-menu a {
    color: #e2e8f0;
}

.fab-nav-bottom .fab-menu a:hover {
    background: #f3f4f6;
}

.dark .fab-nav-bottom .fab-menu a:hover {
    background: #334155;
}

.fab-nav-bottom .fab-menu hr {
    margin: 0.25rem 0;
    border: 0;
    border-top: 1px solid #e5e7eb;
}

.dark .fab-nav-bottom .fab-menu hr {
    border-color: #334155;
}

.dark .skeleton {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    background-size: 200% 100%;
}

/* ===== NAVIGATION DRAWER (Bandeja con iconos) ===== */
.nav-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 50;
}

.nav-drawer-panel {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 22rem;
    max-width: 90vw;
    background: #ffffff;
    z-index: 51;
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    will-change: transform;
}

.dark .nav-drawer-panel {
    background: #1e293b;
}

.nav-drawer-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.dark .nav-drawer-header {
    border-color: #334155;
}

.nav-drawer-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
}

.dark .nav-drawer-header h2 {
    color: #f1f5f9;
}

.nav-drawer-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    padding: 1.5rem;
    flex: 1;
    align-content: start;
}

.nav-drawer-grid a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 0.5rem;
    border-radius: 0.75rem;
    background: #f9fafb;
    color: #374151;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.dark .nav-drawer-grid a {
    background: #334155;
    color: #e2e8f0;
}

.nav-drawer-grid a:hover {
    background: #e5e7eb;
    transform: translateY(-2px);
    border-color: #d1d5db;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.dark .nav-drawer-grid a:hover {
    background: #475569;
    border-color: #64748b;
}

.nav-drawer-grid a svg {
    width: 1.75rem;
    height: 1.75rem;
    margin-bottom: 0.5rem;
    color: #4f46e5;
}

.dark .nav-drawer-grid a svg {
    color: #818cf8;
}

.nav-drawer-grid a span {
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
    line-height: 1.25;
}

.nav-drawer-close {
    padding: 0.5rem;
    border-radius: 0.5rem;
    color: #6b7280;
    transition: all 0.15s ease;
}

.nav-drawer-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.dark .nav-drawer-close:hover {
    background: #334155;
    color: #f1f5f9;
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-text:last-child {
    width: 80%;
}

.skeleton-card {
    height: 120px;
    width: 100%;
}

.skeleton-avatar {
    height: 40px;
    width: 40px;
    border-radius: 50%;
}

.skeleton-row {
    height: 60px;
    width: 100%;
    margin-bottom: 0.5rem;
}

/* ===== SPINNER / LOADER ===== */
@keyframes spinnerSpin {
    to { transform: rotate(360deg); }
}

.spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid #e5e7eb;
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: spinnerSpin 0.8s linear infinite;
}

.dark .spinner {
    border-color: #374151;
    border-top-color: #818cf8;
}

.spinner-sm { width: 1rem; height: 1rem; border-width: 2px; }
.spinner-lg { width: 3rem; height: 3rem; border-width: 4px; }

.page-loader {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(6px);
    z-index: 9999;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.dark .page-loader {
    background: rgba(15, 23, 42, 0.85);
}

.page-loader.hidden-loader {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ===== SKELETON LOADERS ===== */
@keyframes skeleton-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton {
    background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 0.5rem;
}

.dark .skeleton {
    background: linear-gradient(90deg, #334155 25%, #475569 50%, #334155 75%);
    background-size: 200% 100%;
}

.skeleton-card {
    background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 1rem;
}

.dark .skeleton-card {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 0.25rem;
}

.skeleton-text-sm { width: 40%; }
.skeleton-text-md { width: 60%; }
.skeleton-text-lg { width: 80%; }

.skeleton-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.skeleton-circle {
    border-radius: 50%;
}

.skeleton-rounded {
    border-radius: 0.75rem;
}

/* Content swap transition */
.content-skeleton {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.content-real {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.content-skeleton.hidden-skeleton {
    opacity: 0;
    pointer-events: none;
    position: absolute;
    inset: 0;
}

.content-real.visible-real {
    opacity: 1;
}

/* ===== MOBILE: forzar bottom bar, ocultar dropdown ===== */
@media (max-width: 767px) {
  .dropdown-only {
    display: none !important;
  }

  body {
    padding-bottom: 5rem;
  }
}

/* ===== RESPONSIVE TABLES ===== */
@media (max-width: 768px) {
    .responsive-table thead {
        display: none;
    }

    .responsive-table tr {
        display: block;
        margin-bottom: 1rem;
        background: var(--bg-card);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-sm);
        border: 1px solid var(--border-color);
        padding: 1rem;
    }

    .responsive-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border-bottom: 1px solid var(--border-color);
        text-align: right;
    }

    .responsive-table td:last-child {
        border-bottom: none;
    }

    .responsive-table td::before {
        content: attr(data-label);
        font-weight: 600;
        text-transform: uppercase;
        font-size: 0.75rem;
        color: var(--text-secondary);
        text-align: left;
        margin-right: 1rem;
    }

    .responsive-table td > * {
        text-align: right;
    }
}

/* ===== IMPROVED SIDEBAR TOOLTIPS ===== */
.sidebar-tooltip {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 10px;
    background: #1e293b;
    color: #f8fafc;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 100;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.nav-item:hover .sidebar-tooltip {
    opacity: 1;
}

.sidebar-tooltip::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: #1e293b;
}

/* ===== FLOATING DOCK (Bottombar mode) ===== */
.nav-dock {
    display: flex;
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(1rem);
    z-index: 50;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    padding: 0.5rem;
    gap: 0.25rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.dark .nav-dock {
    background: rgba(30, 41, 59, 0.9);
    border-color: #334155;
}

[data-navigation-style="navbar"] .nav-dock {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.nav-dock a,
.nav-dock button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.75rem;
    font-size: 0.65rem;
    font-weight: 500;
    color: #475569;
    text-decoration: none;
    transition: all 0.2s ease;
    min-width: 3.5rem;
}

.dark .nav-dock a,
.dark .nav-dock button {
    color: #94a3b8;
}

.nav-dock a:hover,
.nav-dock button:hover {
    background: #f1f5f9;
    color: #4f46e5;
}

.dark .nav-dock a:hover,
.dark .nav-dock button:hover {
    background: #334155;
    color: #818cf8;
}

.nav-dock a svg,
.nav-dock button svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* Dock more menu */
.nav-dock-more {
    position: absolute;
    bottom: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%);
    width: 16rem;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid #e2e8f0;
    padding: 0.5rem 0;
    z-index: 51;
}

.dark .nav-dock-more {
    background: #1e293b;
    border-color: #334155;
}

.nav-dock-more a {
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    min-width: auto;
    border-radius: 0;
}

.nav-dock-more a svg {
    width: 1rem;
    height: 1rem;
    color: #4f46e5;
}

.dark .nav-dock-more a svg {
    color: #818cf8;
}

/* ===== MOILE BOTTOM NAV ===== */
.mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid #e2e8f0;
    padding: 0.5rem 0;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    justify-content: space-around;
    opacity: 0;
    pointer-events: none;
    transform: translateY(100%);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.dark .mobile-bottom-nav {
    background: rgba(15, 23, 42, 0.95);
    border-color: #1e293b;
}

@media (max-width: 767px) {
    [data-navigation-style="sidebar"] .mobile-bottom-nav,
    [data-navigation-style="navbar"] .mobile-bottom-nav,
    [data-navigation-style="dropdown"] .mobile-bottom-nav {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }
}

.mobile-bottom-nav a,
.mobile-bottom-nav button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    font-size: 0.625rem;
    font-weight: 500;
    color: #64748b;
    text-decoration: none;
    transition: all 0.2s ease;
    min-width: 3rem;
}

.dark .mobile-bottom-nav a,
.dark .mobile-bottom-nav button {
    color: #94a3b8;
}

.mobile-bottom-nav a:hover,
.mobile-bottom-nav button:hover {
    color: #4f46e5;
}

.dark .mobile-bottom-nav a:hover,
.dark .mobile-bottom-nav button:hover {
    color: #818cf8;
}

.mobile-bottom-nav a svg,
.mobile-bottom-nav button svg {
    width: 1.5rem;
    height: 1.5rem;
}

/* Mobile more menu */
.mobile-more-menu {
    position: absolute;
    bottom: calc(100% + 0.75rem);
    left: 50%;
    transform: translateX(-50%);
    width: 18rem;
    max-height: 70vh;
    overflow-y: auto;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid #e2e8f0;
    padding: 0.5rem 0;
    z-index: 52;
}

.dark .mobile-more-menu {
    background: #1e293b;
    border-color: #334155;
}

.mobile-more-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: #374151;
    text-decoration: none;
    transition: background 0.15s ease;
}

.dark .mobile-more-menu a {
    color: #e2e8f0;
}

.mobile-more-menu a:hover {
    background: #f3f4f6;
}

.dark .mobile-more-menu a:hover {
    background: #334155;
}

/* Spacer for mobile bottom nav */
.mobile-nav-spacer {
    display: none;
    height: 4rem;
}

@media (max-width: 767px) {
    .mobile-nav-spacer {
        display: block;
    }
}

/* ===== SIDEBAR OVERLAY FOR MOBILE ===== */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

@media (min-width: 768px) {
    .sidebar-overlay {
        display: none;
    }
}

/* ===== APP LAUNCHER GRID (Dropdown mode improved) ===== */
.app-launcher-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    padding: 1rem;
}

.app-launcher-grid a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0.25rem;
    border-radius: 0.75rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.app-launcher-grid a:hover {
    background: #f1f5f9;
    transform: translateY(-2px);
}

.dark .app-launcher-grid a:hover {
    background: #334155;
}

.app-launcher-grid a .app-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-launcher-grid a .app-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.app-launcher-grid a span {
    font-size: 0.7rem;
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
    color: #374151;
}

.dark .app-launcher-grid a span {
    color: #e2e8f0;
}

/* Icon color variants */
.app-icon-indigo { background: #e0e7ff; color: #4f46e5; }
.app-icon-blue { background: #dbeafe; color: #2563eb; }
.app-icon-amber { background: #fef3c7; color: #d97706; }
.app-icon-emerald { background: #d1fae5; color: #059669; }
.app-icon-purple { background: #f3e8ff; color: #7c3aed; }
.app-icon-rose { background: #ffe4e6; color: #e11d48; }
.app-icon-orange { background: #ffedd5; color: #ea580c; }
.app-icon-cyan { background: #cffafe; color: #0891b2; }
.app-icon-teal { background: #ccfbf1; color: #0d9488; }
.app-icon-pink { background: #fce7f3; color: #db2777; }
.app-icon-slate { background: #f1f5f9; color: #475569; }

.dark .app-icon-indigo { background: #312e81; color: #a5b4fc; }
.dark .app-icon-blue { background: #1e3a8a; color: #93c5fd; }
.dark .app-icon-amber { background: #451a03; color: #fcd34d; }
.dark .app-icon-emerald { background: #064e3b; color: #6ee7b7; }
.dark .app-icon-purple { background: #4c1d95; color: #c4b5fd; }
.dark .app-icon-rose { background: #881337; color: #fda4af; }
.dark .app-icon-orange { background: #431407; color: #fdba74; }
.dark .app-icon-cyan { background: #164e63; color: #67e8f9; }
.dark .app-icon-teal { background: #134e4a; color: #5eead4; }
.dark .app-icon-pink { background: #831843; color: #f9a8d4; }
.dark .app-icon-slate { background: #1e293b; color: #94a3b8; }

/* ===== HEADER BACKDROP BLUR ===== */
.header-glass {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.dark .header-glass {
    background: rgba(15, 23, 42, 0.8);
}

/* ===== NOTIFICATION DROPDOWN ===== */
.notif-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 0.75rem);
    width: 24rem;
    max-width: 90vw;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid #e2e8f0;
    z-index: 50;
    overflow: hidden;
}

.dark .notif-dropdown {
    background: #1e293b;
    border-color: #334155;
}

.notif-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
}

.dark .notif-dropdown-header {
    border-color: #334155;
}

.notif-dropdown-body {
    max-height: 20rem;
    overflow-y: auto;
}

.notif-dropdown-footer {
    display: block;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #4f46e5;
    border-top: 1px solid #f1f5f9;
    transition: background 0.15s ease;
}

.dark .notif-dropdown-footer {
    color: #818cf8;
    border-color: #334155;
}

.notif-dropdown-footer:hover {
    background: #f8fafc;
}

.dark .notif-dropdown-footer:hover {
    background: #334155;
}

/* ===== USER AVATAR ===== */
.user-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* x-cloak */
[x-cloak] { display: none !important; }

/* ===== THEME APPLICATION OVERRIDES ===== */
/* Make visual themes affect the actual page */

/* Body background */
.theme-mate body.bg-gray-50,
.theme-glass body.bg-gray-50,
.theme-gradient body.bg-gray-50,
.theme-mate body.dark\:bg-slate-900,
.theme-glass body.dark\:bg-slate-900,
.theme-gradient body.dark\:bg-slate-900 {
    background: var(--bg-primary) !important;
}

/* Main content area */
.theme-mate main,
.theme-glass main,
.theme-gradient main {
    background: var(--bg-secondary);
}

/* Cards and panels */
.theme-mate .bg-white,
.theme-glass .bg-white,
.theme-gradient .bg-white {
    background: var(--bg-card) !important;
}

.theme-mate .dark .bg-slate-800,
.theme-glass .dark .bg-slate-800,
.theme-gradient .dark .bg-slate-800 {
    background: var(--bg-card) !important;
}

/* Inputs */
.theme-mate input,
.theme-glass input,
.theme-gradient input,
.theme-mate select,
.theme-glass select,
.theme-gradient select,
.theme-mate textarea,
.theme-glass textarea,
.theme-gradient textarea {
    background: var(--bg-input) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

/* Borders */
.theme-mate .border-gray-100,
.theme-glass .border-gray-100,
.theme-gradient .border-gray-100,
.theme-mate .border-gray-200,
.theme-glass .border-gray-200,
.theme-gradient .border-gray-200 {
    border-color: var(--border-color) !important;
}

.theme-mate .dark .border-gray-700,
.theme-glass .dark .border-gray-700,
.theme-gradient .dark .border-gray-700 {
    border-color: var(--border-color) !important;
}

/* ===== SIDEBAR FOUC PREVENTION ===== */
html.sidebar-initial-collapsed aside {
    width: 80px;
}
html.sidebar-initial-collapsed main {
    margin-left: 80px;
}
html.sidebar-initial-collapsed aside .sidebar-brand-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* ===== GLASSMORPHISM ENHANCED - Todos los componentes ===== */

/* Fondo de pagina para que el glass se note - aplicado solo a body para no sobrescribir patrones */
.theme-glass body.bg-gray-50,
.theme-glass body.dark\:bg-slate-900 {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 50%, #94a3b8 100%) !important;
    background-attachment: fixed !important;
}
.theme-glass.dark body.bg-gray-50,
.theme-glass.dark body.dark\:bg-slate-900 {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%) !important;
    background-attachment: fixed !important;
}

/* Header */
.theme-glass .header-glass {
    background: rgba(255, 255, 255, 0.65) !important;
    backdrop-filter: blur(30px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(30px) saturate(180%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.35) !important;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.12) !important;
}
.theme-glass.dark .header-glass {
    background: rgba(15, 23, 42, 0.35) !important;
    border-bottom-color: rgba(255, 255, 255, 0.15) !important;
}

/* Sidebar */
.theme-glass aside {
    background: rgba(255, 255, 255, 0.65) !important;
    backdrop-filter: blur(30px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(30px) saturate(180%) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.35) !important;
    box-shadow: 8px 0 32px 0 rgba(31, 38, 135, 0.12) !important;
}
.theme-glass.dark aside {
    background: rgba(15, 23, 42, 0.35) !important;
    border-right-color: rgba(255, 255, 255, 0.12) !important;
}

/* Cards y contenedores */
.theme-glass .bg-white,
.theme-glass .bg-slate-800,
.theme-glass .dark .bg-slate-800,
.theme-glass .rounded-lg.shadow,
.theme-glass .rounded-lg.shadow-sm,
.theme-glass .rounded-lg.shadow-md,
.theme-glass .rounded-lg.shadow-lg,
.theme-glass .rounded-xl.shadow,
.theme-glass .rounded-xl.shadow-sm,
.theme-glass .rounded-xl.shadow-md,
.theme-glass .rounded-xl.shadow-lg {
    background: rgba(255, 255, 255, 0.45) !important;
    backdrop-filter: blur(20px) saturate(160%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(160%) !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1) !important;
    border-radius: 1rem !important;
}
.theme-glass.dark .bg-white,
.theme-glass.dark .bg-slate-800,
.theme-glass.dark .dark .bg-slate-800,
.theme-glass.dark .rounded-lg.shadow,
.theme-glass.dark .rounded-lg.shadow-sm,
.theme-glass.dark .rounded-lg.shadow-md,
.theme-glass.dark .rounded-lg.shadow-lg,
.theme-glass.dark .rounded-xl.shadow,
.theme-glass.dark .rounded-xl.shadow-sm,
.theme-glass.dark .rounded-xl.shadow-md,
.theme-glass.dark .rounded-xl.shadow-lg {
    background: rgba(30, 41, 59, 0.45) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3) !important;
}

/* Dropdowns (notificaciones, usuario) */
.theme-glass .notif-dropdown,
.theme-glass .absolute.right-0.mt-2.w-56,
.theme-glass .nav-dock-more,
.theme-glass .mobile-more-menu {
    background: rgba(255, 255, 255, 0.5) !important;
    backdrop-filter: blur(25px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(25px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.45) !important;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.2) !important;
    border-radius: 1rem !important;
}
.theme-glass.dark .notif-dropdown,
.theme-glass.dark .absolute.right-0.mt-2.w-56,
.theme-glass.dark .nav-dock-more,
.theme-glass.dark .mobile-more-menu {
    background: rgba(15, 23, 42, 0.55) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

/* Nav drawer */
.theme-glass .nav-drawer-panel {
    background: rgba(255, 255, 255, 0.4) !important;
    backdrop-filter: blur(30px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(30px) saturate(180%) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.35) !important;
}
.theme-glass.dark .nav-drawer-panel {
    background: rgba(15, 23, 42, 0.45) !important;
    border-right-color: rgba(255, 255, 255, 0.12) !important;
}
.theme-glass .nav-drawer-grid a {
    background: rgba(255, 255, 255, 0.4) !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
}
.theme-glass.dark .nav-drawer-grid a {
    background: rgba(30, 41, 59, 0.5) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Nav dock */
.theme-glass .nav-dock {
    background: rgba(255, 255, 255, 0.45) !important;
    backdrop-filter: blur(25px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(25px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.2) !important;
}
.theme-glass.dark .nav-dock {
    background: rgba(15, 23, 42, 0.45) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

/* Mobile bottom nav */
.theme-glass .mobile-bottom-nav {
    background: rgba(255, 255, 255, 0.45) !important;
    backdrop-filter: blur(25px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(25px) saturate(180%) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.4) !important;
}
.theme-glass.dark .mobile-bottom-nav {
    background: rgba(15, 23, 42, 0.45) !important;
    border-top-color: rgba(255, 255, 255, 0.15) !important;
}

/* Inputs y selects */
.theme-glass input,
.theme-glass select,
.theme-glass textarea {
    background: rgba(255, 255, 255, 0.4) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.45) !important;
    border-radius: 0.75rem !important;
    color: #1f2937 !important;
}
.theme-glass.dark input,
.theme-glass.dark select,
.theme-glass.dark textarea {
    background: rgba(15, 23, 42, 0.45) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #f1f5f9 !important;
}

/* Tablas */
.theme-glass table {
    background: transparent !important;
}
.theme-glass thead tr {
    background: rgba(255, 255, 255, 0.3) !important;
    backdrop-filter: blur(5px) !important;
}
.theme-glass tbody tr {
    background: rgba(255, 255, 255, 0.3) !important;
    backdrop-filter: blur(5px) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
}
.theme-glass tbody tr:hover {
    background: rgba(255, 255, 255, 0.4) !important;
}
.theme-glass.dark thead tr {
    background: rgba(15, 23, 42, 0.4) !important;
}
.theme-glass.dark tbody tr {
    background: rgba(15, 23, 42, 0.25) !important;
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}
.theme-glass.dark tbody tr:hover {
    background: rgba(15, 23, 42, 0.4) !important;
}

/* Sidebar tooltips */
.theme-glass .sidebar-tooltip {
    background: rgba(0, 0, 0, 0.4) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Breadcrumbs */
.theme-glass nav[aria-label="Breadcrumb"] ol {
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    border-radius: 0.75rem !important;
    padding: 0.5rem 1rem !important;
}
.theme-glass.dark nav[aria-label="Breadcrumb"] ol {
    background: rgba(15, 23, 42, 0.35) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Overlay del drawer */
.theme-glass .nav-drawer-overlay {
    background: rgba(0, 0, 0, 0.2) !important;
    backdrop-filter: blur(5px) !important;
    -webkit-backdrop-filter: blur(5px) !important;
}

/* Mobile overlay del sidebar */
.theme-glass .bg-black\/30,
.theme-glass .bg-black\/20 {
    background: rgba(0, 0, 0, 0.2) !important;
    backdrop-filter: blur(5px) !important;
    -webkit-backdrop-filter: blur(5px) !important;
}

/* App icons en drawer */
.theme-glass .app-icon {
    background: rgba(255, 255, 255, 0.3) !important;
    backdrop-filter: blur(5px) !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
}
.theme-glass.dark .app-icon {
    background: rgba(30, 41, 59, 0.5) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

/* User avatar */
.theme-glass .user-avatar {
    background: rgba(255, 255, 255, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    backdrop-filter: blur(5px) !important;
}
.theme-glass.dark .user-avatar {
    background: rgba(15, 23, 42, 0.5) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

/* Botones principales con sutil glass */
.theme-glass button:not(.windows-hover):not([class*="bg-gradient"]) {
    backdrop-filter: blur(5px) !important;
}
.theme-glass .hover\:bg-gray-100:hover,
.theme-glass .hover\:bg-slate-800:hover {
    background: rgba(255, 255, 255, 0.2) !important;
}
.theme-glass.dark .hover\:bg-gray-100:hover,
.theme-glass.dark .hover\:bg-slate-800:hover {
    background: rgba(15, 23, 42, 0.4) !important;
}

/* Scrollbar para glassmorphism */
.theme-glass ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.4) !important;
    border-radius: 1rem !important;
}
.theme-glass ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.6) !important;
}
.theme-glass.dark ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2) !important;
}

/* ===== FULLCALENDAR: evitar blur glassmorphism ===== */
/* Eliminar backdrop-filter de TODO dentro del calendario */
.theme-glass #vista-calendario,
.theme-glass #vista-calendario .bg-white,
.theme-glass #vista-calendario .bg-slate-800,
.theme-glass #vista-calendario .rounded-lg.shadow,
.theme-glass #vista-calendario .rounded-lg.shadow-sm,
.theme-glass #vista-calendario .rounded-lg.shadow-md,
.theme-glass #vista-calendario .rounded-xl.shadow,
.theme-glass #vista-calendario .rounded-xl.shadow-sm,
.theme-glass #vista-calendario .rounded-xl.shadow-md,
.theme-glass #calendar,
.theme-glass #calendar .fc-view,
.theme-glass #calendar .fc-scrollgrid,
.theme-glass #calendar .fc-scrollgrid-section,
.theme-glass #calendar .fc-timegrid-slot,
.theme-glass #calendar .fc-daygrid-day,
.theme-glass #calendar .fc-col-header-cell,
.theme-glass #calendar .fc-timegrid-col,
.theme-glass #calendar .fc-timegrid-event,
.theme-glass #calendar .fc-daygrid-event,
.theme-glass #calendar .fc-event,
.theme-glass #calendar .fc-list-event,
.theme-glass #calendar button,
.theme-glass #calendar table,
.theme-glass #calendar thead tr,
.theme-glass #calendar tbody tr,
.theme-glass #calendar td,
.theme-glass #calendar th {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Fondo 100% SOLIDO para el contenedor del calendario */
.theme-glass #vista-calendario,
.theme-glass #vista-calendario .bg-white,
.theme-glass #vista-calendario .bg-slate-800,
.theme-glass #vista-calendario .rounded-lg.shadow,
.theme-glass #vista-calendario .rounded-xl.shadow {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: none !important;
}

.theme-glass.dark #vista-calendario,
.theme-glass.dark #vista-calendario .bg-white,
.theme-glass.dark #vista-calendario .bg-slate-800,
.theme-glass.dark #vista-calendario .rounded-lg.shadow,
.theme-glass.dark #vista-calendario .rounded-xl.shadow {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: none !important;
}

/* Las tablas del calendario deben ser transparentes para que no tapen el fondo */
.theme-glass #calendar table,
.theme-glass #calendar thead tr,
.theme-glass #calendar tbody tr,
.theme-glass #calendar td,
.theme-glass #calendar th {
    background: transparent !important;
}

/* Celdas internas del calendario transparentes */
.theme-glass #calendar .fc-timegrid-slot,
.theme-glass #calendar .fc-daygrid-day,
.theme-glass #calendar .fc-col-header-cell,
.theme-glass #calendar .fc-timegrid-col,
.theme-glass #calendar .fc-list-empty {
    background: transparent !important;
}

/* Botones del toolbar del calendario: fondo opaco para que no hereden glass */
.theme-glass #calendar .fc-button-primary {
    background: #4f46e5 !important;
    border-color: #4338ca !important;
    backdrop-filter: none !important;
}
.theme-glass #calendar .fc-button-primary:hover {
    background: #4338ca !important;
}
.theme-glass #calendar .fc-button-primary.fc-button-active {
    background: #3730a3 !important;
}

/* ===== COLORES PREFERIDOS - Mover al final para sobrescribir temas ===== */
[data-color="navy"] {
    --primary: #1e3a8a !important;
    --primary-light: #3b82f6 !important;
    --primary-dark: #1e40af !important;
    --primary-hover: #2563eb !important;
}

[data-color="navy"].dark {
    --primary: #60a5fa !important;
    --primary-light: #93c5fd !important;
    --primary-dark: #3b82f6 !important;
    --primary-hover: #818cf8 !important;
}

[data-color="emerald"] {
    --primary: #059669 !important;
    --primary-light: #10b981 !important;
    --primary-dark: #047857 !important;
    --primary-hover: #059669 !important;
}

[data-color="emerald"].dark {
    --primary: #34d399 !important;
    --primary-light: #6ee7b7 !important;
    --primary-dark: #10b981 !important;
    --primary-hover: #34d399 !important;
}

[data-color="orange"] {
    --primary: #ea580c !important;
    --primary-light: #f97316 !important;
    --primary-dark: #c2410c !important;
    --primary-hover: #ea580c !important;
}

[data-color="orange"].dark {
    --primary: #fb923c !important;
    --primary-light: #fdba74 !important;
    --primary-dark: #f97316 !important;
    --primary-hover: #fb923c !important;
}

[data-color="red"] {
    --primary: #dc2626 !important;
    --primary-light: #ef4444 !important;
    --primary-dark: #b91c1c !important;
    --primary-hover: #dc2626 !important;
}

[data-color="red"].dark {
    --primary: #f87171 !important;
    --primary-light: #fca5a5 !important;
    --primary-dark: #ef4444 !important;
    --primary-hover: #f87171 !important;
}

[data-color="purple"] {
    --primary: #7c3aed !important;
    --primary-light: #8b5cf6 !important;
    --primary-dark: #6d28d9 !important;
    --primary-hover: #7c3aed !important;
}

[data-color="purple"].dark {
    --primary: #a78bfa !important;
    --primary-light: #c4b5fd !important;
    --primary-dark: #8b5cf6 !important;
    --primary-hover: #a78bfa !important;
}
