/* Reset et styles de base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* En-tête fixe */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 1000;
    padding: 1rem 0;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: #667eea;
    cursor: pointer;
    transition: color 0.3s ease;
}

.logo:hover {
    color: #764ba2;
}

.nav {
    display: flex;
    gap: 1rem;
}

.nav-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: #764ba2;
    transform: translateY(-2px);
}



/* Page d'authentification */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 160px); /* Compenser le padding-top de .page */
    padding: 2rem;
}

.auth-card {
    background: white;
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    backdrop-filter: blur(10px);
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #333;
    font-size: 1.8rem;
}

/* Formulaires */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

/* Boutons */
.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #28a745;
    color: white;
}

.btn-secondary:hover {
    background: #218838;
    transform: translateY(-2px);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
}

/* Switch d'authentification */
.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    color: #666;
}

.auth-switch a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.forgot-password {
    text-align: center;
    margin: 1rem 0;
}

.forgot-password a {
    color: #007bff;
    text-decoration: none;
    font-size: 0.9rem;
}

.forgot-password a:hover {
    text-decoration: underline;
}

.reset-info {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #666;
    text-align: center;
}

/* Page d'accueil */
.home-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    /* Le padding-top est maintenant géré par .page */
}

.home-container h2 {
    text-align: center;
    color: white;
    margin-bottom: 3rem;
    font-size: 2.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.action-buttons .btn {
    width: auto;
    min-width: 200px;
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* Section Mes classes */
.my-classes {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.my-classes h3 {
    margin-bottom: 1.5rem;
    color: #333;
    font-size: 1.5rem;
}

.classes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Style de la scrollbar pour .classes-list */
.classes-list::-webkit-scrollbar {
    width: 8px;
}

.classes-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.classes-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.classes-list::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

.class-card {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 15px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.class-card:hover {
    border-color: #667eea;
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.class-card h4 {
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.class-card p {
    color: #666;
    margin-bottom: 1rem;
}

.class-card .class-code {
    background: #667eea;
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
    display: inline-block;
    margin-bottom: 1rem;
}

.class-actions {
    display: flex;
    gap: 0.5rem;
}

.class-actions .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    width: auto;
}

/* Page profil */
.profile-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 160px); /* Compenser le padding-top de .page */
    padding: 2rem;
}

.profile-card {
    background: white;
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 500px;
}

.profile-card h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #333;
    font-size: 1.8rem;
}

.profile-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.profile-actions .btn {
    flex: 1;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
}

.close:hover {
    color: #333;
}

.modal-content h3 {
    margin-bottom: 1.5rem;
    color: #333;
    text-align: center;
}

/* Messages */
.message {
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    text-align: center;
    font-weight: 600;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        padding: 0 1rem;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    .nav-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .home-container h2 {
        font-size: 2rem;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .action-buttons .btn {
        width: 100%;
        max-width: 300px;
    }
    
    .classes-list {
        grid-template-columns: 1fr;
    }
    
    .profile-actions {
        flex-direction: column;
    }
    
    .auth-card,
    .profile-card {
        padding: 1.5rem;
        margin: 1rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page.active {
    animation: fadeIn 0.5s ease;
}

.class-card {
    animation: fadeIn 0.3s ease;
}

/* Page du tableau blanc */
.whiteboard-container {
    height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    /* Permettre le scroll normal */
}  



/* Barre d'outils */
.toolbar {
    background: white;
    border-bottom: 2px solid #e9ecef;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.toolbar-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tool-btn {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-btn:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.tool-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.tool-btn:disabled {
    background: #f8f9fa;
    border-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed !important;
    opacity: 0.5;
}

.toolbar-section label {
    font-weight: 600;
    color: #555;
    margin-right: 0.5rem;
}

.toolbar-section input[type="color"] {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.toolbar-section input[type="range"] {
    width: 100px;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    width: auto;
}

/* Zone principale du tableau */
.main-whiteboard-area{
    display:flex;
    gap:1rem;
    padding:1rem;
    min-height:0;         /* indispensable en flex pour laisser scroller les enfants */
    overflow:hidden;      /* évite le scroll sur toute la rangée */
}
  
  

  

/* Zone principale (70%) */
.primary-canvas-area{
    flex:0 0 70%;
    display:flex;
    flex-direction:column;
    min-height:0;
    overflow:hidden;      /* on scrolle à l'intérieur de .canvas-wrap */
    background:#fff;
    border-radius:10px;
    box-shadow:0 4px 8px rgba(0,0,0,.1);
}

.canvas-header {
    background: #f8f9fa;
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.canvas-header h3 {
    margin: 0;
    color: #333;
}

.canvas-switch {
    display: flex;
    gap: 0.5rem;
}

#mainCanvas {
    flex: 1;
    background: white;
    cursor: crosshair;
    border: none;
    display: block;
}

/* Zone secondaire (30%) */
.secondary-area{
    flex:0 0 30%;
    display:flex;
    flex-direction:column;
    min-height:0;
    background:#fff;
    border-radius:10px;
    box-shadow:0 4px 8px rgba(0,0,0,.1);
}

.secondary-header {
    background: #f8f9fa;
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.secondary-header h4 {
    margin: 0;
    color: #333;
    font-size: 1.1rem;
}

.secondary-content {
    flex: 1;
    overflow: auto;
}

/* Miniatures élèves */
.student-thumbnail {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 0.8rem;
    margin-bottom: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.student-thumbnail:hover {
    border-color: #667eea;
    background: #f0f2ff;
}

.student-thumbnail.active {
    border-color: #667eea;
    background: #e6f0ff;
}

.student-thumbnail h5 {
    margin: 0 0 0.5rem 0;
    color: #333;
    font-size: 0.9rem;
}

.student-thumbnail canvas {
    width: 100%;
    height: auto; /* Permet de conserver le ratio naturel */
    aspect-ratio: 1/1; /* Force le ratio carré */
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

/* Tableau prof en lecture seule */
.teacher-board-preview {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.teacher-board-preview canvas {
    width: 100%;
    height: auto; /* Permet de conserver le ratio naturel */
    aspect-ratio: 1/1; /* Force le ratio carré */
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: not-allowed;
}

.teacher-board-preview p {
    margin: 0.5rem 0 0 0;
    color: #666;
    font-size: 0.9rem;
}

/* Modal ressources */
.resources-content {
    max-height: 400px;
    overflow-y: auto;
}

.upload-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.upload-section h4 {
    margin-bottom: 1rem;
    color: #333;
}

.resources-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
}

.resource-item {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.resource-item:hover {
    border-color: #667eea;
    background: #f0f2ff;
}

.resource-item img {
    width: 100%;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.resource-item p {
    margin: 0;
    font-size: 0.8rem;
    color: #666;
    word-break: break-all;
}

/* Objets flottants */
.floating-object {
    position: absolute;
    cursor: move;
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
    /* Ajouter du padding pour que les points de redimensionnement ne soient pas coupés */
    padding: 15px;
    margin: -15px; /* Compenser le padding pour ne pas affecter la position */
    /* S'assurer que les points ne sont pas coupés */
    overflow: visible;
}

.floating-object:hover {
    border-color: #667eea;
}

.floating-object.selected {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
}

.floating-text {
    background: rgba(255, 255, 255, 0.9);
    padding: 0.5rem;
    border-radius: 4px;
    min-width: 50px;
    min-height: 20px;
    resize: both;
    overflow: hidden;
}

.floating-image {
    max-width: 200px;
    max-height: 200px;
    object-fit: contain;
}

.resize-handle {
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 10px;
    height: 10px;
    background: #667eea;
    border-radius: 50%;
    cursor: se-resize;
}

.floating-object { user-select: none; }

/* Éditeur de texte */
.text-editor-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.text-editor-content {
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.text-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.text-editor-header h3 {
    margin: 0;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #333;
}

.text-editor-tabs {
    display: flex;
    border-bottom: 1px solid #e9ecef;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: #f8f9fa;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn.active {
    background: white;
    border-bottom-color: #007bff;
    color: #007bff;
}

.tab-btn:hover {
    background: #e9ecef;
}

.text-editor-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tab-content {
    display: none;
    flex: 1;
    overflow: hidden;
    flex-direction: column;
}

.tab-content.active {
    display: flex;
}

#textInput, #mathInput {
    flex: 1;
    border: none;
    padding: 1rem;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    resize: none;
    outline: none;
    min-height: 200px;
}

.math-symbols {
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    max-height: 300px;
    overflow-y: auto;
}

.symbol-group {
    margin-bottom: 1rem;
}

.symbol-group h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    color: #666;
    font-weight: 600;
}

.symbol-group button {
    margin: 2px;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.symbol-group button:hover {
    background: #f8f9fa;
    border-color: #007bff;
}

.text-editor-footer {
    padding: 1rem;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.text-options {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.text-options label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #666;
}

.text-options input[type="range"] {
    width: 80px;
}

.text-options input[type="color"] {
    width: 40px;
    height: 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.text-actions {
    display: flex;
    gap: 0.5rem;
}

.text-actions button {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.text-actions button:hover {
    background: #f8f9fa;
}

.text-actions button.primary {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.text-actions button.primary:hover {
    background: #0056b3;
}

/* Éditeur de formules mathématiques */
.formula-editor-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1001;
}

.formula-editor-content {
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    padding: 2rem;
    min-width: 400px;
}

.formula-editor h3 {
    margin: 0 0 1.5rem 0;
    color: #333;
    text-align: center;
}

.fraction-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.fraction-line {
    width: 100px;
    height: 2px;
    background: #333;
    margin: 0.5rem 0;
}

.exponent-container, .subscript-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sqrt-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sqrt-container span {
    font-size: 1.5rem;
    font-weight: bold;
}

.integral-container, .sum-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.integral-limits, .sum-limits {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.integral-container span, .sum-container span {
    font-size: 2rem;
    font-weight: bold;
}

.limit-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.limit-variable {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.formula-editor input {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    min-width: 60px;
}

.formula-editor input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.formula-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.formula-actions button {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.formula-actions button:hover {
    background: #f8f9fa;
}

.formula-actions button.primary {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.formula-actions button.primary:hover {
    background: #0056b3;
}


.canvas-wrap{
    position:relative;
    flex:1;
    min-height:0;         /* autorise le scroll interne en contexte flex */
    background:#fff;
    min-height: calc(100vh - 200px); /* Hauteur minimale pour combler l'espace */
    overflow-y:auto;      /* le scroll se fait ici, pas sur la page */
    border:1px solid #ddd;
    /* Ajouter du padding pour que les points de redimensionnement ne soient pas coupés */
    padding: 20px;
    box-sizing: border-box;
}

  
.canvas-stage{
    position:relative;
    width:100%;
}
  
#mainCanvas{
    display:block;
    width:100%;
    height:auto !important;  /* respecte la hauteur logique (canvas.height) */
    background:#fff;
    border:none;
    cursor:crosshair;
}
  
#overlay{
    position:absolute;
    inset:0;               /* colle aux bords de .canvas-stage */
    pointer-events:none;
    z-index:1;
    /* S'assurer que les points de redimensionnement ne sont pas coupés */
    overflow: visible;
}

  

  

/* Responsive pour le tableau blanc */
@media (max-width: 1024px) {
    .main-whiteboard-area {
        flex-direction: column;
    }
    
    .primary-canvas-area {
        flex: 0 0 60%;
    }
    
    .secondary-area {
        flex: 0 0 40%;
    }
}

@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .toolbar-section {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .main-whiteboard-area {
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .canvas-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .canvas-switch {
        justify-content: center;
    }
}

/* Permet au composant de gérer les gestes multi-touch (pinch) sans scroll/zoom navigateur */
.floating-object {
    touch-action: none;
}
  
/* Gestes tactiles gérés par nos listeners (évite le zoom/scroll natif) */
.floating-object { touch-action: none; }

/* Système de redimensionnement propre */
.resize-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #667eea;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.25);
    display: none;
    z-index: 10001;
    pointer-events: auto;
}

/* Afficher les points en mode sélection */
.select-mode .resize-handle { 
    display: block; 
}

/* Curseurs */
.resize-handle.rh-nw { cursor: nwse-resize; }
.resize-handle.rh-n  { cursor: ns-resize; }
.resize-handle.rh-ne { cursor: nesw-resize; }
.resize-handle.rh-e  { cursor: ew-resize; }
.resize-handle.rh-se { cursor: nwse-resize; }
.resize-handle.rh-s  { cursor: ns-resize; }
.resize-handle.rh-sw { cursor: nesw-resize; }
.resize-handle.rh-w  { cursor: ew-resize; }



  html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    /* Permettre le scroll normal */
  }

/* Gestion de l'affichage des pages */
.page {
    display: none;
    min-height: calc(100vh - 80px); /* Compenser la hauteur du header */
    padding-top: 80px; /* Éviter que le contenu soit caché sous le header */
}

.page.active {
    display: block;
}

/* Styles pour l'éditeur de texte mixte */
.mixed-text-help {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.mixed-text-help p {
    margin-bottom: 0.5rem;
}

.mixed-text-help code {
    background: #e9ecef;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.mixed-text-help strong {
    color: #495057;
}

/* Amélioration des symboles mathématiques */
.symbol-group {
    margin-bottom: 1rem;
}

.symbol-group h4 {
    font-size: 0.9rem;
    color: #495057;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 0.25rem;
}

.symbol-group button {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    margin: 0.125rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.symbol-group button:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

/* Styles pour le rendu LaTeX dans les objets flottants */
.floating-object .MathJax {
    font-size: inherit !important;
}

.floating-object mjx-container {
    font-size: inherit !important;
}

/* Supprimer l'overlay de fond */
.formula-editor-modal:not(.formula-editor-sidebar) {
    display: none !important;
}

/* Éditeur de formules en sidebar */
.formula-editor-sidebar {
    position: fixed !important;
    left: calc(50% + 250px) !important; /* Plus à droite pour éviter de bloquer les boutons */
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: auto !important;
    min-width: 300px !important;
    max-width: 400px !important;
    z-index: 10001 !important;
    background: white !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
    border: 2px solid #667eea !important;
    pointer-events: auto !important; /* S'assurer que les clics passent */
}

.formula-editor-sidebar .formula-editor-content {
    padding: 1.5rem !important;
}

.formula-editor-sidebar .formula-actions {
    margin-top: 1rem !important;
    display: flex !important;
    gap: 0.5rem !important;
    justify-content: flex-end !important;
}

.formula-editor-sidebar .formula-actions button {
    padding: 0.5rem 1rem !important;
    border: none !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 0.9rem !important;
}

.formula-editor-sidebar .formula-actions button:not(.primary) {
    background: #f8f9fa !important;
    color: #495057 !important;
    border: 1px solid #dee2e6 !important;
}

.formula-editor-sidebar .formula-actions button.primary {
    background: #667eea !important;
    color: white !important;
}

.formula-editor-sidebar .formula-actions button:hover {
    opacity: 0.8 !important;
}

/* Styles pour les champs de l'éditeur de formules */
.formula-editor-sidebar input[type="text"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.formula-editor-sidebar input[type="text"]:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}


/* Amélioration de la textarea */
#mixedInput {
    font-family: 'Courier New', monospace !important;
    line-height: 1.5 !important;
    padding: 1rem !important;
    border: 2px solid #e9ecef !important;
    border-radius: 8px !important;
    font-size: 14px !important;
}

#mixedInput:focus {
    border-color: #667eea !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
}

/* Responsive pour l'éditeur de texte */
@media (max-width: 768px) {
    .text-editor-modal {
        width: 95% !important;
        max-width: none !important;
    }
    
    .text-editor-tabs {
        flex-wrap: wrap;
    }
    
    .text-editor-tabs .tab-btn {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }
    
    .formula-editor-sidebar {
        left: 10px !important;
        width: calc(100vw - 20px) !important;
        max-width: none !important;
    }
}

/* Styles améliorés pour les ressources */
.upload-info {
    font-size: 12px;
    color: #666;
    margin-top: 8px;
}

.resource-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    transition: all 0.3s ease;
    min-width: 300px;
    width: 100%;
}

.resource-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.resource-item img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
}

.file-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    border-radius: 4px;
    font-size: 24px;
}

.resource-info {
    flex: 1;
}

.resource-name {
    margin: 0 0 5px 0;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.resource-details {
    margin: 0;
    font-size: 12px;
    color: #666;
}

.resource-actions {
    display: flex;
    gap: 8px;
}

.resource-actions button {
    padding: 6px 12px;
    border: 1px solid #667eea;
    background: #667eea;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.resource-actions button:hover {
    background: #5a6fd8;
}

.no-resources {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 40px;
}

/* Gestion des participants */
.participants-list {
    max-height: 400px;
    overflow-y: auto;
}

.participant-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.participant-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.participant-info {
    flex: 1;
}

.participant-name {
    font-weight: 500;
    color: #333;
    margin: 0 0 5px 0;
}

.participant-email {
    font-size: 12px;
    color: #666;
    margin: 0;
}

.participant-role {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    background: #e9ecef;
    color: #495057;
    margin-left: 10px;
}

.participant-role.teacher {
    background: #d4edda;
    color: #155724;
}

.participant-role.student {
    background: #cce5ff;
    color: #004085;
}

.participant-actions {
    display: flex;
    gap: 10px;
}

.participant-actions button {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.btn-ban {
    background: #dc3545;
    color: white;
}

.btn-ban:hover {
    background: #c82333;
}

.btn-unban {
    background: #28a745;
    color: white;
}

.btn-unban:hover {
    background: #218838;
}
  
  