/**
 * ProfeIA Tools 2.6 - Hoja de Estilos Global
 * Diseño moderno SaaS EdTech, Glassmorphism, adaptación responsiva para Celulares/iPad/PC y soporte de impresión.
 */

:root {
    --font-primary: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --color-bg: #f8fafc;
    --color-text-main: #0f172a;
    --color-text-muted: #475569;
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-border: #cbd5e1;
    --glass-bg: rgba(255, 255, 255, 0.92);
    --glass-border: rgba(226, 232, 240, 0.85);
    --glass-shadow: rgba(15, 23, 42, 0.14);
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background-color: var(--color-bg);
    color: var(--color-text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 16px;
    overflow-x: hidden;
}

/* Paneles de Cristal (Widgets Flotantes) */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 18px 40px -10px var(--glass-shadow), 0 4px 12px -2px rgba(15, 23, 42, 0.05);
    border-radius: 20px;
}

/* Ocultar barra de scroll en contenedores deslizables (Dock y Toolbar móvil) */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Temas del Pizarrón Virtual */
.wb-theme-dots {
    background-color: #f8fafc;
    background-image: radial-gradient(#cbd5e1 1.25px, transparent 1.25px);
    background-size: 22px 22px;
}
.wb-theme-grid {
    background-color: #ffffff;
    background-image:
        linear-gradient(to right, #e2e8f0 1px, transparent 1px),
        linear-gradient(to bottom, #e2e8f0 1px, transparent 1px);
    background-size: 28px 28px;
}
.wb-theme-lines {
    background-color: #fffef9;
    background-image: repeating-linear-gradient(transparent, transparent 31px, #bae6fd 31px, #bae6fd 32px);
}
.wb-theme-chalkboard {
    background-color: #143326;
    background-image: radial-gradient(rgba(255,255,255,0.12) 1px, transparent 1px);
    background-size: 24px 24px;
}
.wb-theme-dark {
    background-color: #0f172a;
    background-image: radial-gradient(#334155 1.25px, transparent 1.25px);
    background-size: 22px 22px;
}

/* Scrollbar elegante */
.custom-scroll::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.custom-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.custom-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
}
.custom-scroll::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Animación de Dados en Widget */
@keyframes dice-jump-mini {
    0%   { transform: translateY(0) scale(1) rotate(0deg); }
    50%  { transform: translateY(-22px) scale(1.15) rotate(180deg); }
    100% { transform: translateY(0) scale(1) rotate(360deg); }
}
.anim-jump-mini {
    animation: dice-jump-mini 0.45s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

/* Widget minimizado */
.widget-panel.widget-minimized .widget-body {
    display: none !important;
}
.widget-panel.widget-minimized {
    height: auto !important;
}

/* =====================================================================
   OPTIMIZACIÓN RESPONSIVA PARA CELULARES (Pantallas < 640px)
   Mantiene intacto el diseño de iPad y Computadora, evitando amontonamientos en móvil.
   ===================================================================== */
@media (max-width: 639px) {
    .workspace {
        height: calc(100dvh - 56px) !important;
    }

    /* En celulares, los widgets abiertos se adaptan limpiamente al ancho de la pantalla */
    .widget-panel {
        width: calc(100vw - 24px) !important;
        max-width: 380px !important;
        left: 50% !important;
        transform: translateX(-50%) scale(1) !important;
        max-height: calc(100dvh - 200px) !important;
    }

    .widget-panel.scale-0 {
        transform: translateX(-50%) scale(0.9) !important;
    }

    .widget-panel .widget-body {
        max-height: calc(100dvh - 250px);
        overflow-y: auto;
    }
}

/* Estilos limpios de impresión para Planeaciones, Rúbricas y Exámenes */
@media print {
    nav, #ai-left-sidebar, #ai-toolbar-actions, #global-toast-container, .no-print {
        display: none !important;
    }
    body, main {
        background: #ffffff !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    #ai-right-panel {
        border: none !important;
        box-shadow: none !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}
