/* Home Products Grid - Compact & Responsive Design */

/* Section Container */
.featured-products-section {
    padding: 60px 0;
    background: #f8f9fa;
    width: 100%;
}

/* Featured Products Header */
.featured-products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.featured-products-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2d3436;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

/* View All Button */
.view-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #ff6b35, #e55a2b);
    color: #ffffff;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
    border: 2px solid transparent;
}

.view-all-btn:hover {
    background: linear-gradient(135deg, #e55a2b, #d44a1a);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.4);
    color: #ffffff;
    text-decoration: none;
}

.view-all-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.view-all-btn i {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.view-all-btn:hover i {
    transform: translateX(3px);
}

/* Grid Container - Fixed Width, Always Centered */
.home-products-container {
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
    box-sizing: border-box;
}

/* Grid - Fixed Columns, No Stretching */
.home-products-grid {
    display: grid;
    grid-template-columns: repeat(5, 220px);
    justify-content: center;
    gap: 24px;
    padding: 2rem 0;
    width: auto;
    margin: 0 auto;
}

/* Product Card - Fixed Width, No Stretching */
.product-card {
    width: 220px;
    min-width: 220px;
    max-width: 220px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.product-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

.product-card:focus-within {
    outline: 2px solid #ff6b35;
    outline-offset: 2px;
}

/* Image Container - Always Square */
.product-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f8f9fa;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    transition: transform 0.3s ease;
}

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

.product-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f5f5f5, #e0e0e0);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 2rem;
}

/* Product Badge */
.product-badge {
    position: absolute;
    top: 10px;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
    z-index: 10;
}

.sale-badge {
    right: 10px;
    background: linear-gradient(135deg, #ff4757, #ff6b7a);
}

.featured-badge {
    left: 10px;
    background: linear-gradient(135deg, #d4af37, #f0d872);
    display: flex;
    align-items: center;
    gap: 4px;
}

.new-badge {
    left: 10px;
    background: linear-gradient(135deg, #1e90ff, #4dabf7);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Product Content */
.product-content {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 0px;
    flex: 1;
}

/* Product Title */
.product-title {
    font-size: 12px;
    font-weight: 600;
    color: #2d3436;
    margin: 0;
    line-height: 1.0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.0em;
    margin-top: 0.3rem;
    margin-bottom: 0.2rem;
}

/* Product Price */
.product-price {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-top: 0.1rem;
}

.old-price {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
}

.new-price {
    font-size: 14px;
    font-weight: bold;
    color: #ff6b35;
}


/* Product Rating */
.product-rating {
    display: flex;
    flex-direction: column;
    gap: 0px;
    font-size: 0.7rem;
    margin-bottom: 1px;
    margin-top: 0.1rem;
}

.stars {
    display: flex;
    align-items: center;
    gap: 1px;
    color: #ffc107;
}

.stars i {
    font-size: 0.75rem;
}

.rating-number {
    margin-left: 2px;
    color: #666;
    font-size: 0.7rem;
}

.sold-count {
    color: #999;
    font-size: 0.7rem;
}


/* Mobile Card Compact Design */
@media (max-width: 768px) {
    .product-card {
        padding: 4px;
        margin-bottom: 6px;
        min-height: auto;
        display: flex;
        flex-direction: column;
    }
    
    .product-content {
        padding: 4px;
        gap: 0px;
        display: flex;
        flex-direction: column;
        flex: 1;
    }
    
    .product-title {
        font-size: 0.8rem;
        line-height: 1.1 !important;
        margin-bottom: 0px;
        height: 2.2em;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        margin-top: 0.3rem;
    }
    
    .product-brand {
        font-size: 0.6rem;
        line-height: 0.8 !important;
        margin-bottom: 1px;
    }
    
    .product-rating {
        gap: 0px;
        margin-bottom: 1px;
        margin-top: 0.1rem;
        line-height: 1.0 !important;
    }
    
    .product-rating .stars {
        font-size: 0.6rem;
        line-height: 1.0 !important;
        margin-bottom: 1px;
    }
    
    .product-rating .sold-count {
        font-size: 0.55rem;
        line-height: 1.0 !important;
    }
    
    .product-price {
        margin-bottom: 1px;
        margin-top: 0.1rem;
        line-height: 0.8 !important;
    }
    
    .new-price {
        font-size: 0.8rem;
    }
    
    .old-price {
        font-size: 0.7rem;
    }
}

/* Add to Cart Button */
.product-form,
.add-to-cart-form,
.add-to-cart-btn {
    margin-top: auto;
    padding: 0 16px 16px 16px;
}

.add-to-cart-btn {
    width: 100%;
    background: linear-gradient(135deg, #000000, #333333);
    color: #ffffff;
    border: none;
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    font-size: 0.9rem;
}

.add-to-cart-btn:hover:not(.disabled) {
    background: linear-gradient(135deg, #d4af37, #f0d872);
    color: #000;
    transform: translateY(-2px);
}

.add-to-cart-btn.disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.add-to-cart-btn:active {
    transform: translateY(0);
}

.add-to-cart-btn:focus {
    outline: 2px solid #d4af37;
    outline-offset: 2px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .home-products-grid {
        grid-template-columns: repeat(4, 220px);
    }
    
    .featured-products-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .featured-products-header h2 {
        font-size: 2.2rem;
    }
}

@media (max-width: 1000px) {
    .home-products-grid {
        grid-template-columns: repeat(3, 220px);
    }
}

@media (max-width: 768px) {
    .home-products-container {
        padding: 0 1rem;
    }
    
    .home-products-grid {
        grid-template-columns: repeat(2, 160px);
        gap: 16px;
        padding: 1.5rem 0;
    }
    
    .product-card {
        width: 160px;
        min-width: 160px;
        max-width: 160px;
    }
    
    .product-content {
        padding: 12px;
        gap: 6px;
    }
    
    .product-title {
        font-size: 13px;
    }
    
    .new-price {
        font-size: 14px;
    }
    
    .add-to-cart-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .featured-products-header h2 {
        font-size: 2rem;
    }
    
    .view-all-btn {
        padding: 10px 20px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .home-products-grid {
        grid-template-columns: repeat(2, 140px);
        gap: 12px;
    }
    
    .product-card {
        width: 140px;
        min-width: 140px;
        max-width: 140px;
    }
    
    .product-content {
        padding: 10px;
    }
    
    .product-title {
        font-size: 12px;
    }
    
    .new-price {
        font-size: 13px;
    }
    
    .add-to-cart-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .featured-products-header h2 {
        font-size: 1.8rem;
    }
    
    .view-all-btn {
        padding: 8px 16px;
        font-size: 12px;
    }
}

/* Section Styling */
.featured-products-section h2 {
    text-align: center;
    font-size: 2.5rem;
    font-weight: bold;
    color: #2d3436;
    margin-bottom: 40px;
    position: relative;
}

.featured-products-section h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(135deg, #ff6b35, #e55a2b);
    border-radius: 2px;
}

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

.product-card.loading .product-image {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Accessibility Improvements */
.product-card:focus-visible {
    outline: 2px solid #ff6b35;
    outline-offset: 2px;
}

.add-to-cart-btn:focus-visible {
    outline: 2px solid #ff6b35;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .product-card {
        border: 2px solid #000;
    }
    
    .product-badge {
        background: #000;
        color: #fff;
    }
    
    .add-to-cart-btn {
        background: #000;
        color: #fff;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .product-card,
    .product-image,
    .add-to-cart-btn {
        transition: none;
    }
    
    .product-card:hover {
        transform: none;
    }
    
    .product-card:hover .product-image {
        transform: none;
    }
}