/* ==========================================================================
   TText - Traitement de textes simplifié pour enfants
   Ecole de l'Enfant-Jésus Morlanwelz
   ========================================================================== */

:root {
  --ttext-primary: #3b82f6;
  --ttext-primary-hover: #2563eb;
  --ttext-primary-light: #eff6ff;
  --ttext-accent: #f59e0b;
  --ttext-accent-hover: #d97706;
  --ttext-success: #10b981;
  --ttext-danger: #ef4444;
  --ttext-bg-desk: #e2e8f0;
  --ttext-paper-white: #ffffff;
  --ttext-text-main: #1e293b;
  --ttext-border: #cbd5e1;
  --ttext-toolbar-bg: #f8fafc;
  --ttext-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

/* Pleine page pour l'application TText (100% de la fenêtre, sans scroll global) */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--ttext-bg-desk);
  font-family: 'Nunito', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.ttext-wrapper {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--ttext-bg-desk);
  color: var(--ttext-text-main);
  box-sizing: border-box;
}

/* Bouton Retour au site */
.btn-back-site {
  background: rgba(255, 255, 255, 0.95) !important;
  color: #1e3a8a !important;
  font-weight: 800 !important;
  border: 1px solid white !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-back-site:hover {
  background: white !important;
  color: #1d4ed8 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* --------------------------------------------------------------------------
   Bannière supérieure du document (Header fixe)
   -------------------------------------------------------------------------- */
.ttext-top-bar {
  flex-shrink: 0;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  border-radius: 0;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  color: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 100;
}

.ttext-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 260px;
}

.ttext-logo-badge {
  background: #facc15;
  color: #1e293b;
  font-weight: 800;
  font-size: 15px;
  padding: 4px 12px 4px 6px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.ttext-badge-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  vertical-align: middle;
  object-fit: cover;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.ttext-doc-name-input {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: white;
  font-size: 16px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  outline: none;
  min-width: 200px;
  max-width: 340px;
  transition: all 0.2s;
}

.ttext-doc-name-input:focus {
  background: white;
  color: #1e293b;
  border-color: #facc15;
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.3);
}

.ttext-doc-name-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.ttext-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ttext-pill-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 7px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  user-select: none;
}

.ttext-pill-btn:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: translateY(-1px);
}

.ttext-pill-btn.btn-accent {
  background: #facc15;
  color: #1e293b;
  border-color: #facc15;
}

.ttext-pill-btn.btn-accent:hover {
  background: #fde047;
}

/* --------------------------------------------------------------------------
   Bandeau d'aide interactif au survol (Hint Bar)
   -------------------------------------------------------------------------- */
.ttext-hint-bar {
  flex-shrink: 0;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 4px 16px;
  display: flex;
  align-items: center;
  min-height: 30px;
  box-sizing: border-box;
  font-size: 13px;
  color: #334155;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.ttext-hint-bar.has-hint {
  background: #eff6ff;
  border-bottom-color: #bfdbfe;
}

.ttext-hint-content {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.ttext-hint-badge {
  background: #e2e8f0;
  color: #334155;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.ttext-hint-bar.has-hint .ttext-hint-badge {
  background: #2563eb;
  color: white;
}

.ttext-hint-text {
  font-size: 13px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ttext-hint-bar.has-hint .ttext-hint-text {
  color: #1e293b;
}

.ttext-hint-text strong {
  color: #1d4ed8;
  font-size: 13.5px;
  font-weight: 800;
  margin-right: 4px;
}

/* --------------------------------------------------------------------------
   Barre d'outils principale (Toolbar) & Groupes avec étiquettes
   -------------------------------------------------------------------------- */
.ttext-toolbar {
  flex-shrink: 0;
  background: var(--ttext-toolbar-bg);
  border-bottom: 1px solid var(--ttext-border);
  padding: 6px 16px 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  user-select: none;
  z-index: 90;
}

/* Unité de groupe avec étiquette au-dessus */
.ttext-tool-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.ttext-unit-label {
  font-size: 10px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  line-height: 1;
  user-select: none;
  pointer-events: none;
}

.ttext-tool-group {
  display: flex;
  align-items: center;
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.ttext-tool-separator {
  width: 1px;
  height: 26px;
  background: #e2e8f0;
  margin: 0 2px;
}

.ttext-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #1e293b;
  min-width: 36px;
  height: 36px;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  transition: all 0.12s ease;
  position: relative;
}

.ttext-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f6cbd;
}

.ttext-btn:active {
  background: #e2e8f0;
  transform: translateY(1px);
}

.ttext-btn.active {
  background: #cde6fd !important;
  color: #0f6cbd !important;
  border: 1px solid #70b3f5 !important;
  box-shadow: inset 0 1px 2px rgba(15, 108, 189, 0.1);
}

.ttext-btn svg {
  display: block;
}

/* Icônes spécifiques Microsoft Word */
.word-icon-bold {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-weight: 900;
  font-size: 17px;
  color: inherit;
  line-height: 1;
}

.word-icon-italic {
  font-family: 'Times New Roman', Georgia, serif;
  font-style: italic;
  font-weight: 700;
  font-size: 18px;
  color: inherit;
  line-height: 1;
}

.word-icon-underline {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-weight: 700;
  font-size: 16px;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
  color: inherit;
  line-height: 1;
}

/* Bouton Couleur de Police Word (Lettre A avec barre colorée) */
.word-font-color-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}

