/**
 * Barre de recherche globale — dropdown catégories + panneau de suggestions.
 *
 * S'appuie sur les tokens du thème (--surface, --line, --accent, --mono…).
 */

.dgtl-search {
	position: relative;
	display: block;
	min-width: 0;
}

.dgtl-search .search {
	width: 100%;
}

.search__cat {
	gap: 6px;
	cursor: pointer;
	transition: background 160ms;
}

.search__cat[aria-expanded="true"] {
	background: var(--fg);
	color: var(--bg);
}

.search__cat-caret {
	display: inline-block;
	transition: transform 180ms;
	font-size: 10px;
	opacity: 0.7;
}

.search__cat[aria-expanded="true"] .search__cat-caret {
	transform: rotate(180deg);
}

/* Panneau « catégories » ouvert depuis le bouton « Tous les rayons ». */
.search__cats {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	min-width: 260px;
	max-width: 320px;
	max-height: min(520px, 70vh);
	overflow-y: auto;
	overflow-x: hidden;
	background: var(--surface);
	border: 1.5px solid var(--line);
	border-radius: 16px;
	box-shadow: 6px 6px 0 var(--accent);
	z-index: 60;
	padding: 10px;
	/* Scrollbar fine, style dgtl — Firefox. */
	scrollbar-width: thin;
	scrollbar-color: var(--fg) transparent;
	/* Laisse respirer le contenu par rapport au pouce. */
	scroll-padding-block: 6px;
	overscroll-behavior: contain;
}

/* Scrollbar Webkit/Blink pour le listbox de filtres. */
.search__cats::-webkit-scrollbar {
	width: 10px;
}
.search__cats::-webkit-scrollbar-track {
	background: transparent;
	border-left: 1px dashed var(--hairline);
	margin: 10px 0;
}
.search__cats::-webkit-scrollbar-thumb {
	background-color: var(--fg);
	background-image: linear-gradient(
		180deg,
		var(--fg) 0%,
		var(--fg) 100%
	);
	border: 2px solid var(--surface);
	border-radius: 10px;
	min-height: 40px;
	transition: background-color 140ms;
}
.search__cats::-webkit-scrollbar-thumb:hover {
	background-color: var(--accent);
}
.search__cats::-webkit-scrollbar-thumb:active {
	background-color: var(--accent);
	box-shadow: inset 0 0 0 2px var(--surface);
}
.search__cats::-webkit-scrollbar-corner {
	background: transparent;
}

/* Indicateur de contenu scrollable : fade en haut / bas. */
.search__cats {
	background-image:
		linear-gradient(var(--surface) 30%, rgba(255, 255, 255, 0)),
		linear-gradient(rgba(255, 255, 255, 0), var(--surface) 70%) 0 100%,
		radial-gradient(farthest-side at 50% 0, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0)),
		radial-gradient(farthest-side at 50% 100%, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0)) 0 100%;
	background-color: var(--surface);
	background-repeat: no-repeat;
	background-size: 100% 24px, 100% 24px, 100% 8px, 100% 8px;
	background-attachment: local, local, scroll, scroll;
}

.search__cats[hidden] {
	display: none;
}

.search__cats-head {
	font-family: var(--mono);
	font-size: 10.5px;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--muted);
	padding: 6px 10px 10px;
}

.search__cats-list {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.search__cats-list button {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
	padding: 9px 11px;
	border-radius: 10px;
	font-size: 13.5px;
	font-weight: 500;
	color: var(--fg);
	background: transparent;
	transition: background 140ms, color 140ms;
	text-align: left;
	cursor: pointer;
}

.search__cats-list button:hover,
.search__cats-list button:focus-visible {
	background: var(--surface-2);
	outline: 0;
}

.search__cats-list button[aria-selected="true"] {
	background: var(--fg);
	color: var(--bg);
}

.search__cats-count {
	font-family: var(--mono);
	font-size: 10.5px;
	font-weight: 600;
	letter-spacing: 0.06em;
	opacity: 0.65;
}

/* Panneau principal des suggestions. */
.search__panel {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	background: var(--surface);
	border: 1.5px solid var(--line);
	border-radius: 20px;
	box-shadow: 6px 6px 0 var(--accent);
	z-index: 55;
	max-height: min(560px, 74vh);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.search__panel[hidden] {
	display: none;
}

.search__panel-inner {
	overflow: auto;
	padding: 14px;
	flex: 1;
	scrollbar-width: thin;
	scrollbar-color: var(--fg) transparent;
	overscroll-behavior: contain;
}

.search__panel-inner::-webkit-scrollbar {
	width: 10px;
}
.search__panel-inner::-webkit-scrollbar-track {
	background: transparent;
	margin: 14px 0;
}
.search__panel-inner::-webkit-scrollbar-thumb {
	background-color: var(--fg);
	border: 2px solid var(--surface);
	border-radius: 10px;
	min-height: 40px;
	transition: background-color 140ms;
}
.search__panel-inner::-webkit-scrollbar-thumb:hover {
	background-color: var(--accent);
}
.search__panel-inner::-webkit-scrollbar-thumb:active {
	background-color: var(--accent);
	box-shadow: inset 0 0 0 2px var(--surface);
}

.search__panel-empty {
	padding: 26px 14px;
	text-align: center;
	color: var(--muted);
	font-size: 13.5px;
}

.search__panel-all {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 18px;
	border-top: 1.5px solid var(--line);
	font-family: var(--mono);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--fg);
	background: var(--surface-2);
	transition: background 160ms, color 160ms;
}

.search__panel-all:hover,
.search__panel-all:focus-visible {
	background: var(--fg);
	color: var(--bg);
	outline: 0;
}

.search__panel-all[hidden] {
	display: none;
}

/* Sections internes du panneau. */
.ssect {
	margin-bottom: 14px;
}

.ssect:last-child {
	margin-bottom: 0;
}

.ssect__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	font-family: var(--mono);
	font-size: 10.5px;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--muted);
	padding: 4px 4px 8px;
}

