:root {
    /* DARK MODE DEFAULT */
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --primary-color: #e2e8f0;
    --h1-color: #f87171; 
    --h2-color: #60a5fa; 
    --h3-color: #a78bfa; 
    --border-color: #334155;
    --text-color: #cbd5e1;
    --btn-hover: #334155;
    --summary-bg: rgba(255,255,255,0.05);
}

:root.light-mode {
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --primary-color: #0f172a;
    --h1-color: #ef4444; 
    --h2-color: #3b82f6; 
    --h3-color: #8b5cf6; 
    --border-color: #e2e8f0;
    --text-color: #334155;
    --btn-hover: #e2e8f0;
    --summary-bg: #f8fafc;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    overscroll-behavior: none;
    overscroll-behavior-y: none;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    transition: background-color 0.3s, color 0.3s;
    overflow: hidden;
}

/* App Header */
.app-header {
    background: var(--card-bg);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.header-email-text {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary-color);
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .header-email-text {
        display: none !important;
    }
    .app-header {
        padding: 0.5rem 0.75rem !important;
    }
}

/* Botón Menú Lateral con Alto Contraste y Área Táctil Completa */
#btn-menu-lateral,
.btn-menu-lateral {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
    color: #ffffff !important;
    border: 1.5px solid #38bdf8 !important;
    border-radius: 8px !important;
    padding: 0.5rem 0.95rem !important;
    font-weight: 700 !important;
    font-size: 0.9rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.35rem !important;
    cursor: pointer !important;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.45) !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
    touch-action: manipulation !important;
    min-height: 38px !important;
    min-width: 80px !important;
    margin-left: 0.25rem !important;
    flex-shrink: 0 !important;
    position: relative !important;
    z-index: 20 !important;
}

#btn-menu-lateral *,
.btn-menu-lateral * {
    pointer-events: none !important;
}

#btn-menu-lateral:hover,
.btn-menu-lateral:hover {
    background: linear-gradient(135deg, #0369a1 0%, #0284c7 100%) !important;
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.6) !important;
    transform: translateY(-1px) !important;
}

#btn-menu-lateral:active,
.btn-menu-lateral:active {
    transform: scale(0.95) !important;
    box-shadow: 0 1px 4px rgba(2, 132, 199, 0.3) !important;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo-mobile {
    display: none;
}

@media (max-width: 768px) {
    .logo-full {
        display: none;
    }
    .logo-mobile {
        display: inline;
    }
}

button {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: var(--primary-color);
    transition: all 0.2s;
    margin-left: 0.5rem;
}

button:hover {
    background: var(--btn-hover);
}

button.primary {
    background: var(--h2-color);
    color: white;
    border: none;
}

button.primary:hover {
    filter: brightness(0.9);
}

#btn-delete-class {
    display: none !important;
}

/* Layout */
.app-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

#timeline-container {
    width: 300px;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.timeline-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.timeline {
    padding: 2rem 1.5rem;
    position: relative;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.timeline::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.timeline::-webkit-scrollbar-track {
    background: transparent;
}

.timeline::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 4px;
}

.timeline.is-scrolling::-webkit-scrollbar-thumb,
.timeline:hover::-webkit-scrollbar-thumb {
    background: var(--border-color);
}

.timeline::-webkit-scrollbar-thumb:hover {
    background: var(--h2-color) !important;
}

/* Timeline vertical line */
.timeline::before {
    content: '';
    position: absolute;
    left: 1.85rem;
    top: 1.25rem;
    bottom: 1.25rem;
    width: 2px;
    background: var(--border-color);
}

.timeline-node {
    position: relative;
    padding-left: 1.85rem;
    margin-bottom: 1.15rem;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.timeline-node:last-child {
    margin-bottom: 0.25rem;
}

.timeline-node::before {
    content: '';
    position: absolute;
    left: -0.375rem; 
    top: 0.65rem;
    width: 1.25rem;
    height: 1.25rem;
    background: var(--bg-color);
    border: 3px solid var(--primary-color);
    border-radius: 50%;
    z-index: 1;
    transition: transform 0.2s;
}

.timeline-node:hover::before {
    transform: scale(1.25);
    background: var(--primary-color);
}

.timeline-node-content {
    background: var(--bg-color);
    padding: 0.75rem 0.85rem;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: background 0.2s, border-color 0.2s;
    border: 1px solid var(--border-color);
    border-left: 3px solid transparent;
    min-height: 60px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
}

.timeline-node-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.2rem;
}

.node-meta {
    font-size: 0.78rem;
    color: #64748b;
}

/* Clases Revisadas (Naranja) */
.timeline-node.revisada::before {
    border-color: #f97316 !important;
    background: #ffedd5 !important;
}

:root:not(.light-mode) .timeline-node.revisada::before {
    background: #431407 !important;
}

.timeline-node.revisada .timeline-node-content {
    border-left: 3px solid #f97316;
}

.timeline-node:hover .timeline-node-content {
    background: var(--btn-hover);
}

.node-tooltip {
    font-weight: 600;
    color: var(--primary-color);
}

/* Nodos Apilados (Stacked) */
.timeline-node.stacked::before {
    border-color: var(--h3-color) !important;
    background: var(--card-bg) !important;
    box-shadow: 2px 2px 0 var(--border-color), 4px 4px 0 var(--bg-color);
}

.timeline-node.stacked .timeline-node-content {
    border-left: 3px solid var(--h3-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 3px 3px 0 var(--card-bg);
}

.stacked-badge {
    display: inline-block;
    background: var(--h3-color);
    color: white;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 0.15rem 0.4rem;
    border-radius: 9999px;
    margin-left: 0.35rem;
}

/* Popover Flotante de Clases Apiladas */
.stack-popover {
    display: none;
    z-index: 1010;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    width: 230px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    animation: popoverFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popoverFadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.stack-popover .popover-title {
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stack-popover .popover-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-color);
    transition: background-color 0.15s ease;
}

.stack-popover .popover-item:hover {
    background-color: var(--btn-hover);
    color: var(--primary-color);
}

.stack-popover .popover-item .bullet-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--border-color);
}

.stack-popover .popover-item.revisada .bullet-dot {
    background-color: #f97316;
}

.stack-popover .popover-item.revisada .item-text {
    color: var(--text-color);
    opacity: 0.85;
}

.timeline-filters-selects {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: var(--card-bg);
    margin-bottom: 0;
    z-index: 10;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-group label {
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-group select {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 0.4rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
    width: 100%;
}

.filter-group select:focus {
    border-color: var(--h2-color);
}

/* Visor */
#clase-viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-color);
    overflow-y: auto;
}

.visor-controls {
    display: flex;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.print-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.print-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    margin-left: 0;
}

.mobile-only {
    display: none;
}

#visor-content {
    padding: 2rem;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.placeholder-msg {
    text-align: center;
    color: #64748b;
    margin-top: 4rem;
}

/* Estricto Paleta para Títulos */
#visor-content h1 {
    color: var(--h1-color);
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--h1-color);
    padding-bottom: 0.5rem;
}

