/**
 * WP Zoomable Images - Frontend Styles
 */

/* Zoomable Image Container */
.wpzi-zoomable {
    position: relative;
    display: inline-block;
    overflow: hidden;
    cursor: zoom-in;
    max-width: 100%;
    --zoom-level: 2; /* Default zoom level */
}

.wpzi-zoomable img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.3s ease;
}

/* Hover Zoom - Zoom to full size */
.wpzi-zoomable.wpzi-hover:hover {
    overflow: visible;
    z-index: 999;
}

.wpzi-zoomable.wpzi-hover:hover img {
    transform: scale(var(--zoom-scale, 2));
    transform-origin: center center;
    max-width: var(--natural-width, none);
    max-height: var(--natural-height, none);
}

/* Click Zoom - Zoom to full size */
.wpzi-zoomable.wpzi-click.active {
    overflow: visible;
    z-index: 999;
}

.wpzi-zoomable.wpzi-click.active img {
    transform: scale(var(--zoom-scale, 2));
    transform-origin: center center;
    max-width: var(--natural-width, none);
    max-height: var(--natural-height, none);
}

/* Both Hover & Click - Zoom to full size */
.wpzi-zoomable.wpzi-both:hover,
.wpzi-zoomable.wpzi-both.active {
    overflow: visible;
    z-index: 999;
}

.wpzi-zoomable.wpzi-both:hover img,
.wpzi-zoomable.wpzi-both.active img {
    transform: scale(var(--zoom-scale, 2));
    transform-origin: center center;
    max-width: var(--natural-width, none);
    max-height: var(--natural-height, none);
}

/* Zoom Icon Overlay */
.wpzi-zoomable::after {
    content: '';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cpath d='M21 21l-4.35-4.35'%3E%3C/path%3E%3C/svg%3E");
    background-size: 18px 18px;
    background-position: center;
    background-repeat: no-repeat;
}

.wpzi-zoomable:hover::after {
    opacity: 1;
}

/* Gallery Styles */
.wpzi-gallery {
    display: grid;
    grid-gap: 15px;
    margin: 20px 0;
}

.wpzi-gallery-columns-1 {
    grid-template-columns: 1fr;
}

.wpzi-gallery-columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.wpzi-gallery-columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.wpzi-gallery-columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.wpzi-gallery-columns-5 {
    grid-template-columns: repeat(5, 1fr);
}

.wpzi-gallery-columns-6 {
    grid-template-columns: repeat(6, 1fr);
}

.wpzi-gallery-item {
    position: relative;
    overflow: hidden;
}

.wpzi-gallery-item img {
    width: 100%;
    height: auto;
    display: block;
}

/* Lightbox Styles */
.wpzi-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 999999;
    cursor: zoom-out;
}

.wpzi-lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.wpzi-lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.wpzi-lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1000000;
    line-height: 1;
}

.wpzi-lightbox-close:hover {
    opacity: 0.7;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .wpzi-gallery-columns-3,
    .wpzi-gallery-columns-4,
    .wpzi-gallery-columns-5,
    .wpzi-gallery-columns-6 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .wpzi-zoomable:hover img,
    .wpzi-zoomable.active img {
        transform: scale(var(--zoom-level, 1.5));
    }
}

@media (max-width: 480px) {
    .wpzi-gallery-columns-2,
    .wpzi-gallery-columns-3,
    .wpzi-gallery-columns-4,
    .wpzi-gallery-columns-5,
    .wpzi-gallery-columns-6 {
        grid-template-columns: 1fr;
    }
}

/* Prevent zoom on small images (avatars, icons) */
.wpzi-zoomable.avatar,
.wpzi-zoomable.icon,
.wpzi-zoomable.emoji {
    cursor: default;
}

.wpzi-zoomable.avatar:hover img,
.wpzi-zoomable.icon:hover img,
.wpzi-zoomable.emoji:hover img {
    transform: none;
}

/* Tile-based zoom styles */
.wpzi-tiles {
    width: 100%;
    height: 500px;
    min-height: 400px;
}

.wpzi-openseadragon-viewer {
    width: 100%;
    height: 100%;
    background: #000;
}

.wpzi-tiles .wpzi-openseadragon-viewer {
    border: 1px solid #ddd;
    border-radius: 4px;
}

