/**
 * Rollpix ProductGallery - Layout Styles
 *
 * @category  Rollpix
 * @package   Rollpix_ProductGallery
 */

/* ==============================================
   CSS Variables (defaults - overridden by config)
   ============================================== */

.rp-product-wrapper {
    --rp-col-1: 1fr;
    --rp-col-2: 1fr;
    --rp-gallery-order: 1;
    --rp-info-order: 2;
    --rp-sticky-offset: 20px;
    --rp-image-gap: 20px;
    --rp-grid-cols: 2;
}

/* ==============================================
   Desktop: Grid Layout with CSS Variables
   ============================================== */

.rp-product-wrapper {
    display: grid !important;
    grid-template-columns: var(--rp-col-1) var(--rp-col-2) !important;
    gap: 40px;
    align-items: start;
    margin-bottom: 40px;
}

/* Force all direct children of our wrapper to fill their grid cell */
.rp-product-wrapper > * {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    flex: none !important;
}

/* Gallery column */
.rp-product-gallery {
    order: var(--rp-gallery-order);
}

/* Vertical layout: single column of images */
.rp-layout-vertical .rp-gallery-images {
    display: flex;
    flex-direction: column;
    gap: var(--rp-image-gap);
}

/* ==============================================
   Grid Layout: Multi-column images + info sidebar
   ============================================== */

.rp-layout-grid .rp-gallery-images {
    display: grid;
    grid-template-columns: repeat(var(--rp-grid-cols, 2), 1fr);
    gap: var(--rp-image-gap);
}

/* ==============================================
   Fashion Layout: Alternating 1-2 image pattern
   ============================================== */

.rp-layout-fashion .rp-gallery-images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--rp-image-gap);
}

/* Full-width images: positions 1, 4, 7, 10... */
.rp-layout-fashion .rp-gallery-item:nth-child(3n+1) {
    grid-column: span 2;
}

/* ==============================================
   Slider Layout: Single image with navigation
   ============================================== */

.rp-slider-wrapper {
    position: relative;
}

.rp-layout-slider .rp-gallery-images {
    position: relative;
    overflow: hidden;
}

.rp-layout-slider .rp-gallery-item {
    width: 100%;
}

.rp-layout-slider .rp-gallery-item img {
    width: 100%;
    height: auto;
}

/* Slider Navigation Arrows - comprehensive reset for Luma/Hyva */
.rp-slider-prev,
.rp-slider-next,
.rp-slider-prev:hover,
.rp-slider-next:hover,
.rp-slider-prev:focus,
.rp-slider-next:focus,
.rp-slider-prev:active,
.rp-slider-next:active {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 10;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    max-width: 44px !important;
    max-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(255, 255, 255, 0.85) !important;
    background-image: none !important;
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    transition: opacity 0.2s ease, background-color 0.2s ease;
    color: #333 !important;
    padding: 0 !important;
    margin: 0 !important;
    outline: none !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    line-height: 1 !important;
    font-size: 0 !important;
    box-sizing: border-box !important;
}

.rp-slider-prev,
.rp-slider-prev:hover,
.rp-slider-prev:focus,
.rp-slider-prev:active {
    left: 12px !important;
    right: auto !important;
}

.rp-slider-next,
.rp-slider-next:hover,
.rp-slider-next:focus,
.rp-slider-next:active {
    right: 12px !important;
    left: auto !important;
}

.rp-slider-prev:hover,
.rp-slider-next:hover {
    background: rgba(255, 255, 255, 1) !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2) !important;
}

.rp-slider-prev:disabled,
.rp-slider-next:disabled {
    cursor: default;
    opacity: 0.3;
}

.rp-slider-prev svg,
.rp-slider-next svg {
    width: 20px !important;
    height: 20px !important;
    display: block !important;
    pointer-events: none;
}

/* Slider Dot Indicators */
.rp-slider-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
}

