/**
 * JetPDF Viewer Styles - Refactored for v2.1
 *
 * - Flexbox layout for controls positioning.
 * - Virtualized page stage.
 */

/* --- Main Container --- */
.jetpdf-flipbook-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background-color: #f1f1f1;
    overflow: hidden;
}

/* --- Controls Positioning --- */
.jetpdf-flipbook-container.controls-bottom {
    flex-direction: column;
}

.jetpdf-flipbook-container.controls-top {
    flex-direction: column-reverse;
}

/* --- PDF Stage --- */
.jetpdf-stage {
    flex-grow: 1;
    width: 100%;
    overflow: hidden;
    position: relative;
}

.jetpdf-page-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s ease-in-out;
}

.jetpdf-page-wrapper.is-zoomed {
    cursor: grab;
}

.jetpdf-page-wrapper.is-zoomed.is-panning {
    cursor: grabbing;
}

.jetpdf-page-wrapper canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* --- Navegação Desktop (Hover) --- */
.jetpdf-nav-region {
    position: absolute;
    top: 0;
    height: 100%;
    width: 20%; /* Ocupa 20% da lateral */
    z-index: 5;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: rgba(0,0,0,0.3);
}

.jetpdf-stage:hover .jetpdf-nav-region {
    opacity: 1;
}

.jetpdf-nav-region:before {
    content: '';
}

.jetpdf-nav-region:hover:before {
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
}

.jetpdf-nav-left {
    left: 0;
}
.jetpdf-nav-left:before {
    content: '‹';
}

.jetpdf-nav-right {
    right: 0;
}
.jetpdf-nav-right:before {
    content: '›';
}

/* --- Controles --- */
.jetpdf-controls {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    background: rgba(17, 17, 17, 0.8);
    padding: 8px 12px;
    color: white;
    user-select: none;
    z-index: 10;
    flex-wrap: wrap;
}

.jetpdf-controls button {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 6px 12px;
    font-size: 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.jetpdf-controls button:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

.jetpdf-controls .page-info {
    font-size: 0.9rem;
    white-space: nowrap;
}


/* --- LOADER --- */
.jetpdf-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    z-index: 100;
}

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

/* --- THUMBNAILS --- */
.jetpdf-thumbnails-container {
    flex-shrink: 0;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 9;
    padding: 15px 0;
    box-sizing: border-box;
    transition: max-height 0.3s ease-in-out, visibility 0.3s ease-in-out;
    max-height: 0;
    visibility: hidden;
    overflow: hidden;
}

.jetpdf-thumbnails-container.visible {
    max-height: 200px; /* Adjust as needed */
    visibility: visible;
}

.jetpdf-thumbnails-grid {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    gap: 15px;
    padding: 0 20px;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: #555 #333;
    cursor: grab;
    user-select: none;
}

.jetpdf-thumbnails-grid.is-dragging-thumbs {
    cursor: grabbing;
    scroll-behavior: auto;
}

.jetpdf-thumbnail-item {
    flex-shrink: 0;
    background: white;
    padding: 5px;
    border-radius: 4px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
    height: 150px;
}

.jetpdf-thumbnail-item:hover {
    transform: scale(1.05);
}

.jetpdf-thumbnail-item.current-thumb {
    border-color: #3498db;
    box-shadow: 0 0 10px #3498db;
}

.jetpdf-thumbnail-item canvas {
    height: 100%;
    width: auto;
}
