/* PDF Viewer Overlay */
.pdf-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #525659;
    z-index: 1500;
    display: flex;
    flex-direction: column;
    overscroll-behavior: contain;
}

/* Header bar */
.pdf-viewer-header {
    display: flex;
    align-items: center;
    background: #323639;
    color: #fff;
    padding: 8px 12px;
    min-height: 44px;
    flex-shrink: 0;
}

.pdf-viewer-back {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 12px 4px 4px;
    line-height: 1;
}

.pdf-viewer-back:hover {
    color: #ccc;
}

.pdf-viewer-title {
    flex: 1;
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Scrollable canvas container */
.pdf-viewer-container {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
}

.pdf-viewer-container canvas {
    display: block;
    margin: 4px auto;
    max-width: 100%;
}

/* Share menu in viewer header */
.pdf-viewer-share-wrap {
    position: relative;
    margin-left: 8px;
}

.pdf-viewer-share {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    display: flex;
    align-items: center;
    border-radius: 4px;
}

.pdf-viewer-share:hover,
.pdf-viewer-share:active,
.pdf-viewer-share:focus {
    background: rgba(255,255,255,0.2);
}

.pdf-viewer-share-popover {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    min-width: 170px;
    z-index: 10;
    overflow: hidden;
}

.pdf-viewer-share-popover.open {
    display: block;
}

.pdf-viewer-share-item {
    display: block;
    padding: 10px 14px;
    color: #333;
    text-decoration: none;
    white-space: nowrap;
    font-size: 14px;
}

.pdf-viewer-share-item:hover,
.pdf-viewer-share-item:active {
    background: #f0f0f0;
}

/* Loading indicator */
.pdf-viewer-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: #ccc;
    font-size: 18px;
}

.pdf-viewer-error {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: #ccc;
    gap: 12px;
}

.pdf-viewer-error p {
    margin: 0;
}

.pdf-viewer-error a {
    color: #7eb8f7;
}

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

.pdf-viewer-loading .loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