/* Comprehensive reset for Luma/Hyva button styles */
.rp-slider-dot,
.rp-slider-dot:hover,
.rp-slider-dot:focus,
.rp-slider-dot:active {
    width: 10px !important;
    height: 10px !important;
    min-width: 10px !important;
    min-height: 10px !important;
    max-width: 10px !important;
    max-height: 10px !important;
    border-radius: 50% !important;
    background: #ccc !important;
    background-image: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    cursor: pointer;
    transition: background-color 0.2s ease;
    box-sizing: border-box !important;
    outline: none !important;
    box-shadow: none !important;
    text-indent: -9999px !important;
    font-size: 0 !important;
    line-height: 0 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    transform: none !important;
}

.rp-slider-dot:hover {
    background: #999 !important;
}

.rp-slider-dot.rp-dot-active,
.rp-slider-dot.rp-dot-active:hover,
.rp-slider-dot.rp-dot-active:focus,
.rp-slider-dot.rp-dot-active:active {
    background: #333 !important;
}

/* Slider Transition Styles */
.rp-layout-slider .rp-gallery-item.rp-slide-enter {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
}

/* Slide transition: horizontal */
.rp-layout-slider .rp-gallery-item.rp-slide-enter-left {
    transform: translateX(100%);
}

.rp-layout-slider .rp-gallery-item.rp-slide-enter-right {
    transform: translateX(-100%);
}

/* Slide transition: vertical */
.rp-layout-slider .rp-gallery-item.rp-slide-enter-down {
    transform: translateY(100%);
}

.rp-layout-slider .rp-gallery-item.rp-slide-enter-up {
    transform: translateY(-100%);
}

.rp-layout-slider .rp-gallery-item.rp-slide-active {
    transform: translate(0, 0);
    transition: transform 0.35s ease;
}

.rp-layout-slider .rp-gallery-item.rp-slide-exit {
    transition: transform 0.35s ease;
}

/* Zoom-fade transition */
.rp-layout-slider .rp-gallery-item.rp-zoom-exit {
    transition: transform 0.4s ease, opacity 0.4s ease;
    transform: scale(0.95);
    opacity: 0;
}

