/**
 * KH Tube v1.5.1 — Premium polish, mobile fixes, layout differentiation
 */

:root,
body.kh-tube-v15 {
	--kh-primary: #1d4ed8;
	--kh-secondary: #2563eb;
	--kh-accent: #60a5fa;
	--kh-bg: #0b0f19;
	--kh-surface: #151b2d;
	--kh-card: #151b2d;
	--kh-text: #f3f4f6;
	--kh-text-muted: #d1d5db;
	--kh-text-strong: #ffffff;
	--kh-border: rgba(96, 165, 250, 0.22);
	--kh-glow: rgba(29, 78, 216, 0.45);
}

body.kh-tube-v15 {
	background: var(--kh-bg);
	color: var(--kh-text);
	overflow-x: hidden;
}

#kh-tube-app,
.kh-tube-app {
	max-width: 100%;
	overflow-x: hidden;
}

/* Layout differentiation */
body.kh-tube-layout-home #kh-tube-app {
	background: linear-gradient(180deg, #0b0f19 0%, #0e1424 100%);
}

body.kh-tube-layout-popular .kh-tube-page-header--popular {
	padding: 1.5rem;
	border-radius: 16px;
	background: linear-gradient(135deg, rgba(29, 78, 216, 0.35), rgba(96, 165, 250, 0.12));
	border: 1px solid var(--kh-border);
	box-shadow: 0 12px 40px var(--kh-glow);
}

body.kh-tube-layout-popular .kh-tube-page-badge {
	display: inline-flex;
	align-items: center;
	padding: 0.25rem 0.65rem;
	border-radius: 999px;
	background: var(--kh-primary);
	color: #fff;
	font-size: 0.72rem;
	font-weight: 800;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	margin-bottom: 0.5rem;
}

body.kh-tube-layout-category .kh-tube-category-banner {
	margin-bottom: 1.75rem;
	border-radius: 18px;
	overflow: hidden;
	box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

body.kh-tube-layout-single .kh-tube-single-article--v13 {
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

body.kh-tube-layout-search .kh-tube-page-header--v13 {
	border-left: 4px solid var(--kh-accent);
	padding-left: 1rem;
}

body.kh-tube-layout-page .kh-tube-page-content--standard {
	background: var(--kh-surface);
	border: 1px solid var(--kh-border);
	border-radius: 16px;
	padding: 1.25rem 1.5rem;
	color: var(--kh-text);
}

/* Header nav — HİKAYELER */
.kh-tube-nav-stories {
	font-weight: 800;
	letter-spacing: 0.04em;
}

/* Section heads & link-more buttons */
.kh-tube-section-head--v12 {
	align-items: center;
	min-height: 48px;
}

.kh-tube-section-head-main {
	align-items: center;
}

.kh-tube-link-more {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 36px;
	padding: 0.4rem 0.85rem;
	border-radius: 999px;
	border: 1px solid var(--kh-border);
	background: rgba(29, 78, 216, 0.12);
	color: var(--kh-text-strong) !important;
	white-space: nowrap;
	flex-shrink: 0;
	transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.kh-tube-link-more:hover {
	background: rgba(29, 78, 216, 0.28);
	border-color: var(--kh-accent);
	transform: translateY(-1px);
}

.kh-tube-link-more svg {
	flex-shrink: 0;
}

/* Carousel controls */
.kh-tube-carousel-nav {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border-radius: 50%;
	border: 1px solid var(--kh-border);
	background: rgba(21, 27, 45, 0.92);
	color: var(--kh-text-strong);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
	transition: background 0.2s, transform 0.2s, border-color 0.2s;
}

.kh-tube-carousel-nav:hover {
	background: var(--kh-primary);
	border-color: var(--kh-accent);
	transform: translateY(-2px);
}

.kh-tube-row-nav {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	min-width: 36px;
	padding: 0;
	border-radius: 50%;
	border: 1px solid var(--kh-border);
	background: var(--kh-surface);
	color: var(--kh-text-strong);
	font-size: 1.25rem;
	line-height: 1;
}

/* Page identity — dedicated route banners */
.kh-tube-page-hero {
	margin: 0 0 1.5rem;
	padding: 1.75rem 1.25rem;
	border-radius: 16px;
	border: 1px solid var(--kh-border);
	background: linear-gradient(135deg, var(--kh-surface), rgba(255, 255, 255, 0.02));
}

.kh-tube-page-hero-inner {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.5rem;
	max-width: 720px;
}

.kh-tube-page-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 28px;
	padding: 0.2rem 0.75rem;
	border-radius: 999px;
	font-size: 0.72rem;
	font-weight: 800;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.kh-tube-page-badge--trend {
	background: rgba(239, 68, 68, 0.15);
	color: #fca5a5;
	border: 1px solid rgba(239, 68, 68, 0.35);
}

.kh-tube-page-badge--popular {
	background: rgba(99, 102, 241, 0.15);
	color: #c4b5fd;
	border: 1px solid rgba(99, 102, 241, 0.35);
}

.kh-tube-page-badge--search {
	background: rgba(34, 197, 94, 0.12);
	color: #86efac;
	border: 1px solid rgba(34, 197, 94, 0.3);
}

.kh-tube-page-hero--trend {
	border-color: rgba(239, 68, 68, 0.35);
	background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(245, 158, 11, 0.08));
}

.kh-tube-page-hero--popular {
	border-color: rgba(99, 102, 241, 0.35);
	background: linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(168, 85, 247, 0.08));
}

.kh-tube-page-hero--archive {
	border-color: rgba(236, 72, 153, 0.3);
	background: linear-gradient(135deg, rgba(236, 72, 153, 0.1), rgba(59, 130, 246, 0.08));
}

.kh-tube-page-hero--search {
	border-color: rgba(34, 197, 94, 0.3);
	background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(59, 130, 246, 0.06));
}

