/* Styles de la galerie photos (invité + admin). Mobile-first.
   Réutilise les couleurs/polices du site (voir styles.css). */

:root {
  --green: #5A7444;
  --green-light: #839C4B;
  --bg: #fafafa;
  --card: #ffffff;
  --border: #e3e3e3;
  --danger: #b3503f;
}

.gallery-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

.gallery-title {
  font-family: 'Alex Brush', cursive;
  font-size: 3rem;
  color: var(--green);
  text-align: center;
  margin-bottom: 0.5rem;
}

.gallery-intro {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem;
  text-align: center;
  color: var(--green);
  margin-bottom: 1.5rem;
}

/* --- Boutons --- */
.btn {
  display: inline-block;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.05rem;
  font-weight: 600;
  border: none;
  border-radius: 25px;
  padding: 0.6rem 1.4rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all 0.3s ease;
  min-height: 44px;
}
.btn-primary { background-color: var(--green); color: #fff; box-shadow: 0 3px 6px rgba(0,0,0,0.08); }
.btn-primary:hover { background-color: var(--green-light); transform: translateY(-2px); }
.btn-secondary { background-color: #fff; color: var(--green); border: 1px solid var(--green); }
.btn-secondary:hover { background-color: #f0f3ea; }
.btn-danger { background-color: var(--danger); color: #fff; }
.btn-danger:hover { background-color: #97412f; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-link {
  background: none; border: none; color: var(--green-light); cursor: pointer;
  text-decoration: underline; font-size: 1rem; font-family: 'Cormorant Garamond', serif;
}

/* Bouton « vedette » façon site (jaune, Alex Brush) pour les actions principales */
.btn-cta {
  display: inline-block;
  background-color: #FFCC33;
  color: #5A7444;
  font-family: 'Alex Brush', cursive;
  font-size: 2rem;
  font-weight: 600;
  border: none;
  border-radius: 25px;
  padding: 0.5rem 2rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  min-height: 44px;
}
.btn-cta:hover { background-color: #e6b82e; transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0,0,0,0.15); color: #5A7444; }
.btn-cta:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* --- Carte de connexion --- */
.auth-card {
  background: #fdfcf7;
  border: 1px solid var(--green);
  border-radius: 16px;
  padding: 2rem 1.6rem;
  max-width: 440px;
  margin: 1.5rem auto;
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}
.auth-card h2 {
  font-family: 'Alex Brush', cursive;
  font-size: 2.4rem;
  font-weight: 400;
  color: var(--green);
  margin-bottom: 1rem;
  text-align: center;
}

.field { margin-bottom: 1rem; display: flex; flex-direction: column; gap: 0.35rem; }
.field label { color: var(--green); font-weight: 600; }
.field input, .field textarea, .field select {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  min-height: 44px;
}
.field textarea { min-height: 80px; resize: vertical; }

.form-error { color: var(--danger); margin: 0.5rem 0; min-height: 1.2em; }
.form-success { color: var(--green); margin: 0.5rem 0; }
.muted { color: #888; font-size: 0.92rem; }
.center { text-align: center; }
.hidden { display: none !important; }

/* --- Barre de session --- */
.session-bar {
  display: flex; justify-content: flex-end; align-items: center; gap: 1rem;
  margin-bottom: 1rem;
}

/* --- Upload --- */
.upload-cta { margin-bottom: 1.2rem; }
.upload-card {
  background: #fdfcf7; border: 1px solid var(--green); border-radius: 16px;
  padding: 1.6rem; margin-bottom: 2rem; box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.dropzone {
  border: 2px dashed var(--green-light); border-radius: 12px;
  padding: 1.8rem 1rem; text-align: center; color: var(--green);
  cursor: pointer; background: #f7faf2; font-size: 1.15rem;
}
.dropzone.dragover { background: #eef3e2; }
.progress { margin-top: 1rem; }
.progress-bar { height: 10px; background: #eee; border-radius: 5px; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; width: 0; background: var(--green-light); transition: width 0.2s ease; }
.progress-label { font-size: 0.9rem; color: var(--green); margin-top: 0.4rem; }

/* --- Galerie --- */
.folder-section { margin-bottom: 2.2rem; }
.folder-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.8rem; flex-wrap: wrap; border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem; margin-bottom: 0.9rem;
}
.folder-head h3 { font-family: 'Alex Brush', cursive; font-weight: 400; color: var(--green); font-size: 2rem; }
.folder-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* « Tout sélectionner » d'un dossier : visible uniquement en mode sélection */
#gallery:not(.selecting) .select-folder { display: none; }

/* --- Regroupement par journée --- */
.day-tabs {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem;
  margin-bottom: 1.4rem;
}
.day-tab {
  font-family: 'Cormorant Garamond', serif; font-size: 1.05rem; font-weight: 600;
  border: 1px solid var(--green); border-radius: 25px; padding: 0.45rem 1.2rem;
  background: #fff; color: var(--green); cursor: pointer; min-height: 44px;
  transition: all 0.3s ease;
}
.day-tab:hover { background: #f0f3ea; }
.day-tab.active { background: var(--green); color: #fff; }
.day-group.day-hidden { display: none; }
.day-title {
  display: flex; align-items: center; justify-content: center; gap: 0.9rem;
  font-family: 'Alex Brush', cursive; font-weight: 400; font-size: 2.4rem;
  color: var(--green); margin: 1.6rem 0 0.4rem;
}
.day-title::before, .day-title::after {
  content: ""; flex: 1; height: 1px; background: var(--green-light); opacity: 0.5;
}

/* --- Reportage de la photographe / photos des invités --- */
.collection-tabs {
  display: flex; max-width: 440px; margin: 0 auto 1.2rem;
  border: 1px solid var(--green); border-radius: 25px; overflow: hidden; background: #fff;
}
.collection-tab {
  flex: 1; min-height: 48px; border: none; background: none; cursor: pointer;
  font-family: 'Alex Brush', cursive; font-size: 1.7rem; color: var(--green);
  transition: background 0.3s ease, color 0.3s ease;
}
.collection-tab + .collection-tab { border-left: 1px solid var(--green); }
.collection-tab:hover { background: #f0f3ea; }
.collection-tab.active { background: var(--green); color: #fff; }
.pro-intro {
  text-align: center; margin-bottom: 1.6rem;
  font-family: 'Cormorant Garamond', serif; font-size: 1.15rem; color: var(--green);
}
.pro-intro p { margin-bottom: 0.7rem; font-style: italic; }
.prints-card {
  background: #fdfcf7; border: 1px solid var(--green); border-radius: 16px;
  padding: 1.1rem 1.2rem; max-width: 520px; margin: 0 auto;
}
.prints-card p { font-style: normal; }
.prints-access { margin: 0 0 0.9rem; }
.prints-access > div { display: flex; justify-content: center; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.3rem; }
.prints-access dt { font-weight: 600; }
.prints-access dt::after { content: " :"; }
.prints-access dd { display: flex; align-items: baseline; gap: 0.5rem; }
.prints-prefix { font-family: ui-monospace, Consolas, monospace; font-size: 1rem; color: #333; }
.prints-access code,
.prints-access input {
  font-family: ui-monospace, Consolas, monospace; font-size: 1rem; color: #333;
  background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 0.15rem 0.5rem;
  user-select: all;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 6px;
}
@media (min-width: 600px) { .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; } }
/* Reportage : vignettes plus grandes, grille plus aérée */
#gallery.pro .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
@media (min-width: 600px) { #gallery.pro .grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; } }

.tile {
  position: relative; aspect-ratio: 1 / 1; overflow: hidden;
  border-radius: 6px; background: #eee; cursor: pointer;
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile:focus-visible { outline: 3px solid var(--green-light); outline-offset: 2px; }
.tile.selected { outline: 3px solid var(--green); outline-offset: -3px; }
.tile .check {
  position: absolute; top: 6px; left: 6px; width: 22px; height: 22px;
  border-radius: 50%; background: rgba(255,255,255,0.85); border: 1px solid var(--green);
  display: none; align-items: center; justify-content: center; color: var(--green); font-weight: 700;
}
.selecting .tile .check { display: flex; }
.tile.selected .check { background: var(--green); color: #fff; }

/* Badge « lecture » sur les vignettes de vidéos */
.tile .play-badge {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(0,0,0,0.5); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; padding-left: 3px; pointer-events: none;
}

/* --- Barre d'action en lot --- */
.bulk-bar {
  position: sticky; bottom: 0; z-index: 50;
  background: var(--card); border-top: 2px solid var(--green);
  padding: 0.7rem 1rem; display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
}
.bulk-bar .count { font-weight: 600; color: var(--green); margin-right: auto; }

/* Toast de confirmation (ex. ordre enregistré) */
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 1rem);
  background: var(--green); color: #fff; padding: 0.6rem 1.1rem; border-radius: 25px;
  font-size: 0.95rem; box-shadow: 0 4px 14px rgba(0,0,0,0.18); z-index: 2100;
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* --- Onglets admin --- */
.tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.tab {
  font-family: 'Cormorant Garamond', serif; font-size: 1.05rem;
  padding: 0.55rem 1.1rem; border: 1px solid var(--green); border-radius: 25px;
  background: #fff; color: var(--green); cursor: pointer; min-height: 44px;
}
.tab.active { background: var(--green); color: #fff; }

/* --- Tableau demandes --- */
.req-table { width: 100%; border-collapse: collapse; }
.req-table th, .req-table td { text-align: left; padding: 0.55rem; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.req-row.handled { opacity: 0.5; }
.badge-new { background: var(--green-light); color: #fff; border-radius: 4px; padding: 0.1rem 0.45rem; font-size: 0.8rem; }

/* --- Lightbox --- */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,0.92); z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  /* pinch-zoom : laisser le zoom natif disponible (zoomer sur les visages) */
  touch-action: pan-y pinch-zoom;
}
.lightbox-count {
  position: absolute; top: 16px; left: 16px; color: #fff; font-size: 0.95rem;
  background: rgba(0,0,0,0.4); padding: 0.15rem 0.65rem; border-radius: 12px;
}
.lightbox-loading {
  position: absolute; width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.25); border-top-color: #fff;
  animation: lightbox-spin 0.8s linear infinite; pointer-events: none;
}
@keyframes lightbox-spin { to { transform: rotate(360deg); } }
.lightbox-stage {
  display: flex; align-items: center; justify-content: center;
  max-width: 96vw; max-height: 82vh;
}
.lightbox img,
.lightbox-stage img,
.lightbox-stage video { max-width: 96vw; max-height: 82vh; object-fit: contain; }
.lightbox-bar {
  position: absolute; bottom: 0; left: 0; right: 0; display: flex; gap: 0.6rem;
  justify-content: center; padding: 1rem; background: linear-gradient(transparent, rgba(0,0,0,0.6));
}
.lightbox-close { position: absolute; top: 12px; right: 16px; font-size: 2rem; color: #fff; cursor: pointer; background: none; border: none; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); font-size: 2.4rem; color: #fff; background: none; border: none; cursor: pointer; padding: 0 0.6rem; }
.lightbox-nav.prev { left: 4px; }
.lightbox-nav.next { right: 4px; }

.spinner { text-align: center; color: var(--green); padding: 2rem; }

/* Bouton aperçu (loupe) sur une vignette */
.tile .preview-btn {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px;
  border-radius: 50%; border: none; background: rgba(255,255,255,0.85);
  color: var(--green); cursor: pointer; font-size: 0.95rem; line-height: 1;
}
.tile .filename {
  position: absolute; bottom: 0; left: 0; right: 0; padding: 2px 4px;
  font-size: 0.7rem; color: #fff; background: rgba(0,0,0,0.45);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Réordonnancement (glisser-déposer, souris) */
.tile.dragging { opacity: 0.4; }
.tile.drop-before::before,
.tile.drop-after::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 4px;
  background: var(--green); border-radius: 2px; z-index: 6;
}
.tile.drop-before::before { left: -3px; }
.tile.drop-after::after { right: -3px; }

/* Poignée de glissement : seul point de départ du drag (le clic sur la tuile reste pour la sélection) */
.tile .drag-handle {
  position: absolute; bottom: 4px; right: 4px; width: 28px; height: 28px;
  border-radius: 6px; border: none; background: rgba(255,255,255,0.9);
  color: var(--green); font-size: 1rem; line-height: 1; cursor: grab;
  display: none; align-items: center; justify-content: center; padding: 0; z-index: 5;
}
.grid.selecting .tile .drag-handle { display: flex; }
.tile .drag-handle:active { cursor: grabbing; }

/* Mode « Insérer avant… » : le clic suivant dépose la sélection devant la photo visée */
.grid.placing .tile { cursor: copy; }
.grid.placing .tile:hover { outline: 3px dashed var(--green); outline-offset: -3px; }
.grid.placing .tile.selected { opacity: 0.45; }

/* Actions admin dans la visionneuse (déplacer / supprimer) */
.lightbox-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; justify-content: center; }
.lightbox-actions .lb-folder {
  font-family: inherit; font-size: 1rem; padding: 0.55rem 0.6rem;
  border: 1px solid var(--green); border-radius: 6px; min-height: 44px; max-width: 45vw;
}
