/**
 * Video Player Block - Frontend Styles
 */

.wp-block-ausqual-video-player {
	position: relative;
	border-radius: 15px;
	overflow: hidden;
	background: #1F2828;
	width: 100%;
	/* Default aspect-ratio, overridden by inline style from block attributes */
	aspect-ratio: 16/9;
}

/* Poster overlay */
.ausqual-video-player__poster {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: opacity 0.3s ease;
}

.ausqual-video-player__poster.is-hidden {
	opacity: 0;
	pointer-events: none;
	visibility: hidden;
}

.ausqual-video-player__poster img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Play button */
.ausqual-video-player__play {
	position: relative;
	z-index: 3;
	width: 70px;
	height: 70px;
	background: var(--wp--preset--color--grains, #FFD861);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.ausqual-video-player__play svg {
	width: 30px;
	height: 30px;
	color: var(--wp--preset--color--fertiliser, #1F2828);
}

.ausqual-video-player__play:hover,
.ausqual-video-player__play:focus {
	transform: scale(1.1);
	box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
}

.ausqual-video-player__play:focus {
	outline: 2px solid var(--wp--preset--color--base, #fff);
	outline-offset: 2px;
}

/* Video container */
.ausqual-video-player__video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.ausqual-video-player__video.is-active {
	opacity: 1;
	z-index: 1;
}

/* No poster: show first frame of HTML5 video behind transparent overlay */
.ausqual-video-player__poster.has-no-poster {
	background: transparent;
}

.ausqual-video-player__poster.has-no-poster ~ .ausqual-video-player__video {
	opacity: 1;
}

.ausqual-video-player__video video,
.ausqual-video-player__video iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: none;
}

/* =============================================
   Custom Controls Bar
   ============================================= */

.ausqual-video-player__controls {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: 4;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 16px;
	background: linear-gradient(transparent, rgba(31, 40, 40, 0.85));
	opacity: 0;
	transition: opacity 0.3s ease;
	pointer-events: none;
}

.ausqual-video-player__controls.is-visible {
	opacity: 1;
	pointer-events: auto;
}

/* Buttons */
.ausqual-vp__btn {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: none;
	border-radius: 4px;
	background: transparent;
	color: var(--wp--preset--color--base, #fff);
	cursor: pointer;
	transition: background 0.15s ease;
}

.ausqual-vp__btn:hover {
	background: rgba(255, 255, 255, 0.15);
}

.ausqual-vp__btn:focus-visible {
	outline: 2px solid var(--wp--preset--color--grains, #FFD861);
	outline-offset: 2px;
}

/* Time display */
.ausqual-vp__time {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	gap: 3px;
	font-size: 13px;
	font-variant-numeric: tabular-nums;
	color: var(--wp--preset--color--base, #fff);
	line-height: 1;
	white-space: nowrap;
}

.ausqual-vp__separator {
	opacity: 0.6;
}

/* Progress bar */
.ausqual-vp__progress {
	flex: 1;
	position: relative;
	height: 20px;
	display: flex;
	align-items: center;
	cursor: pointer;
}

.ausqual-vp__progress-buffered,
.ausqual-vp__progress-filled {
	position: absolute;
	top: 50%;
	left: 0;
	height: 4px;
	transform: translateY(-50%);
	border-radius: 2px;
	pointer-events: none;
}

.ausqual-vp__progress-buffered {
	width: 0;
	background: rgba(255, 255, 255, 0.3);
}

.ausqual-vp__progress-filled {
	width: 0;
	background: var(--wp--preset--color--grains, #FFD861);
	z-index: 1;
}

.ausqual-vp__progress-input {
	position: relative;
	z-index: 2;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	background: transparent;
}

/* Range input track */
.ausqual-vp__progress-input::-webkit-slider-runnable-track {
	height: 4px;
	border-radius: 2px;
	background: rgba(255, 255, 255, 0.2);
}

.ausqual-vp__progress-input::-moz-range-track {
	height: 4px;
	border-radius: 2px;
	background: rgba(255, 255, 255, 0.2);
	border: none;
}

/* Range input thumb */
.ausqual-vp__progress-input::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: var(--wp--preset--color--grains, #FFD861);
	border: none;
	margin-top: -5px;
	cursor: pointer;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
	transition: transform 0.1s ease;
}

.ausqual-vp__progress-input::-moz-range-thumb {
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: var(--wp--preset--color--grains, #FFD861);
	border: none;
	cursor: pointer;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
	transition: transform 0.1s ease;
}

.ausqual-vp__progress-input:hover::-webkit-slider-thumb {
	transform: scale(1.2);
}

.ausqual-vp__progress-input:hover::-moz-range-thumb {
	transform: scale(1.2);
}

/* Volume slider */
.ausqual-vp__volume {
	flex-shrink: 0;
	width: 70px;
	height: 4px;
	margin: 0;
	padding: 0;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	background: transparent;
}

.ausqual-vp__volume::-webkit-slider-runnable-track {
	height: 4px;
	border-radius: 2px;
	background: rgba(255, 255, 255, 0.2);
}

.ausqual-vp__volume::-moz-range-track {
	height: 4px;
	border-radius: 2px;
	background: rgba(255, 255, 255, 0.2);
	border: none;
}

.ausqual-vp__volume::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--wp--preset--color--grains, #FFD861);
	border: none;
	margin-top: -4px;
	cursor: pointer;
}

.ausqual-vp__volume::-moz-range-thumb {
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--wp--preset--color--grains, #FFD861);
	border: none;
	cursor: pointer;
}

/* Responsive adjustments */
@media (max-width: 600px) {
	.ausqual-video-player__play {
		width: 56px;
		height: 56px;
	}

	.ausqual-video-player__play svg {
		width: 24px;
		height: 24px;
	}

	.ausqual-video-player__controls {
		gap: 6px;
		padding: 8px 10px;
	}

	.ausqual-vp__time {
		font-size: 11px;
	}

	.ausqual-vp__volume {
		width: 50px;
	}

	.ausqual-vp__btn {
		width: 28px;
		height: 28px;
	}

	.ausqual-vp__btn svg {
		width: 16px;
		height: 16px;
	}
}