.kh-tube-page-title {
	margin: 0;
	font-size: clamp(1.5rem, 3vw, 2rem);
	font-weight: 900;
	line-height: 1.15;
	color: var(--kh-text-strong);
}

.kh-tube-page-subtitle {
	margin: 0;
	font-size: 0.95rem;
	line-height: 1.5;
	color: var(--kh-text-muted);
}

.kh-tube-layout-shell--trend .kh-tube-grid--trend,
.kh-tube-layout-shell--popular .kh-tube-grid--popular {
	gap: 1rem;
}

/* Share buttons v1.5.2 */
.kh-tube-share--v15 {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	width: 100%;
}

.kh-tube-share--v15 .kh-tube-share-label {
	font-size: 0.78rem;
	font-weight: 800;
	color: var(--kh-text-strong);
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.kh-tube-share--v15 .kh-tube-share-grid {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 0.5rem;
	width: 100%;
}

.kh-tube-share--v15 .kh-tube-share-btn {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.35rem;
	min-height: 72px;
	height: 100%;
	padding: 0.55rem 0.45rem;
	border-radius: 12px;
	border: 1px solid var(--kh-border);
	background: var(--kh-surface);
	color: var(--kh-text-strong);
	font-size: 0.72rem;
	font-weight: 700;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
	overflow: hidden;
	cursor: pointer;
	box-sizing: border-box;
}

.kh-tube-share--v15 .kh-tube-share-btn:hover,
.kh-tube-share--v15 .kh-tube-share-btn:focus-visible {
	background: var(--kh-surface-hover, rgba(255, 255, 255, 0.06));
	border-color: var(--kh-primary);
	transform: translateY(-1px);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
	outline: none;
}

.kh-tube-share--v15 .kh-tube-share-btn svg {
	flex-shrink: 0;
}

.kh-tube-share--v15 .kh-tube-share-btn-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: 8px;
	font-size: 0.68rem;
	font-weight: 900;
	line-height: 1;
	flex-shrink: 0;
}

.kh-tube-share--v15 .kh-tube-share-btn-text {
	display: block;
	width: 100%;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.kh-tube-share--v15 .kh-tube-share-btn--copy svg {
	width: 18px;
	height: 18px;
}

.kh-tube-share--v15 .kh-tube-share-btn--wa .kh-tube-share-btn-icon {
	background: #25d366;
	color: #fff;
}

.kh-tube-share--v15 .kh-tube-share-btn--tg .kh-tube-share-btn-icon {
	background: #229ed9;
	color: #fff;
}

.kh-tube-share--v15 .kh-tube-share-btn--x .kh-tube-share-btn-icon {
	background: #111;
	color: #fff;
}

.kh-tube-share--v15 .kh-tube-share-btn--fb .kh-tube-share-btn-icon {
	background: #1877f2;
	color: #fff;
}

.kh-tube-share--v15 .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--v15 {
	margin-left: 1.25rem;
	margin-right: 1.25rem;
}

.kh-tube-hero-actions--row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.65rem;
}

/* Legacy share layout (fallback) */
.kh-tube-share--v13 .kh-tube-share-buttons {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
	gap: 0.5rem;
}

.kh-tube-share--v13 .kh-tube-share-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.35rem;
	min-height: 38px;
	padding: 0.5rem 0.65rem;
	border-radius: 10px;
	font-size: 0.78rem;
	font-weight: 700;
	line-height: 1.2;
	text-align: center;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 100%;
}

.kh-tube-share--v13 .kh-tube-share-btn svg {
	flex-shrink: 0;
}

