/* CONSERVA IL CONTENITORE PRINCIPALE ISOLATO */
#volantini-app {
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #fff;
}

/* VISTA GALLERIA */
#volantini-app .gallery-view {
  margin-top:1.5rem !important;
  max-width: 1200px;
  margin: 0 auto;
}

#volantini-app .grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

#volantini-app .card {
  background-color: #f5f5f5;
  border-radius: 0px;
  overflow: hidden;
  cursor: pointer;
  /* border: 1px solid #2b2b36; */
  border: 1px solid rgba(0, 0, 0, 0.175);
  transition: transform 0.2s;
}


#volantini-app .card h4 {
 color:#292929;
}

#volantini-app .card:hover {
  transform: translateY(-4px);
  border-color: var(--dmsc-primary-color);
}

#volantini-app .card-thumb {
  height: 280px;
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

#volantini-app .card-thumb canvas {
  max-width: 100%;
  max-height: 100%;
}

#volantini-app .card-info {
  padding: 12px;
  text-align: center;
}
/* FINE VISTA GALLERIA*/ 

/* VISTA VISUALIZZATORE */
#volantini-app .viewer-view {
  display: none;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background-color: #121216;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 99999; /* Copre lo schermo quando si apre senza rompere il sito sotto */
}

/* TOOLBAR SUPERIORE */
#volantini-app .toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background-color: #2b2b36;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
  z-index: 100;
  flex-shrink: 0;
}

#volantini-app .toolbar button {
  background-color: #3f3f50;
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

#volantini-app .toolbar button.btn-back {
  background-color: #4f46e5;
}

#volantini-app .page-info {
  font-size: 0.9rem;
  color: #d1d5db;
}

/* CONTENITORE PRINCIPALE CON SCROLL BIDIREZIONALE CORRETTO */
#volantini-app .viewer-container {
  flex: 1;
  width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  touch-action: auto;
  padding: 20px;
  background-color: #121216;
  display: flex;
  align-items: flex-start; /* FONDAMENTALE: permette di raggiungere il bordo superiore durante lo zoom */
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}

/* STRISCIA ORIZZONTALE DELLE PAGINE */
#volantini-app #pdf-pages-wrapper {
  display: flex;
  flex-direction: row;
  align-items: flex-start; /* FONDAMENTALE: previene il taglio della parte superiore */
  gap: 20px;
  margin: auto 0; /* Mantiene la centratura verticale quando la pagina NON è zoomata */
}

/* CONTENITORE SINGOLA PAGINA */
#volantini-app .pdf-page-container {
  flex-shrink: 0;
  scroll-snap-align: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  overflow: hidden;
  background-color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

#volantini-app .pdf-page-container canvas {
  display: block;
  /* Rimuoviamo max-height/max-width forzati per permettere allo zoom di espandere liberamente il canvas */
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* ADATTAMENTO MOBILE STRETTO */
@media (max-width: 600px) {
  #volantini-app .toolbar {
    padding: 8px 10px;
  }

  #volantini-app .toolbar .btn-back span {
    display: none;
  }

  #volantini-app #pdf-pages-wrapper {
    gap: 10px;
  }
}