/**
 * مودال گالری محصول — اسلاید، زوم، تمام‌صفحه
 */

.enhanced-gallery-modal {
    position: fixed;
    inset: 0;
    z-index: 100100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.92);
    opacity: 1;
    transition: opacity 0.25s ease;
    padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}

.enhanced-gallery-modal .enhanced-gallery-content {
    width: min(96vw, 1200px);
    height: min(92vh, 820px);
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    overflow: hidden;
    background: #111827;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

.enhanced-gallery-modal[data-theme="light"] {
    background: rgba(15, 23, 42, 0.88);
}

.enhanced-gallery-modal[data-theme="light"] .enhanced-gallery-content {
    background: #fff;
    color: #111827;
}

.enhanced-gallery-modal .gallery-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.enhanced-gallery-modal[data-theme="light"] .gallery-header {
    background: #f3f4f6;
    border-bottom-color: #e5e7eb;
}

.enhanced-gallery-modal .gallery-counter {
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
}

.enhanced-gallery-modal[data-theme="light"] .gallery-counter {
    color: #111827;
}

.enhanced-gallery-modal .gallery-header .gallery-controls {
    position: static;
    display: flex;
    gap: 8px;
}

.enhanced-gallery-modal .gallery-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.enhanced-gallery-modal[data-theme="light"] .gallery-btn {
    background: rgba(0, 0, 0, 0.06);
    color: #374151;
}

.enhanced-gallery-modal .gallery-btn:hover {
    background: rgba(249, 115, 22, 0.35);
    transform: scale(1.05);
}

.enhanced-gallery-modal .gallery-main-container {
    flex: 1;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    align-items: center;
    min-height: 0;
    overflow: hidden;
    background: #000;
}

.enhanced-gallery-modal .gallery-image-container {
    grid-column: 2;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    min-width: 0;
    cursor: zoom-in;
}

.enhanced-gallery-modal #mainGalleryImage {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
    user-select: none;
    -webkit-user-drag: none;
    transform-origin: center center;
}

/* حالت زوم — transform فقط با JS تنظیم می‌شود */
.enhanced-gallery-modal .gallery-image-container.zoomed {
    cursor: grab;
}
.enhanced-gallery-modal .gallery-image-container.zoomed #mainGalleryImage {
    cursor: grab;
}
.enhanced-gallery-modal .gallery-image-container.zoomed.dragging #mainGalleryImage {
    cursor: grabbing;
    transition: none;
}

.enhanced-gallery-modal .gallery-nav {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    transform: none;
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    pointer-events: auto;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.enhanced-gallery-modal .gallery-nav:hover {
    background: rgba(249, 115, 22, 0.55);
}

.enhanced-gallery-modal .gallery-nav.prev {
    grid-column: 1;
    justify-self: center;
}

.enhanced-gallery-modal .gallery-nav.next {
    grid-column: 3;
    justify-self: center;
}

.enhanced-gallery-modal .gallery-thumbnails-container {
    flex-shrink: 0;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.06);
}

.enhanced-gallery-modal .gallery-thumbnails {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: none;
}

.enhanced-gallery-modal .gallery-thumbnails::-webkit-scrollbar {
    display: none;
}

.enhanced-gallery-modal .gallery-thumbnail {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid transparent;
    opacity: 0.75;
    cursor: pointer;
    transition: opacity 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.enhanced-gallery-modal .gallery-thumbnail.active,
.enhanced-gallery-modal .gallery-thumbnail:hover {
    opacity: 1;
    border-color: #f97316;
    transform: scale(1.04);
}

.enhanced-gallery-modal .gallery-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.enhanced-gallery-modal .image-loader {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    font-size: 1.5rem;
}

.enhanced-gallery-modal .mobile-thumbnails-container {
    flex-shrink: 0;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.06);
}

.enhanced-gallery-modal .mobile-thumbnails {
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.enhanced-gallery-modal .mobile-thumb {
    flex: 1;
    max-width: 140px;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    border: 2px solid transparent;
}

.enhanced-gallery-modal .mobile-thumb:hover {
    border-color: #f97316;
}

.enhanced-gallery-modal .mobile-thumb img {
    width: 100%;
    height: 64px;
    object-fit: cover;
    display: block;
}

.enhanced-gallery-modal .thumb-label {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    padding: 4px 6px;
    font-size: 0.72rem;
    text-align: center;
    color: #fff;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
}

.enhanced-gallery-modal .mobile-indicators {
    display: none;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px 14px;
}

.enhanced-gallery-modal .indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    cursor: pointer;
}

.enhanced-gallery-modal .indicator.active {
    background: #f97316;
    transform: scale(1.2);
}

.enhanced-gallery-modal .desktop-only {
    display: block;
}

.enhanced-gallery-modal .mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .enhanced-gallery-modal {
        padding: 0;
    }

    .enhanced-gallery-modal .enhanced-gallery-content {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .enhanced-gallery-modal .desktop-only {
        display: none !important;
    }

    .enhanced-gallery-modal .mobile-only {
        display: block !important;
    }

    .enhanced-gallery-modal .mobile-indicators {
        display: flex !important;
    }

    .enhanced-gallery-modal .gallery-main-container {
        grid-template-columns: 40px minmax(0, 1fr) 40px;
    }

    .enhanced-gallery-modal .gallery-nav {
        width: 40px;
        height: 40px;
    }
}

/* کلیک‌پذیر بودن تصویر اصلی صفحه محصول */
.zinox-product-page .main-gallery #main-product-image {
    position: relative;
    z-index: 2;
    cursor: zoom-in;
}

.zinox-product-page .main-gallery .gallery-controls {
    z-index: 5;
    pointer-events: auto;
}

#installButton {
    display: none !important;
}

.zinox-product-page .main-gallery .gallery-control-btn {
    pointer-events: auto;
    cursor: pointer;
}