.ssect__head b {
	color: var(--fg);
}

/* Liste de produits suggérés. */
.ssugg {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.ssugg__item a {
	display: grid;
	grid-template-columns: 44px 1fr auto;
	gap: 12px;
	align-items: center;
	padding: 8px 8px;
	border-radius: 12px;
	color: var(--fg);
	transition: background 140ms, transform 140ms;
}

.ssugg__item a:hover,
.ssugg__item a:focus-visible,
.ssugg__item a.is-active {
	background: var(--surface-2);
	outline: 0;
}

.ssugg__media {
	width: 44px;
	height: 44px;
	border-radius: 9px;
	overflow: hidden;
	background: var(--surface-2);
	border: 1px solid var(--hairline);
	display: grid;
	place-items: center;
	flex-shrink: 0;
}

.ssugg__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.ssugg__media--empty {
	font-family: var(--mono);
	font-size: 11px;
	font-weight: 700;
	color: var(--muted);
	letter-spacing: 0.04em;
}

.ssugg__body {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.ssugg__title {
	font-size: 13.5px;
	font-weight: 500;
	letter-spacing: -0.005em;
	line-height: 1.25;
	color: var(--fg);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ssugg__title mark {
	background: var(--tag);
	color: inherit;
	padding: 0 2px;
	border-radius: 3px;
}

.ssugg__meta {
	display: flex;
	gap: 8px;
	align-items: center;
	font-family: var(--mono);
	font-size: 10.5px;
	color: var(--muted);
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.ssugg__meta b {
	color: var(--fg);
	font-weight: 600;
}

.ssugg__meta span + span::before {
	content: '·';
	margin-right: 8px;
	color: var(--muted);
}

.ssugg__price {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: -0.005em;
	color: var(--fg);
	white-space: nowrap;
}

.ssugg__price del,
.ssugg__price .woocommerce-Price-amount del,
.ssugg__price s {
	font-size: 11px;
	color: var(--muted);
	font-weight: 400;
	margin-right: 4px;
}

/* Chips catégories / tendances. */
.schips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.schips a,
.schips button {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 11px;
	border-radius: 999px;
	border: 1px solid var(--hairline);
	background: var(--surface);
	font-size: 12px;
	font-weight: 500;
	color: var(--fg);
	text-decoration: none;
	transition: background 140ms, color 140ms, border-color 140ms;
}

.schips a:hover,
.schips a:focus-visible,
.schips a.is-active,
.schips button:hover,
.schips button:focus-visible {
	background: var(--fg);
	color: var(--bg);
	border-color: var(--fg);
	outline: 0;
}

.schips a .sc__count,
.schips button .sc__count {
	font-family: var(--mono);
	font-size: 10px;
	opacity: 0.7;
}

.schips a:hover .sc__count,
.schips a.is-active .sc__count,
.schips button:hover .sc__count {
	opacity: 0.95;
}

.schips .sc__dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--accent);
}

.search__skel {
	display: grid;
	gap: 6px;
	padding: 4px;
}

.search__skel-row {
	height: 46px;
	border-radius: 10px;
	background: linear-gradient(90deg, var(--surface-2), var(--hairline), var(--surface-2));
	background-size: 200% 100%;
	animation: sskel 1.2s linear infinite;
}

@keyframes sskel {
	0% {
		background-position: 0% 50%;
	}
	100% {
		background-position: -200% 50%;
	}
}

/* Responsive : en mobile, le panneau déborde de la nav. */
@media (max-width: 720px) {
	.search__panel {
		left: -16px;
		right: -16px;
	}
	.search__cats {
		left: -8px;
	}
}
