/**
 * Mixed Media Gallery Module Styles
 *
 * Styles for the Divi Mixed Media Gallery plugin
 *
 * @package Divi_Mixed_Media_Gallery
 * @version 1.0.0
 */

/* Grid Layout */
.et_pb_mixed_media_gallery {
	position: relative;
}

.et_pb_mixed_media_gallery .et_pb_gallery_items {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
	gap: 20px;
	padding: 0;
	margin: 0;
}

.et_pb_mixed_media_gallery .et_pb_gallery_item {
	position: relative;
	list-style: none;
	margin: 0;
	padding: 0;
}

.et_pb_mixed_media_gallery .et_pb_gallery_image {
	position: relative;
	overflow: hidden;
	background: #f5f5f5;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 250px; /* Fixed height for the image container */
}

.et_pb_mixed_media_gallery .et_pb_gallery_image a {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
}

.et_pb_mixed_media_gallery .et_pb_gallery_image img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	display: block;
	object-fit: contain; /* Keep natural aspect ratio */
	transition: transform 0.3s ease, opacity 0.3s ease;
}

.et_pb_mixed_media_gallery .et_pb_gallery_item:hover .et_pb_gallery_image img {
	transform: scale(1.05);
	opacity: 0.9;
}

/* Video Play Button Overlay */
.et_pb_video_overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	transition: background 0.3s ease;
	pointer-events: none;
	z-index: 2;
}

.et_pb_gallery_item:hover .et_pb_video_overlay {
	opacity: 0;
}

.et_pb_video_overlay_icon {
	width: 50px;
	height: 50px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 90 90'%3E%3Ccircle cx='45' cy='45' r='44' fill='rgba(255,255,255,0.9)' stroke='%23333' stroke-width='2'/%3E%3Cpath fill='%23333' d='M35 28v34l30-17z'/%3E%3C/svg%3E");
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center;
	transition: transform 0.3s ease;
	flex-shrink: 0;
}

.et_pb_gallery_item:hover .et_pb_video_overlay_icon {
	transform: scale(1.1);
}

/* Video placeholder when no thumbnail exists */
.et_pb_video_placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	background: #000;
	object-fit: cover;
}

/* Standard Overlay (for images) - Eye icon */
.et_pb_mixed_media_gallery .et_overlay {
	position: absolute !important;
	top: 0 !important;
	left: 0 !important;
	width: 100% !important;
	height: 100% !important;
	background: rgba(255, 255, 255, 0.5) !important;
	opacity: 0 !important;
	transition: opacity 0.3s ease !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	z-index: 3 !important;
	pointer-events: none !important;
}

.et_pb_mixed_media_gallery .et_pb_image_item:hover .et_overlay,
.et_pb_mixed_media_gallery .et_pb_video_item:hover .et_overlay {
	opacity: 1 !important;
}

/* Play icon for video overlay instead of eye */
.et_pb_mixed_media_gallery .et_pb_video_item .et_overlay:before {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 90 90'%3E%3Cpath fill='%23333' d='M45 0C20.147 0 0 20.147 0 45s20.147 45 45 45 45-20.147 45-45S69.853 0 45 0zm0 84C23.458 84 6 66.542 6 45S23.458 6 45 6s39 17.458 39 39-17.458 39-39 39z'/%3E%3Cpath fill='%23333' d='M35 28v34l30-17z'/%3E%3C/svg%3E") !important;
}

.et_pb_mixed_media_gallery .et_overlay:before {
	content: '';
	display: block;
	width: 50px;
	height: 50px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 90 90'%3E%3Cpath fill='%23333' d='M45 73.264c-14.869 0-29.775-8.864-44.307-26.346a3.003 3.003 0 0 1 0-3.836C15.225 25.601 30.131 16.737 45 16.737c14.868 0 29.775 8.864 44.307 26.345a3.003 3.003 0 0 1 0 3.836C74.775 64.399 59.868 73.264 45 73.264zM6.934 45C19.73 59.776 32.528 67.264 45 67.264c12.473 0 25.27-7.487 38.066-22.264C70.27 30.224 57.473 22.737 45 22.737 32.528 22.737 19.73 30.224 6.934 45z'/%3E%3Cpath fill='%23333' d='M45 62c-9.374 0-17-7.626-17-17s7.626-17 17-17 17 7.626 17 17-7.626 17-17 17zm0-28c-6.065 0-11 4.935-11 11s4.935 11 11 11 11-4.935 11-11-4.935-11-11-11z'/%3E%3C/svg%3E");
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center;
}

