/* WooCommerce Snap Scroll Styles */

.wc-snap-scroll-container {
    position: relative;
    width: 100%;
    margin: 20px 0 15px 0;
    overflow: hidden;
    --wc-snap-card-bg: #ffffff;
    --wc-snap-title-color: #333333;
    --wc-snap-price-color: #4a4a4a;
    --wc-snap-add-to-cart-bg: #4CAF50;
    --wc-snap-add-to-cart-text: #ffffff;
    --wc-snap-add-to-cart-feedback: #ffffff;
    --wc-snap-view-btn-bg: #f0f0f0;
    --wc-snap-nav-bg: #f7f7f7;
    --wc-snap-badge-sale-color: #ff6b6b;
    --wc-snap-badge-new-color: #00bcd4;
    --wc-snap-badge-featured-color: #ff9800;
    --wc-snap-badge-oos-color: #999999;
    --wc-snap-badge-bestseller-color: #e91e63;
    --wc-snap-title-lines: 2;
}

/* Section header */
.wc-snap-scroll-header {
    margin-bottom: 15px;
}

.wc-snap-scroll-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--wc-snap-title-color, #333);
}

.wc-snap-scroll-divider {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 0 0 5px 0;
    padding: 0;
}

.wc-snap-scroll-wrapper {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    padding: 7px 30px;
    will-change: scroll-position; /* Hint for browser optimization */
    -webkit-backface-visibility: hidden; /* Prevents jank during scrolling */
    backface-visibility: hidden;
    transform: translateZ(0); /* Force hardware acceleration */
}

/* Hide scrollbar for Chrome/Safari/Opera */
.wc-snap-scroll-wrapper::-webkit-scrollbar {
    display: none;
}

