/**
 * Lightbox Styles - Bursa Urszulanki
 *
 * @package Bursa_Urszulanki
 */

/* Lightbox container */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-base, 300ms ease), visibility var(--transition-base, 300ms ease);
}

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

/* Dark overlay */
.lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    cursor: pointer;
}

/* Content wrapper */
.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Image wrapper */
.lightbox-image-wrapper {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Image */
.lightbox-image {
    max-width: 90vw;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--border-radius-md, 8px);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity var(--transition-base, 300ms ease);
}

.lightbox-image.is-loaded {
    opacity: 1;
}

/* Loading spinner */
.lightbox-spinner {
    position: absolute;
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    display: none;
    animation: lightbox-spin 0.8s linear infinite;
}

.lightbox-image-wrapper.is-loading .lightbox-spinner {
    display: block;
}

@keyframes lightbox-spin {
    to { transform: rotate(360deg); }
}

/* Close button */
.lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: background var(--transition-fast, 150ms ease), transform var(--transition-fast, 150ms ease);
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Navigation arrows */
.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: background var(--transition-fast, 150ms ease), transform var(--transition-fast, 150ms ease);
}

.lightbox-prev {
    left: 16px;
}

.lightbox-next {
    right: 16px;
}

.lightbox-prev:hover,
.lightbox-prev:focus-visible,
.lightbox-next:hover,
.lightbox-next:focus-visible {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

/* Counter */
.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
    font-family: var(--font-body, 'Open Sans', sans-serif);
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 14px;
    border-radius: 20px;
    letter-spacing: 0.05em;
    user-select: none;
}

/* Focus outline for all interactive elements */
.lightbox-close:focus-visible,
.lightbox-prev:focus-visible,
.lightbox-next:focus-visible {
    outline: 2px solid var(--color-accent, #d4af37);
    outline-offset: 2px;
}

/* Responsive adjustments */
@media (max-width: 767px) {
    .lightbox-image-wrapper {
        max-width: 96vw;
        max-height: 80vh;
    }

    .lightbox-image {
        max-width: 96vw;
        max-height: 80vh;
        border-radius: var(--border-radius-sm, 4px);
    }

    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
    }

    .lightbox-prev {
        left: 8px;
    }

    .lightbox-next {
        right: 8px;
    }

    .lightbox-close {
        top: 10px;
        right: 10px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .lightbox,
    .lightbox-image {
        transition: none;
    }

    .lightbox-spinner {
        animation-duration: 1.5s;
    }
}
