/* Home Page Product Grid Styles */

/* Featured Products Section */
.featured-products-section,
.tools-products-section {
    padding: 60px 0;
    background: #fff;
}

.featured-products-section:nth-child(even),
.tools-products-section:nth-child(even) {
    background: #f8f9fa;
}

.section-container {
    max-width: 1328px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Section Header */
.products-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-title {
    font-weight: bold;
    color: #333;
    margin: 0;
}

.view-all-btn {
    display: inline-block;
    background: #009688;
    color: #fff;
    font-weight: bold;
    padding: 12px 30px;
    border-radius: 5px;
    text-decoration: none;
    transition: background 0.3s ease;
}

.view-all-btn:hover {
    background: #00796b;
    color: #fff;
}

/* Home Page Product Grid */
.home-products-grid {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 1.5rem !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Ensure each card behaves as a grid item */
.home-products-grid .product-card {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    grid-column: auto !important;
}

/* Product Card Styles for Home Page */
.home-products-grid .product-card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
    height: 380px;
    border: 1px solid #f0f0f0;
}

.home-products-grid .product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.15);
}

/* Sale Badge */
.home-products-grid .sale-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background-color: #ef4444;
    color: white;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 9999px;
    z-index: 10;
}

/* Product Link */
.home-products-grid .product-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Product Image */
.home-products-grid .product-image {
    width: 100%;
    height: 22rem;
    overflow: hidden;
    flex-shrink: 0;
    background: #f8f9fa;
}

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

.home-products-grid .product-card:hover .product-img {
    transform: scale(1.05);
}

/* Product Info */
.home-products-grid .product-info {
    padding: 0.85rem 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    font-size: 1.8rem;
}

.home-products-grid .product-name {
    font-size: 1.8rem;
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 0.35rem;
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.home-products-grid .product-price-wrapper {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.25rem 0 0.6rem;
}

.home-products-grid .product-price-wrapper .price {
    font-size: 1.125rem;
    font-weight: bold;
    color: #ef4444;
}

.home-products-grid .product-price-wrapper del {
    color: #9ca3af;
    text-decoration: line-through;
    margin-left: 0.5rem;
}

/* Product Actions */
.home-products-grid .product-actions {
    padding: 0 1rem 1rem;
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

/* Buttons */
.home-products-grid .add-to-cart-btn {
    flex: 1;
    background: #ef4444;
    color: #ffffff;
    font-size: 1.5rem;
    padding: 1.1rem 1.2rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    font-weight: 600;
}

.home-products-grid .add-to-cart-btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.home-products-grid .view-details-btn {
    flex: 1;
    border: 1px solid #e2e8f0;
    background: #f7fafc;
    color: #4b5563;
    font-size: 1.5rem;
    padding: 1.1rem 1.2rem;
    border-radius: 8px;
    text-decoration: none;
    text-align: center;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    font-weight: 600;
}

.home-products-grid .view-details-btn:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
    color: #374151;
    transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .home-products-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 900px) {
    .home-products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .products-section-header {
        margin-bottom: 30px;
    }
}

@media (max-width: 640px) {
    .home-products-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    .section-title {
        font-size: 1.8rem;
        text-align: center;
        margin-bottom: 20px;
    }
    
    .products-section-header {
        flex-direction: column;
        text-align: center;
        margin-bottom: 25px;
    }
    
    .view-all-btn {
        padding: 10px 25px;
        font-size: 14px;
    }
    
    .home-products-grid .product-card {
        height: 350px;
    }
    
    .home-products-grid .product-image {
        height: 16rem;
    }
    
    .featured-products-section,
    .tools-products-section {
        padding: 40px 0;
    }
}

/* Loading State */
.products-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    color: #6b7280;
}

/* No Products Message */
.no-products-home {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
}

/* Featured Badge for Special Products */
.featured-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 9999px;
    z-index: 10;
}

/* Animation for product cards on scroll */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.home-products-grid .product-card {
    animation: fadeInUp 0.6s ease-out;
}

.home-products-grid .product-card:nth-child(1) { animation-delay: 0.1s; }
.home-products-grid .product-card:nth-child(2) { animation-delay: 0.2s; }
.home-products-grid .product-card:nth-child(3) { animation-delay: 0.3s; }
.home-products-grid .product-card:nth-child(4) { animation-delay: 0.4s; }
.home-products-grid .product-card:nth-child(5) { animation-delay: 0.5s; }
.home-products-grid .product-card:nth-child(6) { animation-delay: 0.6s; }
.home-products-grid .product-card:nth-child(7) { animation-delay: 0.7s; }
.home-products-grid .product-card:nth-child(8) { animation-delay: 0.8s; }

.pagination-btn {
    background: white;
    color: #6b7280;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.pagination-btn:hover {
    background: #f3f4f6;
}

.pagination-btn.active {
    background: #ef4444;
    color: #fff;
}
