/* ==========================================
   PROFESSIONAL PRODUCT GRID - Compact Design
   Clean, Modern, Professional Layout
   ========================================== */

/* Product Grid Container - Responsive Grid */
.products-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    padding: 1.5rem 0;
}

@media (min-width: 768px) {
    .products-grid-container {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 1.25rem;
    }
}

@media (min-width: 1200px) {
    .products-grid-container {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 1.5rem;
    }
}

/* Product Card - Professional Compact Design */
.products-grid-container .product-card,
.modern-products-grid .product-card {
    background: #ffffff !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    border: 1px solid #e5e7eb !important;
    height: 100% !important;
    cursor: pointer !important;
    min-height: 320px !important;
}

@media (min-width: 768px) {
    .products-grid-container .product-card,
    .modern-products-grid .product-card {
        min-height: 360px !important;
    }
}

@media (min-width: 1200px) {
    .products-grid-container .product-card,
    .modern-products-grid .product-card {
        min-height: 380px !important;
    }
}

.products-grid-container .product-card:hover,
.modern-products-grid .product-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.08) !important;
    border-color: #3b82f6 !important;
}

.products-grid-container .product-card::before {
    display: none !important;
}

/* Product Image Section - Enhanced Display */
.products-grid-container .product-image-wrapper,
.modern-products-grid .product-image-wrapper {
    position: relative !important;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
    padding: 1rem !important;
    height: 220px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
    border-bottom: 1px solid #f3f4f6 !important;
    border-radius: 0 !important;
}

@media (min-width: 768px) {
    .products-grid-container .product-image-wrapper,
    .modern-products-grid .product-image-wrapper {
        height: 240px !important;
    }
}

@media (min-width: 1200px) {
    .products-grid-container .product-image-wrapper,
    .modern-products-grid .product-image-wrapper {
        height: 260px !important;
    }
}

.products-grid-container .product-image-wrapper .product-image,
.modern-products-grid .product-image-wrapper .product-image {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border-radius: 4px !important;
}

.products-grid-container .product-image-wrapper img,
.modern-products-grid .product-image-wrapper img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Carousel images in product cards */
.products-grid-container .product-image-wrapper .carousel-item img,
.modern-products-grid .product-image-wrapper .carousel-item img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
}

.products-grid-container .product-card:hover .product-image,
.modern-products-grid .product-card:hover .product-image,
.products-grid-container .product-card:hover img,
.modern-products-grid .product-card:hover img {
    transform: scale(1.05) !important;
}

/* Product Badges - Top Right */
.product-badges {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    z-index: 10;
}

.product-badge {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 0.3rem 0.65rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-align: center;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
    white-space: nowrap;
    line-height: 1.2;
}

.badge-discount {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

/* Product Content - Compact */
.products-grid-container .product-content,
.modern-products-grid .product-content {
    padding: 0.75rem !important;
    display: flex !important;
    flex-direction: column !important;
    flex-grow: 1 !important;
    gap: 0.4rem !important;
    background: #ffffff !important;
    justify-content: space-between !important;
}

/* Hide Category */
.products-grid-container .product-category,
.modern-products-grid .product-category {
    display: none !important;
}

.products-grid-container .product-title,
.modern-products-grid .product-title {
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    color: #1f2937 !important;
    margin: 0 !important;
    margin-bottom: 0.4rem !important;
    line-height: 1.4 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    min-height: 2.4em !important;
    text-align: left !important;
}

/* Star Rating - Compact */
.products-grid-container .product-card-rating,
.modern-products-grid .product-card-rating {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    margin: 0 !important;
    margin-bottom: 0.4rem !important;
    text-align: left !important;
    flex-wrap: wrap !important;
}

/* Discount Badge Next to Rating */
.discount-badge-rating {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    color: white !important;
    padding: 0.2rem 0.5rem !important;
    border-radius: 12px !important;
    font-size: 0.7rem !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3) !important;
    line-height: 1.2 !important;
}

.product-card-stars {
    color: #fbbf24;
    font-size: 0.8rem;
    display: flex;
    gap: 1px;
}

.product-card-rating-text {
    color: #6b7280;
    font-size: 0.7rem;
    font-weight: 500;
}

