/* SD Video Hotspots - Frontend Viewer */

.sd-video-viewer {
	margin: 30px 0;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	color: #333;
	container-type: inline-size;
	container-name: sd-viewer;
}

/* Layout: Sidebar (Kategorien + Video-Liste) links, Player rechts.
   Der Player bekommt bewusst den Großteil der Breite - die Sidebar ist
   schmal gehalten, damit das Video möglichst groß dargestellt wird. */
.sd-viewer-layout {
	display: grid;
	grid-template-columns: 220px 1fr;
	gap: 20px;
	align-items: start;
}

.sd-viewer-sidebar {
	border-right: 1px solid #eee;
	padding-right: 20px;
}

.sd-viewer-main {
	min-width: 0;
}

.sd-video-container {
	position: relative;
	aspect-ratio: 16 / 9;
	background: #000;
	border-radius: 6px;
	overflow: hidden;
}

.sd-video-container video {
	width: 100%;
	height: 100%;
	display: block;
}

.sd-video-container:fullscreen,
.sd-video-container:-webkit-full-screen {
	aspect-ratio: unset;
	width: 100vw;
	height: 100vh;
}

.sd-video-container:fullscreen video,
.sd-video-container:-webkit-full-screen video {
	object-fit: contain;
}

/* ---------------------------------------------------------------------
 * Custom Player-Controls (eigene Steuerleiste statt nativer Controls,
 * damit die Hotspot-Dots direkt in der Scrub-/Seekleiste sitzen können)
 * ------------------------------------------------------------------- */

.sd-custom-controls {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 22px 12px 10px;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, visibility 0.2s ease;
	z-index: 4;
}

.sd-video-container.sd-controls-visible .sd-custom-controls,
.sd-video-container.sd-paused .sd-custom-controls {
	opacity: 1;
	visibility: visible;
}

/* Seekbar */
.sd-seekbar {
	position: relative;
	height: 6px;
	background: rgba(255, 255, 255, 0.3);
	border-radius: 3px;
	cursor: pointer;
	margin-bottom: 10px;
	touch-action: none;
}

.sd-seekbar:hover {
	height: 8px;
}

.sd-seekbar-buffered {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	width: 0%;
	background: rgba(255, 255, 255, 0.35);
	border-radius: 3px;
	pointer-events: none;
}

.sd-seekbar-progress {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	width: 0%;
	background: #FDD835;
	border-radius: 3px;
	pointer-events: none;
}

.sd-seekbar-handle {
	position: absolute;
	top: 50%;
	left: 0%;
	width: 13px;
	height: 13px;
	margin-left: -6.5px;
	background: #FDD835;
	border-radius: 50%;
	transform: translateY(-50%);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
	pointer-events: none;
	z-index: 2;
}

/* Hotspot-Dots direkt in der Seekbar (Kapitelmarken-Style, wie bei
   YouTube/Pornhub) */
.sd-hotspot-dot {
	position: absolute;
	top: 50%;
	width: 7px;
	height: 7px;
	margin-left: -5.5px;
	transform: translateY(-50%);
	border-radius: 50%;
	background: #fff;
	border: 2px solid #FDD835;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
	cursor: pointer;
	transition: transform 0.15s ease;
	z-index: 3;
}

.sd-hotspot-dot:hover,
.sd-hotspot-dot.active {
	transform: translateY(-50%) scale(1.7);
}

.sd-hotspot-dot-tooltip {
	position: absolute;
	bottom: 12px;
	left: 50%;
	transform: translateX(-50%);
	background: rgba(20, 20, 20, 0.95);
	color: #fff;
	font-size: 8px;
	line-height: 1.25;
	padding: 3px 6px;
	border-radius: 3px;
	max-width: 130px;
	text-align: center;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.15s ease;
	z-index: 5;
}

.sd-hotspot-dot-tooltip strong {
	display: block;
	font-weight: 600;
	font-size: 9px;
}

