/* Document preview lightbox for the Documents tab. The image is created on
   click (see openDocImage in Chatbot_UI_fakeai.js), so nothing loads until the
   user asks for it. */

.doc-image-overlay {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(0.75rem, 3vw, 1.5rem);
    background: rgba(3, 6, 17, 0.82);
    backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.doc-image-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.doc-image-overlay[hidden] { display: none; }

.doc-image-frame {
    position: relative;
    width: min(920px, 100%);
    max-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    background: #0d1220;
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    box-shadow: var(--shadow-soft);
}

.doc-image-close {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    z-index: 2;
    width: 2.2rem;
    height: 2.2rem;
    display: grid;
    place-items: center;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    background: rgba(255, 255, 255, 0.06);
    color: var(--ink);
    cursor: pointer;
    transition: background 0.15s ease;
}

.doc-image-close:hover { background: rgba(255, 255, 255, 0.12); }
.doc-image-close:focus-visible { outline: 2px solid var(--brand-gold); outline-offset: 2px; }

.doc-image-title {
    font-family: "Poppins", sans-serif;
    font-size: 1.05rem;
    line-height: 1.3;
    color: var(--ink);
    text-align: center;
    padding: 0 2rem;
}

.doc-image-stage {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
}

.doc-image-stage img {
    max-width: 100%;
    max-height: 78vh;
    height: auto;
    display: block;
    border-radius: 10px;
}

.doc-image-spinner {
    width: 42px;
    height: 42px;
    border: 3px solid rgba(255, 255, 255, 0.14);
    border-top-color: var(--brand-gold);
    border-radius: 50%;
    animation: docImageSpin 0.9s linear infinite;
}

@keyframes docImageSpin { to { transform: rotate(360deg); } }

.doc-image-missing {
    color: var(--muted-ink);
    font-size: 0.9rem;
    text-align: center;
    padding: 2.5rem 1rem;
}

body.light-mode .doc-image-frame { background: #ffffff; }
body.light-mode .doc-image-stage { background: rgba(0, 0, 0, 0.04); }
body.light-mode .doc-image-close { background: rgba(0, 0, 0, 0.05); color: #0f172a; }
body.light-mode .doc-image-close:hover { background: rgba(0, 0, 0, 0.1); }

@media (prefers-reduced-motion: reduce) {
    .doc-image-spinner { animation-duration: 1.6s; }
}
