/**
 * Journal de Souvenirs Personnalisé - Ped'IA
 * Style premium: glassmorphism, tons chauds, typographies élégantes
 * Prototype style: scrapbook/livre avec spreads (double-pages)
 */

/* ============================================================================
   Typographies élégantes (prototype style)
   ============================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400;1,700&family=Crimson+Pro:wght@300;400;600;700&family=Caveat:wght@500;700&family=Cormorant+Garamond:ital,wght@0,300;0,400;0,700;1,400&family=Great+Vibes&display=swap');

/* ============================================================================
   Variables de design - Thème par défaut (Classic)
   Ces variables sont remplacées dynamiquement par journal-themes.js
   ============================================================================ */
:root {
  /* Couleurs principales */
  --journal-color-terracotta: #c17854;
  --journal-color-secondary: #e8a87c;
  --journal-color-gold: #d4af37;
  --journal-color-beige: #f5efe6;
  --journal-color-cream: #fff5f0;
  --journal-color-text-dark: #5a4a3a;
  --journal-color-text-light: #8b7355;

  /* Glassmorphism */
  --journal-glass-bg: rgba(255, 255, 255, 0.85);
  --journal-glass-border: rgba(255, 255, 255, 0.5);
  --journal-glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  --journal-page-bg: rgba(255, 251, 247, 0.9);
  --journal-container-bg: #000000;
  --journal-spine-shadow: rgba(193, 120, 84, 0.3);

  /* Fonts - remplacées par le thème actif */
  --journal-font-title: 'Playfair Display', serif;
  --journal-font-subtitle: 'Great Vibes', cursive;
  --journal-font-body: 'Crimson Pro', serif;
  --journal-font-quote: 'Caveat', cursive;
  --journal-font-elegant: 'Cormorant Garamond', serif;

  /* Décorations */
  --journal-decoration-color: #c17854;

  /* Dimensions */
  --journal-radius-sm: 12px;
  --journal-radius-md: 16px;
  --journal-radius-lg: 20px;

  --journal-spacing-sm: 12px;
  --journal-spacing-md: 24px;
  --journal-spacing-lg: 32px;
}

/* ============================================================================
   Animations clés
   ============================================================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(60px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
    opacity: 0.3;
  }
  50% { opacity: 0.8; }
  100: {
    background-position: 1000px 0;
    opacity: 0.3;
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  25% {
    transform: translateY(-15px) rotate(-2deg);
  }
  75% {
    transform: translateY(-8px) rotate(2deg);
  }
}

/* ✅ Version sans rotation pour les boutons circulaires */
@keyframes floatNoRotate {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes floatParticle {
  0% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx), var(--ty)) rotate(360deg);
    opacity: 0;
  }
}

@keyframes sparkle {
  0%, 100% {
    opacity: 0;
    transform: scale(0) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1) rotate(180deg);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(193, 120, 84, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(193, 120, 84, 0.6),
                0 0 60px rgba(193, 120, 84, 0.4);
  }
}

/* ============================================================================
   Container principal avec background noir + bulles canvas
   ============================================================================ */
#journal-container {
  min-height: 100vh;
  background: var(--journal-container-bg);
  padding: 3rem 2rem;
  font-family: var(--journal-font-body);
  position: relative;
  overflow-x: hidden;
}

/* ============================================================================
   MODE IMPRESSION - @media print pour export PDF/Livre
   ============================================================================ */
@media print {
  /* Le container devient blanc pour l'impression */
  #journal-container {
    background: white;
    padding: 0;
  }

  /* Chaque spread = 1 page imprimée */
  .book-spread {
    page-break-after: always;
    page-break-inside: avoid;
    box-shadow: none;
    margin: 0;
    max-width: 100%;
    border-radius: 0;
  }

  /* Cacher tous les éléments interactifs */
  .page-add-btn,
  .journal-block-header,
  .journal-floating-add-btn,
  .add-memory-button,
  .resize-handle,
  .journal-stats-bar,
  .journal-header {
    display: none !important;
  }

  /* Forcer les couleurs exactes à l'impression */
  .book-spread,
  .photo-container,
  .journal-photo-block {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    color-adjust: exact;
  }
}

/* Canvas background sera géré par le canvas existant du site */
#journal-container::before {
  content: none;
}

#journal-container::after {
  content: none;
}

/* Tous les enfants directs doivent être au-dessus du pseudo-élément */
#journal-container > * {
  position: relative;
  z-index: 1;
}

/* ============================================================================
   Header du journal
   ============================================================================ */
.journal-header {
  text-align: center;
  margin-bottom: 5rem;
  position: relative;
  animation: fadeInUp 1.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
  transform-style: preserve-3d;
}

.journal-header::before,
.journal-header::after {
  content: '✨';
  position: absolute;
  font-size: 2.5rem;
  animation: sparkle 3s ease-in-out infinite;
  filter: drop-shadow(0 0 10px var(--journal-spine-shadow));
}

.journal-header::before {
  left: 20%;
  top: -10px;
  animation-delay: 0s;
}

.journal-header::after {
  right: 20%;
  top: -10px;
  animation-delay: 1.5s;
}

.journal-title {
  font-family: var(--journal-font-title);
  font-size: 4.5rem;
  font-weight: 700;
  background: linear-gradient(
    135deg,
    var(--journal-color-secondary) 0%,
    var(--journal-color-terracotta) 25%,
    var(--journal-color-gold) 50%,
    var(--journal-color-terracotta) 75%,
    var(--journal-color-secondary) 100%
  );
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 8s ease infinite;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 4px 12px var(--journal-spine-shadow));
  letter-spacing: 2px;
  position: relative;
}

.journal-title::after {
  content: '';
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 150px;
  height: 4px;
  background: linear-gradient(90deg,
    transparent,
    var(--journal-spine-shadow),
    var(--journal-color-secondary),
    var(--journal-spine-shadow),
    transparent
  );
  border-radius: 2px;
  animation: shimmer 3s linear infinite, pulse 2s ease-in-out infinite;
}

.journal-subtitle {
  font-family: var(--journal-font-subtitle);
  font-size: 2.2rem;
  background: linear-gradient(
    135deg,
    #e8a87c 0%,
    #c17854 30%,
    #d4af37 50%,
    #c17854 70%,
    #e8a87c 100%
  );
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 500;
  letter-spacing: 3px;
  margin-top: 2rem;
  filter: drop-shadow(0 3px 12px rgba(193, 120, 84, 0.6));
  animation: float 4s ease-in-out infinite, gradientShift 6s ease infinite;
  position: relative;
  text-shadow: 0 0 30px rgba(193, 120, 84, 0.5);
}

/* Bouton d'information "i" dans la bannière stats */
.journal-info-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  min-width: 26px;
  margin-left: auto;
  background: rgba(255, 255, 255, 0.1);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.journal-info-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.1);
}

.journal-info-icon {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 14px;
  font-weight: 600;
  font-style: italic;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1;
}

/* Responsive pour le bouton info */
@media (max-width: 768px) {
  .journal-info-btn {
    width: 24px;
    height: 24px;
    min-width: 24px;
  }

  .journal-info-icon {
    font-size: 12px;
  }
}

/* ============================================================================
   Book Spread (double-page)
   ============================================================================ */
.book-spread {
  max-width: 1400px;
  margin: 0 auto 6rem;
  background: var(--journal-glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--journal-glass-border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow:
    0 2px 10px rgba(0,0,0,0.03),
    0 10px 30px rgba(0,0,0,0.08),
    0 25px 70px rgba(0,0,0,0.12),
    0 50px 140px rgba(0,0,0,0.08),
    inset 0 1px 0 rgba(255,255,255,0.8),
    inset 0 -1px 0 var(--journal-spine-shadow);
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 600px;
  position: relative;
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  perspective: 2500px;
  opacity: 0;
  transform:
    translateY(80px)
    rotateX(15deg)
    scale(0.95);
}

.book-spread.visible {
  opacity: 1;
  transform:
    translateY(0)
    rotateX(0deg)
    scale(1);
}

/* Ligne centrale (reliure) */
.book-spread::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(to bottom,
    transparent 0%,
    rgba(139, 115, 85, 0.06) 3%,
    rgba(193, 120, 84, 0.15) 10%,
    rgba(193, 120, 84, 0.3) 50%,
    rgba(193, 120, 84, 0.15) 90%,
    rgba(139, 115, 85, 0.06) 97%,
    transparent 100%
  );
  transform: translateX(-50%);
  z-index: 15;
  box-shadow:
    -3px 0 8px rgba(0,0,0,0.08),
    3px 0 8px rgba(0,0,0,0.08),
    0 0 20px rgba(193, 120, 84, 0.2);
}

/* Texture papier */
.book-spread::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 3px,
      rgba(255,255,255,0.02) 3px,
      rgba(255,255,255,0.02) 6px
    ),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 3px,
      rgba(255,255,255,0.02) 3px,
      rgba(255,255,255,0.02) 6px
    ),
    radial-gradient(
      circle at 0% 0%,
      rgba(255,255,255,0.5) 0%,
      transparent 60%
    ),
    radial-gradient(
      circle at 100% 100%,
      rgba(255,255,255,0.5) 0%,
      transparent 60%
    );
  pointer-events: none;
  opacity: 0.7;
  border-radius: 20px;
}

.book-spread:hover {
  transform:
    translateY(-12px)
    rotateX(-3deg)
    scale(1.01);
  box-shadow:
    0 4px 15px rgba(0,0,0,0.04),
    0 15px 40px rgba(0,0,0,0.1),
    0 35px 90px rgba(0,0,0,0.15),
    0 70px 180px rgba(0,0,0,0.1),
    0 0 0 1px rgba(193, 120, 84, 0.1),
    inset 0 1px 0 rgba(255,255,255,0.9),
    inset 0 -1px 0 rgba(193, 120, 84, 0.2);
}

/* ============================================================================
   Pages (gauche/droite) - Conteneur pour layout libre
   ============================================================================ */
.page-left, .page-right {
  padding: 4rem;
  position: relative;
  background:
    radial-gradient(circle at 15% 15%, var(--journal-color-cream) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, var(--journal-color-cream) 0%, transparent 40%),
    linear-gradient(135deg,
      var(--journal-page-bg) 0%,
      var(--journal-glass-bg) 50%,
      var(--journal-page-bg) 100%
    );
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  min-height: 600px;
  overflow: visible; /* ✅ Permet aux boutons d'être visibles même au bord */
}

.page-left {
  border-right: 1px solid rgba(139, 115, 85, 0.08);
  transform-origin: right center;
}

.page-right {
  transform-origin: left center;
}


.book-spread:hover .page-left {
  transform: rotateY(-2deg) translateZ(10px);
}

.book-spread:hover .page-right {
  transform: rotateY(2deg) translateZ(10px);
}

/* Ombres des pages */
.page-left::before, .page-right::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 80px;
  pointer-events: none;
  transition: opacity 0.8s ease;
  z-index: 1;
}

.page-left::before {
  right: 0;
  background: linear-gradient(to left,
    rgba(139, 115, 85, 0.08) 0%,
    rgba(139, 115, 85, 0.03) 30%,
    transparent 100%
  );
}

.page-right::before {
  left: 0;
  background: linear-gradient(to right,
    rgba(139, 115, 85, 0.08) 0%,
    rgba(139, 115, 85, 0.03) 30%,
    transparent 100%
  );
}

.book-spread:hover .page-left::before,
.book-spread:hover .page-right::before {
  opacity: 1.8;
}

/* ✅ Numéros de page (folios) + grille via pseudo-élément unique */
.page-left::after,
.page-right::after {
  /* Numéros de page */
  content: attr(data-page-number);
  position: absolute;
  bottom: 2rem;
  font-family: var(--journal-font-elegant);
  font-size: 13px;
  color: var(--journal-color-text-light);
  font-weight: 400;
  letter-spacing: 1px;
  pointer-events: none;
  opacity: 0.7;
  transition: opacity 0.3s ease;

  /* ✅ Grille 12×12 en arrière-plan (visible au hover) */
  background-image:
    repeating-linear-gradient(
      to right,
      rgba(193, 120, 84, 0) 0px,
      rgba(193, 120, 84, 0) 1px,
      transparent 1px,
      transparent calc(100% / 12)
    ),
    repeating-linear-gradient(
      to bottom,
      rgba(193, 120, 84, 0) 0px,
      rgba(193, 120, 84, 0) 1px,
      transparent 1px,
      transparent calc(100% / 12)
    );
  background-size: 100% 100%;
  transition: background-image 0.3s ease;
}

/* Grille visible uniquement au hover (via un élément supplémentaire) */
.page-grid-overlay {
  content: '';
  position: absolute;
  inset: 4rem; /* Même padding que la page */
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
  /* Grille 12 colonnes × 12 rangées */
  background-image:
    repeating-linear-gradient(
      to right,
      rgba(193, 120, 84, 0.15) 0px,
      rgba(193, 120, 84, 0.15) 1px,
      transparent 1px,
      transparent calc(100% / 12)
    ),
    repeating-linear-gradient(
      to bottom,
      rgba(193, 120, 84, 0.15) 0px,
      rgba(193, 120, 84, 0.15) 1px,
      transparent 1px,
      transparent calc(100% / 12)
    );
  background-size: 100% 100%;
}

.book-spread:hover .page-grid-overlay {
  opacity: 1;
}

.page-left::after {
  left: 4rem; /* Folio extérieur gauche */
}

.page-right::after {
  right: 4rem; /* Folio extérieur droit */
}

.book-spread:hover .page-left::after,
.book-spread:hover .page-right::after {
  opacity: 1;
}

/* ✅ Bouton "Ajouter sur cette page" (crayon emoji) - Visible seulement si la page est vide */
.page-add-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: rgba(193, 120, 84, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  cursor: pointer;
  z-index: 5;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
    0 2px 8px rgba(0,0,0,0.15),
    0 4px 16px rgba(193, 120, 84, 0.3);
  opacity: 0;
}

