/**
 * Minds Whiteboard & Screen Annotator (Pizarra Digital y Anotador de Pantalla)
 * Assets: /assets/css/minds-whiteboard.css
 * Soporta Modo Transparente sobre la web y Modo Pizarra Blanca en Móvil y Escritorio.
 * Incluye gestión de Borradores / Notas, inserción de recursos propios y dock táctil deslizable.
 */

:root {
    --minds-wb-bg: rgba(15, 23, 42, 0.92);
    --minds-wb-border: rgba(255, 255, 255, 0.16);
    --minds-wb-text: #f8fafc;
    --minds-wb-accent: #6366f1;
    --minds-wb-accent-hover: #4f46e5;
    --minds-wb-active: #f59e0b;
    --minds-wb-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.6), 0 0 20px rgba(99, 102, 241, 0.25);
    --minds-wb-radius: 18px;
}

/* ==========================================================================
   1. Canvas Overlay Container
   ========================================================================== */
#mindsWhiteboardOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99990;
    pointer-events: none;
    transition: background-color 0.25s ease;
    overflow: hidden;
}

/* Soporte Nativo de Pantalla Completa (dentro de Modales, Lector de Libros y Visores) */
:fullscreen #mindsWhiteboardOverlay,
:-webkit-full-screen #mindsWhiteboardOverlay,
#pdf-viewer-shell:fullscreen #mindsWhiteboardOverlay {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 2147483647 !important;
}

:fullscreen .minds-wb-context-menu,
:-webkit-full-screen .minds-wb-context-menu,
#pdf-viewer-shell:fullscreen .minds-wb-context-menu {
    z-index: 2147483647 !important;
}

/* En modo dibujo o selección, el overlay es un escudo protector que absorbe 100% de toques/clics */
#mindsWhiteboardOverlay.drawing-active,
#mindsWhiteboardOverlay.select-active,
#mindsWhiteboardOverlay.mode-whiteboard {
    pointer-events: auto !important;
    touch-action: none !important;
}

#mindsWhiteboardOverlay.active {
    display: block;
}

/* Modo Transparente (Anotar sobre la pantalla web) */
#mindsWhiteboardOverlay.mode-transparent {
    background: transparent !important;
}

/* Modo Cuadro Blanco (Pizarra limpia opaca) */
#mindsWhiteboardOverlay.mode-whiteboard {
    background-color: #ffffff !important;
    background-image: 
        radial-gradient(rgba(148, 163, 184, 0.35) 1.5px, transparent 1.5px) !important;
    background-size: 24px 24px !important;
    pointer-events: auto !important;
}

[data-theme="dark"] #mindsWhiteboardOverlay.mode-whiteboard {
    background-color: #0f172a !important;
    background-image: 
        radial-gradient(rgba(255, 255, 255, 0.15) 1.5px, transparent 1.5px) !important;
}

/* El elemento canvas interactivo */
#mindsWhiteboardOverlay .canvas-container {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

#mindsWhiteboardOverlay.drawing-active .canvas-container,
#mindsWhiteboardOverlay.drawing-active canvas,
#mindsWhiteboardOverlay.select-active .canvas-container,
#mindsWhiteboardOverlay.select-active canvas {
    pointer-events: auto !important;
    touch-action: none !important;
}

/* Solo en Modo Clic Web se permite que los toques/clics atraviesen la pantalla para pulsar botones */
#mindsWhiteboardOverlay.cursor-active,
#mindsWhiteboardOverlay.cursor-active .canvas-container,
#mindsWhiteboardOverlay.cursor-active canvas {
    pointer-events: none !important;
    touch-action: auto !important;
}

/* ==========================================================================
   2. Floating Toolbar Dock (Draggable & Horizontally Scrollable on Mobile)
   ========================================================================== */
#mindsWhiteboardDock {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    background: var(--minds-wb-bg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--minds-wb-border);
    border-radius: var(--minds-wb-radius);
    padding: 8px 12px;
    box-shadow: var(--minds-wb-shadow);
    user-select: none;
    color: var(--minds-wb-text);
    transition: transform 0.15s ease, opacity 0.2s ease, width 0.2s ease;
    max-width: 95vw;
}

