/**
 * Smykketing Algolia - frontend-styling.
 * Brandfarve: #ba6f6e. Bygger oven på instantsearch.css satellite (ais-*-klasser).
 */

:root {
	--sta-brand: #ba6f6e;
	--sta-brand-rgb: 186, 111, 110;
}

/* Søgeknap ([sta_search]) */
.sta-search {
	width: 100%;
	max-width: 560px;
}

/* Fuld bredde på tablet og mobil (Breakdance-breakpoint: 1120px) */
@media (max-width: 1119px) {
	.sta-search {
		max-width: none;
	}
}

.sta-search-field {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	height: 44px;
	padding: 0 14px;
	border: 1px solid #ddd;
	border-radius: 4px;
	background: #fff;
	transition: border-color 0.15s ease;
}

.sta-search-field:hover,
.sta-search-field:focus-within {
	border-color: var(--sta-brand);
}

.sta-search-field__icon {
	flex-shrink: 0;
	color: var(--sta-brand);
}

.sta-search-field__input {
	flex: 1;
	min-width: 0;
	height: 100%;
	margin: 0;
	padding: 0;
	border: none;
	background: none;
	box-shadow: none;
	color: #222;
	font-size: 15px;
	outline: none;
	cursor: text;
}

.sta-search-field__input::placeholder {
	color: #6b6b6b;
}

/* Readonly = knap-tilstand på tablet/mobil (overlayet har sit eget felt) */
.sta-search-field__input[readonly] {
	cursor: pointer;
}

.sta-search-field__input::-webkit-search-cancel-button {
	-webkit-appearance: none;
	appearance: none;
}

/* Modal */
.sta-modal-open,
.sta-modal-open body {
	overflow: hidden;
}

.sta-modal {
	position: fixed;
	inset: 0;
	top: var(--sta-modal-top, 0px); /* Sættes af JS = bunden af headeren */
	z-index: 99999;
}

.sta-modal[hidden] {
	display: none;
}

.sta-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
}

.sta-modal__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
	margin: 0;
	background: #fff;
	border-radius: 0;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
	overflow: hidden;
}

.sta-modal__head {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 14px 16px 10px;
}

/* Desktop: headerens felt er søgefeltet - overlayet viser kun resultater */
@media (min-width: 1120px) {
	.sta-modal__searchbox {
		display: none;
	}

	.sta-modal__head {
		justify-content: flex-end;
		padding: 8px 16px 0;
	}
}

.sta-modal__searchbox {
	flex: 1;
}

.sta-modal__close {
	width: 40px;
	height: 40px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: transparent;
	color: #666;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
}

.sta-modal__close:hover {
	background: #f3f3f3;
	color: var(--sta-brand);
}

/* Toolbar: antal, pris-slider, sortering */
.sta-modal__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px 24px;
	padding: 4px 16px 14px;
	border-bottom: 1px solid #eee;
}

.sta-modal__meta {
	display: flex;
	align-items: center;
	gap: 14px;
	min-width: 0;
}

.sta-modal__stats {
	color: #666;
	font-size: 14px;
}

/* Algolia-logo (poweredBy) - krav på Build-planen */
.sta-modal__powered .ais-PoweredBy {
	display: flex;
	align-items: center;
	font-size: 11px;
	color: #888;
}

.sta-modal__powered .ais-PoweredBy-link {
	display: flex;
	align-items: center;
}

.sta-modal__powered .ais-PoweredBy-logo {
	width: auto;
	height: 14px;
}

.sta-modal__sort {
	margin-left: auto;
}

/* Filtre-knap (kun mobil) */
.sta-modal__filters-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	gap: 7px;
	height: 38px;
	padding: 0 14px;
	border: 1px solid var(--sta-brand);
	border-radius: 4px;
	background: #fff;
	color: var(--sta-brand);
	font-size: 14px;
	cursor: pointer;
}

/* Body: filter-sidebar + hits */
.sta-modal__body {
	display: flex;
	flex: 1;
	min-height: 0;
}

.sta-modal__filters {
	flex-shrink: 0;
	width: 260px;
	padding: 14px 18px;
	border-right: 1px solid #eee;
	overflow-x: hidden; /* Slider-tooltips må ikke give sidelæns scroll */
	overflow-y: auto;
}