/* Afficher le bouton au hover de la page */
.page-left:hover .page-add-btn,
.page-right:hover .page-add-btn {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Si la page contient des blocs, cacher le bouton */
.page-left:has(.page-content) .page-add-btn,
.page-right:has(.page-content) .page-add-btn {
  display: none;
}

.page-add-btn:hover {
  background: rgba(232, 168, 124, 1);
  transform: translate(-50%, -50%) scale(1.15) rotate(15deg);
  box-shadow:
    0 4px 12px rgba(0,0,0,0.2),
    0 8px 24px rgba(193, 120, 84, 0.5),
    0 0 30px rgba(193, 120, 84, 0.4);
  border-color: rgba(255, 255, 255, 1);
}

.page-add-btn:active {
  transform: translate(-50%, -50%) scale(1.05) rotate(15deg);
}

/* ============================================================================
   Contenu des pages - Position absolue pour drag & drop
   ============================================================================ */
.page-content {
  position: absolute;
  z-index: 2;
  cursor: move;
  touch-action: none;
  /* Tailles par défaut, écrasées par les valeurs DB */
  width: 400px;
  height: 300px;
  top: 0;
  left: 0;
  /* ✅ Empêcher le débordement du contenu */
  overflow: hidden;
  /* ✅ Taille minimale pour éviter des blocs trop petits */
  min-width: 80px;
  min-height: 80px;
}

/* ✅ Container query pour adaptation responsive du contenu */
@supports (container-type: inline-size) {
  .page-content {
    container-type: inline-size;
    container-name: journal-block;
  }
}

/* État dragging */
.page-content.dragging {
  z-index: 100;
  opacity: 0.9;
  cursor: grabbing;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

/* ✅ Mode pinch-to-resize mobile */
.page-content.pinching {
  z-index: 100;
  box-shadow: 0 0 0 3px rgba(100, 200, 255, 0.7),
              0 0 25px rgba(100, 200, 255, 0.5);
  transition: none; /* Désactiver les transitions pendant le pinch */
}

.page-content.pinching::before {
  content: '';
  position: absolute;
  inset: -4px;
  border: 2px dashed rgba(100, 200, 255, 0.8);
  border-radius: inherit;
  pointer-events: none;
  animation: pinchPulse 0.5s ease-in-out infinite alternate;
}

@keyframes pinchPulse {
  from { opacity: 0.5; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1.02); }
}

/* ✅ Mode édition mobile (après premier tap) */
.page-content.edit-mode {
  box-shadow: 0 0 0 3px rgba(193, 120, 84, 0.6),
              0 0 20px rgba(193, 120, 84, 0.4);
  animation: pulse 1s ease-in-out 2;
}

.page-content.edit-mode::after {
  content: '✋ Tapez à nouveau pour déplacer';
  position: absolute;
  top: -35px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(193, 120, 84, 0.95);
  color: white;
  padding: 6px 12px;
  border-radius: 8px;
  font-family: 'Crimson Pro', serif;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 1000;
  pointer-events: none;
  animation: fadeIn 0.3s ease;
}

/* Poignées de redimensionnement */
.page-content .resize-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: rgba(193, 120, 84, 0.8);
  border: 2px solid white;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 10;
}

.page-content:hover .resize-handle {
  opacity: 1;
}

.page-content .resize-handle.bottom-right {
  bottom: -6px;
  right: -6px;
  cursor: nwse-resize;
}

.page-content .resize-handle.bottom-left {
  bottom: -6px;
  left: -6px;
  cursor: nesw-resize;
}

.page-content .resize-handle.top-right {
  top: -6px;
  right: -6px;
  cursor: nesw-resize;
}

.page-content .resize-handle.top-left {
  top: -6px;
  left: -6px;
  cursor: nwse-resize;
}

/* Poignées sur les côtés (redimensionnement horizontal/vertical seul) */
.page-content .resize-handle.top-center {
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.page-content .resize-handle.bottom-center {
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.page-content .resize-handle.middle-left {
  top: 50%;
  left: -6px;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.page-content .resize-handle.middle-right {
  top: 50%;
  right: -6px;
  transform: translateY(-50%);
  cursor: ew-resize;
}

/* ============================================================================
   Types de blocs - Photo (Polaroid style) - Optimisé pour impression
   ============================================================================ */
.journal-photo-block {
  position: relative;
  width: 100%; /* ✅ Remplace flex: 1 pour meilleur contrôle */
  height: 100%; /* ✅ Remplir le conteneur parent */
  display: flex;
  flex-direction: column;
  padding: clamp(0.25rem, 2%, 1rem); /* ✅ Padding adaptatif au conteneur */
  overflow: hidden; /* ✅ Empêcher le débordement */
  box-sizing: border-box; /* ✅ Inclure le padding dans la taille */
}

.photo-container {
  flex: 1;
  padding: clamp(6px, 2%, 18px); /* ✅ Padding adaptatif */
  background: #fefefe; /* Blanc cassé pour impression */
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: clamp(0.25rem, 2%, 0.75rem); /* ✅ Marge adaptative */
  box-shadow:
    0 2px 4px rgba(0,0,0,0.08),
    0 6px 16px rgba(0,0,0,0.12),
    0 12px 32px rgba(0,0,0,0.08);
  transform: rotate(-1deg);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  /* Optimisation impression */
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* Effet scotch */
.photo-container::before {
  content: '';
  position: absolute;
  top: -4px;
  right: 12%;
  width: 60px;
  height: 24px;
  background: rgba(193, 120, 84, 0.15);
  border-radius: 2px;
  transform: rotate(-2deg);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.book-spread:hover .photo-container {
  transform: rotate(0deg) translateY(-4px);
  box-shadow:
    0 4px 8px rgba(0,0,0,0.1),
    0 10px 24px rgba(0,0,0,0.15),
    0 16px 48px rgba(0,0,0,0.1);
}

.photo-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: contrast(1.05) saturate(1.1);
}

.photo-caption {
  font-family: 'Crimson Pro', serif;
  font-size: clamp(0.8rem, 3.5vw, 1.05rem); /* ✅ Adaptatif à la taille du bloc */
  color: #5a4a3a;
  margin-bottom: clamp(0.15rem, 1%, 0.35rem); /* ✅ Marge adaptative */
  line-height: 1.6;
  position: relative;
  padding-left: clamp(1rem, 4%, 1.5rem); /* ✅ Padding adaptatif */
}

.photo-caption::before {
  content: '◆';
  position: absolute;
  left: 0;
  top: 0.15em; /* ✅ Relatif à la taille de police */
  color: #c17854;
  font-size: 0.7em; /* ✅ Relatif à la taille de police du caption */
}

/* ============================================================================
   Types de blocs - Citation (Quote)
   ============================================================================ */
.journal-quote-block {
  width: 100%; /* ✅ Remplace justify-content pour meilleur contrôle */
  height: 100%; /* ✅ Remplir le conteneur */
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(0.5rem, 3%, 1.5rem) clamp(0.5rem, 2%, 1rem); /* ✅ Padding adaptatif */
  position: relative;
  overflow: hidden; /* ✅ Empêcher le débordement */
  box-sizing: border-box; /* ✅ Inclure le padding dans la taille */
}

.journal-quote-block::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(150px, 70%, 300px); /* ✅ Taille adaptative */
  height: clamp(150px, 70%, 300px);
  background: radial-gradient(circle, rgba(193, 120, 84, 0.06) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(35px);
  pointer-events: none;
}

.quote-mark {
  font-family: var(--journal-font-title);
  font-size: clamp(3rem, 15vw, 6rem); /* ✅ Adaptatif selon la taille du bloc */
  color: var(--journal-color-terracotta);
  opacity: 0.12;
  line-height: 0.5;
  margin-bottom: clamp(0.25rem, 2%, 0.75rem); /* ✅ Marge adaptative */
  text-shadow: 2px 2px 8px var(--journal-spine-shadow);
  position: relative;
}

.quote-text {
  font-family: var(--journal-font-quote) !important;
  font-size: clamp(1.5rem, 6vw, 2.8rem); /* ✅ Adaptatif, meilleure échelle */
  color: var(--journal-color-terracotta) !important;
  font-weight: 700 !important;
  margin-bottom: clamp(0.5rem, 3%, 1.25rem); /* ✅ Marge adaptative */
  line-height: 1.4;
  position: relative;
  z-index: 1;
  text-shadow: none !important;
  transform: rotate(-1deg);
  transition: transform 0.4s ease;
  opacity: 1 !important;
  filter: none !important;
  -webkit-text-fill-color: var(--journal-color-terracotta) !important;
}

/* ✅ Force la couleur terracotta avec spécificité MAXIMALE pour écraser style.css */
h2.quote-text,
h2.quote-text *,
h2.quote-text span,
h2.quote-text font,
h2.quote-text b,
h2.quote-text strong,
h2.quote-text i,
h2.quote-text em,
h2.quote-text u,
.journal-quote-block .quote-text,
.journal-quote-block .quote-text * {
  color: #c17854 !important;
  -webkit-text-fill-color: #c17854 !important;
  -webkit-background-clip: initial !important;
  background-clip: initial !important;
  background: none !important;
  opacity: 1 !important;
  filter: none !important;
}

.book-spread:hover .quote-text {
  transform: rotate(0deg);
}

.quote-context {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(0.85rem, 3vw, 1.1rem); /* ✅ Adaptatif */
  color: #8b7355;
  font-style: italic;
  line-height: 1.6;
  position: relative;
  z-index: 1;
  padding: clamp(0.5rem, 2%, 1rem) clamp(0.75rem, 3%, 1.25rem); /* ✅ Padding adaptatif */
  background: rgba(255, 250, 245, 0.6);
  border-left: 3px solid rgba(193, 120, 84, 0.3);
  border-radius: 0 4px 4px 0;
}

/* ============================================================================
   Types de blocs - Update Memory (Souvenir depuis l'historique)
   ============================================================================ */
.journal-update-memory-block {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1rem, 4%, 2rem);
  position: relative;
  background: linear-gradient(135deg, rgba(255, 250, 245, 0.95) 0%, rgba(255, 245, 235, 0.9) 100%);
  border: 2px solid rgba(193, 120, 84, 0.2);
  border-radius: 32px; /* ✅ Bordures très arrondies */
  box-shadow:
    0 4px 16px rgba(193, 120, 84, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  overflow: hidden; /* ✅ Empêche le débordement du texte */
  box-sizing: border-box; /* ✅ Inclure le padding et border dans la taille */
}

.journal-update-memory-block::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(120px, 60%, 250px);
  height: clamp(120px, 60%, 250px);
  background: radial-gradient(circle, rgba(212, 175, 55, 0.08) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(30px);
  pointer-events: none;
}

.update-memory-header {
  display: flex;
  align-items: center;
  justify-content: center; /* ✅ Centrer le header */
  gap: 0.5rem;
  margin-bottom: clamp(0.75rem, 3%, 1.25rem);
  position: relative;
  z-index: 1;
}

.update-memory-icon {
  font-size: 40px; /* ✅ Taille par défaut, sera ajustée dynamiquement par JS */
  opacity: 0.8;
}

.update-memory-label {
  font-family: var(--journal-font-elegant);
  font-size: 24px; /* ✅ Taille par défaut, sera ajustée dynamiquement par JS */
  color: var(--journal-color-gold);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.journal-update-memory-block .quote-mark {
  font-family: var(--journal-font-title);
  font-size: 80px; /* ✅ Taille par défaut réduite, sera ajustée dynamiquement par JS */
  color: var(--journal-color-gold);
  opacity: 0.3; /* ✅ Augmenté à 30% (au lieu de 15%) pour être plus visible */
  line-height: 0.5;
  margin-bottom: clamp(0.25rem, 2%, 0.5rem);
  text-shadow: 2px 2px 8px rgba(212, 175, 55, 0.2);
  position: relative;
  z-index: 1;
  text-align: center; /* ✅ Centrer le guillemet */
}

.update-memory-text {
  font-family: var(--journal-font-quote);
  font-size: 48px; /* ✅ Taille par défaut, sera ajustée dynamiquement par JS */
  color: var(--journal-color-text-dark);
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: clamp(0.75rem, 3%, 1.5rem);
  position: relative;
  z-index: 1;
  text-align: center; /* ✅ Texte centré */
  /* ✅ Texte responsif qui s'adapte au conteneur */
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  max-width: 100%;
}

.update-memory-footer {
  display: flex;
  flex-direction: column;
  align-items: center; /* ✅ Centrer le footer */
  gap: 0.25rem;
  position: relative;
  z-index: 1;
  padding-top: clamp(0.5rem, 2%, 1rem);
  border-top: 1px solid rgba(193, 120, 84, 0.15);
}

.update-memory-child {
  font-family: var(--journal-font-elegant);
  font-size: 20px; /* ✅ Taille par défaut, sera ajustée dynamiquement par JS */
  color: var(--journal-color-text-light);
  font-style: italic;
}

.update-memory-footer .date-stamp {
  font-size: 18px; /* ✅ Taille par défaut, sera ajustée dynamiquement par JS */
  opacity: 0.7;
}

/* ============================================================================
   Types de blocs - Note/Lettre
   ============================================================================ */
.journal-text-block {
  width: 100%;
  height: 100%;
  padding: 3%; /* ✅ Padding proportionnel au conteneur */
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* ✅ Empêcher le débordement */
  box-sizing: border-box; /* ✅ Inclure le padding dans la taille */
}

.note-header {
  margin-bottom: 5%; /* ✅ Proportionnel au conteneur */
  border-bottom: 2px double #c17854;
  padding-bottom: 3%;
  position: relative;
  flex-shrink: 0; /* ✅ Empêcher le header de rétrécir */
}

.note-header::after {
  content: '✦';
  position: absolute;
  bottom: -0.6em; /* ✅ Relatif à la taille de police */
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95); /* ✅ Légère transparence */
  padding: 0 0.6em; /* ✅ Proportionnel à la taille de police */
  color: #c17854;
  font-size: clamp(0.7rem, 2.5vw, 1rem); /* ✅ Responsive */
}

.journal-text-title {
  font-family: var(--journal-font-title);
  font-size: clamp(1.2rem, 4vw, 2.2rem); /* ✅ Taille responsive qui s'adapte */
  color: var(--journal-color-text-dark);
  margin: 0; /* ✅ Retiré pour meilleur contrôle */
  letter-spacing: 0.02em;
  text-align: center; /* ✅ Centré pour alignement avec la ligne */
  line-height: 1.3;
}

.journal-text-content {
  font-family: var(--journal-font-elegant);
  font-size: clamp(0.9rem, 2.5vw, 1.25rem); /* ✅ Taille responsive */
  color: var(--journal-color-text-dark);
  line-height: 1.8;
  text-indent: 1.5em; /* ✅ Relatif à la taille de police */
  position: relative;
  white-space: pre-wrap;
  flex: 1; /* ✅ Prend l'espace restant */
  overflow-y: auto; /* ✅ Scroll si le texte dépasse */
}

/* ✅ Styles pour le texte formaté dans les blocs */
.journal-text-content strong,
.journal-text-content b,
.journal-text-title strong,
.journal-text-title b,
.journal-milestone-title strong,
.journal-milestone-title b,
.journal-milestone-description strong,
.journal-milestone-description b,
.quote-text strong,
.quote-text b,
.quote-context strong,
.quote-context b {
  font-weight: 700;
}

.journal-text-content em,
.journal-text-content i,
.journal-text-title em,
.journal-text-title i,
.journal-milestone-title em,
.journal-milestone-title i,
.journal-milestone-description em,
.journal-milestone-description i,
.quote-text em,
.quote-text i,
.quote-context em,
.quote-context i {
  font-style: italic;
}

.journal-text-content u,
.journal-text-title u,
.journal-milestone-title u,
.journal-milestone-description u,
.quote-text u,
.quote-context u {
  text-decoration: underline;
}

/* Support des balises <font> avec color pour la couleur personnalisée */
.journal-text-content font[color],
.journal-text-title font[color],
.journal-milestone-title font[color],
.journal-milestone-description font[color],
.quote-text font[color],
.quote-context font[color],
.journal-text-content font[color] *,
.journal-text-title font[color] *,
.journal-milestone-title font[color] *,
.journal-milestone-description font[color] *,
.quote-text font[color] *,
.quote-context font[color] * {
  color: inherit !important; /* Force l'héritage de la couleur du <font> */
}

/* Support des spans avec style inline pour les couleurs - Les spans doivent avoir priorité absolue */
.journal-text-content span[style*="color"] *,
.journal-text-title span[style*="color"] *,
.journal-milestone-title span[style*="color"] *,
.journal-milestone-description span[style*="color"] *,
.quote-text span[style*="color"] *,
.quote-context span[style*="color"] *,
.journal-text-content span[style*="color"],
.journal-text-title span[style*="color"],
.journal-milestone-title span[style*="color"],
.journal-milestone-description span[style*="color"],
.quote-text span[style*="color"],
.quote-context span[style*="color"] {
  /* Les couleurs inline des spans doivent être respectées par le navigateur automatiquement */
  /* Mais on doit s'assurer qu'aucune autre règle ne les écrase */
}

/* Support des spans avec style inline pour les couleurs de fond (background-color) */
/* Les styles inline de background-color doivent être respectés automatiquement par le navigateur */
/* On s'assure juste qu'aucune règle ne les écrase */
.journal-text-content span[style*="background-color"],
.journal-text-title span[style*="background-color"],
.journal-milestone-title span[style*="background-color"],
.journal-milestone-description span[style*="background-color"],
.quote-text span[style*="background-color"],
.quote-context span[style*="background-color"],
.decorative-frame-text span[style*="background-color"],
.update-memory-text span[style*="background-color"],
.journal-text-content font[style*="background-color"],
.journal-text-title font[style*="background-color"],
.journal-milestone-title font[style*="background-color"],
.journal-milestone-description font[style*="background-color"],
.quote-text font[style*="background-color"],
.quote-context font[style*="background-color"],
.decorative-frame-text font[style*="background-color"],
.update-memory-text font[style*="background-color"] {
  /* Les styles inline doivent être appliqués normalement */
  padding: 0 2px; /* Petit padding pour que le fond soit plus visible */
  border-radius: 2px; /* Arrondi léger pour un meilleur rendu */
}

.journal-text-content::first-letter {
  font-family: var(--journal-font-title);
  font-size: 3em; /* ✅ Relatif à la taille du texte (3x plus grand) */
  float: left;
  line-height: 0.85;
  margin: 0.05em 0.3em 0 0; /* ✅ Marges relatives */
  color: var(--journal-color-terracotta);
}

/* ============================================================================
   Types de blocs - Note Simple (sans décoration)
   ============================================================================ */
.journal-text-simple-block {
  width: 100%;
  height: 100%;
  padding: 4%; /* ✅ Padding légèrement plus généreux */
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3%; /* ✅ Espacement entre titre et contenu */
  overflow: hidden; /* ✅ Empêcher le débordement */
  box-sizing: border-box; /* ✅ Inclure le padding dans la taille */
}

.journal-text-simple-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.2rem, 4vw, 2rem); /* ✅ Légèrement plus petit que le bloc décoré */
  color: #5a4a3a;
  margin: 0;
  letter-spacing: 0.02em;
  line-height: 1.3;
  font-weight: 600;
  flex-shrink: 0;
}

.journal-text-simple-content {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(0.9rem, 2.5vw, 1.2rem);
  color: #5a4a3a;
  line-height: 1.8;
  position: relative;
  white-space: pre-wrap;
  flex: 1;
  overflow-y: auto;
}

/* ✅ Styles pour le texte formaté dans le bloc simple */
.journal-text-simple-content strong,
.journal-text-simple-content b,
.journal-text-simple-title strong,
.journal-text-simple-title b {
  font-weight: 700;
}

.journal-text-simple-content em,
.journal-text-simple-content i,
.journal-text-simple-title em,
.journal-text-simple-title i {
  font-style: italic;
}

.journal-text-simple-content u,
.journal-text-simple-title u {
  text-decoration: underline;
}

/* Support des balises <font> et <span> */
.journal-text-simple-content font[color],
.journal-text-simple-title font[color],
.journal-text-simple-content font[color] *,
.journal-text-simple-title font[color] * {
  color: inherit !important;
}

.journal-text-simple-content span[style*="color"],
.journal-text-simple-title span[style*="color"],
.journal-text-simple-content span[style*="color"] *,
.journal-text-simple-title span[style*="color"] * {
  /* Couleurs inline respectées */
}

/* ============================================================================
   Types de blocs - Jalon (Milestone)
   ============================================================================ */
.journal-milestone-block {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(0.5rem, 3%, 1.5rem) clamp(0.5rem, 2%, 1rem); /* ✅ Padding adaptatif */
  position: relative;
  overflow: hidden; /* ✅ Empêcher le débordement */
  box-sizing: border-box; /* ✅ Inclure le padding dans la taille */
}

.journal-milestone-block::before {
  content: '';
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(120px, 60%, 250px); /* ✅ Taille adaptative */
  height: clamp(120px, 60%, 250px);
  background: radial-gradient(circle, rgba(193, 120, 84, 0.05) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(25px);
}

.milestone-badge {
  font-size: clamp(2.5rem, 12vw, 5rem); /* ✅ Adaptatif */
  margin-bottom: clamp(0.5rem, 3%, 1.25rem); /* ✅ Marge adaptative */
  text-align: center;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
  animation: float 3s ease-in-out infinite;
  position: relative;
  z-index: 1;
}

.journal-milestone-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.3rem, 5vw, 2.2rem); /* ✅ Adaptatif */
  color: #5a4a3a;
  margin-bottom: clamp(0.5rem, 3%, 1.25rem); /* ✅ Marge adaptative */
  text-align: center;
  position: relative;
  z-index: 1;
  letter-spacing: 0.5px;
}

.journal-milestone-title::after {
  content: '';
  display: block;
  width: clamp(50px, 30%, 100px); /* ✅ Largeur adaptative */
  height: 2px;
  background: linear-gradient(90deg, transparent, #c17854, transparent);
  margin: clamp(0.5rem, 2%, 1rem) auto 0; /* ✅ Marge adaptative */
}

.journal-milestone-description {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(0.9rem, 3.5vw, 1.15rem); /* ✅ Adaptatif */
  color: #5a4a3a;
  line-height: 1.7;
  flex: 1;
  position: relative;
  z-index: 1;
  text-align: center;
}

.journal-milestone-stats {
  display: flex;
  justify-content: space-around;
  margin-top: clamp(0.75rem, 3%, 1.5rem); /* ✅ Marge adaptative */
  padding: clamp(0.75rem, 3%, 1.25rem); /* ✅ Padding adaptatif */
  background: linear-gradient(135deg, rgba(255, 250, 245, 0.8) 0%, rgba(248, 243, 235, 0.9) 100%);
  border-radius: 8px;
  border: 1px solid rgba(193, 120, 84, 0.15);
  box-shadow:
    inset 0 1px 2px rgba(255,255,255,0.8),
    0 2px 8px rgba(0,0,0,0.05);
}

.journal-milestone-stats span {
  font-family: 'Crimson Pro', serif;
  font-size: clamp(0.85rem, 3vw, 1.05rem); /* ✅ Adaptatif */
  color: #8b7355;
  font-weight: 600;
  text-align: center;
  position: relative;
}

.journal-milestone-stats span:not(:last-child)::after {
  content: '•';
  position: absolute;
  right: -15px;
  color: rgba(193, 120, 84, 0.3);
}

/* ============================================================================
   Types de blocs - Grille de photos
   ============================================================================ */
.journal-photo-grid-block {
  width: 100%;
  height: 100%;
  padding: clamp(0.25rem, 2%, 0.75rem); /* ✅ Padding adaptatif */
  display: flex;
  flex-direction: column;
  overflow: hidden; /* ✅ Empêcher le débordement */
  box-sizing: border-box; /* ✅ Inclure le padding dans la taille */
}

.photos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(0.5rem, 2%, 1rem); /* ✅ Gap adaptatif */
  margin-bottom: 0;
  flex: 1;
  height: 100%;
}

.photos-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  box-shadow:
    0 2px 4px rgba(0,0,0,0.08),
    0 4px 12px rgba(0,0,0,0.1);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  filter: contrast(1.05) saturate(1.05);
}

