
/* Stories Section */
.stories-section {
  margin-top: var(--header-height);
  width: 100%;
  padding: 1rem 1rem;
  display: flex;
  position: relative;
  align-items: center;
}


.stories-container {
  max-width: 100%; 
  position: relative;
  width: 85%;
  padding: 0rem 0rem 0rem 0rem;
  margin: 0 auto;
  overflow: hidden;
}


.stories-controls {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  width: 100%;
  pointer-events: none;
}


.stories-wrapper {
  overflow: hidden;
  border-radius: 15px;
  /* padding: 0 0px; */
  /* padding: 10 10 10 10;  */
  display: flex; 
  justify-content: center;
}

.stories-slider {
  cursor: grab;
  user-select: none;
  display: flex;
  flex-direction: row;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;        /* ← جلوگیری از اسکرول عمودی */
  scroll-behavior: smooth;
  padding: 15px;
  height: auto;              /* ارتفاع داینامیک */
  align-items: flex-start;
  justify-content: flex-start;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.stories-slider::-webkit-scrollbar {
  display: none;
}


.stories-slider.active {
  cursor: grabbing;
}

.story-caption {
  margin-top: 8px;            /* به‌جای position absolute */
  position: static;           /* ← دیگه مطلق نباشه */
  font-size: 0.75rem;
  text-align: center;
  color: var(--text-dark);
  white-space: normal;
  line-height: 1.4;
}

.story-item-container {
  flex: 0 0 auto;
  width: 100px;
  /* height: 100%; ← حذف شد */
  margin: 0 8px;
  position: relative;
  scroll-snap-align: start;
}

.story-item {
  flex: 0 0 auto;
  width: 100px;
  /* height: 100%; ← حذف شد */
  border-radius: 5px;
  margin: 0 8px;
  position: relative;
  text-decoration: none;
  color: inherit;
  text-align: center;
  flex-shrink: 0;
  scroll-snap-align: start;  
  user-select: none;
  display: block;
}


.story-item p {
  font-size: 0.8rem;
  margin-top: 6px;
  color: #0a0606;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* pointer-events: none; */ 
}


.story-image {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #f2f3f7; /* خط داخلی */
  box-shadow: 0 0 0 6px #060e45; /* خط بیرونی */
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none; 
      
}


.story-item:hover .story-image {
  border-color: var(--accent-color);
  box-shadow: var(--shadow-heavy);
}



.no-stories-message {
  text-align: center;
  padding: 3rem;
  color: var(--text-light);
}


/* ظرف اسلایدر */
.stories-wrapper {
  overflow-x: auto;
  display: flex;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  touch-action: pan-x;       /* اجازه‌ی اسکرول افقی طبیعی روی تاچ */
  cursor: grab;
}
.stories-wrapper::-webkit-scrollbar { display: none; }
.stories-wrapper.dragging { cursor: grabbing; }
.stories-slider.dragging {
  cursor: grabbing;
  user-select: none;
}


.stories-nav-btn {
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: white;
  border: none;
  box-shadow: var(--shadow-medium);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
  font-size: 1.2rem;
  transition: background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
  pointer-events: all;
  z-index: 10; 
  transform: translateY(-50%); 
  top: 50%; 
}


.stories-nav-btn:hover {
  box-shadow: var(--shadow-heavy);
  background: var(--primary-color);
  color: white;
}

.stories-nav-btn.prev {
  left: 10px; 
}

.stories-nav-btn.next {
  right: 10px;
}


.stories-nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}


.stories-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000; /* above header in base.html */
  background: rgba(34, 41, 47, 0.6);
  display: flex; /* visible when not .hidden */
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
}
.stories-modal-overlay.open { display: flex; }

.stories-modal {
  width: min(92vw, 460px);
  max-height: 80vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-heavy);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.stories-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  background: #ffffff;
}
.stories-modal-title { font-weight: 700; color: var(--text-dark); }
.stories-modal-close {
  border: none;
  background: transparent;
  font-size: 1.25rem;
  color: var(--text-light);
  cursor: pointer;
  line-height: 1;
  padding: 6px;
  border-radius: 8px;
}
.stories-modal-close:hover { background: #f3f4f6; color: var(--text-dark); }

.stories-modal-body {
  position: relative;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16/9;
  min-height: 220px;
}
.stories-modal-media {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
/* Avoid conflict with page stories nav; scope to modal body */
.stories-modal-body .stories-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.35);
  color: #fff;
  background: rgba(255,255,255,.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
.stories-modal-body .stories-nav-btn.prev { left: 10px; }
.stories-modal-body .stories-nav-btn.next { right: 10px; }
.stories-modal-body .stories-nav-btn:hover { background: rgba(255,255,255,.3); }

.stories-modal-caption {
  padding: 1rem;
  color: var(--text-dark);
  line-height: 1.7;
  text-align: right;
  background: #fff;
}
.stories-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  padding: .75rem 1rem;
  border-top: 1px solid var(--border-color);
  background: #fff;
}

@media (min-width: 768px) {
  .stories-modal { width: min(60vw, 520px); }
}
@media (min-width: 1024px) {
  .stories-modal { width: min(40vw, 560px); }
} 


.story-item,
.story-item img,
.story-item video {
    user-select: none;     
    -webkit-user-drag: none; 
    -moz-user-select: none;   
    -ms-user-select: none;    
}