/* ============================================================
   PDP mobile gallery (2026-10-02) - /produk/{slug}, < 768px only.
   Swipeable photo carousel + synced thumbnails + share/wishlist bar.
   Desktop keeps the original .gallery-main + click-thumbnail flow:
   everything new is display:none there.
   ============================================================ */

.pdp-mg,
.pdp-wish-label {
    display: none;
}

@media (min-width: 768px) {
    .pdp-shopee .pdp-wish-label {
        display: inline;
    }

    .pdp-shopee .pdp-share-row .pdp-share-btn-wishlist {
        width: auto;
        gap: 6px;
        padding: 0 12px;
        border-radius: 999px;
    }
}

@media (max-width: 767.98px) {
    .pdp-shopee .product-gallery.has-mg {
        padding: 0.75rem 1rem 1rem;
    }

    /* The carousel replaces the single main image on mobile */
    .pdp-shopee .product-gallery.has-mg .gallery-main {
        display: none;
    }

    /* ---------- Carousel ---------- */
    .pdp-mg {
        display: block;
        position: relative;
        border-radius: 22px;
        overflow: hidden;
        background: #ffffff;
        box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 18px 40px -22px rgba(15, 23, 42, 0.35);
        isolation: isolate;
    }

    .pdp-mg-track {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
    }

    .pdp-mg-track::-webkit-scrollbar {
        display: none;
    }

    /* Keep every slide square; contain differently proportioned images
       rather than cropping them. */
    .pdp-mg-slide {
        position: relative;
        flex: 0 0 100%;
        margin: 0;
        overflow: hidden;
        aspect-ratio: 1 / 1;
        display: grid;
        place-items: center;
        scroll-snap-align: center;
        scroll-snap-stop: always;
    }

    .pdp-mg-slide::before {
        display: none;
    }

    .pdp-mg-slide img {
        position: relative;
        width: 100%;
        height: 100%;
        object-fit: contain;
        display: block;
        -webkit-user-drag: none;
        user-select: none;
    }

    .pdp-mg-badge {
        position: absolute;
        top: 12px;
        left: 12px;
        z-index: 2;
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 5px 10px;
        border-radius: 999px;
        background: #ef233c;
        color: #fff;
        font-size: 0.78rem;
        font-weight: 800;
        letter-spacing: 0.01em;
        box-shadow: 0 6px 14px -4px rgba(239, 35, 60, 0.55);
    }

    .pdp-mg-badge.is-free {
        background: #10b981;
        box-shadow: 0 6px 14px -4px rgba(16, 185, 129, 0.55);
    }

    .pdp-mg-count {
        position: absolute;
        right: 12px;
        bottom: 12px;
        z-index: 2;
        padding: 4px 10px;
        border-radius: 999px;
        background: rgba(15, 23, 42, 0.72);
        -webkit-backdrop-filter: blur(6px);
        backdrop-filter: blur(6px);
        color: rgba(255, 255, 255, 0.8);
        font-size: 0.74rem;
        font-weight: 600;
        font-variant-numeric: tabular-nums;
    }

    .pdp-mg-count b {
        color: #fff;
        font-weight: 800;
    }

    .pdp-mg-dots {
        position: absolute;
        left: 50%;
        bottom: 16px;
        z-index: 2;
        display: flex;
        gap: 5px;
        transform: translateX(-50%);
        pointer-events: none;
    }

    .pdp-mg-dots span {
        width: 6px;
        height: 6px;
        border-radius: 999px;
        background: rgba(15, 23, 42, 0.22);
        transition: width 0.3s ease, background 0.3s ease;
    }

    .pdp-mg-dots span.is-active {
        width: 18px;
        background: #0f172a;
    }

    /* ---------- Thumbnails ---------- */
    .pdp-shopee .product-gallery.has-mg .pdp-shopee-thumbs {
        gap: 8px;
        margin-top: 12px;
        padding: 2px 2px 4px;
    }

    .pdp-shopee .product-gallery.has-mg .pdp-shopee-thumbs .thumb-item {
        width: 58px;
        height: 58px;
        border-radius: 14px;
        border: 2px solid transparent;
        background: #f1f3f6;
        opacity: 0.55;
        transition: opacity 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    }

    .pdp-shopee .product-gallery.has-mg .pdp-shopee-thumbs .thumb-item.active {
        opacity: 1;
        border-color: #0f172a;
        box-shadow: 0 0 0 3px rgba(255, 235, 0, 0.9);
        transform: translateY(-1px);
    }

    .pdp-shopee .product-gallery.has-mg .pdp-shopee-thumbs .thumb-item img {
        border-radius: 12px;
        background: transparent;
    }

    /* ---------- Share + wishlist bar ---------- */
    .pdp-shopee .pdp-share-row {
        transform: none !important;
        justify-content: space-between !important;
        gap: 6px !important;
        margin-top: 14px !important;
        padding: 8px 8px 8px 14px;
        border: 1px solid #eef0f3;
        border-radius: 999px;
        background: #ffffff;
        box-shadow: 0 6px 18px -12px rgba(15, 23, 42, 0.3);
    }

    .pdp-shopee .pdp-share-group,
    .pdp-shopee .pdp-share-favorite-group {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .pdp-shopee .pdp-share-group {
        min-width: 0;
    }

    .pdp-shopee .pdp-share-favorite-group {
        flex: 0 0 auto;
        margin-left: auto;
    }

    .pdp-shopee .pdp-share-label {
        margin-right: 2px;
        color: #64748b;
        font-size: 0.78rem;
        font-weight: 600;
    }

    .pdp-shopee .pdp-share-row .pdp-share-btn {
        width: 34px;
        height: 34px;
        font-size: 0.95rem;
        background: #f4f5f7 !important;
        border: 0 !important;
    }

    .pdp-shopee .pdp-share-row .pdp-share-btn-whatsapp { color: #25d366; }
    .pdp-shopee .pdp-share-row .pdp-share-btn-facebook { color: #1877f2; }
    .pdp-shopee .pdp-share-row .pdp-share-btn-twitter { color: #0f172a; }
    .pdp-shopee .pdp-share-row .pdp-share-btn-copy { color: #475569; }

    .pdp-shopee .pdp-share-row .pdp-share-btn:active {
        transform: scale(0.92);
    }

    /* Wishlist turns into a labeled pill pushed to the right */
    .pdp-shopee .pdp-share-wishlist-form {
        margin: 0;
    }

    .pdp-shopee .pdp-share-row .pdp-share-btn-wishlist {
        width: auto;
        gap: 6px;
        padding: 0 12px;
        border-radius: 999px;
        background: #0f172a !important;
        border: 0 !important;
        color: #ffeb00 !important;
        font-size: 0.85rem;
    }

    .pdp-shopee .pdp-share-row .pdp-share-btn-wishlist.is-active {
        background: #fef2f2 !important;
        color: #dc2626 !important;
    }

    .pdp-wish-label {
        display: inline;
        color: #fff;
        font-size: 0.74rem;
        font-weight: 700;
        white-space: nowrap;
    }

    .pdp-share-btn-wishlist.is-active .pdp-wish-label {
        color: #dc2626;
    }

    /* Tooltips are hover-only chrome; on touch they just get stuck open */
    .pdp-shopee .pdp-share-row [data-tooltip]::before,
    .pdp-shopee .pdp-share-row [data-tooltip]::after {
        display: none !important;
    }
}

@media (max-width: 359.98px) {
    .pdp-shopee .pdp-share-label { display: none; }
    .pdp-shopee .pdp-share-row .pdp-share-btn { width: 30px; height: 30px; }

    .pdp-shopee .pdp-share-row .pdp-share-btn-wishlist {
        width: auto;
        padding: 0 8px;
    }

    .pdp-shopee .pdp-wish-label {
        display: inline;
        font-size: 0.66rem;
    }
}