.photos-grid img:first-child {
  transform: rotate(-2deg);
}

.photos-grid img:last-child {
  transform: rotate(1deg);
}

.book-spread:hover .photos-grid img {
  transform: rotate(0deg) scale(1.02);
  box-shadow:
    0 4px 8px rgba(0,0,0,0.1),
    0 8px 20px rgba(0,0,0,0.15);
}

/* ============================================================================
   Date stamp (style cachet de cire)
   ============================================================================ */
.date-stamp {
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.95rem;
  color: #8b7355;
  opacity: 0.8;
  font-style: italic;
  display: block;
  margin-top: auto;
  position: relative;
  padding-left: 1.5rem;
  letter-spacing: 0.5px;
}

.date-stamp::before {
  content: '◉';
  position: absolute;
  left: 0;
  color: rgba(193, 120, 84, 0.4);
  font-size: 0.7rem;
}

.journal-block-meta-date {
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.95rem;
  color: #8b7355;
  opacity: 0.8;
  font-style: italic;
  display: block;
  margin-top: auto;
  position: relative;
  padding-left: 1.5rem;
  letter-spacing: 0.5px;
}

.journal-block-meta-date::before {
  content: '◉';
  position: absolute;
  left: 0;
  color: rgba(193, 120, 84, 0.4);
  font-size: 0.7rem;
}

/* ============================================================================
   Bouton flottant d'ajout - NOUVEAU: Position bas gauche FIXE
   ============================================================================ */
.journal-floating-add-btn {
  position: fixed !important; /* ✅ Force fixed pour rester visible */
  bottom: calc(60px + 32px + env(safe-area-inset-bottom)) !important; /* Au-dessus de la bottom nav */
  left: 24px !important;
  background: linear-gradient(135deg,
    rgba(193, 120, 84, 1) 0%,
    rgba(232, 168, 124, 1) 50%,
    rgba(193, 120, 84, 1) 100%
  );
  background-size: 200% 200%;
  color: white;
  border: none;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  padding: 0; /* ✅ Pas de padding qui déforme */
  margin: 0; /* ✅ Pas de margin qui déforme */
  box-sizing: border-box; /* ✅ Inclut border dans dimensions */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 32px;
  font-weight: 300;
  line-height: 1;
  box-shadow:
    0 0 0 0 rgba(193, 120, 84, 0.4),
    0 6px 20px rgba(161, 94, 61, 0.3),
    0 15px 45px rgba(161, 94, 61, 0.4),
    inset 0 -3px 8px rgba(0,0,0,0.2),
    inset 0 3px 8px rgba(255,255,255,0.3);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  animation:
    floatNoRotate 4s ease-in-out infinite,
    glow 2s ease-in-out infinite,
    gradientShift 4s ease infinite;
  position: relative;
}

.journal-floating-add-btn::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    rgba(193, 120, 84, 0.8),
    rgba(232, 168, 124, 0.8),
    rgba(193, 120, 84, 0.8)
  );
  filter: blur(15px);
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -1;
  animation: spin 3s linear infinite;
}

.journal-floating-add-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0.3) 0%,
    transparent 50%
  );
  pointer-events: none;
}

.journal-floating-add-btn:hover::before {
  opacity: 1;
}

.journal-floating-add-btn:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow:
    0 0 0 10px rgba(193, 120, 84, 0.1),
    0 0 0 20px rgba(193, 120, 84, 0.05),
    0 10px 30px rgba(161, 94, 61, 0.4),
    0 20px 60px rgba(161, 94, 61, 0.5),
    inset 0 -3px 10px rgba(0,0,0,0.3),
    inset 0 3px 10px rgba(255,255,255,0.4);
}

.journal-floating-add-btn:active {
  transform: scale(1.05) rotate(90deg);
  box-shadow:
    0 0 0 8px rgba(193, 120, 84, 0.2),
    0 5px 15px rgba(161, 94, 61, 0.5),
    inset 0 3px 10px rgba(0,0,0,0.4);
}

/* ✅ Bouton "Récupérer blocs perdus" */
.journal-rescue-btn {
  position: fixed !important;
  bottom: calc(60px + 32px + 56px + 16px + env(safe-area-inset-bottom)) !important; /* Au-dessus du bouton + */
  left: 24px !important;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  padding: 12px 20px;
  font-family: 'Crimson Pro', serif;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow:
    0 4px 12px rgba(245, 158, 11, 0.3),
    0 8px 24px rgba(217, 119, 6, 0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 99;
}

.journal-rescue-btn:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow:
    0 6px 16px rgba(245, 158, 11, 0.4),
    0 12px 32px rgba(217, 119, 6, 0.5);
}

.journal-rescue-btn:active {
  transform: translateY(-2px) scale(1.02);
}

/* ANCIEN BOUTON: Conservé pour compatibilité */
.add-memory-button {
  position: fixed;
  bottom: 3rem;
  right: 3rem;
  background: linear-gradient(135deg,
    rgba(193, 120, 84, 1) 0%,
    rgba(232, 168, 124, 1) 50%,
    rgba(193, 120, 84, 1) 100%
  );
  background-size: 200% 200%;
  color: white;
  border: none;
  border-radius: 50%;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow:
    0 0 0 0 rgba(193, 120, 84, 0.4),
    0 6px 20px rgba(161, 94, 61, 0.3),
    0 15px 45px rgba(161, 94, 61, 0.4),
    inset 0 -3px 8px rgba(0,0,0,0.2),
    inset 0 3px 8px rgba(255,255,255,0.3);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  animation:
    float 4s ease-in-out infinite,
    glow 2s ease-in-out infinite,
    gradientShift 4s ease infinite;
  position: relative;
  overflow: hidden;
}

.add-memory-button::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    rgba(193, 120, 84, 0.8),
    rgba(232, 168, 124, 0.8),
    rgba(193, 120, 84, 0.8)
  );
  filter: blur(15px);
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -1;
  animation: spin 3s linear infinite;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

.add-memory-button::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0.3) 0%,
    transparent 50%
  );
  pointer-events: none;
}

.add-memory-button:hover::before {
  opacity: 1;
}

