.pdf-viewer {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #0f1720;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    overflow: hidden;
    max-height: min(720px, 78vh);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.pdf-viewer__toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.35);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.pdf-viewer__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: #cbd5e1;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    flex-shrink: 0;
}

.pdf-viewer__btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.pdf-viewer__btn:active {
    background: rgba(255, 255, 255, 0.16);
}

.pdf-viewer__btn svg {
    display: block;
}

.pdf-viewer__zoom {
    font-size: 13px;
    color: #94a3b8;
    min-width: 44px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.pdf-viewer__count {
    font-size: 13px;
    color: #94a3b8;
    padding-left: 10px;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
    flex-shrink: 0;
}

.pdf-viewer__spacer {
    flex: 1;
    min-width: 0;
}

.pdf-viewer__body {
    flex: 1;
    overflow: auto;
    background: #1a1f2b;
    position: relative;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
}

.pdf-viewer__body::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.pdf-viewer__body::-webkit-scrollbar-track {
    background: transparent;
}

.pdf-viewer__body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14);
    border-radius: 4px;
}

.pdf-viewer__body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.24);
}

.pdf-viewer__stage {
    position: relative;
    min-height: 100%;
}

.pdf-viewer__page {
    position: absolute;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    line-height: 0;
    will-change: top, left, width, height;
}

.pdf-viewer__page.is-loading {
    background: #dfe6ef;
}

.pdf-viewer__page.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border: 3px solid rgba(100, 116, 139, 0.25);
    border-top-color: #64748b;
    border-radius: 50%;
    animation: pdfSpin 0.8s linear infinite;
    pointer-events: none;
}

@keyframes pdfSpin {
    to {
        transform: rotate(360deg);
    }
}

.pdf-viewer__canvas {
    display: block;
    opacity: 0;
    transition: opacity 0.18s ease;
}

.pdf-viewer__page:not(.is-loading) .pdf-viewer__canvas {
    opacity: 1;
}

.pdf-viewer:fullscreen {
    max-height: none;
    border-radius: 0;
}

@media (prefers-reduced-motion: reduce) {
    .pdf-viewer__page.is-loading::after {
        animation: none;
        border-top-color: rgba(100, 116, 139, 0.25);
    }

    .pdf-viewer__canvas {
        transition: none;
    }
}

@media (max-width: 640px) {
    .pdf-viewer {
        max-height: 72vh;
        border-radius: 12px;
    }

    .pdf-viewer__toolbar {
        padding: 6px 8px;
        gap: 4px;
    }

    .pdf-viewer__btn {
        width: 30px;
        height: 30px;
        min-width: 30px;
    }

    .pdf-viewer__zoom {
        min-width: 38px;
        font-size: 12px;
    }

    .pdf-viewer__count {
        font-size: 11px;
        padding-left: 6px;
    }
}

@media (max-width: 400px) {
    .pdf-viewer__count {
        display: none;
    }
}