products.css

5.46 KB
05/11/2024 09:07
CSS
products.css
/* Animation Keyframes */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Category Section */
.category-section {
    margin-bottom: 4rem;
    opacity: 1;
}

.category-title {
    font-size: 2rem;
    color: var(--secondary-color);
    margin-bottom: 2rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    opacity: 1;
}

.category-title i {
    color: var(--primary-color);
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    opacity: 1;
}

/* Product Card */
.product-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    opacity: 1;
    animation: fadeIn 0.5s ease forwards;
}

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

/* Product Image */
.product-image-container {
    position: relative;
    padding-top: 75%; /* 4:3 Aspect Ratio */
    overflow: hidden;
    background: #f8f9fa;
    opacity: 1;
}

.product-image-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    opacity: 1;
}

.product-card:hover .product-image-container img {
    transform: scale(1.1);
}

/* Product Tags */
.product-tags {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    z-index: 1;
    opacity: 1;
}

.product-tag {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    backdrop-filter: blur(4px);
    opacity: 1;
}

.product-tag i {
    font-size: 0.8rem;
}

/* Product Content */
.product-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    opacity: 1;
}

.product-title {
    font-size: 1.25rem;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
    font-weight: 600;
    line-height: 1.4;
    opacity: 1;
}

.product-description {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    flex-grow: 1;
    opacity: 1;
}

/* Nutrition Info */
.nutrition-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    opacity: 1;
}

.nutrition-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #666;
    opacity: 1;
}

.nutrition-item i {
    color: var(--primary-color);
    font-size: 1rem;
}

/* Product Footer */
.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    opacity: 1;
}

.product-price {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    opacity: 1;
}

.add-to-cart-btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    border: none;
    border-radius: 25px;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    opacity: 1;
}

.add-to-cart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 153, 51, 0.3);
}

.add-to-cart-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Stock Warning */
.stock-warning {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: rgba(255, 87, 34, 0.9);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    animation: fadeIn 0.3s ease;
    opacity: 1;
}

/* No Products Found */
.no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    background: #f8f9fa;
    border-radius: 15px;
    opacity: 1;
}

.no-products i {
    font-size: 3rem;
    color: #ccc;
    margin-bottom: 1rem;
}

/* Product Count */
.product-count {
    margin-bottom: 1rem;
    color: #666;
    font-size: 0.9rem;
    opacity: 1;
}

/* Allergens */
.product-allergens {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: #666;
    opacity: 1;
}

.product-allergens small {
    display: block;
    padding: 0.5rem;
    background: #fff3e0;
    border-radius: 5px;
    opacity: 1;
}

/* Loading Placeholder */
.product-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    opacity: 1;
}

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

/* Responsive Adjustments */
@media (max-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
}