/* =========================================================
   Site de Lexique — CSS (consolidé / nettoyé)
   - 1 seule définition générique de .modal-overlay (aperçu corpus)
   - Modale Export/Import de classe stylée via #class-transfer-overlay
   - Corrections: conflits de z-index + overflow
   ========================================================= */

/* =========================
   RESET + BASE
   ========================= */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body { height: 100%; }

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f6fb;
  color: #1f2933;
}

/* =========================
   LAYOUT
   ========================= */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: #ededd4;
  border-bottom: 1px solid #e5e7f0;
  top: 0;
  z-index: 20;
}

.app-main {
  padding: 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
  min-height: calc(100vh - 130px);
}

.app-footer {
  padding: 0.75rem 2rem;
  font-size: 0.8rem;
  color: #6b7280;
  border-top: 1px solid #e5e7f0;
  background: #f9fafb;
}

/* =========================
   BRANDING
   ========================= */
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f9fafb;
  font-weight: 700;
  font-size: 1.1rem;
}

.brand-text h1 {
  font-size: 1.2rem;
  font-weight: 700;
}

.brand-text p {
  font-size: 0.8rem;
  color: #6b7280;
}

/* =========================
   BREADCRUMB
   ========================= */
.breadcrumb {
  font-size: 0.85rem;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.breadcrumb-item {
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.breadcrumb-link {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
}

.breadcrumb-link:hover { color: #4f46e5; }

.breadcrumb-separator { opacity: 0.6; }

/* =========================
   VIEWS
   ========================= */
.view {
  display: none;
  animation: fadeIn 0.15s ease-out;
}

.view-active { display: block; }

/* =========================
   HERO ACCUEIL
   ========================= */
.hero {
  text-align: center;
  padding: 3rem 2rem;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
}

.hero h2 {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.hero p {
  color: #6b7280;
  margin-bottom: 1.5rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

/* =========================
   CARDS
   ========================= */
.card {
  background: #ffffff;
  border-radius: 18px;
  padding: 1.5rem 1.75rem;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.04);
  margin-bottom: 1.5rem;
}

.card-header-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.card-action {
  cursor: pointer;
  transition: transform 0.08s ease-out, box-shadow 0.08s ease-out, border-color 0.08s ease-out;
  border: 1px solid transparent;
  text-align: left;
}

.card-action h3,
.card-action h4 { margin-bottom: 0.35rem; }

.card-action p {
  color: #6b7280;
  font-size: 0.9rem;
}

.card-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
  border-color: #e5e7f0;
}

/* =========================
   BUTTONS
   ========================= */
.btn {
  border-radius: 999px;
  padding: 0.6rem 1.4rem;
  border: none;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.btn.primary {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #f9fafb;
  box-shadow: 0 10px 22px rgba(79, 70, 229, 0.35);
}

.btn.primary:hover {
  box-shadow: 0 14px 32px rgba(79, 70, 229, 0.45);
  transform: translateY(-1px);
}

.btn.outline {
  background: transparent;
  border: 1px solid #4f46e5;
  color: #4f46e5;
}

.btn.outline:hover { background: rgba(79, 70, 229, 0.04); }

.btn.ghost {
  background: transparent;
  border: 1px solid #cbd5e1;
  color: #4b5563;
}

.btn.ghost:hover {
  background: #f3f4ff;
  border-style: solid;
}

/* petit bouton réutilisable */
.btn-small {
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
}

/* états */
.btn-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =========================
   FORMS
   ========================= */
.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.75rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group-inline {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

label {
  font-size: 0.9rem;
  font-weight: 500;
}

input[type="text"],
input[type="color"],
select {
  border-radius: 999px;
  border: 1px solid #d1d5db;
  padding: 0.55rem 0.85rem;
  font-size: 0.95rem;
  outline: none;
  background: #f9fafb;
}

input[type="color"] {
  padding: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  cursor: pointer;
}

input:focus,
select:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.2);
  background: #ffffff;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* =========================
   CLASS LIST (CRÉATION)
   ========================= */
.class-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.class-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.class-row input[type="text"] { flex: 1; }

.class-row .remove-class {
  border-radius: 999px;
  border: none;
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
  cursor: pointer;
  background: transparent;
  color: #9ca3af;
}

.class-row .remove-class:hover { color: #ef4444; }

/* =========================
   TABLE-LIKE (MANAGE / CORPUS)
   ========================= */
.table-like {
  border-radius: 14px;
  border: 1px solid #e5e7f0;
  overflow: hidden;
  background: #f9fafb;
  margin-bottom: 1rem;
}

.table-row {
  display: grid;
  grid-template-columns: 2fr 1fr 2fr;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  align-items: center;
  border-bottom: 1px solid #e5e7f0;
}

.table-row.header {
  background: #eef2ff;
  font-size: 0.8rem;
  font-weight: 600;
  color: #4b5563;
}

.table-row:last-child { border-bottom: none; }

.table-row span { font-size: 0.9rem; }

/* =========================
   CLASS HEADING
   ========================= */
.class-heading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.class-color-badge {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 2px solid #e5e7f0;
}

/* =========================
   GRIDS
   ========================= */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

/* =========================
   PANELS / MESSAGES
   ========================= */
.info-panel {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: #eef2ff;
  color: #4b5563;
}

.code-block {
  margin: 0.5rem 0;
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  background: #111827;
  color: #e5e7eb;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

/* =========================
   TEXT STYLES
   ========================= */
.muted { color: #6b7280; }
.small { font-size: 0.8rem; }
.help-text { font-size: 0.8rem; color: #6b7280; }
.error-text { font-size: 0.85rem; color: #b91c1c; margin-top: 0.5rem; }

/* =========================
   TOOLBAR
   ========================= */
.toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.75rem;
}

/* =========================
   UTIL
   ========================= */
.hidden { display: none !important; }
.is-read-only { background-color: #f5f5f5; }

/* =========================
   ANIMATIONS
   ========================= */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =========================
   CLASS TYPE PANEL
   ========================= */
.class-corpus-type-panel {
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px dashed #e5e7f0;
}

.class-corpus-type-panel .table-row.header { background: #f3f4ff; }
.class-corpus-type-panel .table-row { cursor: pointer; }

/* =========================
   ICON BUTTON
   ========================= */
.icon-button {
  border: none;
  background: transparent;
  padding: 0.1rem 0.25rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: #9ca3af;
}

.icon-button:hover {
  color: #dc2626;
  transform: translateY(-1px);
}

/* =========================
   MODALES — GÉNÉRIQUE (base commune)
   ========================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.50);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.25);
  max-width: 720px;
  width: 95%;
  max-height: 80vh;
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  box-sizing: border-box;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.modal-header h2 {
  font-size: 1.1rem;
  margin: 0;
}

.modal-subtitle {
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 0.75rem;
}

.modal-close-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  color: #9ca3af;
}

.modal-close-btn:hover { color: #111827; }

.modal-section-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0.5rem 0 0.25rem;
}

.modal-category-block {
  margin-top: 0.35rem;
  padding: 0.35rem 0.5rem;
  border-radius: 10px;
  background: #f9fafb;
  border: 1px solid #e5e7f0;
}

.modal-category-title {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.modal-category-words { font-size: 0.85rem; }

.modal-category-words span {
  display: inline-block;
  margin-right: 0.35rem;
}

/* =========================
   MODALE DEFINITION / INTERCONNEXIONS
   ========================= */
.definition-modal-word-wrapper {
  text-align: center;
  margin: 0.75rem 0 1rem;
}

.definition-modal-word {
  display: inline-block;
  font-size: 1.3rem;
  font-weight: 700;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  border: 1px solid #e5e7f0;
  background: #f9fafb;
}

.definition-modal-content-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.25rem;
}

.definition-modal-block {
  flex: 1 1 260px;
  border: 1px solid #e5e7f0;
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  background: #f9fafb;
}

.definition-modal-block h3 {
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
}

.definition-modal-block-def textarea {
  width: 100%;
  min-height: 150px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  padding: 0.5rem 0.6rem;
  font-size: 0.9rem;
  resize: vertical;
  background: #ffffff;
}

.definition-modal-links {
  font-size: 0.85rem;
  max-height: 210px;
  overflow-y: auto;
}

.definition-modal-link-group { margin-bottom: 0.5rem; }
.definition-modal-link-group-title { font-weight: 600; margin-bottom: 0.2rem; }
.definition-modal-link-item { margin-left: 0.8rem; }

/* =========================
   MODALE EXPORT / IMPORT (classe)
   IMPORTANT: ne pas réutiliser .modal-overlay (sinon conflits)
   ========================= */
#class-transfer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  padding: 1rem;
  z-index: 1300;

  overflow: auto;          /* scroll si nécessaire */
  display: flex;
  align-items: flex-start; /* évite que la modale soit coupée */
  justify-content: center;
}

#class-transfer-overlay.hidden { display: none !important; }

#class-transfer-overlay .modal-card-white {
  width: min(1200px, 100%);
  max-height: 92vh;
  display: flex;
  flex-direction: column;

  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 20px 40px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.05);
}

/* Header/footer fixes pour cette modale uniquement */
#class-transfer-overlay .modal-header {
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid #e5e7eb;
  flex: 0 0 auto;
  margin-bottom: 0;
}

#class-transfer-overlay .modal-body {
  padding: 0.75rem 1.25rem;
  overflow: auto;
  flex: 1 1 auto;
}

#class-transfer-overlay .modal-footer {
  padding: 0.75rem 1.25rem 1rem;
  border-top: 1px solid #e5e7eb;
  flex: 0 0 auto;
  margin-top: 0;
}

/* grille des types côte à côte */
#class-transfer-groups {
  margin-top: 0.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 0.75rem;
  background: #f8fafc;
  border-radius: 14px;
  padding: 0.75rem;
}

#class-transfer-groups .card {
  margin: 0 !important;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

/* =========================
   STACKING ORDER DES MODALES
   ========================= */
#corpus-preview-overlay { z-index: 1000; }
#definition-modal-overlay { z-index: 1100; }
#image-zoom-overlay { z-index: 1200; }
/* class-transfer overlay est à 1300 */

/* =========================
   VUE "VOIR LES MOTS"
   ========================= */
.word-list-panel,
.word-details-panel {
  min-height: 160px;
  max-height: 320px;
  overflow-y: auto;
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid #e5e7f0;
  padding: 0.5rem 0.6rem;
  box-sizing: border-box;
}

.word-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.word-list-item {
  font-size: 0.9rem;
  padding: 0.2rem 0.3rem;
  border-radius: 6px;
  cursor: pointer;
}

.word-list-item:hover { background: #eef2ff; }

/* Corpus en mode élève : lignes plus grandes */
.student-corpus-list .table-row {
  font-size: 0.95rem;
  padding: 0.6rem 0.75rem;
}

.student-corpus-list .table-row.header { font-size: 0.9rem; }

/* Cartes de corpus en mode élève (page de classe) */
.corpus-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.corpus-card-grid .corpus-card h3 {
  margin-bottom: 0.25rem;
  font-size: 1rem;
}

/* Modal de prévisualisation des corpus : plus large */
#corpus-preview-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

#corpus-preview-modal {
  width: 100%;
  max-width: 1000px;
  max-height: 90vh;
  overflow: auto;
}

@media (min-width: 1200px) {
  #corpus-preview-modal { max-width: 1200px; }
}

/* =========================
   PANNEAUX REPLIABLES (éditeurs)
   ========================= */
.fleurs-panel,
.intensite-panel,
.hyperonymie-panel,
.grille-panel,
.sacs-panel {
  position: relative;
}

.panel-collapsible > h3 { margin-bottom: 0.4rem; }

.panel-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 0;
  background: none;
  border: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.panel-toggle-label { font-weight: 600; }

.panel-toggle-icon {
  font-size: 0.9rem;
  opacity: 0.7;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.panel-collapsed > h3 .panel-toggle-icon {
  transform: rotate(-90deg);
  opacity: 0.5;
}

.panel-collapsed > *:not(h3) { display: none !important; }

.panel-collapsible:not(.panel-expanded) > *:not(h3) { display: none !important; }

.panel-collapsible:not(.panel-expanded) > h3 .panel-toggle-icon {
  transform: rotate(-90deg);
  opacity: 0.5;
}

/* =========================
   DEFINITIONS LIST
   ========================= */
.definitions-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #e5e7f0;
  border-radius: 10px;
  padding: 0.4rem 0.5rem;
  background: #ffffff;
  font-size: 0.85rem;
}

.definition-item {
  padding: 0.25rem 0.3rem;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 0.2rem;
}

.definition-item:hover { background: #f3f4ff; }

.definition-word {
  font-weight: 600;
  margin-bottom: 0.1rem;
}

.definition-text {
  font-size: 0.8rem;
  color: #4b5563;
  white-space: pre-wrap;
}

/* =========================
   CARTES MOTS + IMAGES
   ========================= */
.lex-word-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  box-sizing: border-box;
}

.lex-word-card-image-slot {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 4px;
}

.lex-word-card-image-slot img {
  max-width: 100%;
  max-height: 60px;
  object-fit: contain;
}

.lex-word-card-label {
  text-align: center;
  font-size: 0.85rem;
  word-wrap: break-word;
}

/* Ajustements contextuels */
.fleurs-category-words .lex-word-card,
.morpho-cat-words .lex-word-card {
  margin: 2px 0;
}

.intensite-word-inner.lex-word-card { width: auto; }

/* =========================
   POLICES DE CORPUS
   ========================= */
@font-face {
  font-family: "EcritureA";
  src: url("fonts/EcritureA-Romain.otf") format("opentype");
  font-weight: normal;
  font-style: normal;
}

/* Appliquées sur les conteneurs canvas */
.font-default,
.font-script {
  font-family: "arial", "Segoe Print", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: normal;
  text-transform: none;
}

.font-capitales {
  font-family: inherit;
  font-weight: normal;
  text-transform: uppercase;
}

.font-cursive {
  font-family: "EcritureA", "Segoe Print", "Comic Sans MS", system-ui, sans-serif;
  font-weight: normal;
  text-transform: none;
  font-size-adjust: 0.45; /* à régler */}

/* =========================
   FIX EXPORT PDF (cursive)
   - évite les espaces géants lors du rendu html2canvas
   ========================= */
html.pdf-export-mode .font-cursive,
html.pdf-export-mode .font-cursive *,
html.pdf-export-mode .font-cursive .lex-word-card-label {
  font-size-adjust: none !important; /* neutralise la propriété */
  letter-spacing: 0 !important;
  word-spacing: -0.05em !important; /* ✅ Réduit légèrement l'espacement entre les mots pour la cursive */
  text-rendering: geometricPrecision;
}

/* =========================
   ZOOM IMAGE
   ========================= */
.image-zoom-modal {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  padding: 0.75rem;
  border-radius: 0.75rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

#image-zoom-img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
}

.clickable-image { cursor: zoom-in; }

/* =========================
   CADRES CORPUS (canvas)
   ========================= */
#fleurs-corpus-frame,
#morpho-corpus-frame,
#intensite-corpus-frame,
#hyperonymie-corpus-frame,
#grille-semique-corpus-frame,
#sacs-corpus-frame {
  position: relative;
  padding-top: 2.5rem; /* espace réservé au-dessus du canvas */
}

/* Barre de boutons au-dessus des canvas */
.corpus-expand-btn,
.corpus-images-toggle-btn,
.corpus-words-toggle-btn,
.corpus-font-select,
.corpus-highlight-btn {
  position: absolute;
  top: 0.5rem;
  z-index: 10;
}

/* 1. [ ] Agrandir */
.corpus-expand-btn {
  right: 0.75rem;
  border: 1px solid #d1d5db;
  background: #ffffff;
  border-radius: 999px;
  padding: 0 0.45rem;
  font-size: 0.8rem;
  line-height: 1.4;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.corpus-expand-btn:hover { background: #f3f4f6; }

/* 2. Masquer images */
.corpus-images-toggle-btn {
  right: 4rem;
  font-size: 0.70rem;
  padding: 0.15rem 0.35rem;
  line-height: 1.1;
  border-radius: 4px;
  border: 1px dashed #cbd5e1;
  background: transparent;
  cursor: pointer;
}

.corpus-images-toggle-btn:hover {
  background: #f3f4ff;
  border-style: solid;
}

/* 3. Masquer mots */
.corpus-words-toggle-btn {
  right: 11.5rem;
  font-size: 0.70rem;
  padding: 0.15rem 0.35rem;
  line-height: 1.1;
  border-radius: 4px;
  border: 1px dashed #cbd5e1;
  background: transparent;
  cursor: pointer;
}

.corpus-words-toggle-btn:hover {
  background: #f3f4ff;
  border-style: solid;
}

/* 4. Police */
.corpus-font-select {
  right: 18.5rem;
  font-size: 0.70rem;
  padding: 0.15rem 0.35rem;
  line-height: 1.1;
  border-radius: 4px;
  border: 1px dashed #cbd5e1;
  background: transparent;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: none;
}

.corpus-font-select:hover {
  background: #f3f4ff;
  border-style: solid;
}

/* 5. Surligner */
.corpus-highlight-btn {
  right: 25.5rem;
  font-size: 0.70rem;
  padding: 0.15rem 0.35rem;
  line-height: 1.1;
  border-radius: 4px;
  border: 1px dashed #cbd5e1;
  background: transparent;
  cursor: pointer;
}

.corpus-highlight-btn:hover,
.corpus-highlight-btn.is-active {
  background: #fef3c7;
  border-style: solid;
}

/* Menu surlignage */
.corpus-highlight-menu {
  position: absolute;
  top: 0.1rem;
  right: 12.5rem;
  z-index: 11;
  background: #ffffff;
  border-radius: 0.5rem;
  border: 1px solid #e5e7f0;
  padding: 0.4rem 0.6rem;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
  font-size: 0.75rem;
}

.corpus-highlight-menu.hidden { display: none; }

.corpus-highlight-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.3rem;
}

.corpus-highlight-row:last-child { margin-bottom: 0; }

.highlight-color-btn {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  cursor: pointer;
}

.highlight-color-yellow { background: #fef08a; }
.highlight-color-green  { background: #bbf7d0; }
.highlight-color-blue   { background: #bfdbfe; }
.highlight-color-pink   { background: #fed7e2; }
.highlight-color-red    { background: #f97540; }

.highlight-eraser-btn,
.highlight-clearall-btn {
  border-radius: 999px;
  border: 1px dashed #cbd5e1;
  padding: 0.15rem 0.5rem;
  cursor: pointer;
  background: #f9fafb;
}

.highlight-eraser-btn:hover,
.highlight-clearall-btn:hover { background: #fee2e2; }

/* Application surlignage */
.lex-word-card.lex-highlight-yellow .lex-word-card-label,
.lex-word-card.lex-highlight-yellow {
  background: #fef9c3;
  box-shadow: 0 0 0 2px #facc15;
}

.lex-word-card.lex-highlight-green .lex-word-card-label,
.lex-word-card.lex-highlight-green {
  background: #dcfce7;
  box-shadow: 0 0 0 2px #22c55e;
}

.lex-word-card.lex-highlight-blue .lex-word-card-label,
.lex-word-card.lex-highlight-blue {
  background: #dbeafe;
  box-shadow: 0 0 0 2px #3b82f6;
}

.lex-word-card.lex-highlight-pink .lex-word-card-label,
.lex-word-card.lex-highlight-pink {
  background: #ffe4e6;
  box-shadow: 0 0 0 2px #ec4899;
}

.lex-word-card.lex-highlight-red .lex-word-card-label,
.lex-word-card.lex-highlight-red {
  background: #f97540;
  box-shadow: 0 0 0 2px #ff0707;
}

.lex-word-card.lex-word-highlighted {
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.6);
}

/* =========================
   FILTRES "Tous les corpus"
   ========================= */
.corpus-filters-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 1rem;
  align-items: flex-start;
}

.corpus-filter-card {
  background: #fafafa;
  border: 1px solid #ddd;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  flex: 1 1 0;
  min-width: 0;
}

.corpus-filter-card .small-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.corpus-filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
}

.corpus-filter-options label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.9rem;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .corpus-filters-grid { flex-wrap: wrap; }
  .corpus-filter-card { flex: 1 1 100%; }
}

/* =========================
   RESPONSIVE GLOBAL
   ========================= */
@media (max-width: 640px) {
  .app-header {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }

  .app-main { padding: 1rem; }

  .card { padding: 1.25rem 1.25rem; }

  .table-row { grid-template-columns: 1.3fr 0.9fr 1.8fr; }

  .definition-modal-content-grid { flex-direction: column; }
}

/* =========================
   Cartes ressources (SVG inline, actions en bas)
   ========================= */

.ressource-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: left;
}

.ressource-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.ressource-card-left {
  flex: 1;
  min-width: 0;
}

.ressource-card-title {
  margin: 0;
}

.ressource-card-meta {
  margin: 0.15rem 0 0 0;
}

.ressource-card-preview {
  margin: 0;
}

/* ✅ zone actions en bas */
.ressource-card-actions {
  display: flex;
  gap: 0.35rem;
  justify-content: flex-end;
  margin-top: auto;           /* pousse les boutons en bas */
  padding-top: 0.35rem;
}

/* ✅ boutons icône (petits) */
.ressource-card-actions .btn {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;

  padding: 0;
  border-radius: 999px;
  line-height: 1;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

/* On garde tes styles outline/ghost existants, mais un peu plus fin */
.ressource-card-actions .btn.outline,
.ressource-card-actions .btn.ghost {
  border-width: 1px;
}

/* ✅ SVG */
.ressource-card-actions .btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* La couleur suit le texte (outline/ghost) */
.ressource-card-actions .btn svg path,
.ressource-card-actions .btn svg circle,
.ressource-card-actions .btn svg polyline,
.ressource-card-actions .btn svg line {
  stroke: currentColor;
}

/* ✅ texte accessible mais invisible */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* =========================
   LISERÉ COULEUR — cartes (classes + corpus)
   ========================= */

/* carte “accentuée” : liseré gauche */
.card.card-accent {
  position: relative;
  border-left: 4px solid var(--accent, #6366f1);
}

/* optionnel : un peu plus “classe-like” */
.card.card-action.card-accent:hover {
  border-color: #e5e7f0;              /* garde ton hover */
  border-left-color: var(--accent, #6366f1);
}

/* =========================================================
   RESSOURCES PÉDAGOGIQUES — STYLE SPÉCIAL
   Objectif : look "fiche pédagogique" + pastilles + niveaux
   ========================================================= */

/* --- Variables locales (faciles à ajuster) --- */
:root{
  --ped-bg: #f8fafc;
  --ped-border: #e5e7f0;
  --ped-ink: #111827;
  --ped-muted: #6b7280;

  --ped-indigo: #4f46e5;
  --ped-violet: #7c3aed;

  --ped-ok-bg: rgba(16,185,129,.10);
  --ped-ok-bd: rgba(16,185,129,.25);

  --ped-warn-bg: rgba(245,158,11,.12);
  --ped-warn-bd: rgba(245,158,11,.25);
}

/* =========================
   1) Chips / pastilles (tags visuels)
   ========================= */
.ped-chip-row{
  display:flex;
  flex-wrap:wrap;
  gap:.4rem .55rem;
  align-items:center;
}

.ped-chip{
  display:inline-flex;
  align-items:center;
  gap:.35rem;
  padding:.2rem .6rem;
  border-radius:999px;
  border:1px solid var(--ped-border);
  background:#fff;
  font-size:.78rem;
  color:#374151;
  line-height:1.2;
}

.ped-chip strong{ font-weight:650; }

/* variantes */
.ped-chip.is-typo{
  background:#eef2ff;
  border-color:#dbeafe;
  color:#3730a3;
}
.ped-chip.is-niveau{
  background:#f5f3ff;
  border-color:#e9d5ff;
  color:#5b21b6;
}
.ped-chip.is-format{
  background:#ecfeff;
  border-color:#bae6fd;
  color:#075985;
}

/* mini icône (si tu mets un svg inline ou un •) */
.ped-chip .dot{
  width:.45rem;height:.45rem;border-radius:999px;
  background:currentColor;
  opacity:.65;
}

/* =========================
   2) Rendu "fiche pédagogique" dans la card ressource
   ========================= */
.ressource-card{
  position:relative;
  overflow:hidden;
}

/* bandeau léger en haut (effet fiche) */
.ressource-card::before{
  content:"";
  position:absolute;
  left:0; right:0; top:0;
  height:10px;
  background: linear-gradient(90deg, rgba(79,70,229,.20), rgba(124,58,237,.14));
}

/* contenu mieux hiérarchisé */
.ressource-card-title{
  font-size:1.05rem;
  font-weight:750;
  letter-spacing:-.01em;
}

.ressource-card-meta{
  display:flex;
  flex-wrap:wrap;
  gap:.35rem .45rem;
  align-items:center;
  margin-top:.25rem;
  color:var(--ped-muted);
}

/* aperçu texte comme extrait de fiche */
.ressource-card-preview{
  background: var(--ped-bg);
  border:1px solid var(--ped-border);
  border-radius: 14px;
  padding:.55rem .65rem;
  color:#4b5563;
  font-size:.85rem;
  line-height:1.35;
}

/* =========================
   3) Viewer : "sections pédagogiques"
   (si tu gardes ton HTML viewer : on stylise les <strong> etc.)
   ========================= */
.ped-viewer{
  background:#fff;
  border-radius:18px;
  box-shadow:0 12px 30px rgba(15,23,42,.06);
  border:1px solid rgba(229,231,240,.85);
}

.ped-viewer h2{
  font-size:1.35rem;
  letter-spacing:-.01em;
}

.ped-section{
  margin-top:.75rem;
  padding:.65rem .75rem;
  border-radius:14px;
  border:1px solid var(--ped-border);
  background: var(--ped-bg);
}

.ped-section-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:.5rem;
  font-weight:700;
  color:#374151;
  margin-bottom:.35rem;
  font-size:.92rem;
}

.ped-section-body{
  color:#4b5563;
  font-size:.9rem;
  line-height:1.4;
  white-space:pre-wrap;
}

/* =========================
   4) Groupes de cases "type badges"
   Format (radios) + Niveau (checkboxes)
   -> fonctionne avec ta structure label > input + texte
   ========================= */
.ped-choice-row{
  display:flex;
  flex-wrap:wrap;
  gap:.45rem .6rem;
  margin-top:.25rem;
}

/* le label devient un "badge cliquable" */
.ped-choice-row label{
  display:inline-flex;
  align-items:center;
  gap:.45rem;
  padding:.35rem .7rem;
  border-radius:999px;
  border:1px solid var(--ped-border);
  background:#fff;
  cursor:pointer;
  user-select:none;
  font-size:.9rem;
  color:#374151;
  transition: transform .08s ease, background .12s ease, border-color .12s ease, box-shadow .12s ease;
}

.ped-choice-row label:hover{
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(15,23,42,.05);
  border-color:#dbeafe;
}

/* on masque le look natif, mais on garde accessible */
.ped-choice-row input[type="checkbox"],
.ped-choice-row input[type="radio"]{
  width:16px;
  height:16px;
  margin:0;
  accent-color: var(--ped-indigo);
}

/* état coché : style "sélectionné" */
.ped-choice-row label:has(input:checked){
  background: #eef2ff;
  border-color: rgba(79,70,229,.35);
  box-shadow: 0 0 0 1px rgba(79,70,229,.08) inset;
  color:#3730a3;
}

/* =========================
   5) Mini indicateurs "Objectif / Niveau / Lien"
   ========================= */
.ped-badge-line{
  display:flex;
  flex-wrap:wrap;
  gap:.45rem .6rem;
  margin-top:.35rem;
}

.ped-badge{
  display:inline-flex;
  align-items:center;
  gap:.4rem;
  padding:.18rem .55rem;
  border-radius:999px;
  border:1px solid var(--ped-border);
  background:#fff;
  font-size:.78rem;
  color:#4b5563;
}

.ped-badge.ok{
  background: var(--ped-ok-bg);
  border-color: var(--ped-ok-bd);
  color:#047857;
}

.ped-badge.warn{
  background: var(--ped-warn-bg);
  border-color: var(--ped-warn-bd);
  color:#92400e;
}

/* =========================
   6) Actions (boutons icônes) : un peu plus "pro"
   ========================= */
.ressource-card-actions .btn{
  box-shadow: 0 1px 2px rgba(15,23,42,.06);
}
.ressource-card-actions .btn:hover{
  box-shadow: 0 10px 22px rgba(15,23,42,.10);
  transform: translateY(-1px);
}

/* =========================
   Séparateurs pédagogiques
   ========================= */

.ped-section-separator {
  margin: 0.9rem 0 0.75rem;
  height: 1px;
  background: linear-gradient(
    to right,
    rgba(79, 70, 229, 0.25),
    rgba(124, 58, 237, 0.15),
    rgba(79, 70, 229, 0.25)
  );
  border-radius: 999px;
}


/* .modal-overlay est défini plus haut (ligne ~496) */

.modal-card {
  width: min(860px, 96vw);
  max-height: 88vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* .modal-header est défini plus haut (ligne ~521) */
/* Styles spécifiques pour .modal-card */
.modal-card .modal-header {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #e5e7f0;
}

.modal-title { font-size: 1.05rem; font-weight: 700; }
.modal-subtitle { margin-top: 0.15rem; }

.modal-body {
  padding: 1rem;
  overflow: auto;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.corpus-card-delete-btn {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  width: 1.8rem;
  height: 1.8rem;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.corpus-card-delete-btn:hover {
  background: #fee2e2;
}
