/* ==========================================================
   Administration — Atelier Pivoine
   Même palette que le site (crème, rose ancien, sauge, or)
   ========================================================== */

:root {
  --creme: #faf1e8;
  --papier: #fffaf5;
  --rose-pale: #f7e3de;
  --rose-tendre: #efc3bd;
  --rose-logo: #b87068;
  --rose-ancien: #9a544d;
  --rose-profond: #7f423c;
  --sauge: #8a9a7b;
  --sauge-fonce: #5b6a50;
  --or: #c9a77c;
  --encre: #4a3130;
  --danger: #a12a2a;

  --font-titre: "Allura", "Snell Roundhand", "Brush Script MT", cursive;
  --font-texte: "Instrument Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--creme);
  color: var(--encre);
  font-family: var(--font-texte);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0 0 .6rem; line-height: 1.2; color: var(--rose-profond); }
h1 { font-family: var(--font-titre); font-weight: 400; font-size: clamp(2.6rem, 8vw, 3.4rem); color: var(--rose-logo); line-height: 1.05; }
h2 { font-size: 1.15rem; font-weight: 600; }

p { margin: 0 0 .8rem; }
a { color: var(--rose-ancien); text-underline-offset: .18em; }
a:hover { color: var(--rose-profond); }
img { max-width: 100%; display: block; }

:focus-visible { outline: 3px solid var(--rose-ancien); outline-offset: 2px; }
[hidden] { display: none !important; }

