/* ============================================================
   Player Adsventure - Frontend Player Styles
   ============================================================ */

.pav-player-wrapper {
	display: block;
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
}

.pav-player-container {
	position: relative;
	background: #000;
	overflow: hidden;
	border-radius: 6px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, .4);
	/* Responsive 16:9 by default — overridden inline when a custom ratio is set */
	aspect-ratio: 16 / 9;
	/* Fallback for browsers without aspect-ratio support */
	width: 100%;
}

/* Fallback padding-bottom trick for very old browsers */
@supports not (aspect-ratio: 1) {
	.pav-player-container::before {
		content: '';
		display: block;
		padding-top: 56.25%; /* 9/16 */
	}
}

/* Video element fills the container */
.pav-video-element {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	background: #000;
	cursor: pointer;
	outline: none;
	display: block;
}

/* Ad container sits on top of the video */
.pav-ad-container {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 10;
}

/* IMA requires pointer-events enabled on the ad container when ads play */
.pav-ad-container iframe,
.pav-ad-container .ima-controls-div,
.pav-ad-container .ima-countdown-div {
	pointer-events: auto;
}

/* Play overlay */
.pav-play-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 5;
	cursor: pointer;
	transition: opacity .2s;
}

.pav-play-overlay:hover .pav-play-btn svg circle {
	fill: rgba(0, 0, 0, .75);
}

.pav-play-btn {
	background: none;
	border: none;
	padding: 0;
	cursor: pointer;
	line-height: 0;
	box-shadow: none;
	outline: none;
}

.pav-play-btn:hover,
.pav-play-btn:focus,
.pav-play-btn:active {
	background: none;
	box-shadow: none;
	outline: none;
}

.pav-play-btn svg {
	width: 72px;
	height: 72px;
	filter: drop-shadow( 0 2px 8px rgba(0,0,0,.5) );
	transition: transform .15s;
}

.pav-play-btn:hover svg {
	transform: scale(1.1);
}

/* ── Controls bar ──────────────────────────────────────────── */
.pav-controls {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 6px 10px;
	background: linear-gradient(transparent, rgba(0,0,0,.75));
	z-index: 6;
	opacity: 0;
	transition: opacity .25s;
	box-sizing: border-box;
}

.pav-player-container:hover .pav-controls,
.pav-player-container.pav-paused .pav-controls {
	opacity: 1;
}

/* hide controls completely while ad is playing */
.pav-player-container.pav-ad-playing .pav-controls {
	display: none;
}

.pav-ctrl-btn {
	background: none;
	border: none;
	padding: 4px;
	cursor: pointer;
	line-height: 0;
	flex-shrink: 0;
	color: #fff;
	box-shadow: none;
	outline: none;
	text-decoration: none;
}

.pav-ctrl-btn:hover,
.pav-ctrl-btn:focus,
.pav-ctrl-btn:active {
	background: none;
	color: #fff;
	box-shadow: none;
	outline: none;
	opacity: .8;
}

.pav-ctrl-btn svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: #fff;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
	display: block;
}

.pav-ctrl-play svg {
	width: 20px;
	height: 20px;
}

.pav-icon-play {
	fill: #fff;
	stroke: none !important;
}

.pav-icon-pause rect {
	fill: #fff;
	stroke: none !important;
}

.pav-icon-mute line {
	stroke: #fff;
	fill: none;
}

/* Progress bar */
.pav-progress-wrap {
	flex: 1;
	padding: 8px 0;
	cursor: pointer;
	position: relative;
}

.pav-progress-track {
	height: 4px;
	background: rgba(255,255,255,.3);
	border-radius: 4px;
	position: relative;
}

.pav-progress-fill {
	height: 100%;
	width: 0;
	background: #fff;
	border-radius: 4px;
	pointer-events: none;
	transition: width .1s linear;
}

