/* --- کانتینر اصلی --- */
.mt-am-widget-container {
    position: relative;
    font-family: inherit;
}

.mt-app-menu-wrapper {
    display: flex;
    flex-direction: column;
    background-color: #fff;
    /* ارتفاع پیش‌فرض، توسط ویجت کنترل می‌شود */
    height: 600px; 
    border: 1px solid #eee;
    overflow: hidden;
    position: relative;
    direction: rtl;
}

/* --- حالت مودال (پاپ‌آپ کشویی) --- */
.mt-am-is-modal .mt-app-menu-wrapper {
    position: fixed;
    top: 0;
    right: -100%; /* پیش‌فرض مخفی در سمت راست */
    width: 100%;
    max-width: 400px; /* حداکثر عرض در دسکتاپ/تبلت */
    height: 100vh !important;
    z-index: 999999;
    transition: right 0.3s ease;
    border: none !important;
    border-radius: 0 !important;
}

/* وقتی کلاس open اضافه شود، منو وارد صفحه می‌شود */
.mt-am-is-modal.open .mt-app-menu-wrapper {
    right: 0;
}

.mt-am-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mt-am-is-modal.open .mt-am-modal-overlay {
    opacity: 1;
    visibility: visible;
}

/* --- هدر (جستجو و دکمه بستن) --- */
.mt-am-header-search {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #fff;
    border-bottom: 1px solid #f0f0f1;
    z-index: 5;
    flex-shrink: 0;
    gap: 10px; /* فاصله بین دکمه بستن و فرم جستجو */
}

/* دکمه بستن - مخفی در حالت عادی */
.mt-am-close-btn {
    display: none; 
}

/* نمایش دکمه بستن فقط در حالت مودال */
.mt-am-is-modal .mt-am-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #f1f2f4;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.mt-am-is-modal .mt-am-close-btn:hover {
    background: #e4e5e7;
}

.mt-am-close-btn svg {
    width: 20px;
    height: 20px;
    fill: #424750;
}

/* فرم جستجو */
.mt-am-search-form {
    position: relative;
    display: flex;
    flex: 1; 
    align-items: center;
    background: #f1f2f4;
    border-radius: 8px;
    padding: 0 10px;
    height: 40px;
}

.mt-am-search-form button {
    background: none;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 8px;
}

.mt-am-search-form button svg {
    width: 20px;
    height: 20px;
    fill: #a1a3a8;
}

.mt-am-search-form input[type="search"] {
    flex: 1;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    font-size: 13px;
    color: #424750;
    padding: 0;
    width: 100%;
    height: 100%;
}

.mt-am-search-logo {
    max-height: 24px;
    margin-right: 8px;
    object-fit: contain;
}

/* --- بدنه اصلی (ردیف پایین‌تر از جستجو) --- */
.mt-am-body {
    display: flex;
    flex: 1;
    min-height: 0; 
    overflow: hidden;
    position: relative;
}

/* --- سایدبار --- */
.mt-am-sidebar {
    width: 90px;
    background-color: #f1f2f4;
    overflow-y: auto; 
    height: 100%;     
    flex-shrink: 0;
    
    scrollbar-width: none; 
    -ms-overflow-style: none;
}
.mt-am-sidebar::-webkit-scrollbar { display: none; }

.mt-am-sidebar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px 5px;
    cursor: pointer;
    transition: all 0.2s;
    color: #424750;
    font-size: 12px;
    font-weight: 500;
    border-bottom: 1px solid #eee;
    text-align: center;
    position: relative;
}

