/* ============================================
   مگامنو دسته‌بندی‌های محصولات - بر اساس مگامنوی قدیمی لاله زار آنلاین
   ============================================ */

/* تعریف متغیرهای رنگی */
:root {
    --color-navy-dark: #003871;
    --color-navy-mid: #003871;
    --color-white: #FFFFFF;
    --color-accent-blue: #6f82a7;
    --color-light-gray: #D0D0D0;
    --color-border-light: #F2F2F2;
    --color-text-dark: #333333;
    --color-text-light: #666666;
    --menu-transition: 0.3s ease;
}

/* نوار منو اصلی - حذف شده تا از تداخل جلوگیری شود */
/* .navbar-primary {
    background: var(--color-white);
    border-bottom: 1px solid var(--color-border-light);
    padding: 0;
    position: relative;
    z-index: 1000;
} */

/* حذف شده تا از تداخل جلوگیری شود */
/* .navbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 60px;
}

.navbar-left {
    flex: 1;
}

.navbar-right {
    display: flex;
    align-items: center;
} */

/* دکمه منو - حذف شده تا از تداخل جلوگیری شود */
/* .menu-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--color-navy-dark);
    color: var(--color-white);
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--menu-transition);
    font-family: "Vazirmatn", "Tahoma", "Arial", sans-serif;
}

.menu-toggle-btn:hover {
    background: var(--color-accent-blue);
    transform: translateY(-1px);
}

.icon-menu {
    width: 20px;
    height: 20px;
} */

/* پس‌زمینه تار */
.mega-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all var(--menu-transition);
    pointer-events: none;
}

.mega-menu-overlay.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* کانتینر اصلی مگامنو */
.mega-menu-wrapper {
    position: fixed;
    top: 46px;
    right: -100%; /* شروع از خارج صفحه (سمت راست) */
    width: auto; /* عرض خودکار */
    min-width: 900px; /* افزایش حداقل عرض */
    max-width: 100vw; /* حداکثر عرض صفحه */
    height: calc(100vh - 46px);
    background: var(--color-white);
    z-index: 9999;
    transition: right 0.3s ease, opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    display: flex;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    visibility: hidden;
    opacity: 0;
    transform: translateX(100%); /* شروع از سمت راست */
    pointer-events: none;
    /* اطمینان از مخفی بودن در حالت عادی */
    display: none !important;
}

.mega-menu-wrapper.open {
    right: 0; /* حرکت به سمت راست صفحه */
    visibility: visible;
    opacity: 1;
    transform: translateX(0); /* حرکت به موقعیت نهایی */
    pointer-events: auto;
    display: flex !important; /* نمایش فقط هنگام باز بودن */
    animation: slideInRight 0.3s ease; /* انیمیشن slide-in از سمت راست */
}

/* محتوای مگامنو - فقط سمت راست */
.mega-menu-content {
    width: 100%;
    background: var(--color-white);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
}

/* هدر مگامنو */
.mega-menu-header {
    padding: 20px;
    border-bottom: 1px solid var(--color-border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-navy-dark);
    color: var(--color-white);
}

.mega-menu-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

/* بدنه مگامنو - دو بخش: sidebar و panels */
.mega-menu-body {
    flex: 1;
    display: flex;
    height: 100%;
    overflow: hidden;
    position: relative;
}

/* ستون راست - منوی اصلی */
.mega-menu-sidebar {
    width: 300px;
    min-width: 300px;
    background: #f8f9fa;
    border-left: 1px solid var(--color-light-gray);
    overflow-y: auto;
    flex-shrink: 0;
}

.main-categories {
    list-style: none;
    margin: 0;
    padding: 0;
}

.category-item {
    border-bottom: 1px solid #e9ecef;
}

.category-item:last-child {
    border-bottom: none;
}

.category-item a {
    display: block;
    padding: 16px 20px;
    color: var(--color-text-dark);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--menu-transition);
    border-right: 3px solid transparent;
}

.category-item a:hover,
.category-item.active a {
    background: var(--color-white);
    color: var(--color-navy-dark);
    border-right-color: var(--color-accent-blue);
    padding-right: 25px;
}

/* ستون چپ - پنل زیرمنوها */
.mega-menu-panel {
    flex: 1;
    background: var(--color-white);
    overflow-y: auto;
    position: relative;
    display: none; /* مخفی در حالت عادی */
}

.mega-menu-panel.has-content {
    display: block; /* نمایش فقط وقتی محتوا دارد */
}

.submenu-content {
    padding: 20px;
    height: 100%;
}

