/**
 * Frontend styles for Videos Institucionales carousels.
 *
 * Dark theme matching the Fiscalía institutional carousel design.
 *
 * Responsive breakpoints:
 *   Mobile  < 768px  : stacked layout, smaller thumbnails
 *   Desktop >= 768px : full layout
 *
 * @package Videos_Institucionales_Fiscalia
 */

/* =========================================================================
   CSS Custom Properties
   ========================================================================= */

.videos-institucionales-horizontal,
.videos-institucionales-vertical {
	--vi-bg-dark: #1a1a1a;
	--vi-bg-medium: #333333;
	--vi-text-light: #ffffff;
	--vi-text-muted: #aaaaaa;
	--vi-accent: #4a90d9;
	--vi-active-bg: #2d5a8a;
	--vi-hover-bg: #444444;
	--vi-transition: 0.3s ease;
	--vi-border-radius: 4px;
	box-sizing: border-box;
	font-family: 'Nunito Sans', Verdana, sans-serif;
	width: 100%;
	max-width: 1200px;
	margin: 0 auto;
}

.videos-institucionales-horizontal *,
.videos-institucionales-horizontal *::before,
.videos-institucionales-horizontal *::after,
.videos-institucionales-vertical *,
.videos-institucionales-vertical *::before,
.videos-institucionales-vertical *::after {
	box-sizing: border-box;
}

/* =========================================================================
   Main video panel
   ========================================================================= */

.vi-video-thumbnail {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	background: var(--vi-bg-dark);
	overflow: hidden;
}

.vi-thumbnail-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Play Button — centered blue circle */
.vi-play-button {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 68px;
	height: 68px;
	background: rgba(74, 144, 217, 0.85);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	transition: all var(--vi-transition);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 2;
	padding: 0;
}

.vi-play-button:hover,
.vi-play-button:focus-visible {
	background: rgba(74, 144, 217, 0.95);
	transform: translate(-50%, -50%) scale(1.1);
}

.vi-play-icon {
	color: white;
	font-size: 24px;
	margin-left: 4px;
	line-height: 1;
}

/* Video info — overlay top-right with dark background */
.vi-video-info {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	background: rgba(0, 0, 0, 0.7);
	padding: 15px 20px;
	z-index: 1;
}

.vi-video-title {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	color: var(--vi-text-light);
	line-height: 1.3;
}

/* =========================================================================
   Horizontal Carousel
   ========================================================================= */

.videos-institucionales-horizontal .vi-video-main {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	background: var(--vi-bg-dark);
	overflow: hidden;
}

.videos-institucionales-horizontal .vi-video-thumbnail {
	position: relative;
	width: 100%;
	height: 100%;
}

/* Thumbnails bar */
.vi-thumbnails-bar {
	display: flex;
	align-items: center;
	background: var(--vi-bg-medium);
	height: 80px;
	position: relative;
	margin-top: 0;
}

.vi-thumbnails-container {
	flex: 1;
	overflow: hidden;
	padding: 0 50px;
}

.vi-thumbnails-scroll {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	scroll-behavior: smooth;
	scrollbar-width: thin;
	scrollbar-color: var(--vi-bg-dark) var(--vi-bg-medium);
}

.vi-thumbnails-scroll::-webkit-scrollbar {
	height: 6px;
}

.vi-thumbnails-scroll::-webkit-scrollbar-track {
	background: var(--vi-bg-medium);
}

.vi-thumbnails-scroll::-webkit-scrollbar-thumb {
	background: var(--vi-bg-dark);
	border-radius: 3px;
}

/* Each thumbnail button */
.vi-thumbnail-item {
	flex-shrink: 0;
	width: 100px;
	height: 60px;
	padding: 0;
	margin: 0;
	border: 2px solid transparent;
	overflow: hidden;
	cursor: pointer;
	background: var(--vi-bg-dark);
	transition: border-color var(--vi-transition);
	line-height: 0;
	font-size: 0;
}