#mindsWhiteboardDock.is-visible {
    display: flex;
}

/* Estado Minimizado */
#mindsWhiteboardDock.is-minimized .minds-wb-bottom-row,
#mindsWhiteboardDock.is-minimized .minds-wb-tools-scroll,
#mindsWhiteboardDock.is-minimized .minds-wb-static-actions,
#mindsWhiteboardDock.is-minimized #mindsWbSubmenu {
    display: none !important;
}

#mindsWhiteboardDock.is-minimized {
    padding: 6px 10px;
}

/* Barra Superior del Dock ("Arribita") */
.minds-wb-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    padding-bottom: 6px;
    margin-bottom: 2px;
}

.minds-wb-top-left {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.minds-wb-top-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Botones Pill de la Barra Superior */
.minds-wb-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #f8fafc;
    font-size: 0.76rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.18s ease;
}

.minds-wb-pill-btn:hover {
    background: rgba(99, 102, 241, 0.28);
    border-color: rgba(99, 102, 241, 0.5);
    color: #ffffff;
    transform: translateY(-1px);
}

.minds-wb-pill-btn.minds-wb-save-btn {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.4);
    color: #6ee7b7;
}

.minds-wb-pill-btn.minds-wb-save-btn:hover {
    background: rgba(16, 185, 129, 0.35);
    border-color: #10b981;
    color: #ffffff;
}

.minds-wb-notes-badge {
    background: #f59e0b;
    color: #0f172a;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Badge distintivo de estado */
.minds-wb-mode-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    border-radius: 20px;
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.minds-wb-mini-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 3px 6px;
    border-radius: 6px;
    transition: color 0.15s ease;
}

.minds-wb-mini-btn:hover {
    color: #ffffff;
}

/* Fila Inferior: Contenedor Deslizable + Acciones Estáticas */
.minds-wb-bottom-row {
    display: flex;
    align-items: center;
    width: 100%;
    position: relative;
    gap: 4px;
    overflow: hidden;
}

/* Contenedor Deslizable de Botones de Herramientas */
.minds-wb-tools-scroll {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    padding: 4px 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

/* Acciones Estáticas Pinned (No se mueven al scrollear en celular) */
.minds-wb-static-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 4px;
    padding-left: 2px;
    z-index: 10;
    position: relative;
}

.minds-wb-tools-scroll::-webkit-scrollbar {
    height: 4px;
}

.minds-wb-tools-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.minds-wb-tools-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 4px;
}

/* Mango de arrastre (Drag Handle) */
.minds-wb-drag-handle {
    cursor: grab;
    padding: 6px 8px;
    color: rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: color 0.15s ease;
    touch-action: none;
    flex-shrink: 0;
}

.minds-wb-drag-handle:hover {
    color: #ffffff;
}

.minds-wb-drag-handle:active {
    cursor: grabbing;
}

/* Botones de herramientas */
.minds-wb-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
    width: 38px;
    height: 38px;
    min-width: 38px;
    flex-shrink: 0;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    padding: 0;
    touch-action: manipulation;
}

.minds-wb-btn:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.5);
    color: #ffffff;
    transform: translateY(-2px);
}

.minds-wb-btn:active {
    transform: translateY(0);
}

.minds-wb-btn.active {
    background: linear-gradient(135deg, #6366f1, #4f46e5) !important;
    border-color: #818cf8 !important;
    color: #ffffff !important;
    box-shadow: 0 0 14px rgba(99, 102, 241, 0.6);
}

.minds-wb-btn-close {
    background: rgba(239, 68, 68, 0.22);
    border-color: rgba(239, 68, 68, 0.4);
}

.minds-wb-btn-close:hover {
    background: rgba(239, 68, 68, 0.4);
    border-color: #ef4444;
}

/* Divisor vertical */
.minds-wb-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.12);
    margin: 0 2px;
    flex-shrink: 0;
}

