/* Category Page Styles */
.category-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.category-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
}

.category-header .container {
    position: relative;
    z-index: 2;
}

/* Category-specific backgrounds */
.electronics-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.home-bg {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.beauty-bg {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.sports-bg {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.pet-bg {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.baby-bg {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

.toys-bg {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
}

.auto-bg {
    background: linear-gradient(135deg, #a8caba 0%, #5d4157 100%);
}

.office-bg {
    background: linear-gradient(135deg, #fddb92 0%, #d1fdff 100%);
}

.grocery-bg {
    background: linear-gradient(135deg, #e6dee9 0%, #7c7c7c 100%);
}

/* Filter Card */
.filter-card {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
    margin-bottom: 2rem;
}

/* Fixed Height Product Cards */
.category-products .row {
    display: flex;
    flex-wrap: wrap;
}

.category-products .col-lg-3,
.category-products .col-md-4, 
.category-products .col-sm-6,
.category-products .col-12 {
    display: flex;
    margin-bottom: 2rem;
}

.category-product-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: none;
    overflow: hidden;
    width: 100%;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.category-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

/* Image Container with Hover Effect */
.category-product-image-container {
    position: relative;
    height: 220px;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.category-product-image {
    max-height: 180px;
    width: auto;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

.category-product-hover-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.category-product-image-container:hover .category-product-image {
    opacity: 0;
}

.category-product-image-container:hover .category-product-hover-image {
    opacity: 1;
}

/* Card Body - Fixed Height Content */
.category-product-body {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.category-product-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    min-height: 3.2rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.category-product-vendor {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
    min-height: 1.5rem;
}

.category-product-rating {
    margin-bottom: 0.5rem;
    min-height: 1.5rem;
}

.stars {
    color: #ffc107;
}

.category-product-price {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    min-height: 2.5rem;
}

.category-current-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: #007bff;
}

.category-original-price {
    font-size: 1rem;
    color: #6c757d;
    text-decoration: line-through;
}

.category-discount {
    background: #28a745;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Add to Cart Button - Always at Bottom */
.category-product-actions {
    margin-top: auto;
    padding-top: 1rem;
}

.category-product-actions .btn {
    width: 100%;
}

/* Badge Positioning */
.category-product-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 3;
}

.category-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 3;
}

/* Fallback for products without hover images */
.category-product-image-container:not(.has-hover-image):hover .category-product-image {
    opacity: 1;
}

/* Breadcrumb Styles */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 1rem;
}

.breadcrumb-item a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
}

.breadcrumb-item.active {
    color: white;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: rgba(255, 255, 255, 0.6);
}

/* Loading States */
#loading-state {
    text-align: center;
    padding: 3rem;
}

#empty-state {
    text-align: center;
    padding: 3rem;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .category-products .col-lg-3 {
        flex: 0 0 33.333%;
        max-width: 33.333%;
    }
}

@media (max-width: 992px) {
    .category-products .col-lg-3,
    .category-products .col-md-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .category-product-image-container {
        height: 200px;
    }
    
    .category-product-image,
    .category-product-hover-image {
        max-height: 160px;
    }
}

@media (max-width: 768px) {
    .category-title {
        font-size: 2.5rem;
    }
    
    .filter-card .row {
        gap: 1rem;
    }
    
    .filter-card .col-md-4 {
        width: 100%;
    }
    
    .category-products .col-md-4,
    .category-products .col-sm-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .category-product-image-container {
        height: 180px;
    }
    
    .category-product-image,
    .category-product-hover-image {
        max-height: 140px;
    }
    
    .category-product-body {
        padding: 1.25rem;
    }
    
    .category-product-title {
        font-size: 1rem;
        min-height: 2.8rem;
    }
}

@media (max-width: 576px) {
    .category-header {
        padding: 2rem 0;
    }
    
    .category-title {
        font-size: 2rem;
    }
    
    .category-product-image-container {
        height: 160px;
    }
    
    .category-product-image,
    .category-product-hover-image {
        max-height: 120px;
    }
    
    .category-products .col-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Ensure all cards have equal height */
.row.g-4 {
    align-items: stretch;
}

/* View More Button Styles */
#view-more-container {
    margin-top: 2rem;
}

#view-more-button {
    padding: 12px 40px;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
}

#view-more-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.3);
}

/* Loading animation for new products */
.category-product-card.loading {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s ease forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ensure smooth loading of new products */
#products-container {
    transition: all 0.3s ease;
}


#view-more-container {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
    transition: all 0.3s ease;
}

#view-more-container.d-none {
    display: none !important;
}

#view-more-container[style*="display: none"] {
    display: none !important;
}