/* Messenger photo viewer (js/addons/sd_messaging_system/photo_viewer.js). Shared by storefront and backend. */
.mb-pv {
    position: fixed;
    inset: 0;
    z-index: 100050;
    font-family: 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', Arial, sans-serif;
    color: #1d2939;
}

.mb-pv[hidden] {
    display: none !important;
}

.mb-pv__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(16, 24, 40, 0.62);
}

.mb-pv__window {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    flex-direction: column;
    width: min(72rem, calc(100vw - 4rem));
    height: min(54rem, calc(100vh - 4rem));
    overflow: hidden;
    border-radius: 0.75rem;
    background: #fff;
    box-shadow: 0 1.5rem 3rem rgba(16, 24, 40, 0.28);
    transform: translate(-50%, -50%);
}

.mb-pv.is-maximized .mb-pv__window {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
}

.mb-pv__head {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 3.25rem;
    padding: 0.375rem 0.5rem 0.375rem 1.25rem;
    border-bottom: 1px solid #eaecf0;
}

.mb-pv__meta {
    display: flex;
    flex: 1 1 auto;
    align-items: baseline;
    gap: 0.5rem;
    min-width: 0;
}

.mb-pv__name {
    overflow: hidden;
    font-size: 0.9375rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mb-pv__date,
.mb-pv__count {
    flex: 0 0 auto;
    color: #667085;
    font-size: 0.8125rem;
    white-space: nowrap;
}

.mb-pv__count:not(:empty)::before {
    content: "·";
    margin-right: 0.5rem;
}

.mb-pv__mini-thumb {
    display: none;
}

.mb-pv__win,
.mb-pv__tools {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.25rem;
}

.mb-pv__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: #344054;
    cursor: pointer;
}

.mb-pv__btn svg,
.mb-pv__menu-item svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mb-pv__btn:hover:not(:disabled),
.mb-pv__btn[aria-pressed="true"],
.mb-pv__btn[aria-expanded="true"] {
    background: #f2f4f7;
    color: #101828;
}

.mb-pv__btn:focus-visible,
.mb-pv__menu-item:focus-visible,
.mb-pv__cell:focus-visible {
    outline: 2px solid #204287;
    outline-offset: 2px;
}

.mb-pv__btn:disabled {
    color: #d0d5dd;
    cursor: default;
}

.mb-pv__btn[data-pv-action="more"] svg {
    stroke-width: 3.25;
}

.mb-pv__btn--win svg {
    width: 1rem;
    height: 1rem;
}

.mb-pv__stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    background: #f4f4f5;
    cursor: default;
    touch-action: none;
    user-select: none;
}

.mb-pv__stage.is-zoomed {
    cursor: grab;
}

.mb-pv__stage.is-panning {
    cursor: grabbing;
}

.mb-pv__img {
    position: absolute;
    top: 50%;
    left: 50%;
    max-width: none !important;
    max-height: none !important;
    opacity: 0;
    transform-origin: center center;
    transition: opacity 0.12s ease;
    will-change: transform;
}

.mb-pv__img.is-ready {
    opacity: 1;
}

.mb-pv__status {
    position: absolute;
    top: 50%;
    left: 50%;
    display: none;
    padding: 0.5rem 0.875rem;
    border-radius: 999px;
    background: rgba(16, 24, 40, 0.72);
    color: #fff;
    font-size: 0.8125rem;
    transform: translate(-50%, -50%);
}

.mb-pv__status.is-visible {
    display: block;
}

.mb-pv__nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 0.25rem 0.75rem rgba(16, 24, 40, 0.18);
    transform: translateY(-50%);
}

.mb-pv__nav:hover:not(:disabled) {
    background: #fff;
}

.mb-pv__nav:disabled {
    visibility: hidden;
}

.mb-pv__nav--prev {
    left: 1rem;
}

.mb-pv__nav--next {
    right: 1rem;
}

.mb-pv__nav svg {
    width: 1.5rem;
    height: 1.5rem;
    stroke-width: 2;
}

.mb-pv__grid {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
    align-content: start;
    gap: 0.5rem;
    overflow-y: auto;
    padding: 1rem;
    background: #fff;
}

.mb-pv__grid[hidden] {
    display: none;
}

