/* Custom Smooth Lightbox */
.custom-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s;
}

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

/* Overlay */
.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    transition: opacity 0.4s ease;
}

/* Content */
.lightbox-content {
    position: relative;
    z-index: 2;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Image */
.lightbox-image {
    max-width: 90vw;
    max-height: calc(100vh - 80px);
    width: auto;
    height: auto;
    object-fit: contain;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.lightbox-image.loaded {
    opacity: 1;
    transform: scale(1);
}

/* Close button */
.lightbox-close {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #fff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg) scale(1.1);
}

/* Navigation buttons */
.lightbox-prev,
.lightbox-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #fff;
    font-size: 40px;
                    padding-bottom: 0.35%;
    cursor: pointer;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.lightbox-prev {
    left: 30px;
}

.lightbox-next {
    right: 30px;
}

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

.lightbox-prev:active,
.lightbox-next:active {
    transform: translateY(-50%) scale(0.95);
}

/* Counter */
.lightbox-counter {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    color: #fff;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    z-index: 3;
    backdrop-filter: blur(10px);
    display: none;
}

/* Title */
.lightbox-title {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    font-weight: 400;
    padding: 15px 20px;
    z-index: 3;
    backdrop-filter: blur(10px);
    display: none;
    text-align: center;
    line-height: 1.4;
}

/* Loader */
.lightbox-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.custom-lightbox.loading .lightbox-loader {
    opacity: 1;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Touch/Mobile support */
.lightbox-image {
    touch-action: pan-x pan-y pinch-zoom;
}

/* Responsive */
@media (max-width: 768px) {
    .lightbox-image {
        max-width: 95vw;
        max-height: calc(100vh - 70px);
    }

    .lightbox-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 24px;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 24px;
        background: rgba(255, 255, 255, 0.15);
    }

    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }

    .lightbox-counter {
        top: 10px;
        left: 10px;
        font-size: 12px;
        padding: 6px 12px;
    }

    .lightbox-title {
        font-size: 14px;
        padding: 12px 15px;
    }
}

@media (max-width: 480px) {
    .lightbox-image {
        max-height: calc(100vh - 60px);
    }

    .lightbox-prev,
    .lightbox-next {
        width: 35px;
        height: 35px;
        font-size: 20px;
        padding-bottom: 0.35%;
    }

    .lightbox-close {
        width: 36px;
        height: 36px;
        font-size: 22px;
    }

    .lightbox-title {
        font-size: 13px;
        padding: 10px 12px;
    }
}

/* Smooth entrance animation */
.custom-lightbox.active .lightbox-close {
    animation: fadeInDown 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.1s both;
}

.custom-lightbox.active .lightbox-prev {
    animation: fadeInLeft 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.2s both;
}

.custom-lightbox.active .lightbox-next {
    animation: fadeInRight 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.2s both;
}

.custom-lightbox.active .lightbox-counter {
    animation: fadeInDown 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.3s both;
}

.custom-lightbox.active .lightbox-title {
    animation: fadeInUpFromBottom 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.35s both;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes fadeInUpFromBottom {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
