/**
 * Frontend Styles - WP Insta Stories (Instagram UI - Category Highlights)
 */

/* ========================================================
   1. STORY RINGS GALLERY (HORIZONTAL SCROLL)
   ======================================================== */
.wp-insta-stories-container {
	position: relative;
	width: 100%;
	margin: 20px 0;
	direction: rtl; /* Support RTL Persian by default */
	font-family: inherit;
}

.wp-insta-stories-scroll-wrapper {
	display: flex;
	align-items: center;
	position: relative;
	overflow: hidden;
}

.wp-insta-stories-list {
	display: flex;
	gap: 16px;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-behavior: smooth;
	padding: 10px 8px;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none; /* Firefox */
	-ms-overflow-style: none; /* IE and Edge */
}

.wp-insta-stories-list::-webkit-scrollbar {
	display: none; /* Chrome, Safari, Opera */
}

/* Circle Style Item */
.wp-insta-style-circle .wp-insta-story-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	cursor: pointer;
	user-select: none;
	width: 82px;
	flex-shrink: 0;
	transition: transform 0.2s ease;
}

.wp-insta-style-circle .wp-insta-story-item:hover {
	transform: translateY(-2px);
}

.wp-insta-story-ring {
	width: 74px;
	height: 74px;
	border-radius: 50%;
	padding: 3px;
	background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
	transition: all 0.3s ease;
}

.wp-insta-story-item.is-viewed .wp-insta-story-ring {
	background: #c7c7c7 !important;
	box-shadow: none;
}

.wp-insta-story-avatar-wrap {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	border: 2.5px solid #ffffff;
	overflow: hidden;
	position: relative;
	background: #1e1e1e;
	display: flex;
	align-items: center;
	justify-content: center;
}

