/* ShopKit Widgets — Product Grid */

.skg {
	--skg-accent: #e11d48;
	--skg-cols: 4;
	--skg-gap: 20px;
	--skg-ratio: 1 / 1;
	position: relative;
}
.skg *, .skg-host * { box-sizing: border-box; }
:is(.skg, .skg-qv) .screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

/* ---------- Toolbar (tabs / count / sort) ---------- */
.skg-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px 20px;
	margin-bottom: 22px;
}
.skg-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.skg .skg-tab {
	appearance: none;
	padding: 8px 18px;
	border: 1px solid #e5e7eb;
	border-radius: 999px;
	background: #fff;
	color: #374151;
	font-size: 14px;
	line-height: 1.2;
	cursor: pointer;
	box-shadow: none;
	transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.skg .skg-tab:hover,
.skg .skg-tab.is-active {
	background: var(--skg-accent);
	border-color: var(--skg-accent);
	color: #fff;
}
.skg-tools { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.skg-count { font-size: 14px; color: #6b7280; }
.skg .skg-sort {
	min-width: 160px;
	padding: 8px 12px;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	background-color: #fff;
	color: #374151;
	font-size: 14px;
	line-height: 1.3;
	height: auto;
}

/* ---------- Stage / grid ---------- */
.skg-stage { position: relative; }
.skg-grid {
	display: grid;
	grid-template-columns: repeat(var(--skg-cols), minmax(0, 1fr));
	gap: var(--skg-gap);
}
.skg-stage.is-loading .skg-grid { opacity: .45; pointer-events: none; transition: opacity .2s ease; }
.skg-stage.is-loading::after {
	content: "";
	position: absolute;
	top: 80px; left: 50%;
	width: 34px; height: 34px;
	margin-left: -17px;
	border: 3px solid rgba(0, 0, 0, .12);
	border-top-color: var(--skg-accent);
	border-radius: 50%;
	animation: skg-spin .7s linear infinite;
	z-index: 6;
}
@keyframes skg-spin { to { transform: rotate(360deg); } }

.skg-empty {
	grid-column: 1 / -1;
	padding: 56px 10px;
	text-align: center;
	color: #6b7280;
	font-size: 16px;
}

/* List layout */
.skg-layout-list .skg-grid { grid-template-columns: minmax(0, 1fr); }
.skg-layout-list .skg-card { flex-direction: row; }
.skg-layout-list .skg-card-media { flex: 0 0 32%; max-width: 100%; }
.skg-layout-list .skg-card-body { justify-content: center; padding: 18px 22px; }
.skg-layout-list .skg-btn-wrap .skg-btn { width: auto; }
@media (max-width: 560px) {
	.skg-layout-list .skg-card-media { flex-basis: 38%; }
	.skg-layout-list .skg-card-body { padding: 12px; }
	.skg-layout-list .skg-excerpt { display: none; }
}

/* Carousel layout */
.skg-layout-carousel .skg-grid {
	display: flex;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
	padding-bottom: 4px;
}
.skg-layout-carousel .skg-grid::-webkit-scrollbar { display: none; }
.skg-layout-carousel .skg-card {
	flex: 0 0 calc((100% - (var(--skg-cols) - 1) * var(--skg-gap)) / var(--skg-cols));
	scroll-snap-align: start;
}
.skg-arrow { display: none; }
.skg-has-arrows .skg-arrow {
	position: absolute;
	top: 38%;
	z-index: 5;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px; height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: #111827;
	box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
	cursor: pointer;
	transition: background-color .2s ease, color .2s ease, opacity .2s ease;
}
.skg-has-arrows .skg-arrow:hover { background: var(--skg-accent); color: #fff; }
.skg-has-arrows .skg-arrow[disabled] { opacity: 0; pointer-events: none; }
.skg-arrow svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.skg-prev { left: 8px; }
.skg-next { right: 8px; }

/* ---------- Card ---------- */
.skg-card {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	overflow: hidden;
	background: #fff;
	border: 1px solid #f0f0f0;
	border-radius: 10px;
	transition: box-shadow .25s ease, transform .25s ease, border-color .25s ease, background-color .25s ease;
}
.skg-card-media { position: relative; overflow: hidden; }
.skg-card-img {
	position: relative;
	display: block;
	aspect-ratio: var(--skg-ratio);
	overflow: hidden;
	background: #f3f4f6;
	line-height: 0;
}
.skg-card-img img {
	position: absolute;
	top: 0; left: 0;
	width: 100%; height: 100%;
	max-width: none;
	margin: 0;
	object-fit: cover;
	transition: transform .5s ease, opacity .35s ease;
}
.skg-ratio-auto .skg-card-img { aspect-ratio: auto; }
.skg-ratio-auto .skg-card-img img { position: static; height: auto; }
.skg-ratio-auto .skg-card-img img.skg-img-hover { position: absolute; height: 100%; }
.skg-card-img .skg-img-hover { opacity: 0; }
.skg-card:hover .skg-img-hover { opacity: 1; }
.skg-zoom .skg-card:hover .skg-img-main { transform: scale(1.06); }
.skg-zoom .skg-card-img.has-hover:hover .skg-img-main { transform: none; }
.skg-card.is-oos .skg-img-main { filter: grayscale(.55); opacity: .85; }

/* Badges */
.skg-badges {
	position: absolute;
	top: 10px; left: 10px;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 6px;
	pointer-events: none;
}
.skg-badge {
	display: inline-block;
	padding: 4px 10px;
	border-radius: 4px;
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.3;
}
.skg-badge-sale { background: var(--skg-accent); }
.skg-badge-new  { background: #059669; }
.skg-badge-oos  { background: #6b7280; }

/* Wishlist / quick view */
.skg-actions {
	position: absolute;
	top: 10px; right: 10px;
	z-index: 3;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.skg-actions-hover .skg-actions {
	opacity: 0;
	transform: translateX(8px);
	transition: opacity .25s ease, transform .25s ease;
}
.skg-actions-hover .skg-card:hover .skg-actions,
.skg-actions-hover .skg-actions:focus-within { opacity: 1; transform: none; }
@media (hover: none) {
	.skg-actions-hover .skg-actions { opacity: 1; transform: none; }
}
:is(.skg, .skg-qv) .skg-act {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px; height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: #111827;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
	cursor: pointer;
	line-height: 1;
	transition: background-color .2s ease, color .2s ease, transform .15s ease;
}
:is(.skg, .skg-qv) .skg-act:hover { background: var(--skg-accent); color: #fff; }
:is(.skg, .skg-qv) .skg-act:active { transform: scale(.92); }
.skg-act svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:is(.skg, .skg-qv) .skg-wish.is-active { color: var(--skg-accent); }
:is(.skg, .skg-qv) .skg-wish.is-active:hover { color: #fff; }
.skg-wish.is-active svg { fill: currentColor; }

/* Overlay add-to-cart */
.skg-overlay-btn {
	position: absolute;
	left: 0; right: 0; bottom: 0;
	z-index: 2;
	padding: 10px;
	transform: translateY(100%);
	transition: transform .3s ease;
}
.skg-card:hover .skg-overlay-btn,
.skg-overlay-btn:focus-within { transform: none; }
@media (hover: none) {
	.skg-overlay-btn { position: static; transform: none; padding: 10px 10px 0; }
}

/* Body */
.skg-card-body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 6px;
	padding: 14px;
}
.skg-cat { font-size: 12px; line-height: 1.3; color: #6b7280; }
.skg-cat a { color: inherit; text-decoration: none; }
.skg-cat a:hover { color: var(--skg-accent); }
.skg-title { margin: 0; padding: 0; font-size: 15px; font-weight: 600; line-height: 1.45; }
.skg-title a {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
	color: #111827;
	text-decoration: none;
}
.skg-title a:hover { color: var(--skg-accent); }
.skg-excerpt { margin: 0; font-size: 13px; line-height: 1.55; color: #6b7280; }
.skg-low { font-size: 12px; font-weight: 600; color: #d97706; }

/* Rating */
:is(.skg, .skg-qv) .skg-rating { display: flex; align-items: center; gap: 4px; line-height: 1; }
:is(.skg, .skg-qv) .skg-stars { position: relative; display: inline-block; font-size: 14px; letter-spacing: 2px; line-height: 1; white-space: nowrap; }
:is(.skg, .skg-qv) .skg-stars-bg { color: #d1d5db; }
:is(.skg, .skg-qv) .skg-stars-fg { position: absolute; top: 0; left: 0; overflow: hidden; white-space: nowrap; color: #f59e0b; }
:is(.skg, .skg-qv) .skg-rcount { font-size: 12px; color: #6b7280; }

/* Price */
:is(.skg, .skg-qv) .skg-price { font-size: 16px; font-weight: 700; line-height: 1.3; color: #111827; }
:is(.skg, .skg-qv) .skg-price del { margin-right: 6px; font-size: .85em; font-weight: 400; color: #9ca3af; text-decoration: line-through; opacity: 1; }
:is(.skg, .skg-qv) .skg-price ins { background: transparent; color: var(--skg-accent); text-decoration: none; }

/* Button */
.skg-btn-wrap { margin-top: auto; padding-top: 8px; }
:is(.skg, .skg-qv) .skg-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 16px;
	border: 1px solid transparent;
	border-radius: 6px;
	background: var(--skg-accent);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	box-shadow: none;
	transition: filter .2s ease, background-color .2s ease, color .2s ease, border-color .2s ease;
}
:is(.skg, .skg-qv) .skg-btn:hover { color: #fff; filter: brightness(.92); }
:is(.skg, .skg-qv) .skg-btn-block { display: flex; width: 100%; }
.skg-btn-icon { width: 1.15em; height: 1.15em; fill: currentColor; flex: 0 0 auto; }
:is(.skg, .skg-qv) .skg-btn.is-disabled { background: #e5e7eb; color: #6b7280; cursor: not-allowed; filter: none; }
:is(.skg, .skg-qv) .skg-btn.is-loading { pointer-events: none; opacity: .85; }
.skg-btn.is-loading::after {
	content: "";
	width: 14px; height: 14px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: skg-spin .6s linear infinite;
}
.skg-btn.is-added { filter: none; }

/* ---------- Pagination ---------- */
.skg-pager {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin-top: 28px;
}
.skg-pager:empty { display: none; }
.skg .skg-page {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px; height: 40px;
	padding: 0 12px;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	background: #fff;
	color: #374151;
	font-size: 14px;
	line-height: 1;
	cursor: pointer;
	box-shadow: none;
	transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.skg .skg-page:hover:not(:disabled),
.skg .skg-page.is-active { background: var(--skg-accent); border-color: var(--skg-accent); color: #fff; }
.skg .skg-page:disabled { opacity: .4; cursor: not-allowed; }
.skg-page svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.skg-dots { padding: 0 4px; color: #9ca3af; }
.skg .skg-more {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 32px;
	border: 1px solid var(--skg-accent);
	border-radius: 999px;
	background: #fff;
	color: var(--skg-accent);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	box-shadow: none;
	transition: background-color .2s ease, color .2s ease;
}
.skg .skg-more:hover { background: var(--skg-accent); color: #fff; }
.skg .skg-more.is-loading { pointer-events: none; opacity: .7; }
.skg .skg-more.is-loading::after {
	content: "";
	width: 14px; height: 14px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: skg-spin .6s linear infinite;
}
.skg-sentinel { display: block; width: 100%; height: 1px; }
.skg-spinner {
	width: 28px; height: 28px;
	border: 3px solid rgba(0, 0, 0, .12);
	border-top-color: var(--skg-accent);
	border-radius: 50%;
	animation: skg-spin .7s linear infinite;
}

/* ---------- Responsive ---------- */
@media (max-width: 767px) {
	.skg-card-body { padding: 10px; }
	.skg-title { font-size: 14px; }
	:is(.skg, .skg-qv) .skg-price { font-size: 15px; }
	:is(.skg, .skg-qv) .skg-btn { padding: 9px 10px; font-size: 13px; }
	.skg-tools { width: 100%; justify-content: space-between; margin-left: 0; }
	.skg-filters { flex-wrap: nowrap; overflow-x: auto; margin: 0 -2px; padding-bottom: 4px; scrollbar-width: none; }
	.skg-filters::-webkit-scrollbar { display: none; }
	.skg .skg-tab { white-space: nowrap; }
}

/* ---------- Quick view modal ---------- */
html.skg-lock { overflow: hidden; }
.skg-qv {
	position: fixed;
	top: 0; right: 0; bottom: 0; left: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	opacity: 0;
	visibility: hidden;
	transition: opacity .25s ease, visibility 0s linear .25s;
	--skg-accent: #e11d48;
	color: #111827;
}
.skg-qv.is-open { opacity: 1; visibility: visible; transition-delay: 0s; }
.skg-qv-bg { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0, 0, 0, .55); }
.skg-qv-box {
	position: relative;
	width: 100%;
	max-width: 920px;
	max-height: 90vh;
	overflow: auto;
	padding: 28px;
	border-radius: 12px;
	background: #fff;
	box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
	transform: translateY(18px);
	transition: transform .25s ease;
}
.skg-qv.is-open .skg-qv-box { transform: none; }
.skg-qv .skg-qv-close {
	position: absolute;
	top: 12px; right: 12px;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px; height: 34px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #f3f4f6;
	color: #111827;
	cursor: pointer;
	box-shadow: none;
}
.skg-qv .skg-qv-close:hover { background: var(--skg-accent); color: #fff; }
.skg-qv-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.skg-qv-loading { display: flex; justify-content: center; padding: 70px 0; }
.skg-qv-loading span {
	width: 36px; height: 36px;
	border: 3px solid rgba(0, 0, 0, .12);
	border-top-color: var(--skg-accent);
	border-radius: 50%;
	animation: skg-spin .7s linear infinite;
}
.skg-qv-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 30px; }
.skg-qv-main { overflow: hidden; border-radius: 8px; background: #f3f4f6; line-height: 0; }
.skg-qv-main img { display: block; width: 100%; height: auto; }
.skg-qv-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.skg-qv .skg-qv-thumb {
	width: 62px; height: 62px;
	padding: 0;
	overflow: hidden;
	border: 2px solid transparent;
	border-radius: 6px;
	background: #f3f4f6;
	cursor: pointer;
	line-height: 0;
	box-shadow: none;
}
.skg-qv .skg-qv-thumb.is-active, .skg-qv .skg-qv-thumb:hover { border-color: var(--skg-accent); }
.skg-qv-thumb img { width: 100%; height: 100%; object-fit: cover; }
.skg-qv-info { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.skg-qv-title { margin: 0; padding-right: 30px; font-size: 22px; font-weight: 700; line-height: 1.3; color: #111827; }
.skg-qv-desc { font-size: 14px; line-height: 1.65; color: #4b5563; }
.skg-qv-desc p { margin: 0 0 8px; }
.skg-qv-buy { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 4px; }
.skg-qv-buy .skg-btn { flex: 1 1 160px; padding: 12px 18px; }
.skg-qv-meta { padding-top: 12px; border-top: 1px solid #e5e7eb; font-size: 13px; line-height: 1.7; color: #6b7280; }
.skg-qv-meta a { color: inherit; }
.skg-qv-meta span { font-weight: 600; color: #374151; }
.skg-qv-link { font-size: 14px; font-weight: 600; color: var(--skg-accent); text-decoration: none; }
.skg-qv-link:hover { text-decoration: underline; }

.skg-qty { display: inline-flex; align-items: center; border: 1px solid #e5e7eb; border-radius: 6px; overflow: hidden; }
.skg-qv .skg-qty-btn {
	width: 38px; height: 44px;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: #f9fafb;
	color: #111827;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	box-shadow: none;
}
.skg-qv .skg-qty-btn:hover { background: #f3f4f6; color: #111827; }
.skg-qv .skg-qty-input {
	width: 48px; height: 44px;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: #fff;
	color: #111827;
	font-size: 15px;
	text-align: center;
	-moz-appearance: textfield;
	box-shadow: none;
}
.skg-qty-input::-webkit-outer-spin-button,
.skg-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

@media (max-width: 700px) {
	.skg-qv { padding: 10px; align-items: flex-end; }
	.skg-qv-box { padding: 18px; max-height: 92vh; border-radius: 14px 14px 0 0; }
	.skg-qv-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
	.skg-qv-title { font-size: 19px; }
}

/* ---------- Toast ---------- */
.skg-toast {
	position: fixed;
	left: 50%; bottom: 28px;
	z-index: 1000000;
	max-width: calc(100% - 32px);
	padding: 11px 20px;
	border-radius: 8px;
	background: #111827;
	color: #fff;
	font-size: 14px;
	line-height: 1.4;
	opacity: 0;
	pointer-events: none;
	transform: translate(-50%, 16px);
	transition: opacity .25s ease, transform .25s ease;
}
.skg-toast.is-show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
	.skg *, .skg-qv *, .skg-toast { transition: none !important; animation-duration: .01s !important; }
}
