:root {
  --bg: #ffc0cb;
  --card: #fffacd;
  --fg: #000080;
  --muted: #696969;
  --border: #808080;
  --accent: #ff00ff;
  --header-bg: #87ceeb;
  --panel-bg: #f0e68c;
  --btn-primary: #ff69b4;
  --btn-secondary: #98fb98;
}
* { box-sizing: border-box; }
html, body { 
  margin: 0; 
  padding: 0; 
  color: var(--fg); 
  background: #ffc0cb url('data:image/svg+xml,<svg width="40" height="40" xmlns="http://www.w3.org/2000/svg"><circle cx="5" cy="5" r="2" fill="%23ffb6c1"/><circle cx="25" cy="25" r="2" fill="%23ffb6c1"/><circle cx="35" cy="15" r="2" fill="%23ffd4e5"/><circle cx="15" cy="35" r="2" fill="%23ffd4e5"/></svg>');
  font: 14px/1.5 'Comic Sans MS', 'Chalkboard SE', 'Comic Neue', cursive, sans-serif;
}
a { color: #0000ff; text-decoration: underline; }
a:hover { color: #ff00ff; text-decoration: none; }
a:visited { color: #800080; }

.container { max-width: 980px; margin: 0 auto; padding: 20px; }
header.header { 
  display: flex; gap: 16px; justify-content: space-between; align-items: flex-end; 
  margin: 6px 0 18px;
  background: linear-gradient(180deg, #87ceeb 0%, #4682b4 100%);
  border: 4px outset #ffffff;
  border-radius: 0;
  padding: 20px;
  box-shadow: 8px 8px 0 rgba(0,0,0,0.3), inset 2px 2px 0 rgba(255,255,255,0.5);
  position: relative;
}
header.header::before {
  content: '⭐';
  position: absolute;
  top: 5px;
  left: 5px;
  font-size: 24px;
  animation: blink 1s infinite;
}
header.header::after {
  content: '⭐';
  position: absolute;
  top: 5px;
  right: 5px;
  font-size: 24px;
  animation: blink 1s infinite 0.5s;
}
@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
.title { 
  font-size: 36px; 
  font-weight: 900; 
  margin: 0;
  color: #ffff00;
  text-shadow: 
    3px 3px 0 #ff00ff,
    -2px -2px 0 #00ffff,
    4px 4px 8px rgba(0,0,0,0.5);
  font-family: 'Impact', 'Arial Black', sans-serif;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.muted { color: var(--muted); }
.instruction { 
  color: #fff; 
  font-size: 14px; 
  margin: 8px 0 0 0;
  background: rgba(0,0,0,0.3);
  padding: 5px 10px;
  border-radius: 10px;
  display: inline-block;
}

#title1 {
  font-size: 28px;
  font-weight: 900;
  background: linear-gradient(180deg, #ffffe0 0%, #fffacd 100%);
  border: 4px groove #ff1493;
  border-radius: 0;
  padding: 10px 15px;
  width: 100%;
  font-family: 'Impact', 'Arial Black', sans-serif;
  color: #ff00ff;
  text-shadow: 2px 2px 0 #ffff00, 3px 3px 4px rgba(0,0,0,0.3);
  box-shadow: inset 2px 2px 5px rgba(0,0,0,0.1), 3px 3px 0 rgba(0,0,0,0.2);
  letter-spacing: 1px;
}

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.select, .input { 
  border: 2px inset #808080; 
  border-radius: 0; 
  background: #ffffff; 
  padding: 6px 10px; 
  font: 13px 'MS Sans Serif', Arial, sans-serif;
  box-shadow: inset 1px 1px 2px rgba(0,0,0,0.3);
}
.btn { 
  border: 3px outset #c0c0c0; 
  border-radius: 0; 
  background: linear-gradient(180deg, #dfdfdf 0%, #c0c0c0 100%); 
  padding: 6px 16px; 
  font: bold 13px 'MS Sans Serif', Arial, sans-serif; 
  color: #000;
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.3);
  text-transform: none;
  position: relative;
}
.btn:active {
  border-style: inset;
  transform: translate(1px, 1px);
  box-shadow: inset 1px 1px 2px rgba(0,0,0,0.3);
}
.btn:hover {
  background: linear-gradient(180deg, #e8e8e8 0%, #d0d0d0 100%);
}
.btn.primary { 
  background: linear-gradient(180deg, #ff69b4 0%, #ff1493 100%); 
  border-color: #ff69b4;
  color: #fff;
  font-weight: bold;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.3);
}
.btn.primary:hover {
  background: linear-gradient(180deg, #ff88cc 0%, #ff33aa 100%);
}
.panel { 
  background: linear-gradient(135deg, #f0e68c 0%, #fafad2 100%); 
  border: 4px ridge #ffa500; 
  border-radius: 0; 
  padding: 20px; 
  margin-bottom: 18px;
  box-shadow: 6px 6px 0 rgba(0,0,0,0.2), inset 1px 1px 0 rgba(255,255,255,0.5);
  position: relative;
}
.panel::before {
  content: '🌟 NOUVEAU 🌟';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: #ff0000;
  color: #ffff00;
  padding: 4px 12px;
  border: 2px solid #ffff00;
  font-weight: bold;
  font-size: 11px;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.3);
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.05); }
}

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } header.header { align-items: flex-start; } }

.sheet { background: transparent; }
.card { 
  background: linear-gradient(to bottom, #fffacd 0%, #fafad2 100%); 
  border: 5px ridge #ffd700; 
  box-shadow: 10px 10px 0 rgba(0,0,0,0.3), inset 2px 2px 0 rgba(255,255,255,0.7); 
  border-radius: 0; 
  padding: 30px;
  position: relative;
  margin-bottom: 80px;
}
.card::before {
  content: '🎂';
  position: absolute;
  top: -20px;
  left: 30px;
  font-size: 40px;
  background: linear-gradient(180deg, #ff69b4 0%, #ff1493 100%);
  padding: 5px 15px;
  border: 3px outset #ff69b4;
  border-radius: 50%;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.3);
}
.card::after {
  content: '✨ Créé avec ❤️ en 2025 ✨';
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: #4169e1;
  color: #ffff00;
  padding: 8px 20px;
  border: 3px outset #4169e1;
  font-weight: bold;
  font-size: 12px;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.3);
  white-space: nowrap;
}

.recipe-img { width: 100%; max-height: 320px; object-fit: cover; border-radius: 12px; }

input[type="text"], input[type="url"], textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font: inherit;
}
textarea { min-height: 220px; line-height: 1.7; }
textarea::placeholder { white-space: pre-line; }

h2.sec { font-size: 18px; font-weight: 700; margin: 10px 0; }

.meta { display: flex; gap: 16px; color: var(--muted); margin: 8px 0 18px; font-size: 14px; }
.meta .field { display: flex; align-items: center; gap: 8px; }
.footer { color: var(--muted); font-size: 12px; margin-top: 12px; }
.dot { width: .5rem; height: .5rem; border-radius: 999px; display: inline-block; margin-right: .5rem; background: currentColor; }

/* Impression de base */
@media print {
  .no-print { display: none !important; }
  body { background:#fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Sécurité pour la capture PDF */
.no-print.__pdf_snapshot { display: none !important; }

/* A4 */
@page { size: A4; margin: 10mm; }
.sheet { width: 190mm; margin: 0 auto; }
.card  { padding: 16mm; }
h1.title, input#title { font-size: 22pt; line-height: 1.2; }
.meta { font-size: 10pt; }
h2.sec { font-size: 13pt; margin: 10pt 0 6pt; }

/* Listes imprimables (pour le DOM PDF généré) */
.print-list, .print-olist { margin: 0; padding: 0; list-style: none; }
.print-li { display: flex; gap: 8pt; align-items: flex-start; margin: 4pt 0; line-height: 1.6; }
.print-dot { flex: 0 0 6pt; height: 6pt; width: 6pt; border-radius: 999px; background: #111; margin-top: 5pt; }
.print-step-index { flex: 0 0 auto; min-width: 16pt; font-weight: 700; }

/* Empêcher les coupures moches */
.print-li, .print-step, .print-img { break-inside: avoid; page-break-inside: avoid; }

/* textarea → texte multi-ligne correct en impression */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .container { max-width: initial; padding: 0; }
  .card { border: 0; box-shadow: none; }
  .grid { grid-template-columns: 1fr; gap: 10mm; }
  input, textarea { border: 0; padding: 0; outline: 0; }
  textarea { white-space: pre-line; min-height: auto; height: auto; }
}

/* Textareas : auto-grow */
textarea { overflow: hidden; resize: none; }

/* 2 colonnes (gauche étroit / droite large) */
.recipe-layout{
  display:grid;
  grid-template-columns: 0.34fr 0.66fr;
  gap:12px;
  align-items:start;
}
@media (max-width: 700px){ .recipe-layout{ grid-template-columns:1fr; } }

/* Cartes de section */
.section-card{
  background: linear-gradient(135deg, #ffc0cb 0%, #ffb6c1 100%);
  border: 4px ridge #ff1493;
  border-radius: 0;
  padding: 18px;
  box-shadow: 5px 5px 0 rgba(0,0,0,0.3), inset 1px 1px 0 rgba(255,255,255,0.5);
  position: relative;
}
.section-card::before {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border: 1px solid rgba(255,255,255,0.5);
  pointer-events: none;
}
.section-card h3{ 
  margin: 0 0 12px 0; 
  font-size: 20px; 
  font-weight: 900; 
  color: #8b008b;
  font-family: 'Impact', 'Arial Black', sans-serif;
  text-decoration: none;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #ffff00, 3px 3px 0 rgba(0,0,0,0.2);
  letter-spacing: 2px;
  border-bottom: 3px double #ff1493;
  padding-bottom: 8px;
}

/* Listes d’aperçu à l’écran */
.preview-list{ list-style:none; margin:0; padding:0; }
.preview-list li{ display:flex; gap:8px; align-items:flex-start; margin:6px 0; }
.preview-dot{ flex:0 0 6px; width:6px; height:6px; border-radius:999px; background:#111; margin-top:8px; }
.preview-step{ font-weight:700; width:22px; flex:0 0 auto; text-align:right; margin-right:6px; }

/* Modes d’affichage */
body:not(.editing) .editor-only { display: none !important; }  /* cache les <textarea> en mode Aperçu */
body.editing .preview-only     { display: none !important; }  /* cache les listes en mode Édition */
@media print { .editor-only { display: none !important; } }


/* ===== PDF multipage ===== */
.pdf-header{
  display:flex; align-items:center; gap:10pt; margin:0 0 8pt 0;
}
.pdf-header h1{
  margin:0; font-size:14pt; line-height:1.2; font-weight:800;
}
.pdf-badge{
  margin-left:auto; font-size:9pt; color:#6b7280; border:1px solid #e5e7eb;
  padding:3pt 6pt; border-radius:999px;
}
.pdf-thumb{
  width:22mm; height:16mm; object-fit:cover; border-radius:4pt; flex:0 0 auto;
}
.pdf-hero {
  display: block;
  width: auto;          /* largeur auto */
  max-width: 100%;      /* pas plus large que la page */
  height: auto;         /* conserve proportions */
  max-height: 60mm;     /* limite si trop haute */
  margin: 4pt auto 8pt auto;
  border-radius: 6pt;
}
.pdf-grid{
  display:grid; grid-template-columns:0.34fr 0.66fr; gap:10pt; align-items:start;
}
.pdf-card{
  background:#f9fafb; border:1px solid #e5e7eb; border-radius:12px; padding:10pt;
}
.pdf-card h3{ margin:0 0 6pt 0; font-size:12pt; font-weight:700; }
.pdf-list{ list-style:none; padding:0; margin:0; }
.pdf-list li{ margin:3pt 0; font-size:10.5pt; line-height:1.5; }
.pdf-step{ display:grid; grid-template-columns:16pt 1fr; column-gap:8pt; align-items:start; margin:5pt 0; }
.pdf-step .idx{
  width:14pt; height:14pt; border-radius:999px; background:#111; color:#fff;
  display:inline-flex; align-items:center; justify-content:center;
  font-size:8.5pt; font-weight:700; line-height:14pt; transform:translateY(1pt);
}
.pdf-meta{ display:flex; gap:10pt; font-size:9.5pt; color:#6b7280; margin:0 0 6pt 0; }


/* ==== Modal de prévisualisation PDF ==== */
.pdf-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: none; /* visible via .is-open */
  align-items: center; justify-content: center;
  z-index: 9999;
  padding: 2rem;
}
.pdf-modal.is-open { display: flex; }

.pdf-modal__dialog {
  background: #fff; color:#111;
  width: min(1200px, 96vw);
  height: min(90vh, 900px);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
  display: flex; flex-direction: column;
  overflow: hidden;
}

.pdf-modal__header {
  display:flex; align-items:center; gap:12px;
  padding: 12px 16px; border-bottom:1px solid #e5e7eb;
}
.pdf-modal__header h3 { margin:0; font-size:16px; font-weight:800; }
.pdf-modal__actions { margin-left:auto; display:flex; gap:8px; }

.pdf-modal__body { flex:1; background:#f3f4f6; }
.pdf-modal__body iframe {
  width:100%; height:100%; border:0; background:#fff;
}



/* Texte preview ingrédients et préparation */
#ingredientsPreview li div,
#stepsPreview li div,
#ingredientsPreview li,
#stepsPreview li {
  color: #111 !important; /* noir lisible */
}

/* Numéros des étapes */
.preview-step {
  color: #000 !important;
  font-weight: bold;
}

/* Petits points d’ingrédients */
.preview-dot {
  background-color: #000 !important;
}

.pdf-modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.35);
  align-items: center; justify-content: center; z-index: 1000; }
.pdf-modal.is-open { display: flex; }

/* optional focus outline for dialog */
#pdfPreview:focus { outline: none; }

/* ===== Boutons de la modale PDF ===== */
#pdfPreview .btn {
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

/* Bouton Télécharger */
#pdfPreviewDownload {
  background: #2563eb;   /* bleu */
  color: #fff;
}
#pdfPreviewDownload:hover {
  background: #1d4ed8;
}

/* Bouton Imprimer */
#pdfPreviewPrint {
  background: #10b981;   /* vert */
  color: #fff;
}
#pdfPreviewPrint:hover {
  background: #059669;
}