.wp-insta-story-avatar {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.wp-insta-story-item:hover .wp-insta-story-avatar {
	transform: scale(1.08);
}

/* Creative Badge: Slide Count inside Category */
.wp-insta-slide-count-badge {
	font-family: inherit;
	position: absolute;
	bottom: 2px;
	right: 2px;
	background: linear-gradient(135deg, #ff2a5f, #e60023);
	color: #fff;
	border-radius: 12px;
	padding: 1px 5px;
	font-size: 10px;
	font-weight: 700;
	line-height: 1.3;
	box-shadow: 0 2px 5px rgba(0,0,0,0.4);
	border: 1px solid #fff;
}

.wp-insta-story-title {
	font-family: inherit;
	font-size: 12px;
	font-weight: 600;
	color: #262626;
	margin-top: 6px;
	text-align: center;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 100%;
	line-height: 1.3;
}

/* Card Style Item */
.wp-insta-style-card .wp-insta-story-item {
	width: 110px;
	height: 170px;
	border-radius: 14px;
	overflow: hidden;
	position: relative;
	cursor: pointer;
	flex-shrink: 0;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
	transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.wp-insta-style-card .wp-insta-story-item:hover {
	transform: translateY(-4px);
	box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

.wp-insta-style-card .wp-insta-story-ring {
	width: 100%;
	height: 100%;
	border-radius: 0;
	padding: 0;
	background: none;
}

.wp-insta-style-card .wp-insta-story-avatar-wrap {
	border: none;
	border-radius: 0;
}

.wp-insta-style-card .wp-insta-story-title {
	font-family: inherit;
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	color: #fff;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
	padding: 20px 8px 8px 8px;
	font-size: 13px;
	font-weight: 600;
	text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

/* ========================================================
   2. INSTAGRAM FULLSCREEN VIEWER MODAL
   ======================================================== */
.wp-insta-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
	direction: rtl; /* RTL Persian layout */
	font-family: inherit;
}

.wp-insta-modal * {
	font-family: inherit;
}

.wp-insta-modal.is-active {
	opacity: 1;
	visibility: visible;
}

.wp-insta-modal-backdrop {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(10, 10, 10, 0.93);
	backdrop-filter: blur(18px);
	-webkit-backdrop-filter: blur(18px);
}

/* Close Button */
.wp-insta-modal-close-btn {
	position: absolute;
	top: 20px;
	left: 25px; /* RTL top-left */
	background: rgba(255, 255, 255, 0.15);
	border: none;
	color: #fff;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
	transition: background 0.2s ease, transform 0.2s ease;
}

.wp-insta-modal-close-btn:hover {
	background: rgba(255, 255, 255, 0.28);
	transform: scale(1.06);
}

/* Viewer Container */
.wp-insta-viewer-container {
	position: relative;
	width: 380px;
	max-width: 96vw;
	height: 82vh;
	max-height: 820px;
	min-height: 540px;
	background: #000000;
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
	display: flex;
	flex-direction: column;
	z-index: 10;
	user-select: none;
	transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

@media (max-width: 600px) {
	.wp-insta-viewer-container {
		width: 100vw;
		height: 100vh;
		max-height: none;
		min-height: auto;
		border-radius: 0;
	}
	.wp-insta-modal-close-btn {
		top: 15px;
		left: 15px;
		width: 38px;
		height: 38px;
	}
}

/* Top Progress Header */
.wp-insta-progress-header {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	display: flex;
	gap: 4px;
	padding: 12px 10px 4px 10px;
	z-index: 100;
	background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6) 0%, transparent 100%);
}

.wp-insta-progress-segment {
	flex: 1;
	height: 2.5px;
	background: rgba(255, 255, 255, 0.35);
	border-radius: 2px;
	overflow: hidden;
	position: relative;
}

.wp-insta-progress-fill {
	height: 100%;
	width: 0%;
	background: #ffffff;
	border-radius: 2px;
	transition: width 0.05s linear;
}

.wp-insta-progress-segment.is-completed .wp-insta-progress-fill {
	width: 100% !important;
}

.wp-insta-progress-segment.is-empty .wp-insta-progress-fill {
	width: 0% !important;
}

/* Top Header Bar */
.wp-insta-header-bar {
	position: absolute;
	top: 22px;
	left: 0;
	right: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 8px 14px;
	z-index: 100;
	color: #fff;
	background: linear-gradient(to bottom, rgba(0, 0, 0, 0.45) 0%, transparent 100%);
}

.wp-insta-header-left {
	display: flex;
	align-items: center;
	gap: 10px;
}

.wp-insta-header-avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	object-fit: cover;
	border: 1.5px solid #fff;
	box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.wp-insta-header-info {
	display: flex;
	flex-direction: column;
	justify-content: center;
}

.wp-insta-header-title {
	font-family: inherit;
	font-size: 13.5px;
	font-weight: 700;
	color: #ffffff;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
	line-height: 1.2;
}

.wp-insta-header-subtitle {
	font-family: inherit;
	font-size: 11.5px;
	color: rgba(255, 255, 255, 0.85);
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
	margin-top: 2px;
}

.wp-insta-header-right {
	display: flex;
	align-items: center;
	gap: 10px;
}

.wp-insta-control-btn {
	background: none;
	border: none;
	color: #ffffff;
	cursor: pointer;
	padding: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0.9;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.wp-insta-control-btn:hover {
	opacity: 1;
	transform: scale(1.1);
}

/* Toast Message */
.wp-insta-toast {
	font-family: inherit;
	position: absolute;
	top: 70px;
	left: 50%;
	transform: translateX(-50%);
	background: rgba(0, 0, 0, 0.85);
	color: #fff;
	padding: 8px 16px;
	border-radius: 20px;
	font-size: 12px;
	z-index: 200;
	box-shadow: 0 4px 12px rgba(0,0,0,0.5);
	white-space: nowrap;
	border: 1px solid rgba(255,255,255,0.2);
}

/* Main Media Viewport */
.wp-insta-media-viewport {
	width: 100%;
	height: 100%;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #000;
	overflow: hidden;
	perspective: 1200px;
}

.wp-insta-media-stage {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	transition: transform 0.45s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.45s ease;
	transform-style: preserve-3d;
}

/* Page Flip / Slide 3D Animations */
@keyframes wpInstaSlideNext {
	0% {
		transform: translateX(0) scale(1);
		opacity: 1;
	}
	40% {
		transform: translateX(-18%) scale(0.92) rotateY(-8deg);
		opacity: 0.6;
	}
	100% {
		transform: translateX(0) scale(1) rotateY(0deg);
		opacity: 1;
	}
}

@keyframes wpInstaSlidePrev {
	0% {
		transform: translateX(0) scale(1);
		opacity: 1;
	}
	40% {
		transform: translateX(18%) scale(0.92) rotateY(8deg);
		opacity: 0.6;
	}
	100% {
		transform: translateX(0) scale(1) rotateY(0deg);
		opacity: 1;
	}
}

.wp-insta-anim-next {
	animation: wpInstaSlideNext 0.45s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.wp-insta-anim-prev {
	animation: wpInstaSlidePrev 0.45s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.wp-insta-media-stage img,
.wp-insta-media-stage video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	pointer-events: none;
}

/* Loading Spinner */
.wp-insta-loader {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 20;
	display: none;
}

.wp-insta-loader.is-loading {
	display: block;
}

.wp-insta-spinner {
	width: 40px;
	height: 40px;
	border: 3.5px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: wpInstaSpin 0.8s infinite linear;
}

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

/* Navigation Touch/Click Zones */
.wp-insta-nav-zones {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	z-index: 50;
}

.wp-insta-zone {
	height: 100%;
}

.wp-insta-zone-prev {
	width: 30%;
	cursor: pointer;
}

.wp-insta-zone-next {
	width: 70%;
	cursor: pointer;
}

/* Footer CTA Button */
.wp-insta-footer-cta {
	position: absolute;
	bottom: 24px;
	left: 0;
	right: 0;
	display: flex;
	justify-content: center;
	z-index: 100;
	padding: 0 20px;
}

.wp-insta-cta-button {
	font-family: inherit;
	background: rgba(255, 255, 255, 0.95);
	color: #000;
	text-decoration: none;
	padding: 10px 24px;
	border-radius: 30px;
	font-size: 13.5px;
	font-weight: 700;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
	transition: all 0.25s ease;
	animation: wpInstaBounceUp 2s infinite ease-in-out;
}

.wp-insta-cta-button:hover {
	background: #ffffff;
	transform: translateY(-3px);
	box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
	color: #000;
}

@keyframes wpInstaBounceUp {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-5px); }
}

/* Desktop Arrow Buttons Outside Modal (Right = Prev / قبلی, Left = Next / بعدی) */
.wp-insta-arrow-btn {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
	border: none;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100;
	transition: all 0.2s ease;
}

.wp-insta-arrow-btn:hover {
	background: rgba(255, 255, 255, 0.3);
	transform: translateY(-50%) scale(1.08);
}

.wp-insta-arrow-prev {
	right: calc(50% - 250px);
}

.wp-insta-arrow-next {
	left: calc(50% - 250px);
}

@media (max-width: 860px) {
	.wp-insta-arrow-btn {
		display: none !important;
	}
}
