/* === PDF VIEWER PAGE === */
.pdf-viewer-page {
    padding: clamp(1.5rem, 3vw, 2.5rem) 0 clamp(3rem, 6vw, 5rem);
}

.container--wide {
    max-width: min(1480px, calc(100% - 2rem));
}

/* === HEADER === */
.pdf-head {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1.5rem 2rem;
    align-items: end;
    padding: clamp(1.25rem, 2.5vw, 1.75rem);
    border-radius: var(--radius-2xl);
    margin-top: 1.5rem;
    margin-bottom: 1.75rem;
    background: linear-gradient(135deg, rgba(29, 95, 214, 0.16), rgba(43, 148, 87, 0.06)),
                var(--surface-glass);
    backdrop-filter: blur(var(--blur-lg));
    -webkit-backdrop-filter: blur(var(--blur-lg));
    border: 1px solid rgba(29, 95, 214, 0.28);
}
.pdf-head__main { min-width: 0; }

.pdf-head__badge {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .72rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--color-primary-lighter);
    background: rgba(29, 95, 214, 0.12);
    border: 1px solid rgba(29, 95, 214, 0.32);
    border-radius: var(--radius-pill);
    padding: .35rem .75rem;
    margin-bottom: .9rem;
}
.pdf-head__badge svg { width: 14px; height: 14px; }

.pdf-head__title {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 2.6vw, 2.1rem);
    line-height: 1.18;
    margin: 0 0 .35rem;
    color: var(--siyoh);
}
.pdf-head__author {
    margin: 0 0 .9rem;
    color: var(--text-secondary);
    font-size: 1rem;
}

.pdf-head__meta {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: .4rem .9rem;
}
.pdf-head__meta li {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .85rem;
    color: var(--text-tertiary);
}
.pdf-head__meta li svg { width: 14px; height: 14px; }
.pdf-head__meta-warn { color: var(--color-accent) !important; }

.pdf-head__actions {
    display: flex;
    gap: .85rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.pdf-zoom {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .3rem;
    border-radius: var(--radius-pill);
    background: rgba(15, 31, 56, 0.14);
    border: 1px solid var(--surface-glass-border);
}
.pdf-zoom__btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 0;
    background: transparent;
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background .2s ease, transform .2s var(--ease-spring);
}
.pdf-zoom__btn:hover {
    background: rgba(29, 95, 214, 0.18);
    transform: scale(1.08);
}
.pdf-zoom__label {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: .9rem;
    min-width: 52px;
    text-align: center;
    color: var(--text-primary);
}

.pdf-download svg { width: 18px; height: 18px; }

/* === PROGRESS === */
.pdf-progress {
    position: relative;
    height: 4px;
    border-radius: var(--radius-pill);
    background: rgba(15, 31, 56, 0.06);
    margin-bottom: 1.25rem;
    overflow: hidden;
    transition: opacity .4s ease, height .4s ease;
}
.pdf-progress.is-done {
    opacity: 0;
    height: 0;
    margin-bottom: 0;
    pointer-events: none;
}
.pdf-progress__bar {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0%;
    background: var(--gradient-primary);
    border-radius: inherit;
    transition: width .25s ease;
}
.pdf-progress__label {
    position: absolute;
    top: 8px;
    left: 0;
    font-size: .75rem;
    color: var(--text-tertiary);
    letter-spacing: .04em;
}

/* === PAGES === */
.pdf-pages {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

.pdf-page {
    position: relative;
    width: 100%;
    max-width: 980px;
    overflow-x: auto;
}
.pdf-page__num {
    position: sticky;
    top: calc(var(--navbar-height) + 1rem);
    z-index: 2;
    width: max-content;
    margin-left: auto;
    margin-bottom: -28px;
    padding: .3rem .7rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: .78rem;
    color: var(--color-primary-lighter);
    background: rgba(15, 31, 56, 0.75);
    border: 1px solid rgba(29, 95, 214, 0.3);
    border-radius: var(--radius-pill);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.pdf-page__num span {
    color: var(--text-tertiary);
    margin-left: 2px;
}

.pdf-page__canvas-wrap {
    position: relative;
    margin: 0 auto;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #fff;
    box-shadow:
        0 20px 50px rgba(15, 31, 56, 0.55),
        0 0 0 1px rgba(15, 31, 56, 0.04);
    aspect-ratio: 0.707;
}
.pdf-page__canvas {
    display: block;
    width: 100%;
    height: auto;
}
.pdf-page__placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    color: var(--color-primary-dark);
    font-size: .85rem;
}
.pdf-page__placeholder--error {
    background: linear-gradient(135deg, #fecaca, #fda4af);
    color: #7f1d1d;
    gap: .5rem;
}
.pdf-page__placeholder--error svg { width: 22px; height: 22px; }

.pdf-spinner {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 3px solid rgba(29, 95, 214, 0.2);
    border-top-color: var(--color-primary);
    animation: pdf-spin .9s linear infinite;
}
@keyframes pdf-spin { to { transform: rotate(360deg); } }

/* === ERROR STATE === */
.pdf-error {
    text-align: center;
    padding: 3rem 2rem;
    border-radius: var(--radius-2xl);
    background: rgba(207, 74, 55, 0.08);
    border: 1px solid rgba(207, 74, 55, 0.3);
}
.pdf-error__icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(207, 74, 55, 0.18);
    color: #cf4a37;
}
.pdf-error__icon svg { width: 28px; height: 28px; }
.pdf-error h3 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    margin-bottom: .5rem;
}
.pdf-error p {
    color: var(--text-tertiary);
    margin-bottom: 1.5rem;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .pdf-head {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
    .pdf-head__actions {
        justify-content: space-between;
    }
    .pdf-page__num {
        margin-bottom: -22px;
        font-size: .72rem;
    }
}
