/* ========================================================================
   🎨 سیستم رنگی (Design System)
   ======================================================================== */
.mb-n1 {
    margin-bottom: -0.25rem;
}

.mb-n2 {
    margin-bottom: -0.5rem;
}

:root {
    --c-purple: #7B61FF;
    --c-blue: #45B3FF;
    --c-orange: #FF8A00;
    --c-yellow: #FFC700;
    --c-green: #00D287;
    --c-coral: #FF6B6B;
    --c-gray: #F4F6F8;
    --c-silver: #A3C1DA;
    --c-bronze: #D98C5A;
}

.mb-n1 {
    margin-bottom: -0.25rem;
}

.mb-n2 {
    margin-bottom: -0.5rem;
}

/* 🌟 استایل جادویی مدال‌های روی هم افتاده 🌟 */
.badges-stack {
    display: flex;
    flex-direction: row-reverse; /* برای اینکه از راست به چپ روی هم بیفتند */
    align-items: center;
    padding: 10px 0;
}

.stacked-badge {
    width: 38px; /* سایز بزرگتر */
    height: 38px;
    border-radius: 50%;
    margin-right: -12px; /* افکت روی هم افتادن */
    border: 2px solid #fff;
    background: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.stacked-badge:hover {
    transform: translateY(-10px) scale(1.4); /* پرش به بالا و بزرگ شدن */
    z-index: 10;
    margin-right: 5px;
    margin-left: 15px;
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.2);
}

/* جلوگیری از به هم ریختگی سایدبار در صفحات عریض مثل تنظیمات */
.glass-sidebar {

    z-index: 1000;
}

.glass-profile-expanded {
    overflow: hidden;
}

/* استایل آیکون‌های سفارشی اگر خواستی طراحی کنی */
/*  */
/*  */
/* 🌟 دکمه‌ها و نوارهای خمیری 🌟 */
.btn-clay {
    background: var(--c-orange);
    color: #fff !important;
    border: none;
    box-shadow: 0 6px 15px rgba(255, 138, 0, 0.3), inset 0 3px 6px rgba(255, 255, 255, 0.4);
    transition: all 0.2s ease;
}

.btn-clay:hover {
    background: #ff9922;
    box-shadow: 0 8px 20px rgba(255, 138, 0, 0.4), inset 0 4px 8px rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.btn-clay:active {
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.2) !important;
    transform: translateY(1px);
}

.clay-progress-track {
    background: var(--c-gray);
    box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    height: 10px;
    overflow: hidden;
}

.clay-progress-fill {
    background: linear-gradient(90deg, var(--c-blue), var(--c-green));
    border-radius: 12px;
    height: 100%;
    position: relative;
}

.clay-progress-fill::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    animation: shine 2.5s infinite;
}

@keyframes shine {
    100% {
        left: 200%;
    }
}

/* ========================================================================
   🌟 استایل‌های مشترک منو (Glass Items) 🌟
   ======================================================================== */
.glass-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 6px;
    border-radius: 16px;
    text-decoration: none;
    color: #4a5568;
    transition: 0.3s;
    cursor: pointer;
    position: relative;
    background: transparent;
}

.glass-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    object-fit: contain;
    opacity: 0.8;
    transition: 0.3s;
    background: transparent;
}

.glass-text {
    margin-right: 15px;
    font-weight: 800;
    font-size: 0.95rem;
    opacity: 1;
    transition: opacity 0.3s;
    color: inherit;
}

/* 🌟 رنگ هوور و اکتیو در حالت باز: بنفش کهکشانی 🌟 */
.glass-item:hover {
    background-color: rgba(123, 97, 255, 0.1) !important;
    color: var(--c-purple) !important;
}

.glass-item.active {
    background: linear-gradient(135deg, var(--c-purple) 0%, #9A87FF 100%) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(123, 97, 255, 0.3) !important;
}

.glass-item:hover .glass-icon, .glass-item.active .glass-icon {
    opacity: 1;
    transform: scale(1.1);
}

/* ========================================================================
   📱 موبایل: جزیره شیشه‌ای پایین صفحه
   ======================================================================== */
@media (max-width: 991px) {
    #menu-main {
        background: rgba(255, 255, 255, 0.9) !important;
        backdrop-filter: blur(25px) !important;
        -webkit-backdrop-filter: blur(25px) !important;
        border-radius: 30px 30px 0 0 !important;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.08) !important;
        max-height: 85vh;
        overflow-y: auto;
    }

    .theme-dark #menu-main {
        background: rgba(15, 17, 23, 0.9) !important;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .glass-item {
        padding: 12px;
        margin: 0 15px 12px 15px;
        background: rgba(0, 0, 0, 0.02);
        border: 1px solid rgba(0, 0, 0, 0.03);
    }

    .theme-dark .glass-item {
        background: rgba(255, 255, 255, 0.03);
        border-color: rgba(255, 255, 255, 0.05);
        color: #fff;
    }
}

/* ========================================================================
   💻 دسکتاپ: سایدبار شناور (بدون پس‌زمینه در حالت بسته)
   ======================================================================== */
