/* ═══ Защищённый просмотр PDF ═══ */

.pv-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #525659;
    position: relative;
    overflow: hidden;
}

/* ─── Тулбар ─── */
.pv-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: #323639;
    color: #d1d5db;
    font-size: 13px;
    flex-shrink: 0;
    border-bottom: 1px solid #1a1d20;
    flex-wrap: wrap;
    min-height: 36px;
    user-select: none;
}

.pv-toolbar-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pv-toolbar-sep {
    width: 1px;
    height: 20px;
    background: #4a4e52;
    margin: 0 4px;
}

.pv-toolbar button {
    background: transparent;
    border: 1px solid transparent;
    color: #d1d5db;
    padding: 4px 6px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
}
.pv-toolbar button:hover {
    background: #4a4e52;
    border-color: #5a5e62;
}
.pv-toolbar button:active {
    background: #3a3e42;
}
.pv-toolbar button:disabled {
    opacity: 0.4;
    cursor: default;
}
.pv-toolbar button.pv-active {
    background: #4a7ccc;
    border-color: #5a8cdc;
    color: #fff;
}

.pv-page-input {
    width: 48px;
    background: #1a1d20;
    border: 1px solid #4a4e52;
    color: #d1d5db;
    text-align: center;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 13px;
    height: 26px;
}
.pv-page-input:focus {
    outline: none;
    border-color: #4a7ccc;
}

.pv-page-total {
    color: #9ca3af;
}

.pv-doc-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #9ca3af;
    font-size: 12px;
    text-align: right;
    min-width: 0;
}

/* ─── Поиск ─── */
.pv-search-bar {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: #2a2d30;
    border-bottom: 1px solid #1a1d20;
    flex-shrink: 0;
}
.pv-search-bar.pv-visible {
    display: flex;
}
.pv-search-input {
    flex: 1;
    max-width: 300px;
    background: #1a1d20;
    border: 1px solid #4a4e52;
    color: #d1d5db;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 13px;
    height: 28px;
}
.pv-search-input:focus {
    outline: none;
    border-color: #4a7ccc;
}
.pv-search-info {
    color: #9ca3af;
    font-size: 12px;
    white-space: nowrap;
}

/* ─── Область просмотра ─── */
.pv-viewport {
    flex: 1;
    overflow: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 8px;
}

/* Клиентский режим (PDF.js) */
.pv-canvas-wrapper {
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    background: #fff;
}
.pv-canvas-wrapper canvas {
    display: block;
}

/* Водяной знак overlay (клиентский режим) */
.pv-watermark-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 2;
}

/* Серверный режим (изображения) */
.pv-page-img {
    max-width: 100%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    background: #fff;
    display: block;
}
.pv-page-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 600px;
    height: 800px;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

/* ─── Статус-бар ─── */
.pv-statusbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 8px;
    background: #1a1d20;
    color: #9ca3af;
    font-size: 11px;
    flex-shrink: 0;
    border-top: 1px solid #323639;
}

/* ─── Защита от копирования ─── */
.pv-no-copy .pv-viewport {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}
.pv-no-copy .pv-viewport img,
.pv-no-copy .pv-viewport canvas {
    pointer-events: none;
}

/* ─── Блокировка печати ─── */
@media print {
    .pv-no-print * {
        display: none !important;
    }
    .pv-no-print::after {
        content: 'Печать запрещена';
        display: block;
        font-size: 24px;
        text-align: center;
        padding: 100px 0;
    }
}

/* ─── Спиннер загрузки ─── */
.pv-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #4a4e52;
    border-top-color: #4a7ccc;
    border-radius: 50%;
    animation: pvSpin 0.8s linear infinite;
}
@keyframes pvSpin {
    to { transform: rotate(360deg); }
}

/* ─── Полноэкранный режим ─── */
.pv-fullscreen {
    position: fixed !important;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 99999;
    width: 100vw !important;
    height: 100vh !important;
}
