/* ══════════════════════════════════════════════════════════════
   AMIR PANEL — استوری‌ها (Stories)
   طراحی: لوکس، تیره، شیشه‌ای، با حلقه‌ی گرادیانت چرخان، مشابه اپلیکیشن‌های
   مدرن SaaS/سوشال، هماهنگ با پالت رنگی داشبورد (--ud-primary/--ud-secondary)
══════════════════════════════════════════════════════════════ */

:root {
  --story-c1: #00d4ff;
  --story-c2: #a855f7;
  --story-c3: #ff2fb0;
  --story-c4: #ffd166;
  --story-c5: #00ff96;
  --story-c6: #00d4ff;
  --ud-primary: #00d4ff;
  --ud-secondary: #00ff96;
  --ud-bg: #050608;
  --ud-card: rgba(255,255,255,0.045);
  --ud-border: rgba(255,255,255,0.1);
  --ud-text: #f0f2f5;
  --ud-muted: #9098a8;
}

/* ---------- نوار استوری ---------- */
.amir-stories-bar {
  position: relative;
  z-index: 3;
  margin: 0 0 20px;
  padding: 4px 0 2px;
}
.amir-stories-track {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 2px 10px;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}
.amir-stories-track::-webkit-scrollbar { height: 5px; }
.amir-stories-track::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 10px; }
.amir-stories-track::-webkit-scrollbar-track { background: transparent; }

.amir-story-bubble {
  flex: 0 0 auto;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  width: 78px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--ud-text);
  -webkit-tap-highlight-color: transparent;
}

.amir-story-ring {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  padding: 3px;
  transition: transform 0.18s ease;
}
.amir-story-bubble:active .amir-story-ring { transform: scale(0.94); }

/* حلقه‌ی گرادیانت چرخان: یعنی استوری‌های دیده‌نشده وجود دارد */
.amir-story-ring::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  padding: 3px;
  background: conic-gradient(from var(--story-angle, 0deg), var(--story-c1), var(--story-c2), var(--story-c3), var(--story-c4), var(--story-c5), var(--story-c6));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  animation: amirStoryRingSpin 6s linear infinite;
}
@keyframes amirStoryRingSpin {
  to { --story-angle: 360deg; }
}
@property --story-angle {
  syntax: '<angle>';
  inherits: true;
  initial-value: 0deg;
}

/* حلقه‌ی خاکستری: یعنی همه‌ی استوری‌های این کاربر قبلاً دیده شده */
.amir-story-ring.amir-story-ring-seen::before {
  background: none;
  border: 2px solid rgba(255,255,255,0.16);
  animation: none;
}

/* حلقه‌ی خالی (بدون استوری) برای «افزودن استوری» */
.amir-story-ring.amir-story-ring-empty::before {
  background: none;
  border: 2px dashed rgba(255,255,255,0.22);
  animation: none;
}
.amir-story-ring.amir-story-ring-mine::before {
  background: conic-gradient(from var(--story-angle, 0deg), var(--story-c5), var(--story-c1), var(--story-c2), var(--story-c5));
}

.amir-story-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--ud-bg);
  border: 2px solid var(--ud-bg);
  display: block;
}

