/* ============================================================
   mega-menu.css — مگامنو دسته‌بندی‌ها (فقط دسکتاپ)
   نسخه مدرن با سیستم border-radius یکپارچه
   ============================================================ */

/* ---------- تریگر ---------- */
.mega-menu-trigger {
    position: relative;
}

.mega-menu-trigger-link {
    cursor: pointer;
}

/* after فقط روی آیتم‌های navbar — نه trigger دسته‌بندی، نه parent category های داخل مگامنو */
.mega-menu-nav > ul > li:not(.mega-menu-trigger):hover a::after {
    border-top: 2px solid #6f7863;
}

.mega-menu-cats a::after {
    border-top: none !important;
    border-bottom: none !important;
}

/* ---------- پنل مگامنو ---------- */
.mega-menu-cats {
    position: fixed;
    top: 75px;
    right: 50%;
    left: auto;
    transform: translateX(50%) translateY(-12px);
    width: 100%;
    max-width: 960px;
    background: linear-gradient(to right, #cfd2c4, #b0b6a0);
    backdrop-filter: blur(16px);
    border-top: none !important;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    opacity: 0 !important;
    visibility: hidden !important;
    transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1) 0.08s,
                transform 0.28s cubic-bezier(0.4, 0, 0.2, 1) 0.08s,
                visibility 0.28s 0.08s;
    pointer-events: none !important;
    z-index: 1000;
    direction: rtl;
}

/* ===== وضعیت باز (با کلاس active) ===== */
.mega-menu-cats.active {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(50%) translateY(0);
    pointer-events: auto !important;
    transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.22s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.22s;
}

/* خنثی‌سازی قانون عمومی فلش */
header ul li.mega-menu-trigger:hover > a .fa-angle-down {
    transform: none;
}

/* پل نامرئی بین trigger و منو */
.mega-menu-trigger::after {
    content: '';
    position: fixed;
    top: 55px;
    left: 0;
    width: 100%;
    height: 25px;
    z-index: 999;
    display: none;
}

.mega-menu-cats-inner {
    width: 100%;
    margin: 0 auto;
    padding: 24px 28px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 20px;
    max-height: 65vh;
    overflow-y: auto;
}

ul.mega-menu-col-list {
    position: static !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: none !important;
    width: auto !important;
    background: none !important;
    backdrop-filter: none !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* ---------- هر ستون دسته اصلی ---------- */
.mega-menu-col {
    text-align: center;
}

.mega-menu-col-head {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    margin-bottom: 12px;
    padding-bottom: 12px;
    transition: opacity 0.2s ease;
    justify-content: center;
    border-bottom: 2px solid #6f7863;
}

.mega-menu-col-head:hover {
    opacity: 0.75;
}

.mega-menu-col-img {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    overflow: hidden;
    background: #f3f4f1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(83, 89, 69, 0.15);
}

.mega-menu-col-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mega-menu-col-img i {
    font-size: 1.4rem;
    color: #6f7863;
}

.mega-menu-col-title {
    font-size: 1rem;
    font-weight: 700;
    color: #535945;
}

.mega-menu-col-head.active .mega-menu-col-title {
    color: #6f7863;
    text-decoration: underline;
}

/* ---------- زیردسته‌ها ---------- */
.mega-menu-col-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mega-menu-col-list li a {
    display: block;
    font-size: 0.88rem;
    color: #535945;
    opacity: 0.85;
    text-decoration: none;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.mega-menu-col-list li a:hover {
    opacity: 1;
    background-color: #f3f4f1;
    color: #2a3923;
}

.mega-menu-col-list li a.active {
    opacity: 1;
    font-weight: 700;
    color: #6f7863;
}

/* ---------- اسکرول‌بار ---------- */
.mega-menu-cats-inner::-webkit-scrollbar {
    width: 8px;
}
.mega-menu-cats-inner::-webkit-scrollbar-thumb {
    background: #c1a88a;
    border-radius: var(--radius-sm);
}
.mega-menu-cats-inner::-webkit-scrollbar-track {
    background: #f3f4f1;
}

/* =====================================================
   منوی پروفایل
   ===================================================== */
.mega-menu-profile {
    position: relative;
}

.mega-menu-profile-dropdown {
    position: absolute;
    top: calc(100% + 20px);
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    width: 200px;
    background: linear-gradient(to bottom, #cfd2c4, #b0b6a0);
    backdrop-filter: blur(16px);
    border-top: 3px solid rgba(111, 120, 99, 0.12);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1) 0.08s,
                transform 0.28s cubic-bezier(0.4, 0, 0.2, 1) 0.08s,
                visibility 0.28s 0.08s;
    pointer-events: none;
    z-index: 1001;
    direction: rtl;
    text-align: right;
}

.mega-menu-profile:hover .mega-menu-profile-dropdown,
.mega-menu-profile-dropdown:hover {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
    transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.22s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.22s;
}

/* پل نامرئی پروفایل */
.mega-menu-profile::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 0;
    width: 100%;
    height: 20px;
    z-index: 1000;
}

/* فلش */
.mega-menu-profile .profile-arrow {
    display: inline-block;
    transition: transform 0.22s ease;
}

.mega-menu-profile:hover .profile-arrow {
    transform: rotate(180deg);
}

.mega-menu-profile-inner {
    padding: 12px 0;
    display: flex;
    flex-direction: column;
}

.mega-menu-profile-inner a,
.mega-menu-profile-inner button {
    display: block;
    width: 100%;
    padding: 9px 18px;
    font-size: 0.9rem;
    color: #535945;
    text-decoration: none;
    background: none;
    border: none;
    text-align: center;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
    border-radius: 0;
}

.mega-menu-profile-inner a:hover,
.mega-menu-profile-inner button:hover {
    background: rgba(243, 244, 241, 0.7);
    color: #2a3923;
}

.mega-menu-profile-inner hr {
    margin: 6px 14px;
    border-color: rgba(111, 120, 99, 0.2);
}

.mega-menu-profile-name {
    padding: 10px 18px 6px;
    font-size: 0.82rem;
    color: #6f7863;
    font-weight: 700;
    border-bottom: 1px solid rgba(111, 120, 99, 0.15);
    margin-bottom: 4px;
    text-align: center;
}

/* ---------- فقط دسکتاپ ---------- */
@media (max-width: 991.98px) {
    .mega-menu-cats,
    .mega-menu-profile-dropdown {
        display: none !important;
    }
}