/* Product Gallery Widget */
.pg-container {
    display: flex;
    gap: var(--pg-gap, 20px);
    width: fit-content;
    max-width: 100%;
}

/* Sidebar: thumbnails + arrows */
.pg-sidebar {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: var(--pg-thumb-size, 80px);
    height: var(--pg-sidebar-h);
    flex-shrink: 0;
}

/* Arrow buttons */
.pg-arrow {
    width: 100%;
    height: var(--pg-arrow-h, 30px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--pg-arrow-color, #e63946);
    transition: opacity 0.2s;
    flex-shrink: 0;
    padding: 0;
}

.pg-arrow:hover {
    opacity: 0.7;
}

.pg-arrow svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* Thumbs visible area */
.pg-thumbs-wrap {
    height: var(--pg-thumbs-vh);
    width: 100%;
    overflow-y: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    cursor: grab;
    user-select: none;
}

.pg-thumbs-wrap:active {
    cursor: grabbing;
}

.pg-thumbs-wrap::-webkit-scrollbar {
    display: none;
}

/* Thumbs track */
.pg-thumbs-track {
    display: flex;
    flex-direction: column;
    gap: var(--pg-thumb-gap, 10px);
}

/* Single thumbnail */
.pg-thumb {
    width: var(--pg-thumb-size, 80px);
    height: var(--pg-thumb-size, 80px);
    flex-shrink: 0;
    border: var(--pg-thumb-border-width, 1px) solid var(--pg-thumb-border-color, #ddd);
    cursor: pointer;
    transition: border-color 0.2s;
    padding: 2px;
    background: #fff;
    -webkit-user-drag: none;
    box-sizing: border-box;
}

.pg-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.pg-thumb.active {
    border: var(--pg-thumb-active-width, 2px) solid var(--pg-thumb-active-color, #e63946);
}

/* Main image area */
.pg-main {
    height: var(--pg-sidebar-h);
    width: var(--pg-sidebar-h);
    border: 1px solid var(--pg-main-border-color, #ddd);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: var(--pg-main-bg, #fafafa);
    position: relative;
}

/* Slide track */
.pg-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Single slide */
.pg-slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pg-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Nav prev/next buttons */
.pg-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: var(--pg-nav-size, 40px);
    height: var(--pg-nav-size, 40px);
    background: var(--pg-nav-bg, rgba(255, 255, 255, 0.8));
    border: 1px solid var(--pg-nav-border-color, #ddd);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--pg-nav-color, #e63946);
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    padding: 0;
}

.pg-main:hover .pg-nav {
    opacity: 1;
    visibility: visible;
}

.pg-nav:hover {
    background: #ffffff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.pg-nav svg {
    width: calc(var(--pg-nav-size, 40px) * 0.5);
    height: calc(var(--pg-nav-size, 40px) * 0.5);
    fill: currentColor;
}

.pg-nav-prev {
    left: 10px;
}

.pg-nav-next {
    right: 10px;
}

/* Mobile */
@media (max-width: 768px) {
    .pg-container {
        flex-direction: column;
        width: 100%;
        max-width: 100%;
    }

    .pg-main {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 1 / 1;
        order: 1;
    }

    .pg-sidebar {
        width: 100%;
        flex-direction: row;
        height: var(--pg-thumb-size, 80px) !important;
        justify-content: center;
        gap: 5px;
        order: 2;
        margin-top: 10px;
    }

    .pg-arrow {
        width: var(--pg-arrow-h, 30px);
        height: 100%;
    }

    .pg-arrow.pg-arrow-up {
        transform: rotate(-90deg);
    }

    .pg-arrow.pg-arrow-down {
        transform: rotate(-90deg);
    }

    .pg-thumbs-wrap {
        height: var(--pg-thumb-size, 80px) !important;
        width: var(--pg-thumbs-vh);
        overflow-y: hidden;
        overflow-x: auto;
    }

    .pg-thumbs-track {
        flex-direction: row;
    }

    .pg-nav {
        width: 32px;
        height: 32px;
        opacity: 1;
        visibility: visible;
    }

    .pg-nav svg {
        width: 16px;
        height: 16px;
    }
}