.word-letter-a {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-weight: 800;
  font-size: 16px;
  color: #1e293b;
  line-height: 1.1;
}

.word-color-bar {
  display: block;
  width: 20px;
  height: 4px;
  border-radius: 1px;
  background-color: #dc2626; /* Rouge Word par défaut */
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

/* Bouton Surlignage Word (feutre ab avec barre) */
.word-highlight-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}

.word-highlight-bar {
  display: block;
  width: 20px;
  height: 4px;
  border-radius: 1px;
  background-color: #facc15; /* Jaune fluo Word par défaut */
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

/* Sélecteur de Taille Word (Menu déroulant numérique) */
.ttext-size-select {
  background: white;
  border: 1px solid #cbd5e1;
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  outline: none;
  min-width: 52px;
  text-align: center;
}

.ttext-size-select:hover, .ttext-size-select:focus {
  border-color: #0f6cbd;
}

.ttext-font-select {
  background: white;
  border: 1px solid #cbd5e1;
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  padding: 5px 8px;
  border-radius: 4px;
  cursor: pointer;
  outline: none;
  max-width: 155px;
}

.ttext-font-select:hover, .ttext-font-select:focus {
  border-color: #0f6cbd;
}

.ttext-font-select option {
  padding: 6px 8px;
  font-size: 14px;
}

/* Palette Popover */
.ttext-palette-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  display: none;
  width: 210px;
}

.ttext-palette-popover.show {
  display: block;
  animation: popoverFadeIn 0.15s ease-out;
}

/* Menu de choix du format d'enregistrement */
.save-menu-popover {
  width: 270px;
  left: 0;
  transform: none;
  padding: 8px;
}

.ttext-save-split-group {
  display: inline-flex;
  align-items: center;
  position: relative;
}

.ttext-btn-split-arrow {
  padding: 0 4px !important;
  min-width: 18px !important;
  margin-left: -2px;
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
}

.save-option-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: white;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  margin-bottom: 4px;
}

.save-option-btn:last-child {
  margin-bottom: 0;
}

.save-option-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.save-option-btn.active-format {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.save-fmt-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 6px;
  border-radius: 6px;
  color: white;
  min-width: 40px;
  letter-spacing: 0.5px;
}