.add-memory-button:hover {
  transform: scale(1.2) rotate(90deg);
  box-shadow:
    0 0 0 15px rgba(193, 120, 84, 0.1),
    0 0 0 30px rgba(193, 120, 84, 0.05),
    0 10px 30px rgba(161, 94, 61, 0.4),
    0 20px 60px rgba(161, 94, 61, 0.5),
    inset 0 -3px 10px rgba(0,0,0,0.3),
    inset 0 3px 10px rgba(255,255,255,0.4);
  animation: none;
}

.add-memory-button:active {
  transform: scale(1.1) rotate(90deg);
  box-shadow:
    0 0 0 10px rgba(193, 120, 84, 0.2),
    0 5px 15px rgba(161, 94, 61, 0.5),
    inset 0 3px 10px rgba(0,0,0,0.4);
}

/* ============================================================================
   État vide
   ============================================================================ */
.journal-empty-state {
  text-align: center;
  padding: 4rem 2rem;
  max-width: 600px;
  margin: 0 auto;
  animation: fadeInUp 1s ease;
}

.journal-empty-icon {
  font-size: 80px;
  margin-bottom: 2rem;
  animation: float 3s ease-in-out infinite;
}

.journal-empty-title {
  font-family: 'Playfair Display', serif;
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--journal-color-terracotta);
  margin: 0 0 1rem 0;
}

.journal-empty-text {
  font-family: 'Crimson Pro', serif;
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--journal-color-text-light);
  margin: 0 0 2rem 0;
}

/* ============================================================================
   Statistiques
   ============================================================================ */
.journal-stats-bar {
  background: #000000;
  border: none;
  border-radius: var(--journal-radius-lg);
  padding: var(--journal-spacing-md);
  margin-bottom: var(--journal-spacing-lg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: fadeInUp 0.8s ease;
}

.journal-stats-content {
  display: flex;
  gap: var(--journal-spacing-md);
  align-items: center;
  flex-wrap: wrap;
}

.journal-progress-section {
  flex: 1;
  min-width: 200px;
}

.journal-progress-text {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-family: 'Crimson Pro', serif;
}

.journal-days-count {
  font-size: 16px;
  font-weight: 500;
  color: #ffffff;
}

.journal-completion {
  font-size: 14px;
  color: #ffffff;
}

.journal-progress-bar {
  height: 8px;
  background: rgba(193, 120, 84, 0.15);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.journal-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--journal-color-terracotta), var(--journal-color-gold));
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px rgba(193, 120, 84, 0.4);
}

.journal-current-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(193, 120, 84, 0.15));
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: var(--journal-radius-md);
  font-family: 'Crimson Pro', serif;
  font-weight: 500;
  color: var(--journal-color-text-dark);
}

.journal-badge-icon {
  font-size: 24px;
}

.journal-badge-name {
  font-size: 15px;
}

/* ============================================================================
   Actions des blocs (édition/suppression/décoration)
   ============================================================================ */
.journal-block-header {
  position: absolute;
  top: 1rem; /* ✅ Positionné en haut à droite du bloc */
  right: 1rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 0.6rem; /* ✅ Espacement uniforme entre les 3 boutons */
}

.book-spread:hover .journal-block-header {
  opacity: 1;
}

/* ✅ Aussi afficher au hover du bloc lui-même (utile pour les petites décorations) */
.page-content:hover .journal-block-header {
  opacity: 1;
}

/* ✅ Afficher les boutons quand une décoration est sélectionnée */
.page-content.selected .journal-block-header {
  opacity: 1;
}

/* ✅ Style rond pour les boutons d'action */
.journal-block-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(193, 120, 84, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 20px;
  line-height: 1;
  box-shadow:
    0 2px 8px rgba(0,0,0,0.15),
    0 4px 16px rgba(193, 120, 84, 0.3);
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  flex-shrink: 0; /* ✅ Ne jamais rétrécir */
}

.journal-block-btn:hover {
  background: rgba(232, 168, 124, 1);
  transform: scale(1.15);
  box-shadow:
    0 4px 12px rgba(0,0,0,0.2),
    0 8px 24px rgba(193, 120, 84, 0.5),
    0 0 30px rgba(193, 120, 84, 0.4);
  border-color: rgba(255, 255, 255, 1);
}

.journal-block-btn:active {
  transform: scale(1.05);
}

/* ✅ Bouton décoration avec même couleur que les autres (terracotta) */
.journal-block-btn[data-action="decorate"] {
  background: rgba(193, 120, 84, 0.9); /* ✅ Même couleur terracotta */
}

.journal-block-btn[data-action="decorate"]:hover {
  background: rgba(232, 168, 124, 1); /* ✅ Même hover terracotta */
  box-shadow:
    0 4px 12px rgba(0,0,0,0.2),
    0 8px 24px rgba(193, 120, 84, 0.5),
    0 0 30px rgba(193, 120, 84, 0.4);
}

/* ============================================================================
   Modal
   ============================================================================ */
.journal-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999; /* ✅ Sous la sphère Ped'IA (10000) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.3s ease;
}

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

.journal-modal[hidden] {
  display: none;
}

.journal-modal__backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.92);
  /* ✅ backdrop-filter retiré pour ne pas flouter la sphère Ped'IA */
  /* backdrop-filter: blur(12px); */
  /* -webkit-backdrop-filter: blur(12px); */
  cursor: pointer;
}

.journal-modal__dialog {
  position: relative;
  /* Glass Liquid Effect */
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  padding: 2.5rem;
  border-radius: 24px;
  max-width: 520px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.15),
    inset 0 -1px 1px rgba(0, 0, 0, 0.05),
    0 8px 32px rgba(31, 38, 135, 0.25);
  animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.journal-modal__dialog::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

.journal-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0; /* ✅ Pas de padding qui déforme */
  margin: 0; /* ✅ Pas de margin qui déforme */
  box-sizing: border-box; /* ✅ Inclut border dans dimensions */
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  cursor: pointer;
  font-size: 24px;
  line-height: 1; /* ✅ Évite décalage vertical */
  color: #c17854;
  transition: all 0.2s ease;
}

.journal-modal__close:hover {
  background: rgba(193, 120, 84, 0.3);
  transform: rotate(90deg);
  box-shadow: 0 0 20px rgba(193, 120, 84, 0.4);
}

.journal-modal h3 {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 600;
  color: #e8a87c;
  margin: 0 0 0.5rem 0;
  text-align: center;
  filter: drop-shadow(0 2px 8px rgba(193, 120, 84, 0.4));
}

.journal-modal h3::after {
  content: '✦';
  display: block;
  margin-top: 0.75rem;
  color: #c17854;
  opacity: 0.6;
  font-size: 1rem;
  filter: drop-shadow(0 0 8px rgba(193, 120, 84, 0.6));
}

.journal-modal__lead {
  font-family: 'Crimson Pro', serif;
  font-size: 16px;
  color: rgba(193, 120, 84, 0.8);
  margin: 0 0 2rem 0;
  text-align: center;
}

.journal-block-types {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

.journal-block-type {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 2rem 1.5rem;
  background: rgba(193, 120, 84, 0.08);
  border: 2px solid rgba(193, 120, 84, 0.25);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Crimson Pro', serif;
  position: relative;
  overflow: hidden;
}

.journal-block-type::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(193, 120, 84, 0.15) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.journal-block-type:hover::before {
  opacity: 1;
}

.journal-block-type:hover {
  border-color: #c17854;
  background: rgba(193, 120, 84, 0.2);
  transform: translateY(-6px);
  box-shadow:
    0 8px 16px rgba(0,0,0,0.3),
    0 16px 32px rgba(193, 120, 84, 0.3),
    0 0 40px rgba(193, 120, 84, 0.2);
}

.journal-block-type:active {
  transform: translateY(-2px);
}

.journal-block-type__icon {
  font-size: 32px;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.journal-block-type:hover .journal-block-type__icon {
  transform: scale(1.15);
}

.journal-block-type__name {
  font-size: 14px;
  font-weight: 500;
  color: #e8a87c;
  text-align: center;
}

/* Formulaires */
.journal-form-group {
  margin-bottom: 1.5rem;
}

.journal-form-label {
  display: block;
  font-family: 'Crimson Pro', serif;
  font-size: 15px;
  font-weight: 500;
  color: #e8a87c;
  margin-bottom: 8px;
}

.journal-form-input,
.journal-form-textarea,
.journal-form-select {
  width: 100%;
  padding: 12px 16px;
  font-family: 'Crimson Pro', serif;
  font-size: 15px;
  color: #e8a87c;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(193, 120, 84, 0.3);
  border-radius: var(--journal-radius-sm);
  transition: all 0.2s ease;
}

.journal-form-input::placeholder,
.journal-form-textarea::placeholder {
  color: rgba(193, 120, 84, 0.5);
}

.journal-form-input:focus,
.journal-form-textarea:focus,
.journal-form-select:focus {
  outline: none;
  border-color: var(--journal-color-terracotta);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 3px rgba(193, 120, 84, 0.2),
              0 0 20px rgba(193, 120, 84, 0.3);
}

.journal-form-textarea {
  min-height: 120px;
  resize: vertical;
}

.journal-form-file-input {
  display: none;
}

.journal-form-file-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  font-family: 'Crimson Pro', serif;
  font-size: 15px;
  font-weight: 500;
  color: #e8a87c;
  background: rgba(193, 120, 84, 0.1);
  border: 2px dashed rgba(193, 120, 84, 0.4);
  border-radius: var(--journal-radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.journal-form-file-label:hover {
  background: rgba(193, 120, 84, 0.25);
  border-color: #c17854;
  box-shadow: 0 0 20px rgba(193, 120, 84, 0.3);
}

.journal-form-preview {
  margin-top: 1rem;
  max-width: 100%;
  border-radius: var(--journal-radius-sm);
}

.journal-modal__actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(193, 120, 84, 0.3);
}

.journal-modal__back {
  font-family: 'Crimson Pro', serif;
  font-size: 14px;
  color: #c17854;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px 0;
  margin-bottom: 1.5rem;
  transition: all 0.2s ease;
  filter: drop-shadow(0 0 4px rgba(193, 120, 84, 0.3));
}

.journal-modal__back:hover {
  color: #e8a87c;
  filter: drop-shadow(0 0 8px rgba(193, 120, 84, 0.6));
}

/* ============================================================================
   Rich Text Editor
   ============================================================================ */
.rich-text-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(193, 120, 84, 0.2);
  border-radius: 8px;
}

.rich-text-toolbar button {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(193, 120, 84, 0.1);
  border: 1px solid rgba(193, 120, 84, 0.3);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Crimson Pro', serif;
  font-size: 14px;
  color: #e8a87c;
}

.rich-text-toolbar button:hover {
  background: rgba(193, 120, 84, 0.3);
  border-color: #c17854;
  transform: scale(1.05);
}

.rich-text-toolbar button:active {
  transform: scale(0.95);
}

.rich-text-toolbar .font-select {
  flex: 1;
  min-width: 120px;
  padding: 6px 10px;
  font-family: 'Crimson Pro', serif;
  font-size: 13px;
  color: #e8a87c;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(193, 120, 84, 0.3);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.rich-text-toolbar .font-select:hover {
  border-color: #c17854;
  background: rgba(0, 0, 0, 0.4);
}

.rich-text-toolbar .color-picker {
  width: 40px;
  height: 32px;
  padding: 2px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(193, 120, 84, 0.3);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.rich-text-toolbar .color-picker:hover {
  border-color: #c17854;
  background: rgba(0, 0, 0, 0.4);
  transform: scale(1.05);
}

.rich-text-toolbar .color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}

.rich-text-toolbar .color-picker::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

.rich-text-editor {
  width: 100%;
  min-height: 80px;
  padding: 12px 16px;
  font-family: 'Crimson Pro', serif;
  font-size: 15px;
  color: #e8a87c;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(193, 120, 84, 0.3);
  border-radius: var(--journal-radius-sm);
  transition: all 0.2s ease;
  outline: none;
  cursor: text;
  overflow-y: auto;
  line-height: 1.5;
}

.rich-text-editor.empty::before {
  content: attr(data-placeholder);
  color: rgba(193, 120, 84, 0.5);
  pointer-events: none;
}

.rich-text-editor.empty:not(.focused)::before {
  display: block;
}

.rich-text-editor:focus {
  border-color: var(--journal-color-terracotta);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 3px rgba(193, 120, 84, 0.2),
              0 0 20px rgba(193, 120, 84, 0.3);
}

/* Styles pour le contenu formaté */
.rich-text-editor strong,
.rich-text-editor b {
  font-weight: 700;
}

.rich-text-editor em,
.rich-text-editor i {
  font-style: italic;
}

.rich-text-editor u {
  text-decoration: underline;
}

/* ============================================================================

/* ============================================================================
   Bloc Courbe de Croissance (Growth Chart) - Données automatiques
   ============================================================================ */
.journal-growth-chart-block {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 2%;
  padding: 3%;
  overflow: hidden;
  box-sizing: border-box;
  /* Pas de border, background, ni shadow */
}

/* ✅ Permettre le drag & drop : les enfants ne capturent pas les events */
.journal-growth-chart-block * {
  pointer-events: none;
}

/* Mais les poignées de resize doivent rester interactives */
.page-content[data-type="growth_chart"] .resize-handle {
  pointer-events: auto;
}

/* Header du bloc */
.growth-chart-header {
  text-align: center;
  border-bottom: 2px solid rgba(193, 120, 84, 0.2);
  padding-bottom: 0.75rem;
}

.growth-chart-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #c17854;
  margin: 0 0 0.25rem 0;
}

.growth-chart-subtitle {
  font-family: 'Crimson Pro', serif;
  font-size: 0.9rem;
  color: rgba(74, 63, 53, 0.7);
  margin: 0;
}

/* Loading state */
.growth-chart-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  color: rgba(74, 63, 53, 0.6);
}

.growth-chart-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(193, 120, 84, 0.2);
  border-top-color: #c17854;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Empty state */
.growth-chart-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: rgba(74, 63, 53, 0.6);
}

.growth-chart-empty p {
  margin: 0.5rem 0;
  font-family: 'Crimson Pro', serif;
}

.growth-chart-hint {
  font-size: 0.85rem;
  font-style: italic;
}

/* Content */
.growth-chart-content {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  flex: 1;
  overflow-y: auto;
}

/* Stats Cards - ✅ RESPONSIVE */
.growth-chart-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4%;
  flex: 1;
  align-content: center;
  justify-content: center;
}

.growth-stat {
  background: linear-gradient(135deg,
    rgba(193, 120, 84, 0.08) 0%,
    rgba(232, 168, 124, 0.12) 100%
  );
  border: 1px solid rgba(193, 120, 84, 0.2);
  border-radius: 8px;
  padding: 5% 4%;
  display: flex;
  align-items: center;
  gap: 6%;
  flex: 1 1 28%;
  min-width: 0;
  overflow: hidden;
  transition: all 0.3s ease;
}

