/**
 * NOVA Gallery Widget Styles
 */

/* ============================================
   MAIN WIDGET CONTAINER
   ============================================ */

.nova-gallery-widget {
	width: 100%;
	position: relative;
	box-sizing: border-box;
}

/* ============================================
   FILTERS
   ============================================ */

.nova-gallery-filters {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 10px;
	margin-bottom: 30px;
}

.nova-gallery-filter-item {
	display: inline-block;
	padding: 10px 20px;
	background-color: #f5f5f5;
	color: #333;
	border: 1px solid #ddd;
	border-radius: 4px;
	cursor: pointer;
	transition: all 0.3s ease;
	font-size: 14px;
	font-weight: 500;
	text-decoration: none;
	border: none;
}

.nova-gallery-filter-item:hover {
	background-color: #e0e0e0;
}

.nova-gallery-filter-item.active {
	background-color: #0073aa;
	color: #ffffff;
}

/* ============================================
   GALLERY GRID
   ============================================ */

.nova-gallery-grid {
	display: grid;
	/* grid-template-columns will be set dynamically via JavaScript based on config */
	/* No default value to avoid conflicts - JS will set it with !important */
	gap: 20px;
	width: 100%;
}

/* CSS fallback using data attribute - applies when inline styles are removed by Elementor */
.nova-gallery-grid[data-grid-columns="1"] {
	grid-template-columns: repeat(1, 1fr) !important;
}
.nova-gallery-grid[data-grid-columns="2"] {
	grid-template-columns: repeat(2, 1fr) !important;
}
.nova-gallery-grid[data-grid-columns="3"] {
	grid-template-columns: repeat(3, 1fr) !important;
}
.nova-gallery-grid[data-grid-columns="4"] {
	grid-template-columns: repeat(4, 1fr) !important;
}
.nova-gallery-grid[data-grid-columns="5"] {
	grid-template-columns: repeat(5, 1fr) !important;
}
.nova-gallery-grid[data-grid-columns="6"] {
	grid-template-columns: repeat(6, 1fr) !important;
}
.nova-gallery-grid[data-grid-columns="7"] {
	grid-template-columns: repeat(7, 1fr) !important;
}
.nova-gallery-grid[data-grid-columns="8"] {
	grid-template-columns: repeat(8, 1fr) !important;
}
.nova-gallery-grid[data-grid-columns="9"] {
	grid-template-columns: repeat(9, 1fr) !important;
}
.nova-gallery-grid[data-grid-columns="10"] {
	grid-template-columns: repeat(10, 1fr) !important;
}
.nova-gallery-grid[data-grid-columns="11"] {
	grid-template-columns: repeat(11, 1fr) !important;
}
.nova-gallery-grid[data-grid-columns="12"] {
	grid-template-columns: repeat(12, 1fr) !important;
}

/* CSS fallback for pixels mode with auto-center */
.nova-gallery-grid[data-grid-mode="pixels"] {
	justify-items: center;
}

/* Popup Styles */
.nova-gallery-popup {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 999999;
	display: none;
}

.nova-gallery-popup-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.9);
	cursor: pointer;
}

.nova-gallery-popup-content {
	position: relative;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 40px;
	box-sizing: border-box;
}

.nova-gallery-popup-image-wrapper {
	position: relative;
	max-width: 90%;
	max-height: 90%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

.nova-gallery-popup-image {
	max-width: 100%;
	max-height: 80vh;
	object-fit: contain;
	border-radius: 4px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.nova-gallery-popup-title {
	color: #fff;
	font-size: 18px;
	margin-top: 20px;
	text-align: center;
	max-width: 100%;
	word-wrap: break-word;
}

.nova-gallery-popup-counter {
	color: #fff;
	font-size: 14px;
	margin-top: 10px;
	opacity: 0.8;
}

.nova-gallery-popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 30px;
    height: 30px;
    max-width: 30px !important;
    background-color: rgba(255, 255, 255, 0.2) !important;
    border: none;
    border-radius: 50% !important;
    color: #fff !important;
    font-size: 28px !important;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
    z-index: 1000000;
    padding: 0 !important;
}

.nova-gallery-popup-close:hover {
	background-color: rgba(255, 255, 255, 0.3);
}

.nova-gallery-popup-prev, .nova-gallery-popup-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background-color: rgba(255, 255, 255, 0.2) !important;
    border: none;
    border-radius: 50% !important;
    color: #fff !important;
    font-size: 30px !important;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
    z-index: 1000000;
    padding: 0 !important;
}