.vi-thumbnail-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	margin: 0;
	padding: 0;
}

.vi-thumbnail-item:hover,
.vi-thumbnail-item:focus-visible {
	border-color: var(--vi-accent);
}

.vi-thumbnail-item.active {
	border-color: var(--vi-accent);
	box-shadow: 0 0 8px rgba(74, 144, 217, 0.5);
}

/* Navigation buttons — dark semi-transparent, absolute positioned */
.vi-nav-button {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 40px;
	height: 40px;
	background: rgba(0, 0, 0, 0.5);
	border: none;
	color: white;
	font-size: 24px;
	cursor: pointer;
	z-index: 2;
	transition: background var(--vi-transition);
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 0;
	line-height: 1;
}

.vi-nav-button:hover,
.vi-nav-button:focus-visible {
	background: rgba(0, 0, 0, 0.7);
}

.vi-nav-button:disabled {
	opacity: 0.3;
	cursor: not-allowed;
}

.vi-nav-button.vi-prev {
	left: 0;
}

.vi-nav-button.vi-next {
	right: 0;
}

/* =========================================================================
   Vertical Carousel
   ========================================================================= */

.videos-institucionales-vertical {
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.videos-institucionales-vertical .vi-layout {
	display: flex;
	flex-direction: column;
	gap: 0;
	background: var(--vi-bg-dark);
	min-height: auto;
}

.videos-institucionales-vertical .vi-video-main {
	flex: none;
	width: 100%;
	position: relative;
	background: var(--vi-bg-dark);
}

.videos-institucionales-vertical .vi-video-thumbnail {
	aspect-ratio: 16 / 9;
}

.vi-nav-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 10;
	width: 44px;
	height: 44px;
	background: rgba(0, 0, 0, 0.6);
	border: none;
	color: white;
	font-size: 28px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	opacity: 0;
	transition: all var(--vi-transition);
	line-height: 1;
}

.videos-institucionales-vertical:hover .vi-nav-arrow {
	opacity: 1;
}

.vi-nav-arrow:hover:not(:disabled),
.vi-nav-arrow:focus-visible {
	background: var(--vi-accent);
	transform: translateY(-50%) scale(1.1);
}

.vi-nav-arrow:disabled {
	opacity: 0.3 !important;
	cursor: not-allowed;
}

.vi-nav-arrow.vi-nav-prev { left: 10px; }
.vi-nav-arrow.vi-nav-next { right: 10px; }

/* Counter — absolute overlay at bottom of video, matching theme */
.videos-institucionales-vertical .vi-video-info {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.6));
	padding: 18px 20px;
	display: flex;
	align-items: center;
	gap: 8px;
	z-index: 1;
	font-size: 14px;
	color: var(--vi-text-light);
}

.videos-institucionales-vertical .vi-video-title {
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
	margin-left: 10px;
}

.videos-institucionales-vertical .vi-counter-current {
	font-weight: bold;
	font-size: 18px;
	color: var(--vi-accent);
}

.videos-institucionales-vertical .vi-counter-separator {
	color: var(--vi-text-muted);
}

.videos-institucionales-vertical .vi-counter-dash {
	color: var(--vi-text-muted);
}

/* Sidebar */
.vi-sidebar {
	flex: none;
	width: 100%;
	display: block;
	padding: 0;
	margin: 0;
	max-height: 280px;
	overflow-y: auto;
	background: var(--vi-bg-dark);
	border-top: 1px solid rgba(255, 255, 255, 0.1);
	scrollbar-width: thin;
	scrollbar-color: var(--vi-accent) var(--vi-bg-dark);
	font-size: 0;
	line-height: 0;
}

.vi-sidebar::-webkit-scrollbar {
	width: 6px;
}

.vi-sidebar::-webkit-scrollbar-track {
	background: var(--vi-bg-dark);
}

