/* ShopKit Widgets — Archive (Shop / Category / Tag pages) */

.skar-heading, .skar-toolbar, .skar-filters, .skar-subcats, .skar-pagination { box-sizing: border-box; }
.skar-heading *, .skar-toolbar *, .skar-filters *, .skar-subcats * { box-sizing: border-box; }

/* ---------- Heading ---------- */
.skar-heading { display: flex; flex-direction: column; gap: 8px; }
.skar-heading.has-img { flex-direction: row; align-items: center; gap: 20px; }
.skar-heading-img { flex: 0 0 96px; width: 96px; }
.skar-heading-img img { display: block; width: 100%; height: auto; border-radius: 12px; }
.skar-heading-text { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.skar-title { margin: 0; font-size: 32px; font-weight: 700; line-height: 1.25; color: #111827; }
.skar-count { font-size: 14px; color: #6b7280; }
.skar-desc { font-size: 15px; line-height: 1.7; color: #6b7280; }
.skar-desc p { margin: 0 0 8px; }
.skar-desc p:last-child { margin-bottom: 0; }

/* ---------- Sub-categories ---------- */
.skar-subcats { --skar-cols: 6; display: grid; grid-template-columns: repeat(var(--skar-cols), minmax(0, 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; }
.skar-subcats li { margin: 0; padding: 0; }
.skar-sc-item { display: flex; flex-direction: column; align-items: center; gap: 8px; color: #111827; text-align: center; text-decoration: none; }
.skar-sc-img { display: block; width: 100%; aspect-ratio: 1 / 1; overflow: hidden; border: 2px solid transparent; background: #f3f4f6; transition: border-color .2s ease; }
.skar-sc-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.skar-shape-circle .skar-sc-img { border-radius: 50%; }
.skar-shape-rounded .skar-sc-img { border-radius: 14px; }
.skar-shape-square .skar-sc-img { border-radius: 0; }
.skar-sc-name { font-size: 14px; font-weight: 600; line-height: 1.35; color: #111827; transition: color .2s ease; }
.skar-sc-count { font-size: 12px; color: #9ca3af; }
.skar-sc-item:hover .skar-sc-name { color: #e11d48; }
.skar-sc-item:hover .skar-sc-img { border-color: #e11d48; }

.skar-subcats-pill { display: flex; flex-wrap: wrap; gap: 10px; }
.skar-subcats-pill .skar-sc-item { flex-direction: row; gap: 6px; padding: 8px 16px; border: 1px solid #e5e7eb; border-radius: 999px; background: #fff; transition: background-color .2s ease, border-color .2s ease; }
.skar-subcats-pill .skar-sc-item:hover { background: #f9fafb; }

/* ---------- Toolbar ---------- */
.skar-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 0 0 14px; margin-bottom: 20px; border-bottom: 1px solid #f3f4f6; }
.skar-result-count { margin: 0; font-size: 14px; color: #6b7280; }
.skar-sort { display: flex; align-items: center; gap: 10px; margin: 0 0 0 auto; }
.skar-sort-label { font-size: 14px; font-weight: 600; color: #111827; white-space: nowrap; }
.skar-orderby { min-width: 170px; height: 42px; padding: 0 34px 0 12px; border: 1px solid #d1d5db; border-radius: 8px; background-color: #fff; color: #111827; font-size: 14px; box-shadow: none; }

/* ---------- Archive products ---------- */
.skar-products { margin: 0; }

/* ---------- Pagination ---------- */
.skar-pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 36px; }
.skar-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 42px;
	height: 42px;
	padding: 0 12px;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	background: #fff;
	color: #111827;
	font-size: 15px;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.skar-pagination a.page-numbers:hover,
.skar-pagination .page-numbers.current { background: #111827; border-color: #111827; color: #fff; }
.skar-pagination .page-numbers.dots { border-color: transparent; background: transparent; }
.skar-pagination .page-numbers.dots:hover { color: #111827; background: transparent; }

/* ---------- Filters ---------- */
.skar-filters { --skar-accent: #e11d48; --skar-track: #e5e7eb; --skar-fill: var( --skar-accent ); --skar-thumb: #fff; --skar-thumb-border: var( --skar-accent ); position: relative; }
.skar-form { padding: 0; border: 0 solid #e5e7eb; background: transparent; }
.skar-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.skar-panel-title { margin: 0 0 6px; font-size: 20px; font-weight: 700; color: #111827; }
.skar-close, .skar-filter-open, .skar-overlay { display: none; }

.skar-group { padding: 14px 0; border: 0 solid #f0f0f0; border-top-width: 1px; }
.skar-panel-head + .skar-group, .skar-active + .skar-group { border-top-width: 1px; }
.skar-group > summary, .skar-group-title { display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; font-size: 15px; font-weight: 700; color: #111827; cursor: pointer; list-style: none; }
.skar-group-title { cursor: default; }
.skar-group > summary::-webkit-details-marker { display: none; }
.skar-group > summary::after { content: ""; width: 8px; height: 8px; margin-right: 4px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .2s ease; }
.skar-group[open] > summary::after { transform: rotate(-135deg); }
.skar-group:not([open]) > summary { margin-bottom: 0; }

.skar-opt { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 0; color: #374151; font-size: 14px; line-height: 1.4; text-decoration: none; cursor: pointer; transition: color .15s ease; }
.skar-opt:hover { color: var(--skar-accent); }
.skar-opt-count { flex: 0 0 auto; font-size: 12px; color: #9ca3af; }

/* Category list */
.skar-cat-list { margin: 0; padding: 0; list-style: none; }
.skar-cat-list.is-child { margin-left: 14px; padding-left: 10px; border-left: 1px solid #f0f0f0; }
.skar-cat-list li { margin: 0; padding: 0; }
.skar-cat-list li.is-current > .skar-opt { color: var(--skar-accent); font-weight: 700; }

/* Checkboxes / radios */
.skar-check, .skar-rate { justify-content: flex-start; gap: 10px; }
.skar-check input, .skar-rate input { flex: 0 0 auto; width: 18px; height: 18px; margin: 0; accent-color: var(--skar-accent); cursor: pointer; }
.skar-check .skar-check-text { flex: 1 1 auto; }
.skar-check .skar-opt-count { margin-left: auto; }
.skar-stars { color: #f59e0b; font-size: 16px; letter-spacing: 1px; }
.skar-stars em { color: #d1d5db; font-style: normal; }
.skar-rate-text { font-size: 13px; color: #6b7280; }

/* Price range */
.skar-range { position: relative; height: 22px; margin: 4px 6px 14px; }
.skar-range-track { position: absolute; top: 9px; left: 0; right: 0; height: 4px; border-radius: 999px; background: var(--skar-track); }
.skar-range-fill { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: var(--skar-fill); }
.skar-range input[type="range"] { position: absolute; top: 0; left: -6px; width: calc(100% + 12px); height: 22px; margin: 0; padding: 0; background: transparent; pointer-events: none; -webkit-appearance: none; appearance: none; }
.skar-range input[type="range"]::-webkit-slider-runnable-track { height: 22px; background: transparent; border: 0; }
.skar-range input[type="range"]::-moz-range-track { height: 22px; background: transparent; border: 0; }
.skar-range input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; margin-top: 2px; border: 2px solid var(--skar-thumb-border); border-radius: 50%; background: var(--skar-thumb); cursor: grab; pointer-events: auto; box-shadow: 0 1px 4px rgba(0, 0, 0, .2); }
.skar-range input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border: 2px solid var(--skar-thumb-border); border-radius: 50%; background: var(--skar-thumb); cursor: grab; pointer-events: auto; box-shadow: 0 1px 4px rgba(0, 0, 0, .2); }
.skar-range input[type="range"]:active::-webkit-slider-thumb { cursor: grabbing; }

.skar-price-inputs { display: flex; align-items: center; gap: 8px; }
.skar-price-inputs i { color: #9ca3af; font-style: normal; }
.skar-price-inputs label { position: relative; flex: 1 1 0; min-width: 0; }
.skar-price-inputs label span { position: absolute; top: 50%; left: 10px; transform: translateY(-50%); font-size: 13px; color: #9ca3af; pointer-events: none; }
.skar-price-inputs input { width: 100%; height: 40px; padding: 0 8px 0 26px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; color: #111827; font-size: 14px; box-shadow: none; -moz-appearance: textfield; appearance: textfield; }
.skar-price-inputs input::-webkit-outer-spin-button, .skar-price-inputs input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Active filters */
.skar-active { padding: 10px 0 14px; }
.skar-active-title { margin-bottom: 8px; font-size: 13px; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; }
.skar-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.skar-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; background: #f3f4f6; color: #111827; font-size: 13px; line-height: 1.3; text-decoration: none; transition: background-color .2s ease; }
.skar-chip:hover { background: #fee2e2; }
.skar-chip span { font-size: 15px; line-height: 1; color: #6b7280; }
.skar-chip-clear { align-self: center; font-size: 13px; color: var(--skar-accent); text-decoration: underline; }

/* Buttons */
.skar-actions { display: none; flex-direction: column; gap: 8px; padding-top: 14px; border-top: 1px solid #f0f0f0; }
.skar-actions.has-clear { display: flex; }
.skar-actions .skar-show { display: none; }
.skar-btn { display: inline-flex; align-items: center; justify-content: center; padding: 12px 16px; border: 1px solid transparent; border-radius: 8px; font-size: 14px; font-weight: 600; line-height: 1.2; text-align: center; text-decoration: none; cursor: pointer; box-shadow: none; transition: background-color .2s ease, color .2s ease; }
.skar-btn-apply { background: var( --skar-accent, #111827 ); color: #fff; }
.skar-btn-apply:hover { filter: brightness( .92 ); color: #fff; }
.skar-btn-clear { background: transparent; color: #6b7280; font-weight: 500; }
.skar-btn-clear:hover { color: var(--skar-accent); }

/* ---------- Tablet / mobile: filters in a side panel ---------- */
@media (max-width: 1024px) {
	.skar-filters.has-mobile-btn .skar-filter-open {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		padding: 11px 20px;
		border: 0;
		border-radius: 8px;
		background: #111827;
		color: #fff;
		font-size: 14px;
		font-weight: 600;
		cursor: pointer;
		box-shadow: none;
	}
	.skar-filters.has-mobile-btn .skar-overlay {
		display: block;
		position: fixed;
		top: 0; right: 0; bottom: 0; left: 0;
		z-index: 999997;
		background: rgba(0, 0, 0, .5);
		opacity: 0;
		visibility: hidden;
		transition: opacity .3s ease, visibility 0s linear .3s;
	}
	.skar-filters.has-mobile-btn .skar-form {
		position: fixed;
		top: 0;
		bottom: 0;
		left: 0;
		z-index: 999998;
		width: min(360px, 90vw);
		padding: 18px 20px 24px;
		overflow-y: auto;
		background: #fff;
		box-shadow: 0 10px 40px rgba(0, 0, 0, .2);
		transform: translateX(-100%);
		visibility: hidden;
		transition: transform .35s ease, visibility 0s linear .35s;
	}
	.skar-filters.has-mobile-btn.is-open .skar-overlay { opacity: 1; visibility: visible; transition-delay: 0s; }
	.skar-filters.has-mobile-btn.is-open .skar-form { transform: none; visibility: visible; transition-delay: 0s; }
	.skar-filters.has-mobile-btn .skar-close {
		display: inline-flex;
		padding: 6px;
		border: 0;
		border-radius: 6px;
		background: transparent;
		color: #111827;
		line-height: 0;
		cursor: pointer;
		box-shadow: none;
	}
	.skar-close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
	.skar-filters.has-mobile-btn .skar-actions { display: flex; position: sticky; bottom: -24px; padding-bottom: 6px; background: #fff; }
	.skar-filters.has-mobile-btn .skar-actions .skar-show { display: inline-flex; }
}
html.skar-lock { overflow: hidden; }

@media (max-width: 767px) {
	.skar-title { font-size: 26px; }
	.skar-sort { width: 100%; margin-left: 0; }
	.skar-orderby { flex: 1 1 auto; }
	.skar-heading.has-img { flex-direction: column; align-items: flex-start; }
}

/* ---------- Sub-category tabs: active state ---------- */
.skar-sc-item.is-active .skar-sc-name { color: #e11d48; }
.skar-subcats-card .skar-sc-item.is-active .skar-sc-img { border-color: #e11d48; }
.skar-subcats-pill .skar-sc-item.is-active { border-color: #e11d48; background: #e11d48; }
.skar-subcats-pill .skar-sc-item.is-active .skar-sc-name { color: #fff; }

/* ---------- Loading state while products are swapped (no page reload) ---------- */
.skw-tpl-archive.skar-is-loading [data-widget_type^="skw_archive_products"],
.skw-tpl-archive.skar-is-loading [data-widget_type^="skw_ar_toolbar"] { opacity: .45; pointer-events: none; transition: opacity .15s ease; }
.skw-tpl-archive.skar-is-loading::before {
	content: "";
	position: fixed;
	top: 0; left: 0;
	z-index: 1000001;
	width: 100%;
	height: 3px;
	background: linear-gradient( 90deg, transparent, #e11d48, transparent );
	background-size: 40% 100%;
	background-repeat: no-repeat;
	animation: skar-bar 1s linear infinite;
}
@keyframes skar-bar { from { background-position: -40% 0; } to { background-position: 140% 0; } }
