/**
 * Kawai Gallery Frontend Styles
 */

/* Gallery Container */
.kawai-gallery {
    display: grid;
    grid-template-columns: repeat(var(--kawai-columns, 4), 1fr);
    gap: var(--kawai-gap, 10px);
    margin: 20px 0;
}

/* Gallery Item */
.kawai-gallery-item {
    position: relative;
    display: block;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
    text-decoration: none;
}

.kawai-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.kawai-gallery-item:hover img {
    transform: scale(1.1);
}

/* Overlay */
.kawai-gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 142, 255, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.kawai-gallery-overlay .dashicons {
    color: #fff;
    font-size: 32px;
    width: 32px;
    height: 32px;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.kawai-gallery-item:hover .kawai-gallery-overlay {
    background: rgba(255, 142, 255, 0.4);
}

.kawai-gallery-item:hover .kawai-gallery-overlay .dashicons {
    opacity: 1;
    transform: scale(1);
}

/* Lightbox */
.kawai-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.kawai-lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

.kawai-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.kawai-lightbox-content img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.kawai-lightbox-caption {
    text-align: center;
    color: #fff;
    padding: 15px;
    font-size: 14px;
    opacity: 0.9;
}

.kawai-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    transition: background 0.3s, transform 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000000;
}

.kawai-lightbox-close:hover {
    background: rgba(255, 142, 255, 0.5);
    transform: rotate(90deg);
}

/* Navigation */
.kawai-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kawai-lightbox-nav:hover {
    background: rgba(255, 142, 255, 0.5);
}

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

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

/* Counter */
.kawai-lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 14px;
    opacity: 0.7;
}

/* Error & Empty states */
.kawai-gallery-error,
.kawai-gallery-empty {
    padding: 40px;
    text-align: center;
    background: #f0f0f1;
    border-radius: 8px;
    color: #666;
}

/* Responsive */
@media (max-width: 1024px) {
    .kawai-gallery {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .kawai-gallery {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .kawai-lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .kawai-lightbox-prev {
        left: 10px;
    }
    
    .kawai-lightbox-next {
        right: 10px;
    }
}

@media (max-width: 480px) {
    .kawai-gallery {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 5px !important;
    }
    
    .kawai-gallery-item {
        border-radius: 4px;
    }
}
