@media (max-width: 991.98px){
  .mod-pdfmodal__modal .modal-dialog.modal-fullscreen-lg-down{
    height: 100dvh;
    margin: 0;
  }

  .mod-pdfmodal__modal .modal-dialog.modal-fullscreen-lg-down .modal-content{
    height: 100dvh;
  }
}

/* Tablet grandi (es. iPad Pro in landscape): fullscreen su dispositivi touch (inclusi casi in cui pointer non è coarse) */
@media (hover: none) and (max-width: 1399.98px){
  .mod-pdfmodal__modal .modal-dialog{
    max-width: 100vw;
    width: 100vw;
    height: 100dvh;
    margin: 0;
  }

  .mod-pdfmodal__modal .modal-content{
    height: 100dvh;
    border-radius: 0;
  }
}

.mod-pdfmodal__content{
  overflow: hidden;
}

.mod-pdfmodal__content .modal-body{
  min-height: 0;
}

.mod-pdfmodal__layout{
  display:grid;
  grid-template-columns: 280px 1fr;
  min-height: 70vh;
  height: 70vh;
}

@media (max-width: 991.98px){
  .mod-pdfmodal__layout{
    grid-template-columns: 1fr;
    grid-template-rows: 180px 1fr;
    height: 100%;
    min-height: 0;
  }
}

@media (max-width: 576px){
  .mod-pdfmodal__layout{
    grid-template-rows: 140px 1fr;
  }
}

.mod-pdfmodal__layout.is-list-collapsed{
  grid-template-rows: 0 1fr;
}

.mod-pdfmodal__layout.is-list-collapsed .mod-pdfmodal__list{
  display:none;
}

.mod-pdfmodal__list{
  border-right: 1px solid rgba(0,0,0,.08);
  overflow:auto;
  padding: 10px;
  background:#fff;
}

@media (max-width: 991.98px){
  .mod-pdfmodal__list{
    border-right: 0;
    border-bottom: 1px solid rgba(0,0,0,.08);
  }
}

.mod-pdfmodal__list-items{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.mod-pdfmodal__item{
  width:100%;
  text-align:left;
  padding:10px 12px;
  border-radius:10px;
  border: 1px solid rgba(0,0,0,.12);
  background:#fff;
  cursor:pointer;
  font-size:.95rem;
}

.mod-pdfmodal__item:hover{
  background: rgba(0,0,0,.03);
}

.mod-pdfmodal__item.active{
  border-color: #0d6efd;
  box-shadow: 0 0 0 3px rgba(13,110,253,.15);
}

.mod-pdfmodal__viewer{
  display:flex;
  flex-direction:column;
  min-width:0;
  background:#f7f7f7;
}

.mod-pdfmodal__toolbar{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  padding:10px;
  border-bottom: 1px solid rgba(0,0,0,.08);
  background:#fff;
}

.mod-pdfmodal__frame{
  flex:1;
  min-height:0;
  position: relative;
}

.mod-pdfmodal__frame iframe{
  width:100%;
  height:100%;
  border:0;
  display:block;
  background:#fff;
}

/* Fallback smartphone (no PDF inline affidabile in iframe) */
.mod-pdfmodal__mobilefallback{
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #fff;
  text-align: center;
}

.mod-pdfmodal__mobilefallback-inner{
  max-width: 520px;
}

.mod-pdfmodal__mobilefilename{
  font-weight: 600;
  margin-bottom: 12px;
  word-break: break-word;
}

.mod-pdfmodal__frame.is-mobile-fallback iframe{
  display: none;
}

.mod-pdfmodal__frame.is-mobile-fallback .mod-pdfmodal__mobilefallback{
  display: flex;
}


.mod-pdfmodal__logo{display:block; max-height:64px;}

/* Ensure the modal/backdrop are above ANY fixed UI (floating buttons, widgets, etc.) */
.mod-pdfmodal__modal{ z-index: 2147483647 !important; }
body.mod-pdfmodal--open .modal-backdrop{ z-index: 2147483646 !important; }

@media (max-width: 575.98px){
  /* Phone UI: keep only Elenco + Scarica (Apri in nuova scheda hidden by Bootstrap classes too) */
  .mod-pdfmodal__toolbar [data-pdfmodal-open]{ display: none; }
  .mod-pdfmodal__toolbar{ flex-wrap: nowrap; justify-content: space-between; }
  .mod-pdfmodal__toolbar .btn{ flex: 1 1 0; min-width: 0; white-space: nowrap; }
}