/* Bouton Fermer */
#pdfPreviewClose {
  background: #dc2626;   /* rouge */
  color: #fff;
}
#pdfPreviewClose:hover {
  background: #b91c1c;
}




/* ====== Footer fixe — variables totalement personnalisables ====== */
:root {
  /* Taille & layout */
  --footer-height: 56px;
  --footer-radius: 12px 12px 0 0;
  --footer-gap: 10px;
  --footer-padding-x: 18px;

  /* Couleurs générales */
  --footer-bg: #f9fafb;         /* fond de la barre */
  --footer-fg: #374151;         /* texte */
  --footer-border: #e5e7eb;     /* bord haut */

  /* Bouton DON */
  --donate-bg: #e0245e;
  --donate-fg: #fff;
  --donate-border: #e0245e;
  --donate-bg-hover: #c81e51;

  /* Bouton SITE */
  --site-bg: #3b82f6;
  --site-fg: #fff;
  --site-border: #3b82f6;
  --site-bg-hover: #2563eb;

  /* Style commun boutons du footer */
  --footer-btn-font: 14px;
  --footer-btn-pad-y: 8px;
  --footer-btn-pad-x: 14px;
  --footer-btn-radius: 10px;
  --footer-btn-shadow: 0 2px 8px rgba(0,0,0,.08);
}

