/* ====================================================================
   لیست محصولات - زیبایا
   ==================================================================== */

:root {
    --primary: #d63384;
    --primary-dark: #a82868;
    --primary-light: #f8d7e8;
    --secondary: #7c3aed;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #0dcaf0;
    --text-dark: #212529;
    --text-medium: #495057;
    --text-light: #6c757d;
    --bg-light: #f8f9fa;
    --bg-muted: #e9ecef;
    --border-color: #dee2e6;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.15);
    --transition-fast: 0.2s ease;
    --transition-base: 0.3s ease;
}

/* ====================================================================
   هدر صفحه
   ==================================================================== */
.page-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 40px 20px;
    text-align: center;
    border-radius: 0 0 20px 20px;
    margin-bottom: 30px;
}

.page-header h1 {
    margin: 0 0 10px;
    font-size: 2rem;
    font-weight: 900;
}

.page-header p {
    margin: 0;
    opacity: 0.95;
    font-size: 1.1rem;
}

/* ====================================================================
   آمار سریع
   ==================================================================== */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-item {
    background: white;
    padding: 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all var(--transition-base);
    border-right: 4px solid var(--primary);
}

.stat-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    font-size: 2rem;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--text-dark);
    line-height: 1;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 600;
}

/* ====================================================================
   نوار جستجو اصلی
   ==================================================================== */
.main-search-bar {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-md);
}

.search-form {
    display: flex;
    gap: 10px;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 1.1rem;
}

.search-input {
    width: 100%;
    padding: 14px 45px 14px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: 'Vazirmatn', sans-serif;
    transition: all var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(214, 51, 132, 0.1);
}

.search-btn {
    padding: 14px 30px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: 'Vazirmatn', sans-serif;
    white-space: nowrap;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ====================================================================
   فیلتر دسته‌بندی
   ==================================================================== */
.category-filter-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-sm);
}

.filter-label {
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 15px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.category-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 25px;
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.category-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

.category-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(214, 51, 132, 0.3);
}

.cat-icon {
    font-size: 1.1rem;
}

.cat-count {
    background: rgba(255,255,255,0.3);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
}

.category-btn:not(.active) .cat-count {
    background: var(--border-color);
    color: var(--text-light);
}

/* ====================================================================
   فیلترهای پیشرفته
   ==================================================================== */
.advanced-filters {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-sm);
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-label-small {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.filter-select {
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    background: white;
    font-family: 'Vazirmatn', sans-serif;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
}

.price-range {
    display: flex;
    gap: 8px;
    align-items: center;
}

.price-input {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-family: 'Vazirmatn', sans-serif;
    min-width: 0;
}

.price-input:focus {
    outline: none;
    border-color: var(--primary);
}

.price-separator {
    color: var(--text-light);
    font-size: 0.85rem;
}

.filter-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-apply-filter {
    padding: 10px 20px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: 'Vazirmatn', sans-serif;
}

.btn-apply-filter:hover {
    background: #218838;
    transform: translateY(-2px);
}

.btn-clear-filter {
    padding: 10px 20px;
    background: var(--danger);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    transition: all var(--transition-fast);
}

.btn-clear-filter:hover {
    background: #c82333;
    transform: translateY(-2px);
}

/* ====================================================================
   اطلاعات نتایج
   ==================================================================== */
.results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
    gap: 10px;
}

.results-count {
    font-size: 0.95rem;
    color: var(--text-medium);
}

.results-count strong {
    color: var(--primary);
    font-size: 1.1rem;
}

.page-info {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* ====================================================================
   گرید محصولات
   ==================================================================== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.product-card {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.product-out-of-stock {
    opacity: 0.75;
}

/* تصویر محصول */
.product-image-container {
    position: relative;
    aspect-ratio: 1;
    background: var(--bg-light);
    overflow: hidden;
}

.product-image-container a {
    display: block;
    width: 100%;
    height: 100%;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-base);
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

.product-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: var(--text-light);
}

/* بج‌ها */
.discount-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(238, 90, 111, 0.3);
}

