/* style.css – Version unique et harmonisée */

/* RESET & BASE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f4f7fc;
    color: #1e2a3a;
    line-height: 1.5;
    padding: 12px;
}
header, footer {
    background: white;
    border-radius: 20px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
h1 {
    font-size: 1.6rem;
    color: #0f4c5f;
}
button, a, .btn-chat, .btn-pdf, .video-link, .btn-prof {
    touch-action: manipulation;
}

/* BOUTONS GÉNÉRIQUES */
.btn-chat, .btn-pdf, .video-link, .btn-prof {
    display: inline-block;
    background: #e67e22;
    color: white;
    text-decoration: none;
    padding: 10px 18px;
    border-radius: 40px;
    font-weight: bold;
    margin: 5px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    text-align: center;
}
.btn-chat:hover, .btn-pdf:hover, .video-link:hover, .btn-prof:hover {
    background: #b45f1b;
}
.btn-pdf {
    background: #2c3e50;
}
.btn-pdf:hover {
    background: #e67e22;
}
.btn-continue {
    background: #27ae60 !important;
}
.btn-continue:hover {
    background: #1e8449 !important;
}
.btn-admin {
    background: #0f4c5f;
    color: white;
    padding: 10px 15px;
    border-radius: 30px;
    text-decoration: none;
    display: inline-block;
}
.btn-admin:hover {
    background: #e67e22;
}
.btn-danger {
    background: #c0392b;
}
.btn-danger:hover {
    background: #a82313;
}

/* ACCUEIL – SÉQUENCES & ACCORDÉON */
.sequence {
    background: white;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.sequence h2 {
    color: #0f4c5f;
    border-left: 5px solid #ffb74d;
    padding-left: 12px;
    margin-bottom: 12px;
    font-size: 1.3rem;
}
.desc {
    color: #2c3e50;
    margin-bottom: 20px;
    font-style: italic;
}
.sequence-description {
    background: #fef9e8;
    padding: 10px 20px;
    font-style: italic;
    border-bottom: 1px solid #e9ecef;
}
.sequence-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: #f8f9fa;
    padding: 12px 20px;
    border-radius: 20px 20px 0 0;
}
.sequence-title {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.sequence-stats {
    display: flex;
    gap: 20px;
    font-size: 1rem;
}
.sequence-stats span {
    background: #e9ecef;
    border-radius: 30px;
    padding: 4px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.toggle-icon {
    font-size: 1.2rem;
    color: #e67e22;
}
.sequence-content {
    transition: all 0.2s;
}
.sequence-content.collapsed {
    display: none;
}
.sub-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: #dee2e6;
    cursor: pointer;
    border-radius: 12px;
    margin: 5px 0;
}
.sub-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: bold;
    color: #0f4c5f;
}
.sub-count {
    background: #495057;
    color: white;
    border-radius: 30px;
    padding: 2px 12px;
}
.sub-content {
    transition: all 0.2s;
}
.sub-content.collapsed {
    display: none;
}

/* CARTES RESSOURCES */
.ressources {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}
.carte-ressource {
    flex: 1 1 280px;
    background: #fef9e8;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    transition: transform 0.2s;
}
.carte-ressource:hover {
    transform: translateY(-3px);
}
.carte-ressource h3 {
    color: #e67e22;
    margin-bottom: 12px;
    font-size: 1.2rem;
}
.video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 12px;
}
.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.video-link {
    display: inline-block;
    background: #2c3e50;
    margin-top: 0;
    font-size: 0.85rem;
    padding: 6px 12px;
}
.video-link:hover {
    background: #e67e22;
}
.quiz-card {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
}
.quiz-content {
    flex: 2;
    min-width: 180px;
}
.top5 {
    flex: 1;
    min-width: 140px;
    background: #f0f0f0;
    border-radius: 12px;
    padding: 12px;
    margin-left: 15px;
    font-size: 0.85rem;
}
.top5 ol {
    margin-left: 20px;
    margin-top: 5px;
}
.historique-link {
    display: inline-block;
    margin-top: 10px;
    font-size: 0.8rem;
    color: #0f4c5f;
}

/* CHAT */
.chat-container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    padding: 16px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.chat-messages {
    height: 50vh;
    min-height: 300px;
    overflow-y: auto;
    background: #fef9e8;
    border-radius: 15px;
    padding: 12px;
    margin-bottom: 20px;
}
.message {
    border-bottom: 1px solid #ddd;
    padding: 10px 0;
    word-wrap: break-word;
}
.message strong {
    color: #e67e22;
}
.message small {
    color: #7f8c8d;
    font-size: 0.75rem;
    margin-left: 8px;
}
.btn-supprimer {
    float: right;
    background: #c0392b;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 4px 10px;
    cursor: pointer;
}
.chat-form input, .chat-form textarea {
    width: 100%;
    padding: 10px;
    margin: 8px 0;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 1rem;
}
.envoyer {
    background: #e67e22;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 30px;
    cursor: pointer;
    width: 100%;
    font-size: 1rem;
}
.user-info {
    background: #e9ecef;
    padding: 5px 15px;
    border-radius: 30px;
    font-size: 0.9rem;
}
.user-info a {
    margin-left: 8px;
    color: #e67e22;
    text-decoration: none;
}
.lien-retour {
    margin-top: 20px;
    text-align: center;
}

