/* Product Card Enhancements */
/* Optimized for performance and accessibility */

/* Product Card Container */
.product-card-container {
    width: 100%;
}

/* Product Card Base Styles */
.product-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    will-change: transform;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1) !important;
}

/* Product Image Container */
.product-image-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
}

.product-image {
    transition: transform 0.3s ease-in-out;
    object-fit: cover;
    width: 100%;
    height: 280px;
}

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

/* Product Badges - Overlaid on Image */
.product-badges {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
    z-index: 2;
    pointer-events: none;
}

.product-badges .badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.badge-category {
    background-color: rgba(124, 77, 255, 0.9);
    color: #fff;
}

.badge-stock-in {
    background-color: rgba(40, 167, 69, 0.9);
    color: #fff;
}

.badge-stock-out {
    background-color: rgba(220, 53, 69, 0.9);
    color: #fff;
}

.badge-inactive {
    background-color: rgba(108, 117, 125, 0.9);
    color: #fff;
}

/* Hover Overlay - Action Buttons */
.product-hover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    z-index: 3;
}

.product-card:hover .product-hover-overlay {
    opacity: 1;
}

.product-hover-actions {
    display: flex;
    gap: 10px;
}

.product-hover-actions .btn {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform 0.2s ease-in-out;
}

.product-hover-actions .btn:hover {
    transform: scale(1.1);
}

/* Product Details Section */
.product-details {
    padding: 0;
}

.product-details .card-title {
    font-size: 1rem;
    line-height: 1.4;
    margin-bottom: 8px;
    color: #2c3e50;
    min-height: 2.8em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-details .card-text {
    font-size: 0.875rem;
    color: #6c757d;
}

/* Product Price */
.product-price h6 {
    font-size: 1.25rem;
    margin-bottom: 4px;
}

.product-price small {
    font-size: 0.875rem;
}

/* Responsive Grid - Following User Preferences */
/* XL screens: 4 cards per row */
@media (min-width: 1200px) {
    .product-card-container .col-xl-4 {
        flex: 0 0 25%;
        max-width: 25%;
    }
}

/* MD screens: 2 cards per row */
@media (min-width: 768px) and (max-width: 1199px) {
    .product-card-container .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* SM screens: 1 card per row */
@media (max-width: 767px) {
    .product-card-container .col-sm-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .product-image {
        height: 220px;
    }
    
    .product-hover-overlay {
        /* Always show actions on mobile for better UX */
        opacity: 0.95;
        background: rgba(0, 0, 0, 0.5);
    }
}

/* Filter Section - Always Visible */
.filter-section {
    position: sticky;
    top: 20px;
}

.filter-section .card {
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.filter-section .card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 1rem;
}

.filter-section .card-body {
    padding: 1rem;
}

.product-filter {
    margin-bottom: 1.5rem;
}

.product-filter:last-child {
    margin-bottom: 0;
}

.product-filter h6 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #2c3e50;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: 4px;
}

.autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background-color: #f8f9fa;
}

/* Pagination Improvements */
.pagination {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.pagination .page-link {
    border-radius: 4px;
    margin: 0 2px;
    transition: all 0.2s ease-in-out;
}

.pagination .page-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pagination .page-item.active .page-link {
    background-color: #7c4dff;
    border-color: #7c4dff;
}

/* Accessibility Improvements */
.product-card:focus-within {
    outline: 2px solid #7c4dff;
    outline-offset: 2px;
}

.btn:focus,
.form-control:focus {
    outline: 2px solid #7c4dff;
    outline-offset: 2px;
    box-shadow: 0 0 0 0.2rem rgba(124, 77, 255, 0.25);
}

/* Loading States */
.product-card.loading {
    opacity: 0.6;
    pointer-events: none;
}

.product-card.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #7c4dff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Print Styles */
@media print {
    .product-hover-overlay,
    .filter-section,
    .pagination,
    .btn {
        display: none !important;
    }
    
    .product-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

