/* Bee1 Buy Again for WooCommerce */

.ba {
	--ba-accent: #2e7d32;
	--ba-bad: #c62828;
	--ba-line: rgba(0, 0, 0, .12);
	--ba-muted: rgba(0, 0, 0, .55);
	--ba-bg: #fff;
	--ba-radius: 12px;
}

.ba [hidden] { display: none !important; }

.ba-intro { color: var(--ba-muted); margin: 0 0 12px; }

/* Toolbar ---------------------------------------------------------------- */

.ba-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	margin-bottom: 12px;
}

.ba-search {
	flex: 1 1 220px;
	padding: 10px 12px;
	border: 1px solid var(--ba-line);
	border-radius: 8px;
	font: inherit;
}

.ba-chips { display: flex; gap: 6px; flex-wrap: wrap; }

.ba-chip {
	border: 1px solid var(--ba-line);
	background: transparent;
	color: inherit;
	border-radius: 999px;
	padding: 6px 12px;
	cursor: pointer;
	font: inherit;
	font-size: 14px;
	line-height: 1.2;
}

.ba-chip span { opacity: .6; }

.ba-chip.is-active {
	background: var(--ba-accent);
	border-color: var(--ba-accent);
	color: #fff;
}

.ba-chip.is-active span { opacity: .85; }

.ba-sort {
	padding: 8px 10px;
	border: 1px solid var(--ba-line);
	border-radius: 8px;
	font: inherit;
}

/* List ------------------------------------------------------------------- */

.ba-list {
	list-style: none;
	margin: 0;
	padding: 0;
	border: 1px solid var(--ba-line);
	border-radius: var(--ba-radius);
	overflow: hidden;
}

.ba-item {
	display: grid;
	grid-template-columns: auto 56px minmax(0, 1fr) auto;
	gap: 12px;
	align-items: center;
	padding: 12px 14px;
	margin: 0;
	border-top: 1px solid var(--ba-line);
	cursor: pointer;
	transition: background .15s;
}

.ba-item:first-child { border-top: 0; }
.ba-item:hover { background: rgba(0, 0, 0, .02); }
.ba-item.is-selected { background: color-mix(in srgb, var(--ba-accent) 8%, transparent); }
.ba-item.is-unavailable { cursor: default; }

.ba-item.is-disliked .ba-thumb,
.ba-item.is-disliked .ba-name,
.ba-item.is-unavailable .ba-thumb { opacity: .45; }

.ba-item.is-disliked .ba-name { text-decoration: line-through; }

.ba-check { margin: 0; }
.ba-check input { width: 20px; height: 20px; margin: 0; cursor: pointer; accent-color: var(--ba-accent); }

.ba-thumb img {
	display: block;
	width: 56px;
	height: 56px;
	object-fit: cover;
	border-radius: 8px;
}

.ba-name { font-weight: 600; text-decoration: none; }

.ba-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0 6px;
	color: var(--ba-muted);
	font-size: 13px;
}

