/* Instagram Stories Widget - Shofy Theme */

.shofy-ig-stories {
	--shofy-ig-avatar-size: 66px;
	--shofy-ig-ring-width: 2.5px;
	--shofy-ig-ring-gap: 3px;
	--shofy-ig-ring-start: #feda75;
	--shofy-ig-ring-mid: #fa7e1e;
	--shofy-ig-ring-end: #d62976;
	--shofy-ig-ring-seen: #dbdbdb;
	--shofy-ig-username-size: 12px;
	width: 100%;
	overflow: hidden;
}

.shofy-ig-stories--empty {
	padding: 20px;
	text-align: center;
	color: #8e8e8e;
	font-size: 14px;
	border: 1px dashed #dbdbdb;
	border-radius: 8px;
}

.shofy-ig-stories__rail {
	display: flex;
	align-items: flex-start;
	gap: 16px;
	overflow-x: auto;
	overflow-y: hidden;
	padding: 8px 4px 12px;
	scrollbar-width: none;
	-ms-overflow-style: none;
	-webkit-overflow-scrolling: touch;
}

.shofy-ig-stories__rail::-webkit-scrollbar {
	display: none;
}

@media (pointer: fine) {
	.shofy-ig-stories__rail.is-draggable {
		cursor: grab;
	}

	.shofy-ig-stories__rail.is-draggable.is-dragging {
		cursor: grabbing;
		user-select: none;
		-webkit-user-select: none;
	}

	.shofy-ig-stories__rail.is-draggable.is-dragging .shofy-ig-stories__trigger {
		cursor: grabbing;
		pointer-events: none;
	}
}

.shofy-ig-stories__item {
	flex: 0 0 auto;
	width: calc(var(--shofy-ig-avatar-size) + 8px);
	text-align: center;
}

.shofy-ig-stories__trigger {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	width: 100%;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
	text-decoration: none;
	color: inherit;
}

.shofy-ig-stories__ring {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: calc(var(--shofy-ig-avatar-size) + (var(--shofy-ig-ring-width) + var(--shofy-ig-ring-gap)) * 2);
	height: calc(var(--shofy-ig-avatar-size) + (var(--shofy-ig-ring-width) + var(--shofy-ig-ring-gap)) * 2);
	border-radius: 50%;
	box-sizing: border-box;
	transition: transform 0.15s ease;
}

.shofy-ig-stories__ring-track {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: conic-gradient(
		from -45deg,
		var(--shofy-ig-ring-start),
		var(--shofy-ig-ring-mid),
		var(--shofy-ig-ring-end),
		#962fbf,
		var(--shofy-ig-ring-start)
	);
	-webkit-mask: radial-gradient(
		farthest-side,
		transparent calc(100% - var(--shofy-ig-ring-width)),
		#000 calc(100% - var(--shofy-ig-ring-width))
	);
	mask: radial-gradient(
		farthest-side,
		transparent calc(100% - var(--shofy-ig-ring-width)),
		#000 calc(100% - var(--shofy-ig-ring-width))
	);
	transition: background 0.25s ease;
}

.shofy-ig-stories__item.is-loading .shofy-ig-stories__ring-track {
	background: repeating-conic-gradient(
		from 0deg,
		var(--shofy-ig-ring-start) 0deg 11deg,
		transparent 11deg 16deg,
		var(--shofy-ig-ring-mid) 16deg 27deg,
		transparent 27deg 32deg,
		var(--shofy-ig-ring-end) 32deg 43deg,
		transparent 43deg 48deg,
		#962fbf 48deg 59deg,
		transparent 59deg 64deg
	);
	animation: shofyIgRingSpin 1.5s linear infinite;
}

.shofy-ig-stories__item.is-seen .shofy-ig-stories__ring-track {
	background: var(--shofy-ig-ring-seen);
	animation: none;
}

.shofy-ig-stories__item.is-seen .shofy-ig-stories__avatar {
	background: var(--shofy-ig-ring-seen);
}

.shofy-ig-stories__item.is-seen .shofy-ig-stories__avatar img {
	filter: grayscale(100%);
	opacity: 0.62;
}

.shofy-ig-stories__item.is-seen .shofy-ig-stories__avatar::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: var(--shofy-ig-ring-seen);
	opacity: 0.28;
	pointer-events: none;
}

