/* ── RESET & BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink:        #2C1A0E;
  --leather:    #5C3D1E;
  --parch-dark: #A0714F;
  --parch:      #D4B483;
  --vellum:     #F2E8D5;
  --vellum-off: #EAD9BF;
  --accent:     #8B2500;
  --gold:       #C8973A;
  --shadow:     rgba(44,26,14,0.35);
  --font-title: 'Cinzel', serif;
  --font-body:  'IM Fell English', serif;
  --font-mono:  'Courier Prime', monospace;
}

html, body { height: 100%; background-color: var(--ink); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.7; }

body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 9999; opacity: 0.6;
}

/* ════════════════════════════════
   ÉCRAN DE CONNEXION ADMIN
════════════════════════════════ */
#loginScreen {
  display: none;
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at center, #3a2010 0%, #1a0d05 100%);
  z-index: 500;
  align-items: center; justify-content: center;
  flex-direction: column;
}
#loginScreen.open { display: flex; }

.login-box {
  background: var(--vellum);
  border: 2px solid var(--gold);
  border-radius: 4px;
  padding: 2.5rem 2.25rem 2rem;
  width: 360px;
  max-width: 90vw;
  box-shadow: 0 12px 60px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.1);
  text-align: center;
}

.login-seal {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.login-title {
  font-family: var(--font-title);
  font-size: 1.1rem;
  color: var(--leather);
  letter-spacing: 0.08em;
  margin-bottom: 0.25rem;
}

.login-subtitle {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.82rem;
  color: var(--parch-dark);
  margin-bottom: 1.75rem;
}

.login-ornament {
  color: var(--gold);
  letter-spacing: 0.6em;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
  display: block;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 1.1rem;
  text-align: left;
}

.login-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--parch-dark);
}

.login-input {
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: var(--vellum-off);
  border: 1px solid var(--parch);
  border-radius: 3px;
  color: var(--ink);
  padding: 0.5rem 0.75rem;
  outline: none;
  width: 100%;
  transition: border-color 0.15s;
}
.login-input:focus { border-color: var(--leather); }

.login-error {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
  min-height: 1rem;
  text-align: center;
}

.login-btn {
  font-family: var(--font-title);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  background: var(--leather);
  color: var(--vellum);
  border: none;
  border-radius: 3px;
  padding: 0.6rem 1.5rem;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s;
  box-shadow: 0 2px 8px var(--shadow);
}
.login-btn:hover { background: var(--ink); }

.login-cancel {
  margin-top: 0.9rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-style: italic;
  color: var(--parch-dark);
  cursor: pointer;
  background: none;
  border: none;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.login-cancel:hover { color: var(--leather); }

/* ════════════════════════════════
   LAYOUT PRINCIPAL
════════════════════════════════ */
.app {
  display: grid;
  grid-template-columns: 240px 1fr 400px;
  grid-template-rows: 56px 1fr;
  height: 100vh;
}

/* ── HEADER ── */
header {
  grid-column: 1 / -1;
  background: var(--leather);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  border-bottom: 3px solid var(--gold);
  box-shadow: 0 2px 12px var(--shadow);
  position: relative; z-index: 10;
}

.site-title {
  font-family: var(--font-title);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--vellum);
  letter-spacing: 0.08em;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
  display: flex; align-items: center; gap: 0.5rem;
}
.site-title .ornament { color: var(--gold); font-size: 1.1rem; }

.header-right { display: flex; gap: 0.6rem; align-items: center; }

/* Badge mode admin */
.admin-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  background: rgba(200,151,58,0.2);
  color: var(--gold);
  border: 1px solid rgba(200,151,58,0.4);
  padding: 2px 8px;
  border-radius: 2px;
  display: none;
}
.is-admin .admin-badge { display: inline; }
.is-admin #newEntryBtn { display: inline-flex; }
#newEntryBtn { display: none; }