#visor-content h2 {
    color: var(--h2-color);
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

#visor-content h3 {
    color: var(--h3-color);
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

/* Collapsibles */
details {
    background: var(--card-bg);
    margin-bottom: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

summary {
    padding: 1rem;
    font-weight: 600;
    background: var(--summary-bg);
    cursor: pointer;
    list-style: none;
}

summary::-webkit-details-marker {
    display: none;
}

summary::before {
    content: '▶';
    display: inline-block;
    width: 1.5rem;
    transition: transform 0.2s;
    color: var(--primary-color);
}

details[open] summary::before {
    transform: rotate(90deg);
}

details[open] summary {
    border-bottom: 1px solid var(--border-color);
}

.details-content {
    padding: 1rem;
}

/* Tablas, imágenes y otros elementos dentro del contenido */
#visor-content p, #visor-content li, #visor-content td {
    line-height: 1.5;
}

#visor-content p {
    margin-bottom: 1.2rem;
}

#visor-content th, #visor-content td {
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    text-align: left;
}

#visor-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem auto;
}

#visor-content ol, #visor-content ul {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

/* MathJax Coloring */
mjx-container {
    color: var(--text-color);
}

/* =========================================
   1. Ajustes para el Motor Matemático (MathJax / KaTeX)
   ========================================= */

/* Fórmulas en bloque ($$ ... $$) - Previene que se salgan de la pantalla */
.MathJax_Display, 
.katex-display, 
mjx-container[display="true"] {
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    padding: 10px 0;
    margin: 0 auto;
}

/* =========================================
   2. Ajustes para los Gráficos SVG
   ========================================= */

/* Hace que el triángulo rectángulo escale automáticamente */
/* Hace que los gráficos SVG generales se muestren como bloques centrados, excluyendo MathJax */
#visor-content > svg, #visor-content *:not(mjx-container) > svg {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem auto;
}

/* =========================================
   3. Ajustes para Tablas y Contenedores
   ========================================= */

/* Asegura que el encabezado no rompa pantallas pequeñas */
table, #visor-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

/* Contenedor responsivo para tablas en móviles */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 6000;
}

.modal.hidden {
    display: none;
}

.neon-input {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.neon-input:focus {
    outline: none;
    border-color: var(--h2-color);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

.neon-select {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.neon-select:focus {
    outline: none;
    border-color: var(--h2-color);
}

.modal-content {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
}

.modal-content textarea {
    width: 100%;
    height: 300px;
    margin: 1rem 0;
    padding: 1rem;
    font-family: monospace;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    resize: vertical;
    background: var(--bg-color);
    color: var(--text-color);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Modal de Edición en Escritorio */
#modal-edit-tema .modal-content {
    max-width: 850px !important;
    width: 90% !important;
    padding: 2.25rem !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.7), 0 10px 10px -5px rgba(0, 0, 0, 0.7) !important;
}

#form-edit-tema {
    gap: 1.25rem !important;
}

#form-edit-tema textarea {
    height: auto !important;
    font-size: 0.95rem !important;
    line-height: 1.5 !important;
    padding: 0.75rem 0.85rem !important;
    margin: 0 !important;
    font-family: inherit !important;
    resize: vertical !important;
}

#form-edit-tema input {
    font-size: 0.95rem !important;
    padding: 0.75rem 0.85rem !important;
}

#form-edit-tema label {
    font-size: 0.85rem !important;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Responsive Mobile */
@media (max-width: 768px) {
    #visor-content {
        padding: 0.75rem 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    details {
        border-left: none !important;
        border-right: none !important;
        border-radius: 0 !important;
        margin-bottom: 0.75rem !important;
    }
    
    .details-content {
        padding: 0.75rem 0.5rem !important;
    }

    /* Ajuste responsivo de imágenes en móviles: aprovecha el ancho de la pantalla sin deformar ni alterar la impresión PDF */
    #visor-content img,
    .details-content img,
    .seccion-general img,
    .seccion-taller img,
    .seccion-solucionario img,
    .mateplus-clase-container img {
        width: 95% !important;
        max-width: 100% !important;
        max-height: none !important;
        height: auto !important;
        object-fit: contain !important;
        margin: 0.75rem auto !important;
        display: block !important;
    }


    .app-container {
        position: relative;
    }
    
    #timeline-container {
        width: 100%;
        position: absolute;
        top: 0; left: 0; bottom: 0;
        z-index: 5;
    }
    
    #clase-viewer {
        width: 100%;
        position: absolute;
        top: 0; left: 0; right: 0; bottom: 0;
        z-index: 4; 
        display: none; 
    }
    
    body.viewing-class .app-header {
        display: none; /* Hide header completely to save space */
    }

    body.viewing-class #timeline-container {
        display: none;
    }
    
    body.viewing-class #clase-viewer {
        display: flex;
        z-index: 6;
    }

    .visor-controls {
        flex-direction: column;
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .mobile-only:not(#btn-volver) {
        display: block;
        width: 100%;
        margin-left: 0;
        text-align: center;
    }

    #btn-volver.mobile-only {
        display: none; /* Controlado por JS, se volverá flex */
        position: fixed;
        bottom: 6rem; /* Arriba de volver arriba */
        right: 2rem; /* Lado derecho */
        left: auto;
        z-index: 100;
        background: var(--h1-color);
        color: white;
        border: none;
        border-radius: 50%;
        width: 3.5rem;
        height: 3.5rem;
        font-size: 1.5rem;
        padding: 0;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
        transition: transform 0.3s, opacity 0.3s;
        align-items: center;
        justify-content: center;
    }
    
    /* Modal de Edición en Móviles */
    #modal-edit-tema .modal-content {
        padding: 1.25rem !important;
        width: 95% !important;
        max-width: 95% !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
        border-radius: 8px !important;
    }
    #modal-edit-tema h2 {
        font-size: 1.2rem !important;
        margin-bottom: 0.25rem !important;
        text-align: center;
    }
    #form-edit-tema {
        gap: 0.75rem !important;
        margin-top: 0.5rem !important;
    }
    #form-edit-tema div {
        gap: 0.25rem !important;
    }
    #form-edit-tema label {
        font-size: 0.8rem !important;
    }
    #form-edit-tema textarea {
        font-size: 0.85rem !important;
        padding: 0.5rem 0.60rem !important;
        min-height: 60px !important;
        height: auto !important;
        margin: 0 !important;
    }
    #form-edit-tema input {
        font-size: 0.85rem !important;
        padding: 0.5rem 0.60rem !important;
    }
    #modal-edit-tema .modal-actions {
        margin-top: 0.5rem !important;
        gap: 0.5rem !important;
    }
    #modal-edit-tema .modal-actions button {
        padding: 0.5rem !important;
        font-size: 0.85rem !important;
    }
    
    .print-actions {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    .print-actions button {
        margin-left: 0;
        flex: 1 1 calc(50% - 0.5rem); /* Dos botones por fila en móvil */
        font-size: 0.72rem;
        padding: 0.35rem 0.5rem;
        text-align: center;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.25rem;
    }

    /* Alinear selectores de filtros lado a lado en móvil */
    .timeline-filters-selects {
        flex-direction: row !important;
        gap: 0.5rem !important;
        padding: 0.75rem 1rem !important;
    }

    .timeline-filters-selects .filter-group {
        flex: 1 1 50%;
        min-width: 0;
    }
}

