/* ==== Container اصلی استوری‌ها ==== */
.mn-stories-wrapper {
    width: 100%;
    background: #fff;
    padding: 15px 0;
    border-bottom: 1px solid #e5e5e5;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.mn-stories-container {
    display: flex;
    gap: 16px;
    padding: 0 20px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    justify-content: center;
}

.mn-stories-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

/* ==== آیتم استوری ==== */
.mn-story-item {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
    padding: 4px;
}

.mn-story-item:hover {
    transform: translateY(0px);
}

.mn-story-avatar {
    position: relative;
    width: 80px;
    height: 80px;
}

.mn-stories-container .mn-story-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* حلقه رنگی دور استوری */
.mn-story-ring {
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    z-index: -1;
    animation: rotate 3s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* برای استوری‌های دیده شده */
.mn-story-item.viewed .mn-story-ring {
    background: #c7c7c7;
    animation: none;
}

.mn-story-title {
    font-size: 12px;
    color: #262626;
    max-width: 70px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

/* ==== مودال استوری ==== */
.mn-story-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mn-story-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
}

.mn-story-modal-content {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: 95vh;
    max-height: 850px;
    z-index: 2;
}

/* دکمه بستن */
button.mn-story-close {
    position: absolute;
    top: 17px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.mn-story-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* ==== Viewer اصلی ==== */
.mn-story-viewer {
    width: 100%;
    height: 100%;
    position: relative;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}

/* Progress bars */
.mn-story-progress {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    gap: 4px;
    z-index: 5;
}

.mn-progress-bar {
    flex: 1;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
}

.mn-progress-fill {
    height: 100%;
    background: #fff;
    width: 0;
    transition: width 0.1s linear;
}

.mn-progress-bar.active .mn-progress-fill {
    animation: progress-animation linear;
}

@keyframes progress-animation {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

.mn-progress-bar.completed .mn-progress-fill {
    width: 100%;
}

/* ==== محتوای استوری ==== */
.mn-story-content {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
}

.mn-story-content video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

/* اطلاعات استوری */
.mn-story-info {
    position: absolute;
    bottom: 100px;
    left: 20px;
    right: 20px;
    color: #fff;
    z-index: 3;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    padding: 5px 10px;
    text-align: right  ;
}
.mn-story-info::before {
  content: "";
  background: #0000005e;
  position: relative;
  padding: 10px;
  position: absolute;
  right: 0;
  left: 0;
  bottom: 0;
  top: 0;
  border-radius: 4PX;
}
.mn-story-info-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px 0;
    line-height: 1.3;
    color: #fff;
}

.mn-story-info-caption {
    font-size: 14px;
    margin: 0;
    line-height: 1.5;
    opacity: 0.95;
}

/* دکمه لینک محصول */
.mn-story-link-btn {
    position: absolute;
    bottom: 40px;
    left: 30px;
    right: 30px;
    background: rgba(255, 255, 255, 0.82);
    color: #262626;
    padding: 14px 24px;
    border-radius: 8px;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    z-index: 3;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.mn-story-link-btn:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* ==== دکمه‌های ناوبری ==== */
button.mn-story-nav {
    position: absolute;
    top: 0%;
    transform: none;
    background: rgba(0, 0, 0, 0);
    border: none;
    width: 50%;
    height: 100%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4;
    transition: all 0.2s;
    opacity: 0;
    padding: 0;
    bottom: 0;
}



button.mn-story-nav.mn-story-prev:hover,
button.mn-story-nav.mn-story-next:hover
{
    background: rgba(0, 0, 0, 0);
    opacity: 1;
}


.mn-story-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ==== Responsive ==== */
@media (max-width: 768px) {
    .mn-stories-container {
        padding: 0 15px;
        gap: 12px;
    }
    
    .mn-story-avatar {
        width: 70px;
        height: 70px;
    }
    
    .mn-story-title {
        font-size: 11px;
        max-width: 60px;
    }
    
    .mn-story-modal-content {
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .mn-story-viewer {
        border-radius: 0;
    }
    
    .mn-story-close {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
        font-size: 20px;
    }
    
    .mn-story-info {
        bottom: 130px;
        left: 15px;
        right: 15px;
    }
    
    .mn-story-info-title {
        font-size: 16px;
    }
    
    .mn-story-info-caption {
        font-size: 13px;
    }
    
    .mn-story-link-btn {
        bottom: 80px;
        left: 15px;
        right: 15px;
        padding: 12px 20px;
    }
    
    .mn-story-nav {
        display: none; /* در موبایل با tap روی دو طرف صفحه */
    }
    .mn-stories-container{
        justify-content: flex-start;
    }
}

/* ==== RTL Support ==== */
body.rtl .mn-story-progress {
    left: 12px;
    right: 12px;
    direction: ltr; /* progress همیشه LTR */
}

body.rtl .mn-story-prev {
    right: auto;
    left: 0;
}

body.rtl .mn-story-next {
    left: auto;
    right: 0;
}

body.rtl .mn-story-prev svg {
    transform: rotate(180deg);
}

body.rtl .mn-story-next svg {
    transform: rotate(180deg);
}

/* ==== Loading State ==== */
.mn-story-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
}

.mn-story-loading::after {
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    position: absolute;
    right: calc(50% - 20px);
    top: calc(50% - 20px);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==== Pause indicator ==== */
.mn-story-paused::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    z-index: 10;
}

.mn-story-paused::after {
    content: '||';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    z-index: 11;
}