/**
 * Single Product Page — XTech
 * Premium dark luxury look with orange accents.
 *
 * Mobile (≤768px):
 *   - Custom swipeable gallery (CSS scroll-snap, native touch swipe).
 *   - WooCommerce default gallery is hidden.
 * Desktop (≥769px):
 *   - WooCommerce default gallery (Flexslider) shown, constrained to 800px.
 *   - Custom mobile gallery is hidden.
 */

/* ══════════════════════════════════════════════════════
   PAGE WRAPPER
   ══════════════════════════════════════════════════════ */
.xtech-single-product-page {
    /* Clear the fixed header so it doesn't cover the gallery */
    padding-top: 70px !important;
    background: var(--xtech-bg-base);
}

@media (min-width: 769px) {
    .xtech-single-product-page {
        padding-top: 80px !important;
    }
}

/* ══════════════════════════════════════════════════════
   CUSTOM MOBILE GALLERY
   ══════════════════════════════════════════════════════ */
.xtech-mgallery {
    display: none; /* shown only on mobile via media query */
    position: relative;
    width: 100%;
    background: #000;
    overflow: hidden;
}

.xtech-mgallery__track {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    background: #000;
    width: 100%;
}

.xtech-mgallery__track::-webkit-scrollbar {
    display: none;
}

.xtech-mgallery__slide {
    flex: 0 0 100%;
    width: 100%;
    aspect-ratio: 1 / 1;          /* square viewport — full image visible */
    scroll-snap-align: center;
    scroll-snap-stop: always;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    position: relative;
    cursor: zoom-in;
}

/* Tap hint — small "expand" icon top-left of each slide */
.xtech-mgallery__slide::after {
    content: '';
    position: absolute;
    top: 14px;
    left: 14px;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.5) url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M15 3h6v6'%3e%3c/path%3e%3cpath d='M9 21H3v-6'%3e%3c/path%3e%3cpath d='M21 3l-7 7'%3e%3c/path%3e%3cpath d='M3 21l7-7'%3e%3c/path%3e%3c/svg%3e") center/16px no-repeat;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 4;
    pointer-events: none;
    opacity: 0.85;
}

.xtech-mgallery__slide img {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;          /* full image visible, no crop */
    object-position: center;
    display: block;
    -webkit-user-drag: none;
    user-select: none;
    pointer-events: none;          /* lets touch fall through to scroll */
}

/* Pagination dots */
.xtech-mgallery__dots {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 5;
}

.xtech-mgallery__dot {
    width: 7px;
    height: 7px;
    padding: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    border: none;
    cursor: pointer;
    transition: width 0.3s ease, background 0.3s ease, border-radius 0.3s ease;
}

.xtech-mgallery__dot.is-active {
    width: 22px;
    border-radius: 4px;
    background: var(--xtech-primary);
    box-shadow: 0 0 8px rgba(255, 140, 0, 0.6);
}

/* Counter pill (top-right) */
.xtech-mgallery__counter {
    position: absolute;
    top: 14px;
    right: 14px;
    padding: 5px 12px;
    font-family: var(--xtech-font-heading);
    font-size: 0.78rem;
    font-weight: 600;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    letter-spacing: 0.04em;
    z-index: 5;
    pointer-events: none;
}

.xtech-mgallery__counter-sep {
    margin: 0 3px;
    opacity: 0.5;
}

/* ══════════════════════════════════════════════════════
   DESKTOP GALLERY — WooCommerce wrap
   ══════════════════════════════════════════════════════ */
.xtech-sp-gallery-wrap {
    width: 100%;
    background: #000;
}

.xtech-sp-gallery-wrap .woocommerce-product-gallery {
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
}

.xtech-sp-gallery-wrap .woocommerce-product-gallery .flex-viewport {
    background: #000 !important;
    width: 100% !important;
    border-radius: 0 !important;
}

.xtech-sp-gallery-wrap .woocommerce-product-gallery__image {
    width: 100% !important;
    background: #000 !important;
}

.xtech-sp-gallery-wrap .woocommerce-product-gallery__image img {
    width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
    background: #000 !important;
    display: block !important;
    margin: 0 auto;
    cursor: zoom-in;
}

/* Thumbnails strip (desktop) */
.xtech-sp-gallery-wrap .flex-control-thumbs {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px;
    background: #000;
    margin: 0 !important;
    list-style: none !important;
}

.xtech-sp-gallery-wrap .flex-control-thumbs li {
    flex: 0 0 70px !important;
    width: 70px !important;
    height: 70px !important;
    border-radius: 8px;
    overflow: hidden;
    background: #111;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.25s ease;
}

