.lpc-carousel-wrapper {
    overflow: hidden;
    width: 100%;
    margin: 40px 0;
    cursor: grab;
    position: relative;
    /* Create vertical space for top-right nav arrows so they don't overlap the first row of products */
    padding-top: 0px;
}
.lpc-carousel {
    display: flex;
    gap: 20px;
    scroll-behavior: smooth;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 50px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* Grid layout shortcode: [latest_product_carousel_grid] */
.lpc-grid-wrapper {
    width: 100%;
    margin: 40px 0;
}

.lpc-grid {
    display: grid;
    gap: 20px;
}

.lpc-grid .lpc-carousel-item {
    flex: none;
}

.lpc-grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.lpc-grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lpc-grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.lpc-grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.lpc-grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.lpc-grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

@media (max-width: 1024px) {
    .lpc-grid-cols-5,
    .lpc-grid-cols-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 899px) {
    .lpc-grid-cols-5,
    .lpc-grid-cols-4,
    .lpc-grid-cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
}

@media (max-width: 768px) {
    .lpc-grid { gap: 14px; }
    .lpc-grid-cols-5,
    .lpc-grid-cols-4,
    .lpc-grid-cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.lpc-carousel::-webkit-scrollbar {
    display: none;
}

@media (min-width: 769px) {
    .lpc-carousel {
        scroll-snap-type: x mandatory;
    }

    .lpc-carousel-item {
        scroll-snap-align: start;
    }
}
.lpc-carousel-item {
    flex: 0 0 calc(20% - 16px);
    text-align: left;
    color: #000;
    position: relative;
    background: #fff;
    overflow: visible !important;
    height: auto;
    min-height: 0;
    box-sizing: border-box;
}
.lpc-carousel-item img {
    max-width: 100%;
    height: auto;
    display: block;
    padding-bottom: 4px;
}
.lpc-quick-add-container {
    position: absolute;
    bottom: 25%;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    border-radius: 5px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow: hidden;
    white-space: nowrap;
    text-align: center;
    z-index: 10;
}
.lpc-carousel-item:hover .lpc-quick-add-container {
    opacity: 1;
}
.lpc-quick-add-label {
    padding: 6px 20px;
    display: block;
    background-color: #000;
    color: #fff;
}
.lpc-quick-add-sizes {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    background-color: #fff;
    color: #000;
    padding: 0 10px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease-in-out;
}
.lpc-quick-add-container:hover .lpc-quick-add-sizes {
    max-height: 200px;
    opacity: 1;
    padding: 10px;
}
.lpc-quick-add-container:hover {
    background-color: #fff;
    color: #000;
    width: 220px;
    flex-direction: column;
    border: 1px solid #ccc;
}
.lpc-quick-add-container:hover .lpc-quick-add-label {
    color: #000;
    background-color: #fff;
}
.lpc-quick-add-size {
    border: 1px solid #000;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 3px;
    background: #f5f5f5;
    transition: transform 0.2s ease;
}
.lpc-carousel-item h4,
.lpc-product-title {
    font-size: 16px;
    font-weight: bold;
    margin: 0 0 4px 0;
    color: #000;
    position: relative;
    cursor: pointer;
}
.lpc-carousel-item p,
.lpc-product-price {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 4px 0;
    padding: 0;
    color: #000;
    position: relative;
    z-index: 5;
    background: #fff;
    display: block;
    line-height: 1.4;
}
@media (max-width: 768px) {
    /* Carousel only: default 2 columns × 2 rows, horizontal scroll by page (not .lpc-grid) */
    .lpc-carousel-wrapper:not(.lpc-grid-wrapper) {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }

    /* Column width from JS-set variable so 2 columns + gap = exact visible width (no crop) */
    .lpc-carousel-wrapper .lpc-carousel {
        display: grid;
        grid-template-rows: auto auto;
        grid-auto-flow: column;
        grid-auto-columns: calc((var(--lpc-page-width, 100vw) - 12px) / 2);
        width: max-content;
        min-height: 0;
        gap: 12px;
        padding-bottom: 20px;
    }

    .lpc-carousel-wrapper .lpc-carousel .lpc-carousel-item {
        flex: none;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
    }

    .lpc-carousel-item {
        flex: 0 0 calc(50% - 10px);
    }

    /* Mobile: hide hover-based quick add overlay entirely */
    .lpc-quick-add-container {
        display: none !important;
    }

    /* Mobile: show variation thumbnails without hover, stacked under the image */
    .lpc-title-thumb-wrap {
        position: static;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        height: auto;
    }

    .lpc-product-title,
    .lpc-product-price {
        position: static;
        opacity: 1;
        pointer-events: auto;
        height: auto;
        line-height: 1.4;
        width: 100%;
        background: #fff;
        padding: 0;
    }

    .lpc-variation-thumbnails {
        position: static;
        display: flex !important;
        height: auto;
        width: 100%;
        margin-top: 6px;
        justify-content: flex-start;
        flex-wrap: nowrap;
        gap: 6px;
    }

    /* Re-order so thumbnails appear directly below the product image */
    .lpc-variation-thumbnails {
        order: 1;
    }
    .lpc-product-title {
        order: 2;
    }
    .lpc-product-price {
        order: 3;
    }
}

/* Mobile + tablet quick add icon (bottom-right on image) */
.lpc-quick-add-icon-btn {
    display: none;
    position: absolute;
    right: 12px;
    bottom: 12px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    background: transparent;
    z-index: 30;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.lpc-quick-add-icon-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

@media (max-width: 1024px) {
    .lpc-quick-add-icon-btn {
        display: block;
    }
}

/* Mobile + tablet Quick Add sheet (bottom popup) */
.lpc-quickadd-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 999998;
    display: none;
}

.lpc-quickadd-overlay.show {
    display: block;
}

.lpc-quickadd-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    background: #fff;
    border-radius: 16px 16px 0 0;
    max-height: 92vh;
    overflow: hidden;
    transform: translateY(100%);
    transition: transform 0.18s ease-out;
    display: flex;
    flex-direction: column;
}

.lpc-quickadd-sheet.show {
    transform: translateY(0);
}

.lpc-quickadd-sheet-body {
    overflow: auto;
    padding: 18px 18px 0 18px;
}

.lpc-quickadd-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.lpc-quickadd-close {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 28px;
    line-height: 1;
    color: #111;
}

.lpc-quickadd-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.lpc-quickadd-thumb {
    width: 78px;
    height: 78px;
    object-fit: cover;
    border-radius: 8px;
    background: #f5f5f5;
    flex: 0 0 auto;
}

.lpc-quickadd-title-wrap {
    flex: 1;
    min-width: 0;
}

.lpc-quickadd-title {
    font-size: 18px;
    font-weight: 700;
    margin: 2px 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lpc-quickadd-price {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.lpc-quickadd-view-details {
    display: inline-block;
    margin-top: 4px;
    font-size: 14px;
    color: inherit;
    text-decoration: underline;
}

.lpc-quickadd-section {
    margin-top: 18px;
    padding-bottom: 10px;
}

.lpc-quickadd-size-label {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 12px;
}

.lpc-quickadd-sizes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.lpc-quickadd-size-btn {
    min-width: 70px;
    height: 50px;
    padding: 0 10px;
    border-radius: 12px;
    border: 2px solid #e6e6e6;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #111;
}

.lpc-quickadd-size-btn.active {
    border-color: #111;
    background: #f7f7f7;
}

.lpc-quickadd-quantity-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 18px;
    margin-top: 18px;
    padding-bottom: 10px;
}

.lpc-quickadd-quantity-title {
    font-size: 22px;
    font-weight: 500;
}

.lpc-quickadd-qty-control {
    display: flex;
    align-items: center;
    gap: 20px;
    border: 1px solid #e6e6e6;
    border-radius: 8px;
    padding: 18px 18px;
}

.lpc-quickadd-qty-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 26px;
    line-height: 1;
    width: 26px;
    height: 26px;
}

.lpc-quickadd-qty-value {
    width: 26px;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
}

.lpc-quickadd-footer {
    margin-top: auto;
    padding: 12px 18px 18px 18px;
}

.lpc-quickadd-add-btn {
    width: 100%;
    height: 64px;
    border: none;
    border-radius: 12px;
    background: #000;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
}

@media (max-width: 1024px) {
    /* Avoid conflicting hover quick-add overlay on tablet/phones */
    .lpc-quick-add-container {
        display: none !important;
    }
}

/* Mobile helper: opt‑in 1‑column layout.
   Wrap the shortcode in a container with class "lpc-one-col-mobile"
   (e.g. a Section/Column in Elementor) to force 1 product per row on mobile
   without affecting other carousels. */
@media (max-width: 768px) {
    .lpc-one-col-mobile .lpc-carousel-wrapper .lpc-carousel {
        grid-template-rows: auto;
        grid-auto-columns: calc(var(--lpc-page-width, 100vw));
    }
}

/* Mobile: specific layout for [latest_product_carousel id="sleeveless-grid" …]
   - Show 1 product per "page"
   - Keep ~20% of the next product visible to hint horizontal scroll */
@media (max-width: 768px) {
    #sleeveless-grid.lpc-carousel-wrapper {
        padding-left: 16px;
    }
    #sleeveless-grid.lpc-carousel-wrapper .lpc-carousel {
        grid-template-rows: auto;
        /* 80% of viewport/page width so the next card peeks in */
        grid-auto-columns: calc(var(--lpc-page-width, 100vw) * 0.8);
    }
}