/* Tu peux faire des thèmes en changeant les variables sur body[data-footer-theme="rose"] etc. */
body[data-footer-theme="rose"]{
  --donate-bg:#ff5a8b; --donate-border:#ff5a8b; --donate-bg-hover:#e74d7a;
  --site-bg:#8b5cf6;  --site-border:#8b5cf6;  --site-bg-hover:#7c3aed;
}

.footer-fixed{
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: auto;
  min-height: var(--footer-height);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--footer-gap);
  padding: 12px var(--footer-padding-x);
  background: linear-gradient(90deg, #ff69b4 0%, #4169e1 50%, #32cd32 100%);
  color: #fff;
  border-top: 4px ridge #ffd700;
  border-radius: 0;
  box-shadow: 0 -6px 12px rgba(0,0,0,0.3), inset 0 2px 0 rgba(255,255,255,0.3);
  z-index: 1000;
  font-family: 'Arial', sans-serif;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}
.footer-fixed::before {
  content: '🌟';
  position: absolute;
  left: 10px;
  font-size: 20px;
  animation: rotate 3s linear infinite;
}
.footer-fixed::after {
  content: '🌟';
  position: absolute;
  right: 10px;
  font-size: 20px;
  animation: rotate 3s linear infinite reverse;
}
@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.footer-left { font-size: 13px; }
.footer-right { display: flex; gap: 10px; }

