/**
 * KH Tube Ultimate v1.8 — premium UX, stable interactions, visual polish
 */

/* Section headings */
.kh-tube-section-head--v18 {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1.1rem;
	padding-bottom: 0.85rem;
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.kh-tube-section-head--v18 .kh-tube-section-accent {
	width: 4px;
	height: 100%;
	min-height: 42px;
	border-radius: 999px;
	background: linear-gradient(180deg, var(--kh-primary, #ec4899), #a855f7);
	box-shadow: 0 0 18px rgba(236, 72, 153, 0.35);
}

.kh-tube-section-head--v18 .kh-tube-section-head-main {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	min-width: 0;
}

.kh-tube-section-head--v18 .kh-tube-section-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	border-radius: 14px;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid var(--kh-border);
	color: var(--kh-primary, #ec4899);
	flex-shrink: 0;
}

.kh-tube-section-head--v18 .kh-tube-section-title {
	margin: 0;
	font-size: clamp(1.05rem, 2vw, 1.35rem);
	font-weight: 800;
	line-height: 1.2;
	color: var(--kh-text-strong);
}

.kh-tube-section-head--v18 .kh-tube-section-subtitle {
	margin: 0.2rem 0 0;
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--kh-text-muted, rgba(255, 255, 255, 0.62));
}

.kh-tube-section-head--v18 .kh-tube-link-more {
	display: inline-flex;
	align-items: center;
	gap: 0.2rem;
	padding: 0.45rem 0.75rem;
	border-radius: 999px;
	border: 1px solid var(--kh-border);
	background: rgba(255, 255, 255, 0.03);
	font-size: 0.78rem;
	font-weight: 800;
	text-decoration: none;
	color: var(--kh-text-strong);
	transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
	white-space: nowrap;
}

.kh-tube-section-head--v18 .kh-tube-link-more:hover,
.kh-tube-section-head--v18 .kh-tube-link-more:focus-visible {
	background: rgba(255, 255, 255, 0.07);
	border-color: rgba(236, 72, 153, 0.35);
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
	outline: none;
}

/* Premium cards v1.8 */
.kh-tube-card--v18 {
	position: relative;
}

.kh-tube-card--v18 .kh-tube-card-link {
	border-radius: 18px;
	overflow: hidden;
	border: 1px solid var(--kh-border);
	background: var(--kh-surface);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
	transition: box-shadow 0.22s ease, border-color 0.22s ease;
}

.kh-tube-card--v18 .kh-tube-card-link:hover,
.kh-tube-card--v18 .kh-tube-card-link:focus-visible {
	box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22);
	border-color: rgba(236, 72, 153, 0.35);
	outline: none;
	transform: none;
}

.kh-tube-card--v18 .kh-tube-card-thumb {
	aspect-ratio: 16 / 9;
}

.kh-tube-card--v18 .kh-tube-card-img {
	transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.kh-tube-card--v18 .kh-tube-card-link:hover .kh-tube-card-img,
.kh-tube-card--v18 .kh-tube-card-link:focus-visible .kh-tube-card-img {
	transform: scale(1.06);
}

.kh-tube-card--v18 .kh-tube-card-overlay {
	background: linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.72) 100%);
}

.kh-tube-card--v18 .kh-tube-card-play {
	opacity: 0.92;
	transition: transform 0.2s ease, opacity 0.2s ease;
}

.kh-tube-card--v18 .kh-tube-card-link:hover .kh-tube-card-play,
.kh-tube-card--v18 .kh-tube-card-link:focus-visible .kh-tube-card-play {
	transform: scale(1.08);
	opacity: 1;
}

.kh-tube-card--v18 .kh-tube-card-duration {
	font-size: 0.72rem;
	font-weight: 800;
	padding: 0.28rem 0.5rem;
	border-radius: 8px;
	background: rgba(0, 0, 0, 0.72);
	backdrop-filter: blur(6px);
}

.kh-tube-card--v18 .kh-tube-card-title {
	font-size: 0.92rem;
	font-weight: 800;
	line-height: 1.35;
}

.kh-tube-card--v18 .kh-tube-card-meta {
	font-size: 0.76rem;
	font-weight: 700;
	color: var(--kh-text-muted, rgba(255, 255, 255, 0.68));
}

.kh-tube-card--v18 .kh-tube-card-views {
	color: var(--kh-text-strong);
}

.kh-tube-card-badge--trend,
.kh-tube-card-badge--popular,
.kh-tube-card-badge--featured {
	position: absolute;
	top: 0.65rem;
	left: 0.65rem;
	z-index: 3;
	padding: 0.28rem 0.55rem;
	border-radius: 999px;
	font-size: 0.68rem;
	font-weight: 800;
	letter-spacing: 0.02em;
	backdrop-filter: blur(8px);
}

