@font-face {
    font-family: Estedad ;
    src: url('../fonts/Estedad.woff2')format('woff2');
}

/* استایل حرفه‌ای برای صفحه دسته‌بندی */
:root {
    --primary-color: #324153;
    --secondary-color: #FE5000;
    --accent-color: #FFFB00;
    --white: #ffffff;
    --light-gray: #f8f9fa;
    --border-color: #e0e6ed;
    --text-dark: #2c3e50;
    --text-light: #6c757d;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --shadow-light: 0 2px 8px rgba(50, 65, 83, 0.08);
    --shadow-medium: 0 4px 20px rgba(50, 65, 83, 0.12);
    --shadow-heavy: 0 8px 32px rgba(50, 65, 83, 0.16);
    --gradient-primary: linear-gradient(135deg, #324153 0%, #2c3949 100%);
    --gradient-secondary: linear-gradient(135deg, #FE5000 0%, #e6470a 100%);
    --loading-gradient: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Estedad', 'Tahoma', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--white);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
    text-rendering: optimizeSpeed;
    direction: rtl;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

/* Breadcrumb */
.breadcrumb {
    margin-bottom: 15px;
    padding: 10px 15px;
    background: var(--white);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    align-items: center;
    margin: 0;
    padding: 0;
}

.breadcrumb li {
    display: flex;
    align-items: center;
    margin-left: 8px;
    font-size: 0.9rem;
}

.breadcrumb-link {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
    padding: 2px 6px;
    border-radius: 4px;
}

.breadcrumb-link:hover {
    color: var(--secondary-color);
    background-color: var(--light-gray);
    text-decoration: underline;
}

.breadcrumb-separator {
    color: var(--text-light);
    margin-right: 8px;
    font-size: 0.8rem;
}

.breadcrumb-current {
    color: var(--text-light);
    font-weight: 500;
    padding: 2px 6px;
}

/* نوار فیلتر */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
    padding: 15px;
    background-color: var(--light-gray);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 15px;
}

.filter-options {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--white);
    color: var(--text-dark);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 150px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(254, 80, 0, 0.1);
}

.filter-toggle {
    padding: 8px 15px;
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-dark);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-toggle:hover {
    background-color: var(--light-gray);
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.results-count {
    font-size: 0.85rem;
    color: var(--text-light);
    white-space: nowrap;
}

#results-count {
    font-weight: bold;
    color: var(--primary-color);
}

/* فیلترهای پیشرفته */
.advanced-filters {
    margin: 15px 0;
    padding: 20px;
    background-color: var(--light-gray);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: none;
}

.advanced-filters.active {
    display: block;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.price-filter {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.price-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}

.price-input-group label {
    font-size: 0.85rem;
    color: var(--text-dark);
    min-width: 60px;
}

.price-input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--white);
    color: var(--text-dark);
    font-family: inherit;
    font-size: 0.85rem;
    width: 100%;
}