.ba-meta > span + span::before { content: "·"; margin-inline-end: 6px; }
.ba-price { font-weight: 600; color: #111; }
.ba-price del { opacity: .6; font-weight: 400; }

.ba-oos { color: var(--ba-bad); font-size: 13px; }

/* Remarks ---------------------------------------------------------------- */

.ba-note-text {
	display: inline-block;
	margin-top: 6px;
	padding: 4px 8px;
	border: 0;
	border-radius: 6px;
	background: #fff6d6;
	color: #5d4a00;
	font: inherit;
	font-size: 13px;
	text-align: start;
	cursor: pointer;
}

.ba-item.is-disliked .ba-note-text { background: #fdecea; color: #7a1c1c; }

.ba-note-edit {
	display: flex;
	gap: 6px;
	align-items: flex-start;
	margin-top: 6px;
}

.ba-note-edit textarea {
	flex: 1;
	padding: 6px 8px;
	border: 1px solid var(--ba-line);
	border-radius: 6px;
	font: inherit;
	font-size: 13px;
	resize: vertical;
}

/* Controls --------------------------------------------------------------- */

.ba-ctrl { display: flex; align-items: center; gap: 12px; }

.ba-qty {
	display: inline-flex;
	border: 1px solid var(--ba-line);
	border-radius: 8px;
	overflow: hidden;
	background: var(--ba-bg);
}

.ba-qty button {
	width: 32px;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	font-size: 17px;
	cursor: pointer;
}

.ba-qty button:hover { background: rgba(0, 0, 0, .05); }

.ba-qty input {
	width: 44px;
	padding: 6px 0;
	border: 0;
	background: transparent;
	font: inherit;
	text-align: center;
	-moz-appearance: textfield;
}

.ba-qty input::-webkit-inner-spin-button,
.ba-qty input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.ba-rate { display: flex; gap: 4px; }

.ba-rate button {
	width: 34px;
	height: 34px;
	padding: 0;
	border: 1px solid var(--ba-line);
	border-radius: 50%;
	background: transparent;
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
	filter: grayscale(1);
	opacity: .55;
	transition: opacity .15s, filter .15s, background .15s;
}

.ba-rate button:hover,
.ba-rate button[aria-pressed="true"] { filter: none; opacity: 1; }

.ba-like[aria-pressed="true"] {
	background: color-mix(in srgb, var(--ba-accent) 14%, transparent);
	border-color: var(--ba-accent);
}

.ba-dislike[aria-pressed="true"] {
	background: rgba(198, 40, 40, .12);
	border-color: var(--ba-bad);
}

.ba-item.is-saving .ba-rate { opacity: .6; }

.ba-empty {
	padding: 24px;
	border: 1px dashed var(--ba-line);
	border-radius: var(--ba-radius);
	color: var(--ba-muted);
	text-align: center;
}

/* Sticky action bar ------------------------------------------------------ */

.ba-bar {
	position: sticky;
	bottom: 0;
	z-index: 5;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	margin-top: 12px;
	padding: 12px 14px;
	border: 1px solid var(--ba-line);
	border-radius: var(--ba-radius);
	background: var(--ba-bg);
	box-shadow: 0 -6px 18px rgba(0, 0, 0, .07);
}

.ba-all { display: flex; align-items: center; gap: 6px; margin: 0; cursor: pointer; }
.ba-all input { width: 18px; height: 18px; margin: 0; accent-color: var(--ba-accent); }
.ba-summary { flex: 1; color: var(--ba-muted); font-size: 14px; }
.ba-add { white-space: nowrap; }

/* Toast ------------------------------------------------------------------ */

.ba-toast {
	position: fixed;
	left: 50%;
	bottom: 24px;
	z-index: 99999;
	max-width: calc(100% - 32px);
	padding: 12px 18px;
	border-radius: 10px;
	background: #111;
	color: #fff;
	font-size: 14px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
	transform: translateX(-50%);
	animation: ba-in .2s ease-out;
}

.ba-toast a { margin-inline-start: 10px; color: #fff; font-weight: 600; text-decoration: underline; }

@keyframes ba-in {
	from { opacity: 0; transform: translate(-50%, 8px); }
	to { opacity: 1; transform: translate(-50%, 0); }
}

/* Phones ----------------------------------------------------------------- */

@media (max-width: 640px) {
	.ba-item { grid-template-columns: auto 48px minmax(0, 1fr); gap: 10px; }
	.ba-thumb img { width: 48px; height: 48px; }
	.ba-ctrl { grid-column: 2 / -1; justify-content: space-between; }
	.ba-bar { bottom: 8px; }
	.ba-summary { order: 3; flex-basis: 100%; }
	.ba-add { margin-inline-start: auto; }
}

@media (prefers-reduced-motion: reduce) {
	.ba-toast { animation: none; }
}