.growth-stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(193, 120, 84, 0.15);
}

.growth-stat-icon {
  font-size: 1.5rem; /* Sera ajusté par JS */
  line-height: 1;
  flex-shrink: 0;
}

.growth-stat-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.growth-stat-label {
  font-family: 'Crimson Pro', serif;
  font-size: 0.7rem; /* Sera ajusté par JS */
  font-weight: 600;
  color: rgba(74, 63, 53, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.growth-stat-value {
  font-family: 'Playfair Display', serif;
  font-size: 1rem; /* Sera ajusté par JS */
  font-weight: 700;
  color: #c17854;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ✅ Adaptations responsive par classe de taille */
.journal-growth-chart-block.size-medium .growth-chart-stats {
  flex-direction: column;
}

.journal-growth-chart-block.size-medium .growth-stat {
  flex: 1 1 100%;
}

.journal-growth-chart-block.size-small .growth-chart-stats {
  flex-direction: column;
  gap: 2%;
}

.journal-growth-chart-block.size-small .growth-stat {
  flex: 1 1 100%;
  padding: 3% 4%;
  border-radius: 6px;
}

.journal-growth-chart-block.size-small .growth-stat-label {
  display: none;
}

.journal-growth-chart-block.size-tiny .growth-chart-stats {
  flex-direction: column;
  gap: 1%;
  padding: 0;
}

.journal-growth-chart-block.size-tiny .growth-stat {
  flex: 1 1 100%;
  padding: 2% 3%;
  border-radius: 4px;
  gap: 4%;
}

.journal-growth-chart-block.size-tiny .growth-stat-icon {
  font-size: 0.9rem;
}

.journal-growth-chart-block.size-tiny .growth-stat-value {
  font-size: 0.7rem;
}

.journal-growth-chart-block.size-tiny .growth-stat-label {
  display: none;
}

/* Graphs */
.growth-chart-graphs {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.growth-chart-graph {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(193, 120, 84, 0.15);
  border-radius: 12px;
  padding: 1rem;
}

.growth-graph-title {
  font-family: 'Crimson Pro', serif;
  font-size: 1rem;
  font-weight: 600;
  color: #4a3f35;
  margin: 0 0 0.75rem 0;
  text-align: center;
}

.growth-chart-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 0.5rem;
  height: 80px;
  padding: 0.5rem 0;
}

.growth-chart-bar-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
}

.growth-chart-bar {
  width: 100%;
  min-height: 4px;
  border-radius: 4px 4px 0 0;
  transition: all 0.3s ease;
  cursor: help;
}

.growth-chart-bar:hover {
  opacity: 0.8;
  transform: scaleY(1.05);
}

.height-bar {
  background: linear-gradient(to top,
    #5b9279 0%,
    #7db39b 100%
  );
}

.weight-bar {
  background: linear-gradient(to top,
    #c17854 0%,
    #e8a87c 100%
  );
}

.growth-chart-bar-label {
  font-family: 'Crimson Pro', serif;
  font-size: 0.65rem;
  color: rgba(74, 63, 53, 0.6);
  font-weight: 600;
}

/* Footer */
.growth-chart-footer {
  text-align: center;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(193, 120, 84, 0.15);
}

.growth-chart-data-count {
  font-family: 'Crimson Pro', serif;
  font-size: 0.75rem;
  color: rgba(74, 63, 53, 0.5);
  margin: 0;
  font-style: italic;
}

/* Responsive mobile */
@media (max-width: 768px) {
  .journal-growth-chart-block {
    padding: 1rem;
  }
  
  .growth-chart-stats {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  
  .growth-stat {
    padding: 0.75rem 0.5rem;
  }
  
  .growth-stat-icon {
    font-size: 1.5rem;
  }
  
  .growth-chart-bars {
    height: 60px;
  }
  
  .growth-chart-bar-label {
    font-size: 0.6rem;
  }
}

   Responsive
   ============================================================================ */
@media (max-width: 768px) {
  #journal-container {
    padding: 2rem 1rem;
  }

  .journal-title {
    font-size: 2.5rem;
  }

  .journal-subtitle {
    font-size: 1.6rem; /* ✅ Augmenté de 1.1rem à 1.6rem pour meilleure lisibilité */
    letter-spacing: 2px;
    margin-top: 1.5rem;
  }

  /* ✅ FORCE le layout en colonne sur mobile - sélecteur renforcé */
  .journal-spreads-container .book-spread,
  .book-spread {
    display: flex !important; /* ✅ Utiliser flexbox au lieu de grid */
    flex-direction: column !important; /* ✅ Empiler verticalement */
    grid-template-columns: none !important; /* ✅ Annule complètement le grid */
    min-height: auto !important;
    margin-bottom: 2rem;
    overflow: visible !important; /* ✅ Force visible */
    transform: none !important;
    perspective: none !important;
    gap: 0 !important; /* ✅ Pas de gap dans flexbox, on utilise margin */
    max-width: 100% !important; /* ✅ Prend toute la largeur disponible */
    padding: 1rem !important; /* ✅ Padding autour du spread */
  }

  /* ✅ Cache TOUS les pseudo-éléments du spread (reliure) */
  .book-spread::before,
  .book-spread::after,
  .journal-spreads-container .book-spread::before,
  .journal-spreads-container .book-spread::after {
    display: none !important;
    content: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
  }

  .book-spread:hover {
    transform: none !important;
  }

  /* ✅ FORCE chaque page en pleine largeur avec plus d'espace */
  .book-spread .page-left,
  .book-spread .page-right,
  .page-left,
  .page-right {
    width: 100% !important; /* ✅ Force chaque page à prendre toute la largeur */
    max-width: 100% !important;
    flex: 0 0 100% !important; /* ✅ Ne pas shrink, prendre 100% */
    border: none !important;
    border-right: none !important;
    border-radius: 16px; /* ✅ Coins arrondis pour chaque page */
    padding: 3rem 2rem !important; /* ✅ Plus de padding pour plus d'espace */
    overflow: hidden !important; /* ✅ Coupe ce qui dépasse */
    min-height: 600px !important; /* ✅ Plus de hauteur (était 400px) */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); /* ✅ Ombre individuelle */
    display: block !important; /* ✅ Force block */
    position: relative !important; /* ✅ Pour que les absolute children restent dedans */
  }

  .page-left {
    margin-bottom: 2rem !important; /* ✅ Espacement entre gauche et droite */
  }

  .page-right {
    margin-top: 0 !important;
  }

  /* ✅ Désactive les effets 3D des pages sur mobile */
  .book-spread:hover .page-left,
  .book-spread:hover .page-right {
    transform: none !important;
  }

  /* ✅ Cache les ombres de reliure sur mobile */
  .page-left::before,
  .page-right::before {
    display: none !important;
  }

  /* ✅ Cache la grille overlay sur mobile */
  .page-grid-overlay,
  .page-left .page-grid-overlay,
  .page-right .page-grid-overlay {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
  }

  /* ✅ FORCE les contenus à rester dans les pages avec plus de flexibilité */
  .page-content {
    max-width: calc(100% - 2rem) !important; /* Plus d'espace disponible */
    max-height: 700px !important; /* Plus de hauteur pour les blocs */
  }

  /* ✅ TOUS les blocs doivent avoir overflow hidden sur mobile */
  .journal-photo-block,
  .journal-quote-block,
  .journal-update-memory-block,
  .journal-milestone-block,
  .journal-text-block,
  .journal-text-simple-block,
  .journal-photo-grid-block,
  .journal-decorative-frame,
  .journal-ai-illustration-block,
  .journal-sticker-decoration,
  .journal-growth-chart-block {
    overflow: hidden !important;
    max-width: 100% !important;
    max-height: 100% !important;
    box-sizing: border-box !important;
  }

  /* ✅ Images et contenus internes */
  .journal-photo-block img,
  .journal-photo-grid-block img,
  .decorative-frame-photo img,
  .journal-ai-illustration,
  .photo-container img {
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
  }

  /* ✅ Textes dans les encadrés */
  .decorative-frame-inner,
  .decorative-frame-text,
  .decorative-frame-content,
  .journal-text-content,
  .journal-text-simple-content {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }

  /* ✅ Boutons d'action des blocs - Réduire taille sur mobile */
  .journal-block-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    max-width: 36px; /* ✅ Empêche l'agrandissement */
    max-height: 36px; /* ✅ Empêche l'agrandissement */
    font-size: 18px;
    border-width: 1.5px; /* ✅ Bordure plus fine */
    padding: 0;
    margin: 0;
    box-sizing: border-box;
  }

  /* ✅ Header des boutons - Réduire gap sur mobile */
  .journal-block-header {
    top: 0.5rem;
    right: 0.5rem;
    gap: 0.4rem;
    opacity: 1; /* ✅ Toujours visible sur mobile (pas de hover) */
  }

  /* ✅ Modal - Plus de padding sur mobile */
  .journal-modal {
    padding: 1rem;
  }

  .journal-modal__dialog {
    width: 95%; /* ✅ Utilise plus de largeur écran */
    padding: 2rem 1.5rem; /* ✅ Padding réduit */
    max-height: 90vh; /* ✅ Plus de hauteur disponible */
  }

  /* ✅ TAILLES IDENTIQUES AU DESKTOP - Pas de réduction sur mobile */
  /* Les tailles sont déjà définies avec clamp() dans le CSS principal, pas besoin de les redéfinir ici */

  /* ✅ Padding des blocs IDENTIQUE AU DESKTOP - pas de réduction */
  .journal-photo-block,
  .journal-quote-block,
  .journal-update-memory-block,
  .journal-milestone-block,
  .journal-text-block,
  .journal-photo-grid-block {
    padding: 1.5rem; /* Même padding que desktop pour garder la même apparence */
  }

  .add-memory-button {
    width: 60px;
    height: 60px;
    bottom: 1.5rem;
    right: 1.5rem;
  }

  .journal-block-types {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }

  .journal-block-type {
    padding: 1.5rem 1rem;
  }

  .journal-block-type__icon {
    font-size: 24px;
  }

  .journal-block-type__name {
    font-size: 12px;
  }

  /* ✅ Bouton flottant + - Adapter pour mobile */
  .journal-floating-add-btn {
    width: 52px;
    height: 52px;
    min-width: 52px;
    min-height: 52px;
    max-width: 52px;
    max-height: 52px;
    font-size: 28px;
    bottom: calc(60px + 24px + env(safe-area-inset-bottom)) !important;
    left: 16px !important;
  }

  /* ✅ Bouton fermeture modale - Adapter pour mobile */
  .journal-modal__close {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    max-width: 32px;
    max-height: 32px;
    font-size: 20px;
    top: 12px;
    right: 12px;
  }

  /* ✅ Poignées de resize plus grandes sur mobile pour meilleure prise */
  .page-content .resize-handle {
    width: 24px;
    height: 24px;
    opacity: 0;
    pointer-events: none;
    touch-action: none;
  }

  /* Coins - ajuster la position pour la nouvelle taille */
  .page-content .resize-handle.top-left { top: -12px; left: -12px; }
  .page-content .resize-handle.top-right { top: -12px; right: -12px; }
  .page-content .resize-handle.bottom-left { bottom: -12px; left: -12px; }
  .page-content .resize-handle.bottom-right { bottom: -12px; right: -12px; }

  /* Côtés - ajuster pour la nouvelle taille */
  .page-content .resize-handle.top-center { top: -12px; }
  .page-content .resize-handle.bottom-center { bottom: -12px; }
  .page-content .resize-handle.middle-left { left: -12px; }
  .page-content .resize-handle.middle-right { right: -12px; }

  /* ✅ Améliorer l'espacement du contenu des blocs sur mobile */
  .page-content {
    cursor: pointer;
  }

  /* ✅ Message du mode édition plus compact sur mobile */
  .page-content.edit-mode::after {
    font-size: 11px;
    padding: 5px 10px;
    top: -30px;
  }
}

@media (max-width: 480px) {
  .journal-title {
    font-size: 2rem;
  }

  .journal-subtitle {
    font-size: 1.35rem; /* ✅ Réduit légèrement pour petits écrans mais reste lisible */
    letter-spacing: 1.5px;
  }

  .journal-spreads-container .book-spread,
  .book-spread {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
    gap: 0 !important;
    transform: none !important;
    perspective: none !important;
    overflow: visible !important;
    max-width: 100% !important;
    padding: 0.75rem !important;
  }

  /* ✅ Cache TOUS les pseudo-éléments (reliure + texture) */
  .book-spread::before,
  .book-spread::after,
  .journal-spreads-container .book-spread::before,
  .journal-spreads-container .book-spread::after {
    display: none !important;
    content: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
  }

  .book-spread:hover {
    transform: none !important;
  }

  .book-spread:hover .page-left,
  .book-spread:hover .page-right {
    transform: none !important;
  }

  .book-spread .page-left,
  .book-spread .page-right,
  .page-left,
  .page-right {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    padding: 2.5rem 1.5rem !important; /* ✅ Un peu plus de padding */
    overflow: hidden !important; /* ✅ Coupe ce qui dépasse */
    min-height: 550px !important; /* ✅ Plus de hauteur (était 350px) */
    border-radius: 12px;
    border: none !important;
    border-right: none !important;
    display: block !important;
    position: relative !important;
  }

  .page-left {
    margin-bottom: 1.5rem !important;
  }

  .page-right {
    margin-top: 0 !important;
  }

  .page-left::before,
  .page-right::before {
    display: none !important;
  }

  /* ✅ Cache la grille overlay sur mobile */
  .page-grid-overlay,
  .page-left .page-grid-overlay,
  .page-right .page-grid-overlay {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
  }

  /* ✅ FORCE les contenus à rester dans les pages */
  .page-content {
    max-width: calc(100% - 1.5rem) !important;
    max-height: 650px !important; /* Plus de hauteur */
  }

  /* ✅ TOUS les blocs doivent avoir overflow hidden */
  .journal-photo-block,
  .journal-quote-block,
  .journal-update-memory-block,
  .journal-milestone-block,
  .journal-text-block,
  .journal-text-simple-block,
  .journal-photo-grid-block,
  .journal-decorative-frame,
  .journal-ai-illustration-block,
  .journal-sticker-decoration,
  .journal-growth-chart-block {
    overflow: hidden !important;
    max-width: 100% !important;
    max-height: 100% !important;
    box-sizing: border-box !important;
  }

  /* ✅ Images */
  .journal-photo-block img,
  .journal-photo-grid-block img,
  .decorative-frame-photo img,
  .journal-ai-illustration,
  .photo-container img {
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
  }

  /* ✅ Textes */
  .decorative-frame-inner,
  .decorative-frame-text,
  .decorative-frame-content,
  .journal-text-content,
  .journal-text-simple-content {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }

  /* ✅ Boutons encore plus petits sur très petits écrans */
  .journal-block-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    max-width: 32px;
    max-height: 32px;
    font-size: 16px;
  }

  .journal-block-header {
    top: 0.25rem;
    right: 0.25rem;
    gap: 0.3rem;
  }

  /* ✅ Bouton flottant + encore plus petit */
  .journal-floating-add-btn {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    max-width: 48px;
    max-height: 48px;
    font-size: 24px;
    left: 12px !important;
  }

  /* ✅ Modal presque plein écran */
  .journal-modal__dialog {
    width: 98%;
    padding: 1.5rem 1rem;
    max-height: 92vh;
  }

  .journal-modal__close {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    max-width: 28px;
    max-height: 28px;
    font-size: 18px;
    top: 8px;
    right: 8px;
  }

  /* ✅ TAILLES IDENTIQUES AU DESKTOP - Même sur très petits écrans */
  /* Les tailles de police utilisent déjà clamp() qui s'adapte automatiquement */

  /* ✅ Padding IDENTIQUE AU DESKTOP */
  .journal-photo-block,
  .journal-quote-block,
  .journal-milestone-block,
  .journal-text-block,
  .journal-photo-grid-block {
    padding: 1.5rem; /* Même padding que desktop */
  }

  .photos-grid {
    gap: 0.5rem; /* ✅ Gap encore réduit */
  }
}