.shofy-ig-stories__item.is-seen.is-loading .shofy-ig-stories__ring-track {
	background: repeating-conic-gradient(
		from 0deg,
		var(--shofy-ig-ring-seen) 0deg 12deg,
		transparent 12deg 20deg
	);
	animation: shofyIgRingSpin 1.3s linear infinite;
}

.shofy-ig-stories__item.is-loading .shofy-ig-stories__trigger {
	pointer-events: none;
}

.shofy-ig-stories__avatar {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--shofy-ig-avatar-size);
	height: var(--shofy-ig-avatar-size);
	border-radius: 50%;
	overflow: hidden;
	background: #fff;
	border: 2px solid #fff;
	box-sizing: border-box;
	transition: background 0.25s ease;
}

.shofy-ig-stories__avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: filter 0.25s ease, opacity 0.25s ease;
}

.shofy-ig-stories__username {
	display: block;
	max-width: 100%;
	font-size: var(--shofy-ig-username-size);
	line-height: 1.2;
	color: #262626;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.shofy-ig-stories__trigger:hover .shofy-ig-stories__ring {
	transform: scale(1.03);
}

.shofy-ig-stories__item.is-loading .shofy-ig-stories__ring {
	transform: scale(0.96);
}

@keyframes shofyIgRingSpin {
	from {
		transform: rotate(0deg);
	}
	to {
		transform: rotate(360deg);
	}
}

.shofy-ig-viewer {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.95);
	opacity: 0;
	transition: opacity 0.2s ease;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.shofy-ig-viewer.is-open {
	display: flex;
	opacity: 1;
}

.shofy-ig-viewer.is-closing {
	opacity: 0;
}

.shofy-ig-viewer__stage {
	position: relative;
	width: 100%;
	max-width: 420px;
	height: 100%;
	max-height: 100vh;
	display: flex;
	flex-direction: column;
	user-select: none;
	touch-action: pan-y;
}

@media (min-width: 768px) {
	.shofy-ig-viewer__stage {
		height: min(90vh, 780px);
		border-radius: 8px;
		overflow: hidden;
	}
}

.shofy-ig-viewer__progress-wrap {
	position: absolute;
	top: 8px;
	left: 8px;
	right: 8px;
	z-index: 5;
	display: flex;
	gap: 4px;
}

.shofy-ig-viewer__progress {
	flex: 1;
	height: 2px;
	background: rgba(255, 255, 255, 0.35);
	border-radius: 2px;
	overflow: hidden;
}

.shofy-ig-viewer__progress-bar {
	display: block;
	width: 0%;
	height: 100%;
	background: #fff;
	border-radius: 2px;
	transform-origin: left center;
}

[dir="rtl"] .shofy-ig-viewer__progress-bar {
	transform-origin: right center;
}

.shofy-ig-viewer__progress.is-done .shofy-ig-viewer__progress-bar {
	width: 100%;
}

.shofy-ig-viewer__header {
	position: absolute;
	top: 20px;
	left: 12px;
	right: 12px;
	z-index: 6;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	color: #fff;
}

.shofy-ig-viewer__user {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
	text-decoration: none;
	color: #fff;
}

.shofy-ig-viewer__user-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	overflow: hidden;
	flex-shrink: 0;
	border: 1px solid rgba(255, 255, 255, 0.4);
}

.shofy-ig-viewer__user-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.shofy-ig-viewer__user-meta {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	min-width: 0;
}

.shofy-ig-viewer__user-name {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 180px;
}

.shofy-ig-viewer__user-time {
	font-size: 12px;
	opacity: 0.85;
}

.shofy-ig-viewer__actions {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
}

.shofy-ig-viewer__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #fff;
	cursor: pointer;
}

.shofy-ig-viewer__btn svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

.shofy-ig-viewer__btn--close svg {
	width: 22px;
	height: 22px;
}

.shofy-ig-viewer__media-wrap {
	position: relative;
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #000;
	overflow: hidden;
}

.shofy-ig-viewer__media {
	position: absolute;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
}

.shofy-ig-viewer__media.is-active {
	display: flex;
}

.shofy-ig-viewer__media img,
.shofy-ig-viewer__media video {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
	background: #000;
}

