/**
 * Modern DLE Video Player CSS
 * Version 2.0 - High Performance HTML5 Player
 */

:root {
	--player-primary: #00b3ff;
	--player-primary-rgb: 0, 179, 255;
	--player-bg: #000000;
	--player-text: #ffffff;
	--player-control-bg: rgba(15, 15, 15, 0.75);
	--player-control-hover: rgba(255, 255, 255, 0.15);
	--player-bar-bg: rgba(255, 255, 255, 0.25);
	--player-bar-loaded: rgba(255, 255, 255, 0.45);
}

*, *:before, *:after {
	box-sizing: border-box;
}

html, body {
	margin: 0;
	padding: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
	background-color: var(--player-bg);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	user-select: none;
	-webkit-user-select: none;
}

.dle-player-wrapper {
	position: relative;
	width: 100%;
	height: 100%;
	background-color: #000;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
}

.dle-player-video {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

/* Canvas оверлей для ASS/SSA субтитров */
.dle-ass-canvas {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 10;
}

/* Оверлей стандартных текстовых субтитров */
.dle-subtitles-overlay {
	position: absolute;
	bottom: 60px;
	left: 5%;
	right: 5%;
	text-align: center;
	pointer-events: none;
	z-index: 11;
	transition: bottom 0.2s ease;
}

.dle-subtitles-text {
	display: inline-block;
	background: rgba(0, 0, 0, 0.75);
	color: #ffffff;
	padding: 4px 12px;
	border-radius: 4px;
	font-size: 20px;
	line-height: 1.4;
	text-shadow: 0 1px 2px rgba(0,0,0,0.8);
	max-width: 90%;
	word-wrap: break-word;
}

/* Водяной знак / Логотип */
.dle-watermark {
	position: absolute;
	z-index: 12;
	pointer-events: auto;
	transition: opacity 0.2s ease;
}
.dle-watermark img {
	max-height: 48px;
	max-width: 160px;
	display: block;
}
.dle-watermark.top-right { top: 16px; right: 16px; }
.dle-watermark.top-left { top: 16px; left: 16px; }
.dle-watermark.bottom-right { bottom: 65px; right: 16px; }
.dle-watermark.bottom-left { bottom: 65px; left: 16px; }

/* Центральная кнопка Play / Спиннер загрузки */
.dle-center-action {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 15;
	pointer-events: none;
	display: flex;
	align-items: center;
	justify-content: center;
}

.dle-big-play {
	width: 68px;
	height: 68px;
	background: rgba(0, 0, 0, 0.65);
	border: 2px solid rgba(255, 255, 255, 0.8);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	pointer-events: auto;
	transition: all 0.2s ease;
	backdrop-filter: blur(4px);
}
.dle-big-play:hover {
	transform: scale(1.1);
	background: var(--player-primary);
	border-color: var(--player-primary);
}
.dle-big-play svg {
	width: 32px;
	height: 32px;
	fill: #ffffff;
	margin-left: 4px;
}

.dle-spinner {
	width: 54px;
	height: 54px;
	border: 4px solid rgba(255, 255, 255, 0.2);
	border-top-color: var(--player-primary);
	border-radius: 50%;
	animation: dle-spin 0.8s linear infinite;
	display: none;
}

@keyframes dle-spin {
	to { transform: rotate(360deg); }
}

/* Панель управления плеером */
.dle-controls {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
	z-index: 20;
	padding: 8px 14px 10px 14px;
	display: flex;
	flex-direction: column;
	gap: 6px;
	opacity: 1;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.dle-controls.hidden {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

/* Шкала прогресса и таймлайн */
.dle-progress-container {
	position: relative;
	width: 100%;
	height: 16px;
	display: flex;
	align-items: center;
	cursor: pointer;
}

.dle-progress-track {
	position: relative;
	width: 100%;
	height: 4px;
	background: var(--player-bar-bg);
	border-radius: 2px;
	transition: height 0.15s ease;
}

.dle-progress-container:hover .dle-progress-track {
	height: 7px;
}

.dle-progress-loaded {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	background: var(--player-bar-loaded);
	border-radius: 2px;
	width: 0%;
	pointer-events: none;
}

.dle-progress-played {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	background: var(--player-primary);
	border-radius: 2px;
	width: 0%;
	pointer-events: none;
}

.dle-progress-thumb {
	position: absolute;
	top: 50%;
	right: -6px;
	transform: translateY(-50%) scale(0);
	width: 13px;
	height: 13px;
	background: #ffffff;
	border-radius: 50%;
	box-shadow: 0 0 4px rgba(0,0,0,0.5);
	transition: transform 0.15s ease;
}

.dle-progress-container:hover .dle-progress-thumb {
	transform: translateY(-50%) scale(1);
}

/* Превью кадров при перемотке (Seek Thumbnails) */
.dle-seek-preview {
	position: absolute;
	bottom: 24px;
	left: 0;
	transform: translateX(-50%);
	background: #000;
	border: 2px solid rgba(255, 255, 255, 0.85);
	border-radius: 4px;
	overflow: hidden;
	box-shadow: 0 4px 14px rgba(0,0,0,0.6);
	display: none;
	flex-direction: column;
	align-items: center;
	pointer-events: none;
	z-index: 25;
}

.dle-seek-thumb-img {
	width: 160px;
	height: 90px;
	/* Не cover: это не картинка, а сетка 10x10 кадров. При масштабировании
	   под окно 160x90 весь спрайт сжимался в одну плитку, а background-position
	   уводил его за край — превью показывало чёрный прямоугольник.
	   Точный размер сетки проставляет player.js. */
	background-size: 1600px 900px;
	background-position: 0 0;
	background-repeat: no-repeat;
	display: block;
}

.dle-seek-thumb-time {
	background: rgba(0, 0, 0, 0.85);
	color: #fff;
	font-size: 11px;
	font-weight: 600;
	padding: 2px 6px;
	width: 100%;
	text-align: center;
}

/* Нижний ряд кнопок управления */
.dle-controls-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
}

.dle-controls-left, .dle-controls-right {
	display: flex;
	align-items: center;
	gap: 6px;
}

.dle-btn {
	background: none;
	border: none;
	color: #ffffff;
	padding: 6px;
	border-radius: 4px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease, color 0.15s ease;
	outline: none;
	position: relative;
}

.dle-btn:hover {
	background: var(--player-control-hover);
	color: var(--player-primary);
}

.dle-btn svg {
	width: 20px;
	height: 20px;
	fill: currentColor;
}

/* Таймер */
.dle-time-display {
	color: #e0e0e0;
	font-size: 13px;
	font-weight: 500;
	margin-left: 6px;
	white-space: nowrap;
}

/* Громкость */
.dle-volume-container {
	display: flex;
	align-items: center;
	position: relative;
}

.dle-volume-slider {
	width: 0;
	opacity: 0;
	height: 4px;
	background: var(--player-bar-bg);
	border-radius: 2px;
	cursor: pointer;
	position: relative;
	transition: width 0.2s ease, opacity 0.2s ease;
	margin-left: 4px;
}

.dle-volume-container:hover .dle-volume-slider {
	width: 60px;
	opacity: 1;
}

.dle-volume-fill {
	height: 100%;
	background: var(--player-primary);
	border-radius: 2px;
	width: 80%;
}

/* Выпадающие меню (Качество, Субтитры, Скорость) */
.dle-menu-wrap {
	position: relative;
}

.dle-popup-menu {
	position: absolute;
	bottom: 38px;
	right: 0;
	background: rgba(22, 22, 24, 0.95);
	border: 1px solid rgba(255, 255, 255, 0.15);
	border-radius: 6px;
	padding: 6px 0;
	min-width: 140px;
	max-height: 240px;
	overflow-y: auto;
	box-shadow: 0 6px 18px rgba(0,0,0,0.6);
	backdrop-filter: blur(8px);
	display: none;
	flex-direction: column;
	z-index: 30;
}

.dle-popup-menu.active {
	display: flex;
}

.dle-menu-item {
	padding: 7px 14px;
	font-size: 12px;
	color: #ddd;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: space-between;
	transition: background 0.15s ease, color 0.15s ease;
}

.dle-menu-item:hover {
	background: var(--player-control-hover);
	color: #fff;
}

.dle-menu-item.active {
	color: var(--player-primary);
	font-weight: 600;
}

.dle-menu-item.active:after {
	content: "✓";
	margin-left: 8px;
}

/* Всплывающее уведомление о возобновлении сессии */
.dle-resume-toast {
	position: absolute;
	top: 18px;
	left: 18px;
	background: rgba(18, 18, 20, 0.92);
	border: 1px solid var(--player-primary);
	border-radius: 6px;
	padding: 10px 14px;
	color: #fff;
	font-size: 13px;
	display: flex;
	align-items: center;
	gap: 10px;
	z-index: 35;
	box-shadow: 0 4px 16px rgba(0,0,0,0.5);
	backdrop-filter: blur(6px);
	animation: dle-fade-in 0.3s ease;
}

.dle-resume-btn {
	background: var(--player-primary);
	color: #fff;
	border: none;
	padding: 4px 10px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 12px;
	font-weight: 600;
}

.dle-resume-btn.secondary {
	background: rgba(255, 255, 255, 0.15);
}

.dle-resume-close {
	background: none;
	border: none;
	color: #aaa;
	cursor: pointer;
	font-size: 14px;
	padding: 0 4px;
}

@keyframes dle-fade-in {
	from { opacity: 0; transform: translateY(-10px); }
	to { opacity: 1; transform: translateY(0); }
}

/* Рекламный слой VAST / VPAID */
.dle-ad-container {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 40;
	background: #000;
	display: none;
}

.dle-ad-video {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.dle-ad-topbar {
	position: absolute;
	top: 12px;
	left: 12px;
	right: 12px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	z-index: 42;
	pointer-events: none;
}

.dle-ad-badge {
	background: rgba(0, 0, 0, 0.7);
	color: #ffcc00;
	font-size: 12px;
	font-weight: 600;
	padding: 4px 8px;
	border-radius: 4px;
	border: 1px solid rgba(255, 204, 0, 0.5);
}

.dle-ad-skip-btn {
	background: rgba(0, 0, 0, 0.85);
	color: #ffffff;
	border: 1px solid rgba(255, 255, 255, 0.4);
	padding: 6px 14px;
	border-radius: 4px;
	font-size: 13px;
	cursor: not-allowed;
	pointer-events: auto;
	transition: all 0.2s ease;
}

.dle-ad-skip-btn.can-skip {
	background: var(--player-primary);
	border-color: var(--player-primary);
	cursor: pointer;
	font-weight: 600;
}

.dle-ad-link-btn {
	position: absolute;
	bottom: 20px;
	left: 20px;
	background: rgba(0, 0, 0, 0.8);
	color: #fff;
	padding: 8px 14px;
	border-radius: 4px;
	font-size: 13px;
	text-decoration: none;
	z-index: 42;
	display: flex;
	align-items: center;
	gap: 6px;
	border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Баннеры (Pause Banner, Bottom Banner, Preroll Banner) */
.dle-banner-modal {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 38;
	background: rgba(10, 10, 12, 0.95);
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 8px;
	padding: 12px;
	box-shadow: 0 8px 30px rgba(0,0,0,0.8);
	display: none;
	max-width: 90%;
	max-height: 85%;
}

.dle-banner-modal.active {
	display: block;
}

.dle-banner-close {
	position: absolute;
	top: -12px;
	right: -12px;
	width: 26px;
	height: 26px;
	background: #ff4757;
	color: #fff;
	border-radius: 50%;
	border: 2px solid #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	font-size: 14px;
	font-weight: bold;
	box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.dle-banner-content img {
	max-width: 100%;
	max-height: 320px;
	display: block;
	border-radius: 4px;
}

/* Нижний плавающий баннер */
.dle-bottom-banner {
	position: absolute;
	bottom: 50px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 22;
	background: rgba(15, 15, 15, 0.92);
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 6px;
	padding: 6px 10px;
	display: none;
	align-items: center;
	gap: 8px;
	box-shadow: 0 4px 16px rgba(0,0,0,0.6);
	max-width: 80%;
}

.dle-bottom-banner.active {
	display: flex;
}

.dle-bottom-banner img {
	max-height: 60px;
	border-radius: 4px;
}

/* P2P Статистика */
.dle-p2p-badge {
	position: absolute;
	top: 14px;
	left: 14px;
	background: rgba(0, 0, 0, 0.65);
	border: 1px solid rgba(0, 255, 128, 0.4);
	color: #00ff80;
	font-size: 10px;
	font-family: monospace;
	padding: 3px 6px;
	border-radius: 3px;
	z-index: 26;
	pointer-events: none;
	display: none;
}