/* ============================================================================
   MODE PAYSAGE MOBILE - Rendu identique au desktop
   ============================================================================ */
@media (orientation: landscape) and (max-height: 500px) {
  /* Container avec moins de padding */
  #journal-container {
    padding: 1rem;
  }

  /* ✅ Layout côte-à-côte comme desktop */
  .journal-spreads-container .book-spread,
  .book-spread {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    flex-direction: row !important;
    gap: 0 !important;
    max-width: 100% !important;
    padding: 0.5rem !important;
    aspect-ratio: 2 / 1.4 !important;
  }

  /* Pages côte-à-côte avec ratio A5 paysage */
  .book-spread .page-left,
  .book-spread .page-right,
  .page-left,
  .page-right {
    width: 100% !important;
    max-width: 100% !important;
    min-height: auto !important;
    height: 100% !important;
    aspect-ratio: 1 / 1.414 !important;
    padding: 1.5rem !important;
    margin: 0 !important;
  }

  .page-left {
    margin-bottom: 0 !important;
    border-right: 1px solid rgba(139, 115, 85, 0.08) !important;
  }

  /* Réactiver les effets 3D légers */
  .book-spread:hover .page-left,
  .book-spread:hover .page-right {
    transform: none !important;
  }

  /* Masquer l'overlay de rotation */
  .journal-rotate-overlay {
    display: none !important;
  }

  /* Header plus compact */
  .journal-header {
    margin-bottom: 1rem !important;
    padding: 0.5rem !important;
  }

  .journal-title {
    font-size: 1.8rem !important;
  }

  .journal-subtitle {
    font-size: 1rem !important;
  }

  /* Toolbar ajustée */
  .journal-toolbar {
    top: 0.5rem !important;
    right: 0.5rem !important;
    gap: 0.25rem !important;
  }

  .journal-block-btn {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    font-size: 14px !important;
  }

  /* Bouton flottant repositionné */
  .journal-floating-add-btn {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    font-size: 20px !important;
    bottom: 10px !important;
    left: 10px !important;
  }

  /* Contenu des blocs - mêmes proportions que desktop */
  .page-content {
    max-height: none !important;
  }

  /* Poignées de resize plus petites en paysage */
  .page-content .resize-handle {
    width: 18px;
    height: 18px;
  }

  .page-content .resize-handle.top-left { top: -9px; left: -9px; }
  .page-content .resize-handle.top-right { top: -9px; right: -9px; }
  .page-content .resize-handle.bottom-left { bottom: -9px; left: -9px; }
  .page-content .resize-handle.bottom-right { bottom: -9px; right: -9px; }
  .page-content .resize-handle.top-center { top: -9px; }
  .page-content .resize-handle.bottom-center { bottom: -9px; }
  .page-content .resize-handle.middle-left { left: -9px; }
  .page-content .resize-handle.middle-right { right: -9px; }
}

/* ============================================================================
   Types de blocs - Encadré Décoratif
   ============================================================================ */
.journal-decorative-frame {
  width: 100%;
  height: 100%;
  padding: clamp(1rem, 4%, 2rem);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: rgba(255, 255, 255, 0.95);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden; /* ✅ Empêcher le débordement */
  box-sizing: border-box; /* ✅ Inclure le padding dans la taille */
}

/* Coins décoratifs */
.decorative-frame-corner {
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid var(--custom-border-color, #c17854);
  opacity: 0.6;
}

.decorative-frame-corner.top-left {
  top: 8px;
  left: 8px;
  border-right: none;
  border-bottom: none;
}

.decorative-frame-corner.top-right {
  top: 8px;
  right: 8px;
  border-left: none;
  border-bottom: none;
}

.decorative-frame-corner.bottom-left {
  bottom: 8px;
  left: 8px;
  border-right: none;
  border-top: none;
}

.decorative-frame-corner.bottom-right {
  bottom: 8px;
  right: 8px;
  border-left: none;
  border-top: none;
}

/* Contenu interne */
.decorative-frame-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(0.5rem, 2%, 1rem);
}

/* Style Vintage */
.journal-decorative-frame.frame-vintage {
  background: linear-gradient(135deg, #faf8f5 0%, #f5efe6 100%);
  border: 3px double #c17854;
  box-shadow:
    inset 0 0 30px rgba(193, 120, 84, 0.1),
    0 4px 12px rgba(0,0,0,0.15);
}

/* Style Modern */
.journal-decorative-frame.frame-modern {
  background: #ffffff;
  border: 4px solid #c17854;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  border-radius: 8px;
}

.journal-decorative-frame.frame-modern .decorative-frame-corner {
  display: none;
}

/* Style Ornate (orné) */
.journal-decorative-frame.frame-ornate {
  background: radial-gradient(circle at center, #fff5f0 0%, #f5efe6 100%);
  border: 5px solid;
  border-image: linear-gradient(135deg, #c17854, #d4af37, #c17854) 1;
  box-shadow:
    inset 0 0 50px rgba(193, 120, 84, 0.15),
    0 6px 20px rgba(0,0,0,0.2);
}

/* Style Simple */
.journal-decorative-frame.frame-simple {
  background: #fffbf8;
  border: 2px solid rgba(193, 120, 84, 0.4);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.journal-decorative-frame.frame-simple .decorative-frame-corner {
  opacity: 0.3;
}

/* Style Polaroid */
.journal-decorative-frame.frame-polaroid {
  background: #fefefe;
  border: none;
  padding: clamp(0.5rem, 2%, 1rem) clamp(0.5rem, 2%, 1rem) clamp(2rem, 6%, 3rem);
  box-shadow:
    0 4px 8px rgba(0,0,0,0.1),
    0 8px 20px rgba(0,0,0,0.15);
  transform: rotate(-1deg);
}

.journal-decorative-frame.frame-polaroid .decorative-frame-corner {
  display: none;
}

/* Style Botanical */
.journal-decorative-frame.frame-botanical {
  background:
    radial-gradient(circle at 20% 30%, rgba(139, 195, 139, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(193, 120, 84, 0.1) 0%, transparent 50%),
    linear-gradient(135deg, #fffbf8 0%, #f5f2ed 100%);
  border: 3px solid rgba(139, 195, 139, 0.4);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

/* Patterns de fond */
.journal-decorative-frame.pattern-dots {
  background-image:
    radial-gradient(circle, rgba(193, 120, 84, 0.1) 1px, transparent 1px);
  background-size: 12px 12px;
  background-position: 0 0, 6px 6px;
}

.journal-decorative-frame.pattern-lines {
  background-image:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 10px,
      rgba(193, 120, 84, 0.05) 10px,
      rgba(193, 120, 84, 0.05) 11px
    );
}

.journal-decorative-frame.pattern-flowers::before {
  content: '✿ ❀ ✿ ❀ ✿';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(193, 120, 84, 0.3);
  font-size: 1.2rem;
  letter-spacing: 15px;
  white-space: nowrap;
}

.journal-decorative-frame.pattern-hearts::before {
  content: '♥ ♥ ♥ ♥ ♥';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(193, 120, 84, 0.3);
  font-size: 1rem;
  letter-spacing: 12px;
  white-space: nowrap;
}

.journal-decorative-frame.pattern-stars::before {
  content: '✦ ✧ ✦ ✧ ✦';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(193, 120, 84, 0.3);
  font-size: 1.2rem;
  letter-spacing: 15px;
  white-space: nowrap;
}

/* Contenu photo */
.decorative-frame-photo {
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 4px;
}

.decorative-frame-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(1.05) saturate(1.1);
}

/* Contenu texte */
.decorative-frame-text {
  text-align: center;
  padding: clamp(0.5rem, 2%, 1rem);
}

.decorative-frame-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.2rem, 4vw, 1.8rem);
  color: #5a4a3a;
  margin: 0 0 clamp(0.5rem, 2%, 1rem) 0;
  font-weight: 600;
}

.decorative-frame-content {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(0.95rem, 3vw, 1.15rem);
  color: #5a4a3a;
  line-height: 1.7;
  white-space: pre-wrap;
}

.decorative-frame-date {
  position: absolute;
  bottom: clamp(0.5rem, 2%, 1rem);
  right: clamp(0.75rem, 3%, 1.5rem);
  font-size: 0.85rem;
}

/* Hover effects */
.book-spread:hover .journal-decorative-frame {
  transform: translateY(-2px);
  box-shadow:
    inset 0 0 40px rgba(193, 120, 84, 0.15),
    0 8px 20px rgba(0,0,0,0.2);
}

.journal-decorative-frame.frame-polaroid:hover {
  transform: rotate(0deg) translateY(-4px);
}

/* ============================================================================
   Modal de décorations SVG
   ============================================================================ */
.decoration-categories {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(193, 120, 84, 0.2);
}

.decoration-category-tab {
  padding: 8px 16px;
  font-family: 'Crimson Pro', serif;
  font-size: 14px;
  font-weight: 500;
  color: rgba(193, 120, 84, 0.7);
  background: rgba(193, 120, 84, 0.08);
  border: 1px solid rgba(193, 120, 84, 0.2);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.decoration-category-tab:hover {
  background: rgba(193, 120, 84, 0.15);
  border-color: rgba(193, 120, 84, 0.4);
  color: #c17854;
}

.decoration-category-tab.active {
  background: linear-gradient(135deg, rgba(193, 120, 84, 0.3), rgba(168, 85, 247, 0.2));
  border-color: #c17854;
  color: #e8a87c;
  box-shadow: 0 0 20px rgba(193, 120, 84, 0.3);
}

.decoration-icons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 0.75rem;
  max-height: 300px;
  overflow-y: auto;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  margin-bottom: 1.5rem;
}

.decoration-icon-btn {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(193, 120, 84, 0.1);
  border: 2px solid rgba(193, 120, 84, 0.2);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: #e8a87c;
}

.decoration-icon-btn svg {
  width: 32px;
  height: 32px;
}

.decoration-icon-btn:hover {
  background: rgba(193, 120, 84, 0.25);
  border-color: #c17854;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(193, 120, 84, 0.3);
}

.decoration-icon-btn.active {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.3), rgba(139, 92, 246, 0.2));
  border-color: rgba(168, 85, 247, 0.8);
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.5);
}

.decoration-customization {
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(193, 120, 84, 0.2);
  border-radius: 12px;
  margin-bottom: 1.5rem;
}

.decoration-customization h4 {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  color: #e8a87c;
  margin: 0 0 1rem 0;
}

.decoration-control-group {
  margin-bottom: 1.25rem;
}

.decoration-size-options {
  display: flex;
  gap: 0.5rem;
}

.decoration-size-btn {
  flex: 1;
  padding: 10px;
  font-family: 'Crimson Pro', serif;
  font-size: 14px;
  color: rgba(193, 120, 84, 0.7);
  background: rgba(193, 120, 84, 0.08);
  border: 1px solid rgba(193, 120, 84, 0.2);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.decoration-size-btn:hover {
  background: rgba(193, 120, 84, 0.15);
  border-color: rgba(193, 120, 84, 0.4);
  color: #c17854;
}

.decoration-size-btn.active {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.3), rgba(139, 92, 246, 0.2));
  border-color: rgba(168, 85, 247, 0.8);
  color: #e8a87c;
}

.decoration-color-picker {
  width: 100%;
  height: 48px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(193, 120, 84, 0.3);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.decoration-color-picker:hover {
  border-color: #c17854;
  box-shadow: 0 0 20px rgba(193, 120, 84, 0.3);
}

.decoration-slider {
  width: 100%;
  height: 8px;
  background: rgba(193, 120, 84, 0.2);
  border-radius: 4px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.decoration-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #c17854, #e8a87c);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transition: all 0.2s ease;
}

.decoration-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(193, 120, 84, 0.5);
}

.decoration-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #c17854, #e8a87c);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transition: all 0.2s ease;
}

.decoration-slider::-moz-range-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(193, 120, 84, 0.5);
}

.decoration-preview {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(193, 120, 84, 0.3);
  border-radius: 8px;
  text-align: center;
}

.decoration-preview p {
  font-family: 'Crimson Pro', serif;
  font-size: 14px;
  color: rgba(193, 120, 84, 0.7);
  margin: 0 0 1rem 0;
}

.decoration-preview-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.decoration-preview-icon svg {
  width: 100%;
  height: 100%;
}

/* ============================================================================
   Bloc de décoration SVG (sticker)
   ============================================================================ */
.journal-sticker-decoration {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden; /* ✅ Empêcher le débordement */
  box-sizing: border-box; /* ✅ Inclure le padding dans la taille */
}

.journal-sticker-decoration svg {
  width: 100%;
  height: 100%;
  pointer-events: none; /* Le SVG ne bloque pas les events, mais le container oui */
}

/* ✅ Indicateur visuel quand une décoration est sélectionnée */
.page-content.selected {
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.6),
              0 0 20px rgba(168, 85, 247, 0.4);
  animation: pulse 1s ease-in-out infinite;
}

/* ============================================================================
   Sélecteur de thème
   ============================================================================ */

/* Options de thèmes */
.theme-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
  padding: 4px;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.theme-option:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--journal-color-terracotta);
  transform: translateX(4px);
}

.theme-option.active {
  background: linear-gradient(135deg, rgba(193, 120, 84, 0.15), rgba(212, 175, 55, 0.1));
  border-color: var(--journal-color-terracotta);
  box-shadow: 0 0 20px var(--journal-spine-shadow);
}