/* Bouton connexion/déconnexion */
.auth-btn {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  background: transparent;
  border: 1px solid rgba(212,180,131,0.3);
  color: rgba(212,180,131,0.7);
  border-radius: 3px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.auth-btn:hover { border-color: var(--parch); color: var(--parch); }

/* ── SIDEBAR ── */
.sidebar {
  background: linear-gradient(180deg, #3a2010 0%, #2C1A0E 100%);
  border-right: 2px solid var(--leather);
  overflow-y: auto;
  padding: 1rem 0;
  display: flex; flex-direction: column;
}

.sidebar-section-title {
  font-family: var(--font-title);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--parch-dark);
  padding: 0.75rem 1rem 0.4rem;
}

.folder-list { list-style: none; display: flex; flex-direction: column; gap: 3px; padding: 0 0.6rem; }

.folder-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.45rem 0.7rem;
  border-radius: 3px; cursor: pointer;
  font-family: var(--font-body); font-size: 0.88rem;
  color: var(--parch);
  border-left: 3px solid transparent;
  transition: all 0.15s; position: relative;
}
.folder-item:hover { background: rgba(160,113,79,0.15); color: var(--vellum); border-left-color: var(--parch-dark); }
.folder-item.active { background: rgba(200,151,58,0.12); color: var(--gold); border-left-color: var(--gold); font-style: italic; }
.folder-item .folder-icon { font-size: 1rem; flex-shrink: 0; }

.folder-count {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 0.7rem; color: var(--parch-dark);
  background: rgba(0,0,0,0.2); padding: 1px 5px; border-radius: 2px;
}

/* Actions sur grimoire — admin seulement */
.folder-item-actions { display: none; gap: 2px; }
.folder-item:hover .folder-item-actions { display: flex; }
.is-admin .folder-item-actions { display: none; } /* géré par JS */

.folder-action-btn {
  background: none; border: none; cursor: pointer;
  font-size: 0.75rem; padding: 1px 3px; border-radius: 2px;
  color: var(--parch-dark); line-height: 1;
  transition: all 0.15s;
}
.folder-action-btn:hover { background: rgba(0,0,0,0.2); color: var(--vellum); }
.folder-action-btn.danger:hover { color: #ff6b6b; }

.add-folder-btn {
  margin: 0.5rem 0.6rem;
  background: none; border: 1px dashed var(--leather);
  color: var(--parch-dark); font-family: var(--font-body); font-size: 0.82rem;
  padding: 0.4rem 0.7rem; border-radius: 3px; cursor: pointer; text-align: left;
  transition: all 0.15s; display: none;
}
.is-admin .add-folder-btn { display: block; }
.add-folder-btn:hover { border-color: var(--parch); color: var(--parch); }

.sidebar-divider { height: 1px; background: linear-gradient(90deg, transparent, var(--leather), transparent); margin: 0.75rem 0.6rem; }

/* ── FIL ── */
.feed {
  background: var(--vellum-off);
  overflow-y: auto; padding: 1.5rem 1.25rem;
  display: flex; flex-direction: column;
}

.feed-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.2rem; padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--parch-dark);
  flex-wrap: wrap; gap: 0.5rem;
}

.feed-title { font-family: var(--font-title); font-size: 1rem; color: var(--leather); letter-spacing: 0.05em; }

.feed-search {
  font-family: var(--font-body); font-size: 0.82rem;
  background: var(--vellum); border: 1px solid var(--parch);
  border-radius: 3px; color: var(--ink); padding: 0.25rem 0.6rem;
  outline: none; width: 160px;
  transition: border-color 0.15s;
}
.feed-search:focus { border-color: var(--parch-dark); }
.feed-search::placeholder { color: var(--parch-dark); font-style: italic; }

