﻿/* =========================
   منوی اصلی
========================= */
nav {
    height: 60px;
    background: #efefef;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 25px;
    direction: rtl;
    position: relative;
}

/* آیتم سطح اول */
.menu-item {
    position: relative;
}

    /* لینک‌های سطح اول */
    .menu-item > a {
        background: #ffffff;
        color: #333;
        padding: 8px 16px;
        border-radius: 8px;
        text-decoration: none;
        font-size: 14px;
        display: flex;
        align-items: center;
        gap: 6px;
    }

        /* Hover سطح اول (بدون حرکت) */
        .menu-item > a:hover {
            background: #e3f2fd; /* همان رنگ زیرمنو */
            color: #333; /* مثل زیرمنو */
        }

    /* فلش سطح اول */
    .menu-item.has-sub > a::after {
        content: "";
        width: 0;
        height: 0;
        border-left: 5px solid transparent;
        border-right: 5px solid transparent;
        border-top: 6px solid #333;
    }

    /* تغییر رنگ فلش هنگام Hover */
    .menu-item:hover > a::after {
        border-top-color: #ffffff;
    }

/* =========================
   زیرمنو سطح اول
========================= */
.submenu {
    position: absolute;
    top: 100%;
    right: 0;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    z-index: 1000;
    width: max-content; /* عرض بر اساس متن */
    white-space: nowrap; /* جلوگیری از شکستن خط */
}


/* نمایش زیرمنو سطح اول */
.menu-item:hover > .submenu {
    display: flex;
}

/* لینک‌های داخل زیرمنو */
.submenu a {
    padding: 12px;
    color: #333;
    text-decoration: none;
}

    /* Hover زیرمنو */
    .submenu a:hover {
        background: #e3f2fd;
    }

/* =========================
   زیرمنو سطح دوم
========================= */
.submenu-item {
    position: relative;
}

    /* لینک دارای زیرمنو */
    .submenu-item.has-sub > a {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

        /* فلش سطح دوم */
        .submenu-item.has-sub > a::after {
            content: "";
            width: 0;
            height: 0;
            border-top: 5px solid transparent;
            border-bottom: 5px solid transparent;
            border-right: 6px solid #333;
        }

    /* تغییر رنگ فلش هنگام Hover */
    .submenu-item:hover > a::after {
        border-right-color: #0056b3;
    }

/* موقعیت زیرمنو سطح دوم */
.submenu.level-2 {
    top: 0;
    right: 100%;
    display: none;
    width: max-content; /* پویا */
    white-space: nowrap;
}

/* نمایش سطح دوم */
.submenu-item:hover > .level-2 {
    display: flex;
}
