/* ====================================================================
   AMIR TEAM — استوری‌های هوشمند
   پالت: مشکی اُبسیدین + طلایی شامپاینی، با حلقه‌ی رنگی (طلایی → رز → بنفش → فیروزه‌ای)
   ==================================================================== */

.aat-stories,
.aat-sv {
	--st-gold-1: #f5d98a;
	--st-gold-2: #d4a63c;
	--st-rose: #f472b6;
	--st-violet: #8b5cf6;
	--st-cyan: #22d3ee;
	--st-ink: #07080d;
	font-family: 'Yekan', 'Vazirmatn', 'IRANSans', Tahoma, sans-serif;
}

/* ---------------------------------------------------------------
   نوار بالای چت
   --------------------------------------------------------------- */
.aat-stories { flex: 0 0 auto; padding: 12px 18px 2px; position: relative; z-index: 1; }
.aat-stories[hidden] { display: none; }
.aat-stories-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.aat-stories-title { font-size: 13px; font-weight: 800; color: var(--aat-text, #f4f4fa); display: inline-flex; gap: 6px; align-items: center; }
.aat-stories-count {
	font-size: 11px; padding: 2px 10px; border-radius: 999px;
	color: var(--st-gold-1);
	background: rgba(245, 217, 138, .1);
	border: 1px solid rgba(245, 217, 138, .35);
}
.aat-stories-track {
	display: flex; gap: 18px; overflow-x: auto; padding: 8px 4px 10px;
	scrollbar-width: none; -webkit-overflow-scrolling: touch;
	-webkit-mask-image: linear-gradient(90deg, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
	mask-image: linear-gradient(90deg, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
}
.aat-stories-track::-webkit-scrollbar { display: none; }

.aat-story-item {
	flex: 0 0 auto; width: 78px; padding: 0; border: 0; background: none;
	display: flex; flex-direction: column; align-items: center; gap: 8px;
	color: var(--aat-text, #f4f4fa); font-family: inherit; cursor: pointer;
}
.aat-story-ring {
	position: relative; width: 72px; height: 72px; border-radius: 50%;
	transition: transform .25s cubic-bezier(.2, .8, .2, 1);
	box-shadow: 0 8px 22px -8px rgba(245, 217, 138, .55);
}
.aat-story-ring::before {
	content: ''; position: absolute; inset: 0; border-radius: 50%;
	background: conic-gradient(from 0deg, var(--st-gold-1), var(--st-rose), var(--st-violet), var(--st-cyan), var(--st-gold-1));
	animation: aatStSpin 7s linear infinite;
}
.aat-story-avatar {
	position: absolute; inset: 3px; border-radius: 50%;
	border: 3px solid var(--aat-bg, #0c0d16);
	background: #1b1d2b center / cover no-repeat;
}
.aat-story-item:hover .aat-story-ring { transform: translateY(-3px) scale(1.05); }
.aat-story-item:active .aat-story-ring { transform: scale(.94); }
.aat-story-title { font-size: 11.5px; font-weight: 700; max-width: 78px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aat-story-item.is-seen .aat-story-ring { box-shadow: none; }
.aat-story-item.is-seen .aat-story-ring::before { background: rgba(255, 255, 255, .22); animation: none; }
.aat-story-item.is-seen .aat-story-title { opacity: .6; font-weight: 600; }

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

@media (max-width: 1279px) {
	/* موبایل/تبلت: فضای چت مهم‌تر است؛ نوار فشرده */
	.aat-stories { padding: 8px 12px 0; }
	.aat-stories-head { display: none; }
	.aat-story-item { width: 64px; gap: 5px; }
	.aat-story-ring { width: 58px; height: 58px; }
	.aat-story-title { font-size: 10.5px; max-width: 64px; }
}

/* ---------------------------------------------------------------
   نمایشگر تمام‌صفحه
   --------------------------------------------------------------- */
html.aat-sv-lock, html.aat-sv-lock body { overflow: hidden !important; }

.aat-sv {
	position: fixed; inset: 0; z-index: 1000050;
	display: grid; place-items: center;
	color: #fff; direction: rtl;
	opacity: 0; transition: opacity .28s ease;
}
.aat-sv[hidden] { display: none; }
.aat-sv.is-open { opacity: 1; }
.aat-sv button { font-family: inherit; }

.aat-sv-bg {
	position: absolute; inset: 0;
	background: var(--st-ink) var(--aat-sv-bg, none) center / cover no-repeat;
}
.aat-sv-bg::before {
	content: ''; position: absolute; inset: -40px;
	background: inherit; filter: blur(46px) saturate(1.3) brightness(.55);
	transform: scale(1.1);
}
.aat-sv-bg::after {
	content: ''; position: absolute; inset: 0;
	background:
		radial-gradient(900px 600px at 50% 40%, rgba(245, 217, 138, .08), transparent 70%),
		radial-gradient(circle at 50% 50%, transparent 30%, rgba(3, 4, 8, .72) 100%);
}

.aat-sv-x {
	position: absolute; top: 18px; left: 18px; z-index: 5;
	width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
	color: #fff; cursor: pointer;
	background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2);
	backdrop-filter: blur(10px);
	transition: background .15s, transform .15s;
}
.aat-sv-x:hover { background: rgba(255, 255, 255, .2); transform: rotate(90deg); }

.aat-sv-stage { position: relative; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 34px; height: 100%; }

/* --- کارت اصلی --- */
.aat-sv-card {
	position: relative; overflow: hidden; flex: 0 0 auto;
	height: min(92vh, 880px); aspect-ratio: 9 / 16;
	border-radius: 28px; background: #05060a;
	border: 1px solid rgba(245, 217, 138, .38);
	box-shadow: 0 0 0 6px rgba(245, 217, 138, .05), 0 40px 90px rgba(0, 0, 0, .7), 0 0 80px -20px rgba(245, 217, 138, .3);
	transform: scale(.96); transition: transform .35s cubic-bezier(.2, .8, .2, 1);
	touch-action: pan-y; user-select: none; -webkit-user-select: none;
}
.aat-sv.is-open .aat-sv-card { transform: scale(1); }

.aat-sv-media { position: absolute; inset: 0; background: #0a0b12; }
.aat-sv-el { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .4s ease; }
.aat-sv-el.is-in { opacity: 1; }
.aat-sv-img.is-in { animation: aatSvKb var(--aat-sv-kb, 6000ms) ease-out both; }
.aat-sv-card.is-paused .aat-sv-img { animation-play-state: paused; }
@keyframes aatSvKb { from { transform: scale(1); } to { transform: scale(1.09); } }
@media (prefers-reduced-motion: reduce) { .aat-sv-img.is-in { animation: none; } }

.aat-sv-shade {
	position: absolute; inset: 0; pointer-events: none;
	background:
		linear-gradient(180deg, rgba(0, 0, 0, .62) 0%, rgba(0, 0, 0, 0) 22%),
		linear-gradient(0deg, rgba(0, 0, 0, .88) 0%, rgba(0, 0, 0, .55) 24%, rgba(0, 0, 0, 0) 52%);
}

/* لودر */
.aat-sv-loader { position: absolute; inset: 0; display: none; place-items: center; z-index: 2; pointer-events: none; }
.aat-sv-loader.is-on { display: grid; }
.aat-sv-loader i { width: 44px; height: 44px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .16); border-top-color: var(--st-gold-1); animation: aatStSpin .8s linear infinite; }

/* نوار پیشرفت (RTL: از راست پر می‌شود) */
.aat-sv-progress { position: absolute; top: 12px; right: 14px; left: 14px; z-index: 4; display: flex; gap: 4px; direction: rtl; }
.aat-sv-progress i { position: relative; flex: 1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .28); overflow: hidden; }
.aat-sv-progress u { position: absolute; inset: 0; background: linear-gradient(90deg, var(--st-gold-2), var(--st-gold-1)); transform-origin: right center; transform: scaleX(0); text-decoration: none; }

/* هدر */
.aat-sv-top { position: absolute; top: 24px; right: 14px; left: 14px; z-index: 4; display: flex; align-items: center; gap: 10px; }
.aat-sv-avatar { width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto; background: #1b1d2b center / cover no-repeat; border: 2px solid var(--st-gold-1); box-shadow: 0 0 0 2px rgba(0, 0, 0, .35); }
.aat-sv-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.5; }
.aat-sv-meta b { font-size: 14px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 8px rgba(0, 0, 0, .6); }
.aat-sv-meta small { display: flex; align-items: center; gap: 10px; font-size: 11px; opacity: .85; }
.aat-sv-views { display: inline-flex; align-items: center; gap: 4px; }
.aat-sv-icobtn {
	width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto;
	color: #fff; cursor: pointer; background: rgba(0, 0, 0, .35); border: 1px solid rgba(255, 255, 255, .18);
	backdrop-filter: blur(8px);
}
.aat-sv-icobtn[hidden] { display: none; }
.aat-sv-closeM { display: none; }

/* ناحیه‌های لمسی */
.aat-sv-zones { position: absolute; inset: 70px 0 150px; z-index: 3; display: flex; direction: rtl; touch-action: pan-y; }
.aat-sv-zones span { flex: 1; }
.aat-sv-zones span[data-z="mid"] { flex: 1.1; }

/* پایین کارت */
.aat-sv-bottom { position: absolute; right: 0; left: 0; bottom: 0; z-index: 4; padding: 0 16px 18px; display: flex; flex-direction: column; gap: 14px; pointer-events: none; }
.aat-sv-bottom > * { pointer-events: auto; }
.aat-sv-caption {
	font-size: 14px; line-height: 1.95; font-weight: 500; white-space: pre-wrap;
	text-shadow: 0 2px 12px rgba(0, 0, 0, .8);
	max-height: 34%; overflow-y: auto; scrollbar-width: none;
	animation: aatSvUp .5s .1s both cubic-bezier(.2, .8, .2, 1);
}
.aat-sv-caption[hidden] { display: none; }
.aat-sv-caption::-webkit-scrollbar { display: none; }
@keyframes aatSvUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.aat-sv-row { display: flex; align-items: center; gap: 10px; }
.aat-sv-cta {
	flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	padding: 12px 18px; border-radius: 999px; text-decoration: none;
	font-size: 13.5px; font-weight: 900; color: #2b1d02;
	background: linear-gradient(100deg, var(--st-gold-2), var(--st-gold-1) 50%, var(--st-gold-2));
	background-size: 200% 100%;
	box-shadow: 0 10px 28px -8px rgba(245, 217, 138, .7), inset 0 1px 0 rgba(255, 255, 255, .5);
	animation: aatSvShine 3.5s linear infinite;
	transition: transform .15s;
}
.aat-sv-cta:hover { transform: translateY(-2px); color: #2b1d02; }
.aat-sv-cta[hidden] { display: none; }
@keyframes aatSvShine { to { background-position: -200% 0; } }

.aat-sv-actions { display: flex; gap: 8px; margin-inline-start: auto; }
.aat-sv-act {
	display: inline-flex; align-items: center; gap: 7px; height: 44px; padding: 0 14px; border-radius: 999px;
	color: #fff; cursor: pointer; font-size: 13px;
	background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .22);
	backdrop-filter: blur(10px);
	transition: background .15s, transform .15s, color .15s;
}
.aat-sv-act[hidden] { display: none; }
.aat-sv-act:hover { background: rgba(255, 255, 255, .22); }
.aat-sv-act:active { transform: scale(.92); }
.aat-sv-act b { font-weight: 800; font-variant-numeric: tabular-nums; }
.aat-sv-act.is-liked { color: #fb7185; background: rgba(251, 113, 133, .18); border-color: rgba(251, 113, 133, .5); }
.aat-sv-act.is-liked svg { animation: aatSvBeat .45s; }
@keyframes aatSvBeat { 0% { transform: scale(1); } 40% { transform: scale(1.4); } 100% { transform: scale(1); } }

/* قلبِ دابل‌تپ */
.aat-sv-heart { position: absolute; z-index: 6; width: 110px; height: 110px; margin: -55px 0 0 -55px; color: #fb7185; pointer-events: none; opacity: 0; filter: drop-shadow(0 8px 24px rgba(251, 113, 133, .6)); }
.aat-sv-heart svg { width: 100%; height: 100%; }
.aat-sv-heart.is-pop { animation: aatSvPop .9s cubic-bezier(.2, .8, .2, 1); }
@keyframes aatSvPop { 0% { opacity: 0; transform: scale(.3); } 25% { opacity: 1; transform: scale(1.15); } 60% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.2) translateY(-30px); } }

/* اعلان */
.aat-sv-toast {
	position: absolute; z-index: 8; right: 16px; left: 16px; bottom: 100px; padding: 11px 16px; border-radius: 16px;
	font-size: 12.5px; line-height: 1.7; text-align: center;
	background: rgba(12, 13, 20, .92); border: 1px solid rgba(245, 217, 138, .4);
	backdrop-filter: blur(12px);
}
.aat-sv-toast[hidden] { display: none; }
.aat-sv-toast.is-in { animation: aatSvUp .3s both; }
.aat-sv-toast a { color: var(--st-gold-1); font-weight: 800; }

/* --- پیش‌نمایش استوری‌های همسایه --- */
.aat-sv-ghost {
	position: relative; flex: 0 0 auto; width: 130px; padding: 0; border: 0; background: none; cursor: pointer;
	display: flex; flex-direction: column; align-items: center; gap: 10px; color: #fff;
	opacity: .55; transition: opacity .2s, transform .25s;
}
.aat-sv-ghost.is-empty { visibility: hidden; pointer-events: none; }
.aat-sv-ghost:hover { opacity: .95; transform: scale(1.04); }
.aat-sv-ghost-img {
	width: 130px; aspect-ratio: 9 / 16; border-radius: 20px; background: #1b1d2b center / cover no-repeat;
	border: 1px solid rgba(245, 217, 138, .35); filter: saturate(.85);
	box-shadow: 0 20px 50px rgba(0, 0, 0, .5);
}
.aat-sv-ghost-title { font-size: 12px; font-weight: 700; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.aat-sv-nav {
	position: absolute; top: 50%; z-index: 5; width: 46px; height: 46px; margin-top: -23px; border-radius: 50%;
	display: grid; place-items: center; color: #fff; cursor: pointer;
	background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .22); backdrop-filter: blur(10px);
	transition: background .15s, transform .15s;
}
.aat-sv-nav[hidden] { display: none; }
.aat-sv-nav:hover { background: rgba(245, 217, 138, .25); transform: scale(1.08); }
.aat-sv-nav-prev { right: 20px; }
.aat-sv-nav-next { left: 20px; }

/* --- شیت نظرات --- */
.aat-sv-sheet {
	position: absolute; right: 0; left: 0; bottom: 0; height: 68%; z-index: 7;
	display: flex; flex-direction: column;
	background: rgba(13, 14, 22, .97); backdrop-filter: blur(20px);
	border-top: 1px solid rgba(245, 217, 138, .35); border-radius: 24px 24px 0 0;
	transform: translateY(102%); transition: transform .38s cubic-bezier(.2, .8, .2, 1);
}
.aat-sv-sheet.is-open { transform: none; }
.aat-sv-sheet-grab { width: 44px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .25); margin: 10px auto 0; }
.aat-sv-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px 8px; font-size: 14px; }
.aat-sv-cms { flex: 1; overflow-y: auto; padding: 4px 16px 10px; display: flex; flex-direction: column; gap: 14px; scrollbar-width: thin; scrollbar-color: rgba(245, 217, 138, .3) transparent; }
.aat-sv-cm { display: flex; gap: 10px; animation: aatSvUp .35s both; }
.aat-sv-cm-av { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%; background: #23263a center / cover no-repeat; border: 1px solid rgba(255, 255, 255, .15); }
.aat-sv-cm-body { min-width: 0; flex: 1; }
.aat-sv-cm-head { display: flex; gap: 8px; align-items: baseline; font-size: 12px; }
.aat-sv-cm-head b { font-weight: 800; }
.aat-sv-cm-head span { opacity: .55; font-size: 10.5px; }
.aat-sv-cm-body p { margin: 3px 0 0; font-size: 13px; line-height: 1.8; white-space: pre-wrap; word-break: break-word; }
.aat-sv-cm-empty { padding: 34px 10px; text-align: center; font-size: 13px; opacity: .6; }
.aat-sv-composer { display: flex; align-items: flex-end; gap: 10px; padding: 10px 14px 16px; border-top: 1px solid rgba(255, 255, 255, .08); }
.aat-sv-input {
	flex: 1; resize: none; min-height: 42px; max-height: 96px; padding: 10px 14px; border-radius: 22px;
	color: #fff; font: inherit; font-size: 13px; line-height: 1.7; outline: 0;
	background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .14);
}
.aat-sv-input:focus { border-color: rgba(245, 217, 138, .6); }
.aat-sv-send {
	width: 42px; height: 42px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
	color: #2b1d02; border: 0; background: linear-gradient(135deg, var(--st-gold-1), var(--st-gold-2));
	transition: transform .15s, opacity .15s;
}
.aat-sv-send svg { transform: scaleX(-1); }
.aat-sv-send:disabled { opacity: .5; cursor: default; }
.aat-sv-send:active { transform: scale(.9); }
.aat-sv-login {
	flex: 1; text-align: center; padding: 11px; border-radius: 999px; text-decoration: none; font-size: 13px; font-weight: 800;
	color: #2b1d02; background: linear-gradient(100deg, var(--st-gold-2), var(--st-gold-1));
}

/* --- موبایل / صفحه‌ی کوچک --- */
@media (max-width: 900px) {
	.aat-sv-ghost, .aat-sv-nav, .aat-sv-x { display: none; }
	.aat-sv-closeM { display: grid; }
}
@media (max-width: 600px) {
	.aat-sv-card {
		height: 100dvh; height: 100vh; width: 100vw; aspect-ratio: auto; border-radius: 0; border: 0; box-shadow: none;
	}
	@supports (height: 100dvh) { .aat-sv-card { height: 100dvh; } }
}
