/**
 * Frontend Styles
 *
 * @package Logo_Tabs_Grid
 */

.ltg-collection {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	width: 100%;
}

.ltg-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 30px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
}

.ltg-tab {
	padding: 12px 20px;
	border: 1px solid #ddd;
	background: #fff;
	border-radius: 4px;
	cursor: pointer;
	transition: all 0.3s;
	white-space: nowrap;
	font-size: 14px;
	font-weight: 500;
	color: #333;
	min-width: 44px;
	text-align: center;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
}

.ltg-tab i {
	font-size: 18px;
	width: 18px;
	margin-right: 6px;
}

.ltg-tab-text {
	display: inline-block;
}

.ltg-tab:hover {
	border-color: #999;
}

.ltg-tab:focus {
	outline: 2px solid var(--ltg-tab-active-color, #0073aa);
	outline-offset: 2px;
}

.ltg-tab--active {
	background: var(--ltg-tab-active-color, #0073aa);
	color: #fff;
	border-color: var(--ltg-tab-active-color, #0073aa);
}

/* Collection title */
.ltg-collection-title {
	margin: 0 0 20px 0;
	padding: 0;
	font-size: 24px;
	font-weight: 600;
	line-height: 1.4;
	color: #333;
}

/* Collection description */
.ltg-collection-description {
	margin: 0 0 20px 0;
	padding: 0;
	line-height: 1.6;
	color: #555;
}

.ltg-collection-description p {
	margin: 0 0 15px 0;
}

.ltg-collection-description p:last-child {
	margin-bottom: 0;
}

.ltg-collection-description a {
	color: #0073aa;
	text-decoration: none;
}

.ltg-collection-description a:hover {
	text-decoration: underline;
}

.ltg-grid {
	display: grid;
	grid-template-columns: repeat(var(--ltg-columns-mobile), 1fr);
	gap: var(--ltg-gap);
	width: 100%;
	box-sizing: border-box;
}

@media (min-width: 768px) {
	.ltg-grid {
		grid-template-columns: repeat(var(--ltg-columns-tablet), 1fr);
	}
}

@media (min-width: 1024px) {
	.ltg-grid {
		grid-template-columns: repeat(var(--ltg-columns-desktop), 1fr);
	}
}

/* Masonry layout - This entire code block will be removed from the free version. */
.ltg-grid--masonry {
	display: block;
	column-count: var(--ltg-columns-mobile);
	column-gap: var(--ltg-gap);
	column-fill: balance;
}

@media (min-width: 768px) {
	.ltg-grid--masonry {
		column-count: var(--ltg-columns-tablet);
	}
}

@media (min-width: 1024px) {
	.ltg-grid--masonry {
		column-count: var(--ltg-columns-desktop);
	}
}

.ltg-item {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 1;
	background: #fff;
	border-radius: 4px;
	padding: 20px;
	transition: opacity 0.3s;
	box-sizing: border-box;
}

/* Masonry items - natural sizing with minimal padding */
.ltg-grid--masonry .ltg-item {
	display: inline-block;
	width: 100%;
	aspect-ratio: auto;
	min-height: auto;
	padding: 5px;
	margin-bottom: var(--ltg-gap);
	break-inside: avoid;
	page-break-inside: avoid;
	text-align: center;
	background: transparent;
}

/* Hide behavior for masonry - items should not break layout when hidden */
.ltg-collection--inactive-hide.ltg-collection--masonry .ltg-item:not(.ltg-item--active) {
	display: none;
}

.ltg-collection--inactive-hide.ltg-collection--masonry .ltg-item--active {
	display: inline-block;
}

.ltg-item__link {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	text-decoration: none;
	color: inherit;
}

/* Masonry links should wrap content naturally and center images */
.ltg-grid--masonry .ltg-item__link {
	width: 100%;
	height: auto;
	display: block;
	text-align: center;
}

.ltg-item__image {
	max-width: 100%;
	max-height: var(--ltg-logo-height);
	height: auto;
	width: auto;
	object-fit: contain;
	transition: filter 0.3s, opacity 0.3s;
}

/* Masonry images maintain natural aspect ratio and size - no height constraint */
.ltg-grid--masonry .ltg-item__image {
	max-width: 100%;
	max-height: none;
	height: auto;
	width: auto;
	display: block;
	object-fit: contain;
	margin: 0 auto;
}

/* Grayscale mode: Filter */
.ltg-collection[data-grayscale-mode="filter"] .ltg-item__image,
.ltg-collection:not([data-grayscale-mode]) .ltg-item__image {
	filter: grayscale(100%);
	opacity: 0.7;
}

.ltg-collection[data-grayscale-mode="filter"] .ltg-item--active .ltg-item__image,
.ltg-collection:not([data-grayscale-mode]) .ltg-item--active .ltg-item__image {
	filter: grayscale(0%);
	opacity: 1;
}

/* Grayscale mode: Opacity */
.ltg-collection[data-grayscale-mode="opacity"] .ltg-item__image {
	opacity: 0.4;
}

.ltg-collection[data-grayscale-mode="opacity"] .ltg-item--active .ltg-item__image {
	opacity: 1;
}

/* Inactive item behavior (premium feature) - This entire code block will be removed from the free version. */
/* Dim behavior - reduce opacity */
.ltg-collection--inactive-dim .ltg-item:not(.ltg-item--active) {
	opacity: var(--ltg-inactive-opacity, 1);
}

.ltg-collection--inactive-dim .ltg-item--active {
	opacity: 1;
}

/* Hide behavior - completely hide inactive items */
.ltg-collection--inactive-hide .ltg-item:not(.ltg-item--active) {
	display: none;
}

.ltg-collection--inactive-hide .ltg-item--active {
	display: flex;
}

.ltg-item__title {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Link icon overlay */
.ltg-item {
	position: relative;
}

.ltg-item__link {
	position: relative;
}

.ltg-item__link-icon {
	position: absolute;
	top: 8px;
	right: 8px;
	background: rgba(0, 0, 0, 0.7);
	color: #fff;
	border-radius: 50%;
	width: 28px;
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	z-index: 10;
	transition: background 0.3s;
}

.ltg-item__link:hover .ltg-item__link-icon {
	background: rgba(0, 115, 170, 0.9);
}

/* Tab pills overlay */
.ltg-item__tab-pills {
	position: absolute;
	top: 8px;
	left: 8px;
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	z-index: 10;
	max-width: calc(100% - 16px);
}

.ltg-item__tab-pill {
	background: var(--ltg-tab-active-color, #0073aa);
	color: #fff;
	padding: 4px 8px;
	border-radius: 12px;
	font-size: 11px;
	line-height: 1.2;
	font-weight: 500;
	white-space: nowrap;
	transition: opacity 0.3s;
	opacity: 0.9;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.ltg-item__tab-pill i {
	font-size: 12px;
	line-height: 1;
}

.ltg-item__link:hover .ltg-item__tab-pills .ltg-item__tab-pill,
.ltg-item:hover .ltg-item__tab-pills .ltg-item__tab-pill {
	opacity: 0.4;
}

/* Error message */
.ltg-error {
	padding: 15px;
	background: #fff3cd;
	border: 1px solid #ffc107;
	border-radius: 4px;
	color: #856404;
}

/* Attribution link */
.ltg-attribution {
	margin-top: 20px;
	text-align: center;
	padding-top: 15px;
	border-top: 1px solid #e0e0e0;
}

.ltg-attribution__link {
	font-size: 12px;
	color: #666;
	text-decoration: none;
	transition: color 0.3s;
}

.ltg-attribution__link:hover {
	color: #0073aa;
	text-decoration: underline;
}

/* Lightbox */
.ltg-lightbox {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 999999;
	display: none;
}

.ltg-lightbox[aria-hidden="false"] {
	display: block;
}

.ltg-lightbox__overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.9);
	cursor: pointer;
}

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

.ltg-lightbox__content {
	position: relative;
	max-width: 90%;
	max-height: 90%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	z-index: 1;
}

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

.ltg-lightbox__caption {
	margin-top: 20px;
	color: #fff;
	font-size: 16px;
	text-align: center;
	max-width: 600px;
	line-height: 1.5;
}

.ltg-lightbox__close,
.ltg-lightbox__prev,
.ltg-lightbox__next {
	position: absolute;
	background: rgba(255, 255, 255, 0.2);
	border: 2px solid rgba(255, 255, 255, 0.5);
	color: #fff;
	width: 50px;
	height: 50px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.3s;
	z-index: 2;
	font-size: 24px;
	padding: 0;
	line-height: 1;
}

.ltg-lightbox__close:hover,
.ltg-lightbox__prev:hover,
.ltg-lightbox__next:hover {
	background: rgba(255, 255, 255, 0.3);
	border-color: rgba(255, 255, 255, 0.8);
	transform: scale(1.1);
}

.ltg-lightbox__close:focus,
.ltg-lightbox__prev:focus,
.ltg-lightbox__next:focus {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.ltg-lightbox__close {
	top: 20px;
	right: 20px;
}

.ltg-lightbox__prev,
.ltg-lightbox__next {
	top: 50%;
	transform: translateY(-50%);
}

.ltg-lightbox__prev {
	left: 20px;
}

.ltg-lightbox__next {
	right: 20px;
}

.ltg-lightbox__prev .dashicons,
.ltg-lightbox__next .dashicons,
.ltg-lightbox__close .dashicons {
	width: 24px;
	height: 24px;
	font-size: 24px;
	line-height: 1;
}

@media (max-width: 768px) {
	.ltg-lightbox__container {
		padding: 20px;
	}

	.ltg-lightbox__close,
	.ltg-lightbox__prev,
	.ltg-lightbox__next {
		width: 40px;
		height: 40px;
		font-size: 20px;
	}

	.ltg-lightbox__close {
		top: 10px;
		right: 10px;
	}

	.ltg-lightbox__prev {
		left: 10px;
	}

	.ltg-lightbox__next {
		right: 10px;
	}

	.ltg-lightbox__caption {
		font-size: 14px;
		margin-top: 15px;
	}
}

/* Cursor pointer for items with lightbox */
.ltg-item[data-ltg-lightbox-image] .ltg-item__link {
	cursor: pointer;
}