/* پنل مستقل منوی موبایل؛ dialog بسته به‌صورت پیش‌فرض مخفی است. */
.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: min(360px, calc(100% - 36px));
    max-width: none;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    background: var(--white);
    color: var(--text-black);
    font-family: var(--bs-font-sans-serif);
    direction: rtl;
    text-align: right;
    box-shadow: -12px 0 36px rgba(0, 0, 0, 0.12);
}

.mobile-menu[open] {
    display: flex;
    flex-direction: column;
    animation: mobile-menu-enter 180ms ease-out;
}

.mobile-menu::backdrop {
    background: rgba(0, 0, 0, 0.42);
}

.mobile-menu-heading {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 72px;
    padding: 12px 20px;
    padding-top: max(12px, env(safe-area-inset-top));
    border-bottom: 1px solid var(--border-color);
}

.mobile-menu-heading h2 {
    margin: 0;
    color: var(--text-black);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.8;
}

.mobile-menu-close {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-black);
    cursor: pointer;
}

.mobile-menu-close svg,
.mobile-menu-account svg {
    width: 23px;
    height: 23px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mobile-menu-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 24px 20px;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.mobile-menu-label {
    margin: 0 0 10px;
    color: var(--green-dark);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.9;
}

.mobile-menu-links {
    margin: 0;
    padding: 0;
    list-style: none;
}

.mobile-menu-links a,
.mobile-menu-links a:visited {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 10px 8px;
    border-radius: 5px;
    color: var(--text-black);
    font-size: 15px;
    line-height: 1.9;
    text-decoration: none;
}

.mobile-menu-links a:hover,
.mobile-menu-close:hover {
    background-color: var(--green-light);
    color: var(--green-dark);
}

.mobile-menu-account {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.mobile-menu a:focus-visible,
.mobile-menu button:focus-visible {
    outline: 2px solid var(--green-dark);
    outline-offset: 2px;
}

/* جلوگیری از حرکت صفحهٔ پشت منو، با حفظ موقعیت اسکرول */
html.mobile-menu-open {
    overflow: hidden;
}

html.mobile-menu-open body {
    position: fixed;
    top: var(--mobile-menu-scroll-top, 0px);
    right: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
}

@keyframes mobile-menu-enter {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
    .mobile-menu[open] {
        animation: none;
    }
}