.odt-badge {
  background: linear-gradient(135deg, #185abd, #0284c7);
}

.html-badge {
  background: linear-gradient(135deg, #ea580c, #f97316);
}

.txt-badge {
  background: linear-gradient(135deg, #475569, #64748b);
}

.save-fmt-text {
  display: flex;
  flex-direction: column;
}

.save-fmt-text strong {
  font-size: 13px;
  color: #1e293b;
  display: block;
}

.save-fmt-text small {
  font-size: 11px;
  color: #64748b;
  display: block;
}

@keyframes popoverFadeIn {
  from { opacity: 0; transform: translate(-50%, -6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.palette-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 8px;
  text-align: center;
}

.palette-swatches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  justify-items: center;
}

.swatch-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 0 1px #cbd5e1;
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
}

.swatch-btn:hover {
  transform: scale(1.15);
  box-shadow: 0 0 0 2px var(--ttext-primary);
}

.custom-color-row {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

.custom-color-input {
  width: 30px;
  height: 28px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
}

/* --------------------------------------------------------------------------
   Zone Bureau & Feuille A4 (Canvas de rédaction)
   -------------------------------------------------------------------------- */
.ttext-workspace {
  flex: 1;
  min-height: 0;
  background: var(--ttext-bg-desk);
  padding: 30px 20px 60px 20px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-y: auto;
  overflow-x: auto;
}

.ttext-paper-container {
  transition: transform 0.2s ease;
  transform-origin: top center;
}

.ttext-paper {
  background-color: var(--ttext-paper-white);
  width: 780px;
  min-height: 720px;
  padding: 60px 65px;
  border-radius: 4px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
  outline: none;
  font-family: 'Nunito', Arial, sans-serif;
  font-size: 18px;
  line-height: 1.65;
  color: #1e293b;
  position: relative;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Placeholder stylé pour la feuille */
.ttext-paper:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
  font-style: italic;
  pointer-events: none;
  display: block;
}


/* Orientation Paysage (Horizontal) */
.ttext-paper.orientation-landscape {
  width: 1020px;
  min-height: 560px;
  padding: 50px 60px;
}

/* Paragraphes ou blocs encadrés */
.ttext-boxed-block {
  border: 2px solid #3b82f6;
  background-color: #f8fafc;
  border-radius: 8px;
  padding: 12px 18px;
  margin: 14px 0;
  position: relative;
  transition: border-color 0.2s;
}

.ttext-boxed-block:hover {
  border-color: #1d4ed8;
}

/* Images insérées dans la feuille */
.ttext-paper img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  cursor: pointer;
  transition: outline 0.15s ease, box-shadow 0.15s ease;
  vertical-align: middle;
}

.ttext-paper img:hover {
  outline: 2px dashed #93c5fd;
}

.ttext-paper img.ttext-selected-img {
  outline: 3px solid #2563eb !important;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
}

/* Habillage d'image : flottement et alignement */
.ttext-paper img.ttext-img-float-left {
  float: left;
  margin: 6px 18px 12px 0;
}

.ttext-paper img.ttext-img-float-right {
  float: right;
  margin: 6px 0 12px 18px;
}

.ttext-paper img.ttext-img-center {
  display: block;
  margin: 16px auto;
  float: none;
  clear: both;
}

.ttext-paper img.ttext-img-inline {
  display: inline-block;
  vertical-align: middle;
  margin: 0 6px;
  float: none;
}

/* --------------------------------------------------------------------------
   Barre d'état inférieure (Status Bar)
   -------------------------------------------------------------------------- */
.ttext-status-bar {
  flex-shrink: 0;
  background: white;
  border-top: 1px solid var(--ttext-border);
  border-radius: 0;
  padding: 8px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: #64748b;
  font-weight: 600;
  z-index: 80;
}

.status-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.stat-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.stat-number {
  color: #0f172a;
  font-weight: 800;
}

/* Badge compteur pour l'objectif de 500 caractères */
.stat-char-badge {
  padding: 3px 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.stat-char-badge.warning {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  font-weight: 800;
}
.stat-char-badge.warning .stat-number {
  color: #b45309;
}

.stat-char-badge.exceeded {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  font-weight: 800;
}
.stat-char-badge.exceeded .stat-number {
  color: #b91c1c;
}

.status-badge {
  background: #f1f5f9;
  color: #334155;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-badge.highlight {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.status-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-school-brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: none;
  padding: 0;
  margin-left: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  user-select: none;
}

.status-school-logo {
  height: 20px;
  width: auto;
  max-width: 50px;
  object-fit: contain;
  vertical-align: middle;
}

.status-school-copy {
  letter-spacing: 0.2px;
  font-weight: 700;
  color: #475569;
}

/* --------------------------------------------------------------------------
   Modales d'aide & de modèles
   -------------------------------------------------------------------------- */
.ttext-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.ttext-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.ttext-modal-card {
  background: white;
  border-radius: 20px;
  max-width: 650px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  transform: scale(0.92);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.ttext-modal-overlay.active .ttext-modal-card {
  transform: scale(1);
}

.ttext-modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border-radius: 20px 20px 0 0;
}

.ttext-modal-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ttext-modal-close {
  background: transparent;
  border: none;
  font-size: 24px;
  color: #94a3b8;
  cursor: pointer;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.ttext-modal-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.ttext-modal-body {
  padding: 22px 24px;
  overflow-y: auto;
}


.tips-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tip-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #f8fafc;
  padding: 12px 14px;
  border-radius: 10px;
  border-left: 4px solid var(--ttext-primary);
}

.tip-icon {
  font-size: 24px;
  line-height: 1;
}

.tip-text h4 {
  margin: 0 0 4px 0;
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
}

.tip-text p {
  margin: 0;
  font-size: 13px;
  color: #475569;
  line-height: 1.4;
}

/* Notification Toast */
.ttext-toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: #1e293b;
  color: white;
  padding: 12px 22px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ttext-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Impression propre (Feuille A4 seule)
   -------------------------------------------------------------------------- */
@media print {
  /* Masquer tous les éléments du site et de l'interface */
  body {
    background: white !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  #haut, #menu, .header-actions, #filrouge, .centered-text, #bas, footer,
  .ttext-top-bar, .ttext-toolbar, .ttext-status-bar, .ttext-modal-overlay, .ttext-toast {
    display: none !important;
  }

  .ttext-wrapper {
    max-width: 100% !important;
    margin: 0 !important;
  }

  .ttext-workspace {
    background: white !important;
    padding: 0 !important;
    border: none !important;
  }

  .ttext-paper-container {
    transform: none !important;
  }

  .ttext-paper {
    width: 100% !important;
    min-height: auto !important;
    box-shadow: none !important;
    padding: 20mm !important;
    border: none !important;
    background-image: none !important; /* Pas de réglure à l'impression */
  }
}

/* --------------------------------------------------------------------------
   Responsive Mobile & Tablette
   -------------------------------------------------------------------------- */
@media (max-width: 820px) {
  .ttext-paper {
    width: 95vw;
    padding: 35px 25px;
  }

  .ttext-toolbar {
    gap: 6px;
    padding: 8px;
  }

  .ttext-btn {
    min-width: 32px;
    height: 32px;
    font-size: 14px;
    padding: 2px 6px;
  }
}

/* --------------------------------------------------------------------------
   Pinceau de mise en forme (Format Painter)
   -------------------------------------------------------------------------- */
#btn-format-painter.active {
  background: #dbeafe !important;
  border-color: #2563eb !important;
  color: #1d4ed8 !important;
  box-shadow: inset 0 2px 4px rgba(37, 99, 235, 0.2);
}

body.format-painter-active #ttext-editor {
  cursor: crosshair !important;
}

/* --------------------------------------------------------------------------
   Barre d'outils flottante pour les images
   -------------------------------------------------------------------------- */
.image-floating-toolbar {
  position: absolute;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1e293b;
  color: white;
  padding: 6px 12px;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  font-size: 13px;
  user-select: none;
  animation: ttextToolbarPop 0.15s ease-out;
}

@keyframes ttextToolbarPop {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.img-tool-section {
  display: flex;
  align-items: center;
  gap: 4px;
}

.img-tool-label {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 700;
  text-transform: uppercase;
  margin-right: 2px;
}

.img-tool-btn {
  background: #334155;
  color: #f8fafc;
  border: none;
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.img-tool-btn:hover {
  background: #475569;
  color: white;
}

.img-tool-btn.active {
  background: #2563eb;
  color: white;
}

.img-tool-divider {
  width: 1px;
  height: 18px;
  background: #475569;
  margin: 0 4px;
}

.img-tool-delete {
  background: #dc2626;
  color: white;
}

.img-tool-delete:hover {
  background: #b91c1c;
}

/* Bouton insertion d'image dans la toolbar */
.btn-insert-image-toolbar {
  background: #ecfdf5 !important;
  border-color: #a7f3d0 !important;
}

.btn-insert-image-toolbar:hover {
  background: #d1fae5 !important;
  border-color: #6ee7b7 !important;
}

/* --------------------------------------------------------------------------
   Modale Image & Stickers scolaires
   -------------------------------------------------------------------------- */
.image-modal-card {
  max-width: 580px;
}

.image-upload-zone {
  border: 2px dashed #93c5fd;
  background: #eff6ff;
  border-radius: 12px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.image-upload-zone:hover {
  background: #dbeafe;
  border-color: #2563eb;
}

.image-upload-zone.dragover {
  background: #bfdbfe;
  border-color: #1d4ed8;
  transform: scale(1.02);
}

.upload-icon {
  font-size: 34px;
  margin-bottom: 6px;
}

.upload-title {
  font-size: 15px;
  color: #1e3a8a;
  margin-bottom: 4px;
}

.upload-desc {
  font-size: 13px;
  color: #64748b;
  margin: 0;
}

.modal-divider-text {
  text-align: center;
  position: relative;
  margin: 20px 0 16px;
}

.modal-divider-text::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 100%;
  height: 1px;
  background: #e2e8f0;
  z-index: 1;
}

.modal-divider-text span {
  position: relative;
  background: white;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 800;
  color: #94a3b8;
  letter-spacing: 0.5px;
  z-index: 2;
}

.stickers-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.sticker-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 6px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sticker-card:hover {
  background: white;
  border-color: #3b82f6;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.sticker-card img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  margin-bottom: 6px;
}

.sticker-card span {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
}
