/* ═══════════════════════════════════════════════════════════════════
   BD Product Gallery – CSS
   ═══════════════════════════════════════════════════════════════════ */

.bdpg-gallery {
    --bdpg-radius: 8px;
    --bdpg-thumb-size: 72px;
    --bdpg-thumb-gap: 8px;
    --bdpg-border-color: #e2e2e2;
    --bdpg-active-color: #155dfc;
    --bdpg-arrow-color: #155dfc;
    --bdpg-bg: #fafafa;
    --bdpg-overlay: rgba(0, 0, 0, 0.92);
    --bdpg-transition: 0.25s ease;
    max-width: 100%;
    width: 100%;
}

/* ─── Main Image ──────────────────────────────────────────────────── */
.bdpg-main-wrap {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: var(--bdpg-radius);
    background: var(--bdpg-bg);
    border: 1px solid var(--bdpg-border-color);
    margin-bottom: 12px;
}

.bdpg-main-btn {
    display: block;
    width: 100%;
    padding: 0;
    margin: 0;
    border: none;
    background: none;
    cursor: zoom-in;
    position: relative;
    line-height: 0;
}

.bdpg-main-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    aspect-ratio: 3 / 4;
    max-height: 420px;
    transition: opacity var(--bdpg-transition);
}

.bdpg-main-img.bdpg-fade {
    opacity: 0.3;
}

.bdpg-zoom-icon {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    opacity: 0;
    transition: opacity var(--bdpg-transition);
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.bdpg-main-btn:hover .bdpg-zoom-icon,
.bdpg-main-btn:focus-visible .bdpg-zoom-icon {
    opacity: 1;
}

/* ─── Thumbnails ──────────────────────────────────────────────────── */
.bdpg-thumbs-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
}

.bdpg-thumbs-track {
    display: flex;
    gap: var(--bdpg-thumb-gap);
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 0;
    flex: 1;
}

.bdpg-thumbs-track::-webkit-scrollbar {
    display: none;
}

.bdpg-thumb {
    flex: 0 0 var(--bdpg-thumb-size);
    width: var(--bdpg-thumb-size);
    height: var(--bdpg-thumb-size);
    border-radius: calc(var(--bdpg-radius) - 2px);
    overflow: hidden;
    border: 2px solid var(--bdpg-border-color);
    padding: 0;
    margin: 0;
    background: var(--bdpg-bg);
    cursor: pointer;
    transition: border-color var(--bdpg-transition), box-shadow var(--bdpg-transition);
    line-height: 0;
}

.bdpg-thumb:hover {
    border-color: #999;
}

.bdpg-thumb--active {
    border-color: var(--bdpg-active-color);
    box-shadow: 0 0 0 1px var(--bdpg-active-color);
}

.bdpg-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.bdpg-thumbs-arrow {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bdpg-arrow-color);
    padding: 0;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease, background 0.2s ease;
}

.bdpg-thumbs-arrow.bdpg-arrow-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.bdpg-thumbs-arrow:hover {
    background: rgba(21, 93, 252, 0.08);
    color: var(--bdpg-arrow-color);
}

/* ─── Lightbox ────────────────────────────────────────────────────── */
.bdpg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bdpg-lightbox-overlay {
    position: absolute;
    inset: 0;
    background: var(--bdpg-overlay);
}

.bdpg-lightbox-content {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bdpg-lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    width: auto;
    height: auto;
    display: block;
    border-radius: 4px;
    object-fit: contain;
    transition: opacity 0.2s ease;
    user-select: none;
    -webkit-user-drag: none;
}

.bdpg-lightbox-img.bdpg-fade {
    opacity: 0.2;
}

.bdpg-lightbox-close {
    position: fixed;
    top: 16px;
    right: 20px;
    z-index: 2;
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--bdpg-transition);
}

.bdpg-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.bdpg-lightbox-prev,
.bdpg-lightbox-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 48px;
    height: 48px;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--bdpg-transition);
}

.bdpg-lightbox-prev { left: 16px; }
.bdpg-lightbox-next { right: 16px; }

.bdpg-lightbox-prev:hover,
.bdpg-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.25);
}

.bdpg-lightbox-counter {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    z-index: 2;
}

/* ─── Notice ──────────────────────────────────────────────────────── */
.bdpg-notice {
    padding: 16px 20px;
    background: #f8f8f8;
    border: 1px dashed #ccc;
    border-radius: var(--bdpg-radius);
    color: #666;
    font-size: 14px;
    text-align: center;
}

body.bdpg-lightbox-open {
    overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .bdpg-gallery {
        --bdpg-thumb-size: 60px;
    }

    /* Move lightbox arrows to bottom navigation bar */
    .bdpg-lightbox-prev,
    .bdpg-lightbox-next {
        position: fixed;
        top: auto;
        bottom: 14px;
        transform: none;
        width: 44px;
        height: 44px;
        background: rgba(255, 255, 255, 0.15);
    }
    .bdpg-lightbox-prev {
        left: calc(50% - 80px);
    }
    .bdpg-lightbox-next {
        right: calc(50% - 80px);
    }
    .bdpg-lightbox-prev svg,
    .bdpg-lightbox-next svg {
        width: 22px;
        height: 22px;
    }
    .bdpg-lightbox-counter {
        bottom: 24px;
    }
    .bdpg-lightbox-img {
        max-width: 96vw;
        max-height: 82vh;
    }
}

@media (max-width: 480px) {
    .bdpg-gallery {
        --bdpg-thumb-size: 52px;
        --bdpg-thumb-gap: 6px;
    }
    .bdpg-main-img {
        aspect-ratio: 4 / 3;
        max-height: none;
    }
    .bdpg-thumbs-arrow {
        opacity: 0 !important;
        visibility: hidden !important;
        width: 0 !important;
        flex: 0 0 0 !important;
        overflow: hidden;
    }
    .bdpg-lightbox-close {
        top: 10px;
        right: 10px;
        width: 38px;
        height: 38px;
        font-size: 24px;
    }
}