/* Price and Actions Row - Same Line */
.products-grid-container .price-actions-row,
.modern-products-grid .price-actions-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.5rem !important;
    margin: 0 !important;
    margin-top: auto !important;
    padding-top: 0.5rem !important;
    border-top: 1px solid #f3f4f6 !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
}

@media (max-width: 768px) {
    .products-grid-container .price-actions-row,
    .modern-products-grid .price-actions-row {
        gap: 0.375rem !important;
        padding-top: 0.5rem !important;
    }

    .products-grid-container .product-image-wrapper .carousel-item img,
    .modern-products-grid .product-image-wrapper .carousel-item img {
        max-height: 50% !important;
    }
}

.products-grid-container .price-wrapper,
.modern-products-grid .price-wrapper {
    display: flex !important;
    align-items: baseline !important;
    gap: 0.4rem !important;
    flex-wrap: nowrap !important;
    flex: 1 !important;
    margin: 0 !important;
    min-width: 0 !important;
    overflow: hidden !important;
}

.products-grid-container .current-price,
.modern-products-grid .current-price {
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    color: #1f2937 !important;
    margin: 0 !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
}

.products-grid-container .list-price,
.modern-products-grid .list-price {
    font-size: 0.75rem !important;
    color: #9ca3af !important;
    text-decoration: line-through !important;
    margin: 0 !important;
    white-space: nowrap !important;
}

.products-grid-container .discount-percent {
    background: #fef3c7 !important;
    color: #d97706 !important;
    padding: 0.15rem 0.4rem !important;
    border-radius: 4px !important;
    font-size: 0.65rem !important;
    font-weight: 600 !important;
}

/* Action Buttons - Compact */
.products-grid-container .product-actions,
.modern-products-grid .product-actions {
    display: flex !important;
    gap: 0.5rem !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
    align-items: center !important;
}

.btn-select-options {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    color: white;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    box-shadow: 0 1px 3px rgba(59, 130, 246, 0.2);
    white-space: nowrap;
    min-width: 0;
    flex-shrink: 1;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 768px) {
    .btn-select-options {
        padding: 0.45rem 0.6rem !important;
        font-size: 0.75rem !important;
        gap: 0.25rem !important;
        flex-shrink: 1 !important;
        min-width: 0 !important;
    }
    
    .btn-select-options span,
    .btn-select-options i {
        flex-shrink: 0 !important;
    }
}

.btn-select-options:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
    color: white;
}

.btn-select-options i {
    font-size: 0.9rem;
    flex-shrink: 0;
}

.btn-add-cart-quick {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(16, 185, 129, 0.2);
}

