/**
 * Styles for Postory Post Story Gallery (Custom)
 */

/* -- Gallery Strip -- */
.stories-gallery {
	display: flex;
	gap: 15px;
	justify-content: flex-start;
	overflow-y: hidden;
	overflow-x: auto;
	padding: 10px 0;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
}

.stories-gallery .story-item {
	text-align: center;
	width: 115px;
	flex-shrink: 0;
}

.stories-gallery a.stories-thumb {
	display: block;
	cursor: pointer;
	text-decoration: none;
}

.stories-gallery a.stories-thumb img,
.stories-gallery a.stories-thumb div[style*="background"] {
	border-radius: 50%;
	width: 115px;
	height: 115px;
	object-fit: cover;
	border: 3px solid #5a61ff;
	padding: 1px;
	box-sizing: border-box;
	transition: transform 0.2s;
}

/* .stories-gallery a.stories-thumb:hover img {
	transform: scale(1.05);
} */

.stories-gallery .story-title {
	font-size: 12px;
	margin-top: 5px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: #000;
}

/* -- Gradient Thumb -- */
.postory-gradient-thumb {
	width: 115px;
	height: 115px;
	border-radius: 50%;
	border: 3px solid #5a61ff;
	padding: 1px;
	display: inline-block;
	box-sizing: border-box;
}

/* -- Postory Lightbox -- */

/* Spinner Animation */
@keyframes postory-spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

.postory-spinner {
	border: 3px solid rgba(255, 255, 255, 0.3);
	border-top: 3px solid #fff;
	border-radius: 50%;
	width: 30px;
	height: 30px;
	animation: postory-spin 1s linear infinite;
	margin: 0 auto;
}

.postory-spinner.on-page {
	border: 3px solid rgba(0, 0, 0, 0.1);
	border-top: 3px solid #5a61ff;
}

/* Overlay */
.postory-lightbox-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.9);
	z-index: 99999999;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease;
}

.postory-lightbox-overlay.active {
	opacity: 1;
	visibility: visible;
}

/* Container */
.postory-lightbox-container {
	position: relative;
	width: 100%;
	/* Default width set by JS */
	max-width: 800px;
	max-height: 95vh !important;
	background: #000; /* Dark background matching Insta style preference */
	background: #fff; /* Reset to white as per previous instruction */
	border-radius: 8px;
	overflow-y: auto;
	overflow-x: hidden;
	box-shadow: 0 10px 25px rgba(0,0,0,0.5);
	transform: scale(0.95);
	transition: transform 0.3s ease;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

.postory-lightbox-overlay.active .postory-lightbox-container {
	transform: scale(1);
}

/* Content Area */
.postory-content-area {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	box-sizing: border-box;
}

/* AJAX Loaded Content */
.story-ajax-content {
	width: 100%;
	height: 100%;
	box-sizing: border-box;
}

.story-ajax-content.has-padding {
	padding: 30px;
}

/* Image Content */
.postory-lightbox-container.type-image {
	background: transparent;
	box-shadow: none;
}

.postory-lightbox-container.type-image img {
	max-height: 95vh !important;
	width: auto;
	max-width: 100%;
	display: block;
	margin: 0 auto;
	border-radius: 4px;
	object-fit: contain;
}

/* Iframe / Video */
.postory-lightbox-iframe {
	width: 100%;
	height: 95vh !important;
	max-height: 95vh !important;
	border: none;
	display: block;
}

/* Close Button */
.postory-close-btn {
	position: absolute;
    top: 5px;
    right: 5px !important;
    left: auto !important;
    width: 30px;
    height: 30px;
    background: #000;
    color: #fff;
    border-radius: 10px; /* Corner styling */
    text-align: center;
    line-height: 30px;
    cursor: pointer;
    font-size: 20px;
    z-index: 999999999;
    transition: background 0.2s;
    backdrop-filter: blur(4px);
}

.postory-close-btn:hover {
	background: rgba(0, 0, 0, 0.8);
}

/* Navigation Wrapper */
.postory-nav-wrapper {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80px; /* Height of the gradient area */
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    box-sizing: border-box;
    z-index: 999999999;
    pointer-events: none; /* Let clicks pass through gradient area */
}

/* Navigation Buttons */
.postory-nav-btn {
    pointer-events: auto; /* Enable clicks on buttons */
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 24px;
    border-radius: 18px;
    user-select: none;
    transition: background 0.2s;
}

.postory-nav-btn:hover {
	background: rgba(0, 0, 0, 1);
}

/* Loader */
.postory-loader {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 999999999;
	color: #fff;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
	.postory-lightbox-overlay {
		padding: 0;
		background: #000;
	}

	.postory-lightbox-container {
		width: 100% !important;
		height: 100% !important;
		max-width: 100% !important;
		max-height: 100vh !important;
		border-radius: 0 !important;
		margin: 0 !important;
		background: #fff;
	}

	.postory-content-area {
		height: 100% !important;
	}

	.story-ajax-content {
		height: 100% !important;
		box-sizing: border-box;
	}

	.postory-lightbox-container.type-image img,
	.postory-lightbox-iframe {
		max-height: 100vh !important;
		height: 100% !important;
		object-fit: contain;
	}

	/* Mobile Close Button */
	.postory-close-btn {
		top: 10px;
		right: 10px !important;
		width: 40px;
		height: 40px;
		line-height: 40px;
		font-size: 24px;
        border-radius: 50%; /* Rounder for mobile touch */
        background: rgba(0,0,0,0.5);
	}
}

.story-content-body iframe {
    height: 90vh;
}

@media all and (max-width:768px) {
    .story-content-body iframe {
	    height: 100vh;
    }
}