/* QUIZ */
.quiz-container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.quiz-question {
    border: 1px solid #ddd;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 10px;
    background: #fef9e8;
}
.quiz-question.correct {
    background: #d4edda;
    border-left: 5px solid #28a745;
}
.quiz-question.incorrect {
    background: #f8d7da;
    border-left: 5px solid #dc3545;
}
.options label {
    display: block;
    margin: 5px 0;
    cursor: pointer;
}
.chrono {
    background: #0f4c5f;
    color: #ffb74d;
    font-size: 1.8rem;
    font-weight: bold;
    text-align: center;
    padding: 15px;
    border-radius: 50px;
    margin-bottom: 20px;
    font-family: monospace;
}
.correct-badge {
    color: #28a745;
    font-weight: bold;
    margin-left: 8px;
}
.incorrect-badge {
    color: #dc3545;
    font-weight: bold;
    margin-left: 8px;
}
.explication {
    font-style: italic;
    color: #555;
    margin-top: 10px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 8px;
}
.conflict-box {
    background: #fff3cd;
    padding: 15px;
    border-radius: 12px;
    margin: 20px 0;
    text-align: center;
}
.btn-submit {
    background: #e67e22;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 40px;
    font-weight: bold;
    cursor: pointer;
    margin: 5px;
}

/* AUTHENTIFICATION (élève & professeur) */
.auth-container {
    max-width: 500px;
    margin: 20px auto;
    background: white;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.auth-form .form-group {
    margin-bottom: 15px;
}
.auth-form label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}
.auth-form input {
    width: 100%;
    padding: 10px;
    border-radius: 30px;
    border: 1px solid #ccc;
    font-size: 1rem;
}
.auth-form button {
    background: #e67e22;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 40px;
    font-weight: bold;
    width: 100%;
    cursor: pointer;
    margin-top: 10px;
}
.error {
    background: #ffe6e6;
    color: #c0392b;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
}
.message-success {
    background: #d4edda;
    color: #155724;
    padding: 10px;
    border-radius: 8px;
    margin: 10px 0;
}
.message-error {
    background: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 8px;
    margin: 10px 0;
}

/* TABLEAU DE BORD PROFESSEUR */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}
.stat-item {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 15px;
    text-align: center;
}
.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #e67e22;
}
.stat-card {
    background: white;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.stat-card h2 {
    color: #0f4c5f;
    margin-top: 0;
    border-left: 5px solid #ffb74d;
    padding-left: 15px;
}
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}
th {
    background: #0f4c5f;
    color: white;
}
.admin-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
}
.nav-links {
    margin-bottom: 15px;
}
.nav-links a {
    margin-right: 15px;
}

/* GESTION PROFESSEUR (accordéon, glisser-déposer, formulaires) */
.admin-section {
    border: 1px solid #ccc;
    padding: 15px;
    margin: 20px 0;
    background: #fff;
    border-radius: 10px;
}
.sequence-block {
    border: 1px solid #ddd;
    margin: 15px 0;
    padding: 5px;
    background: #fefefe;
    border-radius: 12px;
}
.sequence-header-clickable {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 10px 12px;
    background: #f0f0f0;
    border-radius: 8px;
    margin: 5px;
}
.sequence-header-clickable:hover {
    background: #e2e2e2;
}
.sequence-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}
.inactive {
    background: #f9f2f2;
    border-left: 5px solid #c0392b;
}
.active {
    background: #f2f9f2;
    border-left: 5px solid #27ae60;
}
.resource-group {
    margin-top: 15px;
    border-top: 1px solid #eee;
    padding-top: 10px;
}
.resource-group h4 {
    margin: 5px 0;
    color: #0f4c5f;
}
.resource-item, .quiz-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px;
    border-bottom: 1px solid #f0f0f0;
    cursor: move;
}
.resource-item .actions button, .quiz-item .actions button {
    margin-left: 5px;
    background: #3498db;
    border: none;
    border-radius: 20px;
    color: white;
    padding: 2px 8px;
    cursor: pointer;
}
.delete-btn {
    background: #c0392b !important;
}
.sortable-drag {
    opacity: 0.4;
    background: #ffd;
}
.save-order-btn {
    margin-top: 5px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 4px 12px;
    cursor: pointer;
}
.sequence-actions input, .sequence-actions textarea {
    width: auto;
    margin: 5px;
}
fieldset {
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 15px;
    margin: 20px 0;
}
.form-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}
.form-inline input, .form-inline button {
    padding: 8px 12px;
    border-radius: 30px;
    border: 1px solid #ccc;
}
.form-inline button {
    background: #e67e22;
    color: white;
    border: none;
    cursor: pointer;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    body {
        padding: 8px;
    }
    .sequence {
        padding: 15px;
    }
    .carte-ressource {
        flex: 1 1 100%;
    }
    .quiz-card {
        flex-direction: column;
    }
    .top5 {
        margin-left: 0;
        margin-top: 15px;
        width: 100%;
    }
    .btn-chat, .btn-pdf, .video-link, .btn-prof {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
    h1 {
        font-size: 1.4rem;
    }
    .sequence h2 {
        font-size: 1.2rem;
    }
    .auth-container {
        margin: 10px;
        padding: 15px;
    }
    /* table responsive (déjà géré par les classes .table si utilisées) */
    .table, .table thead, .table tbody, .table tr, .table td {
        display: block;
    }
    .table th {
        display: none;
    }
    .table td {
        border: none;
        position: relative;
        padding-left: 50%;
    }
    .table td::before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        width: 45%;
        font-weight: bold;
    }
}