.rp-layout-slider .rp-gallery-item.rp-zoom-enter {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.rp-layout-slider .rp-gallery-item.rp-zoom-enter-active {
    opacity: 1;
}

/* ==============================================
   Thumbnail Navigation Strip (slider layout only)
   ============================================== */

.rp-thumbnail-strip {
    display: none;
}

/* Left: thumbnail strip alongside slider */
.rp-thumbnails-left.rp-product-gallery {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 10px;
}

.rp-thumbnails-left .rp-thumbnail-strip {
    order: 1;
}

.rp-thumbnails-left .rp-slider-wrapper {
    order: 2;
}

/* Right: thumbnail strip alongside slider */
.rp-thumbnails-right.rp-product-gallery {
    display: grid;
    grid-template-columns: 1fr 80px;
    gap: 10px;
}

.rp-thumbnails-right .rp-slider-wrapper {
    order: 1;
}

.rp-thumbnails-right .rp-thumbnail-strip {
    order: 2;
}

/* Vertical strip (left/right) */
.rp-thumbnails-left .rp-thumbnail-strip,
.rp-thumbnails-right .rp-thumbnail-strip {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: calc(100vh - var(--rp-sticky-offset, 20px) - 40px);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    align-self: start;
}

.rp-thumbnails-left .rp-thumbnail-strip::-webkit-scrollbar,
.rp-thumbnails-right .rp-thumbnail-strip::-webkit-scrollbar {
    display: none;
}

/* Horizontal strip (bottom) */
.rp-thumbnails-bottom .rp-thumbnail-strip {
    display: flex;
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.rp-thumbnails-bottom .rp-thumbnail-strip::-webkit-scrollbar {
    display: none;
}

/* Thumbnail item - comprehensive reset for Luma/Hyva */
.rp-thumbnail-item,
.rp-thumbnail-item:hover,
.rp-thumbnail-item:focus,
.rp-thumbnail-item:active,
.rp-thumbnail-item:visited {
    flex-shrink: 0;
    width: 70px !important;
    height: 70px !important;
    min-width: 70px !important;
    min-height: 70px !important;
    max-width: 70px !important;
    max-height: 70px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 2px solid transparent !important;
    border-radius: 4px !important;
    background: none !important;
    background-color: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    cursor: pointer;
    overflow: hidden;
    opacity: 0.6;
    transition: opacity 0.2s ease, border-color 0.2s ease;
    text-transform: none !important;
    letter-spacing: normal !important;
    line-height: 0 !important;
    font-size: 0 !important;
    outline: none !important;
    text-decoration: none !important;
    transform: none !important;
    box-sizing: border-box !important;
}

.rp-thumbnail-item:hover {
    opacity: 0.85;
}

.rp-thumbnail-item.rp-thumbnail-active,
.rp-thumbnail-item.rp-thumbnail-active:hover,
.rp-thumbnail-item.rp-thumbnail-active:focus,
.rp-thumbnail-item.rp-thumbnail-active:active {
    opacity: 1;
    border-color: #333 !important;
}

.rp-thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Preserve aspect ratio mode */
.rp-thumbnails-preserve .rp-thumbnail-item,
.rp-thumbnails-preserve .rp-thumbnail-item:hover,
.rp-thumbnails-preserve .rp-thumbnail-item:focus,
.rp-thumbnails-preserve .rp-thumbnail-item:active {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
}

.rp-thumbnails-preserve .rp-thumbnail-item img {
    height: auto;
    object-fit: contain;
}

/* Sliding highlight indicator */
.rp-thumbnail-strip {
    position: relative;
}

.rp-thumbnail-highlight {
    position: absolute;
    top: 0;
    left: 0;
    border: 2px solid #333;
    border-radius: 4px;
    pointer-events: none;
    z-index: 2;
    box-sizing: border-box;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.rp-highlight-no-transition {
    transition: none !important;
}

/* ==============================================
   Thumbnail Overlay Mode (inside image)
   ============================================== */

/* Override grid layout: overlay doesn't need side-by-side */
.rp-thumbnails-overlay.rp-thumbnails-left.rp-product-gallery,
.rp-thumbnails-overlay.rp-thumbnails-right.rp-product-gallery,
.rp-thumbnails-overlay.rp-thumbnails-bottom.rp-product-gallery {
    display: block;
    position: relative;
}

/* Shared overlay thumbnail strip */
.rp-thumbnails-overlay .rp-thumbnail-strip {
    position: absolute;
    z-index: 10;
    background: rgba(255, 255, 255, 0.75);
    border-radius: 8px;
    padding: 6px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Smaller thumbnails in overlay */
.rp-thumbnails-overlay .rp-thumbnail-item,
.rp-thumbnails-overlay .rp-thumbnail-item:hover,
.rp-thumbnails-overlay .rp-thumbnail-item:focus,
.rp-thumbnails-overlay .rp-thumbnail-item:active {
    width: 55px !important;
    height: 55px !important;
    min-width: 55px !important;
    min-height: 55px !important;
    max-width: 55px !important;
    max-height: 55px !important;
}

/* Left overlay: vertical strip on left edge */
.rp-thumbnails-overlay.rp-thumbnails-left .rp-thumbnail-strip {
    display: flex;
    flex-direction: column;
    gap: 6px;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    max-height: 80%;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.rp-thumbnails-overlay.rp-thumbnails-left .rp-thumbnail-strip::-webkit-scrollbar {
    display: none;
}

/* Right overlay: vertical strip on right edge */
.rp-thumbnails-overlay.rp-thumbnails-right .rp-thumbnail-strip {
    display: flex;
    flex-direction: column;
    gap: 6px;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    max-height: 80%;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.rp-thumbnails-overlay.rp-thumbnails-right .rp-thumbnail-strip::-webkit-scrollbar {
    display: none;
}

/* Bottom overlay: horizontal strip near bottom */
.rp-thumbnails-overlay.rp-thumbnails-bottom .rp-thumbnail-strip {
    display: flex;
    flex-direction: row;
    gap: 6px;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 90%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.rp-thumbnails-overlay.rp-thumbnails-bottom .rp-thumbnail-strip::-webkit-scrollbar {
    display: none;
}

/* Overlay thumbnails: push slider arrows inward to avoid overlap */
.rp-thumbnails-overlay.rp-thumbnails-left .rp-slider-prev,
.rp-thumbnails-overlay.rp-thumbnails-left .rp-slider-prev:hover,
.rp-thumbnails-overlay.rp-thumbnails-left .rp-slider-prev:focus,
.rp-thumbnails-overlay.rp-thumbnails-left .rp-slider-prev:active {
    left: 85px !important;
}

.rp-thumbnails-overlay.rp-thumbnails-right .rp-slider-next,
.rp-thumbnails-overlay.rp-thumbnails-right .rp-slider-next:hover,
.rp-thumbnails-overlay.rp-thumbnails-right .rp-slider-next:focus,
.rp-thumbnails-overlay.rp-thumbnails-right .rp-slider-next:active {
    right: 85px !important;
}

/* Dots overlay: float inside the image */
.rp-thumbnails-overlay .rp-slider-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.75);
    border-radius: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.rp-gallery-images {
    gap: var(--rp-image-gap);
}

.rp-gallery-item {
    display: block;
    position: relative;
    overflow: visible;
    border-radius: 4px;
    line-height: 0;
}

.rp-gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
    object-fit: cover;
}

/* Disable hover scale when zoom is active */
.rp-zoom-hover .rp-gallery-item:hover img {
    transform: none;
}

.rp-gallery-item:focus {
    outline: 2px solid #1979c3;
    outline-offset: 2px;
}

/* Product info column - sticky */
.rp-product-wrapper .product-info-main {
    order: var(--rp-info-order);
    position: sticky;
    top: var(--rp-sticky-offset);
    align-self: start;
    width: 100%;
    box-sizing: border-box;
}

/* Reset Luma/Hyva width restrictions on product info inside our wrapper */
.catalog-product-view.page-layout-1column .rp-product-wrapper .product-info-main,
.catalog-product-view .rp-product-wrapper .product-info-main {
    width: 100% !important;
    max-width: none !important;
    min-width: 0;
    float: none;
    padding-left: 0;
    margin-left: 0;
    margin-right: 0;
    flex: none;
}

/* Hyva: force inner section to single column (our wrapper handles the 2-col grid) */
.rp-product-wrapper .product-info-main > section {
    display: block !important;
    max-width: none !important;
    padding: 0 !important;
}

/* Reset Hyva/Tailwind width restrictions on gallery column */
.rp-product-wrapper .rp-product-gallery {
    width: 100% !important;
    max-width: none !important;
    min-width: 0;
}

/* Hide original Fotorama gallery elements */
.catalog-product-view .gallery-placeholder,
.catalog-product-view .fotorama-item,
.catalog-product-view [data-gallery-role="gallery-placeholder"],
.catalog-product-view .product.media {
    display: none !important;
}

/* ==============================================
   Hover Zoom Styles
   ============================================== */

/* Zoom wrapper - contains item and result */
.rp-zoom-wrapper {
    position: relative;
    display: block;
}

/* Gallery item when zoom is enabled */
.rp-zoom-hover .rp-gallery-item {
    cursor: crosshair;
    overflow: visible;
}

/* Zoom Lens */
.rp-zoom-lens {
    position: absolute;
    border: 2px solid rgba(0, 0, 0, 0.4);
    background: rgba(255, 255, 255, 0.4);
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease;
}

.rp-zoom-lens.active {
    opacity: 1;
    visibility: visible;
}

/* Zoom Result */
.rp-zoom-result {
    background-repeat: no-repeat;
    background-color: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.rp-zoom-result.active {
    opacity: 1;
    visibility: visible;
}

/* Zoom result - fixed to viewport (follows cursor) */
.rp-zoom-result-fixed {
    position: fixed;
    border-radius: 6px;
    z-index: 9000;
}

/* Zoom result - inside image */
.rp-zoom-result-inside {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: none;
    box-shadow: none;
    border-radius: 4px;
}

/* ==============================================
   Click-to-Zoom Styles
   ============================================== */

.rp-click-zoom-item {
    cursor: zoom-in;
    overflow: hidden;
}

.rp-click-zoom-item.rp-click-zoomed {
    cursor: zoom-out;
}

.rp-click-zoom-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-repeat: no-repeat;
    background-color: #fff;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
    z-index: 10;
    pointer-events: none;
}

.rp-click-zoom-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ==============================================
   Modal Zoom Styles
   ============================================== */

/* Modal cursor */
.rp-zoom-modal .rp-gallery-item {
    cursor: zoom-in;
}

.rp-zoom-modal .rp-gallery-item:hover img {
    transform: scale(1.02);
}

/* Overlay */
.rp-modal-zoom-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.92);
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.rp-modal-zoom-overlay.rp-modal-active {
    opacity: 1;
}

/* Content: vertical image stack */
.rp-modal-zoom-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    gap: 4px;
}

.rp-modal-zoom-content img {
    max-width: 90%;
    max-height: none;
    width: auto;
    height: auto;
    display: block;
}

/* Close button */
.rp-modal-zoom-close,
.rp-modal-zoom-close:hover,
.rp-modal-zoom-close:focus,
.rp-modal-zoom-close:active {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    z-index: 10001;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    background: rgba(255, 255, 255, 0.15) !important;
    background-image: none !important;
    border: none !important;
    border-radius: 50% !important;
    color: #fff !important;
    font-size: 28px !important;
    line-height: 1 !important;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    outline: none !important;
    box-shadow: none !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    transition: background-color 0.2s ease;
}

.rp-modal-zoom-close:hover {
    background: rgba(255, 255, 255, 0.3) !important;
}

/* Scroll indicator */
.rp-modal-zoom-indicator {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    opacity: 1;
    transition: opacity 0.4s ease;
    animation: rp-modal-bounce 1.5s infinite;
    pointer-events: none;
    font-size: 14px;
}

.rp-modal-zoom-indicator.rp-indicator-hidden {
    opacity: 0;
    pointer-events: none;
}

@keyframes rp-modal-bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-8px); }
}

