/* =============================================================
   Image Insight Gallery — Frontend Styles
   ============================================================= */

/* === CONTAINER === */

.iig-gallery {
	max-width: 1100px;
	margin: 0 auto;
	padding: 20px;
	border-radius: 20px;
	background: var(--iig-bg, #00102E);
	color: var(--iig-text, #fff);
}

.iig-grid-title {
	text-align: center;
	font-size: 22px;
	font-weight: bold;
	margin-bottom: 20px;
}

/* === IMAGE GRID === */

.iig-image-grid {
	display: grid;
	gap: 20px;
	justify-items: center;
}

/* Linked Modalities: responsive auto-fit grid */
.iig-tpl-image_text_with_dialog .iig-image-grid {
	grid-template-columns: repeat(auto-fit, minmax(var(--iig-thumb, 90px), 1fr));
}

/* Round Image: Elementor Flexbox container with boxed content */
.iig-gallery.iig-tpl-image_text {
	display: flex;
	border-radius: 20px;
}

.iig-gallery.iig-tpl-image_text > .iig-image-grid.e-con-inner {
	display: grid;
	grid-template-columns: repeat(var(--iig-columns, 5), 1fr);
	gap: 20px;
	max-width: 1140px;
	margin: 0 auto;
	width: 100%;
	padding: 40px 20px;
}

.iig-tpl-image_text .iig-grid-title {
	grid-column: 1 / -1;
}

/* === CARDS (linked modalities) === */

.iig-tpl-image_text_with_dialog .iig-image-card {
	width: 100%;
	max-width: calc(var(--iig-thumb, 90px) + 30px);
	cursor: pointer;
	text-align: center;
}

.iig-tpl-image_text_with_dialog .iig-image-card img {
	width: var(--iig-thumb, 90px);
	height: var(--iig-thumb, 90px);
	object-fit: cover;
	border-radius: 50%;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.iig-tpl-image_text_with_dialog .iig-image-card:hover img {
	transform: scale(1.08);
	box-shadow: 0 0 0 3px var(--iig-accent, #00b4d8);
}

.iig-caption {
	text-align: center;
	font-size: 11px;
	margin-top: 6px;
}

/* === CARDS (round image — Elementor image-box structure) === */

.iig-tpl-image_text .iig-image-card {
	cursor: pointer;
	text-align: center;
}

.iig-tpl-image_text .elementor-image-box-wrapper {
	text-align: center;
}

.iig-tpl-image_text .elementor-image-box-img {
	margin: 0 auto;
}

.iig-gallery.iig-tpl-image_text .elementor-image-box-img img {
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	border-radius: 50%;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.iig-tpl-image_text .iig-image-card:hover .elementor-image-box-img img {
	transform: scale(1.08);
	box-shadow: 0 0 0 3px var(--iig-accent, #00b4d8);
}

.iig-tpl-image_text .elementor-image-box-content {
	text-align: center;
}

.iig-gallery.iig-tpl-image_text .elementor-image-box-description {
	font-size: 11px;
	margin-top: 6px;
	color: var(--iig-text, #fff);
}

/* === TEXT BOXES TEMPLATES === */

.iig-gallery.iig-tpl-text_box_with_dialog,
.iig-gallery.iig-tpl-text_box_only {
	display: flex;
	border-radius: 20px;
}

.iig-gallery.iig-tpl-text_box_with_dialog > .iig-image-grid.e-con-inner,
.iig-gallery.iig-tpl-text_box_only > .iig-image-grid.e-con-inner {
	display: grid;
	grid-template-columns: repeat(var(--iig-columns, 5), 1fr);
	gap: 20px;
	max-width: 1140px;
	margin: 0 auto;
	width: 100%;
	padding: 40px 20px;
}

.iig-tpl-text_box_with_dialog .iig-grid-title,
.iig-tpl-text_box_only .iig-grid-title {
	grid-column: 1 / -1;
}

.iig-tile {
	position: relative;
	width: 100%;
	box-sizing: border-box;
	background: rgba(255, 255, 255, 0.08);
	border-radius: 16px;
	padding: 28px 10px;
	text-align: center;
	font-weight: bold;
	cursor: pointer;
	overflow: hidden;
	transition: transform 0.35s, box-shadow 0.35s;
}

.iig-tile:hover {
	transform: translateY(-8px) scale(1.05);
	box-shadow: 0 15px 40px rgba(0, 200, 255, 0.4);
}

.iig-tile::before {
	content: "";
	position: absolute;
	inset: 0;
	background: radial-gradient(circle at center, rgba(0, 200, 255, 0.4), transparent 60%);
	opacity: 0;
	transition: opacity 0.35s;
}

.iig-tile:hover::before {
	opacity: 1;
}

.iig-tpl-text_box_only .iig-tile {
	cursor: default;
}

/* === TEXT BOX MODAL (white card) === */

.iig-modal--textbox {
	background: rgba(0, 0, 0, 0.85);
}

.iig-modal--textbox .iig-modal-body {
	background: #fff;
	color: #000;
	border-radius: 16px;
	padding: 35px;
	width: 100%;
	max-width: 420px;
	text-align: center;
	animation: iigFadeIn 0.35s ease;
}

.iig-modal--textbox .iig-modal-title {
	margin: 0 0 12px;
	font-size: 20px;
	font-weight: bold;
}

.iig-modal--textbox .iig-modal-desc {
	margin: 0 0 20px;
	font-size: 14px;
	line-height: 1.6;
	color: #333;
}

.iig-modal--textbox .iig-close-btn {
	background: var(--iig-tile-bg, var(--iig-bg, #00102E));
	color: #fff;
	transition: opacity 0.2s;
}

.iig-modal--textbox .iig-close-btn:hover {
	background: var(--iig-tile-bg, var(--iig-bg, #00102E));
	opacity: 0.75;
	color: #fff;
}

/* =============================================================
   SHARED MODAL / LIGHTBOX (appended to body)
   ============================================================= */

.iig-modal {
	display: none;
	position: fixed;
	inset: 0;
	justify-content: center;
	align-items: center;
	z-index: 100000;
	padding: 15px;
}

.iig-modal.iig-open {
	display: flex;
}

@keyframes iigFadeIn {
	from { opacity: 0; transform: scale(0.85); }
	to   { opacity: 1; transform: scale(1); }
}

/* === LINKED MODALITIES MODAL (white card) === */

.iig-modal--linked {
	background: rgba(0, 0, 0, 0.85);
}

.iig-modal--linked .iig-modal-body {
	background: #fff;
	color: #000;
	padding: 25px;
	border-radius: 15px;
	text-align: center;
	width: 100%;
	max-width: 650px;
	max-height: 90vh;
	overflow-y: auto;
	animation: iigFadeIn 0.3s ease;
}

.iig-modal--linked .iig-modal-img {
	width: 100%;
	max-height: 350px;
	object-fit: contain;
	border-radius: 8px;
}

.iig-modal--linked .iig-modal-title {
	margin: 12px 0 0;
	font-size: 18px;
	font-weight: bold;
}

/* Pathology pills */

.iig-pills {
	margin-top: 15px;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: center;
}

.iig-pill {
	background: var(--iig-bg, #00102E);
	color: #fff;
	padding: 6px 14px;
	border-radius: 15px;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	border: none;
	font-family: inherit;
	transition: background 0.2s;
}

.iig-pill:hover {
	background: var(--iig-accent, #00b4d8);
}

/* Pathology detail panel */

.iig-detail {
	margin-top: 15px;
	padding: 14px;
	border-radius: 10px;
	background: #f4f6f9;
	text-align: left;
	font-size: 14px;
	line-height: 1.5;
	display: none;
}

.iig-detail.iig-visible {
	display: block;
}

.iig-detail h4 {
	margin: 0 0 6px;
	font-size: 16px;
}

.iig-detail p {
	margin: 0;
	color: #333;
}

/* Close button (linked modalities) */

.iig-close-btn {
	margin-top: 18px;
	padding: 8px 20px;
	border: none;
	background: var(--iig-bg, #00102E);
	color: #fff;
	border-radius: 8px;
	cursor: pointer;
	font-size: 14px;
	font-family: inherit;
	transition: background 0.2s;
}

.iig-close-btn:hover {
	background: var(--iig-accent, #00b4d8);
}

/* === ROUND IMAGE LIGHTBOX (dark overlay) === */

.iig-modal--round {
	background: rgba(0, 0, 0, 0.92);
}

.iig-modal--round .iig-modal-body {
	position: relative;
	text-align: center;
	animation: iigFadeIn 0.3s ease;
}

.iig-modal--round .iig-modal-img {
	max-width: 75vw;
	max-height: 75vh;
	object-fit: contain;
}

.iig-modal--round .iig-modal-title {
	margin-top: 15px;
	color: #fff;
	font-size: 18px;
}

/* Close × */

.iig-close-x {
	position: absolute;
	top: -40px;
	right: 0;
	font-size: 32px;
	color: #fff;
	cursor: pointer;
	background: none;
	border: none;
	line-height: 1;
}

/* Nav buttons */

.iig-nav-btn {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
	border: none;
	font-size: 28px;
	padding: 12px 16px;
	cursor: pointer;
	transition: background 0.2s;
	border-radius: 4px;
}

.iig-nav-btn:hover {
	background: rgba(255, 255, 255, 0.35);
}

.iig-nav-prev { left: -70px; }
.iig-nav-next { right: -70px; }

/* =============================================================
   RESPONSIVE
   ============================================================= */

@media (max-width: 768px) {
	.iig-gallery {
		padding: 15px;
		border-radius: 14px;
	}

	.iig-grid-title {
		font-size: 18px;
	}

	.iig-caption {
		font-size: 9px;
	}

	.iig-gallery.iig-tpl-image_text > .iig-image-grid.e-con-inner,
	.iig-gallery.iig-tpl-text_box_with_dialog > .iig-image-grid.e-con-inner,
	.iig-gallery.iig-tpl-text_box_only > .iig-image-grid.e-con-inner {
		grid-template-columns: repeat(3, 1fr);
		padding: 20px 15px;
		gap: 10px;
	}

	/* Lightbox nav buttons inside image area on mobile */
	.iig-nav-prev { left: 5px; }
	.iig-nav-next { right: 5px; }

	.iig-modal--linked .iig-modal-body {
		padding: 15px;
	}

	.iig-pill {
		font-size: 11px;
		padding: 5px 10px;
	}
}

@media (max-width: 480px) {
	.iig-gallery.iig-tpl-image_text > .iig-image-grid.e-con-inner,
	.iig-gallery.iig-tpl-text_box_with_dialog > .iig-image-grid.e-con-inner,
	.iig-gallery.iig-tpl-text_box_only > .iig-image-grid.e-con-inner {
		grid-template-columns: repeat(2, 1fr);
		gap: 8px;
	}

	.iig-modal--round .iig-modal-img {
		max-width: 92vw;
		max-height: 60vh;
	}
}
