/**
 * M-Utils Gallery Lightbox Styles
 */

/* Interactive hints on gallery images */
.wp-block-gallery .wp-block-image img,
.wp-block-gallery figure img,
.wp-block-gallery img,
.gallery .gallery-item img,
.gallery-icon img,
.wp-block-image.has-custom-border img,
.mutils-lightbox-trigger {
    cursor: zoom-in !important;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s ease, opacity 0.22s ease;
}

.wp-block-gallery .wp-block-image:hover img,
.wp-block-gallery figure:hover img,
.gallery .gallery-item:hover img {
    opacity: 0.92;
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}

/* Prevent body scrolling when lightbox is open */
body.mutils-lightbox-open {
    overflow: hidden !important;
    touch-action: none;
}

/* Lightbox Container */
.mutils-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

.mutils-lightbox.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Backdrop */
.mutils-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 29, 0.93);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
}

/* Top bar */
.mutils-lightbox-topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 20;
    pointer-events: none;
}

.mutils-lightbox-counter {
    pointer-events: auto;
    color: #f1f5f9;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 5px 14px;
    border-radius: 20px;
    backdrop-filter: blur(8px);
    user-select: none;
}

.mutils-lightbox-tools {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mutils-lightbox-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    cursor: pointer;
    outline: none;
    padding: 0;
    transition: all 0.18s ease;
    backdrop-filter: blur(8px);
}

.mutils-lightbox-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.08);
    color: #ffffff;
}

.mutils-lightbox-btn:active {
    transform: scale(0.96);
}

/* Navigation arrows */
.mutils-lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    outline: none;
    padding: 0;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(8px);
    user-select: none;
}

.mutils-lightbox-arrow:hover {
    background: rgba(255, 255, 255, 0.26);
    transform: translateY(-50%) scale(1.1);
    border-color: rgba(255, 255, 255, 0.35);
}

.mutils-lightbox-arrow:active {
    transform: translateY(-50%) scale(0.95);
}

.mutils-lightbox-prev {
    left: 20px;
}

.mutils-lightbox-next {
    right: 20px;
}

.mutils-lightbox-arrow.is-hidden {
    display: none !important;
}

/* Lightbox Content & Image */
.mutils-lightbox-content {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 90vw;
    max-height: 84vh;
    pointer-events: auto;
}

.mutils-lightbox-figure {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.mutils-lightbox-image {
    max-width: 90vw;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.08);
    transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    -webkit-user-drag: none;
}

.mutils-lightbox-image.is-loading {
    opacity: 0.3;
    transform: scale(0.98);
}

/* Caption bar */
.mutils-lightbox-caption {
    margin-top: 12px;
    max-width: 80vw;
    color: #e2e8f0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 13.5px;
    line-height: 1.4;
    text-align: center;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 6px 16px;
    border-radius: 20px;
    backdrop-filter: blur(8px);
    display: none;
}

.mutils-lightbox-caption.has-caption {
    display: block;
}

/* Spinner */
.mutils-lightbox-spinner {
    position: absolute;
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: #38bdf8;
    border-radius: 50%;
    animation: mutils-spinner 0.75s linear infinite;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.mutils-lightbox-spinner.is-active {
    opacity: 1;
}

@keyframes mutils-spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .mutils-lightbox-topbar {
        height: 54px;
        padding: 0 14px;
    }

    .mutils-lightbox-arrow {
        width: 42px;
        height: 42px;
    }

    .mutils-lightbox-prev {
        left: 8px;
    }

    .mutils-lightbox-next {
        right: 8px;
    }

    .mutils-lightbox-image {
        max-width: 94vw;
        max-height: 74vh;
    }
}
