/* Custom Lightbox Styles */
.ksm-lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ksm-lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ksm-lightbox.fade-in {
    opacity: 1;
}

.ksm-lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ksm-lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.ksm-lightbox.fade-in .ksm-lightbox-image {
    transform: scale(1);
}

.ksm-lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: #ffffff;
    cursor: pointer;
    background: none;
    border: none;
    z-index: 10001;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, color 0.2s ease;
    line-height: 1;
    padding: 0;
}

.ksm-lightbox-close:hover {
    color: #f1f1f1;
    transform: rotate(90deg);
}

.ksm-lightbox-close:focus {
    outline: 2px solid #ffffff;
    outline-offset: 4px;
}

.ksm-lightbox-prev,
.ksm-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 40px;
    color: #ffffff;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10001;
    user-select: none;
}

.ksm-lightbox-prev:hover,
.ksm-lightbox-next:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-50%) scale(1.1);
}

.ksm-lightbox-prev:focus,
.ksm-lightbox-next:focus {
    outline: 2px solid #ffffff;
    outline-offset: 4px;
}

.ksm-lightbox-prev {
    left: 30px;
}

.ksm-lightbox-next {
    right: 30px;
}

.ksm-lightbox-caption {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #ffffff;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 4px;
    max-width: 80%;
    text-align: center;
    font-size: 16px;
    z-index: 10001;
}

.ksm-lightbox-counter {
    position: absolute;
    top: 20px;
    left: 30px;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    z-index: 10001;
}

.ksm-lightbox-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff;
    font-size: 18px;
}

.ksm-lightbox-spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #ffffff;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .ksm-lightbox-close {
        top: 10px;
        right: 10px;
        font-size: 30px;
        width: 40px;
        height: 40px;
    }

    .ksm-lightbox-prev,
    .ksm-lightbox-next {
        width: 50px;
        height: 50px;
        font-size: 30px;
    }

    .ksm-lightbox-prev {
        left: 10px;
    }

    .ksm-lightbox-next {
        right: 10px;
    }

    .ksm-lightbox-caption {
        bottom: 10px;
        font-size: 14px;
        padding: 8px 15px;
        max-width: 90%;
    }

    .ksm-lightbox-counter {
        top: 10px;
        left: 10px;
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* Prevent body scroll when lightbox is open */
body.ksm-lightbox-open {
    overflow: hidden;
}

/* Accessibility improvements */
.ksm-lightbox-close:focus-visible,
.ksm-lightbox-prev:focus-visible,
.ksm-lightbox-next:focus-visible {
    outline: 3px solid #ffffff;
    outline-offset: 4px;
}
