/* ============================================================
   galerie.css — Page Galerie & Lightbox
   ============================================================ */

/* ---- En-tête ---- */
.galerie-page { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.galerie-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem; margin-bottom: 2rem;
}
.galerie-header h2 {
  font-family: 'Oswald', sans-serif;
  font-size: 2rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--dark);
}
.galerie-sub { color: var(--stone); font-size: .9rem; margin-top: .25rem; }

/* ---- Filtres ---- */
.galerie-filters {
  display: flex; gap: .5rem; flex-wrap: wrap;
  margin-bottom: 1.75rem;
}
.gfilter {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem 1rem; border-radius: 20px;
  border: 1.5px solid var(--border);
  background: #fff; color: var(--stone);
  font-size: .82rem; font-weight: 600;
  cursor: pointer; transition: all .2s;
}
.gfilter svg { width: 14px; height: 14px; }
.gfilter:hover { border-color: var(--green-accent); color: var(--green-accent); }
.gfilter.active {
  background: var(--green-accent); border-color: var(--green-accent);
  color: #fff;
}

/* ---- Grille ---- */
.galerie-grid {
  columns: 3;
  column-gap: 1rem;
}
@media (max-width: 900px) { .galerie-grid { columns: 2; } }
@media (max-width: 500px) { .galerie-grid { columns: 1; } }

.galerie-item {
  break-inside: avoid;
  margin-bottom: 1rem;
}

/* ---- Miniature ---- */
.gi-thumb {
  position: relative; overflow: hidden;
  border-radius: 12px; cursor: pointer;
  background: #d8ddd0;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
  transition: transform .25s, box-shadow .25s;
}
.gi-thumb:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.14); }

.gi-thumb img,
.gi-thumb video {
  width: 100%; display: block;
  border-radius: 12px;
}

/* Overlay au survol */
.gi-overlay {
  position: absolute; inset: 0;
  background: rgba(30,50,30,.35);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .25s;
  border-radius: 12px;
}
.gi-overlay svg { width: 36px; height: 36px; stroke: #fff; }
.gi-thumb:hover .gi-overlay { opacity: 1; }

/* État d'erreur vidéo (codec non supporté) */
.gi-error-overlay {
  display: none;
  position: absolute; inset: 0;
  background: rgba(20,20,20,.82);
  border-radius: 12px;
  flex-direction: column;
  align-items: center; justify-content: center;
  gap: .5rem;
  padding: 1rem;
  text-align: center;
}
.gi-error-overlay svg   { width: 32px; height: 32px; stroke: rgba(255,255,255,.6); }
.gi-error-overlay span  { font-size: .72rem; color: rgba(255,255,255,.7); font-weight: 600; }
.gi-dl-btn {
  display: inline-flex; align-items: center; gap: .3rem;
  background: var(--gold); color: #1a1a1a;
  font-size: .72rem; font-weight: 700;
  padding: .3rem .75rem; border-radius: 7px;
  text-decoration: none; margin-top: .25rem;
}

/* Quand l'erreur est détectée sur la miniature */
.gi-video.video-error .gi-overlay       { display: none !important; }
.gi-video.video-error .gi-error-overlay { display: flex; }
.gi-video.video-error video             { opacity: .15; }

/* Bouton play pour les vidéos */
.gi-play-btn {
  width: 52px; height: 52px;
  background: rgba(255,255,255,.9);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.gi-play-btn svg { width: 22px; height: 22px; color: var(--dark); margin-left: 3px; }

/* Badge "Vidéo" */
.gi-video-badge {
  position: absolute; top: 8px; left: 8px;
  display: flex; align-items: center; gap: .3rem;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  color: #fff; font-size: .72rem; font-weight: 600;
  padding: .25rem .55rem; border-radius: 20px;
}
.gi-video-badge svg { width: 12px; height: 12px; }

/* ---- État vide ---- */
.galerie-empty {
  text-align: center; padding: 5rem 2rem; color: var(--stone);
}
.galerie-empty svg { width: 60px; height: 60px; opacity: .35; margin-bottom: 1rem; }
.galerie-empty p { font-size: 1rem; }

/* ============================================================
   Lightbox
   ============================================================ */
.lightbox {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(10,15,10,.92);
  display: none; align-items: center; justify-content: center;
  padding: 1rem;
}
.lightbox.open { display: flex; }

.lb-content {
  max-width: min(90vw, 1100px);
  max-height: 88vh;
  display: flex; align-items: center; justify-content: center;
}
.lb-content img {
  max-width: 100%; max-height: 88vh;
  border-radius: 10px;
  box-shadow: 0 8px 48px rgba(0,0,0,.5);
  object-fit: contain;
}
.lb-content video {
  max-width: 100%; max-height: 88vh;
  border-radius: 10px;
  box-shadow: 0 8px 48px rgba(0,0,0,.5);
  outline: none;
}

/* Bouton fermer */
.lb-close {
  position: fixed; top: 16px; right: 20px;
  background: rgba(255,255,255,.12); border: none;
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #fff; transition: background .2s;
  z-index: 10000;
}
.lb-close:hover { background: rgba(255,255,255,.25); }
.lb-close svg { width: 20px; height: 20px; }

/* Flèches navigation */
.lb-prev, .lb-next {
  position: fixed; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.12); border: none;
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #fff; transition: background .2s;
  z-index: 10000;
}
.lb-prev { left: 14px; }
.lb-next { right: 14px; }
.lb-prev:hover, .lb-next:hover { background: rgba(255,255,255,.28); }
.lb-prev svg, .lb-next svg { width: 22px; height: 22px; }

/* Compteur */
.lb-counter {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,.6); font-size: .82rem; font-weight: 500;
  background: rgba(0,0,0,.4); padding: .3rem .8rem; border-radius: 20px;
  z-index: 10000;
}