.shofy-ig-viewer__tap-zones {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 110px;
	z-index: 4;
	display: flex;
	pointer-events: none;
}

.shofy-ig-viewer__tap-prev,
.shofy-ig-viewer__tap-next {
	flex: 1;
	border: 0;
	padding: 0;
	margin: 0;
	background: transparent;
	cursor: pointer;
	pointer-events: auto;
}

.shofy-ig-viewer__tap-prev {
	flex: 0 0 30%;
}

.shofy-ig-viewer__tap-next {
	flex: 1;
	margin-right: 64px;
}

[dir="rtl"] .shofy-ig-viewer__tap-next {
	margin-right: 0;
	margin-left: 64px;
}

[dir="rtl"] .shofy-ig-viewer__tap-prev {
	margin-left: 64px;
}

.shofy-ig-viewer__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 7;
	display: none;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
	cursor: pointer;
	align-items: center;
	justify-content: center;
}

.shofy-ig-viewer__nav svg {
	width: 14px;
	height: 14px;
	fill: currentColor;
}

.shofy-ig-viewer__nav--prev {
	left: -48px;
}

.shofy-ig-viewer__nav--next {
	right: -48px;
}

@media (min-width: 992px) {
	.shofy-ig-viewer__nav {
		display: inline-flex;
	}
}

.shofy-ig-viewer.is-paused .shofy-ig-viewer__progress-bar.is-running {
	animation-play-state: paused !important;
}

.shofy-ig-viewer__link-cta {
	position: absolute;
	bottom: 24px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 8;
	display: none;
	padding: 10px 18px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.92);
	color: #262626;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}

.shofy-ig-viewer__link-cta.is-visible {
	display: inline-flex;
}

body.shofy-ig-viewer-open {
	overflow: hidden;
}

.shofy-ig-viewer__footer {
	position: absolute;
	right: 12px;
	bottom: 20px;
	z-index: 20;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 18px;
	pointer-events: auto;
}

[dir="rtl"] .shofy-ig-viewer__footer {
	right: auto;
	left: 12px;
}

.shofy-ig-viewer__btn--like,
.shofy-ig-viewer__btn--share {
	width: 40px;
	height: 40px;
	filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.45));
	pointer-events: auto;
	touch-action: manipulation;
}

.shofy-ig-viewer__btn--like .shofy-ig-viewer__icon-filled,
.shofy-ig-viewer__btn--like.is-liked .shofy-ig-viewer__icon-outline {
	display: none;
}

.shofy-ig-viewer__btn--like.is-liked .shofy-ig-viewer__icon-filled {
	display: block;
	fill: #ed4956;
}

.shofy-ig-viewer__btn--like.is-liked {
 animation: shofyIgLikePulse 0.35s ease;
}

.shofy-ig-viewer__btn--share svg {
	fill: none;
	stroke: currentColor;
}

.shofy-ig-viewer__heart-pop {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 9;
	width: 96px;
	height: 96px;
	margin: -48px 0 0 -48px;
	pointer-events: none;
	opacity: 0;
	transform: scale(0.2);
}

.shofy-ig-viewer__heart-pop svg {
	width: 100%;
	height: 100%;
	fill: #fff;
	filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.35));
}

.shofy-ig-viewer__heart-pop.is-active {
	animation: shofyIgHeartPop 0.9s ease forwards;
}

.shofy-ig-viewer__toast {
	position: absolute;
	left: 50%;
	bottom: 88px;
	z-index: 10;
	transform: translateX(-50%) translateY(12px);
	padding: 10px 16px;
	border-radius: 999px;
	background: rgba(38, 38, 38, 0.92);
	color: #fff;
	font-size: 13px;
	line-height: 1.3;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.shofy-ig-viewer__toast.is-visible {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

@keyframes shofyIgHeartPop {
	0% {
		opacity: 0;
		transform: scale(0.2);
	}
	15% {
		opacity: 1;
		transform: scale(1.05);
	}
	30% {
		transform: scale(0.95);
	}
	45%,
	100% {
		opacity: 0;
		transform: scale(1);
	}
}

@keyframes shofyIgLikePulse {
	0% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.18);
	}
	100% {
		transform: scale(1);
	}
}
