/* Amazon.co.jp の検索リンクを作るツール（includes/amazon-search-builder.php） */

.jgd-asb {
	--jgd-border: #e2e2e2;
	--jgd-muted: #666;
	--jgd-box-bg: #f7f8f9;
	--jgd-buy-bg: #F3B13C; /* 収益リンクのボタン（assets/purchase-box.css と同じ山吹色） */
	--jgd-buy-text: #1F1D1B;
	--jgd-warning-bg: #fff3e0;
	--jgd-warning-text: #8a4b00;
	--jgd-focus: var(--accent, #1e73be);
	margin: 1.5em 0;
	padding: 1.25em;
	border: 1px solid var(--jgd-border);
	border-radius: 6px;
	background: var(--jgd-box-bg);
}

.jgd-asb__field {
	margin: 0 0 1.1em;
	padding: 0;
	border: 0;
}

.jgd-asb__label {
	display: block;
	margin: 0 0 0.35em;
	padding: 0;
	font-weight: 600;
}

.jgd-asb .jgd-asb__input { /* テーマの input[type="text"] より強くする */
	width: 100%;
	max-width: 32em;
	box-sizing: border-box;
	background: #fff;
}

.jgd-asb__row { /* 版・カテゴリー・足す語を1行に */
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 0 1em;
}

.jgd-asb__row .jgd-asb__input {
	max-width: none;
}

.jgd-asb__advanced {
	margin: 0 0 1.1em;
}

.jgd-asb__advanced-summary {
	margin: 0 0 0.6em;
	font-weight: 600;
	cursor: pointer;
}

.jgd-asb__filter {
	display: flex;
	align-items: center;
	gap: 0.5em;
}

.jgd-asb__filter .jgd-asb__choice {
	margin: 0;
}

.jgd-asb__editions { /* 最初の選択肢を、隣の欄の枠の中の文字と同じ高さにする（欄の上の余白 10px と枠 1px） */
	padding-top: 11px;
}

.jgd-asb__editions > .jgd-asb__filter { /* 選択肢の中の i の行。ほかの選択肢と間を揃える */
	margin: 0 0 0.3em;
}

/* i の説明は選択肢の上に重ねて出し、ページの並びを動かさない（商品ページのバッジの i と同じ形。2026-11-02、運営者） */
.jgd-asb__filter--popup {
	position: relative;
}

.jgd-asb__popup {
	position: absolute;
	bottom: calc(100% + 0.4em);
	right: 0;
	left: 0;
	z-index: 1000; /* 上に出すので、ヘッダーより前に出す */
	margin: 0;
	padding: 0.6em 0.8em;
	border: 1px solid var(--jgd-border);
	border-radius: 4px;
	background: #fff;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	font-size: 0.9em;
}

.jgd-asb .jgd-asb__info { /* テーマの button より強くする */
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 1.4em;
	height: 1.4em;
	margin: 0;
	padding: 0;
	border: 1px solid var(--jgd-muted);
	border-radius: 50%;
	background: #fff;
	color: var(--jgd-muted);
	font: italic 600 0.85em/1 Georgia, serif;
	cursor: pointer;
}

.jgd-asb .jgd-asb__info[aria-expanded="true"],
.jgd-asb .jgd-asb__info:hover {
	border-color: var(--jgd-focus);
	color: var(--jgd-focus);
}

.jgd-asb__note {
	margin: 0.4em 0 0;
	color: var(--jgd-muted);
	font-size: 0.9em;
}

.jgd-asb__help {
	margin: 0.35em 0 0;
	color: var(--jgd-muted);
	font-size: 0.9em;
}

.jgd-asb__combo {
	position: relative;
	max-width: 32em;
}

.jgd-asb__list {
	position: absolute;
	z-index: 10;
	top: 100%;
	right: 0;
	left: 0;
	max-height: 18em;
	margin: 2px 0 0;
	padding: 0;
	overflow-y: auto;
	border: 1px solid var(--jgd-border);
	border-radius: 4px;
	background: #fff;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
	list-style: none;
}

.jgd-asb__option,
.jgd-asb__none {
	margin: 0;
	padding: 0.5em 0.75em;
	line-height: 1.35;
}

.jgd-asb__option {
	display: flex;
	flex-wrap: wrap;
	gap: 0 0.6em;
	cursor: pointer;
}

.jgd-asb__option:hover,
.jgd-asb__option[aria-selected="true"] {
	background: #eef4fa;
}

.jgd-asb__option-ja,
.jgd-asb__none {
	color: var(--jgd-muted);
}

.jgd-asb__choice {
	display: block;
	margin: 0 0 0.3em;
	cursor: pointer;
}

.jgd-asb__warning {
	margin: 0.6em 0 0;
	padding: 0.6em 0.8em;
	border-left: 3px solid var(--jgd-warning-text);
	background: var(--jgd-warning-bg);
	color: var(--jgd-warning-text);
	font-size: 0.95em;
}

.jgd-asb__result {
	margin-top: 1.4em;
	padding-top: 1.1em;
	border-top: 1px solid var(--jgd-border);
}

.jgd-asb__hint {
	color: var(--jgd-muted);
}

.jgd-asb__summary { /* 販売元・配送・検索語を1行に。収まらなければ折り返す */
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em 2em;
	margin: 0 0 1em;
}

.jgd-asb__summary-item:last-child { /* 検索語は残りの幅を使い、狭すぎれば次の行へ */
	flex: 1 1 9em;
	min-width: 0;
}

.jgd-asb__summary dt {
	font-weight: 600;
}

.jgd-asb__summary dd {
	margin: 0;
	overflow-wrap: anywhere;
}

.jgd-asb__gloss {
	display: block;
	color: var(--jgd-muted);
	font-size: 0.9em;
}

.jgd-asb__action {
	margin: 0;
}

.jgd-asb__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.45em;
	min-width: 16em;
	padding: 0.75em 1.25em;
	border: 1px solid var(--jgd-buy-bg);
	border-radius: 4px;
	background: var(--jgd-buy-bg);
	color: var(--jgd-buy-text);
	font-weight: 600;
	line-height: 1.4;
	text-decoration: none;
}

.jgd-asb__button:hover,
.jgd-asb__button:focus-visible {
	color: var(--jgd-buy-text);
	opacity: 0.85;
}

.jgd-asb__button[aria-disabled="true"] {
	opacity: 0.45;
	cursor: not-allowed;
}

.jgd-asb .jgd-ext-icon {
	flex: none;
	width: 1em;
	height: 1em;
}

@media (max-width: 768px) { /* スマホは1項目ずつ行を分ける（2026-10-31、運営者） */
	.jgd-asb__row {
		grid-template-columns: 1fr;
	}

	.jgd-asb__editions { /* 縦に並べると隣の欄が無いので、高さを合わせない */
		padding-top: 0;
	}

	.jgd-asb__summary {
		flex-direction: column;
		gap: 0.5em 0;
	}

	.jgd-asb__summary-item:last-child { /* 縦に並べると 9em が高さになるので外す */
		flex: none;
	}
}

@media (max-width: 480px) {
	.jgd-asb {
		padding: 1em;
	}

	.jgd-asb__button {
		width: 100%;
		min-width: 0;
	}
}
