/* Product Optimization Styles */

/* 1. Skeleton Loader for Images */
.image-skeleton {
    background: linear-gradient(90deg, 
        #f0f0f0 25%, 
        #e0e0e0 50%, 
        #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 5px;
    width: 100%;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.image-skeleton::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23ccc"><path d="m21 19v-14c0-1.1-.9-2-2-2h-14c0-1.1-.9-2-2-2s-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2zm-10-6l2.5 3.01 3.5-4.51 4 5.5h-14l4-4z"/></svg>') no-repeat center;
    background-size: contain;
    opacity: 0.3;
}

@keyframes loading {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* 2. Fixed Image Container Height */
.cr-product-image {
    height: 200px !important; /* Altura fija para todas las imágenes */
    min-height: 200px;
    position: relative;
    overflow: hidden;
}

.cr-product-image .cr-image-inner {
    height: 100%;
    width: 100%;
}

.cr-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Mantiene proporción y recorta si es necesario */
    object-position: center;
    transition: opacity 0.3s ease;
}

.cr-product-image img.loading {
    opacity: 0;
}

.cr-product-image img.loaded {
    opacity: 1;
}

/* 3. Product Card Consistent Height */
.cr-product-card {
    height: auto;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.cr-product-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* 4. Loading States */
.products-loading {
    opacity: 0.7;
    pointer-events: none;
}

.product-fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 5. Pagination Loading Indicator */
.pagination-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.pagination-loading i {
    font-size: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.pagination-end {
    text-align: center;
    padding: 20px;
    color: #999;
    font-style: italic;
}

/* 6. Responsive Adjustments */
@media (max-width: 768px) {
    .cr-product-image {
        height: 180px !important;
        min-height: 180px;
    }
    
    .cr-product-card {
        min-height: 350px;
    }
}

@media (max-width: 480px) {
    .cr-product-image {
        height: 160px !important;
        min-height: 160px;
    }
    
    .cr-product-card {
        min-height: 320px;
    }
}

/* 7. Improved Hover Effects */
.cr-product-box:hover .cr-product-image img {
    transform: scale(1.05);
    transition: transform 0.3s ease;
}

.cr-product-box .cr-product-image img {
    transition: transform 0.3s ease;
}
