/* ══════════════════════════════════════════════════════════════════
   PDF — КАТЕГОРИИ
══════════════════════════════════════════════════════════════════ */
.cat-list { display: flex; flex-direction: column; gap: 10px; }

.cat-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    box-shadow: 0 2px 8px rgba(44,100,100,0.08);
}

.cat-item:active { background: var(--glass-bg-strong); border-color: var(--glass-border-acc); }

.cat-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(44, 150, 150, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.cat-info  { flex: 1; }
.cat-name  { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700; }
.cat-count { font-size: 11px; color: var(--sub); margin-top: 2px; }
.cat-arrow { color: var(--sub); font-size: 18px; }

/* ── PDF ПОИСК ── */
.pdf-search-wrap { position: relative; margin-bottom: 16px; }

.pdf-search {
    width: 100%;
    padding: 11px 14px 11px 38px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border-acc);
    border-radius: 12px;
    color: var(--text);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}

.pdf-search:focus { border-color: var(--accent); }
.pdf-search::placeholder { color: var(--sub); }

.pdf-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--sub);
    font-size: 16px;
    pointer-events: none;
}

/* ── PDF СПИСОК ДОКУМЕНТОВ ── */
.doc-list { display: flex; flex-direction: column; gap: 8px; }

.doc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    width: 100%;
    text-align: left;
    box-shadow: 0 2px 8px rgba(44,100,100,0.07);
}

.doc-item:active { background: var(--glass-bg-strong); border-color: var(--glass-border-acc); }

.doc-item.cached .doc-icon { position: relative; }
.doc-item.cached .doc-icon::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--green);
    border: 2px solid var(--bg);
}

.doc-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(44, 150, 150, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}

.doc-name { flex: 1; font-size: 14px; font-weight: 500; color: var(--text); line-height: 1.4; }
.doc-arr  { color: var(--sub); font-size: 16px; flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════════════
   PDF VIEWER
══════════════════════════════════════════════════════════════════ */
#viewer-panel {
    position: fixed;
    inset: 0;
    background: #111;
    z-index: 202;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    overflow: hidden;
}
#viewer-panel.open    { transform: translateY(0); }
#viewer-panel.closing {
    transform: translateY(105%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 1, 1);
}
#viewer-header {
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 10;
    background: linear-gradient(to bottom, rgba(17,17,17,0.96) 70%, transparent);
    padding: 12px calc(56px + var(--sa-left) + var(--csa-left)) 16px calc(56px + var(--sa-right) + var(--csa-right));
    padding-top: calc(12px + var(--sa-top) + var(--csa-top));
    pointer-events: none;
}
#viewer-title {
    font-family: 'Syne', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#pdf-find-bar {
    display: none;
    position: absolute;
    top: calc(54px + var(--sa-top) + var(--csa-top));
    left: 0; right: 0;
    z-index: 11;
    padding: 8px 12px;
    background: rgba(17,17,17,0.97);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    gap: 8px;
    align-items: center;
}
#pdf-find-bar.open { display: flex; }
#pdf-find-input {
    flex: 1;
    padding: 8px 12px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    outline: none;
}
#pdf-find-input::placeholder { color: rgba(255,255,255,0.35); }
#pdf-find-go {
    padding: 8px 14px;
    background: var(--accent2);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-family: 'Syne', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
#pdf-find-go:disabled { opacity: 0.5; }
#pdf-scroll-wrap {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: #111;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}
#pdf-pages-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 4px;
    padding-top: calc(4px + var(--sa-top) + var(--csa-top));
    padding-bottom: calc(4px + var(--sa-bottom) + var(--csa-bottom));
    touch-action: none;
    will-change: transform;
}
.pdf-page-slot {
    position: relative;
    flex-shrink: 0;
    background: #fff;
    outline: 1px solid rgba(255,255,255,0.08);
    contain: layout style size paint;
}
.pdf-page-slot canvas { display: block; }
.pdf-page-slot.loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,#1e1e1e 25%,#2d2d2d 50%,#1e1e1e 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    will-change: background-position;
}
#pdf-controls {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    z-index: 10;
    background: linear-gradient(to top, rgba(17,17,17,0.96) 70%, transparent);
    padding: 12px 16px;
    padding-bottom: calc(12px + var(--sa-bottom) + var(--csa-bottom));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    pointer-events: auto;
}
#pdf-page-indicator {
    font-size: 14px;
    color: rgba(255,255,255,0.65);
    font-family: 'Syne', sans-serif;
    font-weight: 600;
}
#pdf-page-current { color: #fff; }
#pdf-page-sep { margin: 0 3px; opacity: 0.35; }
#pdf-find-nav {
    display: none;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(255,255,255,0.55);
}
#pdf-find-nav.visible { display: flex; }
.find-nav-btn {
    width: 28px; height: 28px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px; color: #fff;
    font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
}
#viewer-panel .pctrl {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff; font-size: 18px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0;
}
#viewer-panel .pctrl:active { background: rgba(255,255,255,0.22); }
.textLayer {
    position: absolute; top: 0; left: 0;
    overflow: hidden; line-height: 1;
    pointer-events: none;
}
.textLayer span {
    color: transparent; position: absolute;
    white-space: pre; transform-origin: 0% 0%;
}
.textLayer .highlight          { background-color: rgba(255,220,0,0.55) !important; border-radius: 2px; }
.textLayer .highlight.selected { background-color: rgba(255,140,0,0.8)  !important; }

/* ── PDF LOADING OVERLAY ── */
.pdf-progress {
    position: fixed;
    top: 0; left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), #5dc5c5);
    transition: width 0.3s ease;
    z-index: 300;
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 8px rgba(44, 150, 150, 0.5);
    pointer-events: none;
}