.footer-btn {
  font-size: var(--footer-btn-font);
  padding: var(--footer-btn-pad-y) var(--footer-btn-pad-x);
  border-radius: var(--footer-btn-radius);
  border: 1px solid transparent;
  text-decoration: none;
  box-shadow: var(--footer-btn-shadow);
  display: inline-flex; align-items: center; gap: 6px;
}

/* Bouton DON */
.footer-btn.donate {
  background: var(--donate-bg);
  color: var(--donate-fg);
  border-color: var(--donate-border);
}
.footer-btn.donate:hover { background: var(--donate-bg-hover); }

/* Bouton SITE */
.footer-btn.site {
  background: var(--site-bg);
  color: var(--site-fg);
  border-color: var(--site-border);
}
.footer-btn.site:hover { background: var(--site-bg-hover); }

/* Ne pas imprimer le footer (déjà no-print, on renforce) */
@media print { .footer-fixed { display: none !important; } }




.app-modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  z-index: 9999; pointer-events: none; }
.app-modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.45); opacity: 0; transition: opacity .25s ease; }
.app-modal__panel { position: relative; width: min(720px, calc(100% - 32px)); max-width: 100%; box-sizing: border-box;
  background: #fff; border-radius: 12px; padding: 16px; transform: translateY(18px) scale(.98);
  opacity: 0; pointer-events: auto; box-shadow: 0 20px 50px rgba(0,0,0,.25);
  transition: transform .28s cubic-bezier(.2,.9,.3,1), opacity .25s ease; }

