/* ==========================================================================
   Kuma Kave Product Images — Frontend Styles
   ========================================================================== */

.kkpi-wrapper * {
	box-sizing: border-box;
}

/* ---------- Filter bar ---------- */
.kkpi-filter-bar {
	display: flex;
	justify-content: center;
	margin-bottom: 24px;
}

.kkpi-filter-select {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	border: 1px solid #e2e2e2;
	background: #f6f6f6 url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%23333' d='M0 0l6 8 6-8z'/%3E%3C/svg%3E") no-repeat right 16px center;
	color: #333;
	padding: 10px 40px 10px 18px;
	border-radius: 6px;
	font-size: 14px;
	cursor: pointer;
	min-width: 220px;
	transition: border-color 0.2s ease;
}

.kkpi-filter-select:hover,
.kkpi-filter-select:focus {
	border-color: #999;
	outline: none;
}

/* ---------- Grid ---------- */
.kkpi-grid-container {
	position: relative;
	min-height: 60px;
}

.kkpi-grid-container.kkpi-loading {
	opacity: 0.4;
	pointer-events: none;
}

.kkpi-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 20px;
}

.kkpi-columns-2 { grid-template-columns: repeat(2, 1fr); }
.kkpi-columns-3 { grid-template-columns: repeat(3, 1fr); }
.kkpi-columns-4 { grid-template-columns: repeat(4, 1fr); }
.kkpi-columns-5 { grid-template-columns: repeat(5, 1fr); }
.kkpi-columns-6 { grid-template-columns: repeat(6, 1fr); }

@media (max-width: 1024px) {
	.kkpi-columns-5,
	.kkpi-columns-6 { grid-template-columns: repeat(3, 1fr); }
	.kkpi-columns-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 767px) {
	.kkpi-grid {
		grid-template-columns: repeat(2, 1fr) !important;
	}
}

@media (max-width: 480px) {
	.kkpi-grid {
		grid-template-columns: repeat(1, 1fr) !important;
	}
}

.kkpi-product-item {
	text-align: center;
}

.kkpi-product-image {
	position: relative;
	overflow: hidden;
	border-radius: 8px;
	cursor: pointer;
	background: #f2f2f2;
}

.kkpi-product-image img {
	display: block;
	width: 100%;
	height: 280px;
	object-fit: cover;
	transition: transform 0.35s ease;
}

.kkpi-product-image:hover img {
	transform: scale(1.05);
}

.kkpi-hover-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.35);
	color: #fff;
	opacity: 0;
	transition: opacity 0.25s ease;
}

.kkpi-product-image:hover .kkpi-hover-overlay,
.kkpi-product-image:focus .kkpi-hover-overlay {
	opacity: 1;
}

.kkpi-product-title {
	margin-top: 12px;
	font-size: 15px;
	font-weight: 500;
	color: #222;
}

.kkpi-no-products {
	text-align: center;
	padding: 40px 0;
	grid-column: 1 / -1;
}

/* ---------- Pagination ---------- */
.kkpi-pagination {
	margin-top: 30px;
}

.kkpi-pagination-inner {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
}

.kkpi-page-btn {
	min-width: 38px;
	height: 38px;
	padding: 0 10px;
	border: 1px solid #e2e2e2;
	background: #fff;
	color: #333;
	border-radius: 6px;
	cursor: pointer;
	font-size: 14px;
	transition: all 0.2s ease;
}

.kkpi-page-btn:hover:not(:disabled) {
	background: #f2f2f2;
}

.kkpi-page-btn.active {
	background: #222;
	color: #fff;
	border-color: #222;
}

.kkpi-page-btn:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.kkpi-page-ellipsis {
	padding: 0 4px;
	color: #999;
}

/* ---------- Popup ---------- */
.kkpi-popup-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.85);
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease;
}

.kkpi-popup-overlay.kkpi-open {
	opacity: 1;
	visibility: visible;
}

.kkpi-popup-box {
	position: relative;
	background: #fff;
	border-radius: 10px;
	max-width: 800px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
	padding: 30px;
}

.kkpi-popup-close {
	position: absolute;
	top: 12px;
	right: 16px;
	background: transparent;
	border: none;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	color: #333;
	z-index: 2;
}

.kkpi-popup-loading {
	display: none;
	align-items: center;
	justify-content: center;
	padding: 80px 0;
}

.kkpi-popup-overlay.kkpi-is-loading .kkpi-popup-loading {
	display: flex;
}

.kkpi-popup-overlay.kkpi-is-loading .kkpi-popup-content {
	display: none;
}

.kkpi-spinner {
	width: 34px;
	height: 34px;
	border: 3px solid #eee;
	border-top-color: #333;
	border-radius: 50%;
	animation: kkpi-spin 0.8s linear infinite;
}

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

.kkpi-popup-title {
	font-size: 22px;
	margin: 0 0 20px;
	padding-right: 30px;
	text-align: center;
}

.kkpi-popup-main-image {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f7f7f7;
	border-radius: 8px;
	min-height: 320px;
}

.kkpi-popup-main-image img {
	max-width: 100%;
	max-height: 60vh;
	object-fit: contain;
	border-radius: 6px;
}

.kkpi-popup-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(255, 255, 255, 0.9);
	border: none;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	cursor: pointer;
	font-size: 14px;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.kkpi-popup-nav:hover {
	background: #fff;
}

.kkpi-popup-prev { left: 10px; }
.kkpi-popup-next { right: 10px; }

.kkpi-popup-thumbs {
	display: flex;
	gap: 10px;
	overflow-x: auto;
	margin-top: 18px;
	padding-bottom: 6px;
}

.kkpi-thumb-item {
	flex: 0 0 auto;
	width: 66px;
	height: 66px;
	border-radius: 6px;
	overflow: hidden;
	cursor: pointer;
	border: 2px solid transparent;
	opacity: 0.7;
	transition: all 0.2s ease;
}

.kkpi-thumb-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.kkpi-thumb-item:hover {
	opacity: 1;
}

.kkpi-thumb-item.active {
	border-color: #222;
	opacity: 1;
}

@media (max-width: 600px) {
	.kkpi-popup-box {
		padding: 20px 16px;
	}
	.kkpi-popup-main-image {
		min-height: 220px;
	}
}
