/* PDF Viewer Modal Styles */
#pdf-viewer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: none;
    justify-content: center;
    align-items: center;
}

#pdf-viewer-modal .modal-content {
    background: #fff;
    width: 90%;
    height: 90%;
    display: flex;
    flex-direction: column;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
}

#pdf-viewer-modal .modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f8f8;
}

#pdf-viewer-modal .modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #333;
}

#pdf-viewer-modal .close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

/* Help callout + zoom control */
#pdf-viewer-modal .pdf-viewer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 10px 20px;
    border-bottom: 1px solid #ddd;
    background: #fff;
    flex-wrap: wrap;
}

#pdf-viewer-modal .pdf-viewer-help {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1 1 380px;
    background: rgb(0 0 0 / 5%);
    border-left: 4px solid #ed1c24;
    border-radius: 0;
    padding: 10px 14px;
}

#pdf-viewer-modal .pdf-viewer-help-icon {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ed1c24;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    margin-top: 1px;
}

#pdf-viewer-modal .pdf-viewer-help p {
    margin: 0;
    font-size: 16px;
    line-height: 1.45;
    color: #333;
    font-family: proxima-nova, sans-serif;
}

#pdf-viewer-modal .pdf-zoom-control {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

#pdf-viewer-modal .pdf-zoom-label {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    color: #333;
    margin: 0;
}

#pdf-viewer-modal .pdf-zoom-in,
#pdf-viewer-modal .pdf-zoom-out {
    width: 30px;
    height: 30px;
    border: 1px solid #ccc;
    border-radius: 50%;
    background: #f1f1f1;
    color: #333;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

#pdf-viewer-modal .pdf-zoom-in:hover,
#pdf-viewer-modal .pdf-zoom-out:hover {
    background: #ed1c24;
    border-color: #ed1c24;
    color: #fff;
}

#pdf-viewer-modal .pdf-zoom-slider {
    width: 170px;
    max-width: 40vw;
    accent-color: #ed1c24;
    cursor: pointer;
}

#pdf-viewer-modal .pdf-zoom-value {
    min-width: 48px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-align: right;
}

#pdf-viewer-modal .modal-body {
    flex: 1;
    overflow: auto;
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    /* "safe" keeps a magnified page reachable: with plain centring, a page
       wider than the body overflows off the left edge and cannot be scrolled
       to. Browsers without safe-alignment support fall back to center. */
    justify-content: center;
    justify-content: safe center;
    align-items: flex-start;
    align-content: flex-start;
}

#pdf-viewer-modal .modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    background: #f8f8f8;
}

/* Page Wrapper and Canvas */
.pdf-page-wrapper {
    position: relative;
    border: 1px solid #ddd;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    background: #fff;
    /* Width is set inline from the zoom level - never scale the canvas with
       transforms, it softens the rendered text. */
    flex: 0 0 auto;
    cursor: pointer;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.pdf-page-wrapper:hover {
    border-color: #ed1c24;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.pdf-page-wrapper.selected {
    border-color: #ed1c24;
    box-shadow: 0 0 0 3px rgba(237, 28, 36, 0.35);
}

.pdf-page-wrapper canvas {
    display: block;
    width: 100%;
    height: auto;
}

/* Page Selection Overlay */
.page-selection-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
}

.page-select-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 4px 8px 4px 5px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    font-size: 13px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    line-height: 1;
}

.pdf-page-wrapper.selected .page-select-label {
    background: #ed1c24;
    border-color: #ed1c24;
    color: #fff;
}

.pdf-page-checkbox {
    width: 22px;
    height: 22px;
    margin: 0;
    cursor: pointer;
    accent-color: #ed1c24;
    background: #fff;
    border-radius: 4px;
    appearance: auto;
    -webkit-appearance: checkbox;
    flex: 0 0 22px;
}

.page-number-badge {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

/* Comparison View - page width comes from the zoom slider (set inline by JS),
   so the pages stay readable and the body scrolls when magnified. */
/* Comparison is a fixed grid - three cards per row, one on mobile; the count
   comes from JS via --compare-cols. Zooming widens the cards instead of
   reflowing the grid, so the whole grid scrolls sideways and stays 3-up. */
#pdf-viewer-modal.compare-mode .modal-body {
    display: grid;
    grid-auto-flow: row;
    grid-template-columns: repeat(var(--compare-cols, 3), max-content);
    align-content: flex-start;
}

#pdf-viewer-modal.compare-mode .pdf-page-wrapper {
    flex: 0 0 auto;
    max-width: none;
}

#pdf-viewer-modal.compare-mode .pdf-page-wrapper:not(.selected-for-compare) {
    display: none;
}

#pdf-viewer-modal .modal-footer .site-btn {
    color: #000;
    font-size: 16px;
    background-color: #DEDEDE;
    padding: 8px 15px;
    border-radius: 25px;
}

#pdf-viewer-modal .modal-footer .site-btn:hover {
    color: #ffffff;
    --tw-text-opacity: 1;
    background-color: rgba(255, 40, 49, var(--tw-text-opacity));
}

