body {
    font-family: 'Poppins', sans-serif;
    background-color: #e0f7fa; /* Baby blue background */
    color: #333; /* Default text color */
}

h1, h2, h3, h4, h5, h6 {
    color: #00796b; /* Darker shade for headings */
}

a {
    color: #00796b; /* Link color */
}

a:hover {
    color: #004d40; /* Darker shade on hover */
}

.navbar {
    background-color: #b2ebf2; /* Light baby blue for navbar */
}

.footer {
    background-color: #b2ebf2; /* Light baby blue for footer */
    padding: 20px 0;
    text-align: center;
}

.btn-primary {
    background-color: #00796b; /* Primary button color */
    border-color: #00796b; /* Border color */
}

.btn-primary:hover {
    background-color: #004d40; /* Darker shade on hover */
    border-color: #004d40; /* Darker border on hover */
}

.card {
    border: 1px solid #b2ebf2; /* Light border for cards */
}

.card-header {
    background-color: #e0f7fa; /* Baby blue for card header */
}

.card-footer {
    background-color: #b2ebf2; /* Light baby blue for card footer */
}

/* Carousel Product Styles */
.carousel-product-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.carousel-product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s;
    z-index: 1;
    pointer-events: none;
}

.carousel-product-card:hover::before {
    left: 100%;
}

.carousel-product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    border-color: #00796b;
}

.product-image-container {
    width: 100%;
    height: 280px;
    overflow: hidden;
    border-radius: 15px;
    background: linear-gradient(45deg, #f0f9ff 0%, #e0f7fa 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    /* Enhanced image container stability */
    position: relative;
    /* Ensure consistent sizing regardless of content */
    min-height: 280px;
    max-height: 280px;
}

/* Loading placeholder for images */
.product-image-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, #f0f9ff 0%, #e0f7fa 100%);
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-image-container:not(:has(img[src])) ::before {
    opacity: 1;
}

.carousel-product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px;
    transition: transform 0.3s ease;
    /* Enhanced image loading performance */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    /* Ensure consistent aspect ratio */
    object-position: center;
    /* Prevent image from exceeding container */
    max-width: 100%;
    max-height: 100%;
    /* Center the image if smaller than container */
    margin: auto;
    display: block;
}

.carousel-product-card:hover .carousel-product-image {
    transform: scale(1.05);
}

.carousel-product-info {
    text-align: center;
    color: #333;
}

.product-title {
    font-weight: 600;
    color: #00796b;
    margin-bottom: 8px;
    font-size: 1.1rem;
    line-height: 1.3;
}

.product-price {
    font-weight: 700;
    color: #2c3e50;
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.product-vendor {
    color: #666;
    font-style: italic;
    font-size: 0.85rem;
}

/* Enhanced carousel styling */
#productCarousel {
    max-width: 100%;
    margin: 0 auto;
}

#productCarousel .carousel-item {
    transition: transform 0.6s ease-in-out;
}

/* Fallback for browsers that don't support object-fit */
@supports not (object-fit: cover) {
    .carousel-product-image {
        width: 100%;
        height: 280px;
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
    }
}

/* Carousel Controls */
#productCarousel .carousel-control-prev,
#productCarousel .carousel-control-next {
    width: 50px;
    height: 50px;
    background: rgba(0, 121, 107, 0.8);
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

#productCarousel .carousel-control-prev {
    left: -25px;
}

#productCarousel .carousel-control-next {
    right: -25px;
}

#productCarousel .carousel-control-prev:hover,
#productCarousel .carousel-control-next:hover {
    background: rgba(0, 121, 107, 1);
    transform: translateY(-50%) scale(1.1);
}

#productCarousel .carousel-control-prev-icon,
#productCarousel .carousel-control-next-icon {
    width: 20px;
    height: 20px;
}

/* Carousel Indicators */
#productCarousel .carousel-indicators {
    bottom: -50px;
    max-width: 300px;
    margin: 0 auto;
    overflow-x: auto;
    white-space: nowrap;
    padding: 10px 0;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

#productCarousel .carousel-indicators::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

#productCarousel .carousel-indicators button {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: rgba(0, 121, 107, 0.3);
    border: 2px solid rgba(0, 121, 107, 0.5);
    margin: 0 5px;
    transition: all 0.3s ease;
}

#productCarousel .carousel-indicators button.active {
    background-color: #00796b;
    border-color: #00796b;
    transform: scale(1.2);
}

/* Product Grid Styles for Products Page */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.product-card {
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
    border: 1px solid #e0f7fa;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border-color: #00796b;
}