.lien-evitement { position: absolute; left: -999px; top: 0; z-index: 200; background: var(--rose-ancien); color: #fff; padding: .6rem 1rem; }
.lien-evitement:focus { left: 0; color: #fff; }

/* ---------- Cadre ---------- */
.barre-haut {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .6rem 1rem; background: var(--papier); border-bottom: 1px solid var(--or);
  position: sticky; top: 0; z-index: 50;
}
.marque { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--rose-profond); font-weight: 600; }
.marque img { width: 2.25rem; height: 2.25rem; border-radius: 50%; border: 1px solid var(--or); object-fit: cover; }

.menu-bouton {
  font: inherit; font-weight: 600; cursor: pointer; padding: .4rem 1rem; border-radius: 999px;
  background: transparent; color: var(--rose-profond); border: 1.5px dashed var(--rose-ancien);
}
.menu-bouton[aria-expanded="true"] { background: var(--rose-pale); }

.cadre { display: block; }

.menu { display: none; background: var(--papier); border-bottom: 1px solid var(--or); padding: .5rem 1rem 1rem; }
.menu.est-ouvert { display: block; }
.menu ul { list-style: none; margin: 0; padding: 0; }
.menu a, .lien-bouton {
  display: block; width: 100%; text-align: left; padding: .65rem .6rem; border-radius: .5rem;
  font: inherit; font-weight: 500; color: var(--encre); text-decoration: none;
  background: none; border: 0; cursor: pointer;
}
.menu a:hover, .lien-bouton:hover { background: var(--rose-pale); color: var(--rose-profond); }
.menu a[aria-current="page"] { background: var(--rose-pale); color: var(--rose-profond); font-weight: 600; }
.menu-bas { margin-top: .75rem !important; padding-top: .75rem !important; border-top: 1px dashed var(--rose-tendre); }

.contenu { padding: 1.25rem 1rem 6rem; max-width: 60rem; }

@media (min-width: 60rem) {
  .barre-haut { display: none; }
  .cadre { display: grid; grid-template-columns: 15rem 1fr; min-height: 100vh; }
  .menu {
    display: block; padding: 1.5rem 1rem; border-bottom: 0; border-right: 1px solid var(--or);
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
  }
  .contenu { padding: 2rem 2.5rem 6rem; }
}

/* ---------- Messages ---------- */
.message { padding: .75rem 1rem; border-radius: .6rem; margin-bottom: 1rem; border: 1px solid; }
.message-succes { background: #edf2e8; border-color: var(--sauge); color: #34422b; }
.message-erreur { background: #fbe9e7; border-color: var(--danger); color: #6d1a1a; }

/* ---------- Boutons ---------- */
.bouton {
  display: inline-block; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; text-align: center;
  padding: .65rem 1.3rem; border-radius: 999px;
  background: var(--rose-ancien); color: #fff; border: 2px solid var(--rose-ancien);
}
.bouton:hover { background: var(--rose-profond); border-color: var(--rose-profond); color: #fff; }
.bouton-clair { background: transparent; color: var(--rose-profond); border-style: dashed; }
.bouton-clair:hover { background: var(--rose-pale); color: var(--rose-profond); }
.bouton-danger { background: transparent; color: var(--danger); border-color: var(--danger); border-style: solid; }
.bouton-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.bouton-petit { padding: .35rem .9rem; font-size: .9rem; }

/* ---------- Formulaires ---------- */
.formulaire { display: grid; gap: 1.25rem; }
.formulaire-etroit { max-width: 26rem; }
.champ { display: grid; gap: .3rem; align-content: start; min-width: 0; }
label, .etiquette-champ { font-weight: 600; font-size: .95rem; color: var(--rose-profond); }

input[type="text"], input[type="password"], input[type="search"], input[type="datetime-local"], select, textarea {
  width: 100%; font: inherit; color: var(--encre);
  padding: .65rem .8rem; background: #fff; border: 1.5px solid var(--rose-tendre); border-radius: .6rem;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--rose-ancien); outline: 3px solid rgba(154, 84, 77, .25); outline-offset: 0; }

.aide { font-size: .88rem; color: #6b5150; margin: 0; }
.grille-champs { display: grid; gap: 1.25rem; }
@media (min-width: 40rem) { .grille-champs { grid-template-columns: 1fr 1fr; } }

.case { display: flex; align-items: center; gap: .7rem; font-weight: 500; color: var(--encre); cursor: pointer; }
.case input { width: 1.25rem; height: 1.25rem; accent-color: var(--rose-ancien); flex: none; }

.reglage { border: 1px dashed var(--rose-tendre); border-radius: .6rem; padding: .6rem 1rem; }
.reglage summary { cursor: pointer; font-weight: 600; color: var(--rose-ancien); }
.reglage[open] summary { margin-bottom: .75rem; }

.ligne-formulaire { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem 1rem; }
.ligne-formulaire .champ { flex: 1 1 14rem; }

.filtres-admin { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem 1rem; margin-bottom: 1.25rem; }
.filtres-admin .champ { flex: 1 1 12rem; }

/* Barre d'enregistrement collée en bas de l'écran */
.barre-actions {
  position: sticky; bottom: 0; z-index: 30;
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
  margin: 0 -1rem; padding: .8rem 1rem calc(.8rem + env(safe-area-inset-bottom, 0px));
  background: var(--papier); border-top: 1px solid var(--or);
}
.barre-actions .bouton { padding: .55rem 1.2rem; }
.lien-annuler { margin-left: auto; font-weight: 500; }
@media (min-width: 60rem) { .barre-actions { margin: 0 -2.5rem; padding-inline: 2.5rem; } }

/* ---------- Panneaux, listes ---------- */
.entete-page { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-bottom: 1rem; }
.entete-page h1 { margin: 0; }
.entete-etat { font-size: .95rem; }

.panneau { background: var(--papier); border: 1px solid var(--rose-tendre); border-radius: .9rem; padding: 1.1rem 1.25rem; margin-bottom: 1.25rem; }

.actions-rapides { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1.5rem; }

.chiffres { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: .75rem; margin-bottom: 1.5rem; }
.chiffre { background: var(--papier); border: 1px dashed var(--rose-ancien); border-radius: .9rem; padding: .8rem 1rem; display: grid; }
.chiffre strong { font-size: 1.9rem; line-height: 1.1; color: var(--rose-profond); }
.chiffre span { font-size: .9rem; }

.deux-colonnes { display: grid; gap: 1.25rem; }
@media (min-width: 46rem) { .deux-colonnes { grid-template-columns: 1fr 1fr; } }

.liste-simple { list-style: none; margin: 0; padding: 0; }
.liste-simple li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .3rem .75rem; padding: .55rem 0; border-top: 1px dashed var(--rose-tendre); }
.liste-simple li:first-child { border-top: 0; }

.vide { font-style: italic; color: var(--rose-profond); }

.lignes { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.ligne {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem;
  background: var(--papier); border: 1px solid var(--rose-tendre); border-radius: .9rem; padding: .8rem 1rem;
}
.ligne-texte { flex: 1 1 14rem; min-width: 0; }
.ligne-titre { display: block; font-weight: 600; font-size: 1.05rem; color: var(--rose-profond); text-decoration: none; overflow-wrap: anywhere; }
.ligne-titre:hover { text-decoration: underline; }
.ligne-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .9rem; margin: .25rem 0 0; font-size: .88rem; color: #6b5150; }
.ligne-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.ligne-vignette { width: 3.75rem; height: 3.75rem; object-fit: cover; border-radius: .5rem; flex: none; }
.ligne-vignette-vide { background: var(--rose-pale); }
.ligne-cat { align-items: flex-end; }
.ligne-cat .ligne-formulaire { flex: 1 1 18rem; }
.ligne-cat .ligne-meta { flex: 1 1 100%; margin: 0; }

.pastille { display: inline-block; padding: .05rem .65rem; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.pastille-publie { background: var(--sauge-fonce); color: #fff; }
.pastille-brouillon { background: var(--rose-pale); color: var(--rose-profond); border: 1px dashed var(--rose-ancien); }
.pastille-programme { background: var(--or); color: #3a2c17; }

/* ---------- Couverture d'article ---------- */
.couverture { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.couverture-apercu { width: 9rem; height: 9rem; object-fit: cover; border-radius: .6rem; border: 1px solid var(--rose-tendre); }
.couverture-boutons { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ---------- Galerie d'une création ---------- */
.galerie-liste { list-style: none; margin: 0 0 .75rem; padding: 0; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); }
.galerie-liste:empty { display: none; }
.galerie-item { position: relative; border: 1px solid var(--rose-tendre); border-radius: .6rem; overflow: hidden; background: #fff; }
.galerie-item img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.galerie-item:first-child::after {
  content: "Aperçu"; position: absolute; top: .4rem; left: .4rem;
  background: var(--sauge-fonce); color: #fff; font-size: .75rem; font-weight: 600; padding: .05rem .5rem; border-radius: 999px;
}
.galerie-outils { display: flex; justify-content: space-between; gap: .25rem; padding: .35rem; background: var(--papier); }
.bouton-icone {
  flex: 1; font: inherit; font-size: 1rem; line-height: 1; cursor: pointer; padding: .5rem 0; min-height: 2.5rem;
  background: transparent; color: var(--rose-profond); border: 1px solid var(--rose-tendre); border-radius: .4rem;
}
.bouton-icone:hover { background: var(--rose-pale); }

/* ---------- Éditeur de texte ---------- */
.editeur-barre {
  display: flex; flex-wrap: wrap; gap: .3rem; padding: .5rem;
  background: var(--papier); border: 1.5px solid var(--rose-tendre); border-bottom: 0; border-radius: .6rem .6rem 0 0;
  position: sticky; top: 0; z-index: 20;
}
@media (max-width: 59.99rem) { .editeur-barre { top: 3.4rem; } }
.editeur-barre button {
  font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer; min-width: 2.5rem; min-height: 2.5rem; padding: .3rem .65rem;
  background: #fff; color: var(--rose-profond); border: 1px solid var(--rose-tendre); border-radius: .4rem;
}
.editeur-barre button:hover { background: var(--rose-pale); }
.editeur-barre .separateur { width: 1px; background: var(--rose-tendre); margin: .2rem .15rem; }

.editeur-zone {
  min-height: 18rem; padding: 1rem; background: #fff; border: 1.5px solid var(--rose-tendre); border-radius: 0 0 .6rem .6rem;
  font-size: 1.05rem; line-height: 1.7; overflow-wrap: anywhere;
}
.editeur-zone:focus { outline: 3px solid rgba(154, 84, 77, .25); border-color: var(--rose-ancien); }
.editeur-zone:empty::before { content: attr(data-placeholder); color: #9a8482; }
.editeur-zone h2 { font-family: var(--font-titre); font-weight: 400; font-size: 2.4rem; color: var(--rose-logo); margin: 1rem 0 .4rem; }
.editeur-zone h3 { font-size: 1.25rem; margin: 1rem 0 .3rem; }
.editeur-zone img { max-width: 100%; max-height: 22rem; width: auto; height: auto; border-radius: .6rem; }
.editeur-zone figcaption:empty::before, .editeur-zone figcaption:has(> br:only-child)::before { content: "Légende (facultatif)"; color: #9a8482; }
.editeur-zone figure { margin: 1rem 0; }
.editeur-zone figcaption { font-size: .9rem; font-style: italic; }
.editeur-zone blockquote { margin: 1rem 0; padding-left: 1rem; border-left: 3px dashed var(--rose-ancien); }
.editeur-zone aside { margin: 1rem 0; padding: 1rem 1.25rem; background: var(--papier); outline: 2px dashed var(--sauge-fonce); outline-offset: -8px; }
.editeur-zone aside h2 { font-size: 2rem; color: var(--sauge-fonce); margin-top: 0; }

/* ---------- Fenêtre de choix des photos ---------- */
.modale { position: fixed; inset: 0; z-index: 100; display: grid; place-items: end center; background: rgba(74, 49, 48, .55); }
@media (min-width: 46rem) { .modale { place-items: center; } }
.modale-boite {
  display: flex; flex-direction: column; width: min(100%, 44rem); max-height: 92vh;
  background: var(--creme); border-radius: 1rem 1rem 0 0; overflow: hidden;
}
@media (min-width: 46rem) { .modale-boite { border-radius: 1rem; max-height: 85vh; } }
.modale-tete { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 1rem; border-bottom: 1px solid var(--or); background: var(--papier); }
.modale-tete h2 { margin: 0; }
.modale-corps { padding: 1rem; overflow-y: auto; flex: 1; }
.modale-pied { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: flex-end; padding: .8rem 1rem calc(.8rem + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--or); background: var(--papier); }

.choix-photos { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); }
.choix-photo { position: relative; display: block; width: 100%; padding: 0; border: 3px solid transparent; border-radius: .6rem; overflow: hidden; background: #fff; cursor: pointer; }
.choix-photo img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.choix-photo[aria-pressed="true"] { border-color: var(--rose-ancien); }
.choix-photo[aria-pressed="true"]::after {
  content: "✓"; position: absolute; top: .3rem; right: .3rem; width: 1.6rem; height: 1.6rem; display: grid; place-items: center;
  background: var(--rose-ancien); color: #fff; border-radius: 50%; font-weight: 700;
}

/* ---------- Dépôt de photos ---------- */
.depot-zone {
  display: grid; place-items: center; text-align: center; padding: 1.75rem 1rem; cursor: pointer;
  border: 2px dashed var(--rose-ancien); border-radius: .9rem; background: #fff; color: var(--rose-profond); font-weight: 600;
}
.depot-zone small { font-weight: 400; }
.depot-zone.est-survole { background: var(--rose-pale); }
.depot-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.depot-zone:focus-within { outline: 3px solid var(--rose-ancien); outline-offset: 2px; }
.depot-etat { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; gap: .3rem; font-size: .92rem; }
.depot-etat .ko { color: var(--danger); }
.depot-etat .ok { color: var(--sauge-fonce); }

/* ---------- Bibliothèque de photos ---------- */
.bibliotheque { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); }
.photo-carte { display: flex; flex-direction: column; gap: .5rem; background: var(--papier); border: 1px solid var(--rose-tendre); border-radius: .9rem; padding: .6rem; }
.photo-carte img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: .6rem; }
.photo-infos { font-size: .82rem; color: #6b5150; margin: 0; }
.photo-alt { display: grid; gap: .3rem; }
.photo-alt label { font-size: .82rem; }
.photo-alt input { padding: .45rem .6rem; font-size: .9rem; }
.photo-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: auto; }

/* ---------- Connexion ---------- */
.page-connexion { display: grid; place-items: center; min-height: 100vh; padding: 1.5rem 1rem; }
.connexion { width: min(100%, 24rem); text-align: center; }
.connexion-fleur { width: 5rem; height: 5rem; margin: 0 auto .75rem; border-radius: 50%; border: 1px solid var(--or); object-fit: cover; }
.connexion h1 { margin-bottom: 0; }
.connexion-sous-titre { color: var(--sauge-fonce); font-weight: 600; margin-bottom: 1.25rem; }
.connexion .panneau { text-align: left; display: grid; gap: 1rem; }
.connexion .bouton { width: 100%; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