/* ==============================================
   Zoom Mode Cursors & Behaviors
   ============================================== */

/* Disabled */
.rp-zoom-disabled .rp-gallery-item {
    cursor: default;
}

.rp-zoom-disabled .rp-gallery-item:hover img {
    transform: none;
}

/* Lightbox */
.rp-zoom-lightbox .rp-gallery-item {
    cursor: zoom-in;
}

.rp-zoom-lightbox .rp-gallery-item:hover img {
    transform: scale(1.02);
}

/* Click zoom */
.rp-zoom-click .rp-gallery-item:hover img {
    transform: none;
}

/* ==============================================
   Mobile: Vertical Stack Layout
   ============================================== */

@media screen and (max-width: 767px) {
    /* Override theme overflow on all ancestors to allow sticky */
    .catalog-product-view .page-wrapper,
    .catalog-product-view .page-main,
    .catalog-product-view .columns,
    .catalog-product-view .column.main {
        overflow: visible !important;
    }

    .rp-product-wrapper {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: none !important;
        gap: 0;
        margin-bottom: 20px;
        overflow: visible !important;
    }

    .rp-product-gallery {
        order: 1 !important;
        width: 100%;
    }

    /* Carousel: gallery sticks at top, info scrolls over it */
    .rp-carousel-active {
        position: -webkit-sticky !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 1;
    }

    .rp-product-wrapper .product-info-main {
        order: 2 !important;
        position: relative !important;
        z-index: 2;
        background: #fff;
        max-height: none !important;
        overflow-y: visible !important;
        width: 100%;
        margin-top: -90px;
        padding-top: 10px;
    }

    .rp-gallery-images {
        gap: 10px;
    }

    /* Grid, fashion layouts collapse to single column on mobile */
    .rp-layout-grid .rp-gallery-images,
    .rp-layout-fashion .rp-gallery-images {
        grid-template-columns: 1fr;
    }

    .rp-layout-fashion .rp-gallery-item:nth-child(3n+1) {
        grid-column: span 1;
    }

    /* Hide slider arrows and dots on mobile */
    .rp-slider-prev,
    .rp-slider-next,
    .rp-slider-dots {
        display: none !important;
    }

    /* Hide thumbnails on mobile */
    .rp-thumbnail-strip {
        display: none !important;
    }

    .rp-thumbnails-left.rp-product-gallery,
    .rp-thumbnails-right.rp-product-gallery {
        display: block !important;
        grid-template-columns: none !important;
    }

    .rp-gallery-item {
        border-radius: 0;
    }

    .rp-gallery-item:hover img {
        transform: none;
    }

    /* Hide zoom elements on mobile */
    .rp-zoom-lens,
    .rp-zoom-result,
    .rp-click-zoom-overlay {
        display: none !important;
    }

    /* Carousel: limit tall images to viewport height */
    .rp-carousel-slide img {
        max-height: 90vh;
        width: 100%;
        height: auto;
    }

    /* Carousel: overlay indicators on image */
    .rp-carousel-active .rp-carousel-indicators {
        display: flex !important;
        position: absolute;
        bottom: 15px;
        left: 0;
        right: 0;
        z-index: 10;
        padding: 0;
    }

    .rp-carousel-active .rp-carousel-dot {
        background: rgba(255, 255, 255, 0.7);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    }

    .rp-carousel-active .rp-carousel-dot:hover {
        background: rgba(255, 255, 255, 0.9);
    }

    .rp-carousel-active .rp-carousel-dot.active {
        background: #fff;
    }
}