/* Print Engine */
@media print {
    @page {
        size: letter;
        margin: 1.5cm 1.5cm 2.0cm 1.5cm;
        @bottom-center {
            content: counter(page) " / " counter(pages);
            font-family: 'Inter', sans-serif;
            font-size: 9pt;
            color: #64748b;
        }
    }

    /* Ocultar elementos interactivos, paginación, modales, menú lateral y controles flotantes */
    .print-pagination, .clase-index, .visor-controls, .app-header, #timeline-container,
    #student-floating-controls, .student-floating-controls, .student-btn-round,
    .student-print-actions, .drawer, .drawer-backdrop, #menu-lateral, #menu-lateral-backdrop,
    #right-scroll-tracker, #right-sensor-area, #section-tracker-indicator,
    .modal, .plan-detail-modal, #btn-scroll-top, #btn-volver, .floating-control,
    .blink-dot, #auth-overlay, .no-print, .seccion-observaciones {
        display: none !important;
        box-shadow: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }

    /* Quitar títulos de summary redundantes que se repiten con los h1 o h2 del contenido */
    .det-encabezado > summary,
    .det-taller > summary,
    .det-solucionario-taller > summary {
        display: none !important;
    }

    /* Evitar títulos huérfanos solos al final de las páginas */
    h1, h2, h3, h4, h5, h6, summary, details > summary {
        page-break-after: avoid !important;
        break-after: avoid !important;
    }

    .details-content > h3 {
        page-break-after: avoid !important;
        break-after: avoid !important;
    }

    /* Evitar saltos de página partidos a la mitad en filas, listas, imágenes y gráficos */
    tr, li, img, svg, figure, mjx-container[display="true"] {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    /* Reducir interlineado y márgenes al imprimir para ahorrar papel y espacio */
    #visor-content p, #visor-content li, #visor-content td {
        line-height: 1.3 !important;
        text-align: left !important;
    }

    #visor-content p {
        margin-bottom: 0.8rem !important;
    }

    #visor-content h1, #visor-content h2, #visor-content h3 {
        margin-top: 1rem !important;
        margin-bottom: 0.5rem !important;
    }

    #visor-content ol, #visor-content ul {
        margin-bottom: 0.8rem !important;
        margin-left: 1.5rem !important;
    }
    
    #visor-content li {
        margin-bottom: 0.25rem !important;
    }

    #visor-content img {
        margin: 0.5rem auto !important;
        max-width: 60% !important; /* Escalar imágenes en impresión para ahorrar espacio */
    }

    /* Resetear posicionamientos y sombras de pantalla que rompen el flujo de páginas en PDF */
    html, body, .app-container, #clase-viewer, #visor-content, .seccion-general, .seccion-taller, .seccion-solucionario {
        position: static !important;
        width: auto !important;
        height: auto !important;
        overflow: visible !important;
        display: block !important;
        inset: auto !important;
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        filter: none !important;
    }

    #visor-content h1 { border-bottom-color: black; }

    details {
        border: none !important;
        margin-bottom: 0 !important;
        background: white !important;
        display: block !important;
        box-shadow: none !important;
    }
    
    summary {
        pointer-events: none; 
        padding: 0 !important;
        background: none !important;
        color: black !important;
        display: block !important;
        box-shadow: none !important;
    }

    summary::before {
        display: none !important;
    }
    
    .details-content {
        padding: 0 !important;
        margin-bottom: 1.5rem;
        display: block !important;
        box-shadow: none !important;
    }

    /* Ocultar el resumen en cualquier modo que no sea completo */
    body:not(.print-modo-completo) .det-resumen {
        display: none !important;
    }

    /* Ocultar secciones del taller o solucionario según el modo de impresión */
    body.print-modo-taller .seccion-general,
    body.print-modo-taller .seccion-solucionario {
        display: none !important;
    }

    body.print-modo-solucionario .seccion-general,
    body.print-modo-solucionario .seccion-taller {
        display: none !important;
    }

    /* Modos de Impresión Estudiante */
    body.print-modo-estudiante-clase .seccion-taller,
    body.print-modo-estudiante-clase .seccion-solucionario,
    body.print-modo-estudiante-clase .student-print-actions {
        display: none !important;
    }

    body.print-modo-estudiante-taller .seccion-general,
    body.print-modo-estudiante-taller .seccion-solucionario,
    body.print-modo-estudiante-taller .student-print-actions {
        display: none !important;
    }

    /* PDF Estudiante & Guía: Ocultar completamente las secciones que no corresponden (tanto título como contenido) */
    body.print-modo-estudiante .det-competencias,
    body.print-modo-estudiante .det-exploracion,
    body.print-modo-estudiante .det-actividad,
    body.print-modo-estudiante .det-soluciones,
    body.print-modo-estudiante .det-examen,
    body.print-modo-estudiante .det-recursos,
    body.print-modo-estudiante .seccion-solucionario,
    body.print-modo-guia .det-competencias,
    body.print-modo-guia .det-exploracion,
    body.print-modo-guia .det-actividad,
    body.print-modo-guia .det-transferencia,
    body.print-modo-guia .det-soluciones,
    body.print-modo-guia .det-examen,
    body.print-modo-guia .seccion-solucionario,
    body.print-modo-guia .seccion-taller {
        display: none !important;
    }

    /* Si existe el taller práctico, ocultamos la sección de transferencia (que diría "Ver taller.") para evitar títulos huérfanos */
    body.print-modo-estudiante:has(.seccion-taller) .det-transferencia {
        display: none !important;
    }
}

/* Estilos de pantalla para el botón Scroll to Top */
#btn-scroll-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 100;
    background: var(--h2-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 3.5rem;
    height: 3.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s, opacity 0.2s;
    display: none; /* Controlado por JS (flex/none) */
    align-items: center;
    justify-content: center;
    margin-left: 0;
}

#btn-scroll-top:hover {
    transform: scale(1.1);
    filter: brightness(1.1);
}

/* Clases de inactividad para ocultar botones flotantes un 70% y opacidad casi completa */
.floating-hide-right {
    transform: translateX(70%) !important;
    opacity: 0.15 !important;
}

.floating-hide-left {
    transform: translateX(-70%) !important;
    opacity: 0.15 !important;
}

/* Forzar layout auto-height durante la generación de PDF para evitar recortes de html2canvas */
body.generating-pdf, body.generating-pdf html {
    height: auto !important;
    overflow: visible !important;
}
body.generating-pdf .app-container {
    height: auto !important;
    overflow: visible !important;
    display: block !important;
}
body.generating-pdf #clase-viewer {
    height: auto !important;
    overflow: visible !important;
    display: block !important;
}

