/* Progressive Enhancement CSS for No-JavaScript Fallbacks */

/* Base styles that work without JavaScript */
.product-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
    background-color: #f8f8f8;
    transition: opacity 0.3s ease;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    filter: contrast(1.1) brightness(1.05);
}

/* No-JS fallback: Show all images immediately */
.no-js .product-image[data-src] {
    opacity: 1;
}

/* Fallback for lazy loading without JavaScript */
noscript img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

/* Enhanced styles when JavaScript is available */
.js .product-image.lazy {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

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

/* Form enhancements that work without JavaScript */
.cart-form {
    display: block;
}

.cart-form input[type="submit"] {
    background: #e91e63;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.cart-form input[type="submit"]:hover {
    background: #c2185b;
}

/* Pagination works without JavaScript */
.pagination a {
    display: inline-block;
    padding: 8px 16px;
    margin: 0 2px;
    background: #e91e63;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.2s;
}

.pagination a:hover {
    background: #c2185b;
}

.pagination a.active {
    background: #ad1457;
}

/* Search form enhancement */
.search-form {
    margin: 20px 0;
}

.search-form input[type="text"] {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 200px;
}

.search-form input[type="submit"] {
    padding: 10px 20px;
    background: #e91e63;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 10px;
}

/* Mobile-first responsive design */
@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .product-image {
        height: 180px;
    }
    
    .search-form input[type="text"] {
        width: 150px;
        margin-bottom: 10px;
    }
    
    .search-form input[type="submit"] {
        margin-left: 0;
        width: 100px;
    }
}

/* Print styles */
@media print {
    .product-image {
        max-height: 200px;
    }
    
    .pagination,
    .search-form {
        display: none;
    }
}