/* Indicador de color actual */
.minds-wb-color-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s ease;
}

.minds-wb-btn:hover .minds-wb-color-indicator {
    transform: scale(1.1);
}

/* Submenú de Colores y Grosores */
#mindsWbSubmenu {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 16px;
    padding: 12px;
    display: none;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
    min-width: 250px;
    z-index: 100000;
}

#mindsWbSubmenu.open {
    display: flex;
}

.minds-wb-color-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.minds-wb-swatch {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.minds-wb-swatch:hover {
    transform: scale(1.15);
}

.minds-wb-swatch.active {
    border-color: #ffffff;
    transform: scale(1.15);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

.minds-wb-size-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.minds-wb-size-btn {
    flex: 1;
    height: 32px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    color: #e2e8f0;
}

.minds-wb-size-btn:hover {
    background: rgba(255, 255, 255, 0.14);
}

.minds-wb-size-btn.active {
    background: rgba(99, 102, 241, 0.35);
    border-color: #6366f1;
    color: #ffffff;
}

.minds-wb-size-dot {
    background: currentColor;
    border-radius: 50%;
}

/* ==========================================================================
   Typography & Font Selection
   ========================================================================== */
.minds-wb-font-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.minds-wb-font-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.minds-wb-font-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #f8fafc;
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 0.78rem;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.minds-wb-font-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: #6366f1;
}

.minds-wb-font-btn.active {
    background: rgba(99, 102, 241, 0.35);
    border-color: #818cf8;
    color: #ffffff;
    font-weight: 700;
}

/* Tooltip nativo en hover (solo escritorio) */
@media (min-width: 769px) {
    .minds-wb-btn[data-title]:hover::after {
        content: attr(data-title);
        position: absolute;
        bottom: calc(100% + 8px);
        left: 50%;
        transform: translateX(-50%);
        background: #0f172a;
        color: #ffffff;
        font-size: 0.72rem;
        font-weight: 600;
        padding: 4px 8px;
        border-radius: 6px;
        white-space: nowrap;
        border: 1px solid rgba(255, 255, 255, 0.15);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
        pointer-events: none;
        z-index: 100001;
    }
}

/* ==========================================================================
   3. Modal / Drawer de Borradores y Notas de Pizarra
   ========================================================================== */
.minds-wb-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100005;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.minds-wb-modal.is-open {
    display: flex;
}

.minds-wb-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.minds-wb-modal-dialog {
    position: relative;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 20px;
    width: 100%;
    max-width: 680px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 30px rgba(99, 102, 241, 0.2);
    color: #f8fafc;
    overflow: hidden;
    animation: mindsModalScale 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes mindsModalScale {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.minds-wb-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
}

.minds-wb-modal-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
}

.minds-wb-modal-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: color 0.15s ease;
}

.minds-wb-modal-close:hover {
    color: #ef4444;
}

/* Pestañas del Modal: Pizarras del Curso vs Mis Borradores */
.minds-wb-modal-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px 0 20px;
    background: rgba(15, 23, 42, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.minds-wb-tab-btn {
    flex: 1 1 0;
    padding: 10px 14px;
    border-radius: 12px 12px 0 0;
    border: 1px solid transparent;
    border-bottom: none;
    background: transparent;
    color: #94a3b8;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
}

.minds-wb-tab-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.minds-wb-tab-btn.active {
    background: rgba(30, 41, 59, 0.7);
    color: #38bdf8;
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
}

.minds-wb-tab-btn.active::after {
    content: '';
    display: block;
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #38bdf8, #6366f1);
    border-radius: 3px 3px 0 0;
}

.minds-wb-modal-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: rgba(30, 41, 59, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.minds-wb-author-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 700;
}

.minds-wb-author-prof {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.minds-wb-author-student {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.35);
}

.minds-wb-course-tag {
    font-size: 0.72rem;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.minds-wb-modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Tarjeta individual de nota / borrador */
.minds-wb-note-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 14px;
    padding: 10px 14px;
    transition: all 0.2s ease;
}

.minds-wb-note-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.minds-wb-note-thumb {
    width: 90px;
    height: 60px;
    border-radius: 8px;
    background: #1e293b;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

.minds-wb-note-info {
    flex: 1;
    overflow: hidden;
}

.minds-wb-note-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.minds-wb-note-meta {
    font-size: 0.74rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 10px;
}

.minds-wb-note-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.minds-wb-note-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #f1f5f9;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.minds-wb-note-btn:hover {
    background: rgba(99, 102, 241, 0.3);
    border-color: #6366f1;
    color: #ffffff;
}

.minds-wb-note-btn-danger:hover {
    background: rgba(239, 68, 68, 0.3) !important;
    border-color: #ef4444 !important;
    color: #fca5a5 !important;
}

.minds-wb-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}