.amir-story-add-badge {
  position: absolute;
  bottom: -1px;
  inset-inline-end: -1px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ud-primary), var(--ud-secondary));
  color: #04121a;
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid var(--ud-bg);
  box-shadow: 0 2px 8px rgba(0,212,255,0.45);
  line-height: 1;
}
.amir-story-name {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ud-muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.amir-story-bubble-mine .amir-story-name { color: var(--ud-text); }

.amir-stories-empty-hint {
  font-size: 12.5px;
  color: var(--ud-muted);
  padding: 4px 2px;
}

/* ══════════════════════════════════════════════════════════════
   مودال ساخت استوری
══════════════════════════════════════════════════════════════ */
.amir-story-create-overlay,
.amir-story-viewer-overlay,
.amir-story-viewers-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(3, 4, 8, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  font-family: "Space Grotesk", "Vazirmatn", sans-serif;
}
.amir-story-create-overlay.is-open,
.amir-story-viewer-overlay.is-open,
.amir-story-viewers-overlay.is-open {
  display: flex;
}

.amir-story-create-box {
  width: min(440px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
  background: linear-gradient(165deg, rgba(20,23,32,0.96), rgba(8,10,15,0.98));
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 26px;
  padding: 26px 22px 22px;
  position: relative;
  box-shadow: 0 30px 90px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.03) inset;
  color: var(--ud-text, #f0f2f5);
  animation: amirStoryPop 0.28s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes amirStoryPop {
  from { transform: scale(0.9) translateY(14px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.amir-story-close-btn {
  position: absolute;
  top: 16px;
  inset-inline-end: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.amir-story-close-btn:hover { background: rgba(255,255,255,0.14); }

.amir-story-create-title {
  margin: 0 0 18px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.2px;
  background: linear-gradient(90deg, #00d4ff, #a855f7 60%, #ff2fb0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.amir-story-create-dropzone {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(255,255,255,0.03);
  border: 1.5px dashed rgba(255,255,255,0.16);
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.amir-story-create-dropzone.amir-dropzone-drag {
  border-color: var(--ud-primary, #00d4ff);
  background: rgba(0,212,255,0.06);
}
.amir-story-dropzone-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 30px 16px;
  text-align: center;
}
.amir-story-dropzone-icon { font-size: 34px; margin-bottom: 4px; filter: drop-shadow(0 4px 14px rgba(168,85,247,0.35)); }
.amir-story-dropzone-title { font-weight: 700; font-size: 15px; }
.amir-story-dropzone-hint { font-size: 12.5px; color: var(--ud-muted, #9098a8); margin-bottom: 8px; }
.amir-story-pick-btn {
  margin-top: 6px;
  padding: 10px 22px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  color: #04121a;
  background: linear-gradient(120deg, #00d4ff, #00ff96);
  box-shadow: 0 6px 20px rgba(0,212,255,0.3);
}

.amir-story-preview-wrap {
  position: relative;
  width: 100%;
  height: 320px;
  background: #000;
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.amir-story-preview-wrap img,
.amir-story-preview-wrap video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.amir-story-preview-remove {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.55);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  backdrop-filter: blur(4px);
}

.amir-story-create-fields { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.amir-story-field-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ud-muted, #9098a8);
  margin-bottom: 6px;
}
.amir-story-caption-input,
.amir-story-link-input,
.amir-story-link-label-input {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 10px 14px;
  color: #fff;
  font-size: 13.5px;
  font-family: inherit;
  resize: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.amir-story-caption-input:focus,
.amir-story-link-input:focus,
.amir-story-link-label-input:focus {
  outline: none;
  border-color: var(--ud-primary, #00d4ff);
  background: rgba(0,212,255,0.06);
}
.amir-story-link-row { display: flex; gap: 10px; }
.amir-story-field-col { flex: 1.4; }
.amir-story-field-col-narrow { flex: 1; }

.amir-story-create-status {
  font-size: 12.5px;
  min-height: 16px;
  font-weight: 600;
}
.amir-story-create-status.is-error { color: #ff6b81; }
.amir-story-create-status.is-success { color: #00ff96; }

.amir-story-publish-btn {
  margin-top: 4px;
  width: 100%;
  padding: 13px;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  font-weight: 800;
  font-size: 14.5px;
  color: #04121a;
  background: linear-gradient(120deg, #00d4ff, #a855f7 55%, #ff2fb0);
  background-size: 200% 100%;
  box-shadow: 0 10px 30px rgba(168,85,247,0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background-position 0.4s ease, transform 0.15s ease, opacity 0.2s ease;
}
.amir-story-publish-btn:hover { background-position: 100% 0; }
.amir-story-publish-btn:active { transform: scale(0.98); }
.amir-story-publish-btn:disabled { opacity: 0.65; cursor: not-allowed; }
.amir-story-publish-spinner {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2.5px solid rgba(4,18,26,0.35);
  border-top-color: #04121a;
  display: none;
  animation: amirStorySpin 0.7s linear infinite;
}
.amir-story-publish-btn.is-loading .amir-story-publish-spinner { display: inline-block; }
@keyframes amirStorySpin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════════
   نمایشگر تمام‌صفحه‌ی استوری
══════════════════════════════════════════════════════════════ */
.amir-story-viewer-overlay { background: #000; padding: 0; }
.amir-story-viewer-stage {
  position: relative;
  width: min(430px, 100vw);
  height: min(100dvh, 860px);
  background: #050608;
  overflow: hidden;
  border-radius: 0;
  box-shadow: 0 0 80px rgba(0,0,0,0.6);
}
@media (min-width: 560px) {
  .amir-story-viewer-stage { border-radius: 22px; height: min(92dvh, 820px); }
}

.amir-story-progress-row {
  position: absolute;
  top: 10px;
  inset-inline: 10px;
  z-index: 6;
  display: flex;
  gap: 4px;
}
.amir-story-progress-track {
  flex: 1;
  height: 3px;
  border-radius: 3px;
  background: rgba(255,255,255,0.28);
  overflow: hidden;
}
.amir-story-progress-fill {
  height: 100%;
  width: 0%;
  background: #fff;
  border-radius: 3px;
  transform-origin: left;
}
[dir="rtl"] .amir-story-progress-fill { transform-origin: right; }
.amir-story-progress-track.is-done .amir-story-progress-fill { width: 100% !important; }
.amir-story-progress-fill.is-animating { transition: width linear; }

.amir-story-viewer-header {
  position: absolute;
  top: 22px;
  inset-inline: 12px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 10px;
}
.amir-story-viewer-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255,255,255,0.3);
}
.amir-story-viewer-headtext { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.amir-story-viewer-name { font-size: 13.5px; font-weight: 700; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.5); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amir-story-viewer-time { font-size: 11.5px; color: rgba(255,255,255,0.7); }

.amir-story-viewer-mute,
.amir-story-viewer-delete,
.amir-story-viewer-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.35);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  backdrop-filter: blur(4px);
}

.amir-story-viewer-media {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}
.amir-story-viewer-media img,
.amir-story-viewer-media video {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.amir-story-viewer-navzone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 32%;
  z-index: 5;
  cursor: pointer;
}
.amir-story-navzone-prev { inset-inline-start: 0; }
.amir-story-navzone-next { inset-inline-end: 0; }

.amir-story-viewer-footer {
  position: absolute;
  bottom: 0;
  inset-inline: 0;
  z-index: 6;
  padding: 16px 14px 20px;
  background: linear-gradient(to top, rgba(0,0,0,0.72), rgba(0,0,0,0));
}
.amir-story-viewer-caption {
  color: #fff;
  font-size: 13.5px;
  line-height: 1.6;
  margin: 0 0 12px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  max-height: 4.8em;
  overflow-y: auto;
}
.amir-story-viewer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.amir-story-link-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.95);
  color: #0b0d12;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}
.amir-story-link-btn-icon { font-size: 14px; }

.amir-story-viewers-btn,
.amir-story-like-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.35);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(4px);
  flex: 0 0 auto;
}
.amir-story-like-btn.is-liked { background: rgba(255,47,176,0.22); border-color: rgba(255,47,176,0.55); }
.amir-story-like-icon { font-size: 16px; transition: transform 0.25s cubic-bezier(.3,1.8,.4,1); display: inline-block; }
.amir-story-like-btn.amir-story-like-pop .amir-story-like-icon { transform: scale(1.4); }

/* ══════════════════════════════════════════════════════════════
   پنل بازدیدکننده‌ها (کشوی پایین)
══════════════════════════════════════════════════════════════ */
.amir-story-viewers-overlay { background: rgba(0,0,0,0.6); align-items: flex-end; }
.amir-story-viewers-panel {
  width: min(430px, 100vw);
  max-height: 62vh;
  background: linear-gradient(180deg, rgba(20,23,32,0.98), rgba(6,7,11,0.99));
  border-radius: 22px 22px 0 0;
  padding: 10px 18px 22px;
  display: flex;
  flex-direction: column;
  animation: amirStorySheetUp 0.25s ease;
  border-top: 1px solid rgba(255,255,255,0.1);
}
@keyframes amirStorySheetUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.amir-story-viewers-panel-handle {
  width: 42px;
  height: 4px;
  border-radius: 3px;
  background: rgba(255,255,255,0.22);
  margin: 4px auto 12px;
}
.amir-story-viewers-panel-title {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 800;
  color: var(--ud-text, #f0f2f5);
}
.amir-story-viewers-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.amir-story-viewer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-radius: 12px;
}
.amir-story-viewer-row img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}
.amir-story-viewer-row-name { flex: 1; font-size: 13px; font-weight: 600; color: var(--ud-text, #f0f2f5); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amir-story-viewer-row-time { font-size: 11px; color: var(--ud-muted, #9098a8); }
.amir-story-viewer-row-heart { font-size: 14px; color: #ff2fb0; }
.amir-story-viewers-empty { text-align: center; color: var(--ud-muted, #9098a8); font-size: 13px; padding: 20px 0; }

.amir-story-viewers-panel-close {
  margin-top: 12px;
  padding: 11px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

@media (max-width: 480px) {
  .amir-story-bubble { width: 68px; }
  .amir-story-ring { width: 60px; height: 60px; }
}

/* ══════════════════════════════════════════════════════════════
   صفحه‌ی مدیریت استوری در پیشخوان وردپرس
══════════════════════════════════════════════════════════════ */
.amir-admin-stories-shell {
  font-family: "Space Grotesk", "Vazirmatn", sans-serif;
}

.amir-admin-stories-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.amir-admin-stories-toolbar-text h2 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 800;
  color: var(--ap-text, #e9e9f5);
}
.amir-admin-stories-toolbar-text p {
  margin: 0;
  font-size: 13px;
  color: var(--ap-muted, #9a9ab8);
  line-height: 1.8;
}

.amir-admin-new-story-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 800;
  font-size: 13.5px;
  color: #04121a;
  background: linear-gradient(120deg, #00d4ff, #a855f7 55%, #ff2fb0);
  background-size: 200% 100%;
  box-shadow: 0 10px 30px rgba(168,85,247,0.28);
  transition: background-position 0.4s ease, transform 0.15s ease;
  flex-shrink: 0;
}
.amir-admin-new-story-btn:hover { background-position: 100% 0; transform: translateY(-1px); }
.amir-admin-new-story-btn-icon { font-size: 15px; }

.amir-admin-stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.amir-admin-story-card {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: var(--ap-card-bg, #15152c);
  border: 1px solid var(--ap-border, #2a2a48);
  aspect-ratio: 9 / 15;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.amir-admin-story-card:hover { transform: translateY(-3px); border-color: rgba(0,212,255,0.4); }

.amir-admin-story-card img,
.amir-admin-story-card video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.amir-admin-story-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.05) 55%);
}

.amir-admin-story-card-badge {
  position: absolute;
  top: 10px;
  inset-inline-start: 10px;
  z-index: 2;
  font-size: 15px;
  background: rgba(0,0,0,0.45);
  border-radius: 8px;
  padding: 4px 7px;
  backdrop-filter: blur(3px);
}

.amir-admin-story-card-delete {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  z-index: 3;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.5);
  color: #ff6b81;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}
.amir-admin-story-card-delete:hover { background: rgba(255,47,81,0.28); }

.amir-admin-story-card-info {
  position: absolute;
  bottom: 0;
  inset-inline: 0;
  z-index: 2;
  padding: 12px 10px;
  color: #fff;
}
.amir-admin-story-card-caption {
  font-size: 11.5px;
  line-height: 1.5;
  margin: 0 0 6px;
  max-height: 3em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  opacity: 0.9;
}
.amir-admin-story-card-stats {
  display: flex;
  gap: 10px;
  font-size: 11.5px;
  font-weight: 700;
}
.amir-admin-story-card-stats span { display: inline-flex; align-items: center; gap: 3px; }

.amir-admin-stories-empty {
  text-align: center;
  padding: 60px 20px;
  border: 1.5px dashed var(--ap-border, #2a2a48);
  border-radius: 18px;
  margin-top: 20px;
}
.amir-admin-stories-empty-icon { font-size: 40px; margin-bottom: 10px; }
.amir-admin-stories-empty p { color: var(--ap-muted, #9a9ab8); font-size: 13.5px; margin: 0; }

