/**
 * Popular Products Styling
 */

/* Section Container */
.popular-products-section,
.trending-products-section {
    margin: 2rem 0;
    padding: 2rem 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

/* Filter Buttons */
.section-filters {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.filter-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

@media (max-width: 640px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
}

/* Product Card */
.product-card {
    position: relative;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    overflow: hidden;
    transition: all 0.3s;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-color: #3b82f6;
}

/* Badges */
.badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 10;
    backdrop-filter: blur(8px);
}

.popular-badge {
    background: rgba(239, 68, 68, 0.9);
    color: white;
}

.trending-badge {
    background: rgba(34, 197, 94, 0.9);
    color: white;
}

/* Product Image */
.product-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: #f9fafb;
}

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

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

/* Product Stats Overlay */
.product-stats {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

.product-stats span {
    padding: 0.25rem 0.5rem;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    color: white;
    font-size: 0.75rem;
    border-radius: 0.25rem;
}

/* Product Info */
.product-info {
    padding: 1rem;
}

.product-name {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 0.5rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Rating */
.product-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.stars {
    display: flex;
    align-items: center;
    gap: 0.125rem;
}

.star {
    font-size: 1rem;
    line-height: 1;
}

.star.full {
    color: #fbbf24;
}

.star.half {
    color: #fbbf24;
    opacity: 0.5;
}

.star.empty {
    color: #d1d5db;
}

.rating-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    margin-left: 0.25rem;
}

.rating-count {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* Price */
.product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: #3b82f6;
    margin-bottom: 0.5rem;
}

/* Category */
.product-category {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Add to Cart Button */
.btn-add-to-cart {
    width: 100%;
    padding: 0.75rem;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 0 0 0.75rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-add-to-cart:hover {
    background: #2563eb;
}

.btn-add-to-cart:active {
    background: #1d4ed8;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
    font-size: 1rem;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 1rem;
    height: 1rem;
    margin-left: 0.5rem;
    border: 2px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty/Error States */
.no-products,
.error {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

.error {
    color: #ef4444;
}

/* Product Link */
.product-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .section-header h2 {
        font-size: 1.5rem;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 640px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .section-filters {
        width: 100%;
        justify-content: space-between;
    }

    .filter-btn {
        flex: 1;
        font-size: 0.75rem;
        padding: 0.5rem;
    }

    .product-name {
        font-size: 0.875rem;
    }

    .product-price {
        font-size: 1rem;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .popular-products-section,
    .trending-products-section {
        background: #1a1a1a;
    }

    .section-header h2 {
        color: #f9fafb;
    }

    .product-card {
        background: #2d2d2d;
        border-color: #404040;
    }

    .product-card:hover {
        border-color: #3b82f6;
    }

    .product-name {
        color: #f9fafb;
    }

    .filter-btn {
        background: #2d2d2d;
        border-color: #404040;
        color: #9ca3af;
    }

    .filter-btn:hover {
        border-color: #3b82f6;
        color: #3b82f6;
    }

    .filter-btn.active {
        background: #3b82f6;
        border-color: #3b82f6;
        color: white;
    }
}