.submenu-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--color-text-light);
}

.submenu-placeholder h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-dark);
}

.submenu-placeholder p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

/* پنل‌های محتوای مگامنو */
.mega-panel {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    right: 0;
    padding: 20px;
    background: var(--color-white);
    overflow-y: auto;
    display: none;
    opacity: 0;
    transform: translateX(-20px);
    transition: all var(--menu-transition);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    -webkit-overflow-scrolling: touch;
}

.mega-panel.visible {
    display: block;
    opacity: 1;
    transform: translateX(0);
}

/* هدر پنل مگامنو */
.mega-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--color-accent-blue);
}

.mega-panel-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--color-text-dark);
}

.mega-panel-link {
    color: var(--color-navy-dark);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    padding: 8px 16px;
    border: 1px solid var(--color-navy-dark);
    border-radius: 4px;
    transition: all var(--menu-transition);
}

.mega-panel-link:hover {
    background: var(--color-navy-dark);
    color: var(--color-white);
}

/* گرید محتوای پنل */
.mega-panel-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* پیش‌فرض ۲ ستون */
    gap: 35px;
    width: fit-content; /* عرض بر اساس محتوا */
    min-width: 500px; /* افزایش حداقل عرض برای ۲ ستون */
}

/* ۳ ستون */
.mega-panel-grid.three-columns {
    grid-template-columns: repeat(3, 1fr);
    min-width: 750px; /* افزایش حداقل عرض */
}

/* ۴ ستون */
.mega-panel-grid.four-columns {
    grid-template-columns: repeat(4, 1fr);
    min-width: 1000px; /* افزایش حداقل عرض */
}

/* تنظیمات responsive برای ستون‌ها */
@media (max-width: 1200px) {
    .mega-panel-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 25px;
    }
}

@media (max-width: 900px) {
    .mega-panel-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (max-width: 600px) {
    .mega-panel-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* ستون‌های دسته‌بندی */
.mega-column {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e9ecef;
}

.mega-column h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-navy-dark);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-accent-blue);
}

.mega-column ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mega-column li {
    margin-bottom: 8px;
}

.mega-column a {
    color: var(--color-text-light);
    text-decoration: none;
    font-size: 14px;
    display: block;
    padding: 6px 0;
    transition: all var(--menu-transition);
    border-radius: 4px;
}

.mega-column a:hover {
    color: var(--color-navy-dark);
    padding-right: 10px;
    background: rgba(0, 56, 113, 0.05);
}

/* دسته‌بندی اصلی */
.mega-category {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e9ecef;
}

.mega-category h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-navy-dark);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-accent-blue);
}

.mega-category ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mega-category li {
    margin-bottom: 8px;
}

.mega-category a {
    color: var(--color-text-light);
    text-decoration: none;
    font-size: 14px;
    display: block;
    padding: 6px 0;
    transition: all var(--menu-transition);
    border-radius: 4px;
}

.mega-category a:hover {
    color: var(--color-navy-dark);
    padding-right: 10px;
    background: rgba(0, 56, 113, 0.05);
}

/* زیردسته‌ها */
.mega-subcategory {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.mega-subcategory h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-dark);
}

.mega-subcategory ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mega-subcategory li {
    margin-bottom: 5px;
}

.mega-subcategory a {
    color: var(--color-text-light);
    text-decoration: none;
    font-size: 13px;
    display: block;
    padding: 4px 0;
    transition: all var(--menu-transition);
}

.mega-subcategory a:hover {
    color: var(--color-navy-dark);
    padding-right: 8px;
}

.close-icon {
    width: 24px;
    height: 24px;
    cursor: pointer;
    color: var(--color-white);
    transition: color var(--menu-transition);
    padding: 4px;
    border-radius: 4px;
}

.close-icon:hover {
    background: rgba(255, 255, 255, 0.2);
}

.close-icon:hover {
    color: var(--color-white);
}

