.ff-image-preview-v2-open {
    overflow: hidden;
}

.ff-image-preview-v2 [hidden] {
    display: none !important;
}

.ff-image-preview-version {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 25px;
    height: 18px;
    padding: 0 6px;
    border: 1px solid color-mix(in srgb, var(--accent-color, #367bf5) 42%, transparent);
    border-radius: 9px;
    background: color-mix(in srgb, var(--accent-color, #367bf5) 8%, var(--surface, #fff));
    color: color-mix(in srgb, var(--accent-color, #367bf5) 76%, var(--text-color, #182230));
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    letter-spacing: .03em;
    white-space: nowrap;
}

.ff-image-preview-v2__header > .ff-image-preview-version {
    margin-left: auto;
}

.ff-image-preview-v2 {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 47120 !important;
    display: grid !important;
    place-items: center !important;
    overflow: hidden !important;
    isolation: isolate;
    color: #182230;
}

.ff-image-preview-v2__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 18, 30, .68);
}

.ff-image-preview-v2__panel {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(96vw, 1180px);
    height: min(94vh, 920px);
    overflow: hidden;
    border: 1px solid rgba(120, 140, 165, .45);
    border-radius: 8px;
    background: #f4f6f8;
    box-shadow: 0 22px 70px rgba(0, 0, 0, .35);
}

.ff-image-preview-v2__header,
.ff-image-preview-v2__footer {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 8px 12px;
    background: #fff;
}

.ff-image-preview-v2__header {
    justify-content: space-between;
    border-bottom: 1px solid #dce2e8;
}

.ff-image-preview-v2__heading,
.ff-image-preview-v2__details {
    display: flex;
    min-width: 0;
    align-items: baseline;
    gap: 10px;
}

.ff-image-preview-v2__title {
    font-size: 15px;
}

.ff-image-preview-v2__source,
.ff-image-preview-v2__size,
.ff-image-preview-v2__metrics,
.ff-image-preview-v2__status {
    overflow: hidden;
    color: #667085;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ff-image-preview-v2__size {
    flex: 0 0 auto;
}

.ff-image-preview-v2__close {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: inherit;
    font-size: 28px;
    line-height: 30px;
}

.ff-image-preview-v2__close:hover,
.ff-image-preview-v2__close:focus {
    background: #edf1f5;
}

.ff-image-preview-v2__stage {
    position: relative;
    display: grid;
    min-width: 0;
    min-height: 0;
    place-items: center;
    overflow: auto;
    overscroll-behavior: contain;
    background: #cfd5dc;
}

.ff-image-preview-v2__image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .18);
}

.ff-image-preview-v2__stage--image.ff-image-preview-v2__stage--fit {
    overflow: hidden;
}

.ff-image-preview-v2__image--fit {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.ff-image-preview-v2__stage--image.ff-image-preview-v2__stage--width,
.ff-image-preview-v2__stage--image.ff-image-preview-v2__stage--actual {
    align-content: start;
}

.ff-image-preview-v2__image--width {
    width: 100%;
    max-width: 100%;
    max-height: none;
    height: auto;
}

.ff-image-preview-v2__image--actual {
    max-width: none;
    max-height: none;
}

.ff-image-preview-v2__stage--pdf {
    display: block;
    overflow: hidden;
}

.ff-image-preview-v2__pdf {
    display: block;
    width: 100%;
    height: 100%;
    min-width: 100%;
    min-height: 100%;
    align-self: stretch;
    justify-self: stretch;
    border: 0;
    background: #fff;
}

.ff-image-preview-v2__loading-copy,
.ff-image-preview-v2__error {
    max-width: 460px;
    padding: 24px;
    border-radius: 6px;
    background: rgba(255, 255, 255, .94);
    text-align: center;
}

.ff-image-preview-v2__error p {
    margin: 8px 0;
}

.ff-image-preview-v2__footer {
    flex-wrap: wrap;
    justify-content: space-between;
    border-top: 1px solid #dce2e8;
}

.ff-image-preview-v2__navigation,
.ff-image-preview-v2__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ff-image-preview-v2__actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.ff-image-preview-v2__actions .btn,
.ff-image-preview-v2__navigation .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.ff-image-preview-v2__icon-button {
    min-width: 32px;
    min-height: 30px;
    padding-right: 8px;
    padding-left: 8px;
}

.ff-image-preview-v2__settings-cog {
    display: block;
    width: 21px;
    height: 21px;
    fill: currentColor;
}

.ff-image-preview-v2__display-settings {
    position: relative;
}

.ff-image-preview-v2__display-settings > summary {
    list-style: none;
    cursor: pointer;
}

.ff-image-preview-v2__display-settings > summary::-webkit-details-marker {
    display: none;
}

.ff-image-preview-v2__display-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 7px);
    z-index: 4;
    display: grid;
    min-width: 145px;
    overflow: hidden;
    border: 1px solid #c8d1dc;
    border-radius: 5px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(22, 34, 52, .22);
}

.ff-image-preview-v2__display-option {
    padding: 8px 12px;
    border: 0;
    border-bottom: 1px solid #e3e8ee;
    background: transparent;
    color: inherit;
    text-align: left;
    white-space: nowrap;
}

.ff-image-preview-v2__display-option:last-child {
    border-bottom: 0;
}

.ff-image-preview-v2__display-option:hover,
.ff-image-preview-v2__display-option:focus,
.ff-image-preview-v2__display-option.is-active {
    background: #e8f1ff;
    color: #1f5eae;
}

.ff-image-preview-v2__print-frame {
    position: fixed;
    top: 0;
    left: -10000px;
    width: 1px;
    height: 1px;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.ff-image-preview-v2__position {
    min-width: 170px;
    color: #475467;
    font-size: 12px;
    text-align: center;
}

.ff-image-preview-v2__loading {
    color: #036ca6;
    font-weight: 600;
}

.ff-theme-dark .ff-image-preview-v2 {
    color: #e7edf4;
}

.ff-theme-dark .ff-image-preview-v2__panel,
.ff-theme-dark .ff-image-preview-v2__stage {
    background: #1c2633;
}

.ff-theme-dark .ff-image-preview-v2__header,
.ff-theme-dark .ff-image-preview-v2__footer,
.ff-theme-dark .ff-image-preview-v2__loading-copy,
.ff-theme-dark .ff-image-preview-v2__error {
    background: #111923;
    border-color: #344151;
}

.ff-theme-dark .ff-image-preview-v2__close:hover,
.ff-theme-dark .ff-image-preview-v2__close:focus {
    background: #293647;
}

.ff-theme-dark .ff-image-preview-v2__source,
.ff-theme-dark .ff-image-preview-v2__size,
.ff-theme-dark .ff-image-preview-v2__metrics,
.ff-theme-dark .ff-image-preview-v2__status,
.ff-theme-dark .ff-image-preview-v2__position {
    color: #aab8c8;
}

.ff-theme-dark .ff-image-preview-v2__display-menu {
    border-color: #455569;
    background: #111923;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .5);
}

.ff-theme-dark .ff-image-preview-v2__display-option {
    border-color: #344151;
}

.ff-theme-dark .ff-image-preview-v2__display-option:hover,
.ff-theme-dark .ff-image-preview-v2__display-option:focus,
.ff-theme-dark .ff-image-preview-v2__display-option.is-active {
    background: #243a58;
    color: #80b4ff;
}

@media (max-width: 720px) {
    .ff-image-preview-v2__panel {
        width: 100vw;
        height: 100vh;
        border: 0;
        border-radius: 0;
    }

    .ff-image-preview-v2__footer,
    .ff-image-preview-v2__details {
        align-items: stretch;
    }

    .ff-image-preview-v2__footer {
        display: grid;
    }

    .ff-image-preview-v2__navigation,
    .ff-image-preview-v2__actions {
        justify-content: space-between;
    }

    .ff-image-preview-v2__actions .btn span {
        display: none;
    }
}

/* Keep the viewport bounded: percentage-sized images in an intrinsic grid row
   can grow that row and clip the image behind the footer. Rotation gets an
   explicit bounding box so every edge remains reachable by scrolling. */
.ff-image-preview-v2 .ff-image-preview-v2__stage--image {
    display: block;
    overflow: auto;
    min-height: 0;
    min-width: 0;
    scrollbar-width: auto;
}
.ff-image-preview-v2__image-box {
    position: relative;
    margin-left: auto;
    margin-right: auto;
}
.ff-image-preview-v2 .ff-image-preview-v2__image-box > img {
    position: absolute;
    top: 50%;
    left: 50%;
    max-width: none !important;
    max-height: none !important;
    min-width: 0;
    min-height: 0;
    transform-origin: center;
}
.ff-image-preview-v2__actions { flex-wrap: wrap; }
.ff-image-preview-v2__actions .btn.is-active {
    border-color: var(--accent-color, #367bf5);
    background: color-mix(in srgb, var(--accent-color, #367bf5) 12%, var(--surface, #fff));
}
@media (max-width: 720px) {
    .ff-image-preview-v2__actions .btn span { display: inline; }
}

/* Keep the common viewing controls visible in the title area. */
.ff-image-preview-v2__header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 8px;
}
.ff-image-preview-v2__view-controls,
.ff-image-preview-v2__header-end {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.ff-image-preview-v2__header-end { justify-content: flex-end; }
.ff-image-preview-v2__view-controls .btn { white-space: nowrap; }
.ff-image-preview-v2__view-controls .btn.is-active {
    border-color: var(--accent-color, #367bf5);
    background: color-mix(in srgb, var(--accent-color, #367bf5) 12%, var(--surface, #fff));
}
.ff-image-preview-v2__heading { overflow: hidden; }
.ff-image-preview-v2__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ff-image-preview-v2__footer {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 6px 10px;
}
.ff-image-preview-v2__footer > * { min-width: 0; }
.ff-image-preview-v2__footer .ff-image-preview-v2__details { flex: 1 1 auto; }
.ff-image-preview-v2__footer .ff-image-preview-v2__navigation,
.ff-image-preview-v2__footer .ff-image-preview-v2__actions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 5px;
}
.ff-image-preview-v2__position { min-width: 48px; font-weight: 700; white-space: nowrap; }
@media (max-width: 1000px) {
    .ff-image-preview-v2__header .ff-image-preview-v2__source,
    .ff-image-preview-v2__header .ff-image-preview-v2__size { display: none; }
    .ff-image-preview-v2__view-controls .btn { font-size: 12px; padding: 5px; }
}
@media (max-width: 720px) {
    .ff-image-preview-v2__footer .ff-image-preview-v2__actions .btn span { display: none; }
    .ff-image-preview-v2__footer .ff-image-preview-v2__actions .btn { min-width: 28px; }
    .ff-image-preview-v2__footer { gap: 4px; }
}
