.acf-repeater-container {
    width: 100%;
}

.acf-repeater-container.layout-block {
    display: flex;
    flex-direction: column;
}

.acf-repeater-container.layout-flex {
    display: flex;
    flex-wrap: wrap;
}

.acf-repeater-container.layout-grid {
    display: grid;
}

.acf-repeater-item {
    display: flex;
    flex-direction: column;
}

.acf-repeater-field {
    display: block;
}

/* Images use inline-block so text-align on parent works for centering */
.acf-repeater-field img {
    display: inline-block;
    max-width: 100%;
    height: auto;
}

/* Headings are block elements - ensure they inherit text-align */
.acf-repeater-field h1,
.acf-repeater-field h2,
.acf-repeater-field h3,
.acf-repeater-field h4,
.acf-repeater-field h5,
.acf-repeater-field h6 {
    text-align: inherit;
    margin: 0;
}

.acf-field-link {
    text-decoration: underline;
    color: inherit;
}

.acf-field-link:hover {
    text-decoration: none;
}

.acf-field-button {
    display: inline-block;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Field Heading */
.acf-field-heading {
    margin: 0 0 10px 0;
    padding: 0;
}

/* Section Title */
.acf-section-title {
    margin: 0 0 20px 0;
    padding: 0;
    width: 100%;
}

/* Index Navigation */
.acf-repeater-index {
    display: flex;
    transition: all 0.3s ease;
}

/* Bottom Pinned Index Navigation */
.acf-repeater-index.is-bottom-pinned {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto !important;
    z-index: 9999;
    margin: 0;
    border-radius: 0;
    padding: 8px 16px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    justify-content: center;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    transition: all 0.3s ease;
    max-height: 80px !important;
    /* Force single row - always horizontal scroll */
    flex-wrap: nowrap !important;
    display: flex !important;
    flex-direction: row !important;
}

/* Compact styling when pinned */
.acf-repeater-index.is-bottom-pinned .acf-index-item {
    padding: 6px 12px;
    flex-shrink: 0;
    flex-grow: 0;
    min-width: max-content;
}

/* Hide scrollbar but keep functionality */
.acf-repeater-index.is-bottom-pinned::-webkit-scrollbar {
    height: 4px;
}

.acf-repeater-index.is-bottom-pinned::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.acf-repeater-index.is-bottom-pinned::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.acf-repeater-index.is-bottom-pinned::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.acf-repeater-index.is-bottom-pinned .acf-index-icon img,
.acf-repeater-index.is-bottom-pinned .acf-index-icon svg {
    width: 24px !important;
    height: 24px !important;
    max-width: 24px !important;
    max-height: 24px !important;
}

.acf-repeater-index.is-bottom-pinned .acf-index-title {
    font-size: 12px !important;
    white-space: nowrap;
}

/* Option to hide titles when pinned */
.acf-repeater-index.is-bottom-pinned.hide-titles-when-pinned .acf-index-title {
    display: none;
}

/* Placeholder to maintain layout when nav is pinned */
.acf-index-placeholder {
    visibility: hidden;
}

/* Mobile: always pinned styles */
@media (max-width: 767px) {
    .acf-repeater-index.has-bottom-pin[data-always-pinned-mobile="1"] {
        /* Will be pinned via JS */
    }
    
    .acf-repeater-index.is-bottom-pinned {
        padding: 6px 10px;
        gap: 8px;
        max-height: 80px !important;
        /* Force single row on mobile too */
        flex-wrap: nowrap !important;
        justify-content: center;
    }
    
    .acf-repeater-index.is-bottom-pinned .acf-index-item {
        padding: 4px 8px;
        flex-direction: column;
        gap: 2px;
        flex-shrink: 0;
    }
    
    .acf-repeater-index.is-bottom-pinned .acf-index-icon img,
    .acf-repeater-index.is-bottom-pinned .acf-index-icon svg {
        width: 24px !important;
        height: 24px !important;
        max-width: 24px !important;
        max-height: 24px !important;
    }
    
    .acf-repeater-index.is-bottom-pinned .acf-index-title {
        font-size: 10px !important;
    }
}

/* Safe area padding for phones with home indicators */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .acf-repeater-index.is-bottom-pinned {
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
    }
}