/* Entrée */
.entry {
  position: relative; padding: 1.1rem 1.2rem 1.1rem 1.5rem;
  border-left: 3px solid var(--parch-dark);
  cursor: pointer; transition: background 0.15s;
}
.entry + .entry::before {
  content: '❧'; display: block; text-align: center;
  color: var(--parch-dark); font-size: 0.9rem;
  margin: 0 0 0 -1.5rem; line-height: 1; padding: 0.2rem 0;
}
.entry:hover { background: rgba(160,113,79,0.08); }
.entry.selected { background: rgba(200,151,58,0.1); border-left-color: var(--gold); }

.entry-meta { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.entry-date { font-family: var(--font-mono); font-size: 0.72rem; color: var(--parch-dark); }
.entry-folder-tag {
  font-family: var(--font-mono); font-size: 0.68rem;
  background: var(--leather); color: var(--vellum);
  padding: 1px 6px; border-radius: 2px;
}
.entry-title { font-family: var(--font-title); font-size: 0.95rem; font-weight: 600; color: var(--ink); margin-bottom: 0.25rem; line-height: 1.3; }
.entry-excerpt {
  font-family: var(--font-body); font-size: 0.85rem; color: var(--leather);
  line-height: 1.5; font-style: italic;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.entry-tags { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-top: 0.5rem; }

.tag {
  font-family: var(--font-mono); font-size: 0.68rem;
  color: var(--accent); background: rgba(139,37,0,0.08);
  border: 1px solid rgba(139,37,0,0.2);
  padding: 1px 7px; border-radius: 10px; cursor: pointer; transition: all 0.15s;
}
.tag:hover { background: rgba(139,37,0,0.15); }
.tag.active { background: var(--accent); color: var(--vellum); }

/* Actions entrée — admin seulement, gérées en JS */
.entry-actions { position: absolute; right: 0.75rem; top: 0.75rem; display: none; gap: 0.3rem; }
.entry:hover .entry-actions.admin-visible { display: flex; }
.icon-btn {
  background: none; border: none; cursor: pointer;
  font-size: 0.9rem; padding: 3px 5px; border-radius: 3px;
  color: var(--parch-dark); transition: all 0.15s;
}
.icon-btn:hover { background: rgba(0,0,0,0.1); color: var(--ink); }
.icon-btn.danger:hover { color: var(--accent); }

.empty-feed { text-align: center; padding: 3rem 1rem; color: var(--parch-dark); font-style: italic; }
.empty-feed .empty-ornament { font-size: 2rem; display: block; margin-bottom: 0.75rem; }

/* ── PANNEAU DROIT (viewer / éditeur) ── */
.right-panel {
  background: var(--vellum);
  border-left: 2px solid var(--parch);
  display: flex; flex-direction: column; overflow: hidden;
}

/* Viewer */
#viewerView { display: flex; flex-direction: column; height: 100%; }

.viewer-header {
  padding: 1.1rem 1.5rem 0.9rem;
  border-bottom: 1px solid var(--parch);
  background: var(--vellum-off);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem;
}
.viewer-title { font-family: var(--font-title); font-size: 1.2rem; color: var(--ink); line-height: 1.3; }
.viewer-body {
  flex: 1; padding: 1.5rem 1.75rem; overflow-y: auto;
  font-family: var(--font-body); font-size: 0.97rem; line-height: 1.9;
  color: var(--ink); white-space: pre-wrap;
}
.viewer-footer {
  padding: 0.75rem 1.5rem; border-top: 1px solid var(--parch);
  background: var(--vellum-off);
  display: flex; justify-content: space-between; align-items: center;
}

/* Welcome pane */
#welcomeView {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; text-align: center; padding: 2rem;
  color: var(--parch-dark); font-style: italic;
}
.welcome-icon { font-size: 2.5rem; margin-bottom: 1rem; display: block; }
#welcomeView p { max-width: 240px; font-size: 0.88rem; line-height: 1.6; }

/* Éditeur */
#editorView { display: none; flex-direction: column; height: 100%; }

.editor-toolbar {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1rem; background: var(--vellum-off);
  border-bottom: 1px solid var(--parch-dark); flex-wrap: wrap;
}
.editor-toolbar-title { font-family: var(--font-title); font-size: 0.72rem; letter-spacing: 0.1em; color: var(--parch-dark); margin-right: auto; }

.editor-body { flex: 1; display: flex; flex-direction: column; padding: 1.25rem 1.5rem; overflow-y: auto; gap: 0.75rem; }

.editor-title-input {
  font-family: var(--font-title); font-size: 1.3rem; font-weight: 600;
  border: none; background: transparent; color: var(--ink); outline: none;
  border-bottom: 1px solid var(--parch); padding-bottom: 0.5rem; width: 100%;
}
.editor-title-input::placeholder { color: var(--parch-dark); font-weight: 400; }

.editor-meta-row { display: flex; gap: 0.75rem; align-items: flex-start; flex-wrap: wrap; }
.editor-field-group { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; min-width: 140px; }
.editor-field-label { font-family: var(--font-mono); font-size: 0.65rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--parch-dark); }

