

#pdf-lightbox {
  overscroll-behavior: none;
  /* position: fixed; */
  top: 0;
  left: 0;
  width: 100%;
  /* height: 100%; */
  height: max-content;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;

  /* workaround */
  /* position: fixed !important;
  z-index: 999999; 
  padding-top: 124px;*/
}

#pdf-container {
  position: relative;
  width: 90%;
  height: 90%;
  background: #ffffff;
  border-radius: 8px;
  overflow: visible;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.pdf-btn {
  background: #043a54;
  color: white;
  border: 1px solid white;
  padding: 12px 22px;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  transition: all 0.2s;
}

.pdf-btn:hover:not(:disabled) {
  /* background: #EBCF48; */
  color: black;
}

body[data-pdf-open="true"] #contenitore > *:nth-child(n+3) {
  display: none
}

.pdf-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.no-arrows::-webkit-outer-spin-button,
.no-arrows::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.no-arrows[type='number'] {
  -moz-appearance: textfield;
  appearance: textfield;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}


input.no-arrows::-webkit-inner-spin-button,
input.no-arrows::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
  border: none;
}

input.no-arrows {
  -moz-appearance: textfield;
  appearance: textfield;
}

body[data-pdf-open="true"] {
  scroll-behavior: auto !important;
}

#pdf-lightbox {
    display: none;
    /* position: fixed; */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,18,40,0.8);
    z-index: 3;
    cursor: pointer;
}

#pdf-container {
    width: 100%;
    height: 100%;
    position: relative;
    cursor: default;
    background: #ffffff;
}

#pdf-pages {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    background: #ffffff;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.pdf-page-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    background: #ffffff;
}

.pdf-page-wrapper:last-child {
    border-bottom: none;
}

.pdf-page-wrapper canvas {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100vw;
}

.page-loading {
    border: 1px solid #043a54;
    background: rgba(4,58,84,0.02);
    position: relative;
}

.page-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #043a54, transparent);
    animation: pageLoadingBar 2s ease-in-out infinite;
}

#pdf-pages::-webkit-scrollbar {
    width: 8px;
}

#pdf-pages::-webkit-scrollbar-track {
    background: #f8f9fa;
}

#pdf-pages::-webkit-scrollbar-thumb {
    background: #043a54;
    border-radius: 4px;
}

#pdf-pages::-webkit-scrollbar-thumb:hover {
    background: #001228;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pageLoadingBar {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@media (max-width: 768px) {
    #pdf-pages::-webkit-scrollbar {
        width: 4px;
    }
    
    .pdf-page-wrapper canvas {
        max-width: 98vw;
    }
    
    #pdf-controls {
        padding: 8px 16px !important;
        gap: 10px !important;
        font-size: 12px !important;
    }
    
    .pdf-btn {
        padding: 12px 22px !important;
        font-size: 12px !important;
        min-width: 32px !important;
    }
    
    #page-input {
        width: 40px !important;
        padding: 3px 6px !important;
        font-size: 11px !important;
    }
    
    #close-btn, #download-btn {
        padding: 12px 22px !important;
        font-size: 11px !important;
    }
    
    #bottom-loading {
        bottom: 10px !important;
        right: 10px !important;
        max-width: 200px !important;
        font-size: 11px !important;
        padding: 8px 15px !important;
    }
}

@media (max-width: 480px) {
    .pdf-page-wrapper {
        padding: 10px 0;
    }
    
    #pdf-controls {
        gap: 8px !important;
        padding: 6px 12px !important;
        left: 10px !important;
        right: 10px !important;
        transform: none !important;
        max-width: none !important;
        flex-wrap: wrap;
    }
    
    #pdf-controls > div {
        order: 1;
    }
    
    #download-btn {
        order: 2;
        margin-left: 0 !important;
    }
    
    #close-btn {
        order: 3;
    }
}

/* Hide all placeholder divs */
div[id^="placeholder-"] {
    display: none !important;
}

/* Show only the first one using adjacent sibling combinator */
div[id^="placeholder-"]:not(div[id^="placeholder-"] ~ div[id^="placeholder-"]) {
    display: flex !important;
}