.theme-option__preview {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.theme-option:hover .theme-option__preview {
  transform: scale(1.1);
}

/* Previews spécifiques à chaque thème */
.theme-preview-classic {
  background: linear-gradient(135deg, #f5efe6, #c17854);
}

.theme-preview-pastel {
  background: linear-gradient(135deg, #fef6fb, #f8b4d9, #a8d8ea);
}

.theme-preview-bold {
  background: linear-gradient(135deg, #ff6b6b, #4ecdc4, #ffe66d);
}

.theme-preview-vintage {
  background: linear-gradient(135deg, #f4efe4, #8b7355, #c4a77d);
  filter: sepia(20%);
}

.theme-preview-nature {
  background: linear-gradient(135deg, #f0f5ed, #5d8a66, #8fb996);
}

.theme-option__info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.theme-option__name {
  font-family: var(--journal-font-title);
  font-size: 18px;
  font-weight: 600;
  color: var(--journal-color-secondary);
}

.theme-option__desc {
  font-family: var(--journal-font-body);
  font-size: 13px;
  color: var(--journal-color-text-light);
}

.theme-option__check {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--journal-color-terracotta);
  color: white;
  border-radius: 50%;
  font-size: 14px;
  font-weight: bold;
}

/* Dialog spécifique au sélecteur de thème */
.theme-selector-dialog {
  max-width: 480px;
}

/* Bouton thème dans les actions des blocs */
.journal-block-btn[data-action="theme"] {
  background: linear-gradient(135deg, var(--journal-color-terracotta), var(--journal-color-gold)) !important;
}

.journal-block-btn[data-action="theme"]:hover {
  background: linear-gradient(135deg, var(--journal-color-secondary), var(--journal-color-gold)) !important;
}

/* Responsive */
@media (max-width: 768px) {
  .theme-options {
    max-height: 350px;
  }

  .theme-option {
    padding: 12px;
    gap: 12px;
  }

  .theme-option__preview {
    width: 48px;
    height: 48px;
    font-size: 24px;
  }

  .theme-option__name {
    font-size: 16px;
  }

  .theme-option__desc {
    font-size: 12px;
  }
}

/* ============================================================================
   Sélecteur de textures d'arrière-plan
   ============================================================================ */

/* Options de textures (même style que theme-options) */
.texture-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
  padding: 4px;
}

.texture-option {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.texture-option:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--journal-color-terracotta);
  transform: translateX(4px);
}

.texture-option.active {
  background: linear-gradient(135deg, rgba(193, 120, 84, 0.15), rgba(212, 175, 55, 0.1));
  border-color: var(--journal-color-terracotta);
  box-shadow: 0 0 20px var(--journal-spine-shadow);
}

.texture-option__preview {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
  transition: transform 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
}

.texture-option:hover .texture-option__preview {
  transform: scale(1.1);
}

.texture-option__icon {
  position: relative;
  z-index: 1;
}

.texture-option__info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.texture-option__name {
  font-family: var(--journal-font-title);
  font-size: 18px;
  font-weight: 600;
  color: var(--journal-color-secondary);
}

.texture-option__desc {
  font-family: var(--journal-font-body);
  font-size: 13px;
  color: var(--journal-color-text-light);
}

.texture-option__check {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--journal-color-terracotta);
  color: white;
  border-radius: 50%;
  font-size: 14px;
  font-weight: bold;
}

/* Dialog spécifique au sélecteur de texture */
.texture-selector-dialog {
  max-width: 480px;
}

/* Bouton texture dans les actions des blocs */
.journal-block-btn[data-action="texture"] {
  background: linear-gradient(135deg, #8b7355, #c4a77d) !important;
}

.journal-block-btn[data-action="texture"]:hover {
  background: linear-gradient(135deg, #a89078, #d4af37) !important;
}

/* Classes de textures appliquées aux pages */
.texture-none {
  /* Pas de texture supplémentaire, garde le fond existant */
}

.texture-dots {
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.1) 1px, transparent 1px) !important;
  background-size: 20px 20px !important;
  background-position: 0 0, 10px 10px !important;
}

.texture-lines {
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 29px,
    rgba(0, 0, 0, 0.08) 29px,
    rgba(0, 0, 0, 0.08) 30px
  ) !important;
}

.texture-grid {
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.05) 1px, transparent 1px) !important;
  background-size: 20px 20px !important;
}

.texture-flowers {
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 35px,
    rgba(255, 182, 193, 0.1) 35px,
    rgba(255, 182, 193, 0.1) 70px
  ) !important;
}

/* ✨ Confettis - Petits confettis colorés festifs */
.texture-confetti {
  background-image:
    radial-gradient(circle at 15% 20%, rgba(255, 107, 107, 0.3) 0%, transparent 4%),
    radial-gradient(circle at 45% 35%, rgba(78, 205, 196, 0.3) 0%, transparent 5%),
    radial-gradient(circle at 75% 15%, rgba(255, 230, 109, 0.3) 0%, transparent 4%),
    radial-gradient(circle at 25% 60%, rgba(138, 43, 226, 0.25) 0%, transparent 5%),
    radial-gradient(circle at 60% 75%, rgba(255, 182, 193, 0.28) 0%, transparent 4%),
    radial-gradient(circle at 85% 50%, rgba(255, 107, 107, 0.25) 0%, transparent 5%),
    radial-gradient(circle at 10% 85%, rgba(78, 205, 196, 0.28) 0%, transparent 4%),
    radial-gradient(circle at 90% 85%, rgba(255, 230, 109, 0.26) 0%, transparent 5%) !important;
  background-size: 90px 90px !important;
  background-position: 0 0, 30px 30px, 60px 15px, 15px 60px, 45px 75px, 75px 45px, 10px 80px, 80px 80px !important;
}

/* 🌈 Arc-en-ciel - Bandes arc-en-ciel subtiles et douces */
.texture-rainbow {
  background-image:
    repeating-linear-gradient(
      135deg,
      rgba(255, 0, 0, 0.08) 0px,
      rgba(255, 127, 0, 0.08) 15px,
      rgba(255, 255, 0, 0.08) 30px,
      rgba(0, 255, 0, 0.08) 45px,
      rgba(0, 127, 255, 0.08) 60px,
      rgba(75, 0, 130, 0.08) 75px,
      rgba(148, 0, 211, 0.08) 90px,
      transparent 90px,
      transparent 120px
    ) !important;
  background-size: 200px 200px !important;
}

/* 🦋 Papillons - Motif papillons délicats */
.texture-butterflies {
  background-image:
    radial-gradient(ellipse 25px 20px at 20% 25%, rgba(138, 43, 226, 0.2) 0%, rgba(138, 43, 226, 0.12) 40%, transparent 60%),
    radial-gradient(ellipse 22px 18px at 22% 25%, rgba(186, 85, 211, 0.18) 0%, rgba(186, 85, 211, 0.1) 40%, transparent 60%),
    radial-gradient(ellipse 28px 22px at 70% 60%, rgba(255, 182, 193, 0.22) 0%, rgba(255, 182, 193, 0.14) 40%, transparent 60%),
    radial-gradient(ellipse 24px 19px at 72% 60%, rgba(255, 192, 203, 0.2) 0%, rgba(255, 192, 203, 0.12) 40%, transparent 60%),
    radial-gradient(ellipse 26px 21px at 50% 85%, rgba(147, 112, 219, 0.18) 0%, rgba(147, 112, 219, 0.1) 40%, transparent 60%),
    radial-gradient(ellipse 23px 18px at 52% 85%, rgba(221, 160, 221, 0.16) 0%, rgba(221, 160, 221, 0.08) 40%, transparent 60%) !important;
  background-size: 120px 120px !important;
  background-position: 0 0, 60px 60px, 30px 90px, 90px 30px !important;
}

/* ☁️ Nuages - Nuages doux et rêveurs */
.texture-clouds {
  background-image:
    radial-gradient(ellipse 120px 60px at 25% 30%, rgba(173, 216, 230, 0.25), rgba(173, 216, 230, 0.12) 50%, transparent 70%),
    radial-gradient(ellipse 140px 70px at 75% 70%, rgba(135, 206, 250, 0.22), rgba(135, 206, 250, 0.1) 50%, transparent 70%),
    radial-gradient(ellipse 110px 55px at 55% 15%, rgba(176, 224, 230, 0.2), rgba(176, 224, 230, 0.08) 50%, transparent 65%),
    radial-gradient(ellipse 130px 65px at 10% 80%, rgba(173, 216, 230, 0.18), rgba(173, 216, 230, 0.09) 50%, transparent 68%),
    radial-gradient(ellipse 125px 62px at 90% 50%, rgba(135, 206, 250, 0.19), rgba(135, 206, 250, 0.1) 50%, transparent 67%) !important;
  background-size: 250px 200px !important;
  background-position: 0 0, 125px 100px, 60px 150px, 180px 50px, 90px 170px !important;
}

/* 🎵 Notes musicales - Petites notes de musique discrètes */
.texture-music {
  background-image:
    radial-gradient(circle at 20% 30%, rgba(147, 112, 219, 0.22) 0%, rgba(147, 112, 219, 0.1) 5%, transparent 12%),
    radial-gradient(ellipse 8px 20px at 21% 28%, rgba(147, 112, 219, 0.18) 0%, transparent 50%),
    radial-gradient(circle at 60% 70%, rgba(186, 85, 211, 0.2) 0%, rgba(186, 85, 211, 0.08) 5%, transparent 14%),
    radial-gradient(ellipse 7px 18px at 61% 68%, rgba(186, 85, 211, 0.16) 0%, transparent 50%),
    radial-gradient(circle at 80% 25%, rgba(138, 43, 226, 0.18) 0%, rgba(138, 43, 226, 0.09) 5%, transparent 13%),
    radial-gradient(ellipse 8px 19px at 81% 23%, rgba(138, 43, 226, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 15% 75%, rgba(147, 112, 219, 0.19) 0%, rgba(147, 112, 219, 0.08) 5%, transparent 12%),
    radial-gradient(ellipse 7px 18px at 16% 73%, rgba(147, 112, 219, 0.14) 0%, transparent 50%) !important;
  background-size: 110px 110px !important;
  background-position: 0 0, 55px 55px, 25px 80px, 80px 30px !important;
}

/* Responsive */
@media (max-width: 768px) {
  .texture-options {
    max-height: 350px;
  }

  .texture-option {
    padding: 12px;
    gap: 12px;
  }

  .texture-option__preview {
    width: 48px;
    height: 48px;
    font-size: 24px;
  }

  .texture-option__name {
    font-size: 16px;
  }

  .texture-option__desc {
    font-size: 12px;
  }
}

/* ============================================================================
   Layers Modal - Gestion des calques (z-index)
   ============================================================================ */

/* Modale plus large pour afficher la liste de blocs */
.layers-modal-dialog {
  max-width: 600px !important;
  /* Garder le fond sombre par défaut, pas de override */
}

.layers-controls {
  padding: 24px;
}

.layers-header {
  margin-bottom: 24px;
  text-align: center;
}

.layers-title {
  font-size: 20px;
  font-weight: 700;
  color: #e8a87c;
  margin: 0 0 8px 0;
  font-family: 'Georgia', serif;
}

.layers-subtitle {
  font-size: 14px;
  color: rgba(232, 168, 124, 0.7);
  margin: 0;
}

.layers-blocks-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
  max-height: 400px;
  overflow-y: auto;
  padding: 4px;
}

.layers-block-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(193, 120, 84, 0.3);
  border-radius: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.layers-block-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(193, 120, 84, 0.5);
  box-shadow: 0 4px 12px rgba(193, 120, 84, 0.2);
  transform: translateY(-2px);
}

.layers-block-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.layers-block-icon {
  font-size: 32px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(193, 120, 84, 0.1), rgba(232, 168, 124, 0.1));
  border-radius: 10px;
  flex-shrink: 0;
}

.layers-block-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.layers-block-type {
  font-size: 15px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.layers-block-zindex {
  font-size: 12px;
  color: rgba(232, 168, 124, 0.7);
  font-family: 'Courier New', monospace;
}

.layers-block-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.layers-move-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #c17854, #e8a87c);
  color: white;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(193, 120, 84, 0.3);
}

.layers-move-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(193, 120, 84, 0.4);
  background: linear-gradient(135deg, #b06844, #d89866);
}

.layers-move-btn:active:not(:disabled) {
  transform: translateY(0);
}

.layers-move-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  box-shadow: none;
}

.layers-empty {
  padding: 40px 20px;
  text-align: center;
}

.layers-empty p {
  font-size: 16px;
  color: rgba(232, 168, 124, 0.7);
  margin: 0;
}

.layers-info {
  padding: 16px;
  background: rgba(193, 120, 84, 0.15);
  border-radius: 10px;
  border-left: 4px solid #e8a87c;
}

.layers-info p {
  margin: 0;
  font-size: 13px;
  color: rgba(232, 168, 124, 0.8);
  line-height: 1.6;
}

.layers-close-btn {
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, #5b9279, #7db39b);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 2px 8px rgba(91, 146, 121, 0.3);
  margin-top: 16px;
}

.layers-close-btn:hover {
  background: linear-gradient(135deg, #4a8268, #6ca389);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(91, 146, 121, 0.4);
}

.layers-close-btn:active {
  transform: translateY(0);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .layers-controls {
    padding: 16px;
  }

  .layers-blocks-list {
    max-height: 300px;
  }

  .layers-block-item {
    padding: 12px;
  }

  .layers-block-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
  }

  .layers-block-type {
    font-size: 14px;
  }

  .layers-move-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
}

/* ============================================================================
   Fix pour les modales <dialog> - Réinitialiser les styles par défaut
   ============================================================================ */
dialog.journal-modal {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  max-width: none;
  max-height: none;
  width: 100%;
  height: 100%;
  z-index: 9998; /* ✅ Sous la sphère Ped'IA même dans le top layer */
}

dialog.journal-modal::backdrop {
  display: none; /* On utilise notre propre backdrop */
}

/* ✅ Forcer la sphère Ped'IA au-dessus des modales dialog */
#pedia-floating-wrapper {
  z-index: 10000 !important;
}

/* ============================================================================
   Container Queries - Adaptation COMPLETE de TOUS les blocs aux petites tailles
   ============================================================================ */