/* Scroll Tracker Lateral Derecho Sutil (Pad Táctil) */
#right-scroll-tracker {
    position: fixed;
    right: 15px;
    left: auto;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1005;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    user-select: none;
    padding: 20px 10px;
}

#right-scroll-tracker.visible {
    opacity: 0.85;
    pointer-events: auto;
}

/* Línea de guía vertical */
.tracker-line {
    position: absolute;
    top: 25px;
    bottom: 25px;
    width: 2px;
    background: var(--border-color);
    opacity: 0.4;
    z-index: 1;
}

/* Puntos de secciones */
.tracker-bullet {
    position: relative;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-color);
    border: 2px solid var(--card-bg);
    cursor: pointer;
    z-index: 2;
    transition: background-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.tracker-bullet:hover {
    transform: scale(1.4);
    background-color: var(--h2-color);
    box-shadow: 0 0 8px var(--h2-color);
}

.tracker-bullet.active {
    transform: scale(1.3);
    background-color: var(--h3-color);
    border-color: var(--h3-color);
    box-shadow: 0 0 10px var(--h3-color);
}

/* Tooltip lateral */
.tracker-tooltip {
    position: absolute;
    right: 20px;
    left: auto;
    top: 50%;
    transform: translateY(-50%) translateX(-10px);
    background: var(--card-bg);
    color: var(--text-color);
    padding: 0.35rem 0.65rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.tracker-bullet:hover .tracker-tooltip {
    opacity: 1;
    transform: translateY(-50%) translateX(0px);
}

/* Indicador central flotante para la sección actual */
#section-tracker-indicator {
    position: fixed;
    right: 55px;
    left: auto;
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(4px);
    color: #ffffff;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 700;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 1006;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

#section-tracker-indicator.visible {
    opacity: 1;
    transform: translateY(-50%) translateX(0px);
}

/* Área activa en el borde derecho para revelar la barra */
#right-sensor-area {
    position: fixed;
    right: 0;
    left: auto;
    top: 70px;
    bottom: 0;
    width: 35px;
    z-index: 1004;
    pointer-events: auto;
}

/* Ocultar tracker, sensor y botones flotantes en la página principal */
body:not(.viewing-class):not(.has-active-class) #btn-volver,
body:not(.viewing-class):not(.has-active-class) #btn-scroll-top,
body:not(.viewing-class):not(.has-active-class) #right-scroll-tracker,
body:not(.viewing-class):not(.has-active-class) #right-sensor-area,
body:not(.viewing-class):not(.has-active-class) #section-tracker-indicator {
    display: none !important;
    pointer-events: none !important;
}

@media (max-width: 768px) {
    body:not(.viewing-class) #btn-volver,
    body:not(.viewing-class) #btn-scroll-top,
    body:not(.viewing-class) #right-scroll-tracker,
    body:not(.viewing-class) #right-sensor-area,
    body:not(.viewing-class) #section-tracker-indicator {
        display: none !important;
        pointer-events: none !important;
    }
}

@media print {
    #right-scroll-tracker, #right-sensor-area, #section-tracker-indicator {
        display: none !important;
    }
}

/* Dropdown Plan de Estudio */
.dropdown-plan:hover .dropdown-plan-content {
    display: block !important;
}

.dropdown-plan-content a:hover {
    background-color: var(--btn-hover);
    color: var(--primary-color) !important;
}

/* Modal grande para Plan de Estudio */
.modal-large {
    max-width: 90% !important;
    width: 1000px !important;
    height: 85vh !important;
    display: flex !important;
    flex-direction: column !important;
    background: rgba(15, 23, 42, 0.95) !important;
    backdrop-filter: blur(12px) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 0 25px rgba(14, 165, 233, 0.25) !important;
}

:root.light-mode .modal-large {
    background: rgba(255, 255, 255, 0.95) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
}

.plan-table {
    width: 100%;
    border-collapse: separate !important;
    border-spacing: 0 0.4rem !important;
    background: transparent !important;
}

.plan-table tbody tr {
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    cursor: grab;
    background: rgba(30, 41, 59, 0.4);
}

:root.light-mode .plan-table tbody tr {
    background: rgba(241, 245, 249, 0.7);
}

.plan-table tbody tr:active {
    cursor: grabbing;
}

.plan-table th, .plan-table td {
    padding: 0.8rem 1rem !important;
    border: none !important;
    vertical-align: middle;
}

.plan-table tbody tr td:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.plan-table tbody tr td:last-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

/* Colores Neón por Asignatura */
/* ARI: Aritmética (Amarillo Neón) */
.plan-row-ari {
    border-left: 4px solid #eab308 !important;
}
.plan-row-ari:hover {
    background: rgba(234, 179, 8, 0.08) !important;
    box-shadow: 0 0 10px rgba(234, 179, 8, 0.2);
}

/* ALG: Álgebra (Azul / Cian Neón) */
.plan-row-alg {
    border-left: 4px solid #0ea5e9 !important;
}
.plan-row-alg:hover {
    background: rgba(14, 165, 233, 0.08) !important;
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.2);
}

/* GEO: Geometría (Verde Neón) */
.plan-row-geo {
    border-left: 4px solid #22c55e !important;
}
.plan-row-geo:hover {
    background: rgba(34, 197, 94, 0.08) !important;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.2);
}

/* EST: Estadística (Morado / Púrpura Neón) */
.plan-row-est {
    border-left: 4px solid #a855f7 !important;
}
.plan-row-est:hover {
    background: rgba(168, 85, 247, 0.08) !important;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.2);
}

/* TRI: Trigonometría (Rosa / Fucsia Neón) */
.plan-row-tri {
    border-left: 4px solid #ec4899 !important;
}
.plan-row-tri:hover {
    background: rgba(236, 72, 153, 0.08) !important;
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.2);
}

/* CAL: Cálculo (Naranja Neón) */
.plan-row-cal {
    border-left: 4px solid #f97316 !important;
}
.plan-row-cal:hover {
    background: rgba(249, 115, 22, 0.08) !important;
    box-shadow: 0 0 10px rgba(249, 115, 22, 0.2);
}

/* Clases deshabilitadas / no preparadas (Gris opaco) */
.plan-row-pending {
    opacity: 0.45 !important;
    border-left: 4px solid #64748b !important;
    background: rgba(71, 85, 105, 0.1) !important;
}
.plan-row-pending:hover {
    opacity: 0.8 !important;
    background: rgba(100, 116, 139, 0.15) !important;
    box-shadow: none !important;
}

/* Badges de Estado */
.badge-status {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    display: inline-block;
}

.badge-ready {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-pending {
    background: rgba(100, 116, 139, 0.15);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, 0.3);
}

/* Drag and Drop Dragging State */
.plan-table tbody tr.dragging {
    opacity: 0.2;
    background: var(--btn-hover) !important;
    border: 1px dashed var(--primary-color) !important;
}

.plan-table tbody tr.drag-over {
    background: rgba(14, 165, 233, 0.1) !important;
    border-top: 2px solid var(--primary-color) !important;
}