/* Action Buttons */
.viewer-action-btn {
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.viewer-action-btn.red-btn {
    background: #ed1c24;
    color: #fff;
}

.viewer-action-btn.red-btn:hover {
    background: #c7181e;
}

.viewer-action-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.catalogbuttons a {
    margin: 15px 0;
}
/* Desktop (Default) */
.options-menu{
    display:flex;
    gap:10px;
}

.more-btn{
    display:none;
}
.modal-footer .responsive-pdfModalfooter {
    display: none !important;
}

.modal-footer .responsive-pdfModalfooter {
    display: none !important;
}

.modal-footer .desktop-pdfModalfooter {
    justify-content: space-between !important;
    display: flex;
    width: 100%;
}

.modal-footer .desktop-pdfModalfooter >.buttongroupModal {
    display: flex;
    gap: 15px;
}
/* Tablet & Mobile */
@media (max-width:991px){
    .modal-footer .desktop-pdfModalfooter {
        display: none !important;
    }
    .modal-footer .responsive-pdfModalfooter {
        display: flex !important;
        gap: 15px;
    }
    
.modal-footer{
    display:flex;
    align-items:center;
    gap:10px;
}

/* show dropdown button */
.more-btn{
    display:inline-block;
    padding:12px 10px;
    background:#eee;
    border-radius:6px;
    cursor:pointer;
    font-size: 16px !important;

}

/* hide buttons initially */
.options-menu{
    position:absolute;
    bottom:50px;
    right:0;
    background:#fff;
    border:1px solid #ddd;
    box-shadow:0 5px 15px rgba(0,0,0,0.15);
    border-radius:6px;
    padding:8px;
    display:none;
    flex-direction:column;
    min-width:275px;
    z-index: 99;
}

/* open dropdown */
.more-options.active .options-menu{
    display:flex;
}

.options-menu button{
    width:100%;
    text-align:left;
    font-size: 16px !important;
    padding: 12px 10px;
}

.more-options{
    position:relative;
}


/* Bitmap is oversampled; this is what downscales it cleanly. */
#pdf-viewer-modal .pdf-page-wrapper canvas {
    display: block;
    width: 100%;
    height: auto;
    background: #fff;
}

/* Do NOT set image-rendering: pixelated / -webkit-optimize-contrast here —
   it defeats the downscale filter and is a common source of "crunchy" text. */

/* Optional: makes an in-progress page read as loading, not broken. */
#pdf-viewer-modal .pdf-page-wrapper.is-rendering {
    position: relative;
}

#pdf-viewer-modal .pdf-page-wrapper.is-rendering::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
    background-size: 200% 100%;
    animation: pdf-shimmer 1.1s linear infinite;
    pointer-events: none;
}

@keyframes pdf-shimmer {
    from {
        background-position: 200% 0;
    }

    to {
        background-position: -200% 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    #pdf-viewer-modal .pdf-page-wrapper.is-rendering::after {
        animation: none;
    }
}

/* Pan cursors */
#pdf-viewer-modal .modal-body.can-pan {
    cursor: grab !important;
}

#pdf-viewer-modal .modal-body.panning {
    cursor: grabbing !important;
    user-select: none;
}

#pdf-viewer-modal .modal-body.panning * {
    pointer-events: none;
}

#pdf-viewer-modal .page-selection-overlay {
    pointer-events: auto;
    cursor: pointer;
}

#pdf-viewer-modal .page-select-label {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    height: 100%;
    padding: 6px 10px;
    cursor: pointer;
}

}
/* Mobile Responsiveness */
@media (max-width: 768px) {
    #pdf-viewer-modal .modal-content {
    width: 95vw;
        height: 95vh;
        border-radius: 8px;
    }
        #pdf-viewer-modal.compare-mode .modal-body {
            display: grid;
            grid-template-columns: repeat(var(--compare-cols, 1), max-content);
            gap: 20px;
            justify-content: start;
            /* not center — centering fights sideways scroll */
            align-content: start;
            overflow: auto;
        }

    #pdf-viewer-modal.compare-mode .modal-body {
        flex-direction: column;
        align-items: center;
        align-items: safe center;
		justify-content: flex-start;
    }

    #pdf-viewer-modal .pdf-viewer-toolbar {
        gap: 10px;
        padding: 10px 15px;
    }

    #pdf-viewer-modal .pdf-viewer-help {
        flex: 1 1 100%;
    }

    #pdf-viewer-modal .pdf-viewer-help p {
        font-size: 13px;
    }

    #pdf-viewer-modal .pdf-zoom-control {
        width: 100%;
        justify-content: space-between;
    }

    #pdf-viewer-modal .pdf-zoom-slider {
        flex: 1 1 auto;
        max-width: none;
    }
}
/* Mobile Responsiveness */
@media (max-width: 575.98px) {
    #pdf-viewer-modal .modal-footer .site-btn {
        font-size: 13px !important;
    }
}