.stock-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
}

.stock-out { background: var(--danger); }
.stock-low { background: #ff9800; }

.featured-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: var(--text-dark);
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
}

/* اطلاعات محصول */
.product-info {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-category {
    display: inline-block;
    background: var(--bg-light);
    color: var(--text-medium);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 10px;
    align-self: flex-start;
}

.product-name {
    margin: 0 0 12px;
    font-size: 1rem;
    font-weight: 900;
    color: var(--text-dark);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 2.8em;
    word-wrap: break-word;
    display: block;
}
.product-name a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.product-name a:hover {
    color: var(--primary);
}

/* اطلاعات فروشنده */
.seller-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    margin-bottom: 10px;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.seller-logo {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
}

.seller-logo-placeholder {
    width: 35px;
    height: 35px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
}

.seller-details {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 5px;
}

.seller-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.seller-name:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.verified-badge {
    font-size: 0.8rem;
}

/* قیمت */
.product-price-section {
    margin-bottom: 10px;
}

.price-original {
    text-decoration: line-through;
    color: var(--text-light);
    font-size: 0.85rem;
    margin-bottom: 3px;
}

.price-final {
    color: var(--success);
    font-size: 1.2rem;
    font-weight: 900;
}

/* امتیاز */
.product-rating {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 12px;
}

.stars {
    color: var(--warning);
    font-size: 0.9rem;
}

.rating-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-dark);
}

/* دکمه‌ها */
.product-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.btn-add-to-cart {
    flex: 2;
    padding: 10px;
    background: linear-gradient(135deg, var(--success) 0%, #20c997 100%);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.85rem;
    text-align: center;
    transition: all var(--transition-fast);
}

.btn-add-to-cart:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.btn-unavailable {
    flex: 2;
    padding: 10px;
    background: var(--bg-muted);
    color: var(--text-light);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: not-allowed;
}

.btn-view-details {
    flex: 1;
    padding: 10px;
    background: var(--info);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.85rem;
    text-align: center;
    transition: all var(--transition-fast);
}

.btn-view-details:hover {
    background: #0aa2c0;
    transform: translateY(-2px);
}

/* ====================================================================
   صفحه‌بندی
   ==================================================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.page-btn {
    padding: 10px 20px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 700;
    transition: all var(--transition-fast);
}

.page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

.page-numbers {
    display: flex;
    gap: 5px;
}

.page-number {
    padding: 8px 14px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 600;
    transition: all var(--transition-fast);
}

.page-number:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.page-number.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ====================================================================
   حالت خالی
   ==================================================================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.empty-state .empty-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    margin: 0 0 10px;
    color: var(--text-dark);
    font-size: 1.5rem;
}

.empty-state p {
    color: var(--text-light);
    margin-bottom: 25px;
    font-size: 1rem;
}

.btn-primary {
    display: inline-block;
    padding: 12px 30px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 700;
    transition: all var(--transition-fast);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ====================================================================
   ریسپانسیو
   ==================================================================== */
@media (max-width: 768px) {
    .page-header {
        padding: 30px 15px;
    }
    
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    .quick-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .search-btn {
        width: 100%;
    }
    
    .category-buttons {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 10px;
    }
    
    .category-btn {
        flex-shrink: 0;
    }
    
    .filter-row {
        grid-template-columns: 1fr;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .product-name {
        font-size: 0.9rem;
    }
    
    .price-final {
        font-size: 1rem;
    }
    
    .product-actions {
        flex-direction: column;
    }
    
    .btn-add-to-cart,
    .btn-view-details {
        width: 100%;
    }
    
    .pagination {
        gap: 5px;
    }
    
    .page-btn {
        padding: 8px 15px;
        font-size: 0.85rem;
    }
    
    .page-number {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-stats {
        grid-template-columns: 1fr;
    }
    
    .stat-item {
        padding: 15px;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
}