/* ==============================================
   Mobile Carousel Styles
   ============================================== */

.rp-carousel-active .rp-carousel-wrapper {
    overflow: hidden;
    position: relative;
    transition: height 0.3s ease;
}

.rp-carousel-track {
    display: flex;
    transition: transform 0.3s ease;
    touch-action: pan-y pinch-zoom;
}

.rp-carousel-slide {
    flex: 0 0 100%;
    width: 100%;
}

.rp-carousel-slide img {
    width: 100%;
    height: auto;
}

/* Carousel Indicators */
.rp-carousel-indicators {
    display: none;
    justify-content: center;
    gap: 8px;
    padding: 15px 0;
}

.rp-carousel-active .rp-carousel-indicators {
    display: flex;
}

.rp-carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: none;
    background: #ccc;
    cursor: pointer;
    padding: 0;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.rp-carousel-dot:hover {
    background: #999;
}

.rp-carousel-dot.active {
    background: #333;
    transform: scale(1.2);
}

/* Stack mode (non-carousel) on mobile */
@media screen and (max-width: 767px) {
    .rp-mobile-stack .rp-gallery-images {
        display: flex;
        flex-direction: column;
    }

    .rp-mobile-stack .rp-carousel-indicators {
        display: none;
    }
}

/* ==============================================
   GLightbox Customizations
   ============================================== */

