/* Instagram Feed Widget - Frontend Styles */

.ifw-feed-wrapper {
	position: relative;
	padding: 0 50px;
}

/* Full-bleed: keluar dari batas lebar konten tema dan penuh selebar browser. */
.ifw-feed-wrapper.ifw-fullwidth {
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
	box-sizing: border-box;
}

.ifw-feed-grid {
	display: flex;
	gap: 6px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	-ms-overflow-style: none;
	scrollbar-width: none;
}

.ifw-feed-grid::-webkit-scrollbar {
	display: none;
}

.ifw-item {
	position: relative;
	display: block;
	flex: 0 0 calc((100% - (var(--ifw-columns, 5) - 1) * 6px) / var(--ifw-columns, 5));
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: #f0f0f0;
	scroll-snap-align: start;
}

.ifw-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.35s ease;
}

.ifw-item:hover img {
	transform: scale(1.04);
}

.ifw-badge {
	position: absolute;
	top: 10px;
	right: 10px;
	filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.6));
	z-index: 2;
}

/* Overlay hover: like, comment, caption */
.ifw-hover-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	color: #fff;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 16px;
	opacity: 0;
	transition: opacity 0.25s ease;
}

.ifw-item:hover .ifw-hover-overlay {
	opacity: 1;
}

.ifw-hover-stats {
	display: flex;
	gap: 20px;
	align-items: center;
	font-weight: 600;
	font-size: 15px;
}

.ifw-stat {
	display: flex;
	align-items: center;
	gap: 6px;
}

.ifw-hover-caption {
	margin: 10px 0 0;
	font-size: 12.5px;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.ifw-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: #fff;
	border: 1px solid #e4e4e4;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
	cursor: pointer;
	font-size: 20px;
	line-height: 1;
	color: #262626;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 3;
}

.ifw-arrow-prev { left: 8px; }
.ifw-arrow-next { right: 8px; }

.ifw-error {
	padding: 10px 14px;
	background: #fdecea;
	border: 1px solid #f5c2c0;
	color: #611a15;
	border-radius: 4px;
	font-size: 13px;
}

/* ============ MODAL DETAIL ============ */

.ifw-modal {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.85);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 999999;
	padding: 32px 20px;
	box-sizing: border-box;
}

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

body.ifw-no-scroll {
	overflow: hidden;
}

.ifw-modal-card {
	background: #fff;
	width: min(760px, 100%);
	max-height: 82vh;
	display: flex;
	overflow: hidden;
	border-radius: 6px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.ifw-modal-image {
	position: relative;
	flex: 1.15;
	background: #000;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 0;
}

.ifw-modal-media {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.ifw-modal-media img,
.ifw-modal-media video {
	width: 100%;
	height: 100%;
	object-fit: contain;
	max-height: 82vh;
	display: block;
}

.ifw-modal-info {
	flex: 1;
	padding: 20px 22px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	min-width: 260px;
	font-size: 13px;
}

.ifw-modal-header {
	display: flex;
	align-items: center;
	gap: 10px;
}

.ifw-modal-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: #e0e0e0;
	overflow: hidden;
	display: inline-block;
	flex-shrink: 0;
}

.ifw-modal-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ifw-modal-username {
	font-size: 14px;
}

.ifw-modal-info hr {
	border: none;
	border-top: 1px solid #efefef;
	margin: 14px 0;
}

.ifw-modal-body {
	flex-grow: 1;
}

.ifw-modal-caption {
	font-size: 14px;
	line-height: 1.5;
	white-space: pre-line;
	margin: 0 0 10px;
}

.ifw-modal-contact {
	font-size: 13px;
	line-height: 1.8;
	color: #262626;
	margin: 0;
}

.ifw-modal-time-top {
	font-size: 11px;
	color: #8e8e8e;
	text-transform: uppercase;
	margin: 14px 0 0;
}

.ifw-modal-likes {
	font-weight: 600;
	font-size: 14px;
	margin: 0;
}

.ifw-modal-time-bottom {
	font-size: 11px;
	color: #8e8e8e;
	margin: 4px 0 16px;
}

.ifw-modal-view-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	font-weight: 600;
	color: #0095f6;
	text-decoration: none;
	margin-top: auto;
}

.ifw-modal-view-link svg path {
	fill: #0095f6;
}

.ifw-modal-close {
	position: absolute;
	top: 16px;
	right: 16px;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.4);
	color: #fff;
	border: none;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	z-index: 5;
}

.ifw-modal-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.9);
	border: none;
	font-size: 24px;
	cursor: pointer;
	z-index: 5;
	color: #262626;
}

.ifw-modal-prev { left: 24px; }
.ifw-modal-next { right: 24px; }

.ifw-carousel-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.85);
	border: none;
	font-size: 18px;
	cursor: pointer;
	z-index: 2;
}

.ifw-carousel-prev { left: 12px; }
.ifw-carousel-next { right: 12px; }

.ifw-carousel-dots {
	position: absolute;
	bottom: 14px;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	gap: 6px;
}

.ifw-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.5);
}

.ifw-dot-active {
	background: #fff;
}

/* Responsive */
@media (max-width: 900px) {
	.ifw-item {
		flex-basis: calc((100% - 2 * 6px) / 3);
	}

	.ifw-modal-card {
		flex-direction: column;
		max-height: 95vh;
		overflow-y: auto;
	}

	.ifw-modal-media img,
	.ifw-modal-media video {
		max-height: 50vh;
	}

	.ifw-modal-nav {
		display: none;
	}
}

@media (max-width: 560px) {
	.ifw-item {
		flex-basis: calc((100% - 1 * 6px) / 2);
	}
	.ifw-feed-wrapper {
		padding: 0 30px;
	}
}
