/* ─────────────────────────────────────────────────────────────
   BI PDF Viewer — frontend modal
───────────────────────────────────────────────────────────── */

/* ── Backdrop ────────────────────────────────────────────── */
.bi-pdf-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .70);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity .22s ease, visibility .22s ease;
}
.bi-pdf-backdrop.is-open {
    opacity: 1;
    visibility: visible;
}

/* ── Modal container ─────────────────────────────────────── */
.bi-pdf-modal {
    background: #fff;
    border-radius: 10px;
    width: min(92vw, 1140px);
    height: min(88vh, 900px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 28px 72px rgba(0, 0, 0, .50);
    transform: scale(.97) translateY(10px);
    transition: transform .22s ease;
    overflow: hidden;
    position: relative;
}
.bi-pdf-backdrop.is-open .bi-pdf-modal {
    transform: none;
}

/* Fullscreen toggle */
.bi-pdf-modal.is-fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    border-radius: 0 !important;
    max-width: none !important;
}

/* ── Mobile: true full-screen ────────────────────────────── */
@media (max-width: 600px) {
    .bi-pdf-backdrop {
        padding: 0;
        align-items: stretch;
    }
    .bi-pdf-modal {
        width: 100%;
        height: 100dvh;
        border-radius: 0;
        box-shadow: none;
    }
}

/* ── Header ──────────────────────────────────────────────── */
.bi-pdf-header {
    display: flex;
    align-items: center;
    gap: .2rem;
    padding: .5rem .625rem .5rem 1.125rem;
    background: #1c3249;
    color: #fff;
    flex-shrink: 0;
    min-height: 48px;
}

.bi-pdf-title {
    flex: 1;
    min-width: 0;
    font-size: .8rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: .85;
    letter-spacing: .01em;
}

/* ── Header buttons ──────────────────────────────────────── */
.bi-pdf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .3em;
    background: none;
    border: none;
    border-radius: 5px;
    color: rgba(255, 255, 255, .72);
    cursor: pointer;
    padding: .35rem .5rem;
    font-size: .78rem;
    font-family: inherit;
    white-space: nowrap;
    text-decoration: none;
    line-height: 1;
    transition: background .14s, color .14s;
    flex-shrink: 0;
}
.bi-pdf-btn:hover,
.bi-pdf-btn:focus-visible {
    background: rgba(255, 255, 255, .15);
    color: #fff;
    outline: none;
}
.bi-pdf-btn svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

/* Close button gets red hover */
.bi-pdf-btn--close {
    color: rgba(255, 255, 255, .85);
    margin-left: .15rem;
}
.bi-pdf-btn--close:hover,
.bi-pdf-btn--close:focus-visible {
    background: rgba(208, 48, 48, .75);
    color: #fff;
}
.bi-pdf-btn--close svg {
    width: 14px;
    height: 14px;
    stroke-width: 2;
}

/* Hide text labels on small screens, keep icons */
.bi-pdf-btn__lbl {
    display: none;
}
@media (min-width: 640px) {
    .bi-pdf-btn__lbl {
        display: inline;
    }
}

/* ── Body / iframe ───────────────────────────────────────── */
.bi-pdf-body {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: #525659;
}

.bi-pdf-iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
}

/* ── Loading spinner ─────────────────────────────────────── */
.bi-pdf-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .85rem;
    color: rgba(255, 255, 255, .65);
    font-size: .8125rem;
    pointer-events: none;
    transition: opacity .18s;
}
.bi-pdf-loading.is-hidden {
    opacity: 0;
}
.bi-pdf-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, .2);
    border-top-color: rgba(255, 255, 255, .85);
    border-radius: 50%;
    animation: bi-pdf-spin .75s linear infinite;
}
@keyframes bi-pdf-spin {
    to { transform: rotate(360deg); }
}

/* ── iOS / no-iframe fallback ────────────────────────────── */
.bi-pdf-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    height: 100%;
    padding: 2rem;
    text-align: center;
}
.bi-pdf-fallback p {
    color: rgba(255, 255, 255, .7);
    font-size: .875rem;
    margin: 0 0 .75rem;
    max-width: 320px;
}
.bi-pdf-fallback a {
    display: inline-flex;
    align-items: center;
    gap: .4em;
    padding: .7rem 1.5rem;
    border-radius: 7px;
    font-weight: 500;
    font-size: .9rem;
    text-decoration: none;
    transition: filter .14s;
}
.bi-pdf-fallback a:hover { filter: brightness(1.12); }
.bi-pdf-fallback a:first-of-type { background: #2271b1; color: #fff; }
.bi-pdf-fallback a:last-of-type  { background: rgba(255,255,255,.15); color: rgba(255,255,255,.85); }

/* ── Toast copy confirmation ─────────────────────────────── */
.bi-pdf-copied-toast {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, .78);
    color: #fff;
    padding: .45rem 1rem;
    border-radius: 5px;
    font-size: .8rem;
    pointer-events: none;
    white-space: nowrap;
    animation: bi-pdf-toast .1s ease;
    z-index: 1;
}
@keyframes bi-pdf-toast {
    from { opacity: 0; transform: translateX(-50%) translateY(4px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Inline link style (optional) ───────────────────────── */
a.bi-pdf-link {
    text-decoration: none;
    cursor: pointer;
}


/* ── PDF icon before link ─────────────────────────────────── */
a.bi-pdf-link::before {
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    content: '\f1c1';
    margin-right: .3em;
    font-size: .85em;
    color: inherit;
    display: inline-block;  /* prevents underline from extending under icon */
    text-decoration: none;
    vertical-align: baseline;
}
