.pdfrack-viewer-container {
    background: #fff;
    border: 1px solid #fff;
    border-radius: 0px;
    overflow: hidden;
    margin: 1em 0;
    position: relative;
    /* font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; */
}

/* Media Library Preview specific adjustments */
.attachment-media-view .pdfrack-viewer-container {
    margin: 0;
    width: 100%;
    height: 100%;
    min-height: 500px;
}

.pdfrack-viewer-container:fullscreen {
    width: 100vw;
    height: 100vh;
    border: none;
    border-radius: 0;
    margin: 0;
}

.pdfrack-content {
    /* Custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.5) transparent;
    cursor: grab;
    user-select: none;
    /* Prevent text selection while dragging */
}

.pdfrack-content.pdfrack-grabbing {
    cursor: grabbing;
    scroll-behavior: auto !important;
    /* Disable smooth scroll during drag */
}

.pdfrack-content::-webkit-scrollbar {
    width: 8px;
}

.pdfrack-content::-webkit-scrollbar-track {
    background: transparent;
}

.pdfrack-content::-webkit-scrollbar-thumb {
    background-color: rgba(148, 163, 184, 0.5);
    border-radius: 4px;
}

.pdfrack-content::-webkit-scrollbar-thumb:hover {
    background-color: rgba(148, 163, 184, 0.8);
}

.pdfrack-page {
    position: relative;
    background: white;
    flex-shrink: 0;
    min-height: 0;
    box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 6px -1px, rgba(0, 0, 0, 0.06) 0px 2px 4px -1px;
    background-color: #fff;
    margin-bottom: 20px;
    transition: transform 0.2s ease;
    overflow: hidden;
    /* Prevent canvas overflow during zoom transitions */
}

.pdfrack-page canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Icons */
.pdfrack-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pdfrack-icon svg {
    width: 20px;
    height: 20px;
}

/* Responsive & Toolbar Optimization */
@media (max-width: 768px) {
    .pdfrack-toolbar {
        bottom: 16px !important;
        max-width: 420px;
        justify-content: space-between;
    }

    .pdfrack-content {
        padding: 12px !important;
        align-items: flex-start !important;
    }

    .pdfrack-page-info {
        font-size: 13px !important;
    }

    /* Hide secondary items on mobile */
    .pdfrack-toolbar .pdfrack-secondary {
        display: none !important;
    }

    /* More Menu Style */
    .pdfrack-more-menu {
        position: absolute;
        bottom: 100%;
        right: 0;
        margin-bottom: 8px;
        background: rgba(30, 41, 59, 0.95);
        backdrop-filter: blur(12px);
        border-radius: 8px;
        padding: 8px;
        display: flex;
        flex-direction: column;
        gap: 4px;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
        z-index: 60;
        min-width: 160px;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .pdfrack-more-menu .pdfrack-btn {
        background: transparent;
        display: flex;
        align-items: center;
        justify-content: flex-start !important;
        width: 100%;
        padding: 4px 8px !important;
        font-size: 14px;
        gap: 16px;
        color: white;
        text-align: left;
        touch-action: manipulation;
    }

    .pdfrack-more-menu .pdfrack-btn:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    .pdfrack-more-menu .pdfrack-menu-label {
        flex: 1;
    }
}

/* Tablet and up: show all secondary items */
@media (min-width: 769px) {
    .pdfrack-more-toggle {
        display: none !important;
    }
}

/* Loading Screen (iOS Style) */
.pdfrack-loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s ease-in-out;
}

.pdfrack-loader-percentage {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.pdfrack-loader-status {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
    font-size: 10px;
    font-weight: 400;
    color: #666;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.pdfrack-progress-container {
    width: 40%;
    max-width: 300px;
    height: 4px;
    background: #222;
    border-radius: 10px;
    overflow: hidden;
}

.pdfrack-progress-bar {
    width: 0%;
    height: 100%;
    background: #fff;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

@keyframes pulse {
    0% {
        opacity: 0.6;
        transform: scale(0.98);
    }

    50% {
        opacity: 1;
        transform: scale(1);
    }

    100% {
        opacity: 0.6;
        transform: scale(0.98);
    }
}

/* Sidebar Customization */
.pdfrack-sidebar-content {
    /* Custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.5) transparent;
}

.pdfrack-sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.pdfrack-sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.pdfrack-sidebar-content::-webkit-scrollbar-thumb {
    background-color: rgba(148, 163, 184, 0.5);
    border-radius: 3px;
}

.pdfrack-sidebar-content::-webkit-scrollbar-thumb:hover {
    background-color: rgba(148, 163, 184, 0.8);
}

.pdfrack-thumbnail-item {
    background-color: transparent;
    border-radius: 2px;
    border: 1px solid transparent;
    cursor: pointer;
    width: 60px;
    height: 74px;
    margin: 0 auto;
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
}

.pdfrack-thumbnail-item:hover {
    border-color: #3b82f6;
}

.pdfrack-active {
    border-color: #3b82f6;
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/**
 * Annotation Layer Styles
 * Standard PDF.js annotation styles adapted for PDF Rack
 */
.annotationLayer {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    transform-origin: top left;
}

.annotationLayer section {
    position: absolute;
    text-align: initial;
    pointer-events: auto;
    box-sizing: border-box;
    margin: 0;
    transform-origin: top left;
}

.annotationLayer .linkAnnotation>a {
    position: absolute;
    font-size: 1em;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgb(0 21 255 / 2%);
    transition: background 0.2s;
}

.annotationLayer .linkAnnotation>a:hover {
    background: rgba(255, 255, 0, 0.2);
}

.annotationLayer .textAnnotation>img {
    position: absolute;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.annotationLayer .popupAnnotation {
    position: absolute;
    z-index: 10;
    background: #ffc;
    border: 1px solid #770;
    padding: 2px;
    font-size: 12px;
    box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.2);
    max-width: 200px;
    word-wrap: break-word;
}