/* ============================================
   MenuSidebar.css - نسخه نهایی قطعی
   نسخه: v6.0 - حل مشکل MIUI
   ============================================ */

.MenuSidebar {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 0;                    /* ← مخفی با width صفر، نه با right منفی */
    max-width: 100vw;
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    overflow: hidden;            /* ← محتوا نباید بیرون بزند */
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.MenuSidebar.show {
    width: 280px;                /* ← باز شدن */
    max-width: 85vw;             /* ← روی موبایل کوچک، ۸۵٪ عرض */
}

.MenuSidebar .menu-content {
    width: 280px;                /* ← عرض ثابت داخلی */
    max-width: 85vw;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.15);
    padding-top: 0.5rem;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.25);
    -webkit-overflow-scrolling: touch;
}

.MenuSidebar.show .menu-content {
    background: rgba(255, 255, 255, 0.6);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.MenuSidebar .close-btn {
    position: absolute;          /* ← نسبت به منو، نه fixed */
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    padding: 0.4rem 0.7rem;
    color: #333;
    width: 2.75rem;
    height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: background 0.3s ease;
}

.MenuSidebar .close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.MenuSidebar ul {
    width: 100%;
    list-style: none;
    padding: 0;
    margin: 0;
    margin-top: 4.5rem;
}

.MenuSidebar li {
    width: 100%;
}

.MenuSidebar li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: #222;
    text-decoration: none;
    font-size: 1rem;
    transition: background 0.2s ease, padding 0.2s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.MenuSidebar li a:hover {
    background: rgba(74, 144, 226, 0.15);
    padding-right: 2rem;
}

/* ===== دکمه منو در نوار بالا ===== */
.TopIcons .menu-icon {
    cursor: pointer;
    font-size: 1.75rem;
    padding: 0.4rem 0.7rem;
    border: none;
    background: none;
    width: 2.75rem;
    height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, transform 0.3s ease;
}

.TopIcons .menu-icon:hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

/* ===== پس‌زمینه تیره ===== */
.MenuOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 998;
    display: none;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.MenuOverlay.show {
    display: block;
    opacity: 1;
}

/* ===== جلوگیری از پرش صفحه ===== */
body.menu-open {
    overflow: hidden;
}

/* ===== واکنش‌گرایی ===== */
@media (max-width: 480px) {
    .MenuSidebar.show {
        width: 85vw;
    }
    .MenuSidebar .menu-content {
        width: 85vw;
    }
}

/* ===== کاهش انیمیشن ===== */
@media (prefers-reduced-motion: reduce) {
    .MenuSidebar,
    .MenuOverlay,
    .MenuSidebar li a,
    .TopIcons .menu-icon {
        transition: none;
    }
}