/* نوار کناری مگامنو */
.mega-sidebar {
    width: 300px;
    min-width: 300px;
    background: #f8f9fa;
    border-left: 1px solid var(--color-light-gray);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

/* هدر نوار کناری */
.sidebar-header {
    padding: 15px 20px;
    background: var(--color-navy-dark);
    color: var(--color-white);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

/* فهرست منوی کناری */
.sidebar-menu {
    flex: 1;
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sidebar-menu .menu-item {
    border-bottom: 1px solid var(--color-border-light);
    position: relative;
}

.sidebar-menu .menu-item:last-child {
    border-bottom: none;
}

.sidebar-menu .menu-item > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    color: var(--color-text-dark);
    text-decoration: none;
    transition: all var(--menu-transition);
    font-size: 14px;
    font-weight: 500;
    background: transparent;
}

.sidebar-menu .menu-item:hover > a {
    background: rgba(0, 56, 113, 0.08);
    color: var(--color-navy-dark);
    padding-right: 25px;
}

.sidebar-menu .menu-item.active > a {
    background: var(--color-navy-dark);
    color: var(--color-white);
    box-shadow: inset -3px 0 0 var(--color-accent-blue);
}

/* فلش منو */
.menu-arrow {
    font-size: 36px; /* دو برابر شده از 18px */
    transition: transform var(--menu-transition);
    margin-right: 8px;
    display: inline-block;
    font-weight: bold;
}

.sidebar-menu .menu-item:hover .menu-arrow {
    color: var(--color-navy-dark);
}

.sidebar-menu .menu-item.active .menu-arrow {
    transform: rotate(90deg);
    color: var(--color-white);
}

/* فوتر نوار کناری */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--color-border-light);
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}

.help-link,
.login-link {
    color: var(--color-text-light);
    text-decoration: none;
    font-size: 13px;
    transition: color var(--menu-transition);
}

.help-link:hover,
.login-link:hover {
    color: var(--color-navy-dark);
}

/* پنل‌های محتوای مگامنو */
.mega-panel {
    position: absolute;
    right: 300px; /* فاصله از sidebar */
    top: 0;
    bottom: auto; /* حذف bottom: 0 */
    left: auto; /* حذف left: 0 */
    width: auto; /* عرض خودکار */
    min-width: 600px; /* افزایش حداقل عرض */
    max-width: calc(100vw - 300px); /* حداکثر عرض */
    height: auto; /* ارتفاع خودکار */
    min-height: 400px; /* حداقل ارتفاع */
    max-height: calc(100vh - 100px); /* حداکثر ارتفاع */
    padding: 45px 55px;
    background: var(--color-white);
    overflow-y: auto;
    display: none;
    opacity: 0;
    transform: translateX(20px);
    transition: all var(--menu-transition);
    -webkit-overflow-scrolling: touch;
}

.mega-panel.visible {
    display: block;
    opacity: 1;
    transform: translateX(0);
}

/* هدر پنل مگامنو */
.mega-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--color-accent-blue);
}

.mega-panel-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--color-text-dark);
}

.mega-panel-link {
    color: var(--color-navy-dark);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    padding: 8px 16px;
    border: 1px solid var(--color-navy-dark);
    border-radius: 4px;
    transition: all var(--menu-transition);
}

.mega-panel-link:hover {
    background: var(--color-navy-dark);
    color: var(--color-white);
}

/* گرید محتوای پنل */
.mega-panel-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* پیش‌فرض ۲ ستون */
    gap: 35px;
    width: fit-content; /* عرض بر اساس محتوا */
    min-width: 500px; /* افزایش حداقل عرض برای ۲ ستون */
}

/* ۳ ستون */
.mega-panel-grid.three-columns {
    grid-template-columns: repeat(3, 1fr);
    min-width: 750px; /* افزایش حداقل عرض */
}

/* ۴ ستون */
.mega-panel-grid.four-columns {
    grid-template-columns: repeat(4, 1fr);
    min-width: 1000px; /* افزایش حداقل عرض */
}

/* تنظیمات responsive برای ستون‌ها */
@media (max-width: 1200px) {
    .mega-panel-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 25px;
    }
}

@media (max-width: 900px) {
    .mega-panel-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (max-width: 600px) {
    .mega-panel-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* ستون‌های دسته‌بندی */
.mega-column {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e9ecef;
}

.mega-column h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-navy-dark);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-accent-blue);
}

.mega-column ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mega-column li {
    margin-bottom: 8px;
}

.mega-column a {
    color: var(--color-text-light);
    text-decoration: none;
    font-size: 14px;
    display: block;
    padding: 6px 0;
    transition: all var(--menu-transition);
    border-radius: 4px;
}

.mega-column a:hover {
    color: var(--color-navy-dark);
    padding-right: 10px;
    background: rgba(0, 56, 113, 0.05);
}