.glightbox-container .gslide-description {
    background: rgba(0, 0, 0, 0.75);
}

.glightbox-container .gslide-title {
    color: #fff;
    font-size: 14px;
    font-weight: 400;
}

/* Ensure close button is always visible */
.glightbox-container .gclose {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    top: 15px !important;
    right: 15px !important;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.glightbox-container .gclose svg {
    width: 20px;
    height: 20px;
}

.glightbox-container .gclose:hover {
    background: rgba(0, 0, 0, 0.85);
}

/* Navigation arrows */
.glightbox-container .gnext,
.glightbox-container .gprev {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 50%;
    width: 44px;
    height: 44px;
}

.glightbox-container .gnext:hover,
.glightbox-container .gprev:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* ==============================================
   Inline Accordion Tabs
   ============================================== */

.rp-accordion {
    margin-top: 30px;
    border-top: 1px solid #e0e0e0;
}

.rp-accordion-section {
    border-bottom: 1px solid #e0e0e0;
}

.rp-accordion-header,
.rp-accordion-header:hover,
.rp-accordion-header:focus,
.rp-accordion-header:active,
.rp-accordion-header:visited {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 0;
    margin: 0;
    background: none !important;
    background-color: transparent !important;
    background-image: none !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    text-align: left;
    line-height: 1.4;
    transition: color 0.2s ease;
    font-family: inherit;
    text-transform: none;
    letter-spacing: normal;
    text-decoration: none;
}

.rp-accordion-header:hover,
.rp-accordion-header:focus {
    color: #333;
    outline: none !important;
}

.rp-accordion-icon {
    flex-shrink: 0;
    width: 12px;
    height: 12px;
    margin-left: 12px;
    border-right: 2px solid #666;
    border-bottom: 2px solid #666;
    transform: rotate(45deg);
    transition: transform 0.3s ease;
}

.rp-accordion-active .rp-accordion-icon {
    transform: rotate(-135deg);
}

.rp-accordion-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}

