/* Danzapa : style de base, inspiré de PowerPoint Web. */

:root {
  /* Charte Danzapa : bleu nuit (fond de la diapo de bienvenue) */
  --accent: #0b1f4d;
  --accent-fonce: #061433;
  --accent-clair: #e3e8f3;    /* fonds actifs, survols */
  --accent-bord: #b9c4dd;
  --accent-pale: #f2f5fb;
  --or: #ffd700;              /* touche dorée, comme le texte de bienvenue */
  --fond: #f3f2f1;
  --surface: #ffffff;
  --texte: #242424;
  --texte-doux: #616161;
  --bordure: #e1dfdd;
  --rayon: 6px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
}

/* Barre de titre */
.barre-titre {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--bordure);
}
.barre-titre { flex-wrap: wrap; row-gap: 0.25rem; }
.barre-titre-droite { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
@media (max-width: 560px) {
  .barre-titre { padding: 0.5rem; }
  .barre-titre-droite { gap: 0.1rem; margin-left: auto; }
  .bouton-lien { padding: 0.3rem 0.4rem; font-size: 0.85rem; }
}
.barre-titre-droite form { margin: 0; }

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--texte);
  text-decoration: none;
}
.logo-icone {
  display: inline-grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--or);
  font-weight: 700;
}
.logo-grand { font-size: 1.5rem; justify-content: center; width: 100%; }

.avatar {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 1px solid var(--bordure);
  font-size: 0.8rem;
  font-weight: 600;
}

.bouton-lien {
  background: none;
  border: 1px solid transparent;
  border-radius: var(--rayon);
  padding: 0.35rem 0.6rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--texte);
  text-decoration: none;
  cursor: pointer;
}
.bouton-lien:hover { background: var(--fond); border-color: var(--bordure); }

.bouton-principal {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--rayon);
  padding: 0.6rem 1.2rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.bouton-principal:hover { background: var(--accent-fonce); }

/* Contenu */
.contenu { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem; }
h1 { margin: 0 0 0.25rem; font-weight: 600; }
.sous-titre { color: var(--texte-doux); margin: 0 0 1.5rem; }

.cartes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.carte {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  padding: 1rem 1.25rem;
}
.carte h2 { font-size: 1.1rem; margin: 0 0 0.5rem; }
.carte p { color: var(--texte-doux); margin: 0 0 0.75rem; }
.carte-bientot { opacity: 0.85; }
.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--fond);
  color: var(--texte-doux);
}

/* Messages */
.message {
  padding: 0.6rem 0.9rem;
  border-radius: var(--rayon);
  background: #e8f1fb;
}
.message-error { background: #fde7e9; color: #a4262c; }
.message-success { background: #dff6dd; }

/* Formulaires */
.formulaire { max-width: 420px; }
.formulaire input,
.boite-connexion input[type="text"],
.boite-connexion input[type="password"] {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  font: inherit;
}
.formulaire .helptext, .formulaire ul { color: var(--texte-doux); font-size: 0.85rem; }

/* Navigation */
.barre-titre-gauche { display: flex; align-items: center; gap: 1.25rem; }
.onglet {
  color: var(--texte);
  text-decoration: none;
  padding: 0.35rem 0.1rem;
  border-bottom: 2px solid transparent;
}
.onglet:hover { border-bottom-color: var(--bordure); }
.onglet-actif { font-weight: 600; border-bottom-color: var(--accent); }

/* Boutons secondaires */
.bouton-secondaire, .bouton-danger {
  display: inline-block;
  background: var(--surface);
  color: var(--texte);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  padding: 0.55rem 1rem;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.bouton-secondaire:hover { background: var(--fond); }
.bouton-danger { background: #a4262c; border-color: #a4262c; color: #fff; font-weight: 600; }
.bouton-danger:hover { background: #8a1f24; }
a.bouton-principal { text-decoration: none; }

.entete-page {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.actions { display: flex; gap: 0.5rem; align-items: center; }

a.carte-lien { color: inherit; text-decoration: none; }
a.carte-lien:hover { border-color: var(--accent); }
.badge-actif { background: var(--accent); color: #fff; }

/* Bibliothèque */
.recherche { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.recherche input {
  flex: 1 1 280px;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  font: inherit;
}

.liste-chants {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
}
.liste-chants li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--bordure);
}
.liste-chants li:last-child { border-bottom: none; }
.liste-chants li > a { color: inherit; text-decoration: none; display: grid; gap: 0.15rem; min-width: 0; }
.liste-chants li > a:hover .liste-titre { color: var(--accent); }
.liste-titre { font-weight: 600; }
.liste-meta, .liste-extrait { font-size: 0.85rem; color: var(--texte-doux); }
.liste-extrait { font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tags { display: flex; gap: 0.3rem; flex-wrap: wrap; justify-content: flex-end; }
.tag {
  font-size: 0.75rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--accent-clair);
  color: var(--accent-fonce);
  text-decoration: none;
  margin-left: 0.3rem;
}
.pagination { display: flex; gap: 1rem; align-items: center; justify-content: center; margin-top: 1rem; }
.vide { color: var(--texte-doux); }
.meta-bas { color: var(--texte-doux); font-size: 0.85rem; margin-top: 1.5rem; }

/* Aperçu des couplets façon diapositive (thème par défaut : blanc sur noir) */
.apercu-couplets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.apercu { margin: 0; }
.apercu figcaption { font-size: 0.8rem; color: var(--texte-doux); margin-bottom: 0.3rem; }
.diapo {
  aspect-ratio: 16 / 9;
  background: #000;
  color: #fff;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.3;
  padding: 0.75rem;
  overflow: hidden;
}
.diapo p { margin: 0; }

/* Formulaire de chant */
.formulaire-chant {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 2fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 720px) {
  .formulaire-chant { grid-template-columns: 1fr; }
}
.formulaire-chant .message { grid-column: 1 / -1; }
.champ { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 1rem; }
.champ label { font-weight: 600; font-size: 0.9rem; }
.champ small { color: var(--texte-doux); font-size: 0.8rem; }
.champ small.erreur { color: #a4262c; }
.champ input, .champ textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  font: inherit;
}
.champ textarea { line-height: 1.5; resize: vertical; }

/* Page de connexion */
.page-connexion {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.boite-connexion {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-align: left;
}
.boite-connexion .sous-titre { text-align: center; }
.boite-connexion label { font-size: 0.9rem; margin-top: 0.5rem; }
.boite-connexion .bouton-principal { margin-top: 1rem; }

/* ================================================================
   Cultes : liste
   ================================================================ */
.creation-rapide { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.creation-rapide input {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  font: inherit;
}
.titre-section { font-size: 1.05rem; margin: 1.5rem 0 0.5rem; }
.liste-cultes {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
}
.liste-cultes li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--bordure);
}
.liste-cultes li:last-child { border-bottom: none; }
.liste-cultes a { color: inherit; text-decoration: none; display: grid; gap: 0.15rem; }
.liste-cultes a:hover .liste-titre { color: var(--accent); }
.badge-pret { background: #dff6dd; color: #107c10; }

.utilisations { margin-top: 1.5rem; }
.utilisations h2 { font-size: 1rem; margin: 0 0 0.4rem; }
.utilisations ul { margin: 0; padding-left: 1.2rem; }

/* ================================================================
   Diapositives : même rendu en vignette et en grand.
   Les tailles de texte suivent la largeur de la diapo (unités cqw).
   Thème par défaut : blanc gras sur noir, comme la présentation actuelle.
   ================================================================ */
.diapo {
  container-type: inline-size;
  aspect-ratio: 16 / 9;
  width: 100%;
  background-color: var(--fond-couleur, #000);
  background-image: var(--fond-image, none);
  background-size: 100% 100%;
  color: var(--texte-couleur, #fff);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.diapo-contenu {
  width: 90%;
  text-align: center;
  font-family: var(--police, Calibri, Carlito, sans-serif);
  font-weight: var(--poids, 700);
  line-height: var(--interligne, 1.2);
}
/* --taille : calculée côté serveur (apps/projection/rendu.py), comme pour le .pptx */
.diapo-contenu p, .diapo-contenu > div { margin: 0; font-size: var(--taille, 5.6cqw); overflow-wrap: anywhere; min-height: 1em; }
.aligner-gauche { text-align: left; }
.aligner-centre { text-align: center; }
.aligner-droite { text-align: right; }
.diapo-titre .diapo-contenu {
  font-family: var(--police-titres, Georgia, serif);
  text-transform: var(--casse-titre, uppercase);
}
.diapo-bienvenue { background-image: var(--bienvenue-image, var(--fond-image, none)); }
/* Bienvenue : texte simple, comme une diapo de chant (modifiable sur place). */
/* Une image de bienvenue remplace toute la diapo, texte compris. */
.avec-image-bienvenue .diapo-bienvenue .diapo-contenu { visibility: hidden; }
.diapo-masquee { opacity: 0.35; }
.diapo-vide { background: #2b2b2b; }
.diapo-vide::after { content: "Aucune diapo"; color: #bbb; font-size: 3cqw; }

/* ================================================================
   Éditeur (disposition PowerPoint Web)
   ================================================================ */
main.editeur {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 49px);
  min-height: 480px;
}
main.editeur > .message { margin: 0.5rem 1rem 0; }

.barre-culte {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 1rem;
  background: var(--surface);
  flex-wrap: wrap;
}
.form-titre { flex: 0 1 26rem; min-width: 10rem; }
.titre-culte {
  width: 100%;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--rayon);
  padding: 0.3rem 0.5rem;
  background: transparent;
  margin: 0;
}
input.titre-culte:hover, input.titre-culte:focus { border-color: var(--bordure); background: var(--fond); }
.statut-choix { font: inherit; font-size: 0.85rem; padding: 0.25rem 0.4rem; border: 1px solid var(--bordure); border-radius: var(--rayon); background: var(--surface); }
.date-culte { color: var(--texte-doux); font-size: 0.9rem; }
.indicateur { margin-left: auto; font-size: 0.85rem; color: #107c10; }
.indicateur-erreur { color: #a4262c; }

/* Ruban */
.ruban { background: var(--surface); border-bottom: 1px solid var(--bordure); padding: 0 1rem 0.5rem; }
.ruban-onglets { display: flex; gap: 0.25rem; overflow-x: auto; }
.ruban-onglets button {
  background: none;
  border: none;
  font: inherit;
  font-size: 0.92rem;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.ruban-onglets button:hover { background: var(--fond); }
.ruban-onglets button.actif { font-weight: 600; border-bottom-color: var(--accent); }
.ruban-panneau {
  display: flex;
  align-items: stretch;
  gap: 0.25rem;
  background: var(--fond);
  border-radius: 8px;
  padding: 0.35rem;
  margin-top: 0.35rem;
  overflow-x: auto;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.ruban-panneau[hidden] { display: none; }
.ruban-groupe {
  display: flex;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0 0.5rem 1.1rem;
  border-right: 1px solid var(--bordure);
  position: relative;
  flex-shrink: 0;
}
.ruban-groupe:last-child { border-right: none; }
.ruban-libelle {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.7rem;
  color: var(--texte-doux);
  white-space: nowrap;
}
.outil {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  min-width: 4.2rem;
  max-width: 7rem;
  padding: 0.3rem 0.45rem;
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  font: inherit;
  font-size: 0.78rem;
  line-height: 1.15;
  text-align: center;
  color: var(--texte);
  text-decoration: none;
  cursor: pointer;
}
.outil:hover:not(:disabled) { background: var(--surface); border-color: var(--bordure); }
.outil.actif { background: var(--accent-clair); border-color: var(--accent-bord); }
.outil:disabled { opacity: 0.4; cursor: default; }
.outil-icone { font-size: 1.25rem; line-height: 1.2; color: var(--accent); }
.ruban-form label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.78rem; }
.ruban-form textarea { width: 18rem; font: inherit; font-size: 0.85rem; padding: 0.3rem; border: 1px solid var(--bordure); border-radius: 4px; resize: vertical; }
.ruban-form input { width: 5rem; font: inherit; padding: 0.3rem; border: 1px solid var(--bordure); border-radius: 4px; }

/* Espace de travail : vignettes | diapo + propriétés, barre d'état en bas */
.espace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 230px 1fr;
  grid-template-rows: 1fr auto;
  background: var(--fond);
}
.vignettes {
  overflow-y: auto;
  padding: 0.75rem 0.75rem 1.5rem 0.5rem;
  border-right: 1px solid var(--bordure);
}
.groupe { margin-bottom: 0.4rem; border-radius: 6px; }
.groupe-entete {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--texte-doux);
  padding: 0.15rem 0.2rem 0.15rem 1.6rem;
  cursor: grab;
  user-select: none;
}
.groupe-nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.poignee { color: #a19f9d; }
.groupe-masque .groupe-nom { text-decoration: line-through; }
.sortable-ghost { opacity: 0.4; background: var(--accent-clair); }
.vignette {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  width: 100%;
  padding: 0.25rem 0;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}
.vignette-numero { width: 1.2rem; font-size: 0.75rem; color: var(--texte-doux); text-align: right; flex-shrink: 0; }
.vignette .diapo { border: 2px solid transparent; border-radius: 5px; box-shadow: 0 0 0 1px var(--bordure); }
.vignette:hover .diapo { border-color: #d6d6d6; }
.vignette.active .diapo { border-color: var(--accent); }
.vignettes-vide { font-size: 0.85rem; color: var(--texte-doux); text-align: center; margin-top: 1rem; }

.centre { overflow-y: auto; padding: 1.25rem 1.5rem; display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.scene { width: 100%; max-width: min(960px, calc((100vh - 330px) * 16 / 9)); min-width: 280px; margin: 0 auto; }
.diapo-grande { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); }

.aide { color: var(--texte-doux); font-size: 0.8rem; }
.bouton-retirer { color: #a4262c; }

.barre-etat {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.25rem 1rem;
  font-size: 0.8rem;
  color: var(--texte-doux);
  background: var(--surface);
  border-top: 1px solid var(--bordure);
}
.barre-etat-droite { margin-left: auto; display: flex; gap: 0.25rem; }
.bouton-vue { background: none; border: 1px solid transparent; border-radius: 4px; font: inherit; padding: 0.15rem 0.5rem; cursor: pointer; color: inherit; }
.bouton-vue:hover { background: var(--fond); }
.bouton-vue.actif { background: var(--accent-clair); border-color: var(--accent-bord); color: var(--texte); }

/* Trieuse de diapositives : toutes les vignettes en grille */
.vue-trieuse { grid-template-columns: 1fr; }
.vue-trieuse .centre { display: none; }
.vue-trieuse .vignettes { border-right: none; padding: 1rem 1.5rem; }
.vue-trieuse .groupe-fixe, .vue-trieuse .groupe {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.5rem 0.75rem;
  padding: 0.25rem;
}
.vue-trieuse .groupe { background: rgba(0, 0, 0, 0.02); }
.vue-trieuse .groupe-entete { grid-column: 1 / -1; padding-left: 0.2rem; }

/* Dialogues */
.dialogue {
  width: min(560px, calc(100vw - 2rem));
  border: none;
  border-radius: 8px;
  padding: 1rem 1.25rem 1.25rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}
.dialogue::backdrop { background: rgba(0, 0, 0, 0.35); }
.dialogue-entete { display: flex; justify-content: space-between; align-items: center; }
.dialogue h2 { font-size: 1.1rem; margin: 0; }
.dialogue label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9rem; font-weight: 600; margin-top: 0.75rem; }
.dialogue input, .dialogue textarea {
  font: inherit;
  font-weight: 400;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
}
.dialogue small { font-weight: 400; color: var(--texte-doux); }
.dialogue .bouton-principal { margin-top: 1rem; }
.resultats-chants { max-height: 320px; overflow-y: auto; margin-top: 0.75rem; border: 1px solid var(--bordure); border-radius: var(--rayon); }
.liste-resultats { list-style: none; margin: 0; padding: 0; }
.resultat {
  display: grid;
  gap: 0.1rem;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid var(--bordure);
  padding: 0.55rem 0.75rem;
  font: inherit;
  cursor: pointer;
}
.resultat:hover, .resultat:focus { background: var(--accent-clair); outline: none; }
.resultats-chants .vide { padding: 0.75rem; margin: 0; }

/* Téléphone : vignettes en bandeau horizontal au-dessus de la diapo */
@media (max-width: 760px) {
  main.editeur { height: auto; }
  .masque-mobile { display: none; }
  .espace { grid-template-columns: 1fr; grid-template-rows: auto auto auto; }
  .vignettes {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: none;
    border-bottom: 1px solid var(--bordure);
    padding: 0.5rem;
  }
  .groupes, .groupe, .groupe-fixe { display: flex; gap: 0.25rem; margin: 0; }
  .groupe-entete { display: none; }
  .vignette { width: 120px; flex-shrink: 0; }
  .vignettes-vide { margin: 0.5rem; }
  .centre { padding: 0.75rem; }
  .scene { min-width: 0; max-width: 100%; }
  .form-proprietes input:not([type=checkbox]) { min-width: 0; width: 100%; }
  .form-proprietes label { flex: 1 1 100%; }
  .vue-trieuse .vignettes { display: block; }
  .vue-trieuse .groupes { display: block; }
  .vue-trieuse .groupe, .vue-trieuse .groupe-fixe { display: grid; grid-template-columns: repeat(2, 1fr); }
  .vue-trieuse .vignette { width: auto; }
}

.ruban-form select { font: inherit; font-size: 0.85rem; padding: 0.3rem; border: 1px solid var(--bordure); border-radius: 4px; background: var(--surface); }
.lien-themes { font-size: 0.78rem; padding: 0.2rem 0.3rem; align-self: flex-end; }

/* ================================================================
   Thèmes
   ================================================================ */
.grille-themes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}
.carte-theme {
  display: grid;
  gap: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  padding: 0.75rem;
  color: var(--texte);
  text-decoration: none;
}
.carte-theme:hover { border-color: var(--accent); }
.carte-theme .diapo { border-radius: 3px; }
.carte-theme-nom { font-weight: 600; }
.formulaire-theme {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 1.3fr;
  gap: 1.5rem;
  align-items: start;
}
.formulaire-theme .message { grid-column: 1 / -1; }
.formulaire-theme input[type=color] { width: 4rem; height: 2.2rem; padding: 0.1rem; }
.formulaire-theme select, .formulaire-theme input[type=number] {
  font: inherit;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  max-width: 16rem;
}
.champ-case { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.champ-case small { flex-basis: 100%; }
.colonne-apercu { position: sticky; top: 1rem; }
.apercu-theme { display: grid; gap: 0.75rem; }
.apercu-theme .diapo { border-radius: 4px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); }
@media (max-width: 760px) {
  .formulaire-theme { grid-template-columns: 1fr; }
  .colonne-apercu { position: static; order: -1; }
}
.champ-case input { width: auto; order: -1; }
.champ-case label { font-weight: 600; }


/* ================================================================
   Saisie des chants dans l'éditeur (mode édition)
   ================================================================ */
.diapo-editable { outline: 3px solid var(--accent); outline-offset: 3px; cursor: text; }
.diapo-editable .diapo-contenu { outline: none; min-height: 30%; caret-color: currentColor; }
.diapo-editable .diapo-contenu:empty::before { content: "Tapez les paroles de cette diapo…"; opacity: 0.5; }


.groupe-edition { box-shadow: 0 0 0 2px var(--accent); background: var(--accent-pale); }
.groupe-edition .groupe-entete { color: var(--accent); font-weight: 600; }

.outil-carre { min-width: 2.2rem; max-width: none; justify-content: center; font-size: 1rem; padding: 0.35rem 0.5rem; }
.outil-couleur { flex-direction: row; align-items: center; gap: 0.3rem; font-size: 0.85rem; }
.outil-couleur .couleur-a { display: inline-flex; flex-direction: column; align-items: center; font-size: 1rem; }
.trait-couleur { display: block; width: 1.1rem; height: 0.28rem; margin-left: -1.35rem; margin-top: 1.25rem; background: #ffd700; border-radius: 1px; }
.carre-fond { width: 1rem; height: 1rem; border: 1px solid var(--bordure); border-radius: 2px; background: #000; }
.outil-couleur .fleche { font-size: 0.65rem; color: var(--texte-doux); }

/* Nuanciers (Couleur du texte, Fond) */
.palette {
  position: fixed;
  z-index: 50;
  width: 15.5rem;
  padding: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
.palette[hidden] { display: none; }
.palette-titre { margin: 0 0 0.5rem; font-size: 0.85rem; font-weight: 600; }
.palette-titre small { display: block; font-weight: 400; color: var(--texte-doux); }
.nuancier { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.35rem; margin-bottom: 0.5rem; }
.nuancier button {
  aspect-ratio: 1;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
}
.nuancier button:hover { outline: 2px solid var(--accent); outline-offset: 1px; }
.palette-ligne {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 0.35rem 0.4rem;
  border: none;
  border-radius: 4px;
  background: none;
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}
.palette-ligne:hover { background: var(--fond); }
.palette-ligne input[type=color] { width: 2rem; height: 1.4rem; padding: 0; border: 1px solid var(--bordure); background: none; cursor: pointer; }
.palette-chant { margin-top: 0.3rem; border-top: 1px solid var(--bordure); border-radius: 0; padding-top: 0.5rem; color: var(--accent); font-weight: 600; }
.couleur-a { font-weight: 700; line-height: 1; }
body:not(.mode-edition) .groupe-police .outil { opacity: 0.45; }

.dialogue details { margin-top: 0.75rem; }
.dialogue summary { cursor: pointer; color: var(--texte-doux); font-size: 0.9rem; }
.liste-resultats li { display: flex; align-items: stretch; border-bottom: 1px solid var(--bordure); }
.liste-resultats li .resultat { border-bottom: none; flex: 1; }
.supprimer-chant { padding: 0 0.75rem; opacity: 0.6; }
.supprimer-chant:hover { opacity: 1; background: #fde7e9; }
.outils-pile { display: flex; flex-direction: column; gap: 0.1rem; }
.outil-ligne { flex-direction: row; justify-content: flex-start; min-width: 0; max-width: none; white-space: nowrap; padding: 0.2rem 0.45rem; }
.ruban-groupe .outil { min-width: 3.6rem; }
.ruban-groupe .outil-carre { min-width: 2.1rem; padding: 0.35rem 0.4rem; }
.ruban-groupe .outil-ligne { min-width: 0; }
/* Ruban contextuel : outils de saisie seulement en mode édition, outils de
   l'élément du culte seulement hors édition. */
body:not(.mode-edition) .groupe-edition-seule,
body.mode-edition .groupe-hors-edition,
body.mode-edition .cache-en-edition,
body:not(.mode-edition) .cache-hors-edition { display: none; }

/* Déploiement sans volume de données (voir config/settings.py) */
.alerte-serveur {
  background: #a4262c;
  color: #fff;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  line-height: 1.4;
}
.alerte-serveur code { background: rgba(255, 255, 255, 0.2); padding: 0 0.25rem; border-radius: 3px; }

/* Ruban, groupe Police : police et taille (pt) de la diapo affichée. */
/* Comme PowerPoint : police et taille sur une ligne, G I S A ⌫ en dessous. */
.pile-police { display: flex; flex-direction: column; gap: 0.2rem; }
.outils-police { display: flex; align-items: center; gap: 0.25rem; }
.outils-format { display: flex; align-items: center; gap: 0.1rem; }
.outils-format .outil { padding-top: 0.2rem; padding-bottom: 0.2rem; }
.outils-police select, .outils-police input {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.2rem 0.3rem;
  border: 1px solid var(--bordure);
  border-radius: 4px;
  background: var(--surface);
}
.outils-police select { width: 8.5rem; }
.outils-police input { width: 2.8rem; text-align: center; border-radius: 4px 0 0 4px; }
.outils-police input::-webkit-inner-spin-button { display: none; }
.outils-police input { -moz-appearance: textfield; appearance: textfield; }
.outils-police input.taille-auto { color: var(--texte-doux); font-style: italic; }
.outils-police :disabled { opacity: 0.5; }
.outil-actif { background: var(--accent-clair); box-shadow: inset 0 0 0 1px var(--accent); }

/* ================================================================
   Projection plein écran (cultes/projection.html)
   ================================================================ */
body.projection { margin: 0; background: #000; overflow: hidden; height: 100vh; }
body.projection.curseur-cache, body.projection.curseur-cache * { cursor: none; }
.projection-scene { height: 100vh; display: flex; align-items: center; justify-content: center; }
.projection-diapo { width: min(100vw, calc(100vh * 16 / 9)); }
.projection-diapo .diapo { border-radius: 0; }
.projection-fin { color: #8a8a8a; font: 1.1rem system-ui, sans-serif; }
.projection-ecran { position: fixed; inset: 0; background: #000; z-index: 5; }
.projection-ecran.ecran-blanc { background: #fff; }

/* Vue présentateur (cultes/projection_presentateur.html) */
body.presentateur {
  margin: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  background: #1f1f1f;
  color: #eee;
  font-family: system-ui, sans-serif;
}
.presentateur-barre { display: flex; align-items: center; gap: 1rem; padding: 0.5rem 1rem; background: #2b2b2b; }
.presentateur-barre .bouton-lien { color: #ddd; }
.presentateur-barre .bouton-principal { margin-left: auto; }
.presentateur-chrono { font-variant-numeric: tabular-nums; font-size: 1.3rem; cursor: pointer; }
.presentateur-principal { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; padding: 1rem 1.5rem; min-height: 0; }
.presentateur-libelle { margin: 0 0 0.4rem; color: #bbb; font-size: 0.9rem; }
.presentateur-cadre .diapo { border-radius: 4px; }
.presentateur-actuelle .presentateur-cadre { max-width: calc((100vh - 330px) * 16 / 9); }
.presentateur-commandes { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.presentateur-liste {
  list-style: none;
  margin: 0;
  padding: 0.6rem 1rem;
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  background: #2b2b2b;
}
.presentateur-liste .vignette { width: 9.5rem; flex: none; }
.presentateur-liste .vignette.active .diapo { border-color: var(--accent); }
@media (max-width: 760px) { .presentateur-principal { grid-template-columns: 1fr; } }

/* Icônes Projeter / Exporter (barre du culte, liste des cultes) */
.actions-culte { display: flex; align-items: center; gap: 0.4rem; }
.bouton-projeter {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.8rem;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
.bouton-projeter:hover { filter: brightness(1.1); }
.icone-culte {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 4px;
  color: var(--texte-doux);
  text-decoration: none;
}
.icone-culte:hover { background: var(--fond, #f3f2f1); color: var(--accent); }
.liste-cultes li > a:first-child { flex: 1; }
.liste-cultes .icone-culte { display: inline-flex; }
.bouton-exporter {
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  border: 1px solid var(--bordure);
  border-radius: 4px;
  background: var(--surface);
  color: inherit;
  font-weight: 600;
  text-decoration: none;
}
.bouton-exporter:hover { border-color: var(--accent); color: var(--accent); }
.etat-projecteur { margin-left: auto; font-size: 0.85rem; color: #f0b429; }
.etat-projecteur.connecte { color: #6ccb5f; }
.presentateur-barre .etat-projecteur + .bouton-principal { margin-left: 0; }

/* ================================================================
   Animations d'entrée du texte (static/js/animations.js pose .joue)
   ================================================================ */
.diapo { --duree-animation: 0.8s; }
.diapo[data-vitesse="rapide"] { --duree-animation: 0.4s; }
.diapo[data-vitesse="lente"] { --duree-animation: 1.5s; }
.diapo.joue[data-animation="fondu"] .diapo-contenu { animation: anim-fondu var(--duree-animation) ease-out both; }
.diapo.joue[data-animation="monter"] .diapo-contenu { animation: anim-monter var(--duree-animation) cubic-bezier(0.2, 0.7, 0.3, 1) both; }
.diapo.joue[data-animation="zoom"] .diapo-contenu { animation: anim-zoom var(--duree-animation) cubic-bezier(0.2, 0.7, 0.3, 1) both; }
.diapo.joue[data-animation="lignes"] .diapo-contenu > * {
  animation: anim-monter var(--duree-animation) ease-out both;
  animation-delay: calc(var(--rang, 0) * var(--duree-animation) * 0.5);
}
.diapo.joue[data-animation="machine"] .lettre { opacity: 0; animation: anim-fondu 0.05s linear both; animation-delay: var(--delai, 0s); }
@keyframes anim-fondu { from { opacity: 0; } to { opacity: 1; } }
@keyframes anim-monter { from { opacity: 0; transform: translateY(12%); } to { opacity: 1; transform: none; } }
@keyframes anim-zoom { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .diapo.joue .diapo-contenu, .diapo.joue .diapo-contenu > *, .diapo.joue .lettre { animation: none !important; opacity: 1 !important; }
}

/* Vignette d'une diapo animée : petit badge ✦ (comme le volet Animation de PowerPoint). */
.vignette .diapo[data-animation]::after {
  content: "✦";
  position: absolute;
  right: 4%;
  bottom: 4%;
  font-size: 0.75rem;
  line-height: 1;
  color: #ffd700;
  text-shadow: 0 0 2px #000;
}

/* Onglet Animations */
.groupe-animations { gap: 0.1rem; }
.outil-animation { min-width: 4.6rem; }
.apercu-anim { font-size: 1.1rem; }
.outil-vitesse { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.8rem; }
.outil-vitesse select { font: inherit; padding: 0.2rem 0.3rem; border: 1px solid var(--bordure); border-radius: 4px; }
.scene { position: relative; }
.diapo-apercu { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.presentateur-astuce { margin: 0; padding: 0.3rem 1.5rem 0; font-size: 0.8rem; color: #9a9a9a; }

/* Diapo image : l'image entière (contain), légende en bas (apps/projection/rendu.zone_image) */
.diapo-image-fichier { position: absolute; inset: 3% 3%; width: 94%; height: 94%; object-fit: contain; }
.diapo-image-fichier.avec-legende { height: 82%; }
.diapo-legende { position: absolute; left: 5%; right: 5%; bottom: 0; height: 12%; width: auto; display: flex; flex-direction: column; justify-content: center; font-family: var(--police-titres, Georgia, serif); }
.icone-pdf { width: auto; padding: 0 0.35rem; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.03em; }

/* Taille : champ + bouton ▾ ; listes Taille et Interligne */
.champ-taille { display: inline-flex; align-items: stretch; }
.ouvrir-liste {
  border: 1px solid var(--bordure);
  border-left: none;
  border-radius: 0 4px 4px 0;
  background: var(--surface);
  padding: 0 0.3rem;
  font-size: 0.7rem;
  cursor: pointer;
}
.ouvrir-liste:hover { color: var(--accent); }
.ouvrir-liste:disabled { opacity: 0.5; cursor: default; }
.palette-liste { width: 13rem; }
.liste-valeurs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.25rem; margin-bottom: 0.4rem; }
.liste-valeurs button {
  padding: 0.3rem 0;
  border: 1px solid var(--bordure);
  border-radius: 4px;
  background: var(--surface);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.liste-valeurs button:hover { border-color: var(--accent); color: var(--accent); }
.liste-tailles { max-height: 12rem; overflow-y: auto; }

/* Fenêtre Partager (lien public « Suivre le culte ») */
.dialogue-partage { width: min(30rem, 94vw); }
.partage-lien { display: flex; gap: 0.4rem; margin: 0.75rem 0 0.5rem; }
.partage-lien input { flex: 1; min-width: 0; font: inherit; font-size: 0.85rem; padding: 0.4rem 0.5rem; border: 1px solid var(--bordure); border-radius: 4px; background: var(--accent-pale); }
.partage-lien .bouton-principal { margin-top: 0; }
.partage-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.partage-actions .bouton-secondaire { text-decoration: none; font-size: 0.85rem; padding: 0.35rem 0.7rem; }
.partage-qr { text-align: center; margin-top: 0.75rem; }
.partage-qr svg { width: 11rem; height: auto; }
.partage-gestion { display: flex; justify-content: space-between; margin-top: 0.5rem; border-top: 1px solid var(--bordure); padding-top: 0.5rem; }
/* La date est déjà dans le titre du culte : la masquer quand la barre manque de place. */
@media (max-width: 1440px) { .barre-culte .date-culte { display: none; } }
.alerte-legere { background: #fff4ce; color: #5c4400; border-bottom: 1px solid #f0d78c; }
