/* ========================================
   IMPROVED PRODUCT CARD LAYOUT
   Modern, Systematic, Mobile-Friendly
   ======================================== */

:root {
    --primary: #2d7a3e;
    --secondary: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --dark: #2c3e50;
    --gray: #7f8c8d;
    --light-gray: #ecf0f1;
    --white: #ffffff;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
}

/* ========================================
   PRODUCT GRID LAYOUT
   ======================================== */

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

/* ========================================
   PRODUCT CARD - SYSTEMATIC DESIGN
   ======================================== */

.product-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.product-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}

/* Product Image Container */
.product-image {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: #f8f9fa;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

/* Badges */
.product-badges {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 48px; /* Leave space for wishlist button */
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 6px;
    z-index: 2;
    flex-wrap: wrap;
}

.badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    white-space: nowrap;
}

.featured-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.hot-badge {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.discount-badge {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: #333;
    font-weight: 800;
}

.new-badge {
    background: linear-gradient(135deg, #30cfd0 0%, #330867 100%);
    color: white;
}

/* Wishlist Button */
.wishlist-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.3s;
    z-index: 10; /* Higher z-index to stay above badges */
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.wishlist-btn:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.wishlist-btn.active {
    color: #e74c3c;
}

/* Product Info Section */
.product-info {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

/* Category Tag */
.product-category {
    display: inline-block;
    padding: 3px 8px;
    background: #f0f0f0;
    color: var(--gray);
    font-size: 0.65rem;
    font-weight: 600;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    width: fit-content;
    margin-bottom: 0;
}

/* Product Name */
.product-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--dark);
    margin: 0;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 36px;
}

.product-name-hi {
    font-size: 0.75rem;
    color: var(--gray);
    margin: 0;
    font-style: italic;
    line-height: 1.1;
}

/* Rating */
.product-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

.rating-stars {
    color: #ffa500;
    font-size: 0.9rem;
}

.rating-count {
    color: var(--gray);
    font-size: 0.8rem;
}

/* Price Section */
.product-price {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
    margin: 4px 0;
}

.price-current {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.price-original {
    font-size: 0.9rem;
    color: var(--gray);
    text-decoration: line-through;
}

.price-unit {
    font-size: 0.75rem;
    color: var(--gray);
}

.price-discount {
    font-size: 0.8rem;
    color: var(--danger);
    font-weight: 600;
}

/* Stock Status */
.stock-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
    width: fit-content;
}

.stock-status.in-stock {
    background: #d4edda;
    color: #155724;
}

.stock-status.low-stock {
    background: #fff3cd;
    color: #856404;
}

.stock-status.out-of-stock {
    background: #f8d7da;
    color: #721c24;
}

/* Product Features */
.product-features {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0;
}

.feature-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--gray);
}

/* Action Buttons */
.product-actions {
    display: flex;
    gap: 6px;
    margin-top: auto;
    padding-top: 6px;
    border-top: 1px solid var(--light-gray);
}

.btn-product {
    flex: 1;
    padding: 9px 10px;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-decoration: none;
    text-align: center;
    line-height: 1;
    min-height: 38px;
    width: 100%;
}

.btn-view-details {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-view-details:hover {
    background: var(--primary);
    color: white;
}

.btn-add-cart {
    background: var(--primary);
    color: white;
}

.btn-add-cart:hover {
    background: var(--secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(45, 122, 62, 0.3);
}

.btn-buy-now {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-buy-now:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-bulk-order {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-bulk-order:hover {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.3);
}

/* Quick View Button */
.quick-view-btn {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    opacity: 0;
    padding: 8px 20px;
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 2;
    white-space: nowrap;
}

.product-card:hover .quick-view-btn {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.quick-view-btn:hover {
    background: var(--primary);
    color: white;
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 10px;
        padding: 10px 0;
    }
    
    .product-card {
        border-radius: 8px;
    }
    
    .product-image {
        height: 160px;
    }
    
    .product-info {
        padding: 10px;
        gap: 5px;
    }
    
    .product-name {
        font-size: 0.85rem;
        min-height: 34px;
        -webkit-line-clamp: 2;
        line-height: 1.2;
    }
    
    .product-name-hi {
        font-size: 0.7rem;
        line-height: 1.1;
    }
    
    .product-category {
        font-size: 0.65rem;
        padding: 2px 6px;
        margin-bottom: 1px;
    }
    
    .product-rating {
        font-size: 0.7rem;
    }
    
    .price-current {
        font-size: 1.1rem;
    }
    
    .price-original {
        font-size: 0.8rem;
    }
    
    .price-unit {
        font-size: 0.7rem;
    }
    
    .badge {
        font-size: 0.6rem;
        padding: 3px 6px;
    }
    
    .product-badges {
        right: 40px; /* More space for smaller wishlist */
    }
    
    .wishlist-btn {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
        top: 6px;
        right: 6px;
    }
    
    .product-actions {
        flex-direction: column;
        gap: 5px;
        padding-top: 5px;
    }
    
    .btn-product {
        padding: 8px 10px;
        font-size: 0.75rem;
        gap: 3px;
        min-height: 36px;
    }
    
    .quick-view-btn {
        display: none;
    }
    
    .stock-status {
        font-size: 0.7rem;
        padding: 2px 6px;
    }
    
    .feature-tag {
        font-size: 0.65rem;
        padding: 2px 5px;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .product-image {
        height: 140px;
    }
    
    .product-info {
        padding: 8px;
        gap: 4px;
    }
    
    .product-name {
        font-size: 0.8rem;
        min-height: 32px;
        line-height: 1.2;
    }
    
    .product-name-hi {
        font-size: 0.65rem;
    }
    
    .product-category {
        font-size: 0.6rem;
        padding: 2px 5px;
    }
    
    .price-current {
        font-size: 1rem;
    }
    
    .price-unit {
        font-size: 0.65rem;
    }
    
    .btn-product {
        padding: 6px 8px;
        font-size: 0.7rem;
        gap: 2px;
    }
    
    .product-actions {
        gap: 4px;
        padding-top: 5px;
    }
}

/* ========================================
   TABLET RESPONSIVE
   ======================================== */

@media (min-width: 769px) and (max-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 16px;
    }
    
    .product-image {
        height: 200px;
    }
}

/* ========================================
   LOADING STATE
   ======================================== */

.product-card.loading {
    pointer-events: none;
    opacity: 0.6;
}

.product-card.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ========================================
   EMPTY STATE
   ======================================== */

.products-empty {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.products-empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.products-empty h3 {
    font-size: 1.5rem;
    color: var(--dark);
    margin-bottom: 10px;
}

.products-empty p {
    color: var(--gray);
    margin-bottom: 20px;
}
