/* ============================================================
   PRODUCT MEDIA GALLERY (Images + Reel-style Videos)
   File: supgor-child/assets/css/product-gallery.css
   ✅ FIXED: Thumbnails now on LEFT (matches competitor layout)
   ✅ FIXED: Nav arrows properly reset — no more blank grey boxes
============================================================ */

.smg-gallery {
    position: relative;
    display: flex;
    gap: 16px;
    max-width: 100%;
}

/* ---------- THUMBNAIL STRIP ---------- */
/* ✅ FIXED: "order: -1" moves thumbs visually to the LEFT, 
   without needing to change the HTML markup order */
.smg-thumbs {
    order: -1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 72px;
    flex-shrink: 0;
    max-height: 520px;
    overflow-y: auto;
    scrollbar-width: thin;
    /* ✅ FIXED: clears space for the theme's "Best Seller / Sale"
       badge, which sits absolutely positioned at the top-left
       corner and was overlapping the first thumbnail */
    margin-top: 40px;
}
.smg-thumbs::-webkit-scrollbar {
    width: 4px;
}
.smg-thumbs::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

.smg-thumb {
    /* ✅ FIXED: theme's global "button" style (using its own
       --form-button-size-base variable) was overriding our
       reset with MORE SPECIFIC padding/height/background rules.
       "all: unset" alone couldn't beat that specificity, so we
       force these exact properties with !important instead. */
    all: unset;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    box-sizing: border-box;
    position: relative;
    display: block;
    width: 72px !important;
    height: 72px !important;
    margin: 0 !important;
    padding: 0 !important;
    padding-inline-start: 0 !important;
    padding-inline-end: 0 !important;
    outline: none;
    box-shadow: none;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: #f5f5f5;
    background-color: #f5f5f5 !important;
    flex-shrink: 0;
    transition: border-color 0.2s ease;
}
.smg-thumb:hover {
    border-color: #bbb;
}
.smg-thumb.smg-thumb-active {
    border-color: #1a1a1a;
}
.smg-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}
.smg-thumb-play-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 26px;
    height: 26px;
    background: rgba(0, 0, 0, 0.65);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    pointer-events: none;
}
.smg-thumb-play-badge svg {
    margin-left: 2px; /* optically center the play triangle */
}

/* ---------- MAIN VIEWER ---------- */
.smg-main-viewer {
    position: relative;
    flex: 1;
    min-width: 0;
    background: #f4f4f4;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.smg-main-stage {
    position: relative;
    width: 100%;
    height: 100%;
}

.smg-slide {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
}
.smg-slide.smg-slide-active {
    display: flex;
}
.smg-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ---------- REEL-STYLE VERTICAL VIDEO ---------- */
.smg-video-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}
.smg-video {
    height: 100%;
    max-width: 100%;
    aspect-ratio: 9 / 16;
    object-fit: cover;
    background: #000;
}

/* ---------- NAV ARROWS ---------- */
/* ✅ FIXED: "all: unset" removes ALL browser default button
   styling (border, background, padding, font) BEFORE our
   custom styles are applied — this was the cause of the
   blank grey box bug */
.smg-nav {
    all: unset;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    box-sizing: border-box;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 42px !important;
    height: 42px !important;
    margin: 0 !important;
    padding: 0 !important;
    padding-inline-start: 0 !important;
    padding-inline-end: 0 !important;
    outline: none;
    border: none;
    border-radius: 50%;
    background: #ffffff;
    background-color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #1a1a1a;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.smg-nav:hover {
    background: #1a1a1a;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.smg-nav:active {
    transform: translateY(-50%) scale(0.94);
}
.smg-nav svg {
    display: block;
    width: 20px;
    height: 20px;
}
.smg-prev { left: 14px; }
.smg-next { right: 14px; }

/* ---------- COUNTER ---------- */
.smg-counter {
    position: absolute;
    bottom: 12px;
    right: 14px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    z-index: 5;
    letter-spacing: 0.3px;
}

/* ---------- RESPONSIVE (MOBILE — thumbs below, horizontal) ---------- */
@media (max-width: 767px) {
    .smg-gallery {
        flex-direction: column;
    }
    .smg-thumbs {
        order: 1; /* thumbs go BELOW main viewer on mobile */
        flex-direction: row;
        width: 100%;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        margin-top: 0; /* badge doesn't affect thumbs here since 
                           they're below the main image on mobile */
    }
    .smg-thumb {
        width: 60px !important;
        height: 60px !important;
    }
    .smg-main-viewer {
        order: 0;
        aspect-ratio: 1 / 1;
    }
    .smg-nav {
        width: 36px;
        height: 36px;
    }
    .smg-nav svg {
        width: 17px;
        height: 17px;
    }
}