.apply-filters {
    padding: 8px 20px;
    background-color: var(--secondary-color);
    color: var(--white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.apply-filters:hover {
    background-color: #e6470a;
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.clear-filters {
    padding: 8px 15px;
    background-color: transparent;
    color: var(--text-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.clear-filters:hover {
    color: var(--danger-color);
    border-color: var(--danger-color);
}

/* بادج تخفیف */
.discount-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, var(--secondary-color), #ff6b35);
    color: var(--white);
    padding: 4px 8px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: bold;
    z-index: 3;
    box-shadow: 0 2px 6px rgba(254, 80, 0, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* استایل‌های محصولات ناموجود */
.product-card.out-of-stock {
    position: relative;
    opacity: 0.7;
}

.out-of-stock-label {
    position: absolute;
    top: 8px;
    left: 8px;
    background-color: var(--danger-color);
    color: var(--white);
    padding: 4px 8px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: bold;
    z-index: 3;
    box-shadow: 0 2px 6px rgba(220, 53, 69, 0.3);
}

.out-of-stock-price {
    color: var(--danger-color);
    font-weight: bold;
    font-size: 14px;
}

/* هشدار موجودی کم */
.stock-warning {
    margin-top: 6px;
    padding: 4px 8px;
    background-color: rgba(255, 193, 7, 0.1);
    border: 1px solid var(--warning-color);
    border-radius: 6px;
    color: var(--warning-color);
    font-size: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stock-warning i {
    font-size: 9px;
}

/* عنوان دسته‌بندی */
.category-title {
    text-align: center;
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-color);
    margin: 15px 0;
    position: relative;
    padding-bottom: 12px;
}

.category-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 50%;
    transform: translateX(50%);
    width: 80px;
    height: 3px;
    background: var(--gradient-secondary);
    border-radius: 2px;
}

.category-description {
    text-align: center;
    color: var(--text-light);
    font-size: 1rem;
    margin-bottom: 25px;
}

/* گرید محصولات - 4 محصول در هر ردیف */
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
    justify-content: center;
    align-items: stretch;
    width: 100%;
}

/* کارت محصول */
.product-card {
    background: var(--white);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-light);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: inherit;
    border: 1px solid transparent;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 360px;
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-heavy);
    border-color: var(--secondary-color);
    text-decoration: none;
}

.product-card:focus {
    outline: 3px solid var(--secondary-color);
    outline-offset: 2px;
}

/* حالت loading */
.product-card.loading {
    animation: pulse 1.5s infinite;
    pointer-events: none;
}

.product-card.loading .image-container {
    background: var(--loading-gradient);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* کانتینر تصویر */
.image-container {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: transparent;
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
}

/* wrapper برای تصاویر */
.image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateZ(0);
}

.product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
                transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    backface-visibility: hidden;
    padding: 12px;
    will-change: transform, opacity;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.product-image.image-error {
    filter: grayscale(100%) opacity(0.7);
}

.primary-image {
    opacity: 1;
    transform: scale(1);
    z-index: 2;
}

.secondary-image {
    opacity: 0;
    transform: scale(0.95);
    z-index: 1;
    loading: lazy;
}

.product-card:hover .primary-image {
    opacity: 0;
    transform: scale(0.95);
}

.product-card:hover .secondary-image {
    opacity: 1;
    transform: scale(1);
}

/* حالت ناموجود */
.product-card.out-of-stock .image-container {
    opacity: 0.6;
}

.product-card.out-of-stock .primary-image,
.product-card.out-of-stock .secondary-image {
    filter: grayscale(100%);
}

/* اطلاعات محصول */
.product-info {
    padding: 15px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-grow: 1;
}

/* نام محصول */
.product-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 12px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    min-height: 2.6em;
    max-height: 2.8em;
}

/* باکس قیمت */
.price-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: auto;
}

.original-price {
    font-size: 0.85rem;
    color: var(--text-light);
    text-decoration: line-through;
}

.discounted-price {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--secondary-color);
}

.normal-price {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary-color);
}

/* صفحه‌بندی */
.pagination {
    margin-top: 30px;
    text-align: center;
}

.pagination ul {
    display: flex;
    justify-content: center;
    list-style: none;
    gap: 6px;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
}

.pagination-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.pagination-link:hover {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
    background-color: rgba(254, 80, 0, 0.05);
}

.pagination-link.active {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: var(--white);
}