.xtech-sp-gallery-wrap .flex-control-thumbs li:hover {
    border-color: rgba(255, 140, 0, 0.5);
}

.xtech-sp-gallery-wrap .flex-control-thumbs li img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    opacity: 0.55;
    transition: opacity 0.25s ease;
}

.xtech-sp-gallery-wrap .flex-control-thumbs li img.flex-active {
    opacity: 1;
    outline: 2px solid var(--xtech-primary);
    outline-offset: -2px;
}

/* ══════════════════════════════════════════════════════
   PRODUCT INFO
   ══════════════════════════════════════════════════════ */
.xtech-sp-info {
    padding: 2rem 0;
}

.xtech-sp-info .product_title {
    font-family: var(--xtech-font-heading);
    font-size: 1.85rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 0.5rem;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.xtech-sp-info .price {
    font-family: var(--xtech-font-heading);
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--xtech-primary) !important;
    margin-bottom: 1.5rem;
    display: block;
}

.xtech-sp-info .price del {
    font-size: 1.1rem;
    color: var(--xtech-text-muted);
    text-decoration: line-through;
    margin-right: 10px;
    font-weight: 400;
}

.xtech-sp-info .price ins {
    text-decoration: none;
}

.woocommerce-product-details__short-description {
    color: var(--xtech-text-secondary);
    font-size: 1rem;
    line-height: 1.65;
    margin-bottom: 1.5rem;
}

/* Add to cart form */
.xtech-sp-info .cart {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.xtech-sp-info .quantity {
    display: flex;
}

.xtech-sp-info .quantity input.qty {
    width: 100%;
    padding: 0.85rem;
    background: var(--xtech-bg-elevated);
    border: 1px solid var(--xtech-border);
    color: #fff;
    border-radius: var(--xtech-radius);
    text-align: center;
    font-size: 1rem;
    font-family: inherit;
}

/* Add to cart button (orange premium) */
.woocommerce button.button.alt.single_add_to_cart_button,
.xtech-sp-info .single_add_to_cart_button {
    width: 100% !important;
    padding: 1rem !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    font-family: var(--xtech-font-heading) !important;
    letter-spacing: 0.02em !important;
    border-radius: var(--xtech-radius) !important;
    background: var(--xtech-gradient) !important;
    color: #fff !important;
    border: none !important;
    cursor: pointer !important;
    box-shadow: 0 10px 24px -8px rgba(255, 140, 0, 0.55) !important;
    margin-top: 0.5rem !important;
    transition: transform 0.25s ease, box-shadow 0.25s ease !important;
}

.woocommerce button.button.alt.single_add_to_cart_button:hover,
.xtech-sp-info .single_add_to_cart_button:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 14px 30px -8px rgba(255, 140, 0, 0.7) !important;
}

/* WhatsApp CTA */
.xtech-product-whatsapp {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem;
    background: #25d366;
    color: #fff;
    border-radius: var(--xtech-radius);
    font-weight: 600;
    font-family: var(--xtech-font-heading);
    font-size: 1.05rem;
    margin-bottom: 1.5rem;
    transition: background 0.25s ease, transform 0.25s ease;
    text-decoration: none;
}

.xtech-product-whatsapp:hover {
    background: #1da851;
    color: #fff;
    transform: translateY(-1px);
}

/* Breadcrumb */
.woocommerce-breadcrumb {
    font-size: 0.8rem;
    color: var(--xtech-text-muted);
    padding-top: 1rem;
    margin-bottom: 0.5rem;
}

.woocommerce-breadcrumb a {
    color: var(--xtech-text-muted);
    transition: color 0.2s;
}

.woocommerce-breadcrumb a:hover {
    color: var(--xtech-primary);
}

/* Meta */
.product_meta {
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--xtech-text-muted);
    font-size: 0.85rem;
}

.product_meta > span {
    display: block;
    margin-bottom: 0.5rem;
}

.product_meta a {
    color: var(--xtech-text-secondary);
    transition: color 0.2s;
}

.product_meta a:hover {
    color: var(--xtech-primary);
}

/* Tabs (Description / Additional Info / Reviews) */
.woocommerce-tabs {
    margin-bottom: 3rem;
    margin-top: 1.5rem;
}

.wc-tabs {
    display: flex;
    list-style: none;
    border-bottom: 1px solid var(--xtech-border);
    margin: 0 0 1.5rem 0;
    padding: 0;
    flex-wrap: wrap;
}

