/* Place stories — Instagram-like rings + fullscreen viewer */

/* ── Home feed ── */
.hmj-stories {
  padding: 1.25rem 0 0.5rem;
}

.hmj-stories__head {
  margin-bottom: 0.75rem;
}

.hmj-stories__title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0.15rem 0 0;
}

.hmj-stories__rail {
  display: flex;
  align-items: flex-start;
  gap: 1.1rem;
  overflow-x: auto;
  padding: 0.4rem 0.15rem 0.85rem;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.hmj-stories__rail::-webkit-scrollbar {
  height: 0;
}

.hmj-stories__ring {
  flex: 0 0 auto;
  width: 78px;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-align: center;
  scroll-snap-align: start;
  appearance: none;
  -webkit-appearance: none;
  line-height: normal;
  font: inherit;
  color: inherit;
}

.hmj-stories__avatar {
  display: block;
  width: 68px;
  height: 68px;
  margin: 0 auto 0.4rem;
  border-radius: 50%;
  padding: 3px;
  box-sizing: border-box;
  overflow: hidden;
}

.hmj-stories__ring.is-unseen .hmj-stories__avatar {
  background: linear-gradient(135deg, #f58529, #dd2a7b 45%, #8134af 75%, #515bd4);
}

.hmj-stories__ring.is-seen .hmj-stories__avatar {
  background: #c9c9c9;
}

.hmj-stories__avatar img,
.hmj-stories__fallback {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2.5px solid #fff;
  background: #f3f3f3;
  box-sizing: border-box;
}

.hmj-stories__fallback {
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #555;
}

.hmj-stories__name {
  display: block;
  font-size: 0.72rem;
  line-height: 1.2;
  color: #222;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 78px;
  margin: 0 auto;
}

/* ── Place details rings ── */
.pd-stories {
  display: block;
  width: 100%;
  clear: both;
  margin: 0.25rem 0 0.85rem;
  padding: 0.5rem 0 0.25rem;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.pd-stories__rail,
.pd-story-row {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.5rem !important; /* فاصله‌ بسیار جمع‌وجور و نزدیک‌تر طبق درخواست کاربر */
  overflow-x: auto !important;
  overflow-y: hidden !important;
  padding: 0.25rem 0.15rem 0.45rem;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 159, 138, 0.25) transparent;
  white-space: nowrap !important;
}

.pd-stories__rail::-webkit-scrollbar,
.pd-story-row::-webkit-scrollbar {
  height: 4px;
}

.pd-stories__rail::-webkit-scrollbar-track,
.pd-story-row::-webkit-scrollbar-track {
  background: transparent;
}

.pd-stories__rail::-webkit-scrollbar-thumb,
.pd-story-row::-webkit-scrollbar-thumb {
  background: rgba(15, 159, 138, 0.25);
  border-radius: 999px;
}

.pd-stories__item,
.pd-story-chip {
  position: relative;
  flex: 0 0 62px !important;
  flex-shrink: 0 !important;
  flex-grow: 0 !important;
  width: 62px !important;
  max-width: 62px !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0;
  cursor: pointer;
  text-align: center;
  appearance: none;
  -webkit-appearance: none;
  line-height: normal;
  font: inherit;
  color: inherit;
  outline: none;
}

.pd-stories__item:focus-visible,
.pd-story-chip:focus-visible {
  outline: 2px solid #14b8a6;
  outline-offset: 3px;
  border-radius: 12px;
}

.pd-stories__ring,
.pd-story-chip__ring {
  display: block;
  width: 56px;
  height: 56px;
  margin: 0 auto 0.25rem;
  border-radius: 50%;
  padding: 2px;
  background: #c9c9c9;
  box-sizing: border-box;
  overflow: hidden;
}

.pd-stories__item.is-unseen .pd-stories__ring,
.pd-story-chip.is-unseen .pd-story-chip__ring,
.pd-story-chip:not(.is-seen):not(.is-highlight) .pd-story-chip__ring {
  background: linear-gradient(135deg, #f58529, #dd2a7b 45%, #8134af 75%, #515bd4);
}

.pd-stories__item.is-seen .pd-stories__ring,
.pd-story-chip.is-seen .pd-story-chip__ring {
  background: #c9c9c9;
}

.pd-stories__item.is-highlight .pd-stories__ring,
.pd-story-chip.is-highlight .pd-story-chip__ring {
  background: linear-gradient(135deg, #0d9488, #14b8a6 55%, #5eead4);
  border-radius: 50%;
}

.pd-stories__ring img,
.pd-story-chip__ring img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  background: #eef2f5;
  box-sizing: border-box;
}

.pd-stories__item.is-highlight .pd-stories__ring img,
.pd-story-chip.is-highlight .pd-story-chip__ring img {
  border-radius: 50%;
}

.pd-stories__label,
.pd-story-chip__label {
  display: block;
  width: 100%;
  font-size: 0.68rem;
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.pd-stories__badge {
  position: absolute;
  top: -2px;
  left: 2px;
  z-index: 1;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.15rem;
  border: 2px solid #fff;
  box-sizing: border-box;
}

/* ── Fullscreen viewer ── */
.hmj-story-viewer {
  position: fixed;
  inset: 0;
  z-index: 20000;
  background: #0a0a0c;
  display: none;
  color: #fff;
  direction: rtl;
}

.hmj-story-viewer.is-open {
  display: flex;
  flex-direction: column;
}

.hmj-story-viewer__progress {
  display: flex;
  gap: 4px;
  padding: 10px 12px 0;
  flex: 0 0 auto;
  position: relative;
  z-index: 3;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.hmj-story-viewer__bar {
  flex: 1;
  height: 2px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  overflow: hidden;
}

.hmj-story-viewer__bar > i {
  display: block;
  height: 100%;
  width: 0;
  background: #fff;
}

.hmj-story-viewer__bar.is-done > i {
  width: 100%;
}

.hmj-story-viewer__bar.is-active > i {
  animation: hmjStoryFill linear forwards;
}

@keyframes hmjStoryFill {
  from { width: 0; }
  to { width: 100%; }
}

.hmj-story-viewer__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  gap: 10px;
  flex: 0 0 auto;
  position: relative;
  z-index: 3;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.hmj-story-viewer__place {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  text-decoration: none;
  color: #fff;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.hmj-story-viewer__place:hover {
  opacity: 0.9;
  color: #fff;
  transform: translateY(-1px);
}

.hmj-story-viewer__place img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: #222;
  flex-shrink: 0;
}

.hmj-story-viewer__place strong {
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hmj-story-viewer__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.hmj-story-viewer__actions button {
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  padding: 0;
  line-height: 1;
}

.hmj-story-viewer__stage {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 0;
  width: 100%;
  background: #0a0a0c;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

.hmj-story-viewer__bg {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  filter: blur(28px) brightness(0.35);
  transform: scale(1.12);
  pointer-events: none;
  z-index: 0;
}

.hmj-story-viewer__frame {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 420px);
  height: 100%;
  max-height: 100%;
  padding: 0 0 12px;
  box-sizing: border-box;
}

.hmj-story-viewer__frame img[data-media] {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 0;
  background: #111;
  opacity: 0;
  transition: opacity 0.18s ease;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.hmj-story-viewer__frame img[data-media].is-ready {
  opacity: 1;
}

.hmj-story-viewer__loader {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.hmj-story-viewer.is-loading .hmj-story-viewer__loader {
  display: flex;
}

.hmj-story-viewer__spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.22);
  border-top-color: #fff;
  animation: hmjStorySpin 0.7s linear infinite;
}

@keyframes hmjStorySpin {
  to { transform: rotate(360deg); }
}

@media (min-width: 768px) {
  .hmj-story-viewer__frame img[data-media] {
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  }
}

.hmj-story-viewer__caption {
  position: absolute;
  bottom: 20px;
  right: 16px;
  left: 16px;
  z-index: 2;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.45;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.75);
  pointer-events: none;
}

.hmj-story-viewer__hit {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 35%;
  z-index: 2;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.hmj-story-viewer__hit--prev { right: 0; }
.hmj-story-viewer__hit--next { left: 0; }

@media (min-width: 768px) {
  .hmj-story-viewer__hit {
    width: calc(50% - 210px);
    min-width: 80px;
  }
}

.hmj-story-viewer__top,
.hmj-story-viewer__caption {
  transition: opacity 0.2s ease;
}

.hmj-story-viewer.is-holding .hmj-story-viewer__top,
.hmj-story-viewer.is-holding .hmj-story-viewer__caption {
  opacity: 0.2;
}

/* Report modal must sit above the fullscreen story viewer (z-index: 20000) */
#reportStoryModal {
  z-index: 21010 !important;
}

#reportStoryModal .modal-dialog {
  z-index: 21011;
}

.modal-backdrop.hmj-story-report-backdrop {
  z-index: 21000 !important;
}
