
/* استایل حرفه‌ای برای صفحه دسته‌بندی */
:root {
    --primary-color: #324153;
    --secondary-color: #FE5000;
    --accent-color: #FFFB00;
    --white: #ffffff;
    --light-gray: #f8f9fa;
    --border-color: #e0e6ed;
    --text-dark: #2c3e50;
    --text-light: #6c757d;
    --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%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn', '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; /* افزودن direction برای متن فارسی */
}

.container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

/* عنوان دسته‌بندی */
.category-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 40px;
    position: relative;
    padding-bottom: 15px;
}

.category-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 50%;
    transform: translateX(50%);
    width: 100px;
    height: 4px;
    background: var(--gradient-secondary);
    border-radius: 2px;
    animation: pulseLine 2s ease-in-out infinite;
}

@keyframes pulseLine {
    0%, 100% { width: 100px; }
    50% { width: 150px; }
}

/* گرید محصولات - بهبود یافته */
.products-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-top: 30px;
    justify-content: center;
}

/* کارت محصول */
.product-card {
    background: var(--white);
    border-radius: 20px;
    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: 2px solid transparent;
    position: relative;
    display: block;
    width: 270px;
    flex: 0 0 auto;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-heavy);
    border-color: var(--secondary-color);
    text-decoration: none;
}

/* تصویر محصول */
.product-image {
    width: 100%;
    height: 220px;
    object-fit: contain;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

/* اطلاعات محصول */
.product-info {
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 120px;
}

/* نام محصول - یک خط با سه نقطه برای فارسی */
.product-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 15px;
    line-height: 1.4;
    direction: rtl; /* جهت راست به چپ برای فارسی */
    
    /* محدود کردن به یک خط با سه نقطه در انتها */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    
    /* برای مرورگرهای مختلف */
    display: block;
    max-width: 100%;
}

/* قیمت محصول */
.product-price {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--secondary-color);
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    padding: 10px 20px;
    border-radius: 25px;
    display: inline-block;
    box-shadow: 0 4px 12px rgba(254, 80, 0, 0.2);
    animation: priceGlow 2s ease-in-out infinite alternate;
    margin-top: auto;
    direction: rtl; /* جهت راست به چپ برای اعداد فارسی */
}

@keyframes priceGlow {
    0% { box-shadow: 0 4px 12px rgba(254, 80, 0, 0.2); }
    100% { box-shadow: 0 6px 18px rgba(254, 80, 0, 0.3); }
}

/* پیام عدم وجود محصول */
.container > p {
    text-align: center;
    font-size: 1.2rem;
    color: var(--text-light);
    margin-top: 60px;
    padding: 40px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 20px;
    border: 2px dashed var(--border-color);
    animation: fadeInUp 0.8s ease-out;
    direction: rtl; /* جهت راست به چپ برای فارسی */
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* رسپانسیو */
@media (max-width: 1200px) {
    .products-grid {
        gap: 25px;
    }
    .product-card {
        width: 250px;
    }
}

@media (max-width: 1024px) {
    .product-card {
        width: 230px;
    }
}

@media (max-width: 900px) {
    .product-card {
        width: calc(50% - 15px);
        max-width: 280px;
    }
}

@media (max-width: 768px) {
    .container {
        margin: 30px auto;
        padding: 0 15px;
    }
    
    .category-title {
        font-size: 2rem;
        margin-bottom: 30px;
        padding-bottom: 12px;
    }
    
    .products-grid {
        gap: 20px;
    }
    
    .product-card {
        width: calc(50% - 10px);
    }
    
    .product-image {
        height: 180px;
        padding: 15px;
    }
    
    .product-info {
        padding: 15px;
        min-height: 110px;
    }
    
    .product-name {
        font-size: 1rem;
    }
    
    .product-price {
        font-size: 1.1rem;
        padding: 8px 16px;
    }
}

@media (max-width: 576px) {
    .product-card {
        width: 100%;
        max-width: 300px;
    }
    
    .category-title {
        font-size: 1.7rem;
        margin-bottom: 25px;
    }
    
    .product-image {
        height: 150px;
        padding: 12px;
    }
    
    .product-info {
        padding: 12px;
        min-height: 100px;
    }
    
    .product-name {
        font-size: 0.9rem;
        margin-bottom: 12px;
    }
    
    .product-price {
        font-size: 1rem;
        padding: 6px 12px;
    }
}

/* انیمیشن ورود کارت‌ها */
.product-card {
    animation: fadeInUp 0.6s ease-out;
    animation-fill-mode: both;
}

.product-card:nth-child(1) { animation-delay: 0.1s; }
.product-card:nth-child(2) { animation-delay: 0.2s; }
.product-card:nth-child(3) { animation-delay: 0.3s; }
.product-card:nth-child(4) { animation-delay: 0.4s; }
.product-card:nth-child(5) { animation-delay: 0.5s; }
.product-card:nth-child(6) { animation-delay: 0.6s; }
.product-card:nth-child(7) { animation-delay: 0.7s; }
.product-card:nth-child(8) { animation-delay: 0.8s; }

/* بهبود عملکرد */
.product-card {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
    will-change: transform, box-shadow;
}

/* پشتیبانی از حالت کاهش حرکت */
@media (prefers-reduced-motion: reduce) {
    .product-card,
    .product-image,
    .category-title::after,
    .product-price {
        animation: none !important;
        transition: none !important;
    }
}

/* پشتیبانی از حالت تیره */
@media (prefers-color-scheme: dark) {
    .product-card {
        background: #2c3e50;
        border-color: #34495e;
    }
    
    .product-name {
        color: #ecf0f1;
    }
    
    .product-image {
        background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    }
    
    .container > p {
        background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
        color: #bdc3c7;
        border-color: #34495e;
    }
}