.pav-progress-thumb {
	position: absolute;
	top: 50%;
	left: 0;
	width: 12px;
	height: 12px;
	background: #fff;
	border-radius: 50%;
	transform: translate(-50%, -50%) scale(0);
	transition: transform .15s;
	pointer-events: none;
}

.pav-progress-wrap:hover .pav-progress-thumb {
	transform: translate(-50%, -50%) scale(1);
}

.pav-progress-wrap:hover .pav-progress-track {
	height: 6px;
}

/* Time labels */
.pav-time-current,
.pav-time-total {
	font-size: 11px;
	color: #fff;
	white-space: nowrap;
	font-family: monospace;
	flex-shrink: 0;
}

/* Touch devices: always show controls, larger hit targets */
@media (hover: none) {
	.pav-controls {
		opacity: 1;
		padding: 4px 8px;
	}
	.pav-progress-thumb {
		transform: translate(-50%, -50%) scale(1);
		width: 14px;
		height: 14px;
	}
	.pav-progress-track {
		height: 5px;
	}
}

/* Small screens: compact controls */
@media (max-width: 480px) {
	.pav-controls {
		gap: 4px;
		padding: 4px 8px;
	}
	.pav-ctrl-btn svg {
		width: 15px;
		height: 15px;
	}
	.pav-ctrl-play svg {
		width: 17px;
		height: 17px;
	}
	.pav-time-current,
	.pav-time-total {
		font-size: 10px;
	}
	.pav-play-btn svg {
		width: 54px;
		height: 54px;
	}
}

.pav-error {
	color: #c00;
	padding: 10px;
	border: 1px solid #c00;
	border-radius: 4px;
}

/* ============================================================
   Admin Styles
   ============================================================ */
.pav-wrap h1 .dashicons {
	margin-right: 6px;
	vertical-align: middle;
}

.pav-settings-grid {
	display: grid;
	grid-template-columns: 1fr 420px;
	gap: 20px;
	margin-top: 20px;
	align-items: start;
}

.pav-sidebar-wide {
	min-width: 0;
}

@media (max-width: 960px) {
	.pav-settings-grid {
		grid-template-columns: 1fr;
	}
}

/* Cards */
.pav-card {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 6px;
	box-shadow: 0 1px 3px rgba(0,0,0,.06);
	overflow: hidden;
	margin-bottom: 20px;
}

.pav-card-header {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 14px 20px;
	border-bottom: 1px solid #f0f0f1;
	background: #f9f9f9;
}

.pav-card-header h2 {
	margin: 0;
	font-size: 14px;
	font-weight: 600;
}

.pav-card-header .dashicons {
	color: #2271b1;
}

.pav-badge {
	margin-left: auto;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 11px;
	font-weight: 600;
	padding: 2px 10px;
	border-radius: 20px;
}

.pav-badge-ok {
	background: #d8f1de;
	color: #1a6630;
}

.pav-badge-ok .dashicons {
	color: #1a6630 !important;
	font-size: 14px;
	width: 14px;
	height: 14px;
}

.pav-card-body {
	padding: 20px;
}

.pav-card-body.pav-no-padding {
	padding: 0;
}

.pav-card-info .pav-card-body code {
	display: block;
	padding: 6px 10px;
	background: #f0f0f1;
	border-radius: 4px;
	font-size: 12px;
	margin: 6px 0 12px;
	word-break: break-all;
}

.pav-card-info ul {
	list-style: disc;
	padding-left: 18px;
}

.pav-card-info ul li {
	margin-bottom: 4px;
}

/* Settings table rows */
.pav-field-row {
	display: flex;
	gap: 16px;
	align-items: center;
	margin-top: 12px;
}

.form-table th {
	width: 200px;
}

/* Drop zone */
.pav-drop-zone {
	border: 2px dashed #c3c4c7;
	border-radius: 8px;
	padding: 40px 20px;
	text-align: center;
	cursor: pointer;
	transition: border-color .2s, background .2s;
	position: relative;
}