/* استایل آیکون‌ها و ماسک‌های SVG */
.mt-am-sidebar-item img,
.mt-am-sidebar-item svg,
.mt-am-sidebar-item i,
.mt-am-svg-mask {
    width: 24px;
    height: 24px;
    font-size: 24px;
    margin-bottom: 8px;
    fill: currentColor;
    object-fit: contain;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ساختار SVG Mask */
.mt-am-svg-mask {
    background-color: currentColor; /* گرفتن رنگ از والد (متن) */
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

/* پوزیشن آیکون */
.mt-am-sidebar-item.icon-pos-right { flex-direction: row; }
.mt-am-sidebar-item.icon-pos-right img, .mt-am-sidebar-item.icon-pos-right svg, .mt-am-sidebar-item.icon-pos-right i, .mt-am-sidebar-item.icon-pos-right .mt-am-svg-mask { margin-bottom: 0; margin-left: 8px; }

.mt-am-sidebar-item.icon-pos-left { flex-direction: row-reverse; }
.mt-am-sidebar-item.icon-pos-left img, .mt-am-sidebar-item.icon-pos-left svg, .mt-am-sidebar-item.icon-pos-left i, .mt-am-sidebar-item.icon-pos-left .mt-am-svg-mask { margin-bottom: 0; margin-right: 8px; }

.mt-am-sidebar-item.icon-pos-bottom { flex-direction: column-reverse; }
.mt-am-sidebar-item.icon-pos-bottom img, .mt-am-sidebar-item.icon-pos-bottom svg, .mt-am-sidebar-item.icon-pos-bottom i, .mt-am-sidebar-item.icon-pos-bottom .mt-am-svg-mask { margin-bottom: 0; margin-top: 8px; }

/* آیتم فعال */
.mt-am-sidebar-item.active {
    background-color: #fff;
    color: #ef394e;
    font-weight: 700;
}

/* --- محتوا (Content Area) --- */
.mt-am-main {
    flex: 1;
    background-color: #fff;
    position: relative;
    height: 100%;
    overflow: hidden;
}

.mt-am-content {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; 
    height: 100%;
    overflow-y: auto; 
    padding: 15px;
    display: none; 
    background-color: #fff;
    
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.mt-am-content::-webkit-scrollbar { display: none; }

/* کلاس اکتیو برای نمایش تب */
.mt-am-content.active {
    display: block !important;
    animation: mtFadeIn 0.3s ease;
}

@keyframes mtFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* هدر و لینک بازگشت */
.mt-am-cat-link {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    color: #19bfd3;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    margin-bottom: 20px;
    direction: ltr; 
    cursor: pointer;
}
.mt-am-cat-link svg { width: 16px; height: 16px; fill: currentColor; }
.mt-am-cat-link span { margin-left: 5px; }

.mt-am-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #000;
    text-align: right;
}

/* --- آکاردئون --- */
.mt-am-accordion-group {
    margin-bottom: 15px;
    border-bottom: 1px solid #f0f0f1;
}

.mt-am-acc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    color: #3f4064;
    user-select: none;
    transition: color 0.2s;
}

.mt-am-acc-header:hover {
    color: #000;
}

.mt-am-acc-icon {
    transition: transform 0.3s ease;
    width: 14px;
    height: 14px;
    fill: #81858b;
}

/* محتوای آکاردئون */
.mt-am-acc-content {
    display: none !important;
    margin-top: 10px;
    padding-bottom: 15px;
}

/* وقتی کلاس open اضافه شد */
.mt-am-accordion-group.open .mt-am-acc-content {
    display: grid !important; 
}

.mt-am-accordion-group.open .mt-am-acc-icon {
    transform: rotate(180deg);
    fill: #ef394e;
}

.mt-am-accordion-group.open .mt-am-acc-header {
    border-bottom: none;
    color: #000;
}

/* --- گرید محصولات --- */
.mt-am-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    row-gap: 20px;
}

.mt-am-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: #0c0c0c;
}

.mt-am-img-wrap {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: #f0f0f1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    overflow: hidden;
    padding: 8px;
    box-sizing: border-box;
    transition: transform 0.2s;
}

.mt-am-grid-item:hover .mt-am-img-wrap {
    transform: scale(1.05);
}

.mt-am-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.mt-am-item-title {
    font-size: 11px;
    line-height: 1.4;
    font-weight: 500;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* --- نوار پایین (Bottom Nav - مختص موبایل و تبلت) --- */
.mt-am-bottom-nav {
    display: none; 
}

@media (max-width: 1024px) {
    .mt-am-bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: #fff;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
        z-index: 999990;
        height: 60px;
        border-top: 1px solid #f0f0f1;
        padding-bottom: env(safe-area-inset-bottom, 0px); /* SafeArea برای آیفون */
    }
    .mt-am-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        flex: 1;
        text-decoration: none;
        color: #81858b;
        cursor: pointer;
        transition: color 0.2s;
        height: 100%;
    }
    .mt-am-nav-item:hover, .mt-am-nav-item:active {
        color: #424750;
    }
    .mt-am-nav-icon i, .mt-am-nav-icon svg {
        font-size: 20px;
        width: 20px;
        height: 20px;
        margin-bottom: 4px;
        fill: currentColor;
    }
    .mt-am-nav-title {
        font-size: 10px;
        font-weight: 500;
    }
    
    /* فاصله دادن به محتوای سایت تا زیر نوار مخفی نشود */
    body:has(.mt-am-bottom-nav) {
        padding-bottom: 60px !important;
    }
}