/* Cosmod AJAX Search */
.cosmod-ajax-search [hidden]{display:none!important}
/**
 * Cosmod AJAX Search — two-pane dropdown (list + preview).
 */

.cosmod-ajax-search {
	position: relative;
	width: 100%;
	font-family: "DM Sans", system-ui, sans-serif;
}

.cosmod-ajax-search__form {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	width: 100%;
	min-height: 42px;
	padding: 0 0.65rem 0 1rem;
	background: var(--cosmod-search-bg, #ececec);
	border-radius: 999px;
	border: 1px solid transparent;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cosmod-ajax-search.is-open .cosmod-ajax-search__form,
.cosmod-ajax-search__form:focus-within {
	border-color: #cfcfcf;
	box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
	background: #fff;
}

.cosmod-ajax-search__input {
	flex: 1 1 auto;
	min-width: 0;
	border: 0;
	background: transparent;
	font-size: 0.95rem;
	line-height: 1.3;
	color: #1a1a1a;
	padding: 0.55rem 0;
	outline: none;
	-webkit-appearance: none;
	appearance: none;
}

.cosmod-ajax-search__input::-webkit-search-decoration,
.cosmod-ajax-search__input::-webkit-search-cancel-button {
	-webkit-appearance: none;
	appearance: none;
}

.cosmod-ajax-search__input::placeholder {
	color: var(--cosmod-search-ph, #555);
	opacity: 1;
}

/* Visually hide a11y label — must not show inside the light search pill */
.cosmod-ajax-search .screen-reader-text,
.cosmod-header .screen-reader-text,
.screen-reader-text {
	border: 0 !important;
	clip: rect(1px, 1px, 1px, 1px) !important;
	clip-path: inset(50%) !important;
	height: 1px !important;
	margin: -1px !important;
	overflow: hidden !important;
	padding: 0 !important;
	position: absolute !important;
	width: 1px !important;
	white-space: nowrap !important;
	word-wrap: normal !important;
}

.cosmod-ajax-search__clear,
.cosmod-ajax-search__submit {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	background: transparent;
	color: #555;
	cursor: pointer;
	border-radius: 50%;
}

.cosmod-ajax-search__clear:hover,
.cosmod-ajax-search__submit:hover {
	color: #111;
	background: rgba(0, 0, 0, 0.05);
}

.cosmod-ajax-search__panel {
	position: absolute;
	z-index: 1200;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	min-width: min(920px, 92vw);
	max-width: 960px;
	background: #fff;
	border: 1px solid #e8e8e8;
	border-radius: 8px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
	overflow: hidden;
}

/* Align panel under search when header is wide */
.cosmod-header .cosmod-ajax-search__panel {
	left: 0;
	right: auto;
	width: min(920px, 92vw);
}

.cosmod-ajax-search__loading,
.cosmod-ajax-search__empty {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.65rem;
	padding: 2rem 1.25rem;
	color: #666;
	font-size: 0.95rem;
}

.cosmod-ajax-search__spinner {
	width: 18px;
	height: 18px;
	border: 2px solid #ddd;
	border-top-color: #222;
	border-radius: 50%;
	animation: cosmod-search-spin 0.7s linear infinite;
}

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

.cosmod-ajax-search__layout {
	display: grid;
	grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.95fr);
	min-height: 360px;
	max-height: min(72vh, 560px);
}

.cosmod-ajax-search__list-col {
	display: flex;
	flex-direction: column;
	min-height: 0;
	border-right: 1px solid #eee;
}

.cosmod-ajax-search__list {
	list-style: none;
	margin: 0;
	padding: 0.35rem 0;
	overflow-y: auto;
	flex: 1 1 auto;
}

.cosmod-ajax-search__item {
	display: grid;
	grid-template-columns: 52px minmax(0, 1fr) auto;
	gap: 0.75rem;
	align-items: center;
	width: 100%;
	padding: 0.65rem 1rem;
	border: 0;
	background: transparent;
	text-align: left;
	cursor: pointer;
	font: inherit;
	color: inherit;
	transition: background 0.12s ease;
}

.cosmod-ajax-search__item:hover,
.cosmod-ajax-search__item.is-active {
	background: #f3f3f3;
}

.cosmod-ajax-search__item-thumb {
	width: 52px;
	height: 52px;
	object-fit: contain;
	background: #fafafa;
	border-radius: 4px;
}

.cosmod-ajax-search__item-body {
	min-width: 0;
}

.cosmod-ajax-search__item-title {
	display: block;
	font-size: 0.9rem;
	font-weight: 600;
	color: #1a1a1a;
	line-height: 1.25;
	margin: 0 0 0.15rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cosmod-ajax-search__item-snippet {
	display: block;
	font-size: 0.78rem;
	color: #888;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cosmod-ajax-search__item-price {
	text-align: right;
	font-size: 0.88rem;
	line-height: 1.25;
	white-space: nowrap;
}

.cosmod-ajax-search__item-price del {
	display: block;
	color: #999;
	font-size: 0.78rem;
	text-decoration: line-through;
}

.cosmod-ajax-search__item-price ins {
	display: block;
	text-decoration: none;
	font-weight: 600;
	color: #111;
}

.cosmod-ajax-search__see-all {
	display: block;
	padding: 0.85rem 1rem;
	border-top: 1px solid #eee;
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #222;
	text-decoration: none;
}

.cosmod-ajax-search__see-all:hover {
	background: #f7f7f7;
	color: #000;
}

/* Preview pane */
.cosmod-ajax-search__preview {
	display: flex;
	flex-direction: column;
	padding: 1.15rem 1.25rem 1.25rem;
	overflow-y: auto;
	min-height: 0;
}

.cosmod-ajax-search__preview-img-wrap {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 160px;
	max-height: 200px;
	margin-bottom: 0.85rem;
}

.cosmod-ajax-search__wish {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #222;
	cursor: pointer;
	transition: color 0.15s ease, transform 0.15s ease;
}

.cosmod-ajax-search__wish:hover {
	color: #111;
	transform: scale(1.06);
}

.cosmod-ajax-search__wish svg {
	width: 22px;
	height: 22px;
	display: block;
}

.cosmod-ajax-search__wish.is-active,
.cosmod-ajax-search__wish[aria-pressed="true"] {
	color: #111;
}

.cosmod-ajax-search__wish.is-active svg path,
.cosmod-ajax-search__wish[aria-pressed="true"] svg path {
	fill: currentColor;
	stroke: currentColor;
}

.cosmod-ajax-search__preview-img {
	max-width: 100%;
	max-height: 190px;
	width: auto;
	height: auto;
	object-fit: contain;
}

.cosmod-ajax-search__preview-title {
	margin: 0 0 0.35rem;
	font-size: 1.05rem;
	font-weight: 600;
	line-height: 1.3;
	color: #111;
}

.cosmod-ajax-search__preview-title a {
	color: inherit;
	text-decoration: none;
}

.cosmod-ajax-search__preview-title a:hover {
	text-decoration: underline;
}

.cosmod-ajax-search__preview-price {
	margin: 0 0 0.75rem;
	font-size: 1.05rem;
	font-weight: 600;
}

.cosmod-ajax-search__preview-price del {
	color: #999;
	font-weight: 400;
	font-size: 0.9rem;
	margin-right: 0.35rem;
	text-decoration: line-through;
}

.cosmod-ajax-search__preview-price ins {
	text-decoration: none;
}

.cosmod-ajax-search__preview-desc {
	margin: 0;
	padding: 0.75rem 0;
	border-top: 1px solid #eee;
	border-bottom: 1px solid #eee;
	font-size: 0.86rem;
	line-height: 1.45;
	color: #444;
}

.cosmod-ajax-search__preview-stock {
	margin: 0.75rem 0 0.85rem;
	font-size: 0.88rem;
	font-weight: 500;
}

.cosmod-ajax-search__preview-stock.is-in {
	color: #1a7f37;
}

.cosmod-ajax-search__preview-stock.is-out {
	color: #b42318;
}

.cosmod-ajax-search__preview-actions {
	display: flex;
	align-items: stretch;
	gap: 0.55rem;
	margin-top: auto;
	padding-top: 0.25rem;
}

.cosmod-ajax-search__qty {
	width: 52px;
	flex: 0 0 52px;
	text-align: center;
	border: 1px solid #ddd;
	border-radius: 999px;
	padding: 0.55rem 0.25rem;
	font-size: 0.95rem;
	font-family: inherit;
	background: #fff;
}

.cosmod-ajax-search__add {
	flex: 1 1 auto;
	border: 0;
	border-radius: 999px;
	padding: 0.7rem 1rem;
	background: #111;
	color: #fff;
	font-size: 0.92rem;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	transition: background 0.15s ease, opacity 0.15s ease;
}

.cosmod-ajax-search__add:hover:not(:disabled) {
	background: #000;
}

.cosmod-ajax-search__add:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.cosmod-ajax-search__add.is-ok {
	background: #1a7f37;
}

/* Mobile: list only, preview stacked below or hidden until tap */
@media (max-width: 820px) {
	.cosmod-ajax-search__panel {
		left: 0 !important;
		right: 0 !important;
		width: auto !important;
		min-width: 0;
		max-width: none;
	}

	.cosmod-ajax-search__layout {
		grid-template-columns: 1fr;
		max-height: min(78vh, 640px);
	}

	.cosmod-ajax-search__list-col {
		border-right: 0;
		border-bottom: 1px solid #eee;
		max-height: 42vh;
	}

	.cosmod-ajax-search__preview {
		padding-top: 1rem;
	}

	.cosmod-ajax-search__preview-img-wrap {
		min-height: 120px;
		max-height: 140px;
	}

	.cosmod-ajax-search__preview-img {
		max-height: 130px;
	}
}

@media (max-width: 640px) {
	.cosmod-ajax-search__form {
		min-height: 40px;
		padding: 0 0.4rem 0 0.85rem;
		gap: 0.15rem;
	}

	.cosmod-ajax-search__input {
		font-size: 0.88rem;
	}

	.cosmod-ajax-search__input::placeholder {
		color: #444;
		opacity: 1;
	}

	.cosmod-ajax-search__clear,
	.cosmod-ajax-search__submit {
		width: 32px;
		height: 32px;
	}

	.cosmod-header .cosmod-ajax-search__panel {
		position: fixed;
		top: auto;
		left: 8px !important;
		right: 8px !important;
		width: auto !important;
		max-height: calc(100vh - 80px);
	}
}
