/* =================================================== 
   🌐 STYLE GLOBAL – Appliqué à toutes les pages
   =================================================== */
   body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: #f0f0f0;
}

/* =============================
   🔧 HEADER RESTRUCTURÉ UNIQUE
   ============================= */
header {
    background: linear-gradient(to right, #0d47a1, #42a5f5);
    color: white;
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 10px 20px;
}

.header-inner {
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Menu centré */
.main-nav {
    display: flex;
    gap: 25px;
    justify-content: center;
    flex-grow: 1;
}

.main-nav a {
    color: white;
    text-decoration: none;
    font-weight: bold;
}

/* Logout à droite */
.logout {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-shrink: 0;
}

.logout a {
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 5px;
    text-decoration: none;
    color: white;
    font-weight: bold;
}

.logout-link {
    background: rgba(255,255,255,0.2);
    padding: 6px 12px;
    border-radius: 5px;
    font-weight: bold;
    color: white;
}

.notification-icon {
    font-size: 22px;
    color: red;
    text-decoration: none;
}

/* Clignotement icône */
.clignote {
    animation: clignoter 1s infinite;
}
@keyframes clignoter {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}
/* ===================================================
   🟪 FORMULAIRE DE CONNEXION (login.php)
   =================================================== */
   .login-box {
    background: white;
    padding: 30px;
    max-width: 400px;
    margin: 80px auto;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.login-box input[type="text"],
.login-box input[type="password"] {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    box-sizing: border-box;
}

.login-box button {
    width: 100%;
    padding: 10px;
    background: #673ab7;
    color: white;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
}

.error {
    color: red;
    font-weight: bold;
    margin-bottom: 10px;
}

.register-link {
    margin-top: 15px;
    text-align: center;
}

.register-link a {
    text-decoration: none;
    color: #673ab7;
    font-weight: bold;
}

/* ===================================================
   🟣 PAGE D’ACCUEIL (accueil.php)
   =================================================== */
.hero {
    background: linear-gradient(to bottom, #0d47a1, #42a5f5);
    color: white;
    text-align: center;
    padding: 30px 20px 30px;
    position: relative;
}

.hero h1 {
    font-size: 40px;
    margin: 0;
    font-family: 'Comic Sans MS', cursive;
}

.hero p {
    font-size: 24px;
    margin-top: 10px;
}

/* Zone centrale */
main {
    padding: 50px;
    text-align: center;
}

/* Menu de navigation */
nav {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

nav a {
    color: white;
    text-decoration: none;
    font-weight: bold;
}

/* 🔽 SOUS-MENU (Dropdown) */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #1976d2;
    min-width: 250px;
    z-index: 1000;
    border-radius: 5px;
    white-space: normal;
    word-wrap: break-word;
}

.dropdown-content a {
    color: white;
    padding: 10px 15px;
    display: block;
    text-align: left;
    text-decoration: none;
}

.dropdown-content a:hover {
    background-color: #0d47a1;
}

.dropdown:hover .dropdown-content {
    display: block;
}
/* 📦 Container principal partagé en deux colonnes */
.chapitre-container {
    display: flex;
    /*gap: 20px;*/
    /*padding: 20px;*/
    margin-top: 0 !important;
    padding-top: 0;  
    position: relative; /* 🔥 Pour le resizer */
}

/* 📘 Liste des leçons */
.lecon-sidebar {
    flex: 1 1 250px; /* width: 30%;🔥 Remplace width par flex */
    min-width: 150px;  /* Limite minimum */
    max-width: 500px;  /* Limite maximum */
    background: #ffffff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 5px rgba(0,0,0,0.1);
}

.lecon-sidebar ul {
    list-style: none;
    padding: 0;
}

.lecon-sidebar li {
    margin-bottom: 10px;
}

.lecon-sidebar a {
    text-decoration: none;
    color: #0d47a1;
    font-weight: bold;
}

/* 📘 Leçon sélectionnée en surbrillance */
.lecon-sidebar ul li a.selected,
#liste-ressources-chapitre a.selected {
    background-color: #d0e0ff;
    border-radius: 4px;
    padding: 6px 10px;
    display: block;
}

/* 📄 Contenu principal avec onglets */
.lecon-content {
    flex: 3 1 0;  /*width: 70%; 🔥 Remplace width par flex */ 
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 5px rgba(0,0,0,0.1);
    overflow: auto;
}

.resizer {
    width: 3px;
    background: #bbb;
    cursor: col-resize;
    margin: 0 3px; /* 🔥 Ajoute ça pour réduire l'espace autour du resizer */
}

/* 🧭 Onglets */
.tabs {
    margin-bottom: 20px;
}

.tabs button {
    padding: 10px 15px;
    margin-right: 10px;
    border: none;
    background: #0d47a1;
    color: white;
    border-radius: 4px;
    cursor: pointer;
}

.tabs button:hover {
    background: #1976d2;
}

/* 🎨 Onglet actif */
.tabs button.active {
    background-color: #0a53be;
    color: white;
}

/* 🟥 Onglet Entraînement rouge */
.tabs button.btn-entrainement {
    background: #d32f2f;
    color: white;
    font-weight: bold;
}

.tabs button.btn-entrainement:hover {
    background: #b71c1c;
}

/* 🔴 Liste des exercices d’entraînement */
#liste-entrainements a {
    color: #0d47a1;
    font-weight: bold;
    display: block;
    margin-bottom: 8px;
}

.lecon-sidebar h3 {
    margin-top: 20px;
}

.lecon-sidebar h3:nth-of-type(3) {
    color: red; /* Titre "Entraînement" */
}
/* ================================
   🎯 Zone de mot de passe avec œil
   ================================ */
   .password-field {
    position: relative;
}

.password-field input {
    width: 100%;
    padding-right: 40px;
}

.password-field img {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.password-field img:hover {
    opacity: 1;
}

/* ===================================================
   📩 FORMULAIRE DE CONTACT (contact.php)
   =================================================== */
.contact-container {
    max-width: 700px;
    margin: 50px auto;
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.contact-container h2 {
    text-align: center;
    color: #0d47a1;
    margin-bottom: 15px;
}

.contact-description {
    text-align: center;
    font-size: 16px;
    margin-bottom: 25px;
    color: #333;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.contact-form label {
    font-weight: bold;
    margin-bottom: 5px;
}

.contact-form textarea {
    width: 100%;
    height: 180px;
    resize: vertical;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-family: inherit;
    font-size: 16px;
    box-sizing: border-box;
}

.contact-form input[type="file"] {
    padding: 8px 0;
}

.contact-form button {
    padding: 12px;
    background-color: #0d47a1;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s ease;
}

.contact-form button:hover {
    background-color: #1565c0;
}

.contact-success {
    background: #e0ffe0;
    color: #2e7d32;
    padding: 10px 15px;
    border: 1px solid #a5d6a7;
    border-radius: 5px;
    margin-bottom: 20px;
    font-weight: bold;
    text-align: center;
}

/* ===================================================
   📬 AFFICHAGE / RÉPONSE AUX MESSAGES (élèves et admin)
   =================================================== */
.reponse-container, .repondre-container {
    max-width: 1000px;
    margin: 40px auto;
    background: #ffffff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.reponse-container h2, .repondre-container h2 {
    text-align: center;
    margin-bottom: 25px;
    color: #0d47a1;
}

.message-original, .message-box {
    background: #f8f8f8;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 25px;
    white-space: pre-wrap;
}

.message-reponse, .reponse-existante {
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: bold;
    color: #2e7d32;
    font-style: italic;
}

.reponse-form textarea, .repondre-form textarea {
    width: 100%;
    height: 180px;
    resize: vertical;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-family: inherit;
    font-size: 16px;
    box-sizing: border-box;
    margin-bottom: 20px;
}

.reponse-form button,
.repondre-form .btn-primary,
.repondre-form .btn-secondary {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
}

.reponse-form button,
.repondre-form .btn-primary {
    background-color: #0d47a1;
    color: white;
}

.repondre-form .btn-secondary {
    background-color: #aaa;
    color: white;
}

.repondre-form .form-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 20px;
}

.existing-response-alert {
    color: #b36b00;
    font-weight: bold;
    margin-bottom: 15px;
    text-align: center;
}

/* ✉️ Icône clignotante */
.clignote, .notification-icon.clignote {
    animation: clignoter 1s infinite;
}

@keyframes clignoter {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}
/* ===================================================
   📨 TABLEAU DE GESTION DES MESSAGES
   =================================================== */
   .message-admin-container {
    padding: 30px;
}

.message-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.message-table th,
.message-table td {
    border: 1px solid #ccc;
    padding: 12px;
    vertical-align: top;
    text-align: left;
}

.message-table th {
    background-color: #f5f5f5;
    font-weight: bold;
}

/* 📏 Colonnes fixes */
.message-table td:nth-child(1), /* Élève */
.message-table td:nth-child(4), /* Pièce jointe */
.message-table td:nth-child(5), /* Date */
.message-table td:nth-child(6), /* Lu */
.message-table td:nth-child(7), /* Action */
.message-table th:nth-child(1),
.message-table th:nth-child(4),
.message-table th:nth-child(5),
.message-table th:nth-child(6),
.message-table th:nth-child(7) {
    width: 100px;
    white-space: nowrap;
}

/* 📏 Colonnes larges */
.message-table td:nth-child(2), /* Message */
.message-table td:nth-child(3), /* Réponse */
.message-table th:nth-child(2),
.message-table th:nth-child(3) {
    width: 30%;
}

/* ===================================================
   🗂️ TABLEAU GESTION DES RESSOURCES
   =================================================== */
.styled-table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    margin: 20px 0;
}

.styled-table th,
.styled-table td {
    border: 1px solid #ccc;
    padding: 10px;
    vertical-align: top;
    text-align: left;
}

.styled-table th:nth-child(1),
.styled-table td:nth-child(1) {
    width: 60px;
    text-align: center;
}

.styled-table th:nth-child(3),
.styled-table td:nth-child(3) {
    width: 10%;
    text-align: center;
}

.styled-table th:nth-child(5),
.styled-table td:nth-child(5),
.styled-table th:nth-child(6),
.styled-table td:nth-child(6) {
    width: 15%;
    text-align: center;
}

.styled-table th:nth-child(2),
.styled-table td:nth-child(2) {
    width: 25% !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.styled-table th:nth-child(4),
.styled-table td:nth-child(4) {
    width: 45% !important;
    min-width: 350px !important;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
}

.styled-table input[type="text"],
.styled-table input[type="datetime-local"] {
    width: 100%;
    padding: 6px;
    box-sizing: border-box;
}

.fullwidth-table {
    width: 96vw;
    margin-left: calc(-48vw + 50%);
    padding: 0 20px;
    box-sizing: border-box;
}

/* ===================================================
   👤 TABLEAU DE GESTION DES UTILISATEURS
   =================================================== */
.table-utilisateurs {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    margin-top: 30px;
}

.table-utilisateurs th,
.table-utilisateurs td {
    border: 1px solid #ccc;
    padding: 10px;
    vertical-align: top;
    text-align: left;
}

.table-utilisateurs td.col-nom,
.table-utilisateurs td.col-prenom {
    width: 120px;
}

.table-utilisateurs td.col-email {
    width: 220px;
}

.table-utilisateurs td.col-mdp {
    width: 160px;
}

.table-utilisateurs td.col-structure,
.table-utilisateurs td.col-sous-niveau {
    width: 160px;
}

.table-utilisateurs td.col-changer-mdp,
.table-utilisateurs td.col-actif,
.table-utilisateurs td.col-archive {
    width: 60px;
    text-align: center;
}

.table-utilisateurs input,
.table-utilisateurs select {
    font-size: 14px;
    padding: 6px;
    width: 100%;
    box-sizing: border-box;
}

/* ===================================================
   🟥 ENTRAÎNEMENT (exos interactifs, LearningApps)
   =================================================== */
#liste-entrainements a {
    color: #0d47a1;
    font-weight: bold;
    display: block;
    margin-bottom: 8px;
}

.lecon-sidebar h3 {
    margin-top: 20px;
}

.lecon-sidebar h3:nth-of-type(3) {
    color: red; /* Entraînement */
}

.tabs button.btn-entrainement {
    background: #d32f2f;
    color: white;
    font-weight: bold;
}

.tabs button.btn-entrainement:hover {
    background: #b71c1c;
}

/* ===================================================
   📱 RESPONSIVE DESIGN
   =================================================== */
@media screen and (max-width: 768px) {
    body, html {
        overflow-x: hidden;
    }

    main {
        padding: 20px;
    }

    nav {
        flex-direction: column;
        gap: 15px;
    }

    .chapitre-container {
        flex-direction: column;
    }

    .lecon-sidebar,
    .lecon-content {
        width: 100%;
    }

    .hero h1 {
        font-size: 28px;
    }

    .hero p {
        font-size: 18px;
    }

    .table-utilisateurs {
        display: block;
        overflow-x: auto;
        width: 100%;
    }

    .login-box,
    .register-box,
    .contact-container,
    .user-form-container {
        width: 90%;
        margin: 30px auto;
        padding: 20px;
    }

    .register-box form,
    .user-form {
        grid-template-columns: 1fr;
    }

    .register-box textarea,
    .form-group-full textarea {
        grid-column: 1 / 2 !important;
    }

    .gestion-container {
        flex-direction: column;
        align-items: center;
    }

    .gestion-button {
        width: 90%;
        text-align: center;
    }

    .tabs button {
        width: 100%;
        margin-bottom: 10px;
    }
}


@media screen and (max-width: 1024px) {
    .scrollable-horizontal {
        overflow-x: auto;
    }

    .scrollable-horizontal iframe,
    .scrollable-horizontal embed {
        min-width: 800px;
        height: 90vh;
    }
}


.register-box {
    background: white;
    padding: 30px;
    max-width: 700px;
    margin: 50px auto;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.register-box form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group-full {
    grid-column: 1 / 3;
}

.form-group-full textarea {
    width: 100%;
    height: 160px;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
    resize: vertical;
    box-sizing: border-box;
    font-family: inherit;
}

.register-box button {
    grid-column: span 2;
    padding: 10px;
    background: #0d47a1;
    color: white;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
}
/* === Style pour le formulaire de demande d'inscription === */
.register-box {
    background: white;
    padding: 30px;
    max-width: 500px;
    margin: 80px auto;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.register-box h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #0d47a1;
}

.register-box form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.register-box label {
    font-weight: bold;
}

.register-box input,
.register-box select,
.register-box textarea {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
}

.register-box button {
    padding: 12px;
    background-color: #0d47a1;
    color: white;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.register-box button:hover {
    background-color: #1565c0;
}

.error {
    color: red;
    font-weight: bold;
    text-align: center;
    margin-bottom: 10px;
}
/* 📄 Centrage des PDF sur PC */
#pdf-container {
    width: 100%;
    text-align: center; /* Centre les pages PDF */
    overflow-x: auto;   /* Ajoute scroll horizontal si besoin */
}

/* 🖨️ Chaque page PDF (canvas) centrée */
#pdf-container .pdf-page {
    display: inline-block; /* 🔥 Pour centrer horizontalement */
    margin: 10px;          /* Optionnel : petit espace autour */
}

/* 📱 Sur téléphone : rien à changer, le scroll horizontal fonctionne */
@media screen and (max-width: 768px) {
    .chapitre-container {
        flex-direction: column; /* 📱 Sur téléphone, l'un en dessous de l'autre */
    }

    .lecon-sidebar, .lecon-content {
        width: 100%; /* 📱 Pleine largeur sur petit écran */
    }
}
@media screen and (max-width: 768px) {
    .chapitre-container {
        flex-direction: column; /* 📱 Sur téléphone, l'un en dessous de l'autre */
    }

    .lecon-sidebar, .lecon-content {
        width: 100%; /* 📱 Pleine largeur sur petit écran */
    }
}


/* ====================================
   🔁 MESSAGE DÉFILANT PAR SOUS-NIVEAU
   ==================================== */
   .message-defilant {
    white-space: nowrap;
    overflow: hidden;
    background: #fffbe6;
    color: #b36b00;
    font-weight: bold;
    padding: 8px 20px;
    border-bottom: 2px solid #ffd633;
    animation: defilement 30s linear infinite;
}

@keyframes defilement {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* ✅ Supprime le vide sous le message */
.message-defilant {
    margin-bottom: 0;
}


/* ======================================
   🔁 Message défilant discret (page chapitre)
   ====================================== */
/* 🔁 Texte rouge défilant sans fond */
.message-defilant-minimal {
    white-space: nowrap;
    overflow: hidden;
    color: red;
    font-weight: bold;
    padding: 5px 15;
    animation: defilement 30s linear infinite;
    text-align: center;
    font-size: 16px;
    border: none;
    background: none;
}
/* 📏 Réduit l'espace au-dessus et en-dessous du message défilant rouge */

/* 📏 Réduit l'espace au-dessus et en-dessous du message défilant rouge */
/* ================================
   📱 Ajustement des iframes sur mobile
   ================================ */
/* ✅ Correction 02/05/2025 finale : meilleure hauteur pour iframe sur mobile */
@media screen and (max-width: 768px) {
    .lecon-content {
        min-height: 60vh;
        overflow-y: auto;
        background: #ffffff;
        border-radius: 8px;
        margin-top: 15px;
    }

    .scrollable-horizontal iframe {
        width: 100% !important;
        height: 75vh !important;  /* On passe à 75% de l’écran */
        min-height: 300px;
        max-height: 85vh;
    }
}
/* ✅ Correction 02/05/2025 : ajustement paysage mobile */
@media screen and (max-width: 1024px) and (orientation: landscape) {
    .chapitre-container {
        flex-direction: row;  /* Repasse en ligne */
    }

    .lecon-sidebar {
        flex: 0 0 25% !important;
        max-width: 25% !important;
    }

    .lecon-content {
        flex: 0 0 75% !important;
        max-width: 75% !important;
    }

    .scrollable-horizontal iframe {
        width: 100% !important;
        height: 75vh !important;
    }
}