.editor-select, .editor-tags-input {
  font-family: var(--font-body); font-size: 0.88rem;
  background: var(--vellum-off); border: 1px solid var(--parch);
  border-radius: 3px; color: var(--ink); padding: 0.3rem 0.5rem; outline: none;
  transition: border-color 0.15s;
}
.editor-select:focus, .editor-tags-input:focus { border-color: var(--parch-dark); }

.editor-tags-display { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-top: 0.25rem; }

.tag-remove {
  font-family: var(--font-mono); font-size: 0.68rem;
  color: var(--accent); background: rgba(139,37,0,0.08);
  border: 1px solid rgba(139,37,0,0.25);
  padding: 1px 8px; border-radius: 10px; cursor: pointer;
  display: flex; align-items: center; gap: 0.25rem;
}
.tag-remove:hover { background: rgba(139,37,0,0.2); }

.editor-textarea {
  flex: 1; font-family: var(--font-body); font-size: 0.95rem;
  line-height: 1.85; color: var(--ink); background: transparent;
  border: none; outline: none; resize: none; min-height: 280px; width: 100%;
}
.editor-textarea::placeholder { color: var(--parch-dark); font-style: italic; }

.editor-footer {
  padding: 0.75rem 1.5rem; border-top: 1px solid var(--parch);
  display: flex; justify-content: space-between; align-items: center;
  background: var(--vellum-off);
}

.word-count { font-family: var(--font-mono); font-size: 0.72rem; color: var(--parch-dark); }

/* ── BOUTONS ── */
.btn {
  font-family: var(--font-title); font-size: 0.78rem; letter-spacing: 0.05em;
  border: none; border-radius: 3px; cursor: pointer; padding: 0.45rem 1rem;
  transition: all 0.15s; white-space: nowrap; display: inline-flex; align-items: center; gap: 0.3rem;
}
.btn-primary { background: var(--leather); color: var(--vellum); box-shadow: 0 1px 4px var(--shadow); }
.btn-primary:hover { background: var(--ink); }
.btn-ghost { background: transparent; color: var(--parch-dark); border: 1px solid var(--parch); }
.btn-ghost:hover { background: rgba(0,0,0,0.05); color: var(--ink); }
.btn-gold { background: var(--gold); color: var(--ink); font-weight: 600; }
.btn-gold:hover { background: #b8862a; }

/* ── MODALS ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(44,26,14,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--vellum); border: 2px solid var(--parch-dark);
  border-radius: 4px; padding: 1.75rem; width: 420px; max-width: 90vw;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}
.modal-title { font-family: var(--font-title); font-size: 1.1rem; color: var(--leather); margin-bottom: 1rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--parch); }
.modal-ornament { text-align: center; color: var(--parch-dark); font-size: 0.9rem; margin: 0.75rem 0; letter-spacing: 0.5em; }

.form-group { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.85rem; }
.form-label { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--parch-dark); }
.form-input {
  font-family: var(--font-body); font-size: 0.9rem;
  background: var(--vellum-off); border: 1px solid var(--parch);
  border-radius: 3px; color: var(--ink); padding: 0.4rem 0.6rem; outline: none;
}
.form-input:focus { border-color: var(--leather); }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.25rem; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  background: var(--leather); color: var(--vellum);
  font-family: var(--font-body); font-size: 0.88rem;
  padding: 0.6rem 1.1rem; border-radius: 3px;
  box-shadow: 0 3px 12px var(--shadow); z-index: 200;
  transform: translateY(10px); opacity: 0; transition: all 0.25s;
  border-left: 3px solid var(--gold);
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--parch-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--leather); }/* ══════════════════════════════════════════════════════
   ANIMATIONS & EFFETS VISUELS — LE SCRIPTORIUM
   À ajouter à la fin de style.css
══════════════════════════════════════════════════════ */

/* ── KEYFRAMES ── */

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

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-18px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(22px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  8%        { opacity: 0.85; }
  18%       { opacity: 0.95; }
  34%       { opacity: 0.80; }
  50%       { opacity: 1; }
  62%       { opacity: 0.88; }
  78%       { opacity: 0.96; }
}

@keyframes goldShimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}