.sta-modal__filters-head {
	display: none;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 6px;
	font-weight: 600;
}

.sta-modal__filters-close {
	width: 36px;
	height: 36px;
	padding: 0;
	border: none;
	background: transparent;
	color: #666;
	font-size: 24px;
	cursor: pointer;
}

.sta-modal__filter-title {
	margin: 18px 0 8px;
	font-size: 15px;
}

.sta-modal__filter-title:first-of-type {
	margin-top: 0;
}

.sta-modal__slider {
	padding: 30px 14px 6px; /* Plads til pris-tooltips over håndtagene */
}

.sta-modal__filters-apply {
	display: none;
	width: 100%;
	margin-top: 16px;
	padding: 12px;
	border: none;
	border-radius: 3px;
	background: var(--sta-brand);
	color: #fff;
	font-weight: 600;
	cursor: pointer;
}

.sta-modal__hits {
	flex: 1;
	padding: 16px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.sta-modal__empty {
	padding: 40px 0;
	color: #666;
	text-align: center;
}

/* InstantSearch-overrides */
.sta-modal .ais-SearchBox-input {
	height: 44px;
	border-color: #ddd;
	box-shadow: none;
	background: #fff;
	color: #222;
}

.sta-modal .ais-SearchBox-input:focus {
	border-color: var(--sta-brand);
	outline: none;
}

.sta-modal .ais-SearchBox-input::placeholder {
	color: #888;
}

.sta-modal .ais-SortBy-select {
	-webkit-appearance: none;
	appearance: none;
	height: 40px;
	max-width: 100%;
	padding: 0 32px 0 10px;
	border: 1px solid #ddd;
	border-radius: 4px;
	background-color: #fff;
	/* Egen pil i brandfarve (temaets blå overstyres) */
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 20 20'%3E%3Cpath d='M5 8l5 5 5-5' fill='none' stroke='%23ba6f6e' stroke-width='2'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	background-size: 12px;
	color: #222;
	box-shadow: none;
}

/* Aktiv (ikke-standard) sortering markeres, så rækkefølgen ikke virker tilfældig */
.sta-modal__sort--active .ais-SortBy-select {
	border-color: var(--sta-brand);
	color: var(--sta-brand);
	font-weight: 500;
}

.sta-modal .ais-SortBy-select:focus,
.sta-modal .ais-SortBy-select:focus-visible {
	border-color: var(--sta-brand);
	outline: none;
	box-shadow: 0 0 0 3px rgba(var(--sta-brand-rgb), 0.15);
}

/* Kategori-filter - lukket accordion m. egne pile (temaets pil overstyres) */
.sta-modal .ais-HierarchicalMenu-link {
	display: flex;
	align-items: center;
	color: #444;
}

.sta-modal .ais-HierarchicalMenu-link::before {
	content: '';
	flex-shrink: 0;
	width: 7px;
	height: 7px;
	margin-right: 9px;
	border-right: 2px solid #b5b5b5;
	border-bottom: 2px solid #b5b5b5;
	background: none;
	transform: rotate(-45deg); /* Højre = lukket */
	transition: transform 0.15s ease;
}

.sta-modal .ais-HierarchicalMenu-item--selected > div > .ais-HierarchicalMenu-link::before {
	border-color: var(--sta-brand);
	transform: rotate(45deg); /* Ned = åben */
}

.sta-modal .ais-HierarchicalMenu-item--selected > div > .ais-HierarchicalMenu-link,
.sta-modal .ais-HierarchicalMenu-link--selected {
	color: var(--sta-brand);
	font-weight: 600;
}

.sta-modal .ais-HierarchicalMenu-list--child {
	margin-left: 16px;
}

.sta-modal .ais-HierarchicalMenu-count {
	background: #f3f3f3;
	color: #777;
}

/* Skjul udsolgte-switch (øverst i filtrene) */
.sta-modal__toggle {
	margin: 0 0 16px;
	padding-bottom: 14px;
	border-bottom: 1px solid #eee;
}

/* row-reverse: checkboxen står først i DOM, men skal vises til højre for teksten */
.sta-modal .ais-ToggleRefinement-label {
	display: flex;
	flex-direction: row-reverse;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	cursor: pointer;
	font-size: 14px;
	color: #444;
}

/* Egen switch i brandfarve (temaets blå overstyres helt) */
.sta-modal .ais-ToggleRefinement-checkbox {
	-webkit-appearance: none;
	appearance: none;
	position: relative;
	flex-shrink: 0;
	width: 40px;
	height: 22px;
	margin: 0;
	border: none;
	border-radius: 11px;
	background: #d6d6d6;
	background-image: none;
	box-shadow: none;
	outline: none;
	cursor: pointer;
	transition: background 0.15s ease;
}

.sta-modal .ais-ToggleRefinement-checkbox::after {
	content: none;
}

.sta-modal .ais-ToggleRefinement-checkbox::before {
	content: '';
	position: absolute;
	top: 3px;
	left: 3px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
	transition: transform 0.15s ease;
}

.sta-modal .ais-ToggleRefinement-checkbox:checked {
	background: var(--sta-brand);
}

.sta-modal .ais-ToggleRefinement-checkbox:checked::before {
	transform: translateX(18px);
}

/* Nulstil filtre (øverst i filtrene) */
.sta-modal .ais-ClearRefinements {
	margin-bottom: 16px;
}

.sta-modal .ais-ClearRefinements-button {
	width: 100%;
	padding: 9px 12px;
	border: 1px solid #ddd;
	border-radius: 3px;
	background: #fff;
	color: #555;
	cursor: pointer;
}

.sta-modal .ais-ClearRefinements-button:hover {
	border-color: var(--sta-brand);
	color: var(--sta-brand);
}

.sta-modal .ais-ClearRefinements-button--disabled {
	display: none;
}

/* Pris-slider (rheostat-klasser fra rangeSlider-widget) */
.sta-modal .ais-RangeSlider .rheostat-progress {
	background-color: var(--sta-brand);
}

.sta-modal .ais-RangeSlider .rheostat-handle {
	width: 20px;
	height: 20px;
	background: #fff;
	border: 2px solid var(--sta-brand);
	border-radius: 50%;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
	cursor: grab;
}

/* Temaets greb-streger i håndtagene fjernes (tooltippen er et rigtigt element og rammes ikke) */
.sta-modal .ais-RangeSlider .rheostat-handle::before,
.sta-modal .ais-RangeSlider .rheostat-handle::after {
	content: none;
}

.sta-modal .ais-RangeSlider .rheostat-tooltip {
	position: absolute;
	top: -30px;
	left: 50%;
	transform: translateX(-50%);
	padding: 1px 7px;
	background: #fff;
	border: 1px solid #eee;
	border-radius: 3px;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
	color: #444;
	font-size: 12px;
	white-space: nowrap;
}

/* Produktgrid i overlay - genbruger .sta-card-designet */
/* Faste kolonneantal - alle går op i hitsPerPage (12), så sidste række altid er fyldt */
.sta-modal .ais-InfiniteHits-list {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	align-items: stretch;
	gap: 16px;
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 1500px) {
	.sta-modal .ais-InfiniteHits-list {
		grid-template-columns: repeat(6, minmax(0, 1fr));
	}
}

@media (max-width: 1099px) {
	.sta-modal .ais-InfiniteHits-list {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 767px) {
	.sta-modal .ais-InfiniteHits-list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* Temaet centrerer hit-elementer lodret - tving stretch, så alle kort er lige høje */
.sta-modal .ais-InfiniteHits-item {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	justify-content: flex-start;
	height: 100%;
	margin: 0;
	padding: 0;
	background: none;
	box-shadow: none;
}

.sta-modal .ais-InfiniteHits-item .sta-card {
	flex: 1;
}

.sta-modal .sta-card {
	width: 100%;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.sta-modal .ais-InfiniteHits {
	text-align: center; /* Centrerer "Vis flere varer" */
}

.sta-modal .ais-InfiniteHits-loadMore {
	display: inline-block;
	min-width: 240px;
	height: auto;
	margin: 24px auto 10px;
	padding: 14px 36px;
	border: 1px solid var(--sta-brand);
	border-radius: 2px;
	background: #fff;
	color: var(--sta-brand);
	font-size: 15px;
	font-weight: 500;
	line-height: 1.2;
	box-shadow: none;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.sta-modal .ais-InfiniteHits-loadMore:hover {
	background: var(--sta-brand);
	color: #fff;
}

.sta-modal .ais-InfiniteHits-loadMore:focus,
.sta-modal .ais-InfiniteHits-loadMore:focus-visible,
.sta-card .sta-card__button:focus,
.sta-card .sta-card__button:focus-visible {
	outline: none;
	border-color: var(--sta-brand);
	box-shadow: 0 0 0 3px rgba(var(--sta-brand-rgb), 0.15);
}

.sta-modal .ais-InfiniteHits-loadMore--disabled {
	display: none;
}

/* Anbefalings-slider ([sta_recommendations]) */
.sta-reco {
	display: none; /* Skjult indtil JS har data */
	margin: 2.5em 0;
}

.sta-reco--loaded {
	display: block;
}

.sta-reco__title {
	margin: 0 0 0.75em;
}

.sta-reco__wrap {
	position: relative;
}

/* Udtoning i kanterne - vises kun når der er mere at scrolle til */
.sta-reco__wrap::before,
.sta-reco__wrap::after {
	content: '';
	position: absolute;
	top: 0;
	bottom: 12px;
	z-index: 1;
	width: 70px;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

.sta-reco__wrap::before {
	left: 0;
	background: linear-gradient(to right, var(--sta-fade, #fff) 15%, rgba(255, 255, 255, 0));
}

.sta-reco__wrap::after {
	right: 0;
	background: linear-gradient(to left, var(--sta-fade, #fff) 15%, rgba(255, 255, 255, 0));
}

.sta-reco__wrap--fade-start::before,
.sta-reco__wrap--fade-end::after {
	opacity: 1;
}

@media (max-width: 768px) {
	/* Kun højre-fade på mobil - venstre ville skjule af det synlige kort */
	.sta-reco__wrap::before {
		content: none;
	}

	.sta-reco__wrap::after {
		width: 44px;
	}
}

.sta-reco__track {
	display: flex;
	gap: 20px;
	margin: 0;
	padding: 4px 2px 12px;
	list-style: none;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.sta-reco__track::-webkit-scrollbar {
	display: none;
}

/* Produktkort */
.sta-card {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	width: 230px;
	padding: 16px;
	background: #fff;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
	scroll-snap-align: start;
}

li.sta-card {
	list-style: none;
}

.sta-card__link {
	display: block;
	position: relative;
	color: inherit;
	text-decoration: none;
}

/* "Ikke på lager"-banner henover billedet */
.sta-card__badge {
	position: absolute;
	top: 32%;
	left: 0;
	right: 0;
	padding: 6px 8px;
	background: rgba(55, 55, 55, 0.85);
	color: #fff;
	font-size: 13px;
	font-weight: 500;
	text-align: center;
}

.sta-card__img {
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: contain;
	margin-bottom: 10px;
	background: #fff;
}

.sta-card__category {
	display: block;
	margin-bottom: 4px;
	font-size: 13px;
	color: #444;
}

.sta-card__name {
	display: block;
	margin-bottom: 6px;
	font-weight: 600;
	color: #1f2937;
}

.sta-card__price {
	display: block;
	margin-bottom: 12px;
	font-weight: 600;
	color: #222;
}

.sta-card__price del {
	margin-right: 6px;
	font-weight: 400;
	color: #999;
}

.sta-card__price ins {
	color: var(--sta-brand);
	text-decoration: none;
}

.sta-card .sta-card__button {
	display: block;
	margin-top: auto;
	padding: 10px 12px;
	border: 1px solid var(--sta-brand);
	border-radius: 2px;
	background: #fff;
	color: var(--sta-brand);
	font-weight: 500;
	text-align: center;
	text-decoration: none;
	transition: background 0.15s ease, color 0.15s ease;
}

/* Hover kun på enheder med mus - touch-tryk må ikke "klæbe" som fyldt knap */
@media (hover: hover) {
	.sta-card .sta-card__button:hover {
		background: var(--sta-brand);
		color: #fff;
	}
}

/* Woo's injicerede "Se kurv"-link skjules i kortene (!important slår temaets knap-styling) */
.sta-card .added_to_cart,
.sta-card a.added_to_cart {
	display: none !important;
}

/* Kurv-feedback: spinner -> grøn m. flueben (Woo sætter .loading/.added) */
.sta-card .sta-card__button {
	position: relative;
}

.sta-card .sta-card__button.loading,
.sta-card .sta-card__button.loading:hover {
	background: #fff; /* Fast hvid bund under load, så spinneren altid ses */
	border-color: var(--sta-brand);
	color: transparent;
	pointer-events: none;
}

.sta-card .sta-card__button.loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 18px;
	height: 18px;
	margin: -9px 0 0 -9px;
	border: 2px solid rgba(var(--sta-brand-rgb), 0.25);
	border-top-color: var(--sta-brand);
	border-radius: 50%;
	animation: sta-spin 0.7s linear infinite;
}

/* Lagt-i-kurv: grøn m. flueben. !important slår temaets knap-farver og :focus-reglen. */
.sta-card .sta-card__button.added,
.sta-card .sta-card__button.sta-added,
.sta-card .sta-card__button.added:hover,
.sta-card .sta-card__button.sta-added:hover,
.sta-card .sta-card__button.added:focus,
.sta-card .sta-card__button.sta-added:focus {
	background: #2e7d32 !important;
	border-color: #2e7d32 !important;
	color: #fff !important;
}

.sta-card .sta-card__button.added::after,
.sta-card .sta-card__button.sta-added::after {
	content: ' ✓';
}

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

/* Pile-navigation */
.sta-reco__nav {
	position: absolute;
	top: 40%;
	z-index: 2;
	width: 40px;
	height: 40px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
	color: var(--sta-brand);
	font-size: 22px;
	line-height: 40px;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.sta-reco__nav:hover {
	background: var(--sta-brand);
	color: #fff;
}

.sta-reco__nav--prev {
	left: -12px;
}

.sta-reco__nav--next {
	right: -12px;
}

/* Responsivt */
/* Fuldskærm på tablet og mobil: headerens felt ville ellers stå lige over
   overlayets eget søgefelt (dobbelt søgefelt). */
@media (max-width: 1119px) {
	.sta-modal {
		top: 0;
	}
}

@media (max-width: 768px) {
	.sta-modal__head {
		padding: 10px 12px 6px;
	}

	/* Toolbar som grid: stats øverst, Filtre + sortering i to PRÆCIS lige store kolonner */
	.sta-modal__toolbar {
		display: grid;
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		gap: 8px 12px;
		padding: 0 12px 10px;
	}

	.sta-modal__meta {
		grid-column: 1 / -1; /* Egen række over Filtre/sortering */
		justify-content: space-between;
	}

	.sta-modal__stats {
		font-size: 13px;
	}

	.sta-modal__filters-toggle {
		display: inline-flex;
		width: 100%;
		min-width: 0;
	}

	.sta-modal__sort {
		width: 100%;
		min-width: 0;
		margin-left: 0;
	}

	.sta-modal__filters-toggle,
	.sta-modal__sort,
	.sta-modal__sort .ais-SortBy,
	.sta-modal .ais-SortBy-select {
		box-sizing: border-box;
	}

	.sta-modal__sort .ais-SortBy {
		width: 100%;
	}

	/* Filter-sidebar bliver en skuffe fra venstre */
	.sta-modal__filters {
		position: fixed;
		top: 0;
		bottom: 0;
		left: 0;
		z-index: 5;
		width: min(320px, 88%);
		padding-bottom: calc(16px + env(safe-area-inset-bottom));
		border-right: none;
		background: #fff;
		box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
		transform: translateX(-105%);
		transition: transform 0.25s ease;
	}

	.sta-modal--filters-open .sta-modal__filters {
		transform: none;
	}

	.sta-modal__filters-head {
		display: flex;
	}

	.sta-modal__filters-apply {
		display: block;
	}

	.sta-modal__slider {
		padding: 30px 20px 6px;
	}

	.sta-modal .ais-SortBy-select {
		height: 38px;
		font-size: 14px;
	}

	.sta-modal .ais-SortBy-select {
		width: 100%;
	}

	.sta-modal .ais-RangeSlider .rheostat-handle {
		width: 26px;
		height: 26px; /* Touch-venlige håndtag */
	}

	.sta-modal .ais-InfiniteHits-list {
		gap: 10px;
	}

	.sta-modal__hits {
		padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
	}
}

@media (max-width: 600px) {
	.sta-card {
		width: 190px;
	}

	.sta-modal .sta-card {
		width: 100%;
	}

	.sta-reco__nav {
		display: none !important; /* Touch-scroll på mobil */
	}
}