/* Conectores visuales */
.sequence-connector {
    position: relative;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 20px;
    height: 20px;
}

.sequence-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    z-index: 2;
    background-color: currentColor;
    box-shadow: 0 0 8px currentColor;
}

.sequence-line {
    position: absolute;
    top: 50%;
    bottom: -150%;
    left: 50%;
    width: 2px;
    background: var(--border-color);
    transform: translateX(-50%);
    z-index: 1;
}

.plan-table tbody tr:last-child .sequence-line {
    display: none;
}

/* =========================================
   PLAN DE ESTUDIO FULLSCREEN & MATRIX
   ========================================= */

.fullscreen-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-color);
    z-index: 5000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.plan-header {
    background: var(--card-bg);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.btn-back-arrow {
    background: transparent;
    color: var(--text-color);
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: bold;
    padding: 0;
    margin: 0;
}

.btn-back-arrow:hover {
    color: var(--h2-color);
}

.plan-matrix-container {
    flex: 1;
    padding: 3rem 2rem 3rem 0;
    overflow: auto;
    background-color: #050a15;
    background-image: 
        linear-gradient(rgba(14, 165, 233, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(14, 165, 233, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: center center;
    position: relative;
}

:root.light-mode .plan-matrix-container {
    background-color: #f8fafc;
    background-image: 
        linear-gradient(rgba(14, 165, 233, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(14, 165, 233, 0.1) 1px, transparent 1px);
}

.plan-matrix {
    display: grid;
    grid-template-columns: 90px repeat(12, 132px); /* Configuración ultra compacta de 132px por columna */
    gap: 0.5rem 0.55rem; /* Espaciado ultra reducido entre filas y columnas */
    align-items: center;
    position: relative;
    z-index: 1;
    width: max-content;
}

.matrix-row {
    display: contents;
}

.matrix-row-header {
    font-size: 0.9rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 0 8px rgba(14, 165, 233, 0.8);
    text-align: center;
    background: rgba(14, 165, 233, 0.1);
    padding: 0.35rem 0.5rem;
    border-radius: 8px;
    border: 2px solid #0ea5e9;
    box-shadow: 0 0 8px rgba(14, 165, 233, 0.4), inset 0 0 5px rgba(14, 165, 233, 0.2);
    letter-spacing: 0.5px;
    grid-column: 1;
}

:root.light-mode .matrix-row-header {
    color: #0ea5e9;
    text-shadow: none;
    background: rgba(14, 165, 233, 0.05);
    box-shadow: 0 3px 5px rgba(14, 165, 233, 0.2);
}

/* Remove bubbles container styling as it's now part of the grid */
.matrix-bubbles {
    display: contents;
}

.matrix-bubbles::-webkit-scrollbar {
    height: 8px;
}
.matrix-bubbles::-webkit-scrollbar-track {
    background: transparent;
}
.matrix-bubbles::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.matrix-col-header {
    font-size: 0.72rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    text-align: center;
    padding: 0.25rem 0.35rem;
    border-bottom: 2px solid rgba(14, 165, 233, 0.2);
    margin-bottom: 0.3rem;
    user-select: none;
    position: sticky !important;
    top: 0 !important;
    z-index: 900 !important;
    background: #050a15 !important;
}

:root.light-mode .matrix-col-header {
    color: #64748b;
    border-bottom-color: rgba(14, 165, 233, 0.1);
    background: #f8fafc !important;
}

.matrix-corner-header {
    position: sticky !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 1100 !important;
    background: #050a15 !important;
    border-bottom: 2px solid rgba(14, 165, 233, 0.2);
}

:root.light-mode .matrix-corner-header {
    background: #f8fafc !important;
    border-bottom-color: rgba(14, 165, 233, 0.1);
}

.matrix-row-header {
    font-size: 0.9rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 0 8px rgba(14, 165, 233, 0.8);
    text-align: center;
    background: #050a15 !important;
    padding: 0.35rem 0.5rem;
    border-radius: 8px;
    border: 2px solid #0ea5e9;
    box-shadow: 0 0 8px rgba(14, 165, 233, 0.4), inset 0 0 5px rgba(14, 165, 233, 0.2);
    letter-spacing: 0.5px;
    grid-column: 1;
    position: sticky !important;
    left: 0 !important;
    z-index: 1000 !important;
}

:root.light-mode .matrix-row-header {
    color: #0ea5e9;
    text-shadow: none;
    background: #f8fafc !important;
    box-shadow: 0 3px 5px rgba(14, 165, 233, 0.2);
}

.matrix-bubble-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
}

.matrix-bubble {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
    border: 2px solid var(--bubble-color, #64748b);
    border-radius: 8px;
    padding: 0.35rem 0.4rem;
    width: 124px;
    height: auto;
    min-height: 65px;
    box-sizing: border-box;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
    box-shadow: 0 0 8px var(--bubble-glow, rgba(100, 116, 139, 0.25)), inset 0 0 5px var(--bubble-glow, rgba(100, 116, 139, 0.1));
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    position: relative;
    user-select: none;
}

:root.light-mode .matrix-bubble {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 3px 8px var(--bubble-glow, rgba(100, 116, 139, 0.2));
}

.matrix-bubble.bubble-pending {
    --bubble-color: #475569 !important;
    --bubble-glow: rgba(100, 116, 139, 0.05) !important;
    border: 2px dashed #475569 !important;
    background: rgba(30, 41, 59, 0.5) !important;
}

:root.light-mode .matrix-bubble.bubble-pending {
    --bubble-color: #cbd5e1 !important;
    --bubble-glow: rgba(148, 163, 184, 0.02) !important;
    border: 2px dashed #cbd5e1 !important;
    background: rgba(241, 245, 249, 0.8) !important;
}

.matrix-bubble:hover {
    transform: scale(1.04);
    filter: brightness(1.2);
    z-index: 10;
}

.matrix-bubble.drag-over {
    border-style: dashed;
    opacity: 0.8;
}

.matrix-bubble.dragging {
    opacity: 0.4;
    transform: scale(0.95);
}

.matrix-bubble-title {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--bubble-text-color, #fff);
    line-height: 1.2;
    word-break: break-word;
    text-shadow: 0 0 4px var(--bubble-glow, rgba(255,255,255,0.3));
    margin-bottom: 0.25rem;
}

:root.light-mode .matrix-bubble-title {
    color: #1e293b;
    text-shadow: none;
}

.matrix-bubble.bubble-pending .matrix-bubble-title {
    color: #64748b;
    text-shadow: none;
}

:root.light-mode .matrix-bubble.bubble-pending .matrix-bubble-title {
    color: #94a3b8;
}

/* Quick Action Buttons inside Bubble */
.matrix-bubble-actions {
    display: flex;
    gap: 0.25rem;
    width: 100%;
    margin-top: auto;
    justify-content: center;
    z-index: 5;
}

.btn-bubble-action {
    flex: 1;
    background: rgba(14, 165, 233, 0.15);
    border: 1px solid rgba(14, 165, 233, 0.4);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 600;
    padding: 0.15rem 0.25rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    user-select: none;
}

.btn-bubble-action:hover {
    background: rgba(14, 165, 233, 0.35);
    border-color: #0ea5e9;
}

.matrix-bubble.bubble-pending .btn-bubble-action {
    background: rgba(100, 116, 139, 0.15);
    border-color: rgba(100, 116, 139, 0.4);
}

.matrix-bubble.bubble-pending .btn-bubble-action:hover {
    background: rgba(100, 116, 139, 0.35);
    border-color: #64748b;
}

:root.light-mode .btn-bubble-action {
    color: #0f172a;
    background: rgba(14, 165, 233, 0.1);
    border-color: rgba(14, 165, 233, 0.25);
}

:root.light-mode .btn-bubble-action:hover {
    background: rgba(14, 165, 233, 0.2);
    border-color: #0ea5e9;
}

/* Blinking Indicator Dot for Pending Modifications */
.blink-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 7px;
    height: 7px;
    background-color: #ef4444;
    border-radius: 50%;
    box-shadow: 0 0 6px #ef4444;
    animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
    0% {
        transform: scale(0.85);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.25);
        opacity: 1;
    }
    100% {
        transform: scale(0.85);
        opacity: 0.5;
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .plan-matrix-container {
        padding: 0.5rem 0.25rem 0.5rem 0;
    }
    .plan-matrix {
        grid-template-columns: 65px repeat(12, 110px);
        gap: 0.4rem 0.5rem;
    }
    .matrix-bubble {
        width: 105px;
        min-height: 62px;
        padding: 0.35rem 0.3rem;
        border-radius: 8px;
    }
    .matrix-bubble-title {
        font-size: 0.68rem;
    }
    .matrix-row-header {
        font-size: 0.75rem;
        padding: 0.25rem 0.35rem;
        border-radius: 6px;
        border-width: 1.5px;
    }
    .btn-bubble-action {
        font-size: 0.55rem;
        padding: 0.1rem 0.2rem;
        border-radius: 3px;
    }
    .matrix-col-header {
        font-size: 0.65rem;
        letter-spacing: 0.4px;
    }
}

/* We don't need matrix-connectors anymore, SVG handles it */
.matrix-connector {
    display: none;
}

.plan-footer {
    background: var(--card-bg);
    padding: 1rem 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

/* Colors by subject for Plan Matrix */
.matrix-bubble.bubble-ari { border-color: #fca5a5; }
.matrix-bubble.bubble-alg { border-color: #93c5fd; }
.matrix-bubble.bubble-geo { border-color: #86efac; }
.matrix-bubble.bubble-est { border-color: #fcd34d; }
.matrix-bubble.bubble-tri { border-color: #c4b5fd; }
.matrix-bubble.bubble-cal { border-color: #fdba74; }

.matrix-bubble.bubble-pending {
    border-color: var(--border-color);
    opacity: 0.8;
}

/* Modals */
.plan-detail-modal {
    position: absolute;
    z-index: 6000;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    padding: 1rem;
    min-width: 250px;
    max-width: 300px;
}

/* Lateral Menu Drawer (Menú Principal) */
.drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 4000;
    transition: opacity 0.3s ease;
}

.drawer-backdrop.hidden {
    opacity: 0;
    pointer-events: none !important;
    display: none !important;
    visibility: hidden !important;
}

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 300px;
    background: var(--card-bg);
    border-left: 1px solid var(--border-color);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    z-index: 4001;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.drawer.hidden {
    transform: translateX(100%);
    display: none !important;
    pointer-events: none !important;
    box-shadow: none !important;
    visibility: hidden !important;
}

.drawer-item {
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.drawer-item:hover {
    background: rgba(14, 165, 233, 0.15) !important;
    border-color: #0ea5e9 !important;
}



/* ==========================================================================
   SOLUCIÓN DEFINITIVA Y UNIVERSAL PARA FÓRMULAS Y ECUACIONES MATHJAX EN MÓVILES
   ========================================================================== */

/* 1. Contenedores de MathJax: visualización en bloque desplegable con scroll táctil suave */
mjx-container[display="true"],
.mjx-container[display="true"],
.MathJax_Display {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-x pan-y !important;
    padding: 0.5rem 0.25rem !important;
    margin: 0.5rem 0 !important;
    box-sizing: border-box !important;
    text-align: center !important;
}

/* Contenedores generales e in-line de MathJax */
mjx-container,
.mjx-container,
.MathJax,
.MathJax_SVG {
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-x pan-y !important;
    box-sizing: border-box !important;
    vertical-align: middle !important;
}

p mjx-container,
li mjx-container,
td mjx-container {
    display: inline-block !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-x pan-y !important;
}

/* 2. SVG interno de MathJax: preserva el ancho real para evitar compresión y permitir desplazamiento */
mjx-container svg,
.mjx-container svg,
.MathJax svg {
    max-width: none !important;
    min-width: min-content !important;
    height: auto !important;
}

/* 3. Indicador y barra de desplazamiento horizontal distintiva para móviles y escritorio */
mjx-container::-webkit-scrollbar,
.mjx-container::-webkit-scrollbar,
.MathJax_Display::-webkit-scrollbar {
    height: 5px !important;
}

mjx-container::-webkit-scrollbar-track,
.mjx-container::-webkit-scrollbar-track,
.MathJax_Display::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.06) !important;
    border-radius: 3px !important;
}

mjx-container::-webkit-scrollbar-thumb,
.mjx-container::-webkit-scrollbar-thumb,
.MathJax_Display::-webkit-scrollbar-thumb {
    background: #0ea5e9 !important; /* Azul distintivo Mate+ */
    border-radius: 3px !important;
}

body.dark-mode mjx-container::-webkit-scrollbar-track,
body.dark-mode .mjx-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1) !important;
}

body.dark-mode mjx-container::-webkit-scrollbar-thumb,
body.dark-mode .mjx-container::-webkit-scrollbar-thumb {
    background: #38bdf8 !important;
}

/* =========================================================================
   ESTILOS DE AUTENTICACIÓN GOOGLE Y CONTROL DE ACCESO EXCLUSIVO (MATE+)
   ========================================================================= */
.auth-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    box-sizing: border-box;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.auth-overlay.auth-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.auth-card {
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(96, 165, 250, 0.3);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.7), 0 0 25px rgba(56, 189, 248, 0.15);
    border-radius: 20px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 440px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: authCardFadeIn 0.35s ease-out;
}

@keyframes authCardFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-logo-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #38bdf8;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0.4rem 1rem;
    border-radius: 9999px;
    margin-bottom: 1.25rem;
    letter-spacing: 0.5px;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    font-size: 0.9rem;
    color: #94a3b8;
    line-height: 1.5;
    margin-bottom: 1.75rem;
}

.btn-google-auth {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: #ffffff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 0.85rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0 0 1.5rem 0;
}

.btn-google-auth:hover {
    background: #f8fafc;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.btn-google-auth:active {
    transform: translateY(0);
}

.auth-whitelist-box {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    text-align: left;
}

.auth-whitelist-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #cbd5e1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-email-tag {
    font-family: monospace;
    font-size: 0.8rem;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.08);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
    word-break: break-all;
}

.auth-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(56, 189, 248, 0.2);
    border-top-color: #38bdf8;
    border-radius: 50%;
    animation: authSpin 0.9s linear infinite;
}

@keyframes authSpin {
    to { transform: rotate(360deg); }
}

.auth-card-denied {
    border-color: rgba(239, 68, 68, 0.4);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.7), 0 0 20px rgba(239, 68, 68, 0.15);
}

.auth-denied-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    animation: authShake 0.5s ease;
}