.product-card-image {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
    background: linear-gradient(45deg, #f0f9ff 0%, #e0f7fa 100%);
}

.product-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.product-card-body {
    padding: 20px;
}

.product-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #00796b;
    margin-bottom: 10px;
    line-height: 1.4;
    height: 2.8em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-card-description {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 15px;
    height: 2.7em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-card-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: #e91e63;
    margin-bottom: 10px;
}

.product-card-vendor {
    color: #999;
    font-size: 0.85rem;
    margin-bottom: 15px;
}

.product-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.product-category-badge {
    background: #e0f7fa;
    color: #00796b;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.stock-indicator {
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.stock-low { background: #ffebee; color: #c62828; }
.stock-medium { background: #fff3e0; color: #ef6c00; }
.stock-high { background: #e8f5e8; color: #2e7d32; }

/* Search and Filter Bar */
.search-filter-bar {
    background: #fff;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    border: 1px solid #e0f7fa;
}

.search-filter-bar .form-control,
.search-filter-bar .form-select {
    border: 2px solid #e0f7fa;
    border-radius: 10px;
    padding: 10px 15px;
    transition: border-color 0.3s ease;
}

.search-filter-bar .form-control:focus,
.search-filter-bar .form-select:focus {
    border-color: #00796b;
    box-shadow: 0 0 0 0.2rem rgba(0, 121, 107, 0.25);
}

/* Image fallback styles */
.image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(45deg, #f0f9ff 0%, #e0f7fa 100%);
    color: #00796b;
    font-size: 1.2rem;
    font-weight: 500;
    height: 100%;
    width: 100%;
}

.image-error {
    background: #ffebee;
    color: #c62828;
}

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

@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 15px;
        padding: 15px 0;
    }
    
    .product-card-body {
        padding: 15px;
    }
    
    .product-card-image {
        height: 200px;
    }
    
    /* Responsive carousel sizing for tablets */
    .product-image-container {
        height: 240px;
    }
    
    .carousel-product-card {
        margin: 15px;
        padding: 15px;
    }
    
    .search-filter-bar {
        padding: 15px;
        margin-bottom: 20px;
    }
}

/* Enhanced Mobile Carousel Responsiveness */
@media (max-width: 768px) {
    /* Mobile carousel improvements */
    #productCarousel {
        margin: 0 -15px; /* Full width on mobile */
    }
    
    .carousel-product-card {
        margin: 5px 10px;
        padding: 10px;
        border-radius: 15px;
    }
    
    .product-image-container {
        height: 200px;
        border-radius: 10px;
    }
    
    .carousel-product-info {
        padding: 10px;
    }
    
    .product-title {
        font-size: 0.95rem;
        line-height: 1.3;
        height: auto;
        margin-bottom: 8px;
    }
    
    .product-price {
        font-size: 1.1rem;
        margin-bottom: 4px;
    }
    
    .product-vendor {
        font-size: 0.8rem;
    }
    
    /* Touch-friendly carousel controls */
    #productCarousel .carousel-control-prev,
    #productCarousel .carousel-control-next {
        width: 40px;
        height: 40px;
        background: rgba(0, 121, 107, 0.9);
        border-radius: 50%;
        top: 40%;
    }
    
    #productCarousel .carousel-control-prev {
        left: 10px;
    }
    
    #productCarousel .carousel-control-next {
        right: 10px;
    }
    
    /* Larger touch targets for indicators */
    #productCarousel .carousel-indicators {
        bottom: -30px;
    }
    
    #productCarousel .carousel-indicators button {
        width: 15px;
        height: 15px;
        margin: 0 8px;
    }
}

@media (max-width: 480px) {
    /* Extra small mobile devices */
    .carousel-product-card {
        margin: 5px;
        padding: 8px;
    }
    
    .product-image-container {
        height: 180px;
    }
    
    .product-title {
        font-size: 0.9rem;
    }
    
    .product-price {
        font-size: 1rem;
    }
    
    .product-vendor {
        font-size: 0.75rem;
    }
    
    /* Hide carousel controls on very small screens for cleaner look */
    #productCarousel .carousel-control-prev,
    #productCarousel .carousel-control-next {
        display: none;
    }
    
    /* Enable swipe gestures hint */
    .carousel-inner::after {
        content: "← Swipe →";
        position: absolute;
        bottom: -50px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 0.8rem;
        color: #666;
        opacity: 0.7;
    }
}

/* Enhanced carousel performance for many products */
.carousel-item {
    transition: transform 0.4s ease-in-out;
}

/* Carousel auto-height adjustment */
.carousel-inner {
    min-height: 280px;
}

@media (max-width: 768px) {
    .carousel-inner {
        min-height: 240px;
    }
}

@media (max-width: 480px) {
    .carousel-inner {
        min-height: 220px;
    }
}

/* Loading animation for carousel */
.carousel-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 280px;
    background: linear-gradient(45deg, #f0f9ff 0%, #e0f7fa 100%);
    border-radius: 15px;
    margin: 20px;
}

.carousel-loading::after {
    content: "Loading products...";
    color: #00796b;
    font-size: 1.1rem;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Print styles */
@media print {
    .product-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .search-filter-bar {
        display: none;
    }
}

/* Carousel Product Counter Styles */
.carousel-counter {
    margin-bottom: 15px;
}

.carousel-counter small {
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 15px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    font-size: 0.85rem;
    font-weight: 500;
}

/* Improved carousel navigation for many products */
#productCarousel .carousel-indicators {
    max-width: 300px;
    margin: 0 auto;
    overflow-x: auto;
    white-space: nowrap;
    padding: 10px 0;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

#productCarousel .carousel-indicators::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* Enhanced product display */
.carousel-product-card {
    position: relative;
    overflow: hidden;
}

.carousel-product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s;
    z-index: 1;
    pointer-events: none;
}

.carousel-product-card:hover::before {
    left: 100%;
}

/* Quick action overlay for products */
.product-quick-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.carousel-product-card:hover .product-quick-actions {
    opacity: 1;
}

.quick-action-btn {
    background: rgba(0, 121, 107, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 5px;
    transition: all 0.3s ease;
}

.quick-action-btn:hover {
    background: rgba(0, 121, 107, 1);
    transform: scale(1.1);
    color: white;
}

/* Product availability badge */
.product-availability {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    z-index: 2;
}

.product-availability.in-stock {
    background: #28a745;
    color: white;
}

.product-availability.low-stock {
    background: #ffc107;
    color: #000;
}

.product-availability.out-of-stock {
    background: #dc3545;
    color: white;
}