.vi-sidebar::-webkit-scrollbar-thumb {
	background: var(--vi-accent);
	border-radius: 3px;
}

.vi-sidebar-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 0 15px 0 12px;
	margin: 0;
	height: 65px;
	background: var(--vi-bg-dark);
	border: none;
	border-radius: 0;
	outline: none;
	width: 100%;
	text-align: left;
	cursor: pointer;
	transition: all var(--vi-transition);
	opacity: 1;
	font-size: 13px;
	line-height: normal;
	vertical-align: top;
}

.vi-sidebar-item:hover {
	background: var(--vi-hover-bg);
}

.vi-sidebar-item.active {
	background: var(--vi-active-bg);
	border-left: 3px solid var(--vi-accent);
}

.vi-sidebar-item img {
	flex: 0 0 55px;
	width: 55px;
	height: 40px;
	object-fit: cover;
	border-radius: 0;
	box-shadow: none;
}

.vi-item-title {
	font-size: 13px;
	line-height: 1.4;
	color: var(--vi-text-light);
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	flex: 1;
}

.vi-sidebar-item.active .vi-item-title {
	color: #fff;
	font-weight: 500;
}

/* =========================================================================
   Modal
   ========================================================================= */

.vi-video-modal {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 999999;
	display: none;
}

.vi-video-modal.open {
	display: flex;
	align-items: center;
	justify-content: center;
}

.vi-modal-overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.9);
	z-index: 1;
}

.vi-modal-content {
	position: relative;
	width: 90%;
	max-width: 1200px;
	max-height: 90vh;
	z-index: 2;
}

.vi-modal-close {
	position: absolute;
	top: -40px;
	right: 0;
	width: 40px;
	height: 40px;
	background: rgba(255, 255, 255, 0.2);
	border: none;
	color: white;
	font-size: 32px;
	cursor: pointer;
	transition: background var(--vi-transition);
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	line-height: 1;
	padding: 0;
}

.vi-modal-close:hover {
	background: rgba(255, 255, 255, 0.3);
}

.vi-modal-player {
	position: relative;
	width: 100%;
	padding-bottom: 56.25%; /* 16:9 */
	height: 0;
	overflow: hidden;
	background: #000;
}

.vi-modal-player iframe,
.vi-modal-player video {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* =========================================================================
   Responsive
   ========================================================================= */

@media (max-width: 768px) {
	/* Horizontal */
	.vi-video-info {
		padding: 10px 15px;
	}

	.vi-video-title {
		font-size: 14px;
	}

	.vi-thumbnails-bar {
		height: 60px;
	}

	.vi-thumbnails-container {
		padding: 0 45px;
	}

	.vi-nav-button {
		width: 35px;
		height: 35px;
		font-size: 20px;
	}

	.vi-thumbnail-item {
		width: 80px;
		height: 48px;
	}

	/* Vertical — stack */
	.videos-institucionales-vertical .vi-layout {
		flex-direction: column;
	}

	.videos-institucionales-vertical .vi-video-main,
	.vi-sidebar {
		flex: 1 1 auto;
		width: 100%;
	}

	.vi-sidebar {
		max-height: 300px;
	}

	/* Modal */
	.vi-modal-content {
		width: 95%;
	}

	.vi-modal-close {
		top: -35px;
		width: 35px;
		height: 35px;
		font-size: 28px;
	}

	/* Play button */
	.vi-play-button {
		width: 50px;
		height: 50px;
	}

	.vi-play-icon {
		font-size: 20px;
	}
}

@media (max-width: 480px) {
	.vi-thumbnails-bar {
		height: 50px;
	}

	.vi-thumbnail-item {
		width: 70px;
		height: 42px;
	}
}

/* Focus styles for accessibility */
.videos-institucionales-horizontal button:focus-visible,
.videos-institucionales-vertical button:focus-visible {
	outline: 2px solid var(--vi-accent);
	outline-offset: 2px;
}