/* ============================================================
   Admin — section galerie (injectée dans admin.php)
   ============================================================ */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 16px; padding: 2.5rem;
  text-align: center; background: #fafaf8;
  transition: border-color .2s, background .2s;
  cursor: pointer;
}
.upload-zone:hover,
.upload-zone.drag-over { border-color: var(--green-accent); background: var(--green-light); }
.upload-zone svg { width: 44px; height: 44px; color: var(--stone); margin-bottom: .75rem; opacity: .6; }
.upload-zone p { color: var(--stone); font-size: .9rem; margin-bottom: .75rem; }
.upload-zone strong { color: var(--dark); }

.upload-progress { display: none; margin-top: 1rem; }
.upload-bar { height: 6px; background: #e5e0d8; border-radius: 3px; overflow: hidden; }
.upload-bar-fill {
  height: 100%; width: 0%;
  background: var(--green-accent);
  transition: width .3s;
  border-radius: 3px;
}

/* Grille admin galerie */
.admin-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .85rem;
  margin-top: 1.5rem;
}
.admin-media-item {
  position: relative; border-radius: 10px; overflow: hidden;
  background: #e8e0d4; aspect-ratio: 1;
  box-shadow: 0 1px 6px rgba(0,0,0,.08);
}
.admin-media-item img,
.admin-media-item video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.admin-media-del {
  position: absolute; top: 6px; right: 6px;
  background: rgba(184,50,48,.85); backdrop-filter: blur(4px);
  border: none; border-radius: 6px;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #fff; transition: background .2s;
  opacity: 0;
}
.admin-media-item:hover .admin-media-del { opacity: 1; }
.admin-media-del svg { width: 14px; height: 14px; }
.admin-media-badge {
  position: absolute; bottom: 6px; left: 6px;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  color: #fff; font-size: .68rem; font-weight: 600;
  padding: .2rem .5rem; border-radius: 10px;
}