/* ✅ BLOC PETIT (max 250px) - Réduction modérée */
@container journal-block (max-width: 250px) {
  /* Citations */
  .quote-text,
  .update-memory-text {
    font-size: 1.2rem !important;
    line-height: 1.3 !important;
  }

  .quote-mark,
  .journal-update-memory-block .quote-mark {
    font-size: 2.5rem !important;
  }

  .quote-context {
    font-size: 0.8rem !important;
    padding: 0.4rem 0.6rem !important;
  }

  /* Texte */
  .journal-text-title,
  .journal-text-simple-title {
    font-size: 1rem !important;
  }

  .journal-text-content,
  .journal-text-simple-content {
    font-size: 0.85rem !important;
    line-height: 1.5 !important;
  }

  .journal-text-content::first-letter {
    font-size: 2em !important;
  }

  .note-header::after {
    font-size: 0.7rem !important;
  }

  /* Milestone */
  .milestone-badge {
    font-size: 2.5rem !important;
    margin-bottom: 0.5rem !important;
  }

  .journal-milestone-title {
    font-size: 1.1rem !important;
    margin-bottom: 0.4rem !important;
  }

  .journal-milestone-title::after {
    width: 40px !important;
    margin-top: 0.4rem !important;
  }

  .journal-milestone-description {
    font-size: 0.85rem !important;
    line-height: 1.5 !important;
  }

  .journal-milestone-stats {
    padding: 0.5rem !important;
    margin-top: 0.5rem !important;
  }

  .journal-milestone-stats span {
    font-size: 0.75rem !important;
  }

  /* Update Memory */
  .update-memory-icon {
    font-size: 1.5rem !important;
  }

  .update-memory-label {
    font-size: 0.8rem !important;
  }

  .update-memory-child {
    font-size: 0.9rem !important;
  }

  .update-memory-footer .date-stamp {
    font-size: 0.8rem !important;
  }

  /* Photo caption */
  .photo-caption {
    font-size: 0.75rem !important;
    padding-left: 1em !important;
  }

  .photo-caption::before {
    font-size: 0.6em !important;
  }

  /* Decorative frame */
  .decorative-frame-text {
    font-size: 0.9rem !important;
    line-height: 1.4 !important;
  }

  /* Growth chart */
  .growth-stat-icon {
    font-size: 1.2rem !important;
  }

  .growth-stat-value {
    font-size: 1rem !important;
  }

  .growth-stat-label {
    font-size: 0.65rem !important;
  }

  .growth-chart-bar-label {
    font-size: 0.55rem !important;
  }
}

/* ✅ BLOC TRÈS PETIT (max 200px) - Réduction importante */
@container journal-block (max-width: 200px) {
  /* Citations */
  .quote-text,
  .update-memory-text {
    font-size: 1rem !important;
    line-height: 1.2 !important;
  }

  .quote-mark,
  .journal-update-memory-block .quote-mark {
    font-size: 2rem !important;
    margin-bottom: 0.2rem !important;
  }

  .quote-context {
    font-size: 0.7rem !important;
    padding: 0.3rem 0.5rem !important;
    border-left-width: 2px !important;
  }

  /* Texte */
  .journal-text-title,
  .journal-text-simple-title {
    font-size: 0.85rem !important;
  }

  .journal-text-content,
  .journal-text-simple-content {
    font-size: 0.7rem !important;
    line-height: 1.4 !important;
    text-indent: 0.8em !important;
  }

  .journal-text-content::first-letter {
    font-size: 1.8em !important;
    margin-right: 0.15em !important;
  }

  .note-header {
    margin-bottom: 3% !important;
    padding-bottom: 2% !important;
  }

  .note-header::after {
    display: none !important;
  }

  /* Milestone */
  .milestone-badge {
    font-size: 2rem !important;
    margin-bottom: 0.3rem !important;
  }

  .journal-milestone-title {
    font-size: 0.9rem !important;
    margin-bottom: 0.3rem !important;
  }

  .journal-milestone-title::after {
    width: 30px !important;
    margin-top: 0.3rem !important;
  }

  .journal-milestone-description {
    font-size: 0.7rem !important;
    line-height: 1.4 !important;
  }

  .journal-milestone-stats {
    display: none !important; /* Cacher les stats sur très petit */
  }

  /* Update Memory */
  .update-memory-icon {
    font-size: 1.2rem !important;
  }

  .update-memory-label {
    font-size: 0.7rem !important;
  }

  .update-memory-child {
    font-size: 0.75rem !important;
  }

  .update-memory-footer .date-stamp {
    font-size: 0.7rem !important;
  }

  .update-memory-footer {
    padding-top: 0.3rem !important;
    gap: 0.15rem !important;
  }

  /* Photo */
  .photo-caption {
    font-size: 0.65rem !important;
  }

  .photo-container {
    padding: 4px !important;
    margin-bottom: 0.3rem !important;
  }

  .photo-container::before {
    display: none !important; /* Cacher le scotch */
  }

  /* Decorative frame */
  .decorative-frame-text {
    font-size: 0.75rem !important;
    line-height: 1.3 !important;
  }

  /* Growth chart */
  .growth-stat-icon {
    font-size: 1rem !important;
  }

  .growth-stat-value {
    font-size: 0.85rem !important;
  }

  .growth-stat-label {
    font-size: 0.55rem !important;
  }

  .growth-chart-bars {
    height: 40px !important;
  }

  .growth-chart-bar-label {
    display: none !important;
  }
}

/* ✅ BLOC ULTRA-PETIT (max 150px) - Mode survie */
@container journal-block (max-width: 150px) {
  /* Citations */
  .quote-text,
  .update-memory-text {
    font-size: 0.75rem !important;
    line-height: 1.2 !important;
  }

  .journal-text-title,
  .journal-text-simple-title {
    font-size: 0.65rem !important;
  }

  .journal-text-content,
  .journal-text-simple-content {
    font-size: 0.55rem !important;
    line-height: 1.3 !important;
    text-indent: 0 !important;
  }

  .journal-text-content::first-letter {
    font-size: 1.5em !important;
    float: none !important;
    display: inline !important;
  }

  .quote-mark {
    display: none !important;
  }

  .quote-context {
    display: none !important;
  }

  /* Milestone */
  .milestone-badge {
    font-size: 1.5rem !important;
    margin-bottom: 0.2rem !important;
  }

  .journal-milestone-title {
    font-size: 0.7rem !important;
  }

  .journal-milestone-title::after {
    display: none !important;
  }

  .journal-milestone-description {
    font-size: 0.55rem !important;
  }

  .journal-milestone-block::before {
    display: none !important; /* Cacher le cercle décoratif */
  }

  /* Update Memory */
  .update-memory-icon {
    font-size: 0.9rem !important;
  }

  .update-memory-label {
    display: none !important;
  }

  .update-memory-footer {
    display: none !important;
  }

  /* Photo */
  .photo-caption {
    display: none !important;
  }

  .photo-container {
    padding: 2px !important;
    margin-bottom: 0 !important;
    transform: none !important;
    box-shadow: none !important;
  }

  /* Decorative frame */
  .decorative-frame-text {
    font-size: 0.6rem !important;
  }

  .decorative-frame-corners {
    display: none !important;
  }

  /* Growth chart - mode minimal */
  .growth-chart-stats {
    display: none !important;
  }

  .growth-chart-bars {
    height: 30px !important;
  }
}

/* ✅ BLOC MINUSCULE (max 100px) - Affichage minimal */
@container journal-block (max-width: 100px) {
  /* Tout devient minimal */
  .quote-text,
  .update-memory-text,
  .journal-text-title,
  .journal-text-simple-title,
  .journal-milestone-title {
    font-size: 0.5rem !important;
    line-height: 1.1 !important;
  }

  .journal-text-content,
  .journal-text-simple-content,
  .journal-milestone-description,
  .decorative-frame-text {
    font-size: 0.45rem !important;
    line-height: 1.2 !important;
  }

  .milestone-badge {
    font-size: 1.2rem !important;
  }

  .update-memory-icon {
    font-size: 0.8rem !important;
  }

  /* Photo grid - afficher moins */
  .photos-grid {
    grid-template-columns: 1fr !important;
    gap: 2px !important;
  }

  .growth-chart-container {
    display: none !important;
  }
}

/* ✅ Règles globales pour empêcher le débordement de texte dans TOUS les blocs */
.page-content * {
  /* Forcer le word-wrap partout */
  word-wrap: break-word;
  overflow-wrap: break-word;
  /* Ne pas forcer break-word car ça casse au milieu des mots, on préfère le wrap naturel */
}

/* ✅ Règle simple : les blocs internes ne doivent pas déborder */
.page-content > div {
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

/* ============================================================================
   Ajustements pour mobile sans bottom bar
   ============================================================================ */
/* Quand la bottom bar est masquée sur mobile, descendre les boutons flottants */
@media (max-width: 900px) {
  /* Sphère flottante Ped'IA - Descendre en bas quand bottom bar masquée */
  body.journal-no-bottom-bar .pedia-floating-container,
  body.journal-no-bottom-bar .pedia-floating-container.pos-bottom-right,
  body.journal-no-bottom-bar .pedia-floating-container.pos-bottom-left {
    bottom: 20px !important; /* Même hauteur que le mobile normal (style.css:8326) */
  }

  /* Bouton + flottant - Descendre en bas quand bottom bar masquée */
  body.journal-no-bottom-bar .journal-floating-add-btn {
    bottom: 20px !important; /* Même hauteur que la sphère */
  }
}

/* ============================================================================
   Overlay "Tourner le téléphone" - Mode paysage requis sur mobile
   ============================================================================ */
/* Le bouton + est masqué via JavaScript dans journal.js */

.journal-rotate-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 90; /* Sous le header (z-index: 100) */
  opacity: 0;
  visibility: hidden;
  pointer-events: none; /* 🔧 FIX: Ne pas bloquer les clics quand invisible */
  transition: opacity 0.4s ease, visibility 0.4s ease;
  padding-top: 80px; /* Espace pour le header */
  box-sizing: border-box;
}

.journal-rotate-overlay.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto; /* 🔧 FIX: Réactiver les interactions quand visible */
}

.journal-rotate-icon {
  width: 160px;
  height: 160px;
  margin-bottom: 1.5rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Conteneur pour le téléphone (fixe au centre) */
.journal-rotate-device {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.journal-rotate-phone {
  width: 50px;
  height: 85px;
  border: 3px solid #e8a87c;
  border-radius: 10px;
  position: relative;
  background: rgba(232, 168, 124, 0.1);
  animation: rotatePhoneAnim 2.5s ease-in-out infinite;
}

@keyframes rotatePhoneAnim {
  0%, 15% {
    transform: rotate(0deg);
  }
  40%, 60% {
    transform: rotate(90deg);
  }
  85%, 100% {
    transform: rotate(0deg);
  }
}

.journal-rotate-phone::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  background: #e8a87c;
  border-radius: 2px;
}

.journal-rotate-phone::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  border: 2px solid #e8a87c;
  border-radius: 50%;
}

/* Flèches qui orbitent autour du téléphone */
.journal-rotate-arrow-top,
.journal-rotate-arrow-bottom {
  width: 45px;
  height: 24px;
  position: absolute;
}

.journal-rotate-arrow-top svg,
.journal-rotate-arrow-bottom svg {
  width: 100%;
  height: 100%;
}

/* Flèche du haut - commence en haut, va vers le bas */
.journal-rotate-arrow-top {
  animation: orbitTop 2.5s ease-in-out infinite;
}

/* Flèche du bas - commence en bas, va vers le haut */
.journal-rotate-arrow-bottom {
  animation: orbitBottom 2.5s ease-in-out infinite;
}

/* Orbite de la flèche du haut : haut → droite → bas → retour fluide */
@keyframes orbitTop {
  0%, 10% {
    top: -38px;
    left: 50%;
    transform: translateX(-50%) rotate(0deg);
    opacity: 1;
  }
  40%, 55% {
    top: 50%;
    left: calc(100% + 20px);
    transform: translateY(-50%) rotate(90deg);
    opacity: 1;
  }
  75% {
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) rotate(180deg);
    opacity: 0.3;
  }
  90%, 100% {
    top: -38px;
    left: 50%;
    transform: translateX(-50%) rotate(360deg);
    opacity: 1;
  }
}

/* Orbite de la flèche du bas : bas → gauche → haut → retour fluide */
@keyframes orbitBottom {
  0%, 10% {
    bottom: -38px;
    right: 50%;
    transform: translateX(50%) rotate(0deg);
    opacity: 1;
  }
  40%, 55% {
    bottom: 50%;
    right: calc(100% + 20px);
    transform: translateY(50%) rotate(90deg);
    opacity: 1;
  }
  75% {
    bottom: calc(100% + 10px);
    right: 50%;
    transform: translateX(50%) rotate(180deg);
    opacity: 0.3;
  }
  90%, 100% {
    bottom: -38px;
    right: 50%;
    transform: translateX(50%) rotate(360deg);
    opacity: 1;
  }
}

.journal-rotate-text {
  color: #f5efe6;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  text-align: center;
  padding: 0 2rem;
  max-width: 280px;
  line-height: 1.4;
  font-weight: 500;
}

.journal-rotate-subtext {
  color: #c17854;
  font-family: 'Crimson Pro', serif;
  font-size: 0.95rem;
  text-align: center;
  margin-top: 0.8rem;
  opacity: 0.8;
}

/* ============================================================================
   Système de sélection à 3 clics sur mobile
   Les classes mobile-* ne sont ajoutées que sur mobile via JS, donc pas besoin de media query
   ============================================================================ */

/* État 1 : Bloc sélectionné (1er clic) - bordure subtile */
.page-content.mobile-selected {
  outline: 2px solid rgba(232, 168, 124, 0.5);
  outline-offset: 2px;
  transition: outline 0.2s ease, box-shadow 0.2s ease;
}

/* État 2 : Mode édition (2ème clic) - bordure vive + poignées visibles */
.page-content.mobile-edit-mode {
  outline: 3px solid #e8a87c;
  outline-offset: 2px;
  box-shadow: 0 0 15px rgba(232, 168, 124, 0.4);
}

/* Masquer les poignées par défaut sur les blocs sélectionnés */
.page-content.mobile-selected .resize-handle {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

/* Afficher les poignées de resize uniquement en mode édition */
.page-content.mobile-edit-mode .resize-handle {
  opacity: 1;
  pointer-events: auto;
  touch-action: none;
  /* Zone de touch élargie via pseudo-élément invisible */
}

/* Agrandir la zone de touch avec un pseudo-élément */
.page-content.mobile-edit-mode .resize-handle::before {
  content: '';
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  /* Zone de 44x44px minimum pour accessibilité tactile */
}

/* Indicateur visuel de l'état actuel */
.page-content.mobile-selected::after,
.page-content.mobile-edit-mode::after {
  content: '';
  position: absolute;
  top: -8px;
  right: -8px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  z-index: 100;
  pointer-events: none;
}

/* Indicateur état 1 : point orange pulsant */
.page-content.mobile-selected:not(.mobile-edit-mode)::after {
  background: rgba(232, 168, 124, 0.7);
  animation: pulseDot 1.5s ease-in-out infinite;
}

/* Indicateur état 2 : point orange vif fixe */
.page-content.mobile-edit-mode::after {
  background: #e8a87c;
  box-shadow: 0 0 8px rgba(232, 168, 124, 0.6);
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
}

/* Cache buster: 1733858680 - Mobile responsive v5 - Larger pages */