/* آیتم‌های فعال در sidebar */
.sidebar-menu .menu-item.current-menu-item > a,
.sidebar-menu .menu-item.current-menu-parent > a {
    background: var(--color-accent-blue);
    color: var(--color-white);
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mega-menu-wrapper {
        width: 100%;
        max-width: 100%;
        right: -100%; /* شروع از سمت راست در موبایل */
        transform: translateX(100%); /* انیمیشن از سمت راست */
    }
    
    .mega-menu-wrapper.open {
        right: 0; /* حرکت به سمت راست صفحه */
        transform: translateX(0); /* موقعیت نهایی */
        animation: slideInRight 0.3s ease; /* انیمیشن slide-in از سمت راست */
    }
    
    .mega-menu-sidebar {
        width: 100%;
        min-width: 100%;
    }
    
    .mega-menu-panel {
        left: 0;
        right: 0;
        top: 0;
        bottom: 0;
        position: absolute;
        z-index: 10000;
        min-width: 100%;
    }
    
    .mega-panel-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .mega-menu-header {
        padding: 15px;
    }
    
    .sidebar-menu .menu-item > a {
        padding: 12px 15px;
    }
}

/* تنظیمات اضافی برای نمایش بهتر */
@media (max-width: 1024px) {
    .mega-menu-wrapper {
        max-width: 80%;
        min-width: 600px;
    }
}

@media (max-width: 768px) {
    .mega-menu-wrapper {
        max-width: 100%;
        min-width: 100%;
    }
    
    .mega-sidebar {
        width: 100%;
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    .mega-menu-wrapper {
        max-width: 100%;
    }
    
    .mega-menu-sidebar {
        width: 100%;
    }
    
    .sidebar-header {
        padding: 10px;
    }
    
    .sidebar-menu .menu-item > a {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .sidebar-footer {
        padding: 15px;
    }
    
    .close-icon {
        width: 20px;
        height: 20px;
    }
    
    .mega-panel {
        padding: 20px;
    }
    
    .mega-panel-header h2 {
        font-size: 20px;
    }
    
    .mega-panel-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .mega-column {
        padding: 15px;
    }
    
    .mega-column h3 {
        font-size: 14px;
    }
    
    .mega-column a {
        font-size: 12px;
    }
}

/* انیمیشن‌های اضافی */
@keyframes slideInRight {
    from {
        right: -100%;
        transform: translateX(100%);
        opacity: 0;
        visibility: hidden;
    }
    to {
        right: 0;
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
    }
}

.mega-menu-wrapper.open {
    animation: slideInRight 0.3s ease;
}

/* حالت body هنگام باز بودن منو */
body.mega-menu-open {
    overflow: hidden;
}

/* گروه‌بندی دسته‌ها */
.category-group {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: none; /* حذف خط جداکننده */
}

.category-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.category-group h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 700;
    color: #1a365d; /* سرمه‌ای تیره مشابه تصویر */
    line-height: 1.3;
}

.category-group h3 a {
    color: inherit;
    text-decoration: none;
    transition: color var(--menu-transition);
}

.category-group h3 a:hover {
    color: #2c5282; /* سرمه‌ای روشن‌تر برای hover */
}

/* زیردسته‌ها */
.sub-categories {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sub-categories li {
    margin-bottom: 6px; /* کاهش فاصله */
    line-height: 1.4;
}

.sub-categories li:last-child {
    margin-bottom: 0;
}

.sub-categories a {
    color: #2d3748; /* مشکی/خاکستری تیره مشابه تصویر */
    text-decoration: none;
    font-size: 15px;
    font-weight: 400;
    transition: all var(--menu-transition);
    display: block;
    padding: 4px 0; /* کاهش padding */
    white-space: nowrap; /* جلوگیری از شکستن متن */
}

.sub-categories a:hover {
    color: #3182ce; /* آبی برای hover */
    padding-right: 10px;
    font-weight: 500;
}

/* آیتم‌های ساده (بدون زیرمنو) */
.simple-category {
    margin-bottom: 15px;
    padding: 0; /* حذف padding */
}

.simple-category a {
    color: #2d3748; /* مشکی/خاکستری تیره */
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all var(--menu-transition);
    display: block;
    white-space: nowrap; /* جلوگیری از شکستن متن */
    padding: 8px 0; /* padding ساده */
}

.simple-category a:hover {
    color: #3182ce; /* آبی برای hover */
    padding-right: 8px;
    font-weight: 600;
}

/* بهبود responsive برای گروه‌بندی */
@media (max-width: 768px) {
    .category-group {
        margin-bottom: 20px;
        padding-bottom: 10px;
    }
    
    .category-group h3 {
        font-size: 14px;
    }
    
    .sub-categories a {
        font-size: 13px;
    }
    
    .simple-category a {
        font-size: 13px;
    }
    
    .mega-panel {
        padding: 20px 25px;
    }
    
    .mega-panel-grid {
        gap: 20px;
    }
}