/* ============================================
   ساختار اصلی منوی سه بخشی
   ============================================ */

.triple-mega-menu-wrapper {
    position: relative;
    display: flex;
    height: 500px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    font-family: 'Vazir', 'IRANSans', Tahoma, sans-serif;
    text-align: right;
    direction: rtl;
}

/* سه بخش منو */
.triple-menu-section {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    border-left: 1px solid #eee;
    transition: all 0.3s ease;
    position: relative;
}

.triple-menu-section:first-child {
    border-left: none;
}

/* بخش اول: دسته‌های مادر */
.parent-categories-section {
    background: #f8f9fa;
    flex: 0 0 250px;
}

/* بخش دوم: دسته‌های فرزند */
.child-categories-section {
    background: #fff;
    flex: 0 0 300px;
    opacity: 0;
    transform: translateX(20px);
    visibility: hidden;
}

.child-categories-section.active {
    opacity: 1;
    transform: translateX(0);
    visibility: visible;
}

/* بخش سوم: محصولات */
.products-section {
    background: #fafafa;
    flex: 1;
    min-width: 400px;
    opacity: 0;
    transform: translateX(20px);
    visibility: hidden;
}

.products-section.active {
    opacity: 1;
    transform: translateX(0);
    visibility: visible;
}

/* ============================================
   استایل دسته‌های مادر (بخش اول)
   ============================================ */

.parent-category {
    margin-bottom: 10px;
    position: relative;
}

.parent-category>a {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.parent-category>a:hover,
.parent-category.active>a {
    border-color: #007cba;
    background: #f0f7ff;
    transform: translateX(-5px);
}

.parent-category>a::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #007cba;
    opacity: 0;
    transition: opacity 0.3s;
}

.parent-category.active>a::before {
    opacity: 1;
}

/* آیکون دسته */
.menu-icon {
    margin-left: 12px;
    font-size: 18px;
    color: #666;
    width: 24px;
    text-align: center;
}

.parent-category.active .menu-icon {
    color: #007cba;
}

/* تصویر دسته */
.category-image {
    margin-left: 12px;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.category-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* عنوان دسته */
.menu-title {
    flex: 1;
    font-weight: 600;
    font-size: 15px;
}

.parent-category.active .menu-title {
    color: #007cba;
    font-weight: 700;
}

/* تعداد محصولات */
.product-count {
    background: #e9ecef;
    color: #666;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-right: 8px;
}

.parent-category.active .product-count {
    background: #007cba;
    color: #fff;
}

/* فلش */
.menu-arrow {
    margin-right: 5px;
    transition: transform 0.3s;
}

.parent-category.active .menu-arrow {
    transform: rotate(-90deg);
}

.menu-arrow i {
    font-size: 12px;
    color: #999;
}

/* ============================================
   استایل دسته‌های فرزند (بخش دوم)
   ============================================ */

.child-category {
    margin-bottom: 8px;
}

.child-category>a {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 6px;
    text-decoration: none;
    color: #555;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.child-category>a:hover,
.child-category.active>a {
    background: #fff;
    border-color: #007cba;
    color: #007cba;
    transform: translateX(-3px);
    box-shadow: 0 3px 10px rgba(0, 124, 186, 0.1);
}

/* تصویر دسته فرزند */
.child-category .category-image {
    width: 35px;
    height: 35px;
}

/* عنوان دسته فرزند */
.child-category .menu-title {
    font-size: 14px;
    font-weight: 500;
}

/* تعداد محصولات دسته فرزند */
.child-category .product-count {
    font-size: 11px;
    padding: 1px 6px;
}

/* ============================================
   استایل محصولات (بخش سوم)
   ============================================ */

.category-products-container {
    animation: fadeIn 0.4s ease;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.product-item-preview {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border: 1px solid #eee;
}

.product-item-preview:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-color: #007cba;
}

.product-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.product-image {
    height: 140px;
    overflow: hidden;
    position: relative;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.product-item-preview:hover .product-image img {
    transform: scale(1.05);
}

.product-info {
    padding: 12px;
}

.product-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    line-height: 1.4;
    height: 36px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-price {
    font-size: 14px;
    font-weight: 700;
    color: #007cba;
    margin-bottom: 5px;
}

.product-price del {
    color: #999;
    font-size: 12px;
    font-weight: normal;
    margin-left: 5px;
}

.product-rating {
    font-size: 12px;
    color: #ffc107;
}

/* دکمه مشاهده همه */
.view-all-products {
    text-align: center;
    padding-top: 15px;
    border-top: 1px solid #eee;
    margin-top: 15px;
}

.view-all-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background: #007cba;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.view-all-btn:hover {
    background: #005a87;
    transform: translateX(-5px);
}

.view-all-btn i {
    margin-right: 8px;
    font-size: 12px;
}

/* ============================================
   عنوان بخش‌ها
   ============================================ */

.section-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin: 0;
    display: flex;
    align-items: center;
}

.section-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 20px;
    background: #007cba;
    margin-left: 10px;
    border-radius: 2px;
}

/* ============================================
   انیمیشن‌ها
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.child-categories-section.active {
    animation: slideInRight 0.3s ease;
}

.products-section.active {
    animation: slideInRight 0.4s ease 0.1s both;
}

/* ============================================
   واکنش‌گرایی
   ============================================ */

@media (max-width: 1200px) {
    .triple-mega-menu-wrapper {
        flex-direction: column;
        height: auto;
        max-height: 70vh;
    }

    .triple-menu-section {
        flex: none;
        width: 100%;
        border-left: none;
        border-bottom: 1px solid #eee;
    }

    .parent-categories-section {
        flex: none;
        max-height: 200px;
        overflow-y: auto;
    }

    .child-categories-section,
    .products-section {
        opacity: 1;
        transform: none;
        visibility: visible;
        display: none;
    }

    .child-categories-section.active,
    .products-section.active {
        display: block;
        animation: fadeIn 0.3s ease;
    }

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

@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .triple-mega-menu-wrapper {
        border-radius: 0;
        box-shadow: none;
    }
}

/* ============================================
   استایل برای حالت بارگذاری
   ============================================ */

.loading-products {
    text-align: center;
    padding: 30px;
}

.loading-products .spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ============================================
   نوتیفیکیشن و پیام
   ============================================ */

.no-products-message {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.no-products-message i {
    font-size: 40px;
    color: #ddd;
    margin-bottom: 15px;
    display: block;
}

.no-products-message h4 {
    color: #999;
    font-size: 16px;
}