/* Shared product gallery — custom + regular product pages */
.product-gallery__workspace,
.custom-editor__workspace {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.75rem;
}

.product-gallery__thumbs-col,
.custom-editor__thumbs-col {
    flex-shrink: 0;
    width: 72px;
    max-height: 520px;
    height: auto;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #c9a227 #eee;
}

.product-gallery__thumbs-col::-webkit-scrollbar,
.custom-editor__thumbs-col::-webkit-scrollbar { width: 5px; }
.product-gallery__thumbs-col::-webkit-scrollbar-thumb,
.custom-editor__thumbs-col::-webkit-scrollbar-thumb { background: #c9a227; border-radius: 3px; }
.product-gallery__thumbs-col::-webkit-scrollbar-track,
.custom-editor__thumbs-col::-webkit-scrollbar-track { background: #f0f0f0; }

.product-gallery__thumbs,
.custom-editor__thumbs {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 72px;
}

.product-gallery__thumb,
.custom-editor__thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    background: #f0f0f0;
    flex-shrink: 0;
    padding: 0;
}

.product-gallery__thumb.active,
.custom-editor__thumb.active { border-color: #d0d0d0; }

.product-gallery__thumb:hover { border-color: #bbb; }
.product-gallery__thumb.active:hover { border-color: #c0c0c0; }

.product-gallery__thumb-select,
.custom-editor__thumb-select {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    border: 2px solid transparent;
    border-radius: 4px;
    background: #e53935;
    color: #fff;
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.15;
    cursor: pointer;
    padding: 4px;
}

.product-gallery__thumb-select:hover,
.custom-editor__thumb-select:hover { background: #c62828; color: #fff; }
.product-gallery__thumb-select.active,
.custom-editor__thumb-select.active { border-color: #c9a227; box-shadow: 0 0 0 1px #c9a227; }

.product-gallery__canvas,
.custom-editor__canvas { flex: 1; min-width: 0; }

.product-gallery__stage,
.preview-stage {
    border: 2px solid #e0e0e0;
    background: #fafafa;
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 520px;
    min-height: 520px;
    max-height: 520px;
    border-radius: 12px;
}

.product-gallery__viewport,
.preview-stage__viewport {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #c9a227 #eee;
}

.product-gallery__viewport::-webkit-scrollbar,
.preview-stage__viewport::-webkit-scrollbar { width: 6px; }
.product-gallery__viewport::-webkit-scrollbar-thumb,
.preview-stage__viewport::-webkit-scrollbar-thumb { background: #c9a227; border-radius: 3px; }
.product-gallery__viewport::-webkit-scrollbar-track,
.preview-stage__viewport::-webkit-scrollbar-track { background: #eee; }

.product-gallery__main,
.preview-stage.mode-sample #preview-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
    border-radius: 10px;
}

.product-gallery__main.is-tall {
    position: relative;
    inset: auto;
    width: 100%;
    height: auto;
    min-height: 100%;
    object-fit: contain;
    object-position: top center;
}

.product-gallery__dots {
    display: none;
    justify-content: center;
    align-items: center;
    gap: 0.35rem;
    pointer-events: none;
}

.product-gallery__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(0, 0, 0, 0.15);
    padding: 0;
    flex-shrink: 0;
    transition: transform 0.15s ease, background 0.15s ease;
}

.product-gallery__dot.active {
    background: #212529;
    border-color: #212529;
    transform: scale(1.25);
}

@media (max-width: 575px) {
    .product-gallery__workspace,
    .custom-editor__workspace {
        flex-direction: column;
        align-items: stretch;
    }
    .product-gallery__thumbs-col,
    .custom-editor__thumbs-col {
        width: 100%;
        height: auto;
        max-height: 88px;
        overflow-x: auto;
        overflow-y: hidden;
    }

    /* Standard product page: swipe + dots only on mobile */
    .product-gallery__thumbs-col {
        display: none;
    }

    .product-gallery__thumbs,
    .custom-editor__thumbs { flex-direction: row; width: auto; }

    .product-gallery__canvas,
    .custom-editor__canvas {
        width: 100%;
        flex: none;
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .product-gallery__stage,
    .preview-stage {
        width: 100%;
        height: min(58vh, 420px);
        min-height: min(58vh, 420px);
        max-height: min(58vh, 420px);
    }

    .product-gallery__dots {
        display: flex;
        padding: 0.6rem 0 0.15rem;
        margin: 0;
    }

    .product-gallery__dot {
        background: #c8c8c8;
        border: none;
    }

    .product-gallery__dot.active {
        background: #212529;
        border: none;
    }

    .product-gallery__viewport {
        touch-action: pan-y pinch-zoom;
    }
}
