/**
 * CommerceKit Stories Module Styles
 * CDM: Custom modification - Stories module CSS
 */

.commercekit-stories-wrapper {
	margin: 0;
	width: 100%;
}

.commercekit-stories-carousel {
	width: 100%;
	padding: 20px 0 0;
}

.commercekit-stories-carousel .swiper-wrapper {
	display: flex;
	align-items: stretch;
}

.commercekit-stories-carousel .swiper-slide {
	width: auto;
	height: auto;
	display: flex;
	flex-direction: column;
	cursor: pointer;
	margin-right: 20px;
}

.commercekit-stories-carousel .swiper-slide:last-child {
	margin-right: 0;
}

.commercekit-story-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
}

.commercekit-story-thumbnail {
	position: relative;
	width: 80px;
	height: 140px;
	border-radius: 12px;
	overflow: hidden;
	background: #f5f5f5;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 8px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	transition: box-shadow 0.2s ease;
}

.commercekit-story-thumbnail:hover {
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.commercekit-story-thumbnail img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.commercekit-story-placeholder {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	color: #fff;
}

.commercekit-story-placeholder svg {
	width: 40px;
	height: 40px;
	opacity: 0.8;
}


.commercekit-story-title {
	font-size: 12px;
	color: #666;
	margin-top: 4px;
	max-width: 80px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Modal Styles */
.commercekit-stories-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;

	display: flex;
	align-items: center;
	justify-content: center;

	background: rgba(0, 0, 0, 0.8);
	z-index: 99999;

	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.commercekit-stories-modal.active {
	opacity: 1;
	visibility: visible;
}

.commercekit-stories-modal-overlay {
	position: absolute;
	inset: 0;

	/* background: rgba(0, 0, 0, 0.3); */
	/* backdrop-filter: blur(4px); */

	z-index: 1;
}

.commercekit-stories-modal-content {
	position: relative;
	margin: auto;
	overflow-y: auto;
	width: 90%;
	max-width: 400px;
	max-height: calc(100vh - 60px);

	display: block;

	z-index: 9999999999;
}

.commercekit-stories-modal-close {
	position: absolute;
	top: 40px;
	right: 35px;
	width: 40px;
	height: 40px;
	background: rgba(255, 255, 255, 0.2);
	border: none;
	border-radius: 50%;
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease;
	z-index: 20;
}

.commercekit-stories-modal-close:hover {
	background: rgba(255, 255, 255, 0.3);
}

.commercekit-stories-modal-close svg {
	width: 24px;
	height: 24px;
}

/* Navigation arrows */
/* Tap zones (Instagram-style) */
.commercekit-stories-tap-zone {
	position: absolute;
	top: 0;
	height: 100%;
	width: 50%;
	z-index: 17;
	background: rgba(0, 0, 0, 0);
	cursor: pointer;
}

.commercekit-stories-tap-zone.tap-left {
	left: 0;
}

.commercekit-stories-tap-zone.tap-right {
	right: 0;
}

.commercekit-stories-video-container {
	position: relative;
	width: 100%;
	aspect-ratio: 9 / 16;

	/* constrain by parent, not viewport */
	calc(100vh - 80px);

	border-radius: 16px;
	overflow: hidden;
	background: #000;

	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.commercekit-stories-video {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: contain;
}

.commercekit-stories-progress-container {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 4px;
	display: flex;
	gap: 2px;
	padding: 8px;
	z-index: 15;
}

.commercekit-stories-progress-item {
	flex: 1;
	height: 3px;
	background: rgba(255, 255, 255, 0.3);
	border-radius: 2px;
	overflow: hidden;
}

.commercekit-stories-progress-item.active {
	background: rgba(255, 255, 255, 0.5);
}

.commercekit-stories-progress-item.completed .commercekit-stories-progress-bar {
	width: 100% !important;
}

.commercekit-stories-progress-bar {
	height: 100%;
	width: 0%;
	background: #fff;
	transition: width 0.1s linear;
}

/* Responsive adjustments */
@media (max-width: 768px) {
	.commercekit-stories-carousel .swiper-slide {
		margin-right: 12px;
	}

	.commercekit-story-thumbnail {
		width: 70px;
		height: 120px;
	}

	.commercekit-story-title {
		font-size: 11px;
		max-width: 70px;
	}

	.commercekit-stories-modal-content {
		padding: 10px;
	}

	.commercekit-stories-modal-close {
		top: 44px;
		right: 16px;
		width: 36px;
		height: 36px;
	}

	.commercekit-stories-prev {
		left: 15px;
	}
	
	.commercekit-stories-next {
		right: 15px;
	}
}

@media (min-width: 1024px) {
	.commercekit-stories-carousel .swiper-slide {
		margin-right: 12px;
	}
}