.btn-add-cart-quick:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.btn-add-cart-quick.in-cart {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.btn-add-cart-quick.in-cart i {
    animation: checkmarkPop 0.3s ease;
}

.btn-add-cart-quick:disabled,
.btn-add-cart-quick.out-of-stock {
    background: #9ca3af !important;
    color: white !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
    pointer-events: none !important;
    box-shadow: none !important;
}

.btn-add-cart-quick:disabled:hover,
.btn-add-cart-quick.out-of-stock:hover {
    background: #9ca3af !important;
    transform: none !important;
    box-shadow: none !important;
}

@keyframes checkmarkPop {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Wishlist Button - Compact */
.wishlist-btn {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    color: #6b7280;
    font-size: 1rem;
    backdrop-filter: blur(4px);
}

.wishlist-btn:hover {
    background: rgba(254, 242, 242, 0.95);
    color: #ef4444;
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.2);
}

.wishlist-btn.active {
    color: #ef4444;
}

/* Product Image Carousel */
.product-image-carousel {
    width: 100%;
    height: 100%;
    position: relative;
}

.product-image-carousel .carousel-inner {
    height: 100%;
}

.product-image-carousel .carousel-item {
    height: 100%;
}

.product-image-carousel .carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-image-carousel .carousel-control-prev,
.product-image-carousel .carousel-control-next {
    width: 28px;
    height: 28px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-image-wrapper:hover .product-image-carousel .carousel-control-prev,
.product-image-wrapper:hover .product-image-carousel .carousel-control-next {
    opacity: 1;
}

.product-image-carousel .carousel-control-prev-icon,
.product-image-carousel .carousel-control-next-icon {
    width: 14px;
    height: 14px;
}

.product-image-carousel .carousel-indicators {
    margin-bottom: 4px;
    bottom: 0;
}

.product-image-carousel .carousel-indicators button {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    border: none;
    margin: 0 2px;
    opacity: 0.7;
}

.product-image-carousel .carousel-indicators button.active {
    background-color: #fff;
    opacity: 1;
}

/* Empty State */
.products-empty {
    text-align: center;
    padding: 4rem 2rem;
    grid-column: 1 / -1;
}

.products-empty i {
    font-size: 4rem;
    color: #ddd;
    margin-bottom: 1rem;
}

.products-empty p {
    color: #999;
    font-size: 1.1rem;
}

/* Loading State */
.product-card.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .products-grid-container {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
        padding: 1rem 0.75rem !important;
    }
    
    .products-grid-container .product-card,
    .modern-products-grid .product-card {
        min-height: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }
    
    .products-grid-container .product-image-wrapper,
    .modern-products-grid .product-image-wrapper {
        height: 160px !important;
        padding: 0.625rem !important;
    }
    
    .products-grid-container .product-content,
    .modern-products-grid .product-content {
        padding: 0.625rem !important;
        gap: 0.375rem !important;
    }
    
    .products-grid-container .product-title,
    .modern-products-grid .product-title {
        font-size: 0.8125rem !important;
        line-height: 1.25 !important;
        margin-bottom: 0.25rem !important;
        min-height: 2.4em !important;
    }
    
    .products-grid-container .product-card-rating,
    .modern-products-grid .product-card-rating {
        margin-bottom: 0.375rem !important;
        gap: 0.375rem !important;
    }
    
    .products-grid-container .current-price,
    .modern-products-grid .current-price {
        font-size: 0.875rem !important;
    }
    
    .products-grid-container .list-price,
    .modern-products-grid .list-price {
        font-size: 0.6875rem !important;
    }
    
    .products-grid-container .price-actions-row,
    .modern-products-grid .price-actions-row {
        padding-top: 0.375rem !important;
        gap: 0.25rem !important;
        flex-wrap: nowrap !important;
    }

        .products-grid-container .price-wrapper,
        .modern-products-grid .price-wrapper {
            gap: 0.25rem !important;
            flex: 1 1 auto !important;
            overflow: hidden !important;
            min-width: 65% !important;
        }

        .products-grid-container .product-actions,
        .modern-products-grid .product-actions {
            flex-shrink: 0 !important;
            gap: 0.25rem !important;
            display: none !important;
        }
    
    .btn-select-options {
        font-size: 0.65rem !important;
        padding: 0.35rem 0.5rem !important;
        gap: 0.2rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 100% !important;
    }
    
    .btn-select-options i {
        font-size: 0.75rem !important;
        flex-shrink: 0 !important;
    }
    
    .btn-add-cart-quick {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.875rem !important;
    }
    
    .discount-badge-rating {
        font-size: 0.625rem !important;
        padding: 0.125rem 0.35rem !important;
    }
    
    .product-card-stars {
        font-size: 0.7rem !important;
    }
    
    .product-card-rating-text {
        font-size: 0.65rem !important;
    }
}

@media (max-width: 576px) {
    .products-grid-container {
        grid-template-columns: 1fr !important;
        gap: 0.875rem !important;
        padding: 0.875rem 0.5rem !important;
    }
    
    .products-grid-container .product-image-wrapper,
    .modern-products-grid .product-image-wrapper {
        height: 180px !important;
        padding: 0.75rem !important;
    }
    
    .products-grid-container .product-content,
    .modern-products-grid .product-content {
        padding: 0.65rem !important;
        gap: 0.4rem !important;
    }
    
    .products-grid-container .product-title,
    .modern-products-grid .product-title {
        font-size: 0.8rem !important;
    }
    
    .btn-select-options {
        max-width: 120px !important;
        font-size: 0.65rem !important;
        padding: 0.35rem 0.5rem !important;
    }
}

/* RTL Support */
[dir="rtl"] .product-badges {
    left: 0.5rem;
    right: auto;
}

[dir="rtl"] .wishlist-btn {
    right: 0.5rem;
    left: auto;
}

/* Accessibility */
.product-card:focus-within {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

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