/* ============================================================================
   photo-gallery-scroll.css — v313.154.67
   ----------------------------------------------------------------------------
   Galleria scorrevole orizzontale stile AllTrails per la sezione "Galleria
   di foto" del detail panel. Sostituisce l'empty-state quando ci sono foto,
   con thumbnail grandi swipe-able + lightbox al tap.
   ============================================================================ */

.ams-scroll-gallery-wrap {
  margin: 8px 0 12px;
}

.ams-scroll-gallery-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 4px 8px;
}
.ams-scroll-gallery-count {
  font-size: 12px;
  color: #8a8a96;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.ams-scroll-gallery {
  display: flex;
  flex-direction: row;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-padding-left: 4px;
  -webkit-overflow-scrolling: touch;
  padding: 4px 4px 12px;
  /* Hide scrollbar (estetica AllTrails: solo tappa-e-trascina) */
  scrollbar-width: none;
  /* v1.18.27: il bridge JS decide vertical-scroll vs swipe orizzontale. */
  touch-action: pan-x pan-y pinch-zoom;
  -ms-touch-action: manipulation;
}
.ams-scroll-gallery::-webkit-scrollbar { display: none; }

.ams-scroll-tile {
  flex: 0 0 auto;
  width: 220px;
  height: 160px;
  border-radius: 12px;
  overflow: hidden;
  scroll-snap-align: start;
  background: #1a1f2e;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
  transition: transform .15s ease, box-shadow .15s ease;
}
.ams-scroll-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .20);
}
.ams-tile-img-btn {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.ams-scroll-tile img {
  width: 100%;
  height: 100%;
  object-fit: contain;       /* v64: vedi tutta la foto, no crop su verticali */
  background: #0f1419;       /* fondo neutro per le bande */
  display: block;
}

/* Badge AI verdict (visibile solo a chi vede la galleria — admin nel rendering) */
.ams-tile-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(196, 60, 30, .92);
  color: #fff;
  font-size: 14px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
  cursor: help;
  pointer-events: auto;
}
.ams-tile-badge--ai-amb {
  background: rgba(180, 130, 40, .92);
}

/* Admin controls (visibili solo se isAdmin) */
.ams-tile-admin {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  pointer-events: auto;
}
.ams-tile-admin-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .12s ease;
}
.ams-tile-admin-btn:hover {
  background: rgba(0, 0, 0, .85);
}
.ams-tile-admin-btn--del:hover {
  background: rgba(196, 30, 30, .9);
}
.ams-scroll-tile-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6a6a78;
  font-size: 13px;
}

/* Mobile: thumbnail leggermente più piccole, ma non troppo (AllTrails-like) */
@media (max-width: 600px) {
  .ams-scroll-tile {
    width: 168px;
    height: 124px;
  }
}

/* ── Lightbox modal ──────────────────────────────────────────────────── */

.ams-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100050;
  background: rgba(0, 0, 0, .92);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity .2s ease;
}
.ams-lightbox.is-open {
  opacity: 1;
}

.ams-lightbox-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.ams-lightbox-img {
  max-width: 96vw;
  max-height: 88vh;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.ams-lightbox-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease;
}
.ams-lightbox-btn:hover {
  background: rgba(255, 255, 255, .22);
}
.ams-lightbox-btn--prev { left: 16px; }
.ams-lightbox-btn--next { right: 16px; }
.ams-lightbox-btn--close {
  top: 16px;
  right: 16px;
  transform: none;
  width: 40px;
  height: 40px;
  font-size: 18px;
}
.ams-lightbox-btn[disabled] {
  opacity: .25;
  cursor: not-allowed;
}

.ams-lightbox-counter {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, .75);
  font: 13px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: rgba(0, 0, 0, .35);
  padding: 6px 12px;
  border-radius: 16px;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

@media (prefers-reduced-motion: reduce) {
  .ams-lightbox,
  .ams-scroll-tile {
    transition: none;
  }
}