@keyframes authShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.btn-auth-denied-logout {
    width: 100%;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 0.85rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    margin: 0;
}

.btn-auth-denied-logout:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* ==========================================================================
   ESTILOS DEL MODO ESTUDIANTE Y PUBLICACIÓN DE CLASES
   ========================================================================== */

.btn-student-auth {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, #0284c7, #0ea5e9);
    color: #ffffff;
    border: 1px solid #38bdf8;
    border-radius: 12px;
    padding: 0.85rem 1.25rem;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-student-auth:hover {
    background: linear-gradient(135deg, #0369a1, #0284c7);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.5);
}

.btn-student-auth:active {
    transform: translateY(0);
}

/* Botón Ojo Minimalista Integrado a la Tarjeta */
.btn-toggle-eye {
    background: transparent;
    border: none;
    outline: none;
    padding: 0.35rem;
    margin: 0;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    transition: color 0.2s, transform 0.2s, background-color 0.2s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.btn-toggle-eye svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
    display: block;
}

/* Modo Noche: Blancuzco discreto cuando está inactivo, blancuzco nítido cuando está activo */
:root:not(.light-mode) .btn-toggle-eye {
    color: rgba(226, 232, 240, 0.45);
}
:root:not(.light-mode) .btn-toggle-eye:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.1);
}
:root:not(.light-mode) .btn-toggle-eye.active {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.12);
}