@media (min-width: 992px) {
    body:not(.is-auth) #page {
        padding-right: 110px !important;
        background-color: var(--c-gray);
        min-height: 100vh;
    }

    body:not(.is-auth) .header-fixed {
        right: 110px !important;
        width: calc(100% - 110px) !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }

    .glass-sidebar {
        position: fixed;
        top: 20px;
        right: 20px;
        bottom: 20px;
        width: 90px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(15px);
        border-radius: 30px;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.05);
        z-index: 9999;
        transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
        overflow-y: auto;
        overflow-x: hidden;
        display: flex;
        flex-direction: column;
        padding: 20px 0;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .glass-sidebar::-webkit-scrollbar {
        display: none;
    }

    .glass-sidebar:hover {
        width: 280px;
    }

    /* -----------------------------------------------
       🌟 حالت بسته (مخفی کردن تمام پس‌زمینه‌ها و حاشیه‌ها) 🌟
       ----------------------------------------------- */
    .glass-sidebar:not(:hover) .glass-item {
        background-color: transparent !important;
        box-shadow: none !important;
        padding: 10px;
        justify-content: center;
    }

    /* 🌟 جادو اینجاست: هاور/اکتیو در حالت بسته فقط هاله نور می‌دهد، بدون باکس 🌟 */
    .glass-sidebar:not(:hover) .glass-item:hover,
    .glass-sidebar:not(:hover) .glass-item.active {
        background-color: transparent !important;
        box-shadow: none !important;
    }

    .glass-sidebar:not(:hover) .glass-item:hover .glass-icon,
    .glass-sidebar:not(:hover) .glass-item.active .glass-icon {
        transform: scale(1.15);
        opacity: 1;
        filter: drop-shadow(0 4px 10px rgba(123, 97, 255, 0.4)); /* سایه نوری بنفش رنگ روی خود آیکون */
    }

    .glass-sidebar:not(:hover) .glass-text,
    .glass-sidebar:not(:hover) .glass-badge,
    .glass-sidebar:not(:hover) .glass-header-text {
        opacity: 0;
        visibility: hidden;
        width: 0;
        margin: 0;
        padding: 0;
        font-size: 0;
    }

    /* آواتار در حالت بسته */
    .glass-brand {
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 60px;
        margin-bottom: 0;
        transition: 0.4s;
    }

    .glass-logo, .glass-avatar {
        width: 50px;
        height: 50px;
        border-radius: 16px;
        object-fit: cover;
        border: 2px solid transparent;
        transition: 0.4s;
    }

    .glass-emoji-avatar {
        width: 50px;
        height: 50px;
        border-radius: 16px;
        background: rgba(0, 0, 0, 0.05);
        color: var(--c-purple);
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 1.5rem;
        transition: 0.4s;
    }

    .glass-level-badge {
        position: absolute;
        bottom: -5px;
        right: -10px;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        background: var(--c-yellow);
        color: #fff;
        font-size: 1.1rem;
        font-weight: 900;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 2px solid #fff;
        transition: 0.4s;
        opacity: 0;
        transform: scale(0);
    }

    .glass-profile-expanded {
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        padding: 0;
        margin: 0;
        transition: max-height 0.4s ease, opacity 0.3s ease;
    }

    /* -----------------------------------------------
       🌟 حالت باز (هاور کردن سایدبار) 🌟
       ----------------------------------------------- */
    .glass-sidebar:hover .glass-avatar, .glass-sidebar:hover .glass-emoji-avatar {
        width: 80px;
        height: 80px;
        border-radius: 25px;
        border-color: var(--c-purple);
        margin-top: 10px;
    }

    .glass-sidebar:hover .glass-level-badge {
        opacity: 1;
        transform: scale(1);
    }

    .glass-sidebar:hover .glass-profile-expanded {
        max-height: 600px;
        opacity: 1;
        padding-top: 10px;
        margin-bottom: 15px;
    }

    .glass-sidebar:hover .glass-item {
        justify-content: flex-start;
        padding: 10px 12px;
    }

    .glass-sidebar:hover .glass-text {
        opacity: 1;
        visibility: visible;
        width: auto;
        margin-right: 15px;
        font-size: 0.95rem;
        transition-delay: 0.1s;
    }

    .glass-sidebar:hover .glass-header-text {
        opacity: 1;
        visibility: visible;
        height: auto;
        padding: 10px 15px;
        font-size: 0.75rem;
    }

    /* دکمه‌های ویژه */
    .logout-item {
        margin-top: auto;
        color: var(--c-coral);
    }

    .logout-item:hover {
        background-color: rgba(255, 107, 107, 0.1) !important;
        color: var(--c-coral) !important;
    }

    .login-item {
        margin-top: auto;
        justify-content: center;
    }

    /* خنثی‌ساز لاگین */
    body.is-auth {
        background-color: var(--c-gray) !important;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 100vh;
    }

    body.is-auth #page {
        padding-right: 0 !important;
        width: 100% !important;
        max-width: 420px !important;
        margin: 0 auto !important;
        border-radius: 30px !important;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08) !important;
        background-color: #fff;
        min-height: 85vh;
    }

    body.is-auth .header-fixed {
        display: none !important;
    }

    body.is-auth .glass-sidebar {
        display: none !important;
    }
}