@keyframes inkDrop {
  0%   { transform: scale(0) rotate(-5deg); opacity: 0; }
  60%  { transform: scale(1.08) rotate(1deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes quillWrite {
  0%   { stroke-dashoffset: 1000; }
  100% { stroke-dashoffset: 0; }
}

@keyframes pageTurn {
  0%   { opacity: 0; transform: rotateY(-8deg) translateX(-10px); }
  100% { opacity: 1; transform: rotateY(0deg) translateX(0); }
}

@keyframes modalAppear {
  0%   { opacity: 0; transform: scale(0.93) translateY(12px); }
  60%  { transform: scale(1.01) translateY(-2px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes toastSlide {
  from { opacity: 0; transform: translateX(60px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes borderPulse {
  0%, 100% { border-color: var(--gold); box-shadow: 0 0 0 0 rgba(200,151,58,0); }
  50%       { border-color: #e8b84b;    box-shadow: 0 0 12px 2px rgba(200,151,58,0.25); }
}

@keyframes particleFloat {
  0%   { transform: translateY(0)   rotate(0deg);   opacity: 0.6; }
  50%  { transform: translateY(-14px) rotate(180deg); opacity: 0.9; }
  100% { transform: translateY(0)   rotate(360deg); opacity: 0.6; }
}

@keyframes scanline {
  0%   { background-position: 0 0; }
  100% { background-position: 0 100%; }
}

/* ── HEADER — flamme sur le titre ── */
.site-title {
  position: relative;
  transition: letter-spacing 0.4s ease;
}
.site-title:hover {
  letter-spacing: 0.13em;
}
.site-title .ornament {
  animation: flicker 4s ease-in-out infinite;
  display: inline-block;
}
.site-title .ornament:last-child {
  animation-delay: 1.8s;
}

/* Shimmer doré sur le titre au survol */
.site-title:hover {
  background: linear-gradient(90deg, var(--vellum) 30%, var(--gold) 50%, var(--vellum) 70%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: goldShimmer 1.8s linear infinite;
}

/* ── HEADER boutons ── */
.auth-btn {
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.auth-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.auth-btn:active { transform: translateY(0) scale(0.97); }

.btn {
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255,255,255,0);
  transition: background 0.15s;
}
.btn:hover::after { background: rgba(255,255,255,0.07); }
.btn:active { transform: scale(0.96); }
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(200,151,58,0.4); }

/* ── SIDEBAR — entrée animée ── */
.sidebar {
  animation: slideInLeft 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.folder-item {
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.folder-item:hover {
  transform: translateX(4px);
  box-shadow: inset 0 0 20px rgba(200,151,58,0.04);
}
.folder-item.active {
  transform: translateX(3px);
}
.folder-item:active { transform: translateX(2px) scale(0.98); }

.add-folder-btn {
  transition: all 0.2s ease;
}
.add-folder-btn:hover {
  transform: translateY(-1px);
  background: rgba(160,113,79,0.08);
}

/* ── FIL — cartes d'entrées ── */
.entry {
  transition: all 0.22s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transform-origin: left center;
}
.entry:hover {
  transform: translateX(3px);
  border-left-color: var(--parch);
  box-shadow: 2px 0 16px rgba(44,26,14,0.08);
}
.entry.selected {
  transform: translateX(5px);
  box-shadow: 3px 0 20px rgba(200,151,58,0.12);
}
.entry:active { transform: translateX(2px) scale(0.995); }

/* Animation d'apparition des entrées */
.entry {
  animation: fadeInUp 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.entry:nth-child(1)  { animation-delay: 0.04s; }
.entry:nth-child(2)  { animation-delay: 0.08s; }
.entry:nth-child(3)  { animation-delay: 0.12s; }
.entry:nth-child(4)  { animation-delay: 0.16s; }
.entry:nth-child(5)  { animation-delay: 0.20s; }
.entry:nth-child(6)  { animation-delay: 0.24s; }
.entry:nth-child(7)  { animation-delay: 0.28s; }
.entry:nth-child(8)  { animation-delay: 0.32s; }
.entry:nth-child(n+9){ animation-delay: 0.36s; }

.entry-title {
  transition: color 0.15s ease;
}
.entry:hover .entry-title { color: var(--leather); }
.entry.selected .entry-title { color: var(--ink); }

.tag {
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tag:hover { transform: translateY(-2px) scale(1.06); }
.tag:active { transform: scale(0.95); }
.tag.active { animation: borderPulse 2.5s ease-in-out infinite; }

/* ── PANNEAU VIEWER — apparition tournée ── */
#viewerView {
  animation: pageTurn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
  transform-style: preserve-3d;
  perspective: 800px;
}

.viewer-title {
  transition: color 0.2s ease;
}

#viewerView .viewer-body {
  animation: fadeIn 0.5s ease 0.15s both;
}

/* Effet plume sur les boutons admin du viewer */
#viewerAdminActions .btn {
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#viewerAdminActions .btn:hover {
  transform: translateY(-2px) rotate(-3deg);
  background: rgba(160,113,79,0.12);
}
#viewerAdminActions .btn.danger:hover {
  transform: translateY(-2px) rotate(3deg);
  color: var(--accent);
}

/* ── ÉDITEUR ── */
#editorView {
  animation: slideInRight 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.editor-title-input {
  transition: border-color 0.2s ease, padding-bottom 0.2s ease;
}
.editor-title-input:focus {
  border-bottom-color: var(--gold);
  padding-bottom: 0.6rem;
}

.editor-textarea {
  transition: background 0.3s ease;
}
.editor-textarea:focus {
  background: rgba(242,232,213,0.4);
}

/* Compteur de mots — animation légère */
.word-count {
  transition: all 0.2s ease;
}

/* Bouton "Sceller" — effet spécial */
#saveEntryBtn {
  position: relative;
  overflow: hidden;
}
#saveEntryBtn::before {
  content: '';
  position: absolute;
  top: -50%; left: -60%;
  width: 40%; height: 200%;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,0.18), transparent);
  transform: skewX(-20deg);
  transition: left 0.6s ease;
}
#saveEntryBtn:hover::before { left: 130%; }
#saveEntryBtn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(44,26,14,0.35); }

/* ── ÉCRAN DE CONNEXION ── */
#loginScreen {
  backdrop-filter: blur(3px);
  transition: opacity 0.3s ease;
}

.login-box {
  animation: inkDrop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  transition: box-shadow 0.3s ease;
}
.login-box:hover {
  box-shadow: 0 16px 80px rgba(0,0,0,0.7), 0 0 40px rgba(200,151,58,0.08), inset 0 1px 0 rgba(255,255,255,0.15);
}

.login-seal {
  animation: flicker 3s ease-in-out infinite 0.5s;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.login-seal:hover { transform: scale(1.2) rotate(8deg); }

.login-input {
  transition: all 0.25s ease;
}
.login-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200,151,58,0.15);
  background: var(--vellum);
}

.login-btn {
  position: relative; overflow: hidden;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.login-btn::before {
  content: '';
  position: absolute;
  top: -50%; left: -60%;
  width: 40%; height: 200%;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,0.15), transparent);
  transform: skewX(-20deg);
  transition: left 0.5s ease;
}
.login-btn:hover::before { left: 130%; }
.login-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.login-btn:active { transform: translateY(0) scale(0.97); }

/* ── MODALS ── */
.modal-overlay {
  transition: opacity 0.25s ease;
  backdrop-filter: blur(2px);
}

.modal {
  animation: modalAppear 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  transition: box-shadow 0.2s ease;
}
.modal:hover {
  box-shadow: 0 12px 60px rgba(0,0,0,0.5);
}

.form-input {
  transition: all 0.2s ease;
}
.form-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200,151,58,0.12);
}

.modal-actions .btn {
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-actions .btn:hover { transform: translateY(-2px); }
.modal-actions .btn:active { transform: scale(0.96); }

/* ── TOAST ── */
.toast.show {
  animation: toastSlide 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ── WELCOME VIEW — particules flottantes ── */
#welcomeView {
  position: relative;
  overflow: hidden;
}
#welcomeView::before,
#welcomeView::after {
  content: '✦';
  position: absolute;
  color: var(--parch);
  font-size: 0.75rem;
  opacity: 0.3;
  animation: particleFloat 6s ease-in-out infinite;
  pointer-events: none;
}
#welcomeView::before { top: 25%; left: 20%; animation-delay: 0s; }
#welcomeView::after  { top: 60%; right: 25%; animation-delay: 3s; font-size: 0.55rem; }

.welcome-icon {
  animation: fadeInUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) both,
             particleFloat 5s ease-in-out 0.6s infinite;
  display: inline-block;
}

