/**
 * Inline Filter System Styles
 * Modern, clean design for instant product filtering
 */

/* Filter Section Container */
.filter-section-inline {
    background: white;
    border-bottom: 1px solid #E5E7EB;
    padding: 20px 0;
    margin-bottom: 24px;
    position: sticky;
    top: 80px; /* Below header */
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.filter-container-inline {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Filter Header Row */
.filter-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.filter-stats {
    font-size: 14px;
    color: #6B7280;
    font-weight: 500;
}

.filter-badge {
    background: #F15B39;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 8px;
}

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

/* Filter Search Input */
.filter-search-input {
    display: flex;
    align-items: center;
    background: #F3F4F6;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 8px 12px;
    gap: 8px;
    min-width: 250px;
}

.filter-search-input input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    color: #374151;
    width: 100%;
}

.filter-search-input input::placeholder {
    color: #9CA3AF;
}

.filter-search-input .material-symbols-outlined {
    color: #9CA3AF;
    font-size: 20px;
}

/* Sort Dropdown */
.filter-sort-dropdown {
    position: relative;
}

.filter-sort-select {
    padding: 8px 32px 8px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23374151' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    min-width: 150px;
}

.filter-sort-select:focus {
    outline: none;
    border-color: #F15B39;
    box-shadow: 0 0 0 3px rgba(241, 91, 57, 0.1);
}

/* Price Range Filter */
.price-range-select {
    padding: 8px 32px 8px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23374151' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    min-width: 170px;
}

/* Category Filter Buttons */
.category-filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: white;
    border: 1.5px solid #D1D5DB;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    white-space: nowrap;
}

.filter-btn:hover {
    border-color: #F15B39;
    color: #F15B39;
    background: #FEF2F0;
    transform: translateY(-1px);
}

.filter-btn .material-symbols-outlined {
    font-size: 18px;
}

.filter-btn:active {
    transform: scale(0.98);
}

.filter-btn.active {
    background: linear-gradient(135deg, #F15B39 0%, #FF7A5C 100%);
    border-color: #F15B39;
    color: white;
    box-shadow: 0 4px 12px rgba(241, 91, 57, 0.3);
}

.filter-btn.active .filter-count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.filter-count {
    background: #F3F4F6;
    color: #6B7280;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

/* Clear Filters Button */
.btn-clear-filters {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: white;
    border: 1.5px solid #E5E7EB;
    border-radius: 8px;
    font-size: 14px;
    color: #6B7280;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-clear-filters:hover {
    border-color: #F15B39;
    color: #F15B39;
    background: #FEF2F0;
}

.btn-clear-filters .material-symbols-outlined {
    font-size: 18px;
}

/* Products Grid - Optimized for more columns */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    padding: 0 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Responsive Grid Overrides */
@media (min-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 16px;
    }
}

@media (min-width: 1024px) and (max-width: 1199px) {
    .products-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 14px;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .products-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 12px;
    }
}

@media (min-width: 480px) and (max-width: 767px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
}

/* Product Card Styles */
.product-card-wrapper {
    animation: fadeInUp 0.3s ease-out;
}

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

.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    height: 100%;
    display: flex;
    flex-direction: column;
    aspect-ratio: 2 / 3; /* Match other files for consistent height */
    min-height: 0;
    max-height: none;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.product-image-container {
    width: 100%;
    height: 66.666%; /* 2/3 of card height for consistent aspect ratio */
    position: relative;
    overflow: hidden;
    background: #F9FAFB;
}

.product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.product-info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

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

.product-price {
    margin: 0;
}

.price-current {
    font-size: 20px;
    font-weight: 700;
    color: #F15B39;
}

/* Product Footer - price and button in same row */
.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0;
}

.product-button {
    width: auto;
    padding: 12px 16px;
    background-color: #ffffff; /* restore white */
    color: #2563EB; /* restore blue text */
    border: 1.5px solid #2563EB; /* restore border */
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.16s ease;
    margin: 0;
    min-height: 44px; /* adjusted for row layout */
}

.product-button:hover {
    background: linear-gradient(135deg, #1E40AF 0%, #1E3A8A 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.18);
    color: #ffffff;
}

.product-button .material-symbols-outlined {
    font-size: 20px;
    color: inherit;
}

.product-button:active {
    transform: scale(0.98);
}

/* No Products Found */
.no-products-found {
    text-align: center;
    padding: 60px 20px;
    max-width: 400px;
    margin: 0 auto;
}

.no-products-found h3 {
    font-size: 20px;
    color: #374151;
    margin: 16px 0 8px;
}

.no-products-found p {
    color: #6B7280;
    font-size: 14px;
    margin-bottom: 20px;
}

/* Load More Button */
#loadMoreProducts {
    display: block;
    margin: 40px auto;
    padding: 12px 32px;
    background: white;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
}

#loadMoreProducts:hover {
    border-color: #F15B39;
    color: #F15B39;
    background: #FEF2F0;
}

/* Loading Spinner for Lazy Load */
.loading-more {
    text-align: center;
    padding: 20px;
    color: #9CA3AF;
    font-size: 14px;
}

.loading-more .spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #E5E7EB;
    border-top-color: #F15B39;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .filter-section-inline {
        top: 60px;
    }

    .filter-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .filter-controls-right {
        width: 100%;
        flex-direction: column;
    }

    .filter-search-input,
    .filter-sort-select,
    .price-range-select {
        width: 100%;
        min-width: 100%;
    }

    .category-filter-buttons {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
    }

    .category-filter-buttons::-webkit-scrollbar {
        height: 4px;
    }

    .category-filter-buttons::-webkit-scrollbar-thumb {
        background: #D1D5DB;
        border-radius: 4px;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 16px;
        padding: 0 12px;
    }

    .product-info {
        padding: 12px;
    }

    .product-name {
        font-size: 14px;
    }

    .price-current {
        font-size: 16px;
    }

    .product-button {
        padding: 8px 12px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