/* Modo Día: Azuloso discreto y minimalista */
:root.light-mode .btn-toggle-eye {
    color: rgba(37, 99, 235, 0.45);
}
:root.light-mode .btn-toggle-eye:hover {
    color: #1d4ed8;
    background: rgba(37, 99, 235, 0.08);
    transform: scale(1.1);
}
:root.light-mode .btn-toggle-eye.active {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.12);
}

/* Botones Flotantes Superiores en Modo Estudiante */
.student-floating-controls {
    position: fixed;
    top: 8px;
    right: 12px;
    left: auto;
    z-index: 2000;
    display: flex;
    gap: 8px;
    align-items: center;
}

.student-btn-round {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--card-bg);
    color: var(--text-color);
    border: 1.5px solid var(--border-color);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.student-btn-round:hover {
    transform: scale(1.08);
    background: var(--summary-bg);
    border-color: var(--primary-color);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}

.student-btn-round:active {
    transform: scale(0.95);
}

.student-btn-exit {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

.student-btn-exit:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
}

/* Feed de Clases por Grados (Modo Estudiante) */
.student-feed {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 0.5rem 0.25rem;
}

.student-grade-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.student-grade-header {
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.15), rgba(14, 165, 233, 0.05));
    border-bottom: 1px solid var(--border-color);
    padding: 0.65rem 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.student-grade-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--h2-color);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.student-grade-badge {
    background: var(--primary-color);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
}

.student-classes-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.65rem;
}

.student-class-card {
    background: var(--summary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 0.85rem;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.student-class-card:hover {
    transform: translateY(-2px);
    border-color: var(--h2-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.student-class-card.active {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.08);
}

.student-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.student-asig-tag {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    background: rgba(56, 189, 248, 0.15);
    color: #0284c7;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.student-card-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-color);
    line-height: 1.35;
}

.student-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.2rem;
}

.student-empty-grade {
    padding: 0.85rem;
    text-align: center;
    color: #94a3b8;
    font-size: 0.82rem;
    font-style: italic;
}

/* =========================================================================
   REGLAS EXCLUSIVAS DE MODO ESTUDIANTE (Protección, No-Colapso, Impresión)
   ========================================================================= */

/* 1. Protección anticopia: no permitir selección de texto ni arrastrar imágenes */
body.modo-estudiante,
body.modo-estudiante * {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
}

body.modo-estudiante img {
    pointer-events: none !important;
    -webkit-user-drag: none !important;
    user-drag: none !important;
}

/* 2. Bloquear colapso de secciones: todas las secciones mostradas en la vista estudiante están bloqueadas y no se pueden ocultar */
body.modo-estudiante details {
    display: block !important;
}

body.modo-estudiante details summary {
    pointer-events: none !important;
    cursor: default !important;
}

body.modo-estudiante details summary::before {
    display: none !important;
}

body.modo-estudiante details summary::-webkit-details-marker {
    display: none !important;
}

/* 3. Ocultar elementos docentes, línea de navegación y botones de control en Modo Estudiante */
body.modo-estudiante .app-header #btn-menu-lateral,
body.modo-estudiante .app-header #btn-header-notif,
body.modo-estudiante .app-header #header-user-badge,
body.modo-estudiante #timeline-filters,
body.modo-estudiante .visor-controls,
body.modo-estudiante .seccion-observaciones,
body.modo-estudiante .img-copy-controls,
body.modo-estudiante .btn-copy-clase-obs,
body.modo-estudiante #right-scroll-tracker,
body.modo-estudiante #section-tracker-indicator,
body.modo-estudiante #btn-scroll-top,
body.modo-estudiante #btn-volver,
body.modo-estudiante .scroll-tracker,
body.modo-estudiante .tracker-line,
body.modo-estudiante .tracker-bullet,
body.modo-estudiante .floating-control {
    display: none !important;
}

body.modo-estudiante #student-floating-controls {
    display: flex !important;
}

/* 4. Botones incrustados de impresión para Estudiantes */
.student-print-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-bottom: 1.25rem;
    margin-right: 7.5rem; /* Margen de seguridad para no solapar los botones flotantes de la esquina superior derecha */
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .student-print-actions {
        display: flex !important;
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-right: 0 !important;
        margin-top: 0.25rem;
        margin-bottom: 1.25rem;
        width: 100%;
        justify-content: stretch;
    }

    .student-print-actions .btn-student-print {
        flex: 1 1 calc(50% - 0.3rem);
        min-width: 120px;
        font-size: 0.76rem;
        padding: 0.5rem 0.35rem;
        justify-content: center;
        text-align: center;
        box-sizing: border-box;
    }
}