/* Added To Bag Popup */
.lpc-added-popup {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    max-width: 90%;
    height: 100px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    font-family: Arial, sans-serif;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.lpc-added-popup.show {
    opacity: 1;
    pointer-events: auto;
}
.lpc-added-popup img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    object-position: center;
    border-radius: 6px;
}
.lpc-added-popup-content {
    flex-grow: 1;
}
.lpc-added-popup-content h5 {
    margin: 0;
    font-size: 14px;
    font-weight: bold;
    color: #000;
}
.lpc-added-popup-content p {
    margin: 2px 0 0;
    font-size: 13px;
    color: #444;
}
.lpc-added-popup-check {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background-color: #000;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Carousel Arrows */
.lpc-image-box {
    position: relative;
    width: 100%;
    display: block;
    overflow: visible;
    min-height: 0;
    height: auto;
}
.lpc-image-box img {
    width: 100%;
    display: block;
}

/* Top-right navigation arrows for whole carousel */
.lpc-carousel-nav {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    gap: 12px;
    z-index: 30;
    margin-right: 20px;
}

.lpc-carousel-nav-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    color: #000;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.lpc-carousel-nav-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    background: #f5f5f5;
}

@media (max-width: 768px) {
    .lpc-carousel-nav {
        top: -10px;
        right: 4px;
    }
    
    .lpc-carousel-nav-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
}