.mb-pv__cell {
    position: relative;
    aspect-ratio: 1 / 1;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0.5rem;
    background: #f2f4f7;
    cursor: pointer;
}

.mb-pv__cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mb-pv__cell.is-current {
    box-shadow: inset 0 0 0 3px #204287;
}

.mb-pv__cell.is-current img {
    opacity: 0.85;
}

.mb-pv__bar {
    position: relative;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 3.5rem;
    padding: 0.5rem 0.75rem;
    border-top: 1px solid #eaecf0;
}

.mb-pv__divider {
    width: 1px;
    height: 1.25rem;
    margin: 0 0.25rem;
    background: #eaecf0;
}

.mb-pv__menu {
    position: absolute;
    right: 0.75rem;
    bottom: calc(100% + 0.25rem);
    z-index: 5;
    min-width: 11rem;
    padding: 0.375rem;
    border: 1px solid #eaecf0;
    border-radius: 0.75rem;
    background: #fff;
    box-shadow: 0 0.75rem 1.5rem rgba(16, 24, 40, 0.16);
}

.mb-pv__menu[hidden] {
    display: none;
}

.mb-pv__menu-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    min-height: 2.5rem;
    margin: 0;
    padding: 0 0.75rem;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: #1d2939;
    font: inherit;
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
}

.mb-pv__menu-item:hover {
    background: #f2f4f7;
}

.mb-pv__toast {
    position: absolute;
    bottom: 4.5rem;
    left: 50%;
    z-index: 6;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: rgba(16, 24, 40, 0.88);
    color: #fff;
    font-size: 0.8125rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%);
    transition: opacity 0.15s ease;
}

.mb-pv__toast.is-visible {
    opacity: 1;
}

/* Minimized: a small bar in the bottom-right corner; the page stays usable. */
.mb-pv.is-minimized {
    inset: auto 1.25rem 1.25rem auto;
}

.mb-pv.is-minimized .mb-pv__backdrop,
.mb-pv.is-minimized .mb-pv__stage,
.mb-pv.is-minimized .mb-pv__bar,
.mb-pv.is-minimized .mb-pv__date,
.mb-pv.is-minimized .mb-pv__count {
    display: none;
}

.mb-pv.is-minimized .mb-pv__window {
    position: static;
    width: 20rem;
    height: auto;
    border-radius: 0.75rem;
    transform: none;
    cursor: pointer;
}

.mb-pv.is-minimized .mb-pv__head {
    border-bottom: 0;
    padding-left: 0.5rem;
}

.mb-pv.is-minimized .mb-pv__meta {
    align-items: center;
}

.mb-pv.is-minimized .mb-pv__mini-thumb {
    display: block;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.375rem;
    object-fit: cover;
}

.mb-pv__print-frame {
    position: fixed;
    right: 0;
    bottom: 0;
    width: 0;
    height: 0;
    border: 0;
}

/* "View in conversation" target highlight. */
.mb-pv-highlight .ty-sd_messaging_system-all {
    animation: mbPvHighlight 2.4s ease;
}

@keyframes mbPvHighlight {
    0%, 60% { box-shadow: 0 0 0 3px rgba(32, 66, 135, 0.55); }
    100% { box-shadow: 0 0 0 0 rgba(32, 66, 135, 0); }
}

@media (max-width: 768px) {
    .mb-pv__window,
    .mb-pv.is-maximized .mb-pv__window {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
    }

    .mb-pv__btn[data-pv-action="minimize"],
    .mb-pv__btn[data-pv-action="maximize"] {
        display: none;
    }

    .mb-pv__btn {
        width: 2.75rem;
        height: 2.75rem;
    }

    .mb-pv__head {
        padding-left: 1rem;
    }

    .mb-pv__meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
    }

    .mb-pv__count:not(:empty)::before {
        content: none;
    }

    .mb-pv__bar {
        padding: 0.375rem 0.25rem max(0.375rem, env(safe-area-inset-bottom));
    }

    .mb-pv__tools {
        gap: 0;
    }

    .mb-pv__divider {
        display: none;
    }

    .mb-pv__nav {
        width: 2.5rem;
        height: 2.5rem;
    }

    .mb-pv__nav--prev {
        left: 0.5rem;
    }

    .mb-pv__nav--next {
        right: 0.5rem;
    }

    .mb-pv__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.25rem;
        padding: 0.25rem;
    }
}
