/* ========================================
   🛍️ PRODUCTS LISTING - ENHANCED
   Modern Grid Layout with Filters
   ======================================== */

:root {
    --primary: #667eea;
    --primary-dark: #5568d3;
    --primary-light: #818cf8;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
}

/* ========================================
   PRODUCTS PAGE LAYOUT
   ======================================== */

.products-page {
    padding: 40px 0;
}

.products-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ========================================
   PAGE HEADER
   ======================================== */

.products-header {
    margin-bottom: 40px;
}

.products-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.products-title i {
    color: var(--primary);
}

.products-subtitle {
    color: var(--gray-600);
    font-size: 1.125rem;
}

.products-count {
    color: var(--primary);
    font-weight: 700;
}

/* ========================================
   LAYOUT WITH SIDEBAR
   ======================================== */

.products-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
}

/* ========================================
   FILTERS SIDEBAR
   ======================================== */

.filters-sidebar {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 180px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--gray-100);
}

.filters-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
}

.clear-filters {
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
}

.clear-filters:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Filter Group */
.filter-group {
    margin-bottom: 32px;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-group-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group-title i {
    color: var(--primary);
    font-size: 18px;
}

/* Filter Options */
.filter-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
    padding: 8px;
    border-radius: 8px;
}

.filter-option:hover {
    background: var(--gray-50);
}

.filter-option input[type="checkbox"],
.filter-option input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.filter-option label {
    flex: 1;
    cursor: pointer;
    font-size: 0.9375rem;
    color: var(--gray-700);
    user-select: none;
}

.filter-option .count {
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* Price Range */
.price-range {
    display: flex;
    gap: 12px;
    align-items: center;
}

.price-input {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.9375rem;
    text-align: center;
}

.price-input:focus {
    outline: none;
    border-color: var(--primary);
}

.price-separator {
    color: var(--gray-500);
    font-weight: 600;
}

.apply-price-btn {
    width: 100%;
    padding: 10px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 12px;
}

.apply-price-btn:hover {
    background: var(--primary-dark);
}

/* ========================================
   PRODUCTS AREA
   ======================================== */

.products-area {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Toolbar */
.products-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 20px 24px;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.results-count {
    color: var(--gray-700);
    font-size: 0.9375rem;
}

.results-count strong {
    color: var(--primary);
    font-weight: 700;
}

.view-toggle {
    display: flex;
    gap: 4px;
    background: var(--gray-100);
    padding: 4px;
    border-radius: 8px;
}

.view-btn {
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
}

.view-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.view-btn i {
    font-size: 18px;
}

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

.sort-label {
    color: var(--gray-700);
    font-weight: 600;
    font-size: 0.9375rem;
}

.sort-select {
    padding: 10px 36px 10px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    font-size: 0.9375rem;
    color: var(--gray-800);
    cursor: pointer;
    transition: all 0.2s;
    background: white;
    font-family: 'Cairo', sans-serif;
}

[dir="rtl"] .sort-select {
    padding: 10px 16px 10px 36px;
    text-align: right;
}

.sort-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* ========================================
   PRODUCTS GRID
   ======================================== */

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.products-grid.list-view {
    grid-template-columns: 1fr;
}

/* ========================================
   EMPTY STATE
   ======================================== */

.empty-state {
    text-align: center;
    padding: 80px 20px;
    background: white;
    border-radius: 16px;
}

.empty-icon {
    font-size: 4rem;
    color: var(--gray-300);
    margin-bottom: 20px;
}

.empty-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 12px;
}

.empty-text {
    color: var(--gray-600);
    font-size: 1.125rem;
    margin-bottom: 24px;
}

.empty-btn {
    display: inline-block;
    padding: 12px 32px;
    background: var(--primary);
    color: white;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.3s;
}

.empty-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* ========================================
   PAGINATION
   ======================================== */

.products-pagination {
    display: flex;
    justify-content: center;
    margin-top: 40px;
}

/* ========================================
   MOBILE FILTERS
   ======================================== */

.mobile-filters-btn {
    display: none;
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    margin-bottom: 24px;
}

.mobile-filters-btn i {
    margin-left: 8px;
}

[dir="rtl"] .mobile-filters-btn i {
    margin-left: 0;
    margin-right: 8px;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1200px) {
    .products-layout {
        grid-template-columns: 240px 1fr;
        gap: 24px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 1024px) {
    .products-layout {
        grid-template-columns: 1fr;
    }
    
    .filters-sidebar {
        display: none;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 320px;
        z-index: 1000;
        max-height: 100vh;
    }
    
    [dir="rtl"] .filters-sidebar {
        right: 0;
        left: auto;
    }
    
    .filters-sidebar.active {
        display: block;
    }
    
    .mobile-filters-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .products-title {
        font-size: 2rem;
    }
    
    .products-toolbar {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
    
    .toolbar-left,
    .toolbar-right {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .view-toggle {
        justify-content: center;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .products-page {
        padding: 20px 0;
    }
    
    .products-container {
        padding: 0 16px;
    }
    
    .products-title {
        font-size: 1.5rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

.filter-option:focus-within {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition-duration: 0.01ms !important;
    }
}
