/* ====================================================
   Image Viewer — просмотр изображений поверх UI
   ==================================================== */

.iv-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.iv-overlay--open {
    opacity: 1;
    pointer-events: auto;
}

/* Тёмный фон */
.iv-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.90);
}

/* Картинка и подпись */
.iv-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: calc(100vw - 130px);
    max-height: calc(100vh - 80px);
    max-height: calc(100dvh - 80px);
}

.iv-img {
    max-width: 100%;
    max-height: calc(100vh - 130px);
    max-height: calc(100dvh - 130px);
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.7);
    display: block;
    transition: opacity 0.15s;
    user-select: none;
}

.iv-img--loading {
    opacity: 0;
}

.iv-name {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    margin-top: 12px;
    text-align: center;
    max-width: 480px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Счётчик сверху по центру */
.iv-counter {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.65);
    font-size: 13px;
    font-weight: 600;
    z-index: 2;
    pointer-events: none;
}

/* Кнопка закрытия */
.iv-close {
    position: fixed;
    top: 14px;
    right: 16px;
    z-index: 2;
    background: rgba(255, 255, 255, 0.13);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: background 0.15s;
}

.iv-close:hover {
    background: rgba(255, 255, 255, 0.28);
}

/* Стрелки навигации */
.iv-prev,
.iv-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    background: rgba(255, 255, 255, 0.13);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: background 0.15s;
}

.iv-prev { left: 14px; }
.iv-next { right: 14px; }

.iv-prev:hover,
.iv-next:hover {
    background: rgba(255, 255, 255, 0.28);
}

/* Мобильные */
@media (max-width: 600px) {
    .iv-content {
        max-width: calc(100vw - 20px);
    }
    .iv-prev { left: 6px; width: 40px; height: 40px; }
    .iv-next { right: 6px; width: 40px; height: 40px; }
}
