/* ============================================================
   Rich Editor — styles toolbar + zone éditable
   Fichier source : src/styles/editor.css
   Importé par src/index.js → compilé dans assets/editor.css
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --ned-primary:    #0d6efd;
  --ned-active-bg:  #e8f0fe;
  --ned-border:     #dee2e6;
  --ned-toolbar-bg: #f8f9fa;
  --ned-btn-hover:  #e9ecef;
  --ned-radius:     4px;
  --ned-shadow:     0 2px 8px rgba(0,0,0,.15);
}

/* ── Toolbar ───────────────────────────────────────────────── */
.ned-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 6px 8px;
  background: var(--ned-toolbar-bg);
  border: 1px solid var(--ned-border);
  border-bottom: none;
  border-radius: var(--ned-radius) var(--ned-radius) 0 0;
  align-items: center;
}

.ned-btn-group {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 0 4px;
  border-right: 1px solid var(--ned-border);
}
.ned-btn-group:last-child { border-right: none; }

/* ── Boutons ───────────────────────────────────────────────── */
.ned-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--ned-radius);
  cursor: pointer;
  font-size: 14px;
  color: #333;
  transition: background .1s, border-color .1s;
}
.ned-btn:hover  { background: var(--ned-btn-hover); border-color: var(--ned-border); }
.ned-btn.ned-active { background: var(--ned-active-bg); border-color: var(--ned-primary); color: var(--ned-primary); }
.ned-btn:disabled { opacity: .4; cursor: default; }
.ned-btn-text { width: auto; padding: 0 6px; font-size: 12px; font-weight: 600; }

/* ── Selects ───────────────────────────────────────────────── */
.ned-select {
  height: 28px;
  padding: 0 4px;
  border: 1px solid var(--ned-border);
  border-radius: var(--ned-radius);
  background: #fff;
  font-size: 13px;
  color: #333;
  cursor: pointer;
}
.ned-fmt-select  { width: 120px; }
.ned-font-select { width: 140px; }
.ned-size-select { width: 70px; }