.pav-drop-zone:hover,
.pav-drop-zone.drag-over {
	border-color: #2271b1;
	background: #f0f6fc;
}

.pav-drop-zone.disabled {
	opacity: .5;
	pointer-events: none;
}

.pav-drop-zone input[type="file"] {
	position: absolute;
	inset: 0;
	opacity: 0;
	/* pointer-events: none so drag events reach the parent div.
	   Clicks are forwarded programmatically via JS. */
	pointer-events: none;
	width: 100%;
	height: 100%;
}

.pav-drop-icon {
	font-size: 48px !important;
	width: 48px !important;
	height: 48px !important;
	color: #2271b1;
}

.pav-drop-text {
	font-size: 15px;
	font-weight: 500;
	color: #1d2327;
	margin: 10px 0 4px;
}

.pav-drop-hint {
	font-size: 12px;
	color: #8c8f94;
	margin: 0;
}

/* Selected file */
.pav-selected-file {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 14px;
	background: #f0f6fc;
	border: 1px solid #2271b1;
	border-radius: 6px;
	margin-bottom: 16px;
}

.pav-selected-file .dashicons {
	color: #2271b1;
}

.pav-filesize {
	font-size: 12px;
	color: #8c8f94;
	margin-left: auto;
}

#pav-clear-file {
	color: #a00;
	font-size: 16px;
	line-height: 1;
}

/* Progress bar */
.pav-upload-progress {
	margin: 16px 0;
}

.pav-progress-bar-wrapper {
	background: #e9eff5;
	border-radius: 20px;
	height: 12px;
	overflow: hidden;
}

.pav-progress-bar {
	height: 100%;
	width: 0;
	background: linear-gradient(90deg, #2271b1, #72aee6);
	border-radius: 20px;
	transition: width .3s ease;
}

.pav-progress-label {
	font-size: 12px;
	color: #50575e;
	display: block;
	margin-top: 4px;
}

/* Upload message */
#pav-upload-message.notice {
	margin: 12px 0 0;
	padding: 10px 14px;
}

/* Video list table */
.pav-videos-table {
	margin: 0 !important;
	border: 0 !important;
}

.pav-videos-table th,
.pav-videos-table td {
	padding: 10px 16px !important;
	vertical-align: middle !important;
}

.pav-shortcode-code {
	font-size: 11px;
	padding: 2px 6px;
	background: #f0f0f1;
	border-radius: 3px;
}

.pav-copy-btn {
	color: #2271b1;
	margin-left: 4px;
}

.pav-copy-btn:hover {
	color: #135e96;
}

.pav-url-link {
	font-size: 11px;
	color: #8c8f94;
	word-break: break-all;
}

.pav-delete-btn {
	color: #c00 !important;
}

.pav-empty-state {
	text-align: center;
	padding: 30px;
	color: #8c8f94;
}

.pav-empty-state .dashicons {
	font-size: 32px;
	width: 32px;
	height: 32px;
}

/* Thumbnail picker */
.pav-thumb-picker {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.pav-thumb-preview {
	position: relative;
	display: inline-block;
}

.pav-thumb-preview img {
	width: 120px;
	height: 68px;
	object-fit: cover;
	border-radius: 4px;
	border: 1px solid #c3c4c7;
	display: block;
}

.pav-thumb-remove {
	position: absolute;
	top: -6px;
	right: -6px;
	background: #d63638;
	color: #fff;
	border: none;
	border-radius: 50%;
	width: 18px;
	height: 18px;
	font-size: 10px;
	line-height: 18px;
	text-align: center;
	cursor: pointer;
	padding: 0;
}

/* Test connection result */
.pav-test-result {
	margin-left: 10px;
	font-weight: 500;
}

.pav-test-result.ok   { color: #00a32a; }
.pav-test-result.fail { color: #d63638; }

/* Responsive */
@media (max-width: 640px) {
	.pav-play-btn svg {
		width: 54px;
		height: 54px;
	}
}