.wc-snap-scroll-item {
    flex: 0 0 auto;
    width: 250px;
    margin-right: 20px;
    scroll-snap-align: start;
    border-radius: 8px;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    background: var(--wc-snap-card-bg, #fff);
    will-change: transform; /* Optimize for animations */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
}

/* Product item styling */
.wc-snap-scroll-product {
    flex: 0 0 auto;
    width: 250px;
    margin-right: 20px;
    scroll-snap-align: start;
    border-radius: 8px;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    background: var(--wc-snap-card-bg, #fff);
    padding: 9px;
    will-change: transform; /* Optimize for animations */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
    justify-content: space-between;
    display: flex;
    flex-flow: column nowrap;
    cursor: pointer;
}

.wc-snap-scroll-product:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.wc-snap-scroll-product--ghost {
    cursor: default;
    pointer-events: none;
    box-shadow: none;
}

.wc-snap-scroll-product--ghost:hover {
    transform: translateZ(0);
    box-shadow: none;
}

.wc-snap-scroll-product--ghost .wc-snap-scroll-product-image,
.wc-snap-scroll-product--ghost .wc-snap-scroll-product-details,
.wc-snap-scroll-product--ghost .wc-snap-scroll-product-actions {
    width: 100%;
}

.wc-snap-scroll-ghost-media,
.wc-snap-scroll-ghost-line,
.wc-snap-scroll-ghost-pill,
.wc-snap-scroll-ghost-button {
    display: block;
    background: linear-gradient(90deg, #eff3f8 0%, #e2e9f1 50%, #eff3f8 100%);
    background-size: 200% 100%;
    animation: wcSnapGhostShimmer 1.2s ease-in-out infinite;
}

.wc-snap-scroll-ghost-media {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 6px;
}

.wc-snap-scroll-ghost-attributes {
    gap: 6px;
}

.wc-snap-scroll-ghost-pill {
    height: 24px;
    border-radius: 999px;
    width: 100%;
}

.wc-snap-scroll-ghost-pill--short {
    width: 72%;
}

.wc-snap-scroll-ghost-line {
    border-radius: 999px;
    margin-bottom: 12px;
}

.wc-snap-scroll-ghost-line--title {
    height: 18px;
    width: 88%;
}

.wc-snap-scroll-ghost-line--price {
    height: 14px;
    width: 36%;
}

.wc-snap-scroll-ghost-button {
    flex: 1;
    height: 34px;
    border-radius: 4px;
}

.wc-snap-scroll-ghost-button--secondary {
    opacity: 0.8;
}

.wc-snap-scroll-product-image {
    position: relative;
    margin-bottom: 10px;
}

.wc-snap-scroll-product-image a {
    display: block;
    text-decoration: none !important;
    color: inherit;
}

.wc-snap-scroll-product-image img {
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 6px;
}

/* Badge styling */
.wc-snap-scroll-badges {
    position: absolute;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 2;
}

.wc-snap-scroll-badges--top-left {
    top: 8px;
    left: 8px;
}

.wc-snap-scroll-badges--top-right {
    top: 8px;
    right: 8px;
    align-items: flex-end;
}

.wc-snap-scroll-badges--bottom-left {
    left: 8px;
    bottom: 8px;
}

.wc-snap-scroll-badges--bottom-right {
    right: 8px;
    bottom: 8px;
    align-items: flex-end;
}

.wc-snap-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wc-snap-badge--sale {
    background-color: var(--wc-snap-badge-sale-color, #ff6b6b);
}

.wc-snap-badge--new {
    background-color: var(--wc-snap-badge-new-color, #00bcd4);
}

.wc-snap-badge--featured {
    background-color: var(--wc-snap-badge-featured-color, #ff9800);
}

.wc-snap-badge--oos {
    background-color: var(--wc-snap-badge-oos-color, #999999);
}

.wc-snap-badge--bestseller {
    background-color: var(--wc-snap-badge-bestseller-color, #e91e63);
}

.wc-snap-badge--custom {
    background-color: #6c757d;
}

.wc-snap-badge--image {
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.wc-snap-badge__image {
    display: block;
    max-width: 84px;
    max-height: 36px;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Product image hover effect */
.wc-snap-scroll-image-hover-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    border-radius: 6px;
}

.wc-snap-scroll-product-img,
.wc-snap-scroll-product-img-hover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    transition: opacity 0.3s ease;
}

.wc-snap-scroll-product-img-hover {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    z-index: 1;
}

.wc-snap-scroll-image-hover-container:hover .wc-snap-scroll-product-img-hover {
    opacity: 1;
}

.wc-snap-scroll-image-hover-container:hover .wc-snap-scroll-product-img {
    opacity: 0;
}

/* Product title */
.wc-snap-scroll-product-title {
    font-size: 1rem !important;
    margin-bottom: 12px;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: var(--wc-snap-title-lines, 2);
    line-clamp: var(--wc-snap-title-lines, 2);
    -webkit-box-orient: vertical;
    color: var(--wc-snap-title-color, #333);
}

.wc-snap-scroll-product-title a {
    text-decoration: none !important;
    color: inherit;
}

/* Product attributes */
.wc-snap-scroll-product-attributes {
    font-size: 0.78rem;
    color: #5f6368;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 6px;
}

.wc-snap-attr {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    line-height: 1.2;
    padding: 5px 9px;
    border-radius: 999px;
    background: #f3f5f7;
    border: 1px solid #e4e8ec;
    white-space: nowrap;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    flex: 0 1 auto;
    overflow: hidden;
}

.wc-snap-attr .attr-label {
    display: inline-block;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    color: #41464b;
}

.wc-snap-attr .attr-value {
    flex: 0 0 auto;
    max-width: 62%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Product price */
.wc-snap-scroll-product-price {
    display: block;
    font-weight: bold;
    color: var(--wc-snap-price-color, #4a4a4a);
    margin-bottom: 12px;
}

/* Quantity controls */
.wc-snap-scroll-quantity {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 2px;
    background: #f9f9f9;
}

.wc-snap-qty-minus,
.wc-snap-qty-plus {
    background: transparent;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    color: #333;
    transition: color 0.2s ease;
}

.wc-snap-qty-minus:hover,
.wc-snap-qty-plus:hover {
    color: var(--wc-snap-add-to-cart-bg, #4CAF50);
}

.wc-snap-qty-input {
    width: 50px;
    padding: 4px 8px;
    border: none;
    text-align: center;
    font-size: 0.9rem;
    background: transparent;
}

.wc-snap-qty-input::-webkit-outer-spin-button,
.wc-snap-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.wc-snap-qty-input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Product actions */
.wc-snap-scroll-product-actions {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 12px;
}

.wc-snap-scroll-product-actions .button {
    flex: 1;
    padding: 8px 10px;
    text-align: center;
    border-radius: 4px;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.2s ease;
    display: block;
    border: none;
    cursor: pointer;
    font-weight: 500;
    text-decoration: none !important;
}

.wc-snap-scroll-container .wc-snap-scroll-product-actions .add_to_cart_button,
.wc-snap-scroll-container .wc-snap-scroll-product-actions .wc-snap-scroll-add-to-cart-button.add_to_cart_button {
    color: var(--wc-snap-add-to-cart-text, #fff);
}

.wc-snap-scroll-product-actions .add_to_cart_button:hover {
    opacity: 0.9;
}

.wc-snap-scroll-product-actions .wc-snap-scroll-add-to-cart-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
}

.wc-snap-scroll-product-actions .added_to_cart.wc-forward {
    display: none;
}

.wc-snap-scroll-product-actions .wc-snap-atc-visual {
    position: relative;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
}

.wc-snap-scroll-product-actions .wc-snap-atc-icon,
.wc-snap-scroll-product-actions .wc-snap-atc-check {
    position: absolute;
    inset: 0;
}

.wc-snap-scroll-product-actions .wc-snap-atc-icon {
    background-color: var(--wc-snap-add-to-cart-text, #fff);
    -webkit-mask-image: var(--wc-snap-atc-icon-url);
    mask-image: var(--wc-snap-atc-icon-url);
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
    transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
}

.wc-snap-scroll-product-actions .wc-snap-atc-check {
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.wc-snap-scroll-product-actions .wc-snap-atc-check::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 12px;
    border-right: 3px solid var(--wc-snap-add-to-cart-feedback, #fff);
    border-bottom: 3px solid var(--wc-snap-add-to-cart-feedback, #fff);
    transform: rotate(45deg);
}

.wc-snap-scroll-product-actions .wc-snap-scroll-add-to-cart-button.is-loading .wc-snap-atc-icon {
    background-color: var(--wc-snap-add-to-cart-feedback, #fff);
    animation: wcSnapAtcSpin 0.9s linear infinite;
}

.wc-snap-scroll-product-actions .wc-snap-scroll-add-to-cart-button.is-added .wc-snap-atc-icon {
    opacity: 0;
    transform: scale(0.72);
    animation: none;
}

.wc-snap-scroll-product-actions .wc-snap-scroll-add-to-cart-button.is-added .wc-snap-atc-check {
    opacity: 1;
    transform: scale(1);
}

.wc-snap-scroll-product-actions .view-product {
    background-color: var(--wc-snap-view-btn-bg, #f0f0f0);
    color: #333;
}

.wc-snap-scroll-product-actions .wc-snap-scroll-add-to-cart-button:not(.add_to_cart_button) {
    background-color: var(--wc-snap-view-btn-bg, #f0f0f0);
    color: #333;
}

.wc-snap-scroll-product-actions .view-product:hover {
    filter: brightness(0.96);
}

.wc-snap-scroll-product-actions .wc-snap-scroll-add-to-cart-button:not(.add_to_cart_button):hover {
    filter: brightness(0.96);
}

.wc-snap-scroll-product-actions .button.disabled {
    background-color: var(--wc-snap-view-btn-bg, #f0f0f0);
    color: #999;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Navigation buttons */
.wc-snap-scroll-navigation {
    display: flex;
    justify-content: space-between;
    margin: 10px 0;
    gap: 7em;
}

.wc-snap-scroll-btn {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    background-color: var(--wc-snap-nav-bg, #f7f7f7);
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    color: #333;
}

.wc-snap-scroll-btn:hover {
    background-color: var(--wc-snap-nav-bg, #f7f7f7);
    filter: brightness(0.96);
    border-color: #ccc;
}

@keyframes wcSnapGhostShimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

@keyframes wcSnapAtcSpin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.wc-snap-scroll-btn:active {
    background-color: var(--wc-snap-nav-bg, #f7f7f7);
    filter: brightness(0.92);
}

.wc-snap-scroll-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.wc-snap-scroll-btn-left {
    padding-right: 12px;
}

.wc-snap-scroll-btn-right {
    padding-left: 12px;
}

.wc-snap-scroll-btn-left svg {
    margin-right: 8px;
}

.wc-snap-scroll-btn-right svg {
    margin-left: 8px;
}

.wc-snap-scroll-btn-hidden {
    opacity: 0.5;
    pointer-events: none;
}

.wc-snap-scroll-btn-disabled {
    opacity: 0.7;
    pointer-events: none;
    cursor: not-allowed;
    transition: opacity 0.2s ease;
}

.wc-snap-scroll-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.wc-snap-scroll-item a {
    display: block;
    padding: 15px;
    text-decoration: none;
    color: inherit;
    text-decoration: none !important;
}

.wc-snap-scroll-item img {
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 10px;
}

.wc-snap-scroll-item h3 {
    font-size: 1rem !important;
    margin-bottom: 12px;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: var(--wc-snap-title-lines, 2);
    line-clamp: var(--wc-snap-title-lines, 2);
    -webkit-box-orient: vertical;
    color: var(--wc-snap-title-color, #333);
}

.wc-snap-scroll-item .price {
    display: block;
    font-weight: bold;
    color: var(--wc-snap-price-color, #4a4a4a);
    margin-bottom: 12px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .wc-snap-scroll-product,
    .wc-snap-scroll-item {
        width: 200px;
    }
    
    .wc-snap-scroll-btn {
        padding: 6px 12px;
        font-size: 14px;
    }
    
    .wc-snap-scroll-btn svg {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 480px) {
    .wc-snap-scroll-product,
    .wc-snap-scroll-item {
        width: 220px;
        margin-right: 15px;
    }
    
    .wc-snap-scroll-product-title,
    .wc-snap-scroll-item h3 {
        font-size: 16px;
    }
    
    .wc-snap-scroll-btn {
        padding: 5px 10px;
        font-size: 12px;
    }
    
    .wc-snap-scroll-btn svg {
        width: 26px;
        height: 26px;
    }
    
    .wc-snap-scroll-btn span {
        display: none;
    }
    
    .wc-snap-scroll-btn-left, .wc-snap-scroll-btn-right {
        padding: 5px;
    }
    
    .wc-snap-scroll-btn-left svg, .wc-snap-scroll-btn-right svg {
        margin: 0;
    }
    
    .wc-snap-scroll-product-actions {
        flex-direction: column;
    }
    
    .wc-snap-scroll-quantity {
        width: 100%;
        margin-bottom: 10px;
    }
}