/* ==========================================================================
   4. Toast Notification
   ========================================================================== */
#mindsWbToast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(16, 185, 129, 0.5);
    color: #ffffff;
    padding: 8px 18px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 100010;
    pointer-events: none;
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    gap: 8px;
}

#mindsWbToast.is-shown {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   5. Barra de Modo Aula para el Profesor (HUD Superior)
   ========================================================================== */
#mindsClassroomHud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 99980;
    background: linear-gradient(135deg, rgba(30, 27, 75, 0.95), rgba(79, 70, 229, 0.95));
    backdrop-filter: blur(12px);
    border-bottom: 2px solid #f59e0b;
    color: #ffffff;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

.minds-hud-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.86rem;
}

.minds-hud-pulse {
    width: 10px;
    height: 10px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: mindsPulse 1.8s infinite;
}

@keyframes mindsPulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.minds-hud-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   6. Mobile Adaptations (Celulares & Pantallas Pequeñas <= 768px)
   ========================================================================== */
@media (max-width: 768px) {
    #mindsWhiteboardDock {
        bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        padding: 6px 8px;
        gap: 4px;
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
        border-radius: 16px;
    }

    .minds-wb-top-bar {
        padding-bottom: 4px;
        margin-bottom: 2px;
    }

    .minds-wb-pill-btn {
        padding: 3px 8px;
        font-size: 0.72rem;
    }

    .minds-wb-pill-label {
        font-size: 0.72rem;
    }

    .minds-wb-mode-badge {
        font-size: 0.6rem;
        padding: 2px 6px;
    }

    .minds-wb-bottom-row {
        gap: 3px;
        overflow: hidden;
    }

    .minds-wb-tools-scroll {
        gap: 5px;
        padding: 4px 1px;
    }

    .minds-wb-static-actions {
        padding-left: 6px;
        margin-left: 2px;
        border-left: 1px solid rgba(255, 255, 255, 0.15);
        background: linear-gradient(90deg, rgba(15, 23, 42, 0.5) 0%, rgba(15, 23, 42, 0.98) 35%);
        box-shadow: -8px 0 14px rgba(0, 0, 0, 0.45);
        border-radius: 0 12px 12px 0;
    }

    .minds-wb-static-actions .minds-wb-divider {
        display: none;
    }

    .minds-wb-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        font-size: 0.9rem;
        border-radius: 9px;
    }

    .minds-wb-drag-handle {
        padding: 4px;
    }

    #mindsWbSubmenu {
        min-width: 230px;
        bottom: calc(100% + 8px);
        left: 50%;
        transform: translateX(-50%);
    }

    .minds-wb-note-card {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .minds-wb-note-thumb {
        width: 100%;
        height: 90px;
    }

    .minds-wb-note-actions {
        justify-content: flex-end;
    }

    #mindsClassroomHud {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    /* Mobile: Inspector de Objetos y Botón Listo */
    .minds-wb-inspector {
        padding: 4px 6px;
        border-radius: 14px;
        max-width: calc(100vw - 16px);
    }

    .minds-wb-insp-inner {
        gap: 3px;
        max-width: calc(100vw - 28px);
    }

    .minds-wb-insp-btn {
        width: 35px;
        height: 35px;
        min-width: 35px;
        font-size: 0.85rem;
    }

    .minds-wb-insp-pill {
        padding: 4px 8px;
        font-size: 0.72rem;
    }

    .minds-wb-text-done-btn {
        padding: 6px 14px;
        font-size: 0.82rem;
    }
}

