/* =====================================================
   PRODUCTS PAGE - IMPROVED CSS
   ===================================================== */

/* Products Container */
.products-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Products Layout */
.products-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
    margin-top: 20px;
}

@media (max-width: 1024px) {
    .products-layout {
        grid-template-columns: 1fr;
    }
    
    .filters-sidebar {
        position: static !important;
    }
}

/* =====================================================
   FILTERS SIDEBAR - IMPROVED STYLING
   ===================================================== */
.filters-sidebar {
    background: #ffffff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: sticky;
    top: 20px;
    height: fit-content;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.filter-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.filter-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.filter-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #1f2937;
}

/* =====================================================
   CATEGORY LINKS - IMPROVED STYLING
   ===================================================== */
.category-parent {
    display: block;
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: 6px;
    background: #f9fafb;
    color: #374151;
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.category-parent:hover {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #1f2937;
}

.category-parent.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
    font-weight: 600;
}

.category-count {
    float: right;
    color: #6b7280;
    font-size: 13px;
    font-weight: 400;
}

.category-parent.active .category-count {
    color: rgba(255, 255, 255, 0.9);
}

/* Subcategories List */
.subcategory-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0 0;
}

.subcategory-item {
    margin-bottom: 4px;
}

.subcategory-link {
    display: block;
    padding: 10px 15px 10px 30px;
    border-radius: 6px;
    color: #6b7280;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    position: relative;
}

.subcategory-link:before {
    content: "•";
    position: absolute;
    left: 18px;
    color: #9ca3af;
}

.subcategory-link:hover {
    background: #f3f4f6;
    color: #374151;
}

.subcategory-link.active {
    background: #dbeafe;
    color: #1e40af;
    border-color: #bfdbfe;
    font-weight: 500;
}

.subcategory-link.active:before {
    color: #1e40af;
}

.subcategory-link .category-count {
    color: inherit;
    opacity: 0.7;
}

/* Sort Select */
.sort-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    color: #374151;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sort-select:hover {
    border-color: #9ca3af;
}

.sort-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* =====================================================
   PRODUCTS GRID
   ===================================================== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
}

/* Product Card */
.product-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.product-image {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
    background: #f3f4f6;
}

.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);
}

.product-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: #9ca3af;
    font-size: 48px;
}

/* Product Info */
.product-info {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-category {
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    font-weight: 500;
}

.product-name, .product-info h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 10px;
    line-height: 1.4;
    min-height: 44px;
}

.product-description {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 15px;
    flex: 1;
}

.product-price {
    font-size: 24px;
    font-weight: 700;
    color: #3b82f6;
    margin-bottom: 15px;
}

.product-actions {
    display: flex;
    gap: 10px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: #3b82f6;
    color: white;
    flex: 1;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

/* Product Count */
.product-count {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 20px;
}

/* No Products */
.no-products {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.no-products p {
    font-size: 18px;
    color: #6b7280;
    margin-bottom: 20px;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

/* Search Bar */
.search-bar {
    max-width: 400px;
    flex: 1;
}

.search-bar input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.search-bar input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .products-container {
        padding: 15px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .page-header h1 {
        font-size: 24px;
    }
    
    .search-bar {
        max-width: 100%;
    }
    
    .filters-sidebar {
        padding: 15px;
    }
    
    .category-parent,
    .subcategory-link {
        font-size: 14px;
        padding: 10px 12px;
    }
    
    .product-image {
        height: 200px;
    }
    
    .product-info {
        padding: 15px;
    }
}

/* Scrollbar Styling for Sidebar */
.filters-sidebar::-webkit-scrollbar {
    width: 6px;
}

.filters-sidebar::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 3px;
}

.filters-sidebar::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.filters-sidebar::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Loading State */
.product-card.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Badge for Featured Products */
.product-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ef4444;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    z-index: 1;
}

.product-badge.featured {
    background: #f59e0b;
}

.product-badge.new {
    background: #10b981;
}
/* =====================================================
   ADD THIS TO YOUR EXISTING style.css FILE
   Products Page - Collapsible Categories + Independent Scroll
   ===================================================== */

/* Products Container */
.products-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Page Header */
.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 10px 0;
}

