/* ============================================================
   galleriafoto.css — Modal Galleria Fotografica
   ============================================================ */

/* ── CARD ───────────────────────────────────────────────────── */
/* gal-card, fmv-ico, fmv-txt, fmv-ttl, fmv-dsc definiti in eventi.css */

/* ── MODAL GALLERIA ─────────────────────────────────────────── */
#galModal {
  display: none;
  position: fixed; inset: 0;
  z-index: 999999;
  flex-direction: column;
  font-family: Arial, Helvetica, sans-serif;

  --gal-bg1:    #0b1220;
  --gal-bg2:    #16233a;
  --gal-panel:  rgba(255,255,255,0.08);
  --gal-text:   #eef2ff;
  --gal-muted:  #b8c2d9;
  --gal-accent: #6ea8fe;
  --gal-shadow: 0 18px 50px rgba(0,0,0,0.40);

  color: var(--gal-text);
  background:
    radial-gradient(circle at top left,    rgba(110,168,254,0.18), transparent 24%),
    radial-gradient(circle at bottom right, rgba(64,224,208,0.12),  transparent 18%),
    linear-gradient(135deg, var(--gal-bg1), var(--gal-bg2));
}
#galModal.open { display: flex; }

/* Topbar — stessa struttura del flipbook */
#galModal .fbk-viewer-topbar {
  flex: 0 0 auto;
  display: flex; align-items: center;
  flex-wrap: wrap;
  gap: 10px; padding: 10px 18px;
  backdrop-filter: blur(12px);
  background: rgba(11,18,32,0.60);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  z-index: 20; box-sizing: border-box;
}
#galModal p { margin-bottom: 0 !important; }
#galModal .fbk-viewer-topbar > p { display: contents; margin: 0; padding: 0; }
#galModal .fbk-topbar-head {
  display: flex; align-items: center; gap: 12px;
  flex: 0 0 auto; min-width: 0; order: 1;
}
#galModal .fbk-title-wrap { min-width: 0; }
#galModal .fbk-title-wrap h1 { font-size: 13px; font-weight: 700; line-height: 1.35; color: #eef2ff; }
#galModal .fbk-title-wrap p  { font-size: 12px; color: #b8c2d9; margin-top: 2px; }

/* Toolbar galleria */
#galModal .gal-toolbar {
  display: flex; align-items: center; gap: 8px;
  flex: 1 1 auto; flex-wrap: nowrap; justify-content: flex-end;
  order: 2;
}
#galModal .gal-end-group {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}

/* Contatore foto */
#galModal .gal-counter {
  font-size: 13px; color: #b8c2d9;
  min-width: 70px; text-align: center; flex-shrink: 0;
}
#galModal .gal-counter strong { color: #eef2ff; font-size: 15px; }

/* Pulsanti — identici al flipbook */
#galModal .fbk-btn-ui {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,0.14);
  background: var(--gal-panel); color: var(--gal-text);
  border-radius: 999px; padding: 0 16px;
  height: 36px; box-sizing: border-box;
  font-size: 14px; cursor: pointer; white-space: nowrap;
  text-decoration: none; user-select: none;
  transition: background .15s, transform .1s;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
}
#galModal .fbk-btn-ui:hover   { background: rgba(255,255,255,0.15); transform: translateY(-1px); }
#galModal .fbk-btn-ui:active  { transform: scale(.96); }
#galModal .fbk-btn-ui:disabled { opacity: .38; cursor: not-allowed; transform: none; }
#galModal .fbk-close-btn {
  font-size: 20px; padding: 0 14px;
  background: rgba(200,30,30,0.25);
  border-color: rgba(255,100,100,0.3);
  flex-shrink: 0;
}
#galModal .fbk-close-btn:hover { background: rgba(200,30,30,0.55); }
#galModal .gal-icon-btn { padding: 0 12px; font-size: 18px; }

/* ── VIEWER SHELL ───────────────────────────────────────────── */
#galModal .gal-viewer-shell {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
  align-items: stretch;
  padding: 14px 14px 0;
  gap: 10px;
  overflow: hidden;
}

/* ── FOTO PRINCIPALE ────────────────────────────────────────── */
#galModal .gal-viewer-card {
  flex: 1 1 auto; min-height: 0;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.03));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: var(--gal-shadow);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  cursor: pointer;
}

/* Zone click prev/next */
#galModal .gal-click-prev,
#galModal .gal-click-next {
  position: absolute; top: 0; bottom: 0; width: 22%;
  z-index: 5; cursor: pointer;
}
#galModal .gal-click-prev { left: 0; }
#galModal .gal-click-next { right: 0; }

/* Crossfade slot foto */
#galModal .gal-photo-slot {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .45s ease;
}
#galModal .gal-photo-slot img {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.50);
  display: block;
  user-select: none; -webkit-user-drag: none;
}
#galModal .gal-slot-hidden { opacity: 0; pointer-events: none; }

