/* Base gallery styles */
.wp-block-gallery-slider img,
.wpg-slider img {
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.wpg-slider img:hover {
    opacity: 0.8;
}

/* Modal styles */
.wpg-modal {
    display: none;
    position: fixed;
    z-index: 1000000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.wpg-modal.is-visible {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
}

/* Modal content container */
.wpg-modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.wpg-slide {
    flex: 0 0 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

.wpg-modal-image {
    max-width: calc(100% - 40px);
    max-height: calc(100% - 40px);
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Navigation buttons */
.wpg-close,
.wpg-prev,
.wpg-next {
    background-color: rgba(50, 50, 50, 0.5) !important;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 30px;
    position: absolute;
    transition: all 0.3s ease;
    padding: 12px 15px;
    border-radius: 50%;
    user-select: none;
    -webkit-user-select: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.wpg-close:hover,
.wpg-prev:hover,
.wpg-next:hover {
    background-color: rgba(50, 50, 50, 0.9) !important;
}

.wpg-close {
    top: 20px;
    right: 20px;
    z-index: 1;
    font-size: 32px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.8) !important;
    border: 3px solid rgba(255, 255, 255, 0.61) !important;
    color: #fff !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.wpg-prev,
.wpg-next {
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wpg-prev {
    left: 20px;
}

.wpg-next {
    right: 20px;
}

.wpg-prev:disabled,
.wpg-next:disabled {
    cursor: not-allowed;
    opacity: 0.3;
    pointer-events: none;
}

/* Loading state */
.wpg-modal-image {
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Focus styles for accessibility */
.wpg-close:focus,
.wpg-prev:focus,
.wpg-next:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Responsive design */
@media (max-width: 768px) {
    .wpg-close,
    .wpg-prev,
    .wpg-next {
        font-size: 20px;
        padding: 8px 12px;
    }
    
    .wpg-close {
        width: 40px;
        height: 40px;
        top: 15px;
        right: 15px;
    }
    
    .wpg-prev,
    .wpg-next {
        width: 48px;
        height: 48px;
    }
    
    .wpg-prev {
        left: 15px;
    }
    
    .wpg-next {
        right: 15px;
    }
    
    .wpg-modal-image {
        max-width: calc(100% - 20px);
        max-height: calc(100% - 20px);
    }
    
    .wpg-slide {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .wpg-close,
    .wpg-prev,
    .wpg-next {
        font-size: 18px;
    }
    
    .wpg-close {
        width: 36px;
        height: 36px;
        top: 10px;
        right: 10px;
    }
    
    .wpg-prev,
    .wpg-next {
        width: 44px;
        height: 44px;
    }
    
    .wpg-prev {
        left: 10px;
    }
    
    .wpg-next {
        right: 10px;
    }
}

/* Performance optimizations */
.wpg-modal * {
    box-sizing: border-box;
}

.wpg-modal-content {
    transform: translateZ(0); /* Enable hardware acceleration */
}

/* Prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
    .wpg-modal,
    .wpg-modal-content,
    .wpg-close,
    .wpg-prev,
    .wpg-next,
    .wpg-modal-image {
        transition: none;
        animation: none;
    }
}