.acf-index-item {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-sizing: border-box;
    flex-shrink: 0;
}

.acf-index-item:hover {
    text-decoration: none;
}

.acf-index-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    flex-shrink: 0;
}

.acf-index-icon img,
.acf-index-icon svg {
    object-fit: contain;
}

.acf-index-title {
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Scroll target offset fix */
.acf-repeater-item[id] {
    scroll-margin-top: 100px;
}

.acf-repeater-empty {
    padding: 20px;
    text-align: center;
    color: #666;
}

/* Product Card Styles - Theme Compatible */
/* Exclusive products with custom discount styling */
.acf-exclusive-product {
    position: relative;
}

/* Ensure proper height in grid layout */
.products.acf-related-grid .product {
    height: 100%;
}
.acf-related-grid .acf-related-post {
    height: 100%;
}

/* Simple Post Styles */
.acf-related-post {
    text-align: center;
}

.acf-related-post-image {
    display: block;
    margin-bottom: 10px;
}

.acf-related-post-image img {
    width: 100%;
    height: auto;
}

.acf-related-post-title {
    font-size: 14px;
    margin: 0;
}

.acf-related-post-title a {
    color: inherit;
    text-decoration: none;
}

.acf-related-post-title a:hover {
    text-decoration: underline;
}

/* Gallery Styles */
.acf-gallery-carousel-wrapper {
    position: relative;
    padding: 0;
}

.acf-gallery-carousel-wrapper.has-arrows {
    padding: 0 50px;
}

.acf-gallery-swiper {
    overflow: hidden;
}

.acf-gallery-swiper .swiper-slide {
    overflow: hidden;
    height: auto;
}

.acf-gallery-swiper .swiper-slide img {
    display: block;
    width: 100%;
    height: auto;
}

.acf-gallery-swiper .swiper-slide a {
    display: block;
    line-height: 0;
    overflow: hidden;
}

.acf-gallery-swiper .swiper-pagination {
    position: relative;
    margin-top: 15px;
    bottom: auto;
}

.acf-gallery-swiper .swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    background: #ccc;
    opacity: 1;
    transition: all 0.3s ease;
}

.acf-gallery-swiper .swiper-pagination-bullet-active {
    background: #c41230;
}

/* Gallery Grid */
.acf-gallery-grid {
    overflow: hidden;
}

.acf-gallery-item {
    overflow: hidden;
}

.acf-gallery-item a {
    display: block;
    line-height: 0;
}

.acf-gallery-item img {
    transition: transform 0.3s ease;
}

.acf-gallery-item:hover img {
    transform: scale(1.05);
}

/* Gallery Masonry */
.acf-gallery-masonry .acf-gallery-item {
    overflow: hidden;
}

/* Popup Base Styles */
.acf-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999999;
    align-items: center;
    justify-content: center;
}

.acf-popup-overlay.show,
.acf-popup-overlay[style*="block"] {
    display: flex !important;
}

body.acf-popup-open {
    overflow: hidden;
}

.acf-popup-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 480px;
    width: 90%;
    margin: 20px;
    animation: acfPopupSlideIn 0.3s ease;
    position: relative;
}

@keyframes acfPopupSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.acf-popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    max-width: 36px;
    max-height: 36px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    aspect-ratio: 1;
    box-sizing: border-box;
}

.acf-popup-close:hover {
    background: #e0e0e0;
    color: #333;
}

.acf-popup-header {
    padding: 24px 24px 0;
}

.acf-popup-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
}

.acf-popup-body {
    padding: 16px 24px;
}

.acf-popup-message {
    margin: 0;
    font-size: 15px;
    color: #555;
    line-height: 1.6;
}