.et_pb_mixed_media_gallery .et_overlay:before {
	font-family: 'ETmodules';
	font-size: 32px;
	color: #333;
	speak: none;
	font-style: normal;
	font-weight: normal;
	font-variant: normal;
	text-transform: none;
	line-height: 1;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* Title and Caption */
.et_pb_mixed_media_gallery .et_pb_gallery_title {
	margin: 10px 0 5px;
	padding: 0;
	font-size: 16px;
	line-height: 1.4;
}

.et_pb_mixed_media_gallery .et_pb_gallery_caption {
	margin: 5px 0 0;
	padding: 0;
	font-size: 14px;
	line-height: 1.6;
	color: #666;
}

/* Pagination */
.et_pb_gallery_pagination {
	margin-top: 30px;
	text-align: center;
}

.et_pb_gallery_pagination ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: inline-flex;
	gap: 5px;
}

.et_pb_gallery_pagination li {
	display: inline-block;
	margin: 0;
	padding: 0;
}

.et_pb_gallery_pagination a {
	display: block;
	padding: 8px 12px;
	background: #f7f7f7;
	color: #333;
	text-decoration: none;
	border-radius: 3px;
	transition: background 0.3s ease, color 0.3s ease;
}

.et_pb_gallery_pagination a:hover,
.et_pb_gallery_pagination a.active {
	background: #333;
	color: #fff;
}

/* Responsive Design */
@media (max-width: 980px) {
	.et_pb_mixed_media_gallery .et_pb_gallery_items {
		grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
		gap: 15px;
	}

	.et_pb_video_overlay_icon {
		width: 60px;
		height: 60px;
	}

	.et_pb_video_overlay_icon:after {
		border-width: 12px 0 12px 20px;
	}
}

@media (max-width: 767px) {
	.et_pb_mixed_media_gallery .et_pb_gallery_items {
		grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
		gap: 10px;
	}

	.et_pb_video_overlay_icon {
		width: 50px;
		height: 50px;
	}

	.et_pb_video_overlay_icon:after {
		border-width: 10px 0 10px 16px;
	}

	.et_pb_mixed_media_gallery .et_overlay:before {
		font-size: 24px;
	}
}

@media (max-width: 479px) {
	.et_pb_mixed_media_gallery .et_pb_gallery_items {
		grid-template-columns: repeat(2, 1fr);
		gap: 8px;
	}

	.et_pb_video_overlay_icon {
		width: 40px;
		height: 40px;
	}

	.et_pb_video_overlay_icon:after {
		border-width: 8px 0 8px 14px;
	}
}

/* Lightbox Video Styles */
.mfp-content video {
	max-width: 100%;
	max-height: 80vh;
	display: block;
	margin: 0 auto;
	background: #000;
}

.mfp-container video {
	outline: none;
}

/* Loading State */
.et_pb_mixed_media_gallery .et_pb_gallery_image.loading {
	background: #f7f7f7;
	min-height: 200px;
}

.et_pb_mixed_media_gallery .et_pb_gallery_image.loading:after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 40px;
	height: 40px;
	margin: -20px 0 0 -20px;
	border: 3px solid #f7f7f7;
	border-top-color: #333;
	border-radius: 50%;
	animation: et-rotate 0.6s linear infinite;
}

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

/* Dark Background Layout */
.et_pb_bg_layout_dark .et_pb_gallery_title,
.et_pb_bg_layout_dark .et_pb_gallery_caption {
	color: #fff;
}

.et_pb_bg_layout_dark .et_overlay {
	background: rgba(0, 0, 0, 0.9);
}

.et_pb_bg_layout_dark .et_overlay:before {
	color: #fff;
}

/* Visual Builder Compatibility */
.et-fb .et_pb_mixed_media_gallery .et_pb_gallery_items {
	min-height: 200px;
}

/* Video container - centered */
.mfp-content .mfp-video-container {
	position: relative;
	display: inline-flex;
	flex-direction: column;
	align-items: flex-end;
}

.mfp-content:has(.mfp-video-container) {
	text-align: center !important;
}

.mfp-video-container video {
	max-width: 100%;
	max-height: 80vh;
	display: block;
}

/* Video counter - positioned below video, aligned right, match image spacing */
.mfp-video-counter {
	color: #ccc;
	font-size: 13px;
	padding-top: 0px;
	padding-bottom: 5px;
	margin-top: 0;
}

/* Lightbox counter visibility fix - ensures counter shows across all themes */
.mfp-content figcaption {
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
	height: auto !important;
}

.mfp-bottom-bar {
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
}

.mfp-counter {
	color: #ccc !important;
	display: block !important;
	opacity: 1 !important;
	font-size: 13px !important;
}