/* By default, hide the built-in nav inside the carousel wrapper.
   You will typically use the standalone shortcode nav instead. */
.lpc-carousel-wrapper > .lpc-carousel-nav {
    display: none;
}

/* Standalone nav shortcode styling: not positioned over the grid */
.lpc-carousel-nav-standalone {
    position: static;
    margin-right: 0;
    margin-left: auto;
    display: inline-flex;
}
/* Image gallery arrows — positioned on the product image */
.lpc-image-box .lpc-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    color: #000;
    font-weight: bold;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    font-size: 18px;
    border: none;
    padding: 0;
    line-height: 1;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    appearance: none;
    -webkit-appearance: none;
}

.lpc-image-box .lpc-carousel-arrow.left {
    left: 12px;
}

.lpc-image-box .lpc-carousel-arrow.right {
    right: 12px;
}

/* Desktop: show image arrows only on hover over the image */
@media (min-width: 769px) {
    .lpc-image-box:hover .lpc-carousel-arrow {
        display: flex;
    }
}

/* Mobile: always show image arrows directly on the product image */
@media (max-width: 768px) {
    .lpc-image-box .lpc-carousel-arrow {
        display: flex !important;
        width: 36px;
        height: 36px;
        font-size: 18px;
        z-index: 25;
    }

    .lpc-image-box .lpc-carousel-arrow.left {
        left: 8px;
    }

    .lpc-image-box .lpc-carousel-arrow.right {
        right: 8px;
    }
}