/* ==========================================================================
   7. Inspector Contextual Flotante de Objetos (Floating Inspector)
   ========================================================================== */
.minds-wb-inspector {
    position: fixed;
    z-index: 99998;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 4px 8px;
    box-shadow: 0 14px 40px -6px rgba(0, 0, 0, 0.75), 0 0 20px rgba(99, 102, 241, 0.28);
    display: flex;
    flex-direction: column;
    gap: 4px;
    user-select: none;
    transition: opacity 0.16s ease, transform 0.16s ease;
    animation: mindsWbInspPop 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 95vw;
}

@keyframes mindsWbInspPop {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.minds-wb-insp-inner {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    max-width: 92vw;
    scrollbar-width: none;
}

.minds-wb-insp-inner::-webkit-scrollbar {
    display: none;
}

.minds-wb-insp-group {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.minds-wb-insp-btn {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 9px;
    color: #e2e8f0;
    width: 33px;
    height: 33px;
    min-width: 33px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}

.minds-wb-insp-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    transform: translateY(-1px);
}

.minds-wb-insp-btn.active {
    background: rgba(99, 102, 241, 0.35);
    border-color: #6366f1;
    color: #ffffff;
}

.minds-wb-insp-btn-accent {
    background: rgba(56, 189, 248, 0.18);
    border-color: rgba(56, 189, 248, 0.3);
    color: #38bdf8;
}

.minds-wb-insp-btn-accent:hover {
    background: rgba(56, 189, 248, 0.35);
    color: #ffffff;
}

.minds-wb-insp-btn-danger:hover {
    background: rgba(239, 68, 68, 0.25) !important;
    color: #f87171 !important;
}

.minds-wb-insp-pill {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 0.74rem;
    font-weight: 700;
    color: #f1f5f9;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.minds-wb-insp-pill:hover {
    background: rgba(99, 102, 241, 0.28);
    border-color: #6366f1;
    color: #ffffff;
}

.minds-wb-insp-badge {
    font-size: 0.72rem;
    font-weight: 800;
    color: #94a3b8;
    min-width: 28px;
    text-align: center;
    padding: 0 2px;
}

.minds-wb-insp-sep {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.14);
    margin: 0 3px;
}

/* Selector de Color en el Inspector */
.minds-wb-insp-color-trigger {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 20px;
    padding: 4px 8px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: #cbd5e1;
    font-size: 0.7rem;
}

.minds-wb-insp-color-trigger:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.minds-wb-insp-color-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    background-color: #ef4444;
}

.minds-wb-insp-color-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 6px 4px 4px 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    animation: mindsWbFadeIn 0.15s ease;
}

.minds-wb-insp-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.minds-wb-insp-swatch:hover {
    transform: scale(1.22);
    border-color: #ffffff;
}

/* ==========================================================================
   8. Botón Flotante "Listo ✓" para Terminar Escritura
   ========================================================================== */
.minds-wb-text-done-btn {
    position: fixed;
    z-index: 100005;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    font-weight: 700;
    font-size: 0.86rem;
    padding: 7px 18px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.45), 0 0 12px rgba(16, 185, 129, 0.3);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    animation: mindsWbFadeIn 0.2s ease;
}

.minds-wb-text-done-btn:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 14px 30px rgba(16, 185, 129, 0.6);
}

/* ==========================================================================
   9. Modos Dinámicos de Acomodación del Dock (Typing Active & Proximity Dim)
   ========================================================================== */
#mindsWhiteboardDock.typing-active {
    opacity: 0.18 !important;
    pointer-events: none !important;
    transform: translateX(-50%) translateY(20px) scale(0.95) !important;
    transition: opacity 0.22s ease, transform 0.22s ease !important;
}

