/* Webup Products Grid */
.webup-products-grid {
    width: 100%;
}

.webup-products-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.webup-no-products {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 16px;
}

/* Product Card */
.webup-product-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.webup-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Image Wrapper */
.webup-product-image-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
}

.webup-product-image-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0);
    transition: background-color 0.3s ease;
    pointer-events: none;
}

.webup-product-image-wrapper:hover::after {
    background-color: rgba(0, 0, 0, 0.03);
}

/* Image Ratios */
.webup-product-image-wrapper.ratio-1-1 {
    aspect-ratio: 1 / 1;
}

.webup-product-image-wrapper.ratio-4-3 {
    aspect-ratio: 4 / 3;
}

.webup-product-image-wrapper.ratio-3-4 {
    aspect-ratio: 3 / 4;
}

.webup-product-image-wrapper.ratio-16-9 {
    aspect-ratio: 16 / 9;
}

.webup-product-image-wrapper.ratio-9-16 {
    aspect-ratio: 9 / 16;
}

.webup-product-image-wrapper.ratio-auto {
    aspect-ratio: auto;
}

.webup-product-link {
    display: block;
    width: 100%;
    height: 100%;
}

/* Product Images */
.webup-product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.4s ease;
}

.webup-product-image.secondary {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
}

/* Gallery hover: Vis secondary billede ved hover (kun når swatches ikke hoveres) */
.webup-product-image-wrapper.has-secondary:hover .webup-product-image.primary {
    opacity: 0;
}

.webup-product-image-wrapper.has-secondary:hover .webup-product-image.secondary {
    opacity: 1;
}

/* Deaktiver gallery hover når swatches hoveres */
.webup-product-image-wrapper.has-secondary.swatch-hover .webup-product-image.primary {
    opacity: 1;
}

.webup-product-image-wrapper.has-secondary.swatch-hover .webup-product-image.secondary {
    opacity: 0;
}

/* Sale Badge */
.webup-sale-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #e74c3c;
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    z-index: 2;
    line-height: 1.4;
}

/* Tags Overlay (on image hover) */
.webup-product-tags-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 2;
}

.webup-product-image-wrapper:hover .webup-product-tags-overlay {
    opacity: 1;
    transform: translateY(0);
}

.webup-product-tags-overlay .webup-product-tag {
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    font-size: 11px;
}

/* Product Swatches Overlay */
.webup-product-swatches-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.85), transparent);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 3;
}

.webup-product-image-wrapper:hover .webup-product-swatches-overlay {
    opacity: 1;
    transform: translateY(0);
}

.webup-product-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-sizing: border-box;
    background: #fff;
}

.webup-product-swatch:hover {
    transform: scale(1.15);
    border-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.webup-product-swatch.active {
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.5);
}

.webup-product-swatch.color {
    border-width: 2px;
}

.webup-product-swatch.image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.webup-product-swatch.button {
    width: auto;
    height: auto;
    min-width: 28px;
    min-height: 24px;
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 500;
    background: #fff;
    color: #333;
    line-height: 1;
}

.webup-product-swatch.more {
    background: rgba(255, 255, 255, 0.9);
    font-size: 11px;
    font-weight: 500;
    color: #333;
    cursor: default;
}

.webup-product-swatch.more:hover {
    transform: none;
    box-shadow: none;
}

/* Product Content */
.webup-product-content {
    padding: 15px;
}

/* Product Title */
.webup-product-title {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
}

.webup-product-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s ease;
}

.webup-product-title a:hover {
    color: #4CAF50;
}

/* Product Tags (below title) */
.webup-product-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.webup-product-tag {
    display: inline-block;
    padding: 3px 10px;
    background: #f5f5f5;
    color: #666;
    font-size: 11px;
    border-radius: 12px;
    line-height: 1.4;
}

/* Product Price */
.webup-product-price {
    margin-top: 8px;
}

/* Add to Cart Button */
.webup-add-to-cart-btn {
    display: inline-block;
    background: #4CAF50;
    color: #fff;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    margin-top: 12px;
    border: none;
    box-sizing: border-box;
}

.webup-add-to-cart-btn:hover {
    background: #45a049;
    color: #fff;
    transform: translateY(-1px);
}

.webup-add-to-cart-btn:active {
    transform: translateY(0);
}

.webup-add-to-cart-btn.out-of-stock {
    background: #ccc;
    cursor: not-allowed;
    pointer-events: none;
}

.webup-add-to-cart-btn.out-of-stock:hover {
    transform: none;
}

.webup-add-to-cart-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.webup-add-to-cart-btn.added::after {
    content: ' \2713';
}

.webup-price-current {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.webup-product-card.on-sale .webup-price-current {
    color: #e74c3c;
}

/* WooCommerce price HTML overrides */
.webup-price-current del {
    display: none;
}

.webup-price-current ins {
    text-decoration: none;
}

/* Sale Info */
.webup-price-sale-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.webup-price-original {
    font-size: 13px;
    color: #999;
}

.webup-price-original del {
    text-decoration: none;
}

.webup-price-discount {
    font-size: 12px;
    font-weight: 600;
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
}

/* Load More */
.webup-load-more-wrapper {
    text-align: center;
    margin-top: 30px;
    padding: 20px 0;
}

.webup-load-more-btn {
    background: #4CAF50;
    color: #fff;
    border: none;
    padding: 12px 30px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.webup-load-more-btn:hover {
    background: #45a049;
    transform: translateY(-1px);
}

.webup-load-more-btn:active {
    transform: translateY(0);
}

.webup-load-more-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.webup-load-more-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Loading Spinner */
.webup-loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #e0e0e0;
    border-top-color: #4CAF50;
    border-radius: 50%;
    animation: webup-spin 0.8s linear infinite;
    vertical-align: middle;
    margin-left: 10px;
}

@keyframes webup-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Infinite Scroll Trigger */
.webup-infinite-trigger {
    height: 1px;
    margin-top: 20px;
}

/* Product Card Animation on Load */
.webup-product-card.webup-fade-in {
    animation: webup-fadeInUp 0.4s ease forwards;
    opacity: 0;
}

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

/* Staggered animation delay for new products */
.webup-product-card.webup-fade-in:nth-child(4n+1) { animation-delay: 0s; }
.webup-product-card.webup-fade-in:nth-child(4n+2) { animation-delay: 0.1s; }
.webup-product-card.webup-fade-in:nth-child(4n+3) { animation-delay: 0.2s; }
.webup-product-card.webup-fade-in:nth-child(4n+4) { animation-delay: 0.3s; }

/* Responsive */
@media (max-width: 1024px) {
    .webup-products-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .webup-products-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .webup-product-title {
        font-size: 14px;
    }

    .webup-price-current {
        font-size: 15px;
    }

    .webup-product-swatch {
        width: 24px;
        height: 24px;
    }

    .webup-sale-badge {
        font-size: 11px;
        padding: 3px 8px;
    }

    .webup-product-content {
        padding: 12px;
    }

    .webup-product-swatches {
        padding: 10px 12px 0;
    }
}

@media (max-width: 480px) {
    .webup-products-container {
        gap: 12px;
    }

    .webup-product-title {
        font-size: 13px;
    }

    .webup-price-current {
        font-size: 14px;
    }

    .webup-price-sale-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .webup-product-swatch {
        width: 22px;
        height: 22px;
    }

    .webup-load-more-btn {
        width: 100%;
        padding: 14px 20px;
    }
}
