/* Storygram Groups - list styles (شبیه ویجت اول) */

.sgcg-wrapper {
	position: relative;
	display: flex;
	align-items: center;
	gap: 8px;
	direction: rtl;
}

.sgcg-track {
	display: flex;
	gap: var(--sgcg-items-gap, 12px);
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	list-style: none;
	margin: 0;
	padding: 8px 4px;
	flex: 1 1 auto;
	scrollbar-width: none;
}
.sgcg-track::-webkit-scrollbar {
	display: none;
}

.sgcg-item {
	flex: 0 0 calc((100% / var(--sgcg-visible-desktop, 8)) - var(--sgcg-items-gap, 12px) * (var(--sgcg-visible-desktop, 8) - 1) / var(--sgcg-visible-desktop, 8));
	scroll-snap-align: start;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	min-width: 0;
}

@media (max-width: 1024px) {
	.sgcg-item {
		flex: 0 0 calc((100% / var(--sgcg-visible-tablet, 5)) - var(--sgcg-items-gap, 12px) * (var(--sgcg-visible-tablet, 5) - 1) / var(--sgcg-visible-tablet, 5));
	}
}

@media (max-width: 767px) {
	.sgcg-item {
		flex: 0 0 calc((100% / var(--sgcg-visible-mobile, 3)) - var(--sgcg-items-gap, 12px) * (var(--sgcg-visible-mobile, 3) - 1) / var(--sgcg-visible-mobile, 3));
	}
}

.sgcg-circle {
	display: block;
	background: none;
	border: none;
	padding: 0;
	cursor: pointer;
	margin: 0 auto;
}

.sgcg-ring {
	display: flex;
	align-items: center;
	justify-content: center;
	width: calc(var(--sgcg-circle, 80px) + (var(--sgcg-ring-w, 3px) + var(--sgcg-ring-gap, 3px)) * 2);
	height: calc(var(--sgcg-circle, 80px) + (var(--sgcg-ring-w, 3px) + var(--sgcg-ring-gap, 3px)) * 2);
	border-radius: 50%;
	border: var(--sgcg-ring-w, 3px) solid var(--sgcg-ring-color, #ff3040);
	padding: var(--sgcg-ring-gap, 3px);
	box-sizing: border-box;
	transition: border-color .2s ease;
}

@media (max-width: 767px) {
	.sgcg-ring {
		width: calc(var(--sgcg-circle-mobile, 60px) + (var(--sgcg-ring-w, 3px) + var(--sgcg-ring-gap, 3px)) * 2);
		height: calc(var(--sgcg-circle-mobile, 60px) + (var(--sgcg-ring-w, 3px) + var(--sgcg-ring-gap, 3px)) * 2);
	}
}

.sgcg-wrapper[data-mark-viewed="1"] .sgcg-item.sgcg-viewed .sgcg-ring {
	border-color: var(--sgcg-ring-color-viewed, #c7c7c7);
}

.sgcg-img,
.sgcg-img-placeholder {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
	display: block;
	background: #eee;
}

.sgcg-img-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	color: #888;
	font-size: 1.4em;
}

.sgcg-title {
	margin-top: 6px;
	font-size: 12px;
	line-height: 1.4;
	color: var(--sgcg-title-color, #262626);
	max-width: calc(var(--sgcg-circle, 80px) + 20px);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sgcg-arrow {
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: none;
	cursor: pointer;
	background: var(--sgcg-arrow-bg, rgba(0,0,0,.5));
	color: var(--sgcg-arrow-color, #fff);
	font-size: 20px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 2;
}

@media (max-width: 767px) {
	.sgcg-arrow { display: none; }
}

.sgcg-empty {
	direction: rtl;
	opacity: .7;
}

/* ================= ویوئر تمام‌صفحه ================= */

.sgcg-viewer-overlay {
	position: fixed;
	inset: 0;
	background: var(--sgcg-viewer-bg, #000);
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	direction: rtl;
}

.sgcg-viewer-stage {
	position: relative;
	width: 100%;
	max-width: 420px;
	height: 100%;
	max-height: 100vh;
	background: #000;
	overflow: hidden;
}

@media (min-width: 768px) {
	.sgcg-viewer-stage {
		height: 90vh;
		max-height: 780px;
		border-radius: 12px;
	}
}

.sgcg-progress-row {
	position: absolute;
	top: 8px;
	left: 8px;
	right: 8px;
	display: flex;
	gap: 4px;
	z-index: 5;
}

.sgcg-progress-seg {
	flex: 1 1 0;
	height: 3px;
	background: rgba(255,255,255,.35);
	border-radius: 3px;
	overflow: hidden;
}

.sgcg-progress-fill {
	height: 100%;
	width: 0%;
	background: var(--sgcg-progress-color, #fff);
	border-radius: 3px;
}

.sgcg-progress-fill.sgcg-fill-anim {
	transition: width linear;
}

.sgcg-viewer-header {
	position: absolute;
	top: 18px;
	left: 12px;
	right: 12px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	z-index: 5;
	color: #fff;
	text-shadow: 0 1px 3px rgba(0,0,0,.5);
}

.sgcg-viewer-title {
	font-size: 14px;
	font-weight: 600;
}

.sgcg-header-actions {
	display: flex;
	gap: 10px;
}

.sgcg-icon-btn {
	background: rgba(0,0,0,.25);
	border: none;
	color: #fff;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 15px;
}

.sgcg-media-wrap {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #000;
}

.sgcg-media-wrap img,
.sgcg-media-wrap video {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
}

.sgcg-nav-zone {
	position: absolute;
	top: 0;
	bottom: 0;
	width: 33%;
	z-index: 4;
	cursor: pointer;
	background: transparent;
	border: none;
}

.sgcg-nav-prev { right: 0; }
.sgcg-nav-next { left: 0; }

.sgcg-link-bar {
	position: absolute;
	bottom: 18px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 5;
	text-decoration: none;
	background: var(--sgcg-link-bg, #fff);
	color: var(--sgcg-link-color, #000);
	padding: 10px 22px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 700;
	display: none;
	box-shadow: 0 2px 10px rgba(0,0,0,.3);
}

.sgcg-link-bar.sgcg-visible {
	display: inline-block;
}
