/* Original M-well Product Cards with Enhanced Cart Functionality */

/* Product Grid Container */
#productsGrid {
    margin-top: 2rem;
}

#productsGrid .col-lg-4,
#productsGrid .col-md-6 {
    margin-bottom: 1rem;
}

/* Original Product Card Design */
.modern-product-card {
    background: #ffffff;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

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

/* Product Image Wrapper - Original Design */
.product-image-wrapper {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
    border-radius: 15px 15px 0 0;
}

/* Wishlist heart (mobile) */
.wishlist-heart {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255,255,255,0.95);
    border: 1px solid #e9ecef;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ff6b6b;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.wishlist-heart.active { background: #ffe4e6; color: #dc2626; border-color: #fecaca; }
.wishlist-heart i { pointer-events: none; }

.product-image {
    width: 100%;
    height: 100%;
    position: relative;
}

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

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

/* Discount Badge */
.discount-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

/* Product Overlay - Full Width Style */
.product-overlay-btn {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 3;
    padding: 0 20px 20px 20px;
}

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

.btn-view-product {
    background: white;
    border: none;
    color: #333;
    padding: 15px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    width: 100%;
    text-align: center;
}

.btn-view-product:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    color: #333;
}

/* Product Details - Original Style */
.product-details {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Product Rating - Original Style */
.product-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 12px;
}

.product-rating .fas.fa-star {
    color: #fbbf24;
    font-size: 14px;
}

.product-rating .far.fa-star {
    color: #e5e7eb;
    font-size: 14px;
}

.rating-text {
    color: #666;
    font-size: 0.85rem;
    margin-left: 6px;
}

/* Product Pricing - Original Style */
.product-pricing {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.current-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
}

.original-price {
    font-size: 1rem;
    color: #999;
    text-decoration: line-through;
}

/* Product Actions - Original Style */
.product-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
}

/* Quantity Counter Section */
.quantity-counter-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border: none !important;
    margin-bottom: 8px;
    background: transparent;
}

.in-cart-label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.quantity-btn,
button.quantity-btn,
.quantity-controls .quantity-btn {
    background: #f8f9fa !important;
    border: 1px solid #e9ecef !important;
    color: #6c757d !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    font-size: 0.8rem !important;
    font-weight: 400 !important;
    cursor: pointer !important;
    outline: none !important;
    box-shadow: none !important;
    text-decoration: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    min-width: 32px !important;
    max-width: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
}

.quantity-btn:hover {
    background: #e9ecef;
    border: 1px solid #dee2e6 !important;
    color: #495057;
    outline: none !important;
    box-shadow: none !important;
    text-decoration: none !important;
}

.quantity-btn:active {
    background: #dee2e6;
    border: 1px solid #ced4da !important;
    outline: none !important;
    box-shadow: none !important;
}

.quantity-btn:focus {
    outline: none !important;
    border: 1px solid #e9ecef !important;
    box-shadow: none !important;
    text-decoration: none !important;
}

.quantity-display {
    font-weight: 600;
    font-size: 1rem;
    color: #333;
    min-width: 20px;
    text-align: center;
}

/* Button Row - Side by Side Layout */
.button-row {
    display: flex !important;
    gap: 12px;
    width: 100%;
}

/* Wishlist Button - Left Side (50% width) */
.btn-wishlist {
    background: transparent;
    border: 2px solid #e9ecef;
    color: #ff6b6b;
    padding: 12px 8px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    display: flex !important;
    align-items: center;
    gap: 6px;
    justify-content: center;
    flex: 1;
    min-width: 0;
}

.btn-wishlist:hover {
    border-color: #ff6b6b;
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.05);
}

.btn-wishlist.active {
    background: rgba(255, 107, 107, 0.1);
    border-color: #ff6b6b;
    color: #ff6b6b;
}

/* Add to Cart Button - Right Side (50% width) */
.btn-add-cart {
    background: linear-gradient(135deg, #007bff, #0056b3);
    border: none;
    color: white;
    padding: 12px 8px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    flex: 1;
    min-width: 0;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.btn-add-cart:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
}

/* Quantity Counter */
.quantity-counter {
    flex: 1;
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 4px;
    transition: all 0.3s ease;
}

.quantity-counter:hover {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.quantity-btn {
    background: #6366f1;
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 0.8rem;
}

.quantity-btn:hover {
    background: #4f46e5;
    transform: scale(1.1);
}

.quantity-btn:active {
    transform: scale(0.95);
}

.quantity-display {
    flex: 1;
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
    color: #1a1a1a;
}

/* Wishlist Button */
.btn-wishlist {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    color: #6b7280;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.btn-wishlist:hover {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #ef4444;
    transform: scale(1.05);
}

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

/* Floating Cart Badge */
.floating-cart-badge {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-cart-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border-radius: 50%;
    text-decoration: none;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
    transition: all 0.3s ease;
    position: relative;
}

.floating-cart-link:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 35px rgba(99, 102, 241, 0.5);
    color: white;
}

.floating-cart-link i {
    font-size: 1.4rem;
}

.floating-cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    border: 2px solid white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Hide floating cart when count is 0 */
.floating-cart-badge.hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
}

/* Responsive Design - Original Layout */
@media (max-width: 1200px) {
    .product-image-wrapper {
        height: 230px;
    }
    
    .product-details {
        padding: 18px;
    }
}

@media (max-width: 768px) {
    .product-image-wrapper {
        height: 200px;
    }
    
    .product-details {
        padding: 16px;
    }
    
    .product-name {
        font-size: 1rem;
    }
    
    .current-price {
        font-size: 1.2rem;
    }
    
    .btn-add-cart {
        padding: 10px 14px;
        font-size: 0.8rem;
    }
    
    .floating-cart-badge {
        bottom: 80px; /* sit above bottom nav */
        right: 16px;
        z-index: 3000;
    }
    
    .floating-cart-link {
        width: 50px;
        height: 50px;
    }
    
    .floating-cart-link i {
        font-size: 1.2rem;
    }

    /* Remove hover/animation effects on mobile cards */
    .modern-product-card { transition: none; }
    .modern-product-card:hover { transform: none; box-shadow: 0 8px 25px rgba(0,0,0,0.1); }
    .modern-product-card:hover .product-main-image { transform: none; }

    /* Show full product image within the same frame on mobile */
    .product-main-image {
        object-fit: contain;
        background: #ffffff;
        padding: 6px;
    }
}

@media (max-width: 576px) {
    .product-image-wrapper {
        height: 180px;
    }
    
    .original-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .btn-add-cart { width: 100%; }
    .btn-wishlist { display: none !important; }
    
    .quantity-controls {
        gap: 8px;
    }

    /* Hide hover-only overlay on mobile */
    .product-overlay-btn { display: none !important; opacity: 0 !important; }
    .modern-product-card { transition: none; }
    .modern-product-card:hover { transform: none; }
    .modern-product-card:hover .product-main-image { transform: none; }

    /* Ensure full image is visible on small phones */
    .product-main-image {
        object-fit: contain;
        background: #ffffff;
        padding: 6px;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

.fade-out {
    animation: fadeOut 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-10px); }
}

/* Loading States */
.btn-add-to-cart.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-add-to-cart.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Success States */
.btn-add-cart.success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.quantity-counter-section.success {
    background: #f0fdf4;
    border-color: #10b981;
}
