/* لایتباکس سفارشی برای گالری محصولات */
.custom-lightbox {
    display: none;
    position: fixed;
    z-index: 99999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.custom-lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.custom-lightbox__container {
    position: relative;
    width: 90%;
    height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-lightbox__content {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-lightbox__image {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.custom-lightbox__image.loaded {
    opacity: 1;
    transform: scale(1);
}

/* دکمه بستن */
.custom-lightbox__close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    transition: all 0.3s ease;
    z-index: 100000;
}

.custom-lightbox__close:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg);
}

/* دکمه‌های ناوبری */
.custom-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 24px;
    transition: all 0.3s ease;
    z-index: 10;
}

.custom-lightbox__nav:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.custom-lightbox__nav--prev {
    right: 20px;
}

.custom-lightbox__nav--next {
    left: 20px;
}

.custom-lightbox__nav.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* شمارنده تصاویر */
.custom-lightbox__counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10;
    direction: ltr;
}

/* تامبنیل‌ها */
.custom-lightbox__thumbnails {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    max-width: 90%;
    overflow-x: auto;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    z-index: 10;
}

.custom-lightbox__thumbnails::-webkit-scrollbar {
    height: 5px;
}

.custom-lightbox__thumbnails::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
}

.custom-lightbox__thumbnails::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 5px;
}

.custom-lightbox__thumbnail {
    width: 60px;
    height: 60px;
    min-width: 60px;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    border-radius: 5px;
    overflow: hidden;
}

.custom-lightbox__thumbnail:hover {
    opacity: 0.8;
}

.custom-lightbox__thumbnail.active {
    opacity: 1;
    border-color: #fff;
}

.custom-lightbox__thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* لودینگ */
.custom-lightbox__loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 5;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* زوم */
.custom-lightbox__zoom-controls {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 10px;
    z-index: 10;
}

.custom-lightbox__zoom-btn {
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    transition: all 0.3s ease;
}

.custom-lightbox__zoom-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.custom-lightbox__image-wrapper {
    position: relative;
    overflow: hidden;
    cursor: grab;
}

.custom-lightbox__image-wrapper.dragging {
    cursor: grabbing;
}

/* موبایل */
@media (max-width: 768px) {
    .custom-lightbox__close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .custom-lightbox__nav {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .custom-lightbox__nav--prev {
        left: 10px;
    }
    
    .custom-lightbox__nav--next {
        right: 10px;
    }
    
    .custom-lightbox__thumbnails {
        bottom: 60px;
        padding: 5px;
    }
    
    .custom-lightbox__thumbnail {
        width: 50px;
        height: 50px;
        min-width: 50px;
    }
    
    .custom-lightbox__counter {
        bottom: 10px;
        font-size: 12px;
        padding: 8px 16px;
    }
    
    .custom-lightbox__zoom-controls {
        display: none;
    }
}

/* انیمیشن ورود و خروج */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.custom-lightbox.closing {
    animation: fadeOut 0.3s ease forwards;
}
