/* =====================================================
   مگامنو – سایت (فقط دسکتاپ، فقط منوی دسته‌بندی هدر)
   ===================================================== */
/* آیتم مگا باید مرجع موقعیت نباشد تا پنل تمام‌عرض هدر باشد.
   انیمیشن ورود هدر روی li یک transform باقی می‌گذارد که مرجع موقعیت می‌سازد؛ برای آیتم مگا بدون transform اجرا می‌شود. */
.header-center .category-menu > li.has-mega { position: static; animation-name: sgMmItemIn; }
@keyframes sgMmItemIn { from { opacity: 0; } to { opacity: 1; } }
.header-center .category-menu > li.has-mega::after { display: none; }
.header-center .category-menu > li.mega-hide-native > .sub-menu { display: none !important; }

/* خنثی کردن استایل زیرمنوی کشویی هدر برای منوهای داخل پنل */
.header-center .category-menu .sg-mega .sub-menu {
    position: static; min-width: 0; margin: 0; padding: 0 12px 0 0; border: 0; border-radius: 0;
    background: none; box-shadow: none; opacity: 1; visibility: visible; transform: none; transition: none;
}
.header-center .category-menu .sg-mega .sub-menu::before { display: none; }
.header-center .category-menu .sg-mega .sub-menu li { opacity: 1; transform: none; }
.header-center .category-menu .sg-mega .sub-menu li a { display: block; padding: 5px 0; border-radius: 0; background: none; font-size: 12.5px; white-space: normal; color: var(--sg-muted, #5a5a61); }
.header-center .category-menu .sg-mega .sub-menu li a:hover { padding-right: 4px; background: none; color: var(--sg-primary, #70212a); }

.sg-mega {
    --mm-p: var(--sg-primary, #70212a);
    --mm-g: var(--sg-gold, #d4b178);
    --mm-t: var(--sg-text, #161618);
    --mm-m: var(--sg-muted, #5a5a61);
    --mm-e: cubic-bezier(.22, 1, .36, 1);
    position: absolute;
    top: 100%;
    left: 50%;
    z-index: var(--mm-z, 60);
    width: min(calc(100% - 40px), var(--mm-maxw, 1200px));
    box-sizing: border-box;
    padding: var(--mm-pad, 28px);
    border: var(--mm-bw, 1px) solid var(--mm-bd, rgba(22, 22, 24, .08));
    border-top: 0;
    border-radius: 0 0 var(--mm-r, 22px) var(--mm-r, 22px);
    background: var(--mm-bg, #fff);
    color: var(--mm-t);
    text-align: right;
    direction: rtl;
    translate: -50% 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .28s ease, transform .45s var(--mm-e), visibility .28s;
}
/* پل هاور بین لینک و پنل */
.sg-mega::before { content: ""; position: absolute; right: 0; left: 0; bottom: 100%; height: 22px; }
/* خط طلایی بالای پنل */
.sg-mega::after { content: ""; position: absolute; top: 0; right: var(--mm-r, 22px); left: var(--mm-r, 22px); height: 1px; background: linear-gradient(90deg, transparent, var(--mm-g), transparent); opacity: .7; }

.sg-mega[data-align="full"] { left: 0; right: 0; width: auto; translate: none; border-radius: 0 0 var(--mm-r) var(--mm-r); border-inline: 0; }
.sg-mega[data-align="full"] > .sg-mega__grid { max-width: var(--mm-maxw, 1200px); margin: 0 auto; }
.sg-mega[data-align="center"] { width: min(calc(100% - 40px), var(--mm-w, 900px), var(--mm-maxw, 1200px)); }
.sg-mega[data-align="item"] { left: var(--mm-x, 50%); width: min(calc(100% - 32px), var(--mm-w, 560px)); translate: none; border-radius: var(--mm-r); border-top: var(--mm-bw) solid var(--mm-bd); margin-top: 8px; }
.sg-mega[data-align="item"]::before { height: 30px; }

.sg-mega[data-shadow="soft"] { box-shadow: 0 30px 60px -34px rgba(22, 22, 24, .28); }
.sg-mega[data-shadow="strong"] { box-shadow: 0 34px 70px -26px rgba(22, 22, 24, .45); }

/* انیمیشن‌ها */
.sg-mega[data-anim="slide"] { transform: translateY(10px); }
.sg-mega[data-anim="scale"] { transform: scale(.97); transform-origin: top center; }
.sg-mega[data-anim="none"] { transition: none; }

/* حالت باز */
.has-mega.is-open > .sg-mega,
html:not(.sg-mega-js) .has-mega:hover > .sg-mega,
html:not(.sg-mega-js) .has-mega:focus-within > .sg-mega {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
}
.header-center .category-menu > li.has-mega.is-open > a { color: var(--sg-primary, #70212a); }
.header-center .category-menu > li.has-mega.is-open > a::after { transform: scaleX(1); }
.header-center .category-menu > li.has-mega.is-open > a::before { transform: rotate(135deg); margin-top: 3px; }

/* تیره شدن صفحه */
.sg-mega-overlay {
    position: fixed; inset: 0; top: var(--sg-header-h, 110px); z-index: 999;
    background: rgba(22, 22, 24, .28);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility .3s;
}
.sg-mega-overlay.is-on { opacity: 1; visibility: visible; }

/* =====================================================
   ستون‌ها و بلوک‌ها
   ===================================================== */
.sg-mega__grid { display: grid; grid-template-columns: var(--mm-cols, 1fr); gap: var(--mm-gap, 28px); align-items: start; }
.sg-mega__col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.sg-mega__col > * { margin: 0; animation: sgMmIn .45s var(--mm-e) both; }
.has-mega:not(.is-open) .sg-mega__col > * { animation: none; }
.sg-mega__col:nth-child(2) > * { animation-delay: .04s; } .sg-mega__col:nth-child(3) > * { animation-delay: .08s; } .sg-mega__col:nth-child(4) > * { animation-delay: .12s; } .sg-mega__col:nth-child(5) > * { animation-delay: .16s; }
@keyframes sgMmIn { from { opacity: 0; transform: translateY(6px); } }

/* ستون‌های داخلی (چند ستون کنار هم داخل یک ستون اصلی) */
.sg-mega__columns { display: grid; grid-template-columns: var(--mm-sub-cols, 1fr); gap: var(--mm-sub-gap, 20px); align-items: start; }
.sg-mega__subcol { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.sg-mega__subcol > * { margin: 0; }

.sg-mega a { color: inherit; text-decoration: none; }
.sg-mega__icon { display: inline-grid; place-items: center; flex-shrink: 0; color: var(--mm-p); }
.sg-mega__icon img { display: block; width: 100%; height: 100%; object-fit: contain; }
.sg-mega__icon.dashicons { width: 20px; height: 20px; font-size: 20px; }

/* عنوان */
.sg-mega__heading { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 900; line-height: 1.6; color: var(--mm-t); padding-bottom: 8px; border-bottom: 1px solid rgba(22, 22, 24, .06); }
.sg-mega__heading > a, .sg-mega__heading > span { display: inline-flex; align-items: center; gap: 8px; }
.sg-mega__heading .sg-mega__icon { width: 18px; height: 18px; }
.sg-mega__heading a:hover { color: var(--mm-p); }

/* متن */
.sg-mega__text { font-size: 13px; line-height: 2; color: var(--mm-m); }
.sg-mega__text p { margin: 0 0 .5em; }
.sg-mega__text a { color: var(--mm-p); font-weight: 700; }

/* منوی وردپرس */
.sg-mega__menu ul { margin: 0; padding: 0; list-style: none; }
.sg-mega__menu-list > li > a { display: flex; align-items: center; gap: 8px; padding: 7px 0; font-size: 13.5px; font-weight: 600; color: var(--mm-t); transition: color .25s ease, padding .35s var(--mm-e); }
.sg-mega__menu-list > li > a:hover { color: var(--mm-p); padding-right: 6px; }
.sg-mega__menu-list .sub-menu { padding-right: 12px; }
.sg-mega__menu-list .sub-menu a { display: block; padding: 5px 0; font-size: 12.5px; color: var(--mm-m); }
.sg-mega__menu-list .sub-menu a:hover { color: var(--mm-p); }
.sg-mega__menu .menu-item-icon-img img { width: 18px; height: 18px; }

/* لینک */
.sg-mega__link { display: flex; align-items: center; gap: 10px; }
.sg-mega__link .sg-mega__icon { width: 36px; height: 36px; padding: 7px; box-sizing: border-box; border-radius: 12px; background: rgba(112, 33, 42, .07); transition: background-color .3s ease, color .3s ease; }
.sg-mega__link-text { display: flex; flex-direction: column; min-width: 0; }
.sg-mega__link-text b { font-size: 13.5px; font-weight: 800; transition: color .25s ease; }
.sg-mega__link-text small { font-size: 11.5px; line-height: 1.8; color: var(--mm-m); }
a.sg-mega__link:hover b { color: var(--mm-p); }
a.sg-mega__link:hover .sg-mega__icon { color: #fff; background: var(--mm-p); }
.sg-mega__link.is-card { padding: 12px; border-radius: 16px; border: 1px solid rgba(22, 22, 24, .07); transition: border-color .3s ease, transform .4s var(--mm-e); }
a.sg-mega__link.is-card:hover { border-color: rgba(112, 33, 42, .25); transform: translateY(-2px); }
.sg-mega__link.is-button { justify-content: center; height: 44px; padding: 0 18px; border-radius: 12px; color: #fff; background: var(--mm-p); }
.sg-mega__link.is-button b { color: #fff !important; }
.sg-mega__link.is-button .sg-mega__icon { width: auto; height: auto; padding: 0; background: none !important; color: #fff; }

/* تصویر */
.sg-mega__image { position: relative; }
.sg-mega__img-link { position: relative; display: block; border-radius: var(--mm-img-r, 16px); overflow: hidden; isolation: isolate; }
.sg-mega__img-frame { display: block; width: var(--mm-img-w, 100%); height: var(--mm-img-h, auto); aspect-ratio: auto; overflow: hidden; border-radius: var(--mm-img-r, 16px); background: #f7eeee; }
.sg-mega__img-frame img { display: block; width: 100%; height: 100%; min-height: 100%; object-fit: var(--mm-img-fit, cover); transition: transform .9s var(--mm-e), filter .4s ease; }
.sg-mega__image.hover-zoom a:hover img { transform: scale(1.06); }
.sg-mega__image.hover-lift .sg-mega__img-link { transition: transform .45s var(--mm-e), box-shadow .45s var(--mm-e); }
.sg-mega__image.hover-lift a:hover { transform: translateY(-3px); box-shadow: 0 18px 30px -20px rgba(22, 22, 24, .5); }
.sg-mega__image.hover-dim a:hover img { filter: brightness(.82); }
.sg-mega__image.has-overlay .sg-mega__img-link::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(22, 22, 24, .6), transparent 60%); pointer-events: none; }
.sg-mega__image.cap-overlay figcaption { position: absolute; right: 14px; left: 14px; bottom: 12px; z-index: 1; font-size: 14px; font-weight: 800; color: #fff; text-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
.sg-mega__image.cap-below figcaption { margin-top: 8px; font-size: 13px; font-weight: 700; }

/* لیست */
.sg-mega__list-title { margin: 0 0 8px; font-size: 12px; font-weight: 800; color: var(--mm-m); }
.sg-mega__list ul { display: grid; grid-template-columns: repeat(var(--mm-list-cols, 1), minmax(0, 1fr)); gap: 4px 16px; margin: 0; padding: 0; list-style: none; }
.sg-mega__list li > a, .sg-mega__list li > span { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; }
.sg-mega__li-text { display: flex; flex-direction: column; min-width: 0; }
.sg-mega__li-text b { font-weight: 600; transition: color .25s ease; }
.sg-mega__li-text small { font-size: 11.5px; color: var(--mm-m); line-height: 1.8; }
.sg-mega__list li > a:hover b { color: var(--mm-p); }
.sg-mega__list.is-plain li > a::before { content: ""; width: 5px; height: 5px; flex-shrink: 0; background: var(--mm-g); transform: rotate(45deg); transition: background-color .25s ease; }
.sg-mega__list.is-plain li > a:hover::before { background: var(--mm-p); }
.sg-mega__list.is-icon .sg-mega__icon { width: 18px; height: 18px; }
.sg-mega__thumb { flex-shrink: 0; width: 44px; height: 44px; border-radius: 12px; overflow: hidden; background: #f7eeee; }
.sg-mega__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sg-mega__list.is-desc li > a { align-items: flex-start; padding: 8px 0; }
.sg-mega__list.is-desc b { font-weight: 800; }

/* جداکننده */
.sg-mega__divider { width: 100%; height: 0; margin: var(--mm-hr-space, 8px) 0 !important; border: 0; border-top: 1px solid rgba(22, 22, 24, .08); }
.sg-mega__divider.is-dashed { border-top-style: dashed; }
.sg-mega__divider.is-gold { border: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--mm-g), transparent); }

.sg-mega__html { font-size: 13px; line-height: 2; }

.sg-mega a:focus-visible { outline: 2px solid var(--mm-p); outline-offset: 3px; border-radius: 8px; }

@media (max-width: 768px) {
    .sg-mega, .sg-mega-overlay { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
    .sg-mega, .sg-mega *, .sg-mega-overlay { animation: none !important; transition: none !important; }
}