/* Full-screen image preview opened from the document drop zone (interlop/dropZone.js → showFullscreenImage).
   The viewer is always dark, like a photo viewer, in both light and dark themes. */
.acme-image-preview {
    position: fixed;
    inset: 0;
    z-index: var(--app-image-preview-z-index, 2147483500);
    display: flex;
    flex-direction: column;
    background: rgb(10 12 16 / 0.88);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: #f1f5f9;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
}

.acme-image-preview[hidden] { display: none; }
.acme-image-preview.is-open { opacity: 1; pointer-events: auto; }

.acme-image-preview__bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid rgb(255 255 255 / 0.08);
    background: rgb(0 0 0 / 0.25);
}

.acme-image-preview__icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: var(--acme-radius-md, 8px);
    background: color-mix(in srgb, var(--acme-color-primary-action, #0d6efd) 28%, transparent);
    color: #fff;
}

.acme-image-preview__name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
}

.acme-image-preview__close {
    flex: none;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid rgb(255 255 255 / 0.14);
    border-radius: 50%;
    background: rgb(255 255 255 / 0.08);
    color: #fff;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease;
}

.acme-image-preview__close:hover { background: rgb(255 255 255 / 0.18); border-color: rgb(255 255 255 / 0.28); }
.acme-image-preview__close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.acme-image-preview svg { width: 18px; height: 18px; }

/* Clicking the stage (outside the image) closes the preview. */
.acme-image-preview__stage {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    cursor: zoom-out;
}

.acme-image-preview__img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--acme-radius-lg, 10px);
    background: #fff; /* transparent PNGs stay readable */
    box-shadow: 0 24px 64px rgb(0 0 0 / 0.5);
    cursor: default;
    transform: scale(0.96);
    transition: transform 200ms cubic-bezier(.2, .8, .2, 1);
}

.acme-image-preview.is-open .acme-image-preview__img { transform: none; }
.acme-image-preview.is-loading .acme-image-preview__img,
.acme-image-preview.is-error .acme-image-preview__img { visibility: hidden; }

.acme-image-preview__status {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    font-size: 13px;
    color: #cbd5e1;
    pointer-events: none;
}

.acme-image-preview.is-loading .acme-image-preview__status,
.acme-image-preview.is-error .acme-image-preview__status { display: grid; }

.acme-image-preview.is-loading .acme-image-preview__status::before {
    content: "";
    width: 32px;
    height: 32px;
    border: 3px solid rgb(255 255 255 / 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: acme-image-preview-spin 800ms linear infinite;
}

@keyframes acme-image-preview-spin { to { transform: rotate(360deg); } }

@media (max-width: 576px) {
    .acme-image-preview__bar { padding: 10px 12px; }
    .acme-image-preview__stage { padding: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .acme-image-preview,
    .acme-image-preview__img { transition: none; }
    .acme-image-preview__img { transform: none; }
    .acme-image-preview.is-loading .acme-image-preview__status::before { animation-duration: 2.4s; }
}