.pagination-ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* پیام عدم وجود محصول */
.no-products-container {
    text-align: center;
    padding: 40px 20px;
    margin-top: 30px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 16px;
    border: 2px dashed var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.no-products-icon {
    font-size: 3rem;
    color: var(--text-light);
    margin-bottom: 10px;
}

.no-products {
    font-size: 1.1rem;
    color: var(--text-light);
    line-height: 1.6;
}

.back-to-home {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: var(--white);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    margin-top: 15px;
}

.back-to-home:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

/* رسپانسیو - دسکتاپ */
@media (max-width: 1200px) {
    .product-grid {
        grid-template-columns: repeat(4, minmax(220px, 1fr));
        gap: 15px;
    }
    
    .image-container {
        height: 180px;
        padding: 12px;
    }
    
    .product-image {
        padding: 10px;
    }
    
    .product-info {
        padding: 12px;
    }
}

/* رسپانسیو - تبلت بزرگ */
@media (max-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(3, minmax(200px, 1fr));
    }
    
    .category-title {
        font-size: 1.8rem;
    }
    
    .category-description {
        font-size: 0.95rem;
    }
    
    .filter-bar {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
}

/* رسپانسیو - تبلت */
@media (max-width: 900px) {
    .product-grid {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
        gap: 15px;
    }
    
    .container {
        padding: 15px;
    }
    
    .category-title {
        font-size: 1.6rem;
        margin-bottom: 20px;
    }
    
    .image-container {
        height: 160px;
    }
    
    .product-card {
        min-height: 340px;
    }
}

/* رسپانسیو - تبلت کوچک */
@media (max-width: 768px) {
    .container {
        margin: 0 auto;
        padding: 15px;
    }
    
    .category-title {
        font-size: 1.5rem;
        padding-bottom: 10px;
        margin-bottom: 15px;
    }
    
    .category-description {
        font-size: 0.9rem;
        margin-bottom: 20px;
    }
    
    .breadcrumb {
        margin-bottom: 12px;
        padding: 8px 0;
    }
    
    .breadcrumb li {
        font-size: 0.8rem;
    }
    
    .filter-bar {
        padding: 12px;
        margin: 15px 0;
        gap: 12px;
    }
    
    .filter-options {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 8px;
    }
    
    .filter-select,
    .filter-toggle {
        width: 100%;
        font-size: 0.8rem;
        padding: 7px 10px;
    }
    
    .product-grid {
        gap: 12px;
    }
    
    .image-container {
        height: 150px;
        padding: 10px;
    }
    
    .product-image {
        padding: 8px;
    }
    
    .product-info {
        padding: 10px;
    }
    
    .product-name {
        font-size: 0.9rem;
        min-height: 2.4em;
        margin-bottom: 10px;
    }
    
    .discounted-price,
    .normal-price {
        font-size: 1rem;
    }
    
    .original-price {
        font-size: 0.8rem;
    }
    
    .pagination-link {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
    
    .price-filter {
        flex-direction: column;
        align-items: stretch;
    }
    
    .price-input-group {
        min-width: 100%;
    }
}

/* رسپانسیو - موبایل بزرگ */
@media (max-width: 640px) {
    .product-grid {
        grid-template-columns: repeat(2, minmax(140px, 1fr));
        gap: 10px;
    }
    
    .category-title {
        font-size: 1.4rem;
        margin-bottom: 15px;
    }
    
    .product-card {
        min-height: 300px;
        border-radius: 12px;
    }
    
    .image-container {
        height: 130px;
        padding: 8px;
    }
    
    .product-image {
        padding: 6px;
    }
    
    .product-info {
        padding: 8px;
    }
    
    .product-name {
        font-size: 0.85rem;
        min-height: 2.2em;
        margin-bottom: 8px;
    }
    
    .discounted-price,
    .normal-price {
        font-size: 0.9rem;
    }
    
    .original-price {
        font-size: 0.75rem;
    }
    
    .discount-badge,
    .out-of-stock-label {
        font-size: 10px;
        padding: 3px 6px;
        border-radius: 12px;
    }
    
    .stock-warning {
        font-size: 9px;
        padding: 3px 6px;
    }
}

/* رسپانسیو - موبایل متوسط */
@media (max-width: 480px) {
    .container {
        padding: 12px;
    }
    
    .category-title {
        font-size: 1.3rem;
        margin-bottom: 12px;
        padding-bottom: 8px;
    }
    
    .category-description {
        font-size: 0.85rem;
        margin-bottom: 15px;
    }
    
    .product-grid {
        grid-template-columns: repeat(2, minmax(130px, 1fr));
        gap: 8px;
    }
    
    .product-card {
        min-height: 280px;
        border-radius: 10px;
    }
    
    .image-container {
        height: 120px;
        padding: 6px;
    }
    
    .product-image {
        padding: 5px;
    }
    
    .product-info {
        padding: 6px;
    }
    
    .product-name {
        font-size: 0.8rem;
        min-height: 2em;
        margin-bottom: 6px;
    }
    
    .discounted-price,
    .normal-price {
        font-size: 0.85rem;
    }
    
    .original-price {
        font-size: 0.7rem;
    }
    
    .no-products-container {
        padding: 30px 15px;
        margin-top: 20px;
        gap: 10px;
    }
    
    .no-products-icon {
        font-size: 2.5rem;
    }
    
    .no-products {
        font-size: 1rem;
    }
    
    .pagination-link {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }
}

/* رسپانسیو - موبایل کوچک */
@media (max-width: 375px) {
    .category-title {
        font-size: 1.2rem;
    }
    
    .product-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        max-width: 280px;
        margin: 15px auto;
    }
    
    .product-card {
        min-height: 260px;
        max-width: 100%;
    }
    
    .image-container {
        height: 140px;
    }
    
    .product-info {
        padding: 10px;
    }
    
    .product-name {
        font-size: 0.85rem;
    }
    
    .discounted-price,
    .normal-price {
        font-size: 0.9rem;
    }
}

/* رسپانسیو - موبایل خیلی کوچک */
@media (max-width: 320px) {
    .container {
        padding: 10px;
    }
    
    .category-title {
        font-size: 1.1rem;
    }
    
    .product-grid {
        gap: 8px;
        max-width: 260px;
    }
    
    .product-card {
        min-height: 240px;
    }
    
    .image-container {
        height: 120px;
        padding: 5px;
    }
    
    .product-info {
        padding: 8px;
    }
    
    .product-name {
        font-size: 0.75rem;
    }
}

/* برای دستگاه‌های تاچ */
@media (hover: none) and (pointer: coarse) {
    .product-card:active .primary-image {
        opacity: 0;
        transform: scale(0.95);
    }
    
    .product-card:active .secondary-image {
        opacity: 1;
        transform: scale(1);
    }
}

/* انیمیشن‌ها */
@media (prefers-reduced-motion: no-preference) {
    .product-card {
        animation: fadeInUp 0.6s ease-out;
        animation-fill-mode: both;
    }
    
    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* کاهش حرکت */
@media (prefers-reduced-motion: reduce) {
    .product-card,
    .product-image,
    .discount-badge {
        animation: none !important;
        transition: none !important;
    }
    
    .product-card:hover {
        transform: none;
    }
    
    .advanced-filters.active {
        animation: none;
    }
}

/* پشتیبانی از حالت تیره */
@media (prefers-color-scheme: dark) {
    :root {
        --white: #1a1a1a;
        --text-dark: #e0e0e0;
        --light-gray: #2c3e50;
        --border-color: #34495e;
        --text-light: #95a5a6;
        --loading-gradient: linear-gradient(90deg, #2c3e50 25%, #34495e 50%, #2c3e50 75%);
    }
    
    body {
        background-color: #121212;
        color: var(--text-dark);
    }
    
    .product-card {
        background: var(--light-gray);
        border-color: var(--border-color);
    }
    
    .product-name {
        color: var(--text-dark);
    }
    
    .image-container {
        background: transparent;
    }
    
    .no-products-container {
        background: linear-gradient(135deg, var(--light-gray) 0%, #2c3e50 100%);
        color: var(--text-light);
        border-color: var(--border-color);
    }
    
    .normal-price {
        color: #ffa726;
    }
    
    .breadcrumb-link {
        color: #3498db;
    }
    
    .breadcrumb-current {
        color: var(--text-light);
    }
    
    .filter-bar,
    .advanced-filters {
        background-color: #2c3e50;
        border-color: var(--border-color);
    }
    
    .filter-select,
    .filter-toggle,
    .price-input {
        background-color: #34495e;
        color: var(--text-dark);
        border-color: var(--border-color);
    }
    
    .filter-select:focus,
    .price-input:focus {
        border-color: var(--secondary-color);
        box-shadow: 0 0 0 3px rgba(254, 80, 0, 0.2);
    }
    
    .back-to-home {
        background-color: #2980b9;
    }
    
    .back-to-home:hover {
        background-color: var(--secondary-color);
    }
    
    .pagination-link {
        background-color: #34495e;
        border-color: var(--border-color);
        color: var(--text-dark);
    }
    
    .pagination-link:hover {
        background-color: #2c3e50;
        border-color: var(--secondary-color);
        color: var(--secondary-color);
    }
    
    .pagination-link.active {
        background-color: var(--secondary-color);
        border-color: var(--secondary-color);
        color: #ffffff;
    }
    
    .clear-filters {
        color: var(--text-light);
        border-color: var(--border-color);
    }
    
    .clear-filters:hover {
        color: #ff6b6b;
        border-color: #ff6b6b;
    }
}