.product-count {
    font-size: 14px;
    color: #6b7280;
    margin: 10px 0;
}

/* Products Layout - Two Columns */
.products-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
    height: calc(100vh - 250px);
    overflow: hidden;
}

/* Sidebar - Independent Scroll */
.filters-sidebar {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

.filters-sidebar::-webkit-scrollbar {
    width: 6px;
}

.filters-sidebar::-webkit-scrollbar-track {
    background: #f3f4f6;
}

.filters-sidebar::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

/* Filter Section */
.filter-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.filter-section:last-child {
    border-bottom: none;
}

.filter-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: #1f2937;
}

/* Category Item */
.category-item {
    margin-bottom: 8px;
}

/* Category Parent Button/Link */
.category-parent {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 15px;
    border-radius: 8px;
    background: #f9fafb;
    color: #374151;
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    cursor: pointer;
    text-align: left;
}

.category-parent:hover {
    background: #f3f4f6;
    border-color: #e5e7eb;
}

.category-parent.active {
    background: #3b82f6;
    color: white;
    font-weight: 600;
}

/* Category Text & Count */
.category-text {
    flex: 1;
}

.category-count {
    color: #6b7280;
    font-size: 13px;
    margin-left: auto;
    margin-right: 8px;
}

.category-parent.active .category-count {
    color: rgba(255, 255, 255, 0.9);
}

/* Dropdown Arrow */
.dropdown-arrow {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    color: #6b7280;
}

.category-parent.active .dropdown-arrow {
    color: white;
}

.category-parent.expanded .dropdown-arrow {
    transform: rotate(180deg);
}

/* Subcategories Container */
.subcategories {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    margin-top: 4px;
}

.subcategories.expanded {
    max-height: 500px;
}

/* Subcategory List */
.subcategory-list {
    list-style: none;
    padding: 8px 0 0 0;
    margin: 0;
}

.subcategory-item {
    margin-bottom: 4px;
}

/* Subcategory Link */
.subcategory-link {
    display: flex;
    align-items: center;
    padding: 10px 15px 10px 30px;
    border-radius: 6px;
    color: #6b7280;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
    position: relative;
}

.subcategory-link:before {
    content: "•";
    position: absolute;
    left: 18px;
    color: #9ca3af;
}

.subcategory-link:hover {
    background: #f3f4f6;
    color: #374151;
}

.subcategory-link.active {
    background: #dbeafe;
    color: #1e40af;
    font-weight: 500;
}

.subcategory-link.active:before {
    color: #1e40af;
}

/* Sort Select */
.sort-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    color: #374151;
    font-size: 14px;
    cursor: pointer;
}

.sort-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Products Grid Container - Independent Scroll */
.products-grid-container {
    height: 100%;
    overflow-y: auto;
    padding-right: 10px;
}

.products-grid-container::-webkit-scrollbar {
    width: 8px;
}

.products-grid-container::-webkit-scrollbar-track {
    background: #f3f4f6;
}

.products-grid-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    padding-bottom: 30px;
}

/* Product Card */
.product-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

/* Product Image */
.product-image {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
    background: #f3f4f6;
}

.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);
}

.product-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: #9ca3af;
    font-size: 48px;
}

/* Product Info */
.product-info {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-category {
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.product-name {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 10px;
    line-height: 1.4;
}

.product-description {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 15px;
    flex: 1;
}

.product-price {
    font-size: 24px;
    font-weight: 700;
    color: #3b82f6;
    margin-bottom: 15px;
}

.product-actions {
    display: flex;
    gap: 10px;
}

/* No Products */
.no-products {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 10px;
}

.no-products p {
    font-size: 18px;
    color: #6b7280;
    margin-bottom: 20px;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .products-layout {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }
    
    .filters-sidebar {
        height: auto;
        max-height: 400px;
    }
    
    .products-grid-container {
        height: auto;
        overflow-y: visible;
    }
}

@media (max-width: 768px) {
    .products-container {
        padding: 15px;
    }
    
    .page-header h1 {
        font-size: 24px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .product-image {
        height: 200px;
    }
    
    .product-info {
        padding: 15px;
    }
}