/**
 * Gallery Lightbox Styles
 *
 * @package SolezadChild
 * @version 1.0.0
 */

/* Lightbox Container */
.soledad-gallery-lightbox {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.soledad-gallery-lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    animation: lightboxFadeIn 0.3s ease;
}

@keyframes lightboxFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Lightbox Content */
.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Lightbox Image */
.lightbox-image {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 85vh;
    display: block;
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: lightboxZoomIn 0.3s ease;
}

@keyframes lightboxZoomIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Loader */
.lightbox-loader {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
}

.lightbox-loader:after {
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    margin: 5px;
    border-radius: 50%;
    border: 3px solid #fff;
    border-color: #fff transparent #fff transparent;
    animation: lightboxLoader 1.2s linear infinite;
}

@keyframes lightboxLoader {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Caption */
.lightbox-caption {
    display: none;
    margin-top: 15px;
    padding: 10px 20px;
    color: #fff;
    font-size: 14px;
    text-align: center;
    max-width: 80%;
    line-height: 1.5;
}

/* Counter */
.lightbox-counter {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

/* Close Button */
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    background: none;
    border: none;
    color: #fff;
    font-size: 40px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    z-index: 100001;
    opacity: 0.8;
    transition: all 0.3s ease;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close:hover,
.lightbox-close:focus {
    opacity: 1;
    transform: scale(1.1);
    outline: none;
}

.lightbox-close:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Navigation Buttons */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #fff;
    font-size: 50px;
    font-weight: 300;
    cursor: pointer;
    user-select: none;
    opacity: 0.6;
    transition: all 0.3s ease;
    padding: 10px 15px;
    z-index: 100001;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-nav:hover,
.lightbox-nav:focus {
    opacity: 1;
    outline: none;
}

.lightbox-nav:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.lightbox-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

/* Gallery Block - Add padding */
.wp-block-gallery {
    padding-bottom: 20px;
}

/* Gallery Images - Make them clickable */
.wp-block-gallery img {
    cursor: pointer;
    transition: all 0.3s ease;
}

.wp-block-gallery img:hover {
    opacity: 0.85;
    transform: scale(1.02);
}

/* Focus styles for accessibility */
.wp-block-gallery img:focus {
    outline: 3px solid #007cba;
    outline-offset: 2px;
}

/* Mobile Styles */
@media (max-width: 768px) {
    .lightbox-close {
        top: 10px;
        right: 10px;
        font-size: 30px;
        width: 35px;
        height: 35px;
    }

    .lightbox-nav {
        font-size: 35px;
        padding: 5px 10px;
    }

    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }

    .lightbox-counter {
        bottom: -30px;
        font-size: 12px;
    }

    .lightbox-caption {
        font-size: 12px;
        padding: 8px 15px;
        max-width: 90%;
    }

    .lightbox-image {
        max-height: 80vh;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .lightbox-nav {
        font-size: 30px;
        background-color: rgba(0, 0, 0, 0.5);
        border-radius: 50%;
        width: 40px;
        height: 40px;
        padding: 0;
    }

    .lightbox-prev {
        left: 5px;
    }

    .lightbox-next {
        right: 5px;
    }
}

/* Print Styles */
@media print {
    .soledad-gallery-lightbox {
        display: none !important;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .soledad-gallery-lightbox,
    .lightbox-image,
    .lightbox-close,
    .lightbox-nav,
    .wp-block-gallery img {
        animation: none !important;
        transition: none !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .lightbox-close,
    .lightbox-nav {
        outline: 1px solid #fff;
    }

    .lightbox-close:focus,
    .lightbox-nav:focus {
        outline: 3px solid #fff;
    }
}