.product-gallery {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    user-select: none;
}

.gallery-main-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 16px;
    overflow: hidden;
    background: #f3f4f6;
    cursor: pointer;
}

.gallery-main-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-main-wrapper:hover .gallery-main-img {
    transform: scale(1.03);
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: background 0.2s, transform 0.2s;
    z-index: 2;
    color: #374151;
}

.gallery-nav:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.1);
}

.gallery-nav--prev { right: 10px; }
.gallery-nav--next { left: 10px; }

.gallery-counter {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0,0,0,0.5);
    color: #fff;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 20px;
    pointer-events: none;
    font-family: inherit;
}

.gallery-zoom-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 2;
}

.gallery-zoom-btn:hover {
    background: rgba(0,0,0,0.75);
}

.gallery-thumbnails {
    display: flex;
    flex-direction: row-reverse;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
}

.gallery-thumbnails::-webkit-scrollbar {
    height: 4px;
}
.gallery-thumbnails::-webkit-scrollbar-track {
    background: transparent;
}
.gallery-thumbnails::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.gallery-thumb {
    flex-shrink: 0;
    width: 70px;
    height: 70px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.2s, opacity 0.2s;
    background: #f3f4f6;
    padding: 0;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-thumb:hover {
    border-color: #93c5fd;
    opacity: 0.9;
}

.gallery-thumb--active {
    border-color: #3b82f6 !important;
    opacity: 1;
}

.gallery-dots {
    display: none;
    justify-content: center;
    gap: 6px;
    margin-top: 2px;
}

.gallery-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d1d5db;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    padding: 0;
}

.gallery-dot--active {
    background: #3b82f6;
    transform: scale(1.3);
}


.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.lightbox.lightbox--open {
    visibility: visible;
    opacity: 1;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    cursor: pointer;
}

.lightbox-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 90vw;
    max-width: 860px;
    padding: 16px;
}

.lightbox-img {
    max-width: 100%;
    max-height: 68vh;
    object-fit: contain;
    border-radius: 12px;
    display: block;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    transition: opacity 0.2s ease;
}

.lightbox-img.lightbox-img--fade {
    opacity: 0;
}

.lightbox-close {
    position: absolute;
    top: -8px;
    right: -8px;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 2;
}

.lightbox-close:hover {
    background: rgba(255,255,255,0.3);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    z-index: 2;
}

.lightbox-nav:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-50%) scale(1.08);
}

.lightbox-nav--prev { right: -60px; }
.lightbox-nav--next { left: -60px; }

.lightbox-thumbnails {
    display: flex;
    flex-direction: row-reverse;
    gap: 8px;
    overflow-x: auto;
    max-width: 100%;
    padding: 4px 0;
    scrollbar-width: thin;
    scrollbar-color: #4b5563 transparent;
}

.lightbox-thumb {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.2);
    cursor: pointer;
    transition: border-color 0.2s, opacity 0.2s;
    padding: 0;
    background: #374151;
}

.lightbox-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lightbox-thumb:hover {
    border-color: rgba(255,255,255,0.6);
}

.lightbox-thumb--active {
    border-color: #60a5fa !important;
}

.lightbox-counter {
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    font-family: inherit;
}


@media (max-width: 768px) {

    .gallery-dots {
        display: flex;
    }

    .gallery-thumb {
        width: 56px;
        height: 56px;
    }

    .lightbox-nav--prev { right: 4px; }
    .lightbox-nav--next { left: 4px; }

    .lightbox-nav {
        width: 40px;
        height: 40px;
        background: rgba(255,255,255,0.2);
        top: auto;
        bottom: calc(60px + 60px + 24px);
        transform: none;
    }

    .lightbox-nav:hover {
        transform: scale(1.05);
    }

    .lightbox-img {
        max-height: 55vh;
    }

    .lightbox-content {
        width: 100vw;
        padding: 12px 8px;
    }
}

@media (prefers-color-scheme: dark) {
    .gallery-main-wrapper,
    .gallery-thumb {
        background: #1f2937;
    }
}
