/* PDF Viewer Component Styles */

/* Viewer layout */
#viewerWrapper {
    min-height: 60vh;
    /* Minimum height for the wrapper */
    overflow-x: auto;
    /* Allow horizontal scrolling for zoomed content */
}

#scrollRegion {
    overflow-x: auto;
    /* Enable horizontal scrolling when content is wider than container */
    min-height: 60vh;
    /* Minimum height for viewer */
    max-height: none;
    /* Allow natural height expansion */
}

#scrollRegion.allow-x {
    overflow-x: auto;
}

#pdfPages {
    min-height: 400px;
    /* Ensure some minimum space for PDF content */
    position: relative;
    /* Required for absolute positioning of error messages */
}

/* Page styling */
.pdf-page-wrapper {
    position: relative;
}

.pdf-page-wrapper canvas {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    /* Enhanced canvas rendering quality */
    image-rendering: high-quality;
    /* Modern browsers */
    image-rendering: -webkit-optimize-contrast;
    /* Safari */
    transform: translateZ(0);
    /* Force GPU acceleration */
    backface-visibility: hidden;
    /* Prevent blurring during animations */
}

/* Scrollbar styles */
.scrollbar-thin::-webkit-scrollbar {
    width: 8px;
}

.scrollbar-thin::-webkit-scrollbar-track {
    background: transparent;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.scrollbar-thin::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Dock wrapper positioning - fixed over viewer, shown on hover */
#dockWrapper {
    position: fixed;
    bottom: 20px;
    z-index: 9999;
    /* Make sure it's above everything */
    pointer-events: none;
    /* Pass clicks through wrapper */
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    max-width: 90%;
    display: flex;
    justify-content: center;
    opacity: 0;
    /* Start hidden */
    transition: transform 0.3s ease-out, opacity 0.3s ease-out,
        bottom 0.5s ease-out;
}

/* Dock position adjustments for mobile nav visibility */
#dockWrapper.above-mobile-nav {
    bottom: 80px; /* Above the mobile nav (64px nav height + 16px gap) */
}

#dockWrapper.mobile-nav-hidden {
    bottom: 20px; /* At the bottom when nav is hidden */
}

/* Show dock when viewer is hovered */
#viewerWrapper:hover ~ #dockWrapper,
#dockWrapper:hover {
    opacity: 1;
}

#dockContainer {
    pointer-events: auto;
    /* Capture clicks on the dock itself */
    background: #1e3a8a;
    /* Dark blue background */
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(30, 58, 138, 0.3), 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 8px;
}

/* Dock buttons */
.dock-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0;
    border: none;
    /* Remove borders */
    background: transparent;
    /* Transparent background */
    border-radius: 8px;
    line-height: 1;
    transition: 0.15s;
    color: #ffffff;
    /* White icons */
}

.dock-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.8;
    stroke: #ffffff;
    /* White stroke for icons */
    fill: none;
}

.dock-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    /* Light white overlay on hover */
    border: none;
}

.dock-btn:active {
    background: rgba(255, 255, 255, 0.25);
    /* Slightly more opaque on active */
}

.dock-btn:focus-visible {
    outline: 2px solid #60a5fa;
    /* Light blue outline for focus */
    outline-offset: 2px;
}

.dock-sep {
    width: 1px;
    height: 26px;
    background: rgba(255, 255, 255, 0.3);
    /* White separator with opacity */
    margin: 0 4px;
    border-radius: 1px;
}
#moreMenu {
    min-width: 120px;
}
#moreMenu .dock-btn {
    width: 100%;
    height: auto;
    justify-content: flex-start;
    padding: 6px 8px;
    margin: 0;
    font-size: 11px;
    color: #ffffff;
    /* White text for menu items */
}

#moreMenu .dock-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

/* Mobile styles */
@media (max-width: 640px) {
    #dockWrapper {
        bottom: 15px;
        max-width: 95%;
        /* Wider on mobile to ensure better use of space */
    }

    /* Adjust for mobile nav on mobile/tablet devices */
    #dockWrapper.above-mobile-nav {
        bottom: 80px; /* Above the mobile nav */
    }

    #dockWrapper.mobile-nav-hidden {
        bottom: 15px; /* At the bottom when nav is hidden */
    }

    #dockContainer {
        gap: 1px;
        /* Tighter spacing between items */
    }

    body {
        font-size: 14px;
    }

    .no-scrollbar::-webkit-scrollbar {
        display: none;
    }

    .no-scrollbar {
        scrollbar-width: none;
    }

    #scrollRegion {
        overscroll-behavior-y: contain;
    }

    .mobile-hidden {
        display: none !important;
    }

    .mobile-only {
        display: block !important;
    }

    .mobile-only.flex {
        display: flex !important;
    }

    .mobile-only.inline-flex {
        display: inline-flex !important;
    }
}

/* Page number input styling */
#pageNumInput {
    max-width: 3ch;
    text-align: center;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    color: white !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Hide number input arrows */
#pageNumInput::-webkit-outer-spin-button,
#pageNumInput::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#pageNumInput[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

#pageNumInput:focus {
    background: rgba(255, 255, 255, 0.15) !important;
    border-radius: 3px;
}

/* Page info container styling */
.page-info-container {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 4px !important;
    transition: all 0.2s ease !important;
}

.page-info-container:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
}

.page-info-container:focus-within {
    background: rgba(255, 255, 255, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.6) !important;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1) !important;
}

/* Error message styling - center vertically and horizontally */
/* Higher specificity to override base error styles */
#pdfPages .error,
#viewerContainer .error,
.error {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 200px !important;
    padding: 2rem !important;
    text-align: center !important;
    color: #dc2626 !important;
    background-color: #fef2f2 !important;
    border: 1px solid #fecaca !important;
    border-radius: 8px !important;
    margin: 2rem auto !important;
    max-width: 500px !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    box-shadow: 0 4px 6px rgba(220, 38, 38, 0.1) !important;
}

/* Center error in the full viewport if it's the only content */
#pdfPages:has(.error:only-child) {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 60vh !important;
}

/* Alternative centering for browsers that don't support :has() */
#pdfPages .error:first-child:last-child {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
    min-height: auto !important;
}
