/* PDF Viewer Styles */
.pdfjs-viewer-wrapper {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    margin: 20px 0;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.pdf-title {
    background: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.pdf-title h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
}

.pdfjs-viewer-container {
    display: flex;
    flex-direction: column;
}

/* Toolbar */
.pdf-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap;
    gap: 10px;
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

a.pdf-btn.pdf-download {
    color: #fff;
}

.pdf-btn {
    background: #000;
    color: white;
    border: none;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    transition: background 0.2s;
}

.pdf-btn:hover {
    background: #000;
}

/* .pdf-download {
    background: #28a745;
}

.pdf-download:hover {
    background: #218838;
} */

.page-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-input {
    width: 40px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
    text-align: center;
    height: 30px;
}

.zoom-level {
    min-width: 50px;
    text-align: center;
    font-weight: bold;
}

/* Canvas Container */
.pdf-canvas-container {
    position: relative;
    min-height: 400px;
    background: #f9f9f9;
    /* display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px; */
    display: block;

    /* keeps spacing */
}


.pdf-loading {
    position: absolute;
    color: #666;
    font-size: 16px;
}

/* Thumbnails */
.pdf-thumbnails {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    overflow-x: auto;
}

.thumbnails-container {
    display: flex;
    gap: 10px;
    padding-bottom: 5px;
}

.thumbnail-wrapper {
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 4px;
    transition: border-color 0.2s;
}

.thumbnail-wrapper:hover {
    border-color: #000;
}

.thumbnail-wrapper.active {
    border-color: #000;
    background: #e8f0fe;
}

.thumbnail {
    display: block;
    max-height: 100px;
    border-radius: 2px;
}

/* Responsive */
@media (max-width: 768px) {
    .pdf-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .toolbar-left,
    .toolbar-center,
    .toolbar-right {
        justify-content: center;
        flex-wrap: wrap;
    }

    .pdf-canvas-container {
        min-height: 300px;
    }
}

/* Fullscreen mode */
:fullscreen .pdfjs-viewer-wrapper {
    width: 100vw;
    height: 100vh;
    margin: 0;
    border-radius: 0;
    border: none;
}

:fullscreen .pdf-canvas-container {
    min-height: calc(100vh - 120px);
}


/* new css for handtool */
.pdfjs-viewer-wrapper {
    width: 100%;
    margin: 0 auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background: #f5f5f5;
}

.pdf-title {
    background: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
}

.pdf-title h3 {
    margin: 0;
    color: #333;
    font-size: 1.2em;
}

.pdfjs-viewer-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Toolbar Styles */
.pdf-toolbar {
    background: #2c3e50;
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    border-bottom: 1px solid #1a252f;
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 5px 0;
}



.page-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-input {
    width: 50px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
    text-align: center;
}

.zoom-level {
    min-width: 50px;
    text-align: center;
    font-weight: bold;
}

/* Main Canvas Container with Scroll and Hand Tool */
.pdf-canvas-container {
    position: relative;
    overflow: auto;
    background: #525659;
    flex-grow: 1;
    min-height: 400px;
    cursor: grab;
}

.pdf-canvas-container.grabbing {
    cursor: grabbing;
}

.pdf-canvas-container.hand-tool {
    cursor: grab;
}

.pdf-canvas-container.hand-tool.grabbing {
    cursor: grabbing;
}

.pdf-canvas-container:not(.hand-tool) {
    cursor: default;
}

.pdf-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 18px;
}

.pdf-canvas {
    display: block;
    margin: 0px auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);


    max-width: none;
    height: auto;
}


/* Footer with Thumbnails */
.pdf-footer {
    background: #f8f9fa;
    border-top: 1px solid #ddd;
    padding: 10px;
}

.thumbnails-container {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px;
}

.thumbnail-wrapper {
    flex: 0 0 auto;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 3px;
    transition: border-color 0.3s;
}

.thumbnail-wrapper:hover {
    border-color: #3498db;
}

.thumbnail-wrapper.active {
    border-color: #e74c3c;
}

.thumbnail {
    display: block;
    width: 80px;
    height: auto;
    border-radius: 2px;
}

/* Tool Controls */
.tool-controls {
    display: flex;
    gap: 5px;
    margin-left: 10px;
}

.tool-btn {
    background: #7f8c8d;
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.3s;
}

.tool-btn:hover {
    background: #95a5a6;
}

.tool-btn.active {
    background: #000;
}

/* Enable pinch zoom ONLY on touch devices */
@media (pointer: coarse) {
    .pdf-canvas-container {
        touch-action: none;
    }
}

/* Mobile-only toolbar layout */
@media (max-width: 768px) {

    .toolbar-center,
    .toolbar-right {
        display: none;
    }
}