.kh-tube-card-badge--trend {
	background: rgba(249, 115, 22, 0.88);
	color: #fff;
}

.kh-tube-card-badge--popular {
	background: rgba(168, 85, 247, 0.88);
	color: #fff;
}

.kh-tube-card-badge--featured {
	background: rgba(236, 72, 153, 0.88);
	color: #fff;
}

.kh-tube-card-signal {
	display: inline-flex;
	align-items: center;
	font-size: 0.72rem;
	font-weight: 800;
	margin-bottom: 0.15rem;
}

.kh-tube-card-signal--trend {
	color: #fb923c;
}

.kh-tube-card-signal--popular {
	color: #c084fc;
}

.kh-tube-card--v18.kh-tube-card--ranked .kh-tube-card-rank {
	background: linear-gradient(135deg, #ec4899, #a855f7);
	box-shadow: 0 8px 18px rgba(236, 72, 153, 0.35);
}

/* Share bar v1.8 */
.kh-tube-share--v18 {
	margin: 1rem 0 1.25rem;
	padding: 1rem;
	border-radius: 18px;
	border: 1px solid var(--kh-border);
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
	box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

.kh-tube-share-bar-head {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	margin-bottom: 0.85rem;
}

.kh-tube-share-bar-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 10px;
	background: rgba(236, 72, 153, 0.12);
	color: var(--kh-primary, #ec4899);
}

.kh-tube-share-bar-label {
	font-size: 0.88rem;
	font-weight: 800;
	color: var(--kh-text-strong);
}

.kh-tube-share-bar {
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 0.55rem;
}

.kh-tube-share-action {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.45rem;
	min-height: 78px;
	padding: 0.65rem 0.4rem;
	border-radius: 14px;
	border: 1px solid var(--kh-border);
	background: rgba(255, 255, 255, 0.04);
	color: var(--kh-text-strong);
	text-decoration: none;
	font-size: 0.72rem;
	font-weight: 800;
	line-height: 1.15;
	text-align: center;
	cursor: pointer;
	transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.2s ease;
}

.kh-tube-share-action:hover,
.kh-tube-share-action:focus-visible {
	background: rgba(255, 255, 255, 0.08);
	border-color: rgba(236, 72, 153, 0.35);
	box-shadow: 0 10px 22px rgba(0, 0, 0, 0.16);
	outline: none;
}

.kh-tube-share-action-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 11px;
	background: rgba(255, 255, 255, 0.06);
	transition: transform 0.18s ease;
}

.kh-tube-share-action:hover .kh-tube-share-action-icon,
.kh-tube-share-action:focus-visible .kh-tube-share-action-icon {
	transform: scale(1.08);
}

.kh-tube-share-action-icon--wa { background: rgba(37, 211, 102, 0.15); color: #25d366; }
.kh-tube-share-action-icon--tg { background: rgba(34, 158, 217, 0.15); color: #229ed9; }
.kh-tube-share-action-icon--fb { background: rgba(24, 119, 242, 0.15); color: #1877f2; }
.kh-tube-share-action-icon--x { background: rgba(255, 255, 255, 0.08); color: #fff; }

.kh-tube-share-action-text {
	display: block;
	width: 100%;
	color: var(--kh-text-strong);
}

.kh-tube-share-action.is-copied {
	border-color: #22c55e;
	background: rgba(34, 197, 94, 0.12);
}

/* Info card v1.8 */
.kh-tube-info-card--v18 {
	margin: 0 0 1.25rem;
	padding: 1.15rem 1.2rem 1.2rem;
	border-radius: 18px;
	border: 1px solid var(--kh-border);
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
	box-shadow: 0 14px 34px rgba(0, 0, 0, 0.14);
}

.kh-tube-info-card-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	margin-bottom: 1rem;
}

.kh-tube-info-card-title {
	margin: 0;
	font-size: 1rem;
	font-weight: 800;
	color: var(--kh-text-strong);
}

.kh-tube-info-card-accent {
	width: 48px;
	height: 4px;
	border-radius: 999px;
	background: linear-gradient(90deg, var(--kh-primary, #ec4899), #a855f7);
}

.kh-tube-info-card-meta {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.75rem;
	margin-bottom: 1rem;
}

.kh-tube-info-meta-item {
	padding: 0.75rem 0.85rem;
	border-radius: 14px;
	border: 1px solid rgba(255, 255, 255, 0.06);
	background: rgba(255, 255, 255, 0.03);
}

.kh-tube-info-meta-item--wide {
	grid-column: 1 / -1;
}

.kh-tube-info-meta-label {
	display: block;
	margin-bottom: 0.25rem;
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--kh-text-muted, rgba(255, 255, 255, 0.58));
}

.kh-tube-info-meta-value {
	font-size: 0.88rem;
	font-weight: 800;
	color: var(--kh-text-strong);
}

.kh-tube-info-meta-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}

.kh-tube-info-meta-tags a {
	display: inline-flex;
	padding: 0.28rem 0.55rem;
	border-radius: 999px;
	border: 1px solid var(--kh-border);
	background: rgba(255, 255, 255, 0.04);
	font-size: 0.76rem;
	font-weight: 700;
	text-decoration: none;
	color: var(--kh-text-strong);
	transition: border-color 0.15s ease, background 0.15s ease;
}

.kh-tube-info-meta-tags a:hover,
.kh-tube-info-meta-tags a:focus-visible {
	border-color: rgba(236, 72, 153, 0.35);
	background: rgba(236, 72, 153, 0.08);
	outline: none;
}

.kh-tube-info-card-subtitle {
	margin: 0 0 0.65rem;
	font-size: 0.82rem;
	font-weight: 800;
	color: var(--kh-text-strong);
}

.kh-tube-info-card-body.is-collapsed .kh-tube-info-card-content {
	display: -webkit-box;
	-webkit-line-clamp: 4;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.kh-tube-info-card-content {
	font-size: 0.92rem;
	line-height: 1.65;
	color: var(--kh-text, rgba(255, 255, 255, 0.86));
}

.kh-tube-info-card-toggle {
	display: inline-flex;
	align-items: center;
	margin-top: 0.75rem;
	padding: 0.45rem 0.85rem;
	border: 0;
	border-radius: 999px;
	background: rgba(236, 72, 153, 0.12);
	color: var(--kh-primary, #ec4899);
	font-size: 0.78rem;
	font-weight: 800;
	cursor: pointer;
	transition: background 0.15s ease;
}

.kh-tube-info-card-toggle:hover,
.kh-tube-info-card-toggle:focus-visible {
	background: rgba(236, 72, 153, 0.18);
	outline: none;
}

.kh-tube-info-card-body.is-expanded + .kh-tube-info-card-toggle .kh-tube-description-toggle-more,
.kh-tube-info-card-body:not(.is-expanded) + .kh-tube-info-card-toggle .kh-tube-description-toggle-less {
	display: none;
}

/* Sidebar CTA v1.8 */
.kh-tube-sidebar-cta--v18 .kh-tube-sidebar-cta-btn {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.55rem;
	width: 100%;
	padding: 1rem 1.1rem;
	border-radius: 18px;
	overflow: hidden;
	text-decoration: none;
	font-size: 0.84rem;
	font-weight: 800;
	line-height: 1.25;
	color: #fff;
	background: linear-gradient(135deg, rgba(249, 115, 22, 0.95) 0%, rgba(236, 72, 153, 0.95) 48%, rgba(168, 85, 247, 0.95) 100%);
	border: 1px solid rgba(255, 255, 255, 0.14);
	box-shadow:
		0 12px 32px rgba(236, 72, 153, 0.32),
		inset 0 1px 0 rgba(255, 255, 255, 0.18);
	transition: box-shadow 0.25s ease, filter 0.2s ease;
}

.kh-tube-sidebar-cta--v18 .kh-tube-sidebar-cta-glow {
	position: absolute;
	inset: 0;
	background: linear-gradient(120deg, transparent 20%, rgba(255, 255, 255, 0.22) 50%, transparent 80%);
	transform: translateX(-120%);
	transition: transform 0.55s ease;
	pointer-events: none;
}

.kh-tube-sidebar-cta--v18 .kh-tube-sidebar-cta-btn:hover .kh-tube-sidebar-cta-glow,
.kh-tube-sidebar-cta--v18 .kh-tube-sidebar-cta-btn:focus-visible .kh-tube-sidebar-cta-glow {
	transform: translateX(120%);
}

.kh-tube-sidebar-cta--v18 .kh-tube-sidebar-cta-btn:hover,
.kh-tube-sidebar-cta--v18 .kh-tube-sidebar-cta-btn:focus-visible {
	filter: brightness(1.06);
	box-shadow:
		0 16px 40px rgba(236, 72, 153, 0.42),
		0 0 28px rgba(249, 115, 22, 0.28),
		inset 0 1px 0 rgba(255, 255, 255, 0.22);
	outline: none;
}

.kh-tube-sidebar-cta--v18 .kh-tube-sidebar-cta-icon {
	font-size: 1.15rem;
	animation: kh-tube-cta-pulse 2.4s ease-in-out infinite;
}

.kh-tube-sidebar-cta--v18 .kh-tube-sidebar-cta-text,
.kh-tube-sidebar-cta--v18 .kh-tube-sidebar-cta-arrow {
	position: relative;
	z-index: 1;
}

.kh-tube-sidebar-cta--v18 .kh-tube-sidebar-cta-arrow {
	opacity: 0.85;
	transition: transform 0.18s ease;
}

.kh-tube-sidebar-cta--v18 .kh-tube-sidebar-cta-btn:hover .kh-tube-sidebar-cta-arrow,
.kh-tube-sidebar-cta--v18 .kh-tube-sidebar-cta-btn:focus-visible .kh-tube-sidebar-cta-arrow {
	transform: translateX(3px);
}

@keyframes kh-tube-cta-pulse {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.08); }
}

/* Stable slider navigation — no layout shift */
.kh-tube-carousel--v12,
.kh-tube-category-slider,
.kh-tube-stories-slider {
	position: relative;
}

.kh-tube-carousel-nav,
.kh-tube-row-nav,
.kh-tube-category-slider-nav,
.kh-tube-stories-nav,
.kh-tube-premium-nav {
	position: absolute;
	top: 50%;
	z-index: 4;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 999px;
	background: rgba(18, 18, 24, 0.72);
	backdrop-filter: blur(10px);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
	transform: translateY(-50%);
	transition: background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.kh-tube-carousel-nav--prev,
.kh-tube-row-nav--prev,
.kh-tube-premium-nav--prev { left: 0.35rem; }

.kh-tube-carousel-nav--next,
.kh-tube-row-nav--next,
.kh-tube-premium-nav--next { right: 0.35rem; }

.kh-tube-carousel-nav:hover,
.kh-tube-carousel-nav:focus-visible,
.kh-tube-row-nav:hover,
.kh-tube-row-nav:focus-visible,
.kh-tube-category-slider-nav:hover,
.kh-tube-category-slider-nav:focus-visible,
.kh-tube-stories-nav:hover,
.kh-tube-stories-nav:focus-visible,
.kh-tube-premium-nav:hover,
.kh-tube-premium-nav:focus-visible {
	transform: translateY(-50%);
	background: rgba(236, 72, 153, 0.22);
	border-color: rgba(236, 72, 153, 0.45);
	box-shadow: 0 12px 28px rgba(236, 72, 153, 0.28);
	outline: none;
}

.kh-tube-carousel-nav svg,
.kh-tube-row-nav svg,
.kh-tube-category-slider-nav svg,
.kh-tube-premium-nav svg {
	transition: transform 0.18s ease;
}

.kh-tube-carousel-nav:hover svg,
.kh-tube-row-nav:hover svg,
.kh-tube-category-slider-nav:hover svg,
.kh-tube-premium-nav:hover svg {
	transform: scale(1.12);
}

.kh-tube-category-slider,
.kh-tube-stories-slider {
	display: block;
	padding: 0 2.75rem;
}

.kh-tube-category-slider-track,
.kh-tube-stories-slider-track,
.kh-tube-carousel-row-track {
	min-height: 0;
}

/* Page heroes trend/popular */
.kh-tube-page-hero--v18 .kh-tube-page-badge--trend {
	background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(236, 72, 153, 0.2));
	border-color: rgba(249, 115, 22, 0.35);
}

.kh-tube-page-hero--v18 .kh-tube-page-badge--popular {
	background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(236, 72, 153, 0.15));
	border-color: rgba(168, 85, 247, 0.35);
}

.kh-tube-grid--trend,
.kh-tube-grid--popular {
	gap: 1rem;
}

/* Override legacy hover transforms that cause layout jump */
.kh-tube-active.kh-tube-v18 .kh-tube-card--stream:hover,
.kh-tube-active.kh-tube-v18 .kh-tube-card--v13:hover,
.kh-tube-active.kh-tube-v18 .kh-tube-card--premium:hover {
	transform: none;
}

@media (max-width: 991px) {
	.kh-tube-share-bar {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	#kh-video-page .kh-tube-share--v18,
	#kh-video-page .kh-tube-info-card--v18 {
		margin-left: 0;
		margin-right: 0;
	}

	#kh-video-page .kh-tube-share-bar {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.kh-tube-info-card-meta {
		grid-template-columns: 1fr;
	}

	.kh-tube-category-slider,
	.kh-tube-stories-slider {
		padding: 0;
	}

	.kh-tube-row-nav,
	.kh-tube-category-slider-nav,
	.kh-tube-stories-nav,
	.kh-tube-premium-nav {
		display: none;
	}
}

@media (max-width: 768px) {
	#kh-video-page .kh-tube-share-bar {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 640px) {
	.kh-tube-share-bar {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	#kh-video-page .kh-tube-share-bar {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.kh-tube-section-head--v18 {
		flex-direction: column;
		align-items: flex-start;
	}
}

@media (prefers-reduced-motion: reduce) {
	.kh-tube-sidebar-cta--v18 .kh-tube-sidebar-cta-icon,
	.kh-tube-card--v18 .kh-tube-card-img,
	.kh-tube-share-action-icon {
		animation: none;
		transition: none;
	}
}
