/*----------------------------------------
  HESARMILAN MENU STYLE (RTL + Vazirmatn)
  Cleaned and Compact Edition
----------------------------------------*/

/* 1. Font: Vazirmatn (local load) */
@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/Vazirmatn-Regular.woff2') format('woff2'),
         url('fonts/Vazirmatn-Regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/Vazirmatn-Bold.woff2') format('woff2'),
         url('fonts/Vazirmatn-Bold.woff') format('woff');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* 2. Global setup */
html, body {
    font-family: 'Vazirmatn', Tahoma, sans-serif !important;
    direction: rtl;
}

:root {
    --hm-bg: rgba(255, 255, 255, 0.95);
    --hm-bg-hover: rgba(216, 180, 0, 0.08);
    --hm-shadow: 0 6px 20px rgba(0, 0, 0, 0.10);
    --hm-radius: 10px;
    --hm-color: #2e2e2e;
    --hm-color-hover: #356b3d;
    --hm-color-active: #d4af37;
}

/* 3. Top-level menu */
#ast-hf-menu-1 > li > a {
    padding: 8px 12px !important;
    font-size: 14px !important;
    font-weight: 500;
    line-height: 1.2;
    color: var(--hm-color);
    text-align: right;
    transition: color .2s ease;
    display: inline-block; 
    width: auto !important; /* Make sure width auto adjusts to content */
    box-sizing: border-box; /* Include padding and border in the width calculation */
}

/* Hover effect for top-level menu */
#ast-hf-menu-1 > li:hover > a {
    color: var(--hm-color-hover);
}

/* Active state for current or ancestor items */
#ast-hf-menu-1 > li.current-menu-item > a,
#ast-hf-menu-1 > li.current-menu-ancestor > a {
    color: var(--hm-color-active);
    font-weight: 600;
}

/* 4. Submenu box (small, neat) */
#ast-hf-menu-1 .sub-menu {
    background: var(--hm-bg);
    border-radius: var(--hm-radius);
    box-shadow: var(--hm-shadow);
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 2px 0 !important;
    width: auto !important; /* Make sure width auto adjusts to content */
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: all .25s ease;
    z-index: 9999;
}

#ast-hf-menu-1 li:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 5. Submenu items (tight spacing) */
#ast-hf-menu-1 .sub-menu li a {
    display: block;
    padding: 2px 10px !important;
    font-size: 15px !important;
    line-height: 1.2;
    color: var(--hm-color);
    text-align: right;
    transition: all .18s ease;
    white-space: nowrap;
}

/* Hover effect for submenu items */
#ast-hf-menu-1 .sub-menu li a:hover {
    background: var(--hm-bg-hover);
    color: var(--hm-color-hover);
    transform: translateX(-2px);
}

/* 6. Sub-submenu (flyout right for RTL) */
#ast-hf-menu-1 .sub-menu .sub-menu {
    top: 0;
    right: 100%; /* Position submenu to the right for RTL */
    left: auto;
    margin-right: 4px;
    background: var(--hm-bg);
    border-radius: var(--hm-radius);
    box-shadow: var(--hm-shadow);
    border: 1px solid rgba(0, 0, 0, 0.05);
    width: auto !important; /* Auto width for sub-submenus */
    opacity: 0;
    visibility: hidden;
    transform: translateX(6px);
    transition: all .22s ease;
}

#ast-hf-menu-1 .sub-menu li:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* 7. Remove bullets/arrows */
#ast-hf-menu-1 .sub-menu,
#ast-hf-menu-1 .sub-menu li {
    list-style: none !important;
}

#ast-hf-menu-1 .menu-item-has-children > a .ast-icon {
    display: none !important;
}

/* 8. Mobile fix */
@media (max-width: 921px) {
    #ast-hf-menu-1 .sub-menu li a {
        padding: 8px 12px !important;
        font-size: 15px !important;
    }
}

/* 9. Ensure header layer above hero */
.ast-primary-header-bar, .site-header {
    position: relative;
    z-index: 1000;
}
/* --- هدر دسکتاپ: منو + سوییچر زبان --- */
@media (min-width: 922px) {

    /* منوی اصلی همیشه در یک خط بماند و متن‌ها نشکنند */
    #ast-hf-menu-1 {
        display: flex;
        flex-wrap: nowrap;
    }

    #ast-hf-menu-1 > li {
        margin: 0 2px !important;
    }

    #ast-hf-menu-1 > li > a {
        padding: 7px 7px !important;
        font-size: 17px !important;   /* اگر خیلی تنگ شد، بکن 13.5px */
        font-weight: 500;
        white-space: nowrap;          /* نذار «بازدید و تماس» نصفه بشکنه */
    }

    #ast-hf-menu-1 > li:last-child > a {
        padding-left: 4px !important;
        padding-right: 4px !important;
    }

    /* سوییچر زبان در هدر */
    .fake-lang {
        margin-left: 20px;      /* فاصله از منو، اگر زیاد بود بکن 10-15px */
        display: flex;
        align-items: center;
        gap: 8px;
        white-space: nowrap;
        font-size: 16px;
        font-weight: 800;
    }

    .fake-lang span {
        display: inline-block;
        padding: 0 3px;
        cursor: pointer;
    }

    .fake-lang span:hover {
        color: #356b3d;
    }

    .fake-lang .active {
        color: #d4af37;
        font-weight: 600;
    }
}
/* روان‌تر شدن هاور منو و جلوگیری از گم شدن فوکوس */
@media (min-width: 922px) {

    /* افزایش ناحیه قابل انتخاب بدون زیاد شدن عرض منو */
    #ast-hf-menu-1 > li > a {
        line-height: 2.2em !important;
    }

    /* جلوگیری از از بین رفتن هاور هنگام حرکت بین آیتم‌ها */
    #ast-hf-menu-1 > li {
        padding: 2px 0 !important;
    }
}
