/* ===== دسکتاپ مگامنو - Hover Submenu ===== */

.kz-mega-body-lock {
    overflow: hidden;
}

.kz-desktop-mega-instance {
    position: relative;
    display: inline-block;
}

/* دکمه باز کردن منو */
.kz-desktop-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 42px;
    padding: 0 18px;
    border: 1px solid #dbe3ee;
    background: #FAFDFF;
    color: #1f2937;
    border-radius: 10px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    line-height: 1;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.kz-desktop-trigger:hover,
.kz-desktop-trigger[aria-expanded="true"] {
    border-color: #c7d2e1;
    background: #f8fbff;
    color: #0f172a;
}

.kz-desktop-trigger-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* overlay */
.kz-desktop-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: 9997;
}

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

/* باکس اصلی مگامنو */
.kz-desktop-mega {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: min(1120px, calc(100vw - 32px));
    height: min(78vh, 720px);
    background: #ffffff;
    border: 1px solid #e5eaf1;
    border-radius: 18px;
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.15);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
    z-index: 9998;
    overflow: hidden;
}

.kz-desktop-mega.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.kz-desktop-mega-inner {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 0;
    direction: rtl;
    height:100%;
}

/* ستون والدها */
.kz-mega-parents {
    background: #fbfcfe;
    border-left: 1px solid #eef2f7;
    padding: 18px 14px;
    overflow-y: auto;
    height:100%;
}

/* راست چین کردن اسکرول بار */
.kz-mega-parents {
    overflow-y: auto !important;
    direction: ltr !important;          /* اسکرول‌بار می‌آید سمت راست */
    scrollbar-gutter: stable !important;
    padding-right: 6px !important;
    scrollbar-width: thin;
}

.kz-mega-parent {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    text-align: right;
    border: 0;
    background: transparent;
    color: #334155;
    border-radius: 12px;
    padding: 14px 14px;
    margin: 0 0 6px;
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    transition: all 0.2s ease;
    flex-direction: row-reverse;
}

.kz-mega-parent:hover {
    background: #f1f6fb;
    color: #0f172a;
}

.kz-mega-parent.is-active {
    background: #eef6ff;
    color: #0b63c9;
}

.kz-mega-parent-text {
    flex: 1;
    min-width: 0;
    line-height: 1.8;
    text-align: right;
    direction: rtl;
}

/* ۱. اصلاح جهت فلش در حالت عادی (رو به چپ) */
.kz-mega-parent-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    transition: transform 0.2s ease, color 0.2s ease;
    /* فلش را ۱۸۰ درجه می‌چرخانیم تا نوکش به سمت چپ (داخل منو) باشد */
    transform: rotate(180deg); 
}

/* ۲. اصلاح حرکت در حالت هوور و فعال */
.kz-mega-parent.is-active .kz-mega-parent-icon,
.kz-mega-parent:hover .kz-mega-parent-icon {
    color: #0b63c9;
    /* چون چرخش ۱۸۰ درجه دادیم، translateX مثبت یعنی حرکت به سمت چپ */
    transform: rotate(180deg) translateX(4px); 
}

/* ۳. برای اطمینان از اینکه متن و آیکون درست می‌ایستند */
.kz-mega-parent {
    direction: rtl !important; /* محتوای داخل ردیف باید RTL باشد */
    flex-direction: row !important; /* چون RTL شد، متن راست و آیکون خودکار چپ می‌افتد */
    justify-content: space-between;
}

/* پنل‌ها */
.kz-mega-panels{
    padding: 20px;
    height:100%;
    overflow:hidden;
    display:flex;
    flex-direction:column;
}

.kz-mega-panel{
    height:100%;
    display:none;
    flex-direction:column;
}

.kz-mega-panel.is-active{
    display:flex;
}

@keyframes kzFadePanel {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kz-mega-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eef2f7;
}

.kz-mega-panel-title {
    margin: 0 0 4px;
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.5;
}

.kz-mega-panel-desc {
    margin: 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1.8;
}

/* --- دکمه مشاهده همه --- */
.kz-mega-view-all,
.kz-mega-empty-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-decoration: none;
    background: #f1f2f4; /* خاکستری بسیار ملایم شبیه دیجی‌کالا */
    color: #222222; /* رنگ آبی فیروزه‌ای برند یا رنگ دلخواه شما */
    border-radius: 100px; /* کاملاً گرد */
    padding: 16px 14px;
    font-size: 11.5px;
    font-weight: 700;
    transition: all 0.3s ease;
    white-space: nowrap;
    border: none;
    line-height: 1; /* اصلاح تراز عمودی متن */
}

/* اصلاح جهت و تراز فلش */
.kz-mega-view-all::after,
.kz-mega-empty-link::after {
    content: ""; /* استفاده از SVG یا کد یونیکد اصلاح شده */
    display: inline-block;
    width: 6px;
    height: 6px;
    border-top: 1.5px solid currentColor;
    border-left: 1.5px solid currentColor;
    transform: rotate(-45deg); /* ساخت فلش به سمت چپ در RTL */
    margin-right: 4px;
    margin-top: 1px; /* اصلاح دستی تراز عمودی برای وسط‌چینی دقیق */
    transition: transform 0.3s ease;
}

/* حالت هاور مدرن و ملایم (بدون رنگ تند) */
.kz-mega-view-all:hover,
.kz-mega-empty-link:hover {
    background: #e2e5e9; /* فقط کمی تیره‌تر شدن پس‌زمینه */
    color: #008294; /* کمی تیره‌تر شدن متن */
}

/* انیمیشن فلش در هاور */
.kz-mega-view-all:hover::after,
.kz-mega-empty-link:hover::after {
    transform: rotate(-45deg) translate(2px, 2px); /* حرکت ریز به سمت چپ */
}


/* گرید زیرمجموعه‌ها */
.kz-mega-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    overflow-y:auto;
    padding:10px;
}

.kz-mega-grid{
    overflow-y:auto;
    padding-left:4px;
}

.kz-mega-child-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 50px;
    padding: 18px 0px;
    text-decoration: none;
    background: #ffffff;
    border: 1px solid #edf2f7;
    border-radius: 14px;
    transition: all 0.22s ease;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
}

.kz-mega-child-card:hover {
    transform: translateY(-3px);
    border-color: #d7e6f8;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.kz-mega-img-wrapper {
    width: 60px;
    height: 60px;
    border-radius: 0px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    overflow: hidden;
}

.kz-mega-img-wrapper.is-empty {
    color: #cbd5e1;
}

.kz-mega-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.25s ease;
}

/* انیمیشن عکس ها */
/*.kz-mega-child-card:hover .kz-mega-img-wrapper img {
    transform: scale(1.06);
}*/

.kz-mega-child-title {
    display: block;
    width: 100%;
    text-align: center;
    color: #1f2937;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.9;
}

/* وقتی زیرمجموعه ندارد */
.kz-mega-empty-state {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-height: 260px;
    border: 1px dashed #dbe3ee;
    border-radius: 16px;
    background: #fbfdff;
    padding: 28px;
}

.kz-mega-empty-state p {
    margin: 0 0 16px;
    font-size: 14px;
    color: #475569;
    line-height: 1.9;
}

.kz-mega-error {
    padding: 12px 16px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
    border-radius: 10px;
    font-size: 14px;
}

/* واکنش‌گرا */
@media (max-width: 1200px) {
    .kz-desktop-mega {
        width: min(1000px, calc(100vw - 24px));
    }

    .kz-mega-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1024px) {
    .kz-desktop-mega-instance {
        display: none !important;
    }
}