.rp-accordion-panel.rp-accordion-open {
    max-height: 2000px;
}

.rp-accordion-content {
    padding: 0 0 20px 0;
    font-size: 14px;
    line-height: 1.6;
    color: #555;
}

.rp-accordion-content p {
    margin: 0 0 12px;
}

.rp-accordion-content table {
    width: 100%;
    border-collapse: collapse;
}

.rp-accordion-content table th,
.rp-accordion-content table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.rp-accordion-content table th {
    font-weight: 600;
    color: #333;
    width: 40%;
}

/* Description truncation with gradient fade */
.rp-accordion-truncated {
    overflow: hidden;
    position: relative;
}

.rp-accordion-truncated::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
    pointer-events: none;
}

.rp-accordion-readmore,
.rp-accordion-readmore:hover,
.rp-accordion-readmore:focus,
.rp-accordion-readmore:active {
    display: block;
    background: none !important;
    background-color: transparent !important;
    background-image: none !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: #1979c3;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 0 16px;
    margin: 0;
    text-decoration: underline;
    text-transform: none;
    letter-spacing: normal;
    font-family: inherit;
}

@media screen and (max-width: 767px) {
    /* On mobile: hide accordion, restore original Magento tabs */
    .rp-accordion {
        display: none !important;
    }

    .rp-inline-tabs .product.info.detailed,
    .product.info.detailed {
        display: block !important;
    }
}

/* ==============================================
   Shimmer Loading Effect
   ============================================== */

@keyframes rp-shimmer-slide {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.rp-shimmer .rp-gallery-item {
    position: relative;
    background: #e0e0e0;
    overflow: hidden;
    min-height: 200px;
}

.rp-shimmer .rp-gallery-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.6) 50%,
        transparent 100%
    );
    animation: rp-shimmer-slide 1.5s infinite;
    z-index: 1;
}

.rp-shimmer .rp-gallery-item.rp-loaded::before {
    display: none;
}

.rp-shimmer .rp-gallery-item.rp-loaded {
    background: transparent;
    min-height: auto;
}

.rp-shimmer .rp-gallery-item img {
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: rp-shimmer-fallback 0s 5s forwards;
}

