/**
 * KH Tube Ultimate v1.6 — share, discovery, ads, navigation polish
 */

/* Navigation active state */
.kh-tube-nav a.is-active,
.kh-tube-mobile-panel a.is-active {
	color: var(--kh-primary, #ec4899);
	font-weight: 800;
}

.kh-tube-nav-contact.is-active {
	box-shadow: inset 0 -2px 0 var(--kh-primary, #ec4899);
}

/* Share v1.6 */
.kh-tube-share--v16 {
	margin: 1rem 1.25rem 1.25rem;
	padding: 1rem;
	border: 1px solid var(--kh-border);
	border-radius: 16px;
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
}

.kh-tube-share--v16 .kh-tube-share-head {
	margin-bottom: 0.75rem;
}

.kh-tube-share--v16 .kh-tube-share-label {
	font-size: 0.78rem;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--kh-text-strong);
}

.kh-tube-share--v16 .kh-tube-share-grid {
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 0.55rem;
}

.kh-tube-share--v16 .kh-tube-share-btn {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	min-height: 76px;
	padding: 0.65rem 0.35rem;
	border: 1px solid var(--kh-border);
	border-radius: 14px;
	background: var(--kh-surface);
	color: var(--kh-text-strong);
	text-decoration: none;
	font-size: 0.7rem;
	font-weight: 700;
	line-height: 1.15;
	text-align: center;
	transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
	overflow: hidden;
	cursor: pointer;
	box-sizing: border-box;
}

.kh-tube-share--v16 .kh-tube-share-btn:hover,
.kh-tube-share--v16 .kh-tube-share-btn:focus-visible {
	transform: translateY(-2px);
	border-color: var(--kh-primary);
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
	outline: none;
}

.kh-tube-share--v16 .kh-tube-share-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.06);
	color: var(--kh-text-strong);
	flex-shrink: 0;
}

.kh-tube-share--v16 .kh-tube-share-icon--wa {
	background: rgba(37, 211, 102, 0.15);
	color: #25d366;
}

.kh-tube-share--v16 .kh-tube-share-icon--tg {
	background: rgba(34, 158, 217, 0.15);
	color: #229ed9;
}

.kh-tube-share--v16 .kh-tube-share-icon--fb {
	background: rgba(24, 119, 242, 0.15);
	color: #1877f2;
}

.kh-tube-share--v16 .kh-tube-share-icon--x {
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
}

.kh-tube-share--v16 .kh-tube-share-btn-text {
	display: block;
	width: 100%;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.kh-tube-share--v16 .kh-tube-share-btn.is-copied {
	border-color: #22c55e;
	background: rgba(34, 197, 94, 0.12);
	color: #86efac;
}

.kh-tube-single-article--v13 .kh-tube-share--v16 {
	margin-left: 0;
	margin-right: 0;
}

/* Related + discovery stack */
.kh-tube-single-discovery {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
	padding: 0 0 1.25rem;
}

.kh-tube-related--v16 {
	padding-top: 0.25rem;
}

.kh-tube-grid--related {
	gap: 1rem;
}

.kh-tube-related-ads.kh-tube-ad-zone {
	padding-top: 0.25rem;
}

/* Category slider */
.kh-tube-section--category-slider {
	padding: 0;
}

.kh-tube-category-slider {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0.35rem;
}

.kh-tube-category-slider-track {
	display: flex;
	gap: 0.85rem;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	padding: 0.25rem 0.15rem 0.75rem;
	scrollbar-width: none;
}

.kh-tube-category-slider-track::-webkit-scrollbar {
	display: none;
}

.kh-tube-category-slider-item {
	flex: 0 0 min(220px, 72vw);
	scroll-snap-align: start;
}

.kh-tube-category-slider-nav {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	min-width: 40px;
	border-radius: 999px;
	border: 1px solid var(--kh-border);
	background: var(--kh-surface);
	color: var(--kh-text-strong);
	cursor: pointer;
	transition: background 0.2s ease, transform 0.15s ease;
}

.kh-tube-category-slider-nav:hover {
	background: rgba(255, 255, 255, 0.08);
	transform: translateY(-1px);
}

/* Advertisement slots */
.kh-tube-ad-slot {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	margin: 0.85rem 0;
}

.kh-tube-ad-slot--sidebar_top,
.kh-tube-ad-slot--sidebar_bottom,
.kh-tube-ad-slot--related_videos {
	margin: 0;
}

.kh-tube-ad {
	position: relative;
	overflow: hidden;
	border-radius: 14px;
	border: 1px solid var(--kh-border);
	background: rgba(255, 255, 255, 0.02);
}

.kh-tube-ad-link,
.kh-tube-ad-img,
.kh-tube-ad-video-wrap,
.kh-tube-ad-code {
	display: block;
	width: 100%;
}

.kh-tube-ad-img {
	height: auto;
	max-width: 100%;
	object-fit: contain;
}

.kh-tube-ad-video-wrap {
	aspect-ratio: 16 / 9;
	background: #000;
}

.kh-tube-ad-video {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.kh-tube-ad-code {
	padding: 0.75rem;
	overflow: auto;
}

.kh-tube-slot--bottom,
.kh-tube-slot--top {
	margin: 0.75rem 0;
}

.kh-tube-widget--ad-bottom {
	margin-top: 0.25rem;
}

/* Popup ads */
.kh-tube-popup-ad {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.kh-tube-popup-ad[hidden] {
	display: none;
}

.kh-tube-popup-ad-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.72);
	backdrop-filter: blur(4px);
}

.kh-tube-popup-ad-dialog {
	position: relative;
	z-index: 2;
	width: min(640px, 100%);
	max-height: min(90vh, 720px);
	overflow: auto;
	border-radius: 18px;
	background: var(--kh-surface, #111);
	border: 1px solid var(--kh-border, rgba(255, 255, 255, 0.12));
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
	padding: 0.75rem;
}

.kh-tube-popup-ad-close {
	position: absolute;
	top: 0.5rem;
	right: 0.5rem;
	z-index: 3;
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
}

.kh-tube-popup-ad .kh-tube-ad {
	border: 0;
	background: transparent;
}

/* Responsive */
@media (max-width: 991px) {
	.kh-tube-share--v16 .kh-tube-share-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.kh-tube-category-slider-nav {
		display: none;
	}

	.kh-tube-category-slider-track {
		padding-bottom: 0.35rem;
	}
}

@media (max-width: 560px) {
	.kh-tube-share--v16 {
		margin-left: 0.85rem;
		margin-right: 0.85rem;
		padding: 0.85rem;
	}

	.kh-tube-share--v16 .kh-tube-share-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.kh-tube-share--v16 .kh-tube-share-btn {
		min-height: 68px;
	}

	.kh-tube-single-discovery {
		padding-left: 0.85rem;
		padding-right: 0.85rem;
	}
}
