/* کانتینر اصلی */
.mt-sp-wrapper {
    position: relative;
    overflow: hidden;
    background: #fff;
}

/* هدر ویجت */
.mt-sp-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e2;
    position: relative;
    z-index: 2; /* هدر روی گرید قرار گیرد */
}

.mt-sp-header-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    font-size: 16px;
}
body:not(.rtl) .mt-sp-header-icon { margin-left: 0; margin-right: 10px; }

.mt-sp-header-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
}

/* کانتینر اسلایدر/گرید */
.mt-sp-container {
    position: relative;
    width: 100%;
    transition: opacity 0.3s ease;
}

/* 
   ==============
   حالت گرید (Grid Mode)
   ==============
*/
.mt-sp-container.mt-force-grid {
    /* ترفند حذف خط بالای ردیف اول: کانتینر را 1 پیکسل بالا می‌کشیم */
    margin-top: -1px; 
}

.mt-sp-container.mt-force-grid .mt-sp-track {
    display: grid !important;
    grid-template-columns: repeat(var(--mt-cols, 6), 1fr) !important;
    gap: 1px !important; 
    background-color: #e0e0e2 !important; 
    width: 100% !important;
    transform: none !important;
    padding: 0 !important;
    border: none !important;
}

/* در حالت گرید، آیتم‌ها نباید بوردر داشته باشند */
.mt-sp-container.mt-force-grid .mt-sp-slide {
    width: auto !important;
    margin: 0 !important;
    border: none !important; 
    height: auto !important;
    background: #fff;
}

.mt-sp-container.mt-force-grid .mt-sp-nav-btn {
    display: none !important;
}

/* 
   ==============
   حالت اسلایدر (Slider Mode)
   ==============
*/
.mt-sp-track:not(.mt-force-grid .mt-sp-track) {
    display: flex;
    background-color: transparent; 
}

/* اعمال خط جداکننده برای تمام اسلایدها */
.mt-sp-slide:not(.mt-force-grid .mt-sp-slide) {
    background: #fff;
    height: auto;
    display: flex;
    flex-direction: column;
    /* خط سمت چپ برای همه کارت‌ها در RTL */
    border-left: 1px solid #e0e0e2; 
    box-sizing: border-box;
}

/* حذف خط بیرونی (سمت چپ‌ترین کارت در RTL) */
.mt-sp-track:not(.mt-force-grid .mt-sp-track) .mt-sp-slide:last-child {
    border-left: none;
}

/* تنظیمات LTR */
body:not(.rtl) .mt-sp-slide:not(.mt-force-grid .mt-sp-slide) {
    border-left: none;
    border-right: 1px solid #e0e0e2;
}
body:not(.rtl) .mt-sp-track:not(.mt-force-grid .mt-sp-track) .mt-sp-slide:last-child {
    border-right: none;
}


/* 
   ==============
   کارت و المان‌های داخلی
   ==============
*/
.mt-sp-card {
    background: #fff;
    padding: 20px;
    display: flex;
    flex-direction: column;
    text-decoration: none !important;
    position: relative;
    height: 100%;
    width: 100%;
}

.mt-sp-img-box {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--mt-img-h, 150px);
    width: 100%;
}
.mt-sp-img-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.mt-sp-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
    width: 100%;
}

.mt-sp-title {
    font-size: 16px;
    line-height: 1.6;
    margin: 0 0 10px 0;
    color: #3f4064;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: 52px;
}

.mt-sp-meta { margin-top: auto; }

.mt-sp-row-1 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.mt-sp-badge {
    background: #ef394e;
    color: #fff;
    padding: 0 6px;
    height: 20px;
    line-height: 20px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    min-width: 32px;
    text-align: center;
}

.mt-sp-price {
    font-weight: 700;
    font-size: 16px;
    color: #3f4064;
    display: flex;
    align-items: center;
    gap: 3px;
}

.mt-sp-toman::before {
    content: 'تومان';
    font-size: 11px;
    font-weight: 400;
    opacity: 0.8;
}

.mt-sp-row-2 {
    display: flex;
    justify-content: flex-end; 
    align-items: center;
    height: 18px;
}

.mt-sp-old {
    color: #c3c3ce;
    text-decoration: line-through;
    font-size: 13px;
}

/* دکمه‌های ناوبری */
.mt-sp-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: #fff;
    border: 1px solid #e0e0e2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    color: #3f4064;
    font-size: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.3s;
}

.mt-sp-prev { right: 10px; }
.mt-sp-next { left: 10px; }
body:not(.rtl) .mt-sp-prev { left: 10px; right: auto; }
body:not(.rtl) .mt-sp-next { right: 10px; left: auto; }

.swiper-button-disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
    background-color: #f5f5f5;
}

/* موبایل */
@media (max-width: 767px) {
    .mt-sp-card { padding: 10px; }
    .mt-sp-title { font-size: 14px; min-height: 45px; }
    .mt-sp-nav-btn { width: 32px; height: 32px; font-size: 16px; }
}

/* --- Skeleton Loading Styles --- */
.mt-sp-skeleton-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #fff;
    z-index: 50;
    display: flex;
    flex-wrap: wrap;
    gap: 1px;
    background-color: #f0f0f1;
    overflow: hidden;
}

.mt-sp-sk-card {
    background: #fff;
    padding: 20px;
    width: calc(100% / var(--mt-cols, 6) - 1px);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.mt-sp-sk-anim {
    background: linear-gradient(90deg, #f0f0f1 25%, #e0e0e2 50%, #f0f0f1 75%);
    background-size: 200% 100%;
    animation: mt-skeleton 1.5s infinite;
    border-radius: 4px;
}

@keyframes mt-skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@media (max-width: 1024px) {
    .mt-sp-sk-card { width: calc(100% / 4 - 1px); }
}
@media (max-width: 767px) {
    .mt-sp-sk-card { width: calc(100% / 2 - 1px); }
}