/* ═══════════════════════════════════════════════════════════════════════
   Plugin doc — éditeur WYSIWYG (Google Docs equivalent).
   Fenêtre flottante + toolbar + page A4 simulée + launcher modal.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Fenêtre flottante ─────────────────────────────────────────────── */
.doc-float-window {
  position: fixed;
  display: flex;
  flex-direction: column;
  background: rgba(8, 14, 28, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 10px;
  box-shadow:
    0 18px 60px rgba(0, 0, 0, 0.55),
    0 0 24px rgba(88, 200, 255, 0.14);
  overflow: hidden;
  font-family: var(--font-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
  color: var(--fg, #cdd6f4);
  animation: doc-win-in 0.18s ease-out;
}
@keyframes doc-win-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }
.doc-float-window.doc-float-window-maximized { border-radius: 0; box-shadow: none; }

.doc-float-window-titlebar {
  display: flex; align-items: center; justify-content: space-between;
  height: 34px; padding: 0 12px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: grab; user-select: none; flex-shrink: 0;
}
.doc-float-window-titlebar:active { cursor: grabbing; }
.doc-float-window-titlebar-left { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.doc-float-window-title {
  font-size: 13px; font-weight: 600;
  color: var(--fg, #cdd6f4);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: 0.01em; margin-left: 6px;
}

.doc-float-window-body {
  flex: 1;
  display: flex; flex-direction: column;
  overflow: hidden;
  background: #0d1117;
}

/* ── Toolbar ───────────────────────────────────────────────────────── */
.doc-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  font-size: 12px;
}
.doc-tb-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; height: 26px;
  padding: 0 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  color: var(--fg, #cdd6f4);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.doc-tb-btn:hover {
  background: rgba(88, 200, 255, 0.14);
  border-color: rgba(88, 200, 255, 0.28);
}
.doc-tb-btn:active { transform: translateY(1px); }
.doc-tb-select {
  height: 26px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  color: var(--fg, #cdd6f4);
  font-size: 12px;
  padding: 0 6px;
  cursor: pointer;
}
.doc-tb-color {
  width: 28px; height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 0 2px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}
.doc-tb-sep {
  width: 1px; height: 18px;
  background: rgba(255, 255, 255, 0.10);
  margin: 0 4px;
  flex-shrink: 0;
}

/* ── Canvas + page A4 ──────────────────────────────────────────────── */
.doc-canvas {
  flex: 1; min-height: 0;
  overflow: auto;
  background: #1a1a1a;
  padding: 24px 0;
}
.doc-page {
  width: min(21cm, calc(100% - 48px));
  min-height: 27cm;
  margin: 0 auto;
  padding: 2.5cm 2cm;
  background: #f5f1e8;
  color: #1a1a1a;
  border-radius: 4px;
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.45);
  font-family: 'Calibri', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  outline: none;
}
.doc-page:focus { outline: 2px solid rgba(88, 200, 255, 0.20); outline-offset: 2px; }
.doc-page p { margin: 0 0 10px; }
.doc-page h1 { font-size: 26px; margin: 0 0 14px; font-weight: 700; }
.doc-page h2 { font-size: 20px; margin: 22px 0 10px; font-weight: 700; }
.doc-page h3 { font-size: 17px; margin: 18px 0 8px; font-weight: 600; }
.doc-page h4 { font-size: 15px; margin: 14px 0 6px; font-weight: 600; }
.doc-page ul, .doc-page ol { margin: 0 0 12px; padding-left: 28px; }
.doc-page li { margin: 2px 0; }
.doc-page a { color: #1a4ea8; text-decoration: underline; }
.doc-page img { max-width: 100%; height: auto; }
.doc-page table { border-collapse: collapse; margin: 12px 0; font-size: 13px; }
.doc-page th, .doc-page td { border: 1px solid #c9c2b3; padding: 6px 10px; text-align: left; vertical-align: top; }
.doc-page th { background: #ebe5d4; font-weight: 600; }
.doc-page blockquote {
  margin: 10px 0; padding: 6px 14px;
  border-left: 3px solid #b9a87c;
  color: #444; background: rgba(0, 0, 0, 0.02);
}
.doc-page pre {
  background: #2a2a2a; color: #f5f1e8;
  padding: 12px 14px; border-radius: 4px;
  overflow-x: auto;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.45;
}
.doc-page hr { border: 0; border-top: 1px solid #c9c2b3; margin: 18px 0; }

/* ── Launcher modal ────────────────────────────────────────────────── */
.doc-launcher-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.doc-launcher {
  background: var(--bg-secondary, #1e1e2e);
  color: var(--text-primary, #cdd6f4);
  border: 1px solid var(--border-color, #45475a);
  border-radius: 10px;
  width: 100%; max-width: 520px;
  max-height: 80vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.55);
}
.doc-launcher-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color, #313244);
  background: var(--bg-tertiary, #181825);
  font-weight: 600;
  color: var(--accent-primary, #cba6f7);
}
.doc-launcher-close {
  background: transparent; border: none; color: inherit; cursor: pointer;
  font-size: 18px; padding: 4px 8px; border-radius: 4px;
}
.doc-launcher-close:hover { background: var(--bg-hover, #313244); }
.doc-launcher-body { padding: 14px; overflow-y: auto; }
.doc-launcher-new {
  width: 100%; padding: 10px;
  background: var(--accent-primary, #cba6f7);
  color: #1e1e2e; border: none; border-radius: 6px;
  font-weight: 600; font-size: 13px;
  cursor: pointer; margin-bottom: 12px;
}
.doc-launcher-new:hover { filter: brightness(1.08); }
.doc-launcher-list { display: flex; flex-direction: column; gap: 6px; }
.doc-launcher-item {
  display: flex; flex-direction: column; align-items: flex-start;
  width: 100%; padding: 10px 12px;
  background: var(--bg-tertiary, #181825);
  border: 1px solid var(--border-color, #313244);
  border-radius: 6px;
  color: inherit;
  cursor: pointer; text-align: left;
  transition: border-color .12s, background .12s;
}
.doc-launcher-item:hover {
  border-color: var(--accent-primary, #cba6f7);
  background: var(--bg-hover, #313244);
}
.doc-launcher-item-name { font-weight: 600; font-size: 13px; }
.doc-launcher-item-meta { font-size: 11px; color: var(--text-secondary, #a6adc8); margin-top: 2px; }
.doc-launcher-empty {
  text-align: center;
  color: var(--text-secondary, #a6adc8);
  padding: 24px;
  font-size: 12px;
  font-style: italic;
}