.rp-shimmer .rp-gallery-item.rp-loaded img {
    opacity: 1;
    animation: none;
}

@keyframes rp-shimmer-fallback {
    to { opacity: 1; }
}

/* ==============================================
   Fade-in on Scroll
   ============================================== */

.rp-fadein .rp-gallery-item {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.rp-fadein .rp-gallery-item.rp-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ==============================================
   Scroll Focus Effect
   ============================================== */

[class*="rp-focus-"] .rp-gallery-item {
    transition: opacity 0.35s ease, filter 0.35s ease;
    will-change: opacity, filter;
}

/* ==============================================
   Image Counter
   ============================================== */

.rp-counter-display {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.rp-counter-display.rp-counter-visible {
    opacity: 1;
    visibility: visible;
}

@media screen and (max-width: 767px) {
    .rp-counter-display {
        display: none !important;
    }
}

/* ==============================================
   Accessibility
   ============================================== */

@media (prefers-reduced-motion: reduce) {
    .rp-gallery-item img {
        transition: none;
    }

    .rp-gallery-item:hover img {
        transform: none;
    }

    .rp-carousel-track {
        transition: none;
    }

    .rp-carousel-dot {
        transition: none;
    }

    .rp-zoom-lens,
    .rp-zoom-result {
        transition: none;
    }

    .rp-modal-zoom-overlay {
        transition: none;
    }

    .rp-modal-zoom-indicator {
        animation: none;
        transition: none;
    }

    .rp-accordion-panel {
        transition: none;
    }

    .rp-accordion-icon {
        transition: none;
    }

    /* Shimmer: disable animation */
    .rp-shimmer .rp-gallery-item::before {
        animation: none;
    }

    .rp-shimmer .rp-gallery-item img {
        transition: none;
    }

    /* Fade-in: show immediately without animation */
    .rp-fadein .rp-gallery-item {
        opacity: 1;
        transform: none;
        transition: none;
    }

    /* Focus: disable scroll effect */
    [class*="rp-focus-"] .rp-gallery-item {
        opacity: 1 !important;
        filter: none !important;
        transition: none;
    }

    /* Counter: disable transition */
    .rp-counter-display {
        transition: none;
    }

    /* Thumbnails: disable scroll and highlight transition */
    .rp-thumbnail-strip {
        scroll-behavior: auto;
    }

    .rp-thumbnail-highlight {
        transition: none;
    }

    /* Slider: disable all transitions */
    .rp-slider-prev,
    .rp-slider-next,
    .rp-slider-dot {
        transition: none;
    }

    .rp-layout-slider .rp-gallery-item {
        transition: none !important;
    }
}

/* ==============================================
   Print Styles
   ============================================== */

@media print {
    .rp-product-wrapper {
        display: block;
    }

    .rp-product-gallery {
        page-break-after: always;
    }

    .rp-product-wrapper .product-info-main {
        position: static;
    }

    .rp-carousel-indicators,
    .rp-zoom-lens,
    .rp-zoom-result,
    .rp-click-zoom-overlay,
    .rp-modal-zoom-overlay {
        display: none;
    }

    .rp-accordion-panel {
        max-height: none !important;
        overflow: visible !important;
    }

    /* Hide non-printable elements */
    .rp-counter-display,
    .rp-thumbnail-strip,
    .rp-slider-prev,
    .rp-slider-next,
    .rp-slider-dots {
        display: none !important;
    }

    /* Show all images without effects */
    .rp-shimmer .rp-gallery-item {
        background: transparent;
        min-height: auto;
    }

    .rp-shimmer .rp-gallery-item::before {
        display: none;
    }

    .rp-shimmer .rp-gallery-item img,
    .rp-fadein .rp-gallery-item {
        opacity: 1;
        transform: none;
    }

    [class*="rp-focus-"] .rp-gallery-item {
        opacity: 1 !important;
        filter: none !important;
    }
}
