/* ====== Story Frontend Styles (Final Design: Instagram Gradient, Large Circles, Full Text) ====== */

/* ----------------------------------
 * ۱. استایل‌های کانتینر استوری (دایره‌ها)
 * ---------------------------------- */

.sm-story-container {
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  gap: 16px;
  padding: 10px;
  justify-content: flex-start;
  align-items: flex-start;
  scroll-behavior: smooth;
  direction: rtl; /* تضمین جهت RTL */
}

/* اسکرول مخفی برای زیبایی */
.sm-story-container::-webkit-scrollbar {
  height: 6px;
}
.sm-story-container::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}

/* هر دایره (دسته) */
.sm-story-cat {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  text-align: center;
  transition: transform 0.3s ease;
  white-space: normal;
  flex-shrink: 0; 
  /* پهنای ثابت برای دسته که متن در آن قرار بگیرد */
  width: 90px; 
}

.sm-story-cat:hover {
  transform: scale(1.07);
}

/* گرادیانت اینستاگرام با ضخامت ۴ پیکسل */
.sm-story-cover {
  /* **برگردانده شده به 90px** */
  width: 90px;
  height: 90px;
  border-radius: 50%;
  
  /* گرادیانت اینستاگرام */
  background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #ffc000 45%, #ff007f 60%, #bc00ff 90%);
  
  /* padding برای شبیه‌سازی ضخامت حاشیه (4px) */
  padding: 3px; 
  
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.sm-story-cover img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover; /* **تغییر از contain به cover برای فیت شدن کامل** */
  display: block;
  
  /* ایجاد فاصله سفید بین عکس و گرادیانت */
  padding: 2px;
  background-color: #fff;
}

/* نام زیر دایره */
.sm-story-name {
  margin-top: 5px;
  font-size: 13px;
  color: #333;
  font-weight: 500;
  
  /* **اصلاح شده: امکان چند خطی شدن و نمایش کامل متن** */
  max-width: 100px; /* پهنای کافی برای متن */
  white-space: normal; /* اجازه چند خطی شدن */
  overflow: visible; /* نمایش کامل متن */
  text-overflow: clip; /* حذف text-overflow */
  
  text-align: center;
}

/* ===== مودال ===== */
.sm-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9); 
  display: flex; 
  align-items: center;
  justify-content: center;
  z-index: 9999; 
  transition: opacity 0.3s ease;
}

.sm-modal-content {
  position: relative;
  width: 100%;
  max-width: 400px;
  height: 100%;
  max-height: 80vh; 
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  align-items: center; 
  justify-content: center; 
}

/* ----------------------------------
 * ۳. استایل‌های محتوای رسانه‌ای و Tap to Play
 * ---------------------------------- */

.sm-modal-content img,
.sm-modal-content video {
  width: 100%;
  height: 100%;
  object-fit: contain; 
  display: block;
  user-select: none;
}

/* پوشش شفاف محافظ ویدئو */
.sm-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent; 
    z-index: 16; 
    cursor: default; 
}

.sm-tap-to-play {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    z-index: 17; 
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
    font-weight: bold;
}


/* ----------------------------------
 * ۴. استایل‌های نوار پیشرفت (تایم‌لاین)
 * ---------------------------------- */

.sm-progress {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  height: 3px;
  display: flex;
  gap: 4px;
  z-index: 25; 
}

.sm-progress-segment {
  flex: 1;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  overflow: hidden;
}

.sm-progress-bar {
  width: 0%;
  height: 100%;
  background: #fff; 
  transition: width linear;
}

/* ----------------------------------
 * ۵. استایل‌های کنترل‌های آیتم (داخل محتوا)
 * ---------------------------------- */

/* دکمه بستن و شمارنده */
.sm-modal-close,
.sm-counter {
    position: absolute;
    color: #fff;
    z-index: 26; 
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.7);
}

.sm-modal-close {
  top: 15px;
  right: 15px;
  font-size: 30px;
  cursor: pointer;
  line-height: 1;
  padding: 5px;
}

.sm-counter {
  top: 15px;
  left: 15px;
  font-size: 14px;
  padding: 5px 10px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 10px;
  line-height: 1;
}

/* دکمه‌های مرئی آیتم */
.sm-item-prev,
.sm-item-next {
    position: absolute;
    color: #fff; 
    font-size: 0; 
    cursor: pointer;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.4); 
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20; 
    user-select: none;
    transition: background 0.2s ease;
    padding: 0; 
}

.sm-item-prev:hover,
.sm-item-next:hover {
  background: rgba(0, 0, 0, 0.7);
}

.sm-item-prev { 
    right: 10px; 
}

.sm-item-next { 
    left: 10px; 
}

/* فلش‌های کوچک سفید روی دکمه‌های آیتم */
.sm-item-prev::before,
.sm-item-next::before {
    position: absolute;
    content: '❮';
    color: #fff; 
    font-size: 20px; 
    line-height: 1;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.7);
    pointer-events: none; 
}

.sm-item-next::before {
    content: '❯';
}


/* ----------------------------------
 * ۶. استایل‌های کنترل‌های دسته (Category Navigation)
 * ---------------------------------- */
 
.sm-category-control {
    display: none; 
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
    z-index: 9998; 
    color: #fff;
    font-size: 60px; 
    width: 60px; 
    user-select: none;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    background: transparent !important; 
}


/* برای حالت دسکتاپ و تبلت (عرض بالای 768 پیکسل) */
@media (min-width: 768px) {
    .sm-modal {
        display: grid;
        grid-template-columns: 80px minmax(300px, 420px) 80px; 
    }

    .sm-modal-content {
        grid-column: 2;
    }

    .sm-category-control {
        display: flex; 
    }
}

/* واکنش‌گرا - تنظیمات موبایل اصلی */
@media (max-width: 480px) {
  /* **برگردانده شده به 90px** */
  .sm-story-cover {
    width: 90px;
    height: 90px;
  }
  .sm-story-cover img {
    padding: 2px;
  }
  /* **اصلاح شده برای نمایش کامل متن در موبایل** */
  .sm-story-cat {
    width: 100px; /* فضای بیشتر برای متن */
  }
  .sm-story-name {
    font-size: 13px;
    max-width: 100px; 
    white-space: normal; /* اجازه چند خطی شدن */
    overflow: visible;
  }
}