/* ── SCROLLBAR ANIMÉE ── */
::-webkit-scrollbar-thumb {
  transition: background 0.2s ease;
}
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* ── DIVIDER SIDEBAR — lueur animée ── */
.sidebar-divider {
  animation: borderPulse 4s ease-in-out infinite;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  border: none;
  opacity: 0.5;
}

/* ── BADGE ADMIN ── */
.admin-badge {
  animation: fadeIn 0.4s ease both;
}
.is-admin .admin-badge {
  animation: inkDrop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ── RECHERCHE ── */
.feed-search {
  transition: all 0.25s ease;
}
.feed-search:focus {
  width: 200px;
  border-color: var(--parch-dark);
  box-shadow: 0 0 0 3px rgba(160,113,79,0.12);
}

/* ── SÉPARATEUR entre entrées — rotation au survol ── */
.entry + .entry::before {
  display: block;
  transition: all 0.3s ease;
  transform-origin: center;
}
.entry:hover + .entry::before,
.entry + .entry:hover::before {
  color: var(--parch);
  transform: rotate(180deg) scale(1.2);
}

/* ── ICÔNES ACTIONS GRIMOIRE ── */
.folder-action-btn {
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.folder-action-btn:hover {
  transform: scale(1.2);
}
.folder-action-btn.danger:hover {
  transform: scale(1.2) rotate(10deg);
}

/* ── SÉLECTEUR ET INPUTS ÉDITEUR ── */
.editor-select, .editor-tags-input {
  transition: all 0.2s ease;
}
.editor-select:focus, .editor-tags-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200,151,58,0.1);
}

.tag-remove {
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tag-remove:hover { transform: scale(1.08); }

/* ── RÉDUCTION DE MOUVEMENT ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}