.wc-tabs li {
    margin-right: 1.5rem;
    list-style: none;
}

.wc-tabs a {
    display: block;
    padding: 0.85rem 0;
    color: var(--xtech-text-muted);
    font-weight: 600;
    font-family: var(--xtech-font-heading);
    position: relative;
    text-decoration: none;
    transition: color 0.25s ease;
}

.wc-tabs li.active a,
.wc-tabs a:hover {
    color: var(--xtech-primary);
}

.wc-tabs li.active a::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--xtech-gradient);
    border-radius: 2px;
}

.woocommerce-Tabs-panel {
    color: var(--xtech-text-secondary);
    line-height: 1.7;
}

/* ══════════════════════════════════════════════════════
   DESKTOP (≥769px)
   ══════════════════════════════════════════════════════ */
@media (min-width: 769px) {
    .xtech-mgallery {
        display: none !important;
    }

    .xtech-sp-gallery-wrap {
        max-width: 800px;
        margin: 2rem auto;
        border-radius: var(--xtech-radius-xl);
        overflow: hidden;
    }

    .xtech-sp-info .cart {
        flex-direction: row;
        align-items: stretch;
    }

    .xtech-sp-info .quantity {
        width: 110px;
        flex-shrink: 0;
    }

    .xtech-sp-info .single_add_to_cart_button {
        flex: 1;
        margin-top: 0 !important;
    }

    .xtech-sp-info .product_title {
        font-size: 2.25rem;
    }

    .xtech-sp-info .price {
        font-size: 2rem;
    }
}

/* ══════════════════════════════════════════════════════
   MOBILE (≤768px)
   ══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* Show our custom mobile gallery */
    .xtech-mgallery {
        display: block;
    }

    /* Hide WooCommerce default flexslider on mobile */
    .xtech-sp-gallery-wrap {
        display: none !important;
    }

    /* Tighter info area on mobile */
    .xtech-sp-info {
        padding: 1.5rem 0;
    }

    .xtech-sp-info .product_title {
        font-size: 1.5rem;
    }

    .xtech-sp-info .price {
        font-size: 1.6rem;
        margin-bottom: 1rem;
    }
}

/* ══════════════════════════════════════════════════════
   FULL-SCREEN LIGHTBOX
   Tap any gallery image to open it at full size.
   Swipe horizontally to switch between images.
   ══════════════════════════════════════════════════════ */
.xtech-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #000;
    display: none;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.xtech-lightbox.is-open {
    display: flex;
    opacity: 1;
}

.xtech-lightbox__track {
    flex: 1;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    width: 100%;
}

.xtech-lightbox__track::-webkit-scrollbar {
    display: none;
}

.xtech-lightbox__slide {
    flex: 0 0 100%;
    width: 100vw;
    height: 100%;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    padding: 60px 16px;
    box-sizing: border-box;
}

.xtech-lightbox__slide img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    /* Allow native pinch-zoom on mobile browsers */
    touch-action: pinch-zoom;
}

/* Close button */
.xtech-lightbox__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    border-radius: 999px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.xtech-lightbox__close:hover {
    background: rgba(255, 140, 0, 0.18);
    border-color: var(--xtech-primary);
    transform: scale(1.05);
}

.xtech-lightbox__close svg {
    stroke: #fff;
}

/* Counter */
.xtech-lightbox__counter {
    position: absolute;
    top: 22px;
    left: 50%;
    transform: translateX(-50%);
    padding: 7px 14px;
    font-family: var(--xtech-font-heading);
    font-size: 0.82rem;
    font-weight: 600;
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    letter-spacing: 0.04em;
    z-index: 10;
    pointer-events: none;
}

.xtech-lightbox__counter-sep {
    margin: 0 4px;
    opacity: 0.5;
}

/* Prev / next arrows (desktop) */
.xtech-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 999px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.xtech-lightbox__nav:hover {
    background: rgba(255, 140, 0, 0.18);
    border-color: var(--xtech-primary);
}

.xtech-lightbox__nav--prev { left: 16px; }
.xtech-lightbox__nav--next { right: 16px; }

.xtech-lightbox__nav.is-hidden {
    display: none !important;
}

/* Body lock when lightbox is open */
body.xtech-lightbox-open {
    overflow: hidden;
}

@media (min-width: 769px) {
    .xtech-lightbox__nav {
        display: flex;
    }

    .xtech-lightbox__close {
        width: 48px;
        height: 48px;
        top: 22px;
        right: 22px;
    }
}