.btn-student-print {
    background: var(--summary-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.55rem 1.1rem;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.btn-student-print:hover {
    background: var(--btn-hover);
    border-color: var(--h2-color);
    color: var(--h2-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.btn-student-print-taller {
    border-color: rgba(16, 185, 129, 0.4);
    color: #10b981;
}

.btn-student-print-taller:hover {
    background: rgba(16, 185, 129, 0.12);
    border-color: #10b981;
    color: #10b981;
}

.btn-student-print-whatsapp {
    border-color: rgba(37, 211, 102, 0.4);
    color: #16a34a;
}

.btn-student-print-whatsapp:hover {
    background: rgba(37, 211, 102, 0.12);
    border-color: #25D366;
    color: #15803d;
}

.btn-student-print-whatsapp-taller {
    border-color: rgba(18, 140, 126, 0.4);
    color: #0f766e;
}

.btn-student-print-whatsapp-taller:hover {
    background: rgba(18, 140, 126, 0.12);
    border-color: #128C7E;
    color: #115e59;
}


.btn-action-whatsapp {
    background: #25D366 !important;
    color: white !important;
    border: none !important;
    font-weight: 700 !important;
    border-radius: 6px;
    transition: all 0.2s ease;
}
.btn-action-whatsapp:hover {
    background: #1ebc57 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 211, 102, 0.3);
}
.btn-action-whatsapp-taller {
    background: #128C7E !important;
    color: white !important;
    border: none !important;
    font-weight: 700 !important;
    border-radius: 6px;
    transition: all 0.2s ease;
}
.btn-action-whatsapp-taller:hover {
    background: #0e6b60 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(18, 140, 126, 0.3);
}
.btn-action-email {
    background: #0284c7 !important;
    color: white !important;
    border: none !important;
    font-weight: 700 !important;
    border-radius: 6px;
    transition: all 0.2s ease;
}
.btn-action-email:hover {
    background: #0369a1 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(2, 132, 199, 0.3);
}
.btn-action-email-taller {
    background: #dc2626 !important;
    color: white !important;
    border: none !important;
    font-weight: 700 !important;
    border-radius: 6px;
    transition: all 0.2s ease;
}
.btn-action-email-taller:hover {
    background: #b91c1c !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 38, 38, 0.3);
}
.btn-student-print-email {
    border-color: rgba(2, 132, 199, 0.4);
    color: #0284c7;
}
.btn-student-print-email:hover {
    background: rgba(2, 132, 199, 0.12);
    border-color: #0284c7;
    color: #0369a1;
}
.btn-student-print-email-taller {
    border-color: rgba(220, 38, 38, 0.4);
    color: #dc2626;
}
.btn-student-print-email-taller:hover {
    background: rgba(220, 38, 38, 0.12);
    border-color: #dc2626;
    color: #b91c1c;
}


/* ==========================================================================
   VISIBILIDAD DISPOSITIVOS: BOTONES COMPARTIR (MÓVIL) VS IMPRIMIR (ESCRITORIO)
   ========================================================================== */

/* En Escritorio (ancho > 768px):
   - Ocultar botones de compartir (solo móvil)
   - Mostrar botones de impresión en vista estudiante
*/
@media (min-width: 769px) {
    #btn-whatsapp-clase,
    #btn-whatsapp-taller,
    .btn-action-whatsapp,
    .btn-action-whatsapp-taller,
    .btn-student-print-whatsapp,
    .btn-student-print-whatsapp-taller {
        display: none !important;
    }

    #btn-print-student-clase,
    #btn-print-student-taller {
        display: inline-flex !important;
    }
}

/* En Móvil (ancho <= 768px):
   - Mostrar botones de compartir
   - Ocultar botones de imprimir en vista estudiante
*/
@media (max-width: 768px) {
    #btn-whatsapp-clase,
    #btn-whatsapp-taller,
    .btn-action-whatsapp,
    .btn-action-whatsapp-taller,
    .btn-student-print-whatsapp,
    .btn-student-print-whatsapp-taller {
        display: inline-flex !important;
    }

    #btn-print-student-clase,
    #btn-print-student-taller {
        display: none !important;
    }
}


/* ==========================================================================
   BOTONES WHATSAPP Y CONTROLES A LA MISMA ALTURA (38px) Y POSICIÓN INICIAL
   ========================================================================== */
.student-floating-controls {
    position: fixed;
    top: 8px;
    right: 12px;
    left: auto;
    z-index: 2000;
    display: flex;
    gap: 8px;
    align-items: center;
    height: 38px;
}

.student-print-actions,
.print-actions {
    display: flex !important;
    gap: 0.5rem !important;
    justify-content: flex-start !important;
    align-items: center !important;
    margin-top: 0 !important; /* Misma posición inicial superior */
    margin-bottom: 1rem !important;
    flex-wrap: nowrap !important;
    width: auto !important;
    height: 38px !important;
}

.btn-whatsapp-student,
#btn-whatsapp-clase,
#btn-whatsapp-taller,
#btn-whatsapp-student-clase,
#btn-whatsapp-student-taller {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%) !important;
    color: #ffffff !important;
    border: 1.5px solid rgba(255, 255, 255, 0.4) !important;
    border-radius: 19px !important;
    height: 38px !important; /* Altura exacta igual a los botones circulares / botón de salir */
    padding: 0 0.95rem !important;
    font-size: 0.86rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.04em !important;
    line-height: 1 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.45rem !important;
    box-shadow: 0 3px 8px rgba(18, 140, 126, 0.35) !important;
    box-sizing: border-box !important;
    width: auto !important;
    max-width: fit-content !important;
    flex: 0 0 auto !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

.btn-whatsapp-student:hover,
#btn-whatsapp-clase:hover,
#btn-whatsapp-taller:hover,
#btn-whatsapp-student-clase:hover,
#btn-whatsapp-student-taller:hover {
    background: linear-gradient(135deg, #2cf075 0%, #15a191 100%) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 5px 12px rgba(18, 140, 126, 0.45) !important;
}

.btn-whatsapp-student:active,
#btn-whatsapp-clase:active,
#btn-whatsapp-taller:active,
#btn-whatsapp-student-clase:active,
#btn-whatsapp-student-taller:active {
    transform: scale(0.96) !important;
    box-shadow: 0 1px 4px rgba(18, 140, 126, 0.2) !important;
}

.btn-whatsapp-student svg,
#btn-whatsapp-clase svg,
#btn-whatsapp-taller svg,
#btn-whatsapp-student-clase svg,
#btn-whatsapp-student-taller svg {
    flex-shrink: 0 !important;
    width: 16px !important;
    height: 16px !important;
    fill: #ffffff !important;
}

@media (max-width: 768px) {
    .student-floating-controls {
        top: 8px !important;
        right: 10px !important;
        left: auto !important;
    }

    .student-print-actions,
    .print-actions {
        justify-content: flex-start !important;
        width: auto !important;
        gap: 0.45rem !important;
        margin-top: 0 !important;
        margin-bottom: 0.85rem !important;
        height: 38px !important;
    }

    .print-actions button#btn-whatsapp-clase,
    .print-actions button#btn-whatsapp-taller,
    .btn-whatsapp-student {
        flex: 0 0 auto !important;
        width: auto !important;
        height: 38px !important;
        padding: 0 0.85rem !important;
        font-size: 0.82rem !important;
        gap: 0.4rem !important;
    }
}