/* Couleurs claires du site (ivoire, or). L'espace client reste toujours clair (decide le 23/11/2026) ;
   seule la page admin (<html class="sombre-possible">) suit le mode sombre de Windows. */
:root {
  --fond: #faf7f2;
  --carte: #ffffff;
  --texte: #1c1813;
  --doux: #6e665b;
  --ligne: #e8e0d3;
  --or: #b8935a;
  --or-fonce: #8a6a30;
  --vert: #2f7d4f;
  --rouge: #b3412f;
  --ombre: 0 2px 10px rgba(60, 45, 20, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root.sombre-possible {
    color-scheme: dark;
    --fond: #16140f;
    --carte: #221f19;
    --texte: #f1ece3;
    --doux: #a69d90;
    --ligne: #3a352c;
    --or: #d0a85c;
    --or-fonce: #e2bd74;
    --vert: #5bbd83;
    --rouge: #e07a66;
    --ombre: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--fond);
  color: var(--texte);
  font-family: "Tajawal", "Segoe UI", Tahoma, "Noto Sans Arabic", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

/* Page de connexion de l'espace client : photo plein ecran (photo de demonstration, a remplacer) */
.page-connexion {
  min-height: 100vh; min-height: 100svh; display: flex; align-items: center; justify-content: center;
  padding: 72px 16px 32px; position: relative;
  background: #14110d url("https://images.unsplash.com/photo-1542038784456-1ea8e935640e?auto=format&fit=crop&w=2000&q=70") center / cover;
}
.page-connexion::before { content: ""; position: absolute; inset: 0; background: rgba(20, 17, 13, .55); }
.page-connexion .connexion {
  position: relative; width: 100%; max-width: 420px; margin: 0;
  background: rgba(250, 247, 242, .97); color: #1f1c18; padding: 40px 32px 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
.page-connexion .connexion h1 { font-family: "Amiri", serif; font-size: 30px; text-align: center; margin: 10px 0 12px; }
.page-connexion .doux { color: #6f675d; }
.page-connexion input { background: #fff; border-color: #e4ddd2; color: #1f1c18; border-radius: 0; }
.page-connexion button.principal { background: #b8935a; border-color: #b8935a; border-radius: 0; }
.page-connexion button.principal:hover { background: #a37f48; }
.page-connexion .erreur { color: #b3412f; }
.logo-grand {
  display: block; text-align: center; text-decoration: none; color: #1f1c18; direction: ltr;
  font-family: "Cormorant Garamond", Georgia, serif; font-size: 26px; font-weight: 600; letter-spacing: 5px;
}
.logo-grand span { color: #b8935a; }
.retour-site { position: absolute; top: 22px; inset-inline-start: 24px; color: #fff; text-decoration: none; opacity: .85; z-index: 1; }
.retour-site:hover { opacity: 1; }
.aide-connexion { text-align: center; font-size: 15px; margin: 4px 0 0; }
.aide-connexion a { color: #8a6a30; text-decoration: none; font-weight: 500; }
.aide-connexion a:hover { text-decoration: underline; }
.cache { display: none !important; }
.centre { text-align: center; }
button, input, select, textarea { font: inherit; color: inherit; }
button {
  border: 1px solid var(--ligne);
  background: var(--carte);
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
}
button:disabled { opacity: .5; cursor: default; }
button.principal { background: var(--or); border-color: var(--or); color: #fff; font-weight: 600; }
button.danger { color: var(--rouge); }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--ligne);
  background: var(--carte);
  border-radius: 10px;
  padding: 10px 12px;
}
label { display: block; margin: 12px 0 4px; color: var(--doux); font-size: 14px; }

header.barre {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: var(--carte); border-bottom: 1px solid var(--ligne);
  position: sticky; top: 0; z-index: 5;
}
.logo { font-family: "Cormorant Garamond", Georgia, serif; font-size: 20px; font-weight: 600; letter-spacing: 4px; color: var(--or-fonce); direction: ltr; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.boite {
  background: var(--carte); border: 1px solid var(--ligne); border-radius: 14px;
  padding: 16px; box-shadow: var(--ombre); margin-bottom: 16px;
}
.boite h2 { margin: 0 0 12px; font-size: 18px; }
.doux { color: var(--doux); }
.erreur { color: var(--rouge); min-height: 1.5em; margin: 8px 0 0; }

/* Connexion */
.connexion { max-width: 380px; width: calc(100% - 32px); margin: 10vh auto 0; }
.connexion .logo { font-size: 26px; text-align: center; margin-bottom: 4px; }
.connexion button { width: 100%; margin-top: 16px; padding: 12px; }

/* Galerie */
.filtres { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filtres button.actif { border-color: var(--or); color: var(--or-fonce); font-weight: 600; }
.galerie {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
@media (max-width: 480px) { .galerie { grid-template-columns: repeat(3, 1fr); gap: 4px; } }
.vignette {
  position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden;
  background: var(--ligne); cursor: pointer; border: 2px solid transparent; padding: 0;
}
.vignette.choisie { border-color: var(--or); }
.vignette img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vignette .pastille {
  position: absolute; top: 4px; inset-inline-start: 4px; background: var(--or); color: #fff;
  border-radius: 999px; font-size: 12px; padding: 0 7px; font-weight: 700;
}
.vignette .pastille-album {
  position: absolute; bottom: 4px; inset-inline-start: 4px; background: rgba(0, 0, 0, .65); color: #fff;
  border-radius: 999px; font-size: 11px; padding: 0 7px;
}

/* Protection des photos */
.protege, .protege * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.protege img { pointer-events: none; -webkit-user-drag: none; }
body.voile .protege img { filter: blur(24px); }
@media print { .protege { display: none !important; } }

/* Fenetre photo */
.fenetre {
  position: fixed; inset: 0; background: #000; z-index: 20;
  display: flex; flex-direction: column;
}
.fenetre .haut { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; color: #fff; }
.fenetre .haut button { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .3); }
.fenetre .image { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; }
.fenetre .image img { max-width: 100%; max-height: 100%; object-fit: contain; }
.fenetre .fleche {
  position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0, 0, 0, .4);
  color: #fff; border: none; font-size: 28px; width: 44px; height: 64px;
}
.fenetre .fleche.prec { left: 4px; }
.fenetre .fleche.suiv { right: 4px; }
.fenetre .options {
  background: var(--carte); padding: 12px 16px 16px; border-radius: 16px 16px 0 0;
  max-height: 50vh; overflow: auto;
}
.ligne-format {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid var(--ligne);
}
.ligne-format:last-child { border-bottom: none; }
.compteur { display: flex; align-items: center; gap: 6px; }
.compteur button { width: 38px; height: 38px; padding: 0; font-size: 20px; }
.compteur span { min-width: 28px; text-align: center; font-weight: 700; }
.case { display: flex; align-items: center; gap: 10px; padding: 10px 0; cursor: pointer; margin: 0; color: var(--texte); font-size: 16px; }
.case input { width: 22px; height: 22px; }

/* Barre du total */
.barre-total {
  position: sticky; bottom: 0; background: var(--carte); border-top: 1px solid var(--ligne);
  padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; z-index: 5;
}
.barre-total strong { font-size: 18px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 8px 6px; border-bottom: 1px solid var(--ligne); }
td.nombre, th.nombre { text-align: end; white-space: nowrap; }
tr.total td { font-weight: 700; border-bottom: none; }
.message { padding: 12px 14px; border-radius: 10px; background: rgba(47, 125, 79, .12); color: var(--vert); margin-bottom: 16px; }

/* ---------------------------------------------------------------- Telephone */
.barre-total { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.fenetre .options { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
body.fenetre-ouverte { overflow: hidden; }
@media (max-width: 600px) {
  main { padding: 12px; }
  .boite { padding: 14px; border-radius: 12px; margin-bottom: 12px; }
  header.barre { padding: 10px 12px; }
  .logo { font-size: 17px; letter-spacing: 3px; white-space: nowrap; }
  .filtres { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .filtres button { white-space: nowrap; flex: none; }
  .fenetre .options { max-height: 46vh; padding-top: 6px; }
  .compteur button { width: 44px; height: 44px; }
  .ligne-format { padding: 6px 0; }
  .barre-total strong { font-size: 17px; }
  .page-connexion { padding: 64px 16px 24px; align-items: flex-start; }
  .page-connexion .connexion { padding: 30px 20px 22px; margin-top: 4vh; }
  .retour-site { top: 18px; inset-inline-start: 16px; font-size: 15px; }
}

/* Details de l'evenement */
.details { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
.details dt { color: var(--doux); }
.details dd { margin: 0; font-weight: 500; }
.details dd[dir="ltr"] { text-align: right; }

/* ---------------------------------------------------------------- Avancement : une ligne qui se remplit */
.avancement-titre { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.avancement-titre strong { font-size: 18px; color: var(--or-fonce); }
.ligne-avancement { position: relative; padding: 0 7px; }
.ligne-avancement::before, .ligne-pleine {
  content: ""; position: absolute; top: 6px; height: 4px; border-radius: 4px;
}
.ligne-avancement::before { inset-inline: 7px; background: var(--ligne); }
.ligne-pleine { inset-inline-start: 7px; max-width: calc(100% - 14px); background: linear-gradient(to left, var(--vert), var(--or)); transition: width .6s ease; }
.points { list-style: none; margin: 0; padding: 0; display: flex; justify-content: space-between; position: relative; }
.points li { display: flex; flex-direction: column; align-items: center; width: 16px; }
.points .point {
  width: 16px; height: 16px; border-radius: 50%; background: var(--carte); border: 2px solid var(--ligne); flex: none;
}
.points li.fait .point { background: var(--vert); border-color: var(--vert); }
.points li.actuel .point { background: var(--or); border-color: var(--or); box-shadow: 0 0 0 5px rgba(168, 130, 63, .22); }
.points .nom-etape {
  margin-top: 8px; font-size: 12px; line-height: 1.3; color: var(--doux); text-align: center; width: 84px;
}
.points li.actuel .nom-etape { color: var(--texte); font-weight: 700; }
@media (max-width: 760px) { .points .nom-etape { display: none; } }

/* ---------------------------------------------------------------- Galerie : cocher les photos */
.vignette { user-select: none; }
.vignette .coche {
  position: absolute; top: 6px; inset-inline-start: 6px; width: 28px; height: 28px; padding: 0;
  border-radius: 50%; border: 2px solid #fff; background: rgba(0, 0, 0, .3); color: #fff;
  font-size: 16px; font-weight: 700; line-height: 1; pointer-events: none;
}
.vignette.choisie .coche { background: var(--or); border-color: var(--or); }
.vignette.choisie img { opacity: .85; }
.vignette .agrandir {
  position: absolute; bottom: 6px; inset-inline-end: 6px; width: 30px; height: 30px; padding: 0;
  border-radius: 8px; border: none; background: rgba(0, 0, 0, .55); color: #fff; font-size: 16px;
}
.vignette.choisie { border-color: var(--or); border-width: 3px; }

/* ---------------------------------------------------------------- Resume : format et album */
.nombre-choisies { font-size: 17px; font-weight: 700; margin: 0 0 10px; }
.sous-titre-bloc { color: var(--doux); margin: 0 0 8px; }
.formats { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-bottom: 10px; }
.format { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px; border-width: 2px; }
.format strong { font-size: 18px; }
.format span { font-size: 13px; color: var(--doux); }
.format.actif { border-color: var(--or); background: rgba(168, 130, 63, .12); }
.case-album { align-items: flex-start; border-top: 1px solid var(--ligne); margin-bottom: 6px; }
.case-album input { flex: none; margin-top: 3px; }
#btn-valider { width: 100%; padding: 13px; margin-top: 12px; font-size: 17px; }

/* Photo en grand : bouton choisir */
.bouton-choix { width: 100%; padding: 14px; font-size: 17px; font-weight: 600; }
.bouton-choix.actif { background: var(--or); border-color: var(--or); color: #fff; }
.barre-total button { white-space: nowrap; flex: none; }
.barre-total > div { font-size: 14px; line-height: 1.4; }
@media (max-width: 600px) { .formats { grid-template-columns: repeat(3, 1fr); } .format { padding: 10px 4px; } .format strong { font-size: 16px; } .format span { font-size: 12px; } }

/* Photo en grand : zoom et gestes */
.fenetre .image { touch-action: none; overflow: hidden; cursor: zoom-in; }
.fenetre .image.zoomee { cursor: grab; }
.fenetre .image img { transform-origin: center center; will-change: transform; }
.fenetre .image img.anime { transition: transform .25s ease; }
.fenetre .haut span { font-size: 15px; }
.fenetre .indication { position: absolute; bottom: 8px; inset-inline: 0; text-align: center; color: rgba(255, 255, 255, .6); font-size: 13px; pointer-events: none; }
.vignette .coche { pointer-events: auto; cursor: pointer; width: 32px; height: 32px; }
.fenetre .fleche { direction: ltr; unicode-bidi: isolate; }   /* sinon ‹ › sont inverses en arabe */

/* Espace client : couleur d'accent = vert WhatsApp sur toute la page (demande du 23/11/2026).
   Le logo garde l'or du studio. */
body.espace { --or: #25d366; --or-fonce: #179c4a; }
body.espace .logo, body.espace .logo-grand span { color: #a8823f; }
body.espace button.principal:hover { background: #1ebe5b; border-color: #1ebe5b; }
body.espace .points li.actuel .point { box-shadow: 0 0 0 5px rgba(37, 211, 102, .22); }
body.espace .format.actif { background: rgba(37, 211, 102, .1); }
body.espace .page-connexion button.principal { background: #25d366; border-color: #25d366; }
body.espace .page-connexion button.principal:hover { background: #1ebe5b; }
body.espace .aide-connexion a { color: #179c4a; }

/* Logo du studio sur les pages de connexion */
.logo-connexion { display: block; text-align: center; line-height: 0; }
.logo-connexion img { height: 150px; width: auto; }
.connexion .logo-connexion img { margin-bottom: 4px; }
@media (prefers-color-scheme: dark) { :root.sombre-possible .logo-connexion img { content: url("/img/logo-blanc.webp"); } }

/* Choix de l'album (le client choisit la taille) */
.albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-bottom: 12px; }
.album { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px; border-width: 2px; }
.album strong { font-size: 15px; }
.album span { font-size: 13px; color: var(--doux); }
.album.actif { border-color: var(--or); background: rgba(37, 211, 102, .1); }
@media (max-width: 600px) { .albums { grid-template-columns: repeat(3, 1fr); } .album { padding: 10px 4px; } .album strong { font-size: 14px; } }

/* Compte de la prestation, sous les details de l'evenement */
.table-service { margin-top: 14px; border-top: 1px solid var(--ligne); }
#albums .ligne-format strong { font-size: 15px; }
#albums .ligne-format.choisi strong { color: var(--or-fonce); }
#albums.albums { display: block; }   /* une ligne par taille d album, avec - et + */

/* Bloc « الصور والألبوم » en 3 parties : photos, album, total (26/11/2026) */
.partie { padding: 16px 0; border-bottom: 1px solid var(--ligne); }
.partie:first-child { padding-top: 0; }
.partie.resume { border-bottom: none; padding-bottom: 0; }
.titre-partie { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 19px; }
.titre-partie .optionnel { font-size: 14px; font-weight: 400; }
.icone-partie {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 38px; height: 38px; border-radius: 10px; background: rgba(37, 211, 102, .12); color: var(--or-fonce);
}
.prix-partie { display: flex; justify-content: space-between; gap: 10px; margin: 8px 0 0; padding: 10px 12px; border-radius: 10px; background: rgba(0, 0, 0, .03); }
.prix-partie:empty { display: none; }
.prix-partie strong { white-space: nowrap; }
.ligne-album { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--ligne); }
.ligne-album:last-child { border-bottom: none; }
.ligne-album .case { flex: 1; }
.ligne-album strong { font-size: 15px; }
.ligne-album.choisi strong { color: var(--or-fonce); }
#table-total tr.grand-total td { font-size: 18px; color: var(--or-fonce); border-top: 2px solid var(--ligne); }
body.espace input[type="checkbox"] { accent-color: #25d366; }
.ligne-album .case > span { display: flex; flex-direction: column; line-height: 1.35; }
.ligne-album .doux { font-size: 14px; }
