/* CodeByCP Reels — frontend styles */

.ccp-reels {
	--ccp-accent: #7c5cff;
	--ccp-bar-bg: rgba(0, 0, 0, 0.65);
	--ccp-fill: #7c5cff;
	--ccp-track: rgba(255, 255, 255, 0.3);
	width: 100%;
	box-sizing: border-box;
}

.ccp-reels *,
.ccp-reels *::before,
.ccp-reels *::after {
	box-sizing: border-box;
}

/* Heading */
.ccp-reels-head {
	margin-bottom: 32px;
	text-align: center;
}

.ccp-reels-title {
	margin: 0 0 10px;
	color: #fff;
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: -0.02em;
}

.ccp-reels-sub {
	margin: 0;
	color: rgba(255, 255, 255, 0.65);
	line-height: 1.6;
	max-width: 620px;
	display: inline-block;
}

.ccp-reels-grid {
	display: grid;
	grid-template-columns: repeat(var(--ccp-cols, 4), minmax(0, 1fr));
	gap: var(--ccp-gap, 18px);
	width: 100%;
}

/* ---------- Slider ---------- */
.ccp-reels-slider {
	position: relative;
	width: 100%;
}

.ccp-reels-track {
	display: flex;
	gap: var(--ccp-gap, 18px);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	padding-bottom: 2px;
}

.ccp-reels-track::-webkit-scrollbar {
	display: none;
}

.ccp-reels-track > .ccp-reel-card {
	flex: 0 0 calc((100% - (var(--ccp-cols, 4) - 1) * var(--ccp-gap, 18px)) / var(--ccp-cols, 4));
	scroll-snap-align: start;
}

/* Arrows */
.ccp-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 8;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	border: 1px solid rgba(255, 255, 255, 0.15);
	background-color: rgba(255, 255, 255, 0.08);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background-color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.ccp-arrow svg {
	fill: #fff;
}

.ccp-arrow:hover {
	background-color: rgba(255, 255, 255, 0.18);
}

.ccp-arrow.ccp-prev {
	left: -10px;
}

.ccp-arrow.ccp-next {
	right: -10px;
}

.ccp-arrow.is-disabled {
	opacity: 0.3;
	pointer-events: none;
}

/* Dots */
.ccp-reels-dots {
	display: flex;
	justify-content: center;
	gap: 8px;
	margin-top: 18px;
}

.ccp-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	border: 0;
	padding: 0;
	background-color: rgba(255, 255, 255, 0.3);
	cursor: pointer;
	transition: transform 0.2s ease, background-color 0.2s ease;
}

.ccp-dot.is-active {
	background-color: #7c5cff;
	transform: scale(1.3);
}

@media ( max-width: 600px ) {
	.ccp-arrow.ccp-prev { left: 4px; }
	.ccp-arrow.ccp-next { right: 4px; }
}

/* Card */
.ccp-reel-card {
	background-color: #141414;
	border-radius: 18px;
	overflow: hidden;
	position: relative;
	transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.ccp-reel-card:hover {
	transform: translateY(-4px);
}

/* Media wrapper (keeps aspect ratio) */
.ccp-reel-media {
	position: relative;
	width: 100%;
	aspect-ratio: 9 / 16;
	background: #000;
	overflow: hidden;
	cursor: pointer;
}

.ccp-video,
.ccp-yt-mount,
.ccp-yt-mount iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border: 0;
	display: block;
}

/* Poster */
.ccp-poster {
	position: absolute;
	inset: 0;
	background-size: cover;
	background-position: center;
	z-index: 2;
	transition: opacity 0.4s ease;
}

.ccp-reel-media.is-playing .ccp-poster,
.ccp-reel-media.is-started .ccp-poster {
	opacity: 0;
	pointer-events: none;
}

/* Big center play button */
.ccp-bigplay {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 64px;
	height: 64px;
	border-radius: 50%;
	border: 0;
	background-color: rgba(0, 0, 0, 0.45);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	z-index: 4;
	transition: transform 0.2s ease, opacity 0.3s ease, background-color 0.2s ease;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.ccp-bigplay svg {
	fill: #fff;
	transform: translateX(1px);
}

.ccp-bigplay:hover {
	transform: translate(-50%, -50%) scale(1.08);
}

.ccp-reel-media.is-playing .ccp-bigplay {
	opacity: 0;
	pointer-events: none;
}

.ccp-reel-media.is-playing:hover .ccp-bigplay {
	opacity: 1;
	pointer-events: auto;
}

/* Control bar */
.ccp-bar {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 5;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	background: linear-gradient(to top, var(--ccp-bar-bg), rgba(0, 0, 0, 0));
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.3s ease, transform 0.3s ease;
	pointer-events: none;
}

.ccp-reel-media:hover .ccp-bar,
.ccp-reel-media.is-playing .ccp-bar,
.ccp-reel-media.is-touch .ccp-bar {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

.ccp-bar button {
	background: transparent;
	border: 0;
	padding: 4px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	line-height: 0;
	border-radius: 6px;
	transition: background-color 0.2s ease;
}

.ccp-bar button:hover {
	background: rgba(255, 255, 255, 0.12);
}

.ccp-bar button svg {
	fill: #fff;
}

.ccp-spacer {
	flex: 1 1 auto;
}

/* Range sliders (seek + volume) */
.ccp-bar input[type="range"] {
	-webkit-appearance: none;
	appearance: none;
	height: 4px;
	border-radius: 999px;
	background: var(--ccp-track);
	cursor: pointer;
	outline: none;
	margin: 0;
}

.ccp-seek {
	flex: 1 1 auto;
	min-width: 40px;
}

.ccp-volume {
	flex: 0 0 64px;
	width: 64px;
}

/* Filled portion via gradient set in JS through --val */
.ccp-bar input[type="range"] {
	background: linear-gradient(
		to right,
		var(--ccp-fill) 0%,
		var(--ccp-fill) var(--val, 0%),
		var(--ccp-track) var(--val, 0%),
		var(--ccp-track) 100%
	);
}

.ccp-bar input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: #fff;
	border: 2px solid var(--ccp-fill);
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
	transition: transform 0.15s ease;
}

.ccp-bar input[type="range"]::-webkit-slider-thumb:hover {
	transform: scale(1.2);
}

.ccp-bar input[type="range"]::-moz-range-thumb {
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: #fff;
	border: 2px solid var(--ccp-fill);
}

/* Caption */
.ccp-reel-caption {
	color: #fff;
	padding: 12px 14px;
	font-size: 14px;
	line-height: 1.4;
}

/* Loading shimmer for youtube mounts */
.ccp-reel--youtube .ccp-yt-mount {
	background: #000;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
	.ccp-reel-card,
	.ccp-bigplay,
	.ccp-bar,
	.ccp-poster {
		transition: none;
	}
}