.sd-hotspot-dot-tooltip span {
	display: block;
	color: #ccc;
	margin-top: 1px;
	font-size: 8px;
}

.sd-hotspot-dot-tooltip span:empty {
	display: none;
}

.sd-hotspot-dot:hover .sd-hotspot-dot-tooltip {
	opacity: 1;
	visibility: visible;
}

/* Buttons / Zeitanzeige */
.sd-controls-row {
	display: flex;
	align-items: center;
	gap: 10px;
}

.sd-ctrl-btn {
	background: none;
	border: none;
	padding: 4px;
	width: 30px;
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: #fff;
	opacity: 0.9;
}

.sd-ctrl-btn:hover {
	opacity: 1;
}

.sd-ctrl-btn svg {
	width: 22px;
	height: 22px;
	fill: currentColor;
}

.sd-time-display {
	color: #fff;
	font-size: 12px;
	font-family: 'Monaco', 'Courier New', monospace;
	white-space: nowrap;
}

.sd-controls-spacer {
	flex: 1;
}

/* Kategorie-Tabs */
.sd-cat-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 18px;
}

.sd-cat-tab {
	padding: 6px 12px;
	background: #f5f5f5;
	border: 1px solid #e0e0e0;
	border-radius: 4px;
	font-size: 12px;
	color: #333;
	cursor: pointer;
	transition: background 0.15s ease;
}

.sd-cat-tab:hover {
	background: #ececec;
}

.sd-cat-tab.active {
	background: #FDD835;
	border-color: #FDD835;
	color: #000;
	font-weight: 600;
}

/* Video-Liste (Titel + Länge) */
.sd-video-list {
	display: flex;
	flex-direction: column;
	gap: 2px;
	max-height: 520px;
	overflow-y: auto;
}

.sd-video-list-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 10px 12px;
	border-radius: 4px;
	border-left: 3px solid transparent;
	cursor: pointer;
	font-size: 13px;
	color: #333;
	transition: background 0.15s ease;
}

.sd-video-list-item:hover {
	background: #f5f5f5;
}

.sd-video-list-item.active {
	background: #fff8dc;
	border-left-color: #FDD835;
	font-weight: 600;
}

.sd-video-list-title {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sd-video-list-duration {
	flex-shrink: 0;
	font-family: 'Monaco', 'Courier New', monospace;
	font-size: 11px;
	color: #888;
}

.sd-list-empty {
	padding: 12px;
	text-align: center;
	color: #888;
	font-size: 13px;
}

/* Responsive - basiert auf der tatsächlichen Breite des Viewers (Container
   Query), nicht auf der Viewport-Breite. Wichtig, weil das Theme die
   Inhaltsspalte oft schmaler macht als der Viewport (Sidebar im Theme etc.) -
   mit einer normalen @media-Query würde der Player dann trotzdem gequetscht
   nebeneinander mit der Sidebar dargestellt und wirkt viel zu klein. */
@container sd-viewer (max-width: 900px) {
	.sd-viewer-layout {
		grid-template-columns: 1fr;
	}

	.sd-viewer-sidebar {
		border-right: none;
		border-bottom: 1px solid #eee;
		padding-right: 0;
		padding-bottom: 16px;
		margin-bottom: 20px;
	}

	.sd-video-list {
		max-height: 260px;
	}
}

/* Fallback für Browser ohne Container-Query-Support: gängige, schmale
   Viewport-Breiten trotzdem stapeln. */
@supports not (container-type: inline-size) {
	@media (max-width: 900px) {
		.sd-viewer-layout {
			grid-template-columns: 1fr;
		}

		.sd-viewer-sidebar {
			border-right: none;
			border-bottom: 1px solid #eee;
			padding-right: 0;
			padding-bottom: 16px;
			margin-bottom: 20px;
		}

		.sd-video-list {
			max-height: 260px;
		}
	}
}