/* Legacy selector — keep for backwards compatibility */
.lpc-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    color: #000;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    font-size: 18px;
    border: none;
    padding: 0;
    line-height: 1;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    appearance: none;
    -webkit-appearance: none;
}
.lpc-carousel-arrow.left {
    left: 12px;
}
.lpc-carousel-arrow.right {
    right: 12px;
}

/* Title and Thumbnails Container */
.lpc-title-thumb-wrap {
    position: relative;
    width: 100%;
    display: block;
    margin-bottom: 0;
    overflow: visible !important;
    height: auto;
    min-height: 0;
    background: #fff;
}

.lpc-product-title {
    font-size: 16px;
    font-weight: bold;
    margin: 0;
    color: #000;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    line-height: 30px;
    width: 100%;
    cursor: pointer;
    transition: opacity 0.2s ease;
    z-index: 5;
    background: #fff;
    text-align: left;
    padding-left: 0;
    opacity: 1;
}

.lpc-variation-thumbnails {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    width: 100%;
    display: none;
    gap: 8px;
    margin: 0;
    padding: 0;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    z-index: 6;
    background: #fff;
    box-sizing: border-box;
}

.lpc-title-thumb-wrap:hover .lpc-product-title,
.lpc-title-thumb-wrap:hover .lpc-product-price {
    opacity: 0;
    pointer-events: none;
}

.lpc-title-thumb-wrap:hover .lpc-variation-thumbnails {
    display: flex !important;
}

.lpc-variation-thumbnail {
    width: 45px;
    height: 50px;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    position: relative;
    flex: 0 0 45px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    margin: 0;
}

.lpc-variation-thumbnail.active {
    border: 2px solid #111;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 2;
}

.lpc-variation-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    padding: 0;
    border-radius: 3px;
}

/* Ensure proper z-indexing for all interactive elements */
.lpc-carousel-item img {
    position: relative;
    z-index: 1;
}

.lpc-quick-add-container {
    z-index: 10;
}

.lpc-product-title,
.lpc-variation-thumbnails {
    z-index: 5;
}


/* Mobile overrides – ensure title, price, and variation thumbnails are visible and stacked correctly */
@media (max-width: 768px) {
    /* Hide hover-based quick add on mobile */
    .lpc-quick-add-container {
        display: none !important;
    }

    /* Make the wrapper a vertical stack so we can control order */
    .lpc-title-thumb-wrap {
        position: static !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 4px !important;
        height: auto !important;
    }

    /* Title and price should be normal block elements, always visible */
    .lpc-product-title,
    .lpc-product-price {
        position: static !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        height: auto !important;
        line-height: 1.4 !important;
        width: 100% !important;
        background: #fff !important;
        padding: 0 !important;
    }

    /* Thumbnails always visible on mobile, directly under image */
    .lpc-variation-thumbnails {
        position: static !important;
        display: flex !important;
        height: auto !important;
        width: 100% !important;
        margin-top: 6px !important;
        justify-content: flex-start !important;
        flex-wrap: nowrap !important;
        gap: 6px !important;
    }

    /* Remove hover-based hiding on mobile */
    .lpc-title-thumb-wrap:hover .lpc-product-title,
    .lpc-title-thumb-wrap:hover .lpc-product-price {
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    .lpc-title-thumb-wrap:hover .lpc-variation-thumbnails {
        display: flex !important;
    }

    /* Ordering: image (outside), then thumbnails, then title, then price */
    .lpc-variation-thumbnails {
        order: 1;
    }
    .lpc-product-title {
        order: 2;
    }
    .lpc-product-price {
        order: 3;
    }
}