.kh-tube-share--v13 .kh-tube-share-btn span {
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Ranked cards — popular page */
.kh-tube-card--ranked {
	position: relative;
}

.kh-tube-card-rank {
	position: absolute;
	top: 0.65rem;
	left: 0.65rem;
	z-index: 5;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2rem;
	height: 2rem;
	padding: 0 0.45rem;
	border-radius: 10px;
	background: linear-gradient(135deg, var(--kh-primary), var(--kh-secondary));
	color: #fff;
	font-weight: 900;
	font-size: 0.9rem;
	box-shadow: 0 4px 14px var(--kh-glow);
}

.kh-tube-card--ranked:nth-child(-n+3) .kh-tube-card-rank {
	background: linear-gradient(135deg, #f59e0b, #ef4444);
}

.kh-tube-card-badge {
	position: absolute;
	top: 0.65rem;
	left: 0.65rem;
	z-index: 5;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 1.75rem;
	padding: 0 0.55rem;
	border-radius: 999px;
	font-size: 0.68rem;
	font-weight: 800;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.kh-tube-card-badge--trend {
	background: linear-gradient(135deg, #ef4444, #f59e0b);
	color: #fff;
	box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

/* Video player responsive */
.kh-tube-single-player,
.kh-tube-player-shell,
.kh-tube-player-wrap {
	width: 100%;
	max-width: 100%;
	overflow: hidden;
}

.kh-tube-player-wrap .plyr,
.kh-tube-player-wrap video,
.kh-tube-player {
	width: 100% !important;
	max-width: 100% !important;
	height: auto !important;
	aspect-ratio: 16 / 9;
}

.kh-tube-player-wrap .plyr__video-wrapper {
	max-width: 100%;
}

/* Grid & cards — mobile overflow */
.kh-tube-grid,
.kh-tube-carousel-viewport,
.kh-tube-carousel-row-track,
.kh-tube-wrap,
.kh-tube-container,
.kh-tube-layout {
	max-width: 100%;
}

.kh-tube-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
	gap: 1rem;
}

.kh-tube-card,
.kh-tube-card-link,
.kh-tube-card-thumb,
.kh-tube-card-img,
.kh-tube-card-thumb img {
	max-width: 100%;
}

.kh-tube-card-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Sidebar polish */
.kh-tube-sidebar--v12 {
	border-radius: 16px;
	padding: 0.25rem;
}

.kh-tube-sidebar--v12 .kh-tube-widget {
	padding: 1rem 1.1rem;
	border-bottom: 1px solid var(--kh-border);
}

.kh-tube-sidebar--v12 .kh-tube-widget:last-child {
	border-bottom: none;
}

.kh-tube-sidebar--v12 .kh-tube-widget-title {
	color: var(--kh-text-strong);
	font-weight: 800;
	margin-bottom: 0.75rem;
}

.kh-tube-sidebar-cats a,
.kh-tube-sidebar-ranked a,
.kh-tube-sidebar-latest a {
	color: var(--kh-text) !important;
	font-weight: 600;
	line-height: 1.45;
}

/* Typography contrast pass */
.kh-tube-section-title,
.kh-tube-page-title,
.kh-tube-card-title,
.kh-tube-single-title,
.kh-tube-widget-title,
.kh-tube-footer-title,
.kh-tube-category-banner-title {
	color: var(--kh-text-strong) !important;
}

.kh-tube-page-subtitle,
.kh-tube-card-meta,
.kh-tube-meta-pill,
.kh-tube-card-date {
	color: var(--kh-text-muted) !important;
}

.kh-tube-card-views {
	color: var(--kh-text) !important;
	font-weight: 700;
}

/* Like button disabled state */
.kh-tube-like-btn.is-liked,
.kh-tube-like-btn:disabled {
	opacity: 0.85;
	cursor: default;
	pointer-events: none;
}

/* Category pills */
.kh-tube-cat-pill {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 36px;
	padding: 0.45rem 0.9rem;
	border-radius: 999px;
	font-weight: 700;
}

/* Mobile */
@media (max-width: 991px) {
	body.kh-tube-v15 {
		padding-bottom: 72px;
	}

	#kh-tube-header .kh-tube-platform-header-inner {
		flex-wrap: nowrap;
		gap: 0.65rem;
	}

	.kh-tube-layout--with-sidebar {
		display: flex;
		flex-direction: column;
		gap: 1.25rem;
	}

	.kh-tube-sidebar--sticky {
		position: static;
		width: 100%;
	}

	.kh-tube-grid {
		grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr));
		gap: 0.75rem;
	}

	.kh-tube-share--v15 .kh-tube-share-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.kh-tube-share--v15 .kh-tube-share-btn {
		min-height: 64px;
	}

	.kh-tube-share--v13 .kh-tube-share-buttons {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.kh-tube-section-head--v12 {
		flex-wrap: wrap;
		gap: 0.75rem;
	}

	.kh-tube-link-more {
		width: 100%;
		justify-content: center;
	}

	.kh-tube-carousel-nav {
		width: 38px;
		height: 38px;
	}

	.kh-tube-single-meta-bar {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.75rem;
	}

	.kh-tube-single-actions {
		flex-wrap: wrap;
		gap: 0.5rem;
	}
}

@media (max-width: 480px) {
	.kh-tube-share--v15 .kh-tube-share-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.kh-tube-share--v15 .kh-tube-share-btn {
		min-height: 58px;
		padding: 0.45rem 0.35rem;
		font-size: 0.68rem;
	}

	.kh-tube-page-hero {
		padding: 1.25rem 1rem;
	}

	.kh-tube-share--v13 .kh-tube-share-btn span {
		font-size: 0.72rem;
	}

	.kh-tube-card-title {
		font-size: 0.9rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.kh-tube-card--stream:hover,
	.kh-tube-link-more:hover,
	.kh-tube-carousel-nav:hover {
		transform: none;
	}
}