.nova-gallery-popup-prev {
	left: 20px;
}

.nova-gallery-popup-next {
	right: 20px;
}

.nova-gallery-popup-prev:hover,
.nova-gallery-popup-next:hover {
	background-color: rgba(255, 255, 255, 0.3);
}

@media (max-width: 768px) {
	.nova-gallery-popup-content {
		padding: 20px;
	}

	.nova-gallery-popup-image {
		max-height: 70vh;
	}

	.nova-gallery-popup-close {
		top: 10px;
		right: 10px;
		width: 35px;
		height: 35px;
		font-size: 24px;
	}

	.nova-gallery-popup-prev,
	.nova-gallery-popup-next {
		width: 40px;
		height: 40px;
		font-size: 20px;
	}

	.nova-gallery-popup-prev {
		left: 10px;
	}

	.nova-gallery-popup-next {
		right: 10px;
	}
}

/* Cursor pointer for items with popup enabled */
.nova-gallery-item[data-popup-image] {
	cursor: pointer;
}

/* ============================================
   GALLERY ITEM
   ============================================ */

.nova-gallery-item {
	position: relative;
	width: 100%;
	overflow: hidden;
	border-radius: 8px;
	background: #f0f0f0;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	justify-content: flex-start;
}

.nova-gallery-item.has-background-image {
	position: relative;
	min-height: 300px;
}

.nova-gallery-item.has-creative-background {
	position: relative;
}

/* ============================================
   ITEM IMAGE
   ============================================ */

.nova-gallery-item-image {
	position: relative;
	width: 100%;
	overflow: hidden;
}

.nova-gallery-item-image img {
	width: 100%;
	height: auto;
	display: block;
	object-fit: cover;
}

/* Image Overlay */
.nova-gallery-item-overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	height: 100%;
	z-index: 2;
	pointer-events: none;
	box-sizing: border-box;
}

.nova-gallery-item.has-background-image .nova-gallery-item-overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	height: 100%;
	z-index: 2;
	pointer-events: none;
	box-sizing: border-box;
}

.nova-gallery-item-image {
	position: relative;
}

.nova-gallery-item-image .nova-gallery-item-overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	height: 100%;
	z-index: 2;
	pointer-events: none;
	box-sizing: border-box;
}

/* ============================================
   ITEM TITLE
   ============================================ */

.nova-gallery-item-title {
	margin: 15px;
	padding: 0;
	font-size: 18px;
	font-weight: 600;
	line-height: 1.4;
	color: #333;
	position: relative;
	z-index: 3;
}

/* ============================================
   ITEM LINK
   ============================================ */

.nova-gallery-item-link {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	height: 100%;
	z-index: 10;
	text-decoration: none;
	cursor: pointer;
	box-sizing: border-box;
}

/* ============================================
   ANIMATIONS
   ============================================ */

.nova-gallery-item {
	transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), 
	            transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
	            visibility 0.5s ease,
	            max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
	            margin 0.5s cubic-bezier(0.4, 0, 0.2, 1),
	            padding 0.5s cubic-bezier(0.4, 0, 0.2, 1);
	opacity: 1;
	transform: scale(1) translateY(0);
	visibility: visible;
	max-height: 5000px;
	overflow: hidden;
}

.nova-gallery-item.hidden {
	opacity: 0;
	transform: scale(0.9) translateY(-10px);
	visibility: hidden;
	pointer-events: none;
	max-height: 0;
	margin-top: 0 !important;
	margin-bottom: 0 !important;
	padding-top: 0 !important;
	padding-bottom: 0 !important;
	transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), 
	            transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
	            visibility 0.5s ease,
	            max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
	            margin 0.5s cubic-bezier(0.4, 0, 0.2, 1),
	            padding 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.nova-gallery-item.fade-in {
	animation: NOVAGalleryFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes NOVAGalleryFadeIn {
	from {
		opacity: 0;
		transform: scale(0.9) translateY(20px);
	}
	to {
		opacity: 1;
		transform: scale(1) translateY(0);
	}
}