.acf-popup-footer {
    padding: 16px 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* Button Styles */
.acf-popup-btn {
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    white-space: nowrap;
}

.acf-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.acf-btn-secondary:hover {
    background: #e0e0e0;
}

.acf-btn-primary {
    background: #c41230;
    color: #fff;
}

.acf-btn-primary:hover {
    background: #a00f28;
}

.acf-btn-primary.loading {
    pointer-events: none;
}

.acf-spinner {
    display: inline-block;
    vertical-align: middle;
    margin-right: 4px;
}

.acf-btn-primary.loading .acf-spinner {
    animation: acf-spin 1s linear infinite;
}

@keyframes acf-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.acf-btn-primary.added {
    background: #c41230;
    cursor: pointer;
    pointer-events: auto;
}

.acf-btn-primary.added:hover {
    background: #a00f28;
}

.acf-btn-primary:disabled,
.acf-btn-primary.disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Hide WooCommerce added_to_cart link inside our wrappers */
.acf-exclusive-products-wrapper .added_to_cart,
.acf-related-products-wrapper .added_to_cart,
.acf-popup-overlay .added_to_cart,
.acf-popup-modal .added_to_cart,
.acf-preview-actions .added_to_cart,
.acf-product-preview-popup .added_to_cart,
a.added_to_cart[href*="carrito"],
a.added_to_cart[href*="cart"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    pointer-events: none !important;
}

.acf-btn-outline {
    background: transparent;
    color: #c41230;
    border: 2px solid #c41230;
    padding: 10px 18px;
}

.acf-btn-outline:hover {
    background: #c41230;
    color: #fff;
}

/* Product Preview Modal */
.acf-preview-modal {
    max-width: 700px;
}

.acf-preview-content {
    display: flex;
    gap: 24px;
    padding: 24px;
    padding-top: 48px;
    max-height: 70vh;
    overflow-y: auto;
}

/* Gallery Styles */
.acf-preview-gallery {
    flex: 0 0 280px;
    max-width: 280px;
}

.acf-gallery-main {
    position: relative;
    margin-bottom: 12px;
}

.acf-gallery-image {
    width: 100%;
    aspect-ratio: 1;
    background: #f8f8f8;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.acf-gallery-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.acf-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    max-width: 36px;
    max-height: 36px;
    border: none;
    background: #e0e0e0;
    color: #555;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
    z-index: 2;
    padding: 0;
    aspect-ratio: 1;
    box-sizing: border-box;
    opacity: 0;
}

.acf-gallery-main:hover .acf-gallery-nav {
    opacity: 1;
}

.acf-gallery-nav:hover {
    background: #c41230;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.acf-gallery-prev {
    left: 8px;
}

.acf-gallery-next {
    right: 8px;
}

.acf-gallery-thumbs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.acf-gallery-thumb {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.acf-gallery-thumb:hover {
    opacity: 0.9;
}

.acf-gallery-thumb.active {
    border-color: #c41230;
    opacity: 1;
}

.acf-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Preview Details */
.acf-preview-details {
    flex: 1;
    min-width: 0;
}

.acf-preview-brand {
    font-size: 12px;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.acf-preview-brand a {
    color: inherit;
    text-decoration: none;
}

.acf-preview-brand a:hover {
    color: #c41230;
}

.acf-preview-title {
    margin: 0 0 12px;
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
}

.acf-preview-sku {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.acf-preview-categories {
    font-size: 13px;
    color: #666;
    margin-bottom: 12px;
}

.acf-preview-categories a {
    color: #c41230;
    text-decoration: none;
}

.acf-preview-categories a:hover {
    text-decoration: underline;
}

.acf-preview-price {
    margin-bottom: 8px;
    font-size: 18px;
}

.acf-preview-price del {
    color: #999;
    font-size: 15px;
    margin-right: 8px;
}

.acf-preview-price ins {
    text-decoration: none;
    font-weight: 600;
    color: #c41230;
}

.acf-preview-price .acf-discount-badge {
    display: inline-block;
    background: #c41230;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.acf-preview-stock {
    font-size: 14px;
    margin-bottom: 16px;
}

.acf-preview-stock .in-stock {
    color: #28a745;
}

.acf-preview-stock .out-of-stock {
    color: #dc3545;
}

.acf-preview-description {
    font-size: 14px;
    color: #555;
    line-height: 1.6;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.acf-preview-description p {
    margin: 0 0 10px;
}

.acf-preview-description p:last-child {
    margin-bottom: 0;
}

/* Preview Modal Footer */
.acf-product-preview-popup .acf-popup-footer {
    border-top: 1px solid #eee;
    justify-content: center;
}

/* Confirmation Popup (shown over preview) */
.acf-confirm-popup {
    z-index: 1000000;
}

.acf-confirm-popup .acf-popup-modal {
    max-width: 420px;
}

/* Responsive */
@media (max-width: 700px) {
    .acf-preview-modal {
        max-width: 95%;
        margin: 10px;
    }
    
    .acf-preview-content {
        flex-direction: column;
        padding: 16px;
        padding-top: 40px;
        max-height: 80vh;
    }
    
    .acf-preview-gallery {
        flex: 0 0 auto;
        max-width: 100%;
    }
    
    .acf-gallery-image {
        max-height: 250px;
        aspect-ratio: auto;
    }
    
    .acf-preview-details {
        text-align: left;
    }
    
    .acf-popup-footer {
        flex-direction: column;
        padding: 16px;
    }
    
    .acf-popup-btn {
        width: 100%;
        text-align: center;
    }
}

/* Legacy button support */
.acf-popup-cancel,
.acf-popup-continue {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.acf-popup-cancel {
    background: #f0f0f0;
    color: #333;
}

.acf-popup-cancel:hover {
    background: #e0e0e0;
}

.acf-popup-continue {
    background: #c41230;
    color: #fff;
}

.acf-popup-continue:hover {
    background: #a00f28;
}

/* AJAX Add to Cart Button States */
.acf-ajax-add-to-cart.loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.acf-ajax-add-to-cart.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-top: -8px;
    margin-left: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: acfSpinner 0.8s linear infinite;
}

@keyframes acfSpinner {
    to {
        transform: rotate(360deg);
    }
}

.acf-ajax-add-to-cart.added {
    background: #4caf50 !important;
    border-color: #4caf50 !important;
}

/* ACF Product Carousel */
.acf-product-carousel {
    position: relative;
}

.acf-product-carousel .splide__list {
    display: flex !important;
    align-items: stretch !important;
}

.acf-product-carousel .splide__slide {
    flex-shrink: 0;
    display: flex;
    height: auto !important;
}

.acf-product-carousel .splide__slide .products {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    width: 100%;
}

.acf-product-carousel .splide__slide .products .product {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 10px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Equal height inner wrappers - common theme patterns */
.acf-product-carousel .splide__slide .products .product > .product-wrapper,
.acf-product-carousel .splide__slide .products .product > .content-product-inner,
.acf-product-carousel .splide__slide .products .product > .product-inner,
.acf-product-carousel .splide__slide .products .product > .inner-product,
.acf-product-carousel .splide__slide .products .product > div:first-child {
    display: flex;
    flex-direction: column;
    height: 100%;
    flex: 1;
}

.acf-product-carousel .splide__slide .products .product .product-details,
.acf-product-carousel .splide__slide .products .product .product-info,
.acf-product-carousel .splide__slide .products .product .product-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.acf-product-carousel .splide__slide .products .product .product-button-group,
.acf-product-carousel .splide__slide .products .product .add-to-cart-wrap,
.acf-product-carousel .splide__slide .products .product .product-actions {
    margin-top: auto;
}

/* Ensure product card borders/backgrounds stretch full height */
.acf-product-carousel .splide__slide .products .product.content-bg {
    background: #fff;
}

.acf-product-carousel .splide__slide .products .product.entry {
    height: 100%;
}

.acf-product-carousel .splide__arrows {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 10;
}

.acf-product-carousel .splide__arrow {
    pointer-events: auto;
    position: absolute;
    background: #e0e0e0;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
}

.acf-product-carousel .splide__arrow:hover {
    background: #c41230;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.acf-product-carousel .splide__arrow--prev {
    left: -20px;
}

.acf-product-carousel .splide__arrow--next {
    right: -20px;
}

.acf-product-carousel .splide__arrow svg {
    width: 20px;
    height: 20px;
    fill: #555;
    transition: fill 0.2s ease;
}

.acf-product-carousel .splide__arrow:hover svg {
    fill: #fff;
}
