/* ═══════════════════════════════════════════════════════════════
   BLOC-NOTES PROJET — modale plein écran (Quill, sections + pages)
   Restaure le CSS perdu : ouvre en overlay flottant au-dessus de la page.
   ═══════════════════════════════════════════════════════════════ */

/* Bloque le scroll du body quand l'overlay est ouvert */
body.project-notebook-open { overflow: hidden; }

/* ── Overlay plein écran ── */
.project-notebook-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: pnb-fade-in 0.18s ease-out;
}
@keyframes pnb-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Modale principale ── */
.project-notebook-shell {
  width: 100%;
  max-width: 1400px;
  height: 100%;
  max-height: 100%;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  animation: pnb-pop 0.22s ease-out;
}
@keyframes pnb-pop {
  from { transform: translateY(8px) scale(0.985); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* ── Header ── */
.project-notebook-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(180deg, #fafbfc 0%, #ffffff 100%);
}
.project-notebook-header-title {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  flex: 1;
  min-width: 0;
}
.project-notebook-h1 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #111827;
}
.project-notebook-project {
  font-size: 0.85rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-notebook-header-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

/* ── Body : 2 colonnes (rail + main) ── */
.project-notebook-body {
  flex: 1;
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 0;
  overflow: hidden;
}

/* ── Rail (sidebar gauche : sections) ── */
.project-notebook-rail {
  background: #f8fafc;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.project-notebook-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.85rem 0.55rem;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #475569;
}
.project-notebook-rail-head .btn { padding: 0.15rem 0.55rem; font-size: 0.9rem; }
.project-notebook-section-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.4rem 0.4rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.project-notebook-section-btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  font-size: 0.88rem;
  color: #111827;
  transition: background 0.12s, border-color 0.12s;
  font-family: inherit;
}
.project-notebook-section-btn:hover { background: #eef2ff; }
.project-notebook-section-btn.active {
  background: #ffffff;
  border-color: #c7d2fe;
  box-shadow: 0 1px 2px rgba(15,23,42,0.06);
  font-weight: 600;
}
.project-notebook-section-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}
.project-notebook-section-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-notebook-rail-foot {
  flex-shrink: 0;
  padding: 0.55rem 0.65rem 0.75rem;
  border-top: 1px solid #e5e7eb;
}

/* ── Main (zone éditeur) ── */
.project-notebook-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.project-notebook-pages-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid #e5e7eb;
  background: #fafbfc;
}
.project-notebook-pages-tabs {
  display: flex;
  gap: 0.3rem;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: thin;
}
.project-notebook-page-tab {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.85rem;
  border: 1px solid #d1d5db;
  background: #ffffff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #374151;
  white-space: nowrap;
  font-family: inherit;
  transition: all 0.12s;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-notebook-page-tab:hover { background: #f3f4f6; border-color: #9ca3af; }
.project-notebook-page-tab.active {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #ffffff;
  font-weight: 600;
}

.project-notebook-editor-panel {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem 5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 0;
}
.project-notebook-field-label {
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: #6b7280;
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 0.4rem;
}
.project-notebook-page-title-input {
  font-size: 1.45rem;
  font-weight: 700;
  padding: 0.5rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  width: 100%;
  color: #111827;
}
.project-notebook-page-title-input:hover { border-color: #e5e7eb; }
.project-notebook-page-title-input:focus {
  outline: none;
  border-color: #4f46e5;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.project-notebook-editor-mount {
  flex: 1;
  min-height: 280px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.project-notebook-editor-mount .ql-toolbar {
  border: none;
  border-bottom: 1px solid #e5e7eb;
  background: #fafbfc;
}
.project-notebook-editor-mount .ql-container {
  border: none;
  flex: 1;
  font-size: 0.95rem;
  font-family: 'Inter', -apple-system, sans-serif;
}
.project-notebook-editor-mount .ql-editor {
  padding: 1rem 1.25rem;
  min-height: 240px;
}

.project-notebook-editor-loading {
  text-align: center;
  color: #6b7280;
  padding: 1rem;
}

.project-notebook-body-textarea {
  width: 100%;
  min-height: 280px;
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 0.92rem;
  resize: vertical;
}

.project-notebook-plain {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 0.95rem;
  line-height: 1.55;
  margin: 0;
  background: transparent;
  padding: 0;
}

/* ── FAB Enregistrer (flottant bas-droite) ── */
.project-notebook-fab-save {
  position: absolute;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 5;
  padding: 0.7rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(79, 70, 229, 0.35);
  border: none;
  cursor: pointer;
}

/* ── États "armé" pour suppression confirmée ── */
.project-notebook-delete-secondary {
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.project-notebook-delete-armed,
.project-notebook-delete-armed:hover {
  background: #dc2626 !important;
  color: #ffffff !important;
  border-color: #dc2626 !important;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .project-notebook-overlay { padding: 0; }
  .project-notebook-shell { border-radius: 0; max-width: none; height: 100%; max-height: 100%; }
  .project-notebook-body { grid-template-columns: 1fr; }
  .project-notebook-rail {
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
    max-height: 28vh;
  }
}

/* ═══════════════════════════════════════════════════════════════
   APERÇU TUILE NOTES (sur la page projet)
   ═══════════════════════════════════════════════════════════════ */
.project-notes-tile-preview {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.project-notes-preview-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid #f1f5f9;
  border-radius: 4px;
  transition: background 0.12s;
}
.project-notes-preview-row:last-child { border-bottom: none; }
.project-notes-preview-row--link {
  cursor: pointer;
}
.project-notes-preview-row--link:hover {
  background: #f9fafb;
}
.project-notes-preview-main {
  flex: 1;
  min-width: 0;
}
.project-notes-preview-title {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: #111827;
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-notes-preview-excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.78rem;
  color: #6b7280;
  line-height: 1.4;
}

.project-notes-tile-wrap {
  cursor: pointer;
}
.project-notes-tile-wrap:hover {
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}