/* header */
.app-modal__header{ display:flex; align-items:center; gap:12px; margin-bottom:6px; }
.app-modal__title{ margin:0; font-size:16px; font-weight:700; }
.app-modal__close{ margin-left:auto; background:transparent; border:0; font-size:20px; line-height:1; cursor:pointer; }

/* body */
.app-modal__body{ font-size:14px; color:#111; margin:8px 0 12px; }

/* footer */
.app-modal__footer{ display:flex; gap:8px; justify-content:flex-end; }

/* visible state */
.app-modal.is-open .app-modal__backdrop { opacity: 1; }
.app-modal.is-open .app-modal__panel { opacity: 1; transform: translateY(0) scale(1); }

/* variants */
.app-modal__panel[data-kind="error"] { border-left: 4px solid #dc2626; }
.app-modal__panel[data-kind="warn"]  { border-left: 4px solid #f59e0b; }
.app-modal__panel[data-kind="info"]  { border-left: 4px solid #2563eb; }

/* small anim sur le texte */
.app-modal__body p { margin:0 0 .6rem 0; animation: slideIn .26s ease both; }
@keyframes slideIn { from { opacity:0; transform: translateY(6px); } to { opacity:1; transform: none; } }

@media (max-width:520px) {
  .app-modal__panel { width: calc(100% - 20px); padding:12px; border-radius:10px; }
  .app-modal__title { font-size:15px; }
  .app-modal__body { font-size:13px; }
}

/* ===== Notices ===== */
.app-notice {
  background: #fff;
  border-left: 6px solid #111;
  border-radius: 6px;
  padding: 10px 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  opacity: 0;
  transform: translateX(30px);
  transition: opacity .3s ease, transform .3s ease;
  font-size: 14px;
  color: #000;
  max-width: 280px;
}
.app-notice.is-visible {
  opacity: 1;
  transform: translateX(0);
}
.app-notice--warn {
  border-color: #e63946;
  background: #fff5f5;
}
.app-notice--info {
  border-color: #3b82f6;
  background: #f0f6ff;
}