/* ── Couleurs ──────────────────────────────────────────────── */
.ned-color-btn {
  position: relative;
  width: 32px;
}
.ned-color-indicator {
  display: block;
  width: 18px;
  height: 3px;
  border-radius: 1px;
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
}
.ned-color-picker {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 9999;
  background: #fff;
  border: 1px solid var(--ned-border);
  border-radius: var(--ned-radius);
  box-shadow: var(--ned-shadow);
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(8, 20px);
  gap: 2px;
  min-width: 190px;
}
.ned-swatch {
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 2px;
  border: 1px solid rgba(0,0,0,.1);
  cursor: pointer;
  transition: transform .1s;
}
.ned-swatch:hover { transform: scale(1.2); border-color: #555; }
.ned-color-reset {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding: 3px 6px;
  font-size: 11px;
  background: #f1f1f1;
  border: 1px solid var(--ned-border);
  border-radius: var(--ned-radius);
  cursor: pointer;
  text-align: center;
}
.ned-color-reset:hover { background: #e2e6ea; }

/* ── Zone éditable ─────────────────────────────────────────── */
.ned-prosemirror-mount { width: 100%; }

.ned-content {
  outline: none;
  min-height: 300px;
  padding: 1rem;
  font-size: 14px;
  line-height: 1.6;
  color: #212529;
  font-family: Arial, sans-serif;
}

/* Curseur texte */
.ned-content *::selection { background: #b3d4ff; }

/* Styles de contenu */
.ned-content h1 { font-size: 2em;   font-weight: 700; margin: .67em 0; }
.ned-content h2 { font-size: 1.5em; font-weight: 700; margin: .75em 0; }
.ned-content h3 { font-size: 1.17em;font-weight: 700; margin: .83em 0; }
.ned-content h4 { font-size: 1em;   font-weight: 700; margin: 1.12em 0; }
.ned-content p  { margin: 0 0 .8em; }
.ned-content blockquote {
  border-left: 4px solid #adb5bd;
  margin: 1em 0;
  padding: .5em 1em;
  color: #6c757d;
  background: #f8f9fa;
}
.ned-content pre {
  background: #2d2d2d;
  color: #f8f8f2;
  padding: 1em;
  border-radius: var(--ned-radius);
  overflow-x: auto;
  font-family: "Courier New", monospace;
  font-size: 13px;
}
.ned-content code { background: #e9ecef; padding: 1px 4px; border-radius: 3px; font-family: "Courier New", monospace; font-size: 88%; }
.ned-content pre code { background: none; padding: 0; }
.ned-content ul,
.ned-content ol { padding-left: 1.5em; margin: 0 0 .8em; }
.ned-content li { margin: .2em 0; }
.ned-content hr { border: none; border-top: 2px solid var(--ned-border); margin: 1.5em 0; }
.ned-content a  { color: var(--ned-primary); text-decoration: underline; }

/* Tables */
.ned-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
}
.ned-content td,
.ned-content th {
  border: 1px solid #adb5bd;
  padding: 6px 10px;
  min-width: 40px;
}
.ned-content th {
  background: #f1f3f5;
  font-weight: 700;
  text-align: left;
}
.ned-content .selectedCell::after {
  background: rgba(200,200,255,.4);
  content: "";
  left: 0; right: 0; top: 0; bottom: 0;
  position: absolute;
  z-index: 2;
  pointer-events: none;
}
.ned-content .column-resize-handle {
  position: absolute;
  right: -2px; top: 0; bottom: 0;
  width: 4px;
  background: #aaaaff;
  cursor: col-resize;
  z-index: 3;
}

/* Images */
.ned-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--ned-radius);
}
.ned-content img.ned-img-left   { float: left;  margin: 0 1em 1em 0; }
.ned-content img.ned-img-right  { float: right; margin: 0 0 1em 1em; }
.ned-content img.ned-img-center { display: block; margin: 1em auto; }
.ned-content img.ned-img-full   { width: 100%; float: none; margin: 1em 0; }

/* Colonnes */
.ned-content .ned-cols {
  display: flex;
  gap: 1.5em;
  margin: 1em 0;
}
.ned-content .ned-col {
  flex: 1;
  min-width: 0;
}

/* Lettrine */
.ned-content p.ned-dropcap::first-letter {
  float: left;
  font-size: 3.5em;
  line-height: .8;
  margin: .05em .1em 0 0;
  font-weight: 700;
}

/* Drag & drop highlight */
.ned-dragover { outline: 2px dashed var(--ned-primary) !important; }

/* ── Barre de statut ───────────────────────────────────────── */
.ned-status {
  padding: 4px 10px;
  background: var(--ned-toolbar-bg);
  border: 1px solid var(--ned-border);
  border-top: none;
  border-radius: 0 0 var(--ned-radius) var(--ned-radius);
  font-size: 12px;
  color: #6c757d;
  display: flex;
  gap: 1em;
}

/* ── Modals ────────────────────────────────────────────────── */
.ned-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}
.ned-modal[style*="flex"] { display: flex !important; }
.ned-modal-dialog {
  background: #fff;
  border-radius: 6px;
  box-shadow: var(--ned-shadow);
  min-width: 360px;
  max-width: 90vw;
}
.ned-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ned-border);
}
.ned-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #6c757d;
  line-height: 1;
}
.ned-modal-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ned-modal-body label { font-size: 13px; font-weight: 600; margin: 0; }
.ned-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--ned-border);
}
.ned-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--ned-border);
  border-radius: var(--ned-radius);
  font-size: 14px;
}
.ned-btn-primary {
  padding: 6px 16px;
  background: var(--ned-primary);
  color: #fff;
  border: none;
  border-radius: var(--ned-radius);
  cursor: pointer;
  font-size: 14px;
}
.ned-btn-primary:hover { background: #0b5ed7; }
.ned-btn-secondary {
  padding: 6px 16px;
  background: #dc3545;
  color: #fff;
  border: none;
  border-radius: var(--ned-radius);
  cursor: pointer;
  font-size: 14px;
}
.ned-btn-secondary:hover { background: #bb2d3b; }

