/**
 * Image Lightbox Styles for GSWPTS
 * Provides a clean, responsive lightbox for viewing images
 */

/* Prevent body scrolling when lightbox is open */
body.swptls-lightbox-open {
    overflow: hidden;
}

/* Lightbox overlay */
.swptls-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* Lightbox container */
.swptls-lightbox-container {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

/* Lightbox header - positioned outside the white container */
.swptls-lightbox-header {
    position: fixed;
    top: 0px;
    right: 0px;
    z-index: 10;
}

/* Close button */
.swptls-lightbox-close {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #333;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    padding: inherit;
}

.swptls-lightbox-close:hover {
    background: rgba(255, 255, 255, 1);
    color: #333;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.swptls-lightbox-close:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Lightbox content */
.swptls-lightbox-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

/* Lightbox image */
.swptls-lightbox-content .swptls-lightbox-display-image {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
}

/* Loading state */
.swptls-lightbox-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    color: #666;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Spinner animation */
.swptls-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: swptls-spin 1s linear infinite;
}

@keyframes swptls-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Table image cursor indication */
.swptls-lightbox-image {
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.cell_div .swptls-lightbox-image:hover {
    opacity: 0.8;
    transform: scale(1.02);
}

/* Responsive design */
@media (max-width: 768px) {
    .swptls-lightbox-container {
        max-width: 98vw;
        max-height: 98vh;
        margin: 1vh;
    }

    .swptls-lightbox-header {
        top: 15px;
        right: 15px;
    }

    .swptls-lightbox-close {
        width: 40px;
        height: 40px;
    }

    .swptls-lightbox-content .swptls-lightbox-display-image {
        max-height: 85vh;
    }
}

@media (max-width: 480px) {
    .swptls-lightbox-container {
        border-radius: 4px;
    }

    .swptls-lightbox-header {
        top: 10px;
        right: 10px;
    }

    .swptls-lightbox-close {
        width: 36px;
        height: 36px;
    }

    .swptls-lightbox-close svg {
        width: 18px;
        height: 18px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .swptls-lightbox-overlay {
        background-color: rgba(0, 0, 0, 0.95);
    }

    .swptls-lightbox-close {
        background: #fff;
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {

    .swptls-lightbox-image,
    .swptls-lightbox-close,
    .swptls-spinner {
        transition: none;
        animation: none;
    }

    .swptls-lightbox-image:hover {
        transform: none;
    }
}

/* Focus management for accessibility */
.swptls-lightbox-overlay:focus-within .swptls-lightbox-close {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Print styles - hide lightbox */
@media print {
    .swptls-lightbox-overlay {
        display: none !important;
    }
}