/* Zoom */
#galModal .gal-photo-slot.gal-zoomed {
  overflow: auto; align-items: flex-start; justify-content: flex-start; cursor: zoom-out;
}
#galModal .gal-photo-slot.gal-zoomed img {
  max-width: none; max-height: none; cursor: zoom-out;
}

/* Frecce overlay */
#galModal .gal-arrow-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 10;
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(11,18,32,0.65); border: 1px solid rgba(255,255,255,0.18);
  color: var(--gal-text); font-size: 0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0;
  transition: opacity .2s, background .15s, transform .15s;
  user-select: none;
}
#galModal .gal-viewer-card:hover .gal-arrow-btn { opacity: 1; }
#galModal .gal-arrow-btn:hover { background: rgba(110,168,254,0.35); transform: translateY(-50%) scale(1.1); }
#galModal .gal-arrow-btn-l { left: 16px; }
#galModal .gal-arrow-btn-r { right: 16px; }
#galModal .gal-arrow-btn:disabled { opacity: 0 !important; cursor: default; }
/* Triangoli CSS dentro i pulsanti overlay */
#galModal .gal-arrow-btn-l::before {
  content: ''; display: block; width: 0; height: 0;
  border-style: solid; border-width: 8px 12px 8px 0;
  border-color: transparent #eef2ff transparent transparent;
  margin-right: 2px;
}
#galModal .gal-arrow-btn-r::after {
  content: ''; display: block; width: 0; height: 0;
  border-style: solid; border-width: 8px 0 8px 12px;
  border-color: transparent transparent transparent #eef2ff;
  margin-left: 2px;
}

/* ── THUMBNAIL STRIP ────────────────────────────────────────── */
#galModal .gal-thumb-strip {
  flex: 0 0 auto;
  height: 84px;
  display: flex; align-items: center;
  gap: 6px;
  overflow-x: auto; overflow-y: hidden;
  padding: 4px 4px 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(110,168,254,0.4) transparent;
  cursor: grab;
  user-select: none;
}
#galModal .gal-thumb-strip.gal-dragging { cursor: grabbing; }
#galModal .gal-thumb-strip::-webkit-scrollbar { height: 4px; }
#galModal .gal-thumb-strip::-webkit-scrollbar-thumb { background: rgba(110,168,254,0.4); border-radius: 2px; }

#galModal .gal-thumb {
  flex: 0 0 auto;
  width: 64px; height: 64px;
  border-radius: 8px; overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color .2s, transform .15s, opacity .2s;
  opacity: .55;
}
#galModal .gal-thumb img {
  width: 100%; height: 100%;
  object-fit: cover; display: block; pointer-events: none;
}
#galModal .gal-thumb:hover  { opacity: .85; transform: scale(1.06); }
#galModal .gal-thumb.active {
  border-color: #6ea8fe; opacity: 1;
  transform: scale(1.08);
  box-shadow: 0 0 0 3px rgba(110,168,254,0.30);
}

/* Frecce triangolo CSS (fbk-arrow è scopato a #fbkModal, ridefinisco qui) */
#galModal .fbk-arrow {
  display: inline-block; width: 0; height: 0; vertical-align: middle;
  border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}
#galModal .fbk-arrow.fbk-arrow-l {
  border-right: 7px solid #eef2ff; margin-right: 4px;
}
#galModal .fbk-arrow.fbk-arrow-r {
  border-left: 7px solid #eef2ff; margin-left: 4px;
}

/* Icona play (triangolo CSS) */
#galModal .gal-play-icon {
  display: inline-block; width: 0; height: 0; vertical-align: middle;
  border-style: solid; border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent #eef2ff;
}

/* Icona pausa (due barre verticali CSS puro) */
#galModal .gal-pause-icon {
  display: inline-flex; gap: 3px; align-items: center;
}
#galModal .gal-pause-icon::before,
#galModal .gal-pause-icon::after {
  content: ''; display: block;
  width: 3px; height: 12px;
  background: #eef2ff; border-radius: 1px;
}

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 1000px) {
  #galModal #galFsBtn { display: none; }
  #galModal .gal-toolbar { gap: 6px; }
  #galModal .fbk-viewer-topbar { gap: 8px; padding: 10px 14px; }
}
@media (max-width: 560px) {
  #galModal .fbk-viewer-topbar { flex-wrap: wrap !important; }
  #galModal .fbk-topbar-head   { flex: 1 1 100%; order: 1; }
  #galModal .gal-toolbar       { order: 2; flex: 1 1 100%; justify-content: center; flex-wrap: wrap; gap: 6px; }
  #galModal .gal-thumb-strip   { height: 64px; }
  #galModal .gal-thumb         { width: 50px; height: 50px; }
  #galModal .fbk-btn-ui        { padding: 0 10px; font-size: 13px; height: 32px; }
  #galModal .gal-viewer-shell  { padding: 6px 6px 0; }
}
