/* ==================================== */
/* IMAGE PREVIEW MODAL (reusable)        */
/* Black background, zoom in/out via     */
/* magnifying glass buttons, drag to pan */
/* once zoomed in, prev/next arrows +    */
/* "N / total" counter when the image    */
/* belongs to a group (carousel), and a  */
/* Bootstrap-blue Download button — all  */
/* three bottom controls always visible  */
/* in one horizontal row.                */
/* Use openImagePreview (from            */
/* image-preview.js) to trigger.         */
/* ==================================== */

#imagePreviewModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 999999;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#imagePreviewModal img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    cursor: default;
    transition: transform 0.15s ease;
    transform-origin: center center;
    user-select: none;
    -webkit-user-drag: none;
}

#imagePreviewModal img.zoomed {
    cursor: grab;
    transition: none; /* no lag while dragging */
}

#imagePreviewModal img.dragging {
    cursor: grabbing;
}

#imagePreviewModal .image-preview-close {
    position: absolute;
    top: 16px;
    right: 24px;
    color: #fff;
    font-size: 36px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
    z-index: 2;
}

/* --- Prev / Next round arrow buttons --- */
.image-preview-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: none;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: none; /* shown via JS only when the image belongs to a group */
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.image-preview-nav:hover {
    background: rgba(255,255,255,0.3);
}

.image-preview-prev { left: 16px; }
.image-preview-next { right: 16px; }

/* --- "N / total" counter --- */
.image-preview-counter {
    display: none; /* shown via JS only when the image belongs to a group */
    position: absolute;
    top: 16px;
    left: 18px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 15px;
    font-weight: 600;
    z-index: 2;
}

/* --- Bottom control row: always one horizontal line --- */
.image-preview-bottom-controls {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px;
    z-index: 2;
}

.image-preview-zoom-btn {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: none;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.image-preview-zoom-btn:hover {
    background: rgba(255,255,255,0.3);
}

.image-preview-zoom-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

/* --- Download button: Bootstrap-blue rectangular --- */
.image-preview-download-btn {
    background-color: #0d6efd;   /* Bootstrap "primary" blue */
    color: #fff;
    border: none;
    height: 46px;
    padding: 0 18px;
    border-radius: 6px;          /* Bootstrap's default button radius */
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.image-preview-download-btn:hover {
    background-color: #0b5ed7;   /* Bootstrap primary hover shade */
}

.image-preview-download-btn i {
    font-size: 15px;
}