#mindsWhiteboardDock.minds-wb-dock-proximity-dim {
    opacity: 0.22 !important;
    pointer-events: none !important;
    transition: opacity 0.2s ease !important;
}

/* ==========================================================================
   10. Modo Mano / Desplazar y Pan Adaptativo
   ========================================================================== */
#mindsWhiteboardOverlay.hand-active,
#mindsWhiteboardOverlay.hand-active .canvas-container,
#mindsWhiteboardOverlay.hand-active canvas {
    cursor: grab !important;
}

#mindsWhiteboardOverlay.is-panning,
#mindsWhiteboardOverlay.is-panning .canvas-container,
#mindsWhiteboardOverlay.is-panning canvas {
    cursor: grabbing !important;
}

/* ==========================================================================
   11. Menú Contextual Rápido con Clic Derecho (Glassmorphic Context Menu)
   ========================================================================== */
.minds-wb-context-menu {
    position: fixed;
    z-index: 100010;
    min-width: 260px;
    max-width: 330px;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65), 0 0 25px rgba(99, 102, 241, 0.25);
    padding: 12px;
    color: #f8fafc;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    animation: mindsWbMenuPop 0.16s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: top left;
}

@keyframes mindsWbMenuPop {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(-6px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.minds-wb-ctx-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.minds-wb-ctx-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #cbd5e1;
    display: flex;
    align-items: center;
}

.minds-wb-ctx-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s ease;
}

.minds-wb-ctx-close:hover {
    color: #ef4444;
}

.minds-wb-ctx-section {
    margin-bottom: 8px;
}

.minds-wb-ctx-section:last-child {
    margin-bottom: 0;
}

.minds-wb-ctx-tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.minds-wb-ctx-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 8px 4px;
    color: #f1f5f9;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.minds-wb-ctx-btn i {
    font-size: 1rem;
}

.minds-wb-ctx-btn:hover {
    background: rgba(99, 102, 241, 0.35);
    border-color: rgba(99, 102, 241, 0.6);
    transform: translateY(-1px);
}

.minds-wb-ctx-btn.is-active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.8), rgba(79, 70, 229, 0.8));
    border-color: #818cf8;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.minds-wb-ctx-shapes-row {
    display: flex;
    gap: 6px;
}

.minds-wb-ctx-shape-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 6px 8px;
    color: #e2e8f0;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.minds-wb-ctx-shape-btn:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.5);
}

.minds-wb-ctx-colors {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 12px;
}

.minds-wb-ctx-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    border: 2px solid transparent;
}

.minds-wb-ctx-swatch:hover {
    transform: scale(1.25);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

.minds-wb-ctx-swatch.is-active {
    border-color: #ffffff;
    transform: scale(1.15);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

.minds-wb-ctx-obj-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.minds-wb-ctx-action-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 6px 8px;
    color: #e2e8f0;
    font-size: 0.78rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s ease;
}

.minds-wb-ctx-action-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.minds-wb-ctx-footer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.minds-wb-ctx-icon-action {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.15s ease;
}

.minds-wb-ctx-icon-action:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    transform: translateY(-1px);
}

/* ==========================================================================
   12. Botones de Activación de Pizarra en el Libro de Texto
   ========================================================================== */
.btn-pdf-wb-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.3));
    color: #fbbf24 !important;
    border: 1px solid rgba(245, 158, 11, 0.4) !important;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-pdf-wb-toggle:hover {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff !important;
    border-color: #f59e0b !important;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    transform: translateY(-1px);
}

.btn-pdf-wb-toggle.is-active {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff !important;
    border-color: #10b981 !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.hotspot-btn-whiteboard {
    background: rgba(245, 158, 11, 0.9) !important;
    border-color: #fbbf24 !important;
    color: #0f172a !important;
}

.hotspot-btn-whiteboard:hover {
    background: #f59e0b !important;
    transform: scale(1.08) !important;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.6) !important;
}

