/* Buyer discovery (shop.js): search, farmer pages, buy again, basket pill. Loaded after kisan.css.
 * Tokens only (kisan.css :root), so light and dark both work. */

/* ---------- product cards (kisan.js postHtml / listingView) ---------- */
/* Low stock on the photo, bottom-left: "५ केजी मात्र बाँकी" */
.rk-low {
	position: absolute; left: 10px; bottom: 10px; padding: 4px 10px 3px; border-radius: 999px;
	background: var(--mustard); color: var(--on-accent); font-size: 13px; font-weight: 800; box-shadow: var(--shadow-sm);
}
/* Seller line is a link to the farmer page: 44px tall target, same visual spacing as before */
a.rk-seller {
	display: block; min-height: 44px; margin: -10px 0 -2px; padding: 12px 0; line-height: 20px;
	color: var(--ink-2); text-decoration: none;
}
a.rk-seller b { color: var(--ink); font-weight: 700; }
a.rk-seller::after {
	content: ""; display: inline-block; width: 7px; height: 7px; margin: 0 2px 2px 8px; vertical-align: middle;
	border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg);
}
.rk-detail-head a.rk-seller { margin: -8px 0 0; font-size: 15px; }

/* ---------- feed: search button + buy again ---------- */
.sh-search-btn {
	display: flex; align-items: center; gap: 10px; min-height: 50px; margin: -6px 0 14px; padding: 0 14px;
	border-radius: 14px; border: 1px solid var(--line-strong); background: var(--paper); box-shadow: var(--shadow-sm);
	color: var(--ink-2); font-size: 16px; font-weight: 600; text-decoration: none;
}
.sh-search-btn svg { width: 22px; height: 22px; flex: 0 0 auto; color: var(--leaf-ink); }
.sh-search-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sh-again { margin: 0 0 4px; }
.sh-again-row {
	display: flex; gap: 10px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 12px;
	scroll-snap-type: x proximity; scrollbar-width: none;
}
.sh-again-row::-webkit-scrollbar { display: none; }
.sh-again-card {
	flex: 0 0 140px; display: flex; flex-direction: column; overflow: hidden; scroll-snap-align: start;
	background: var(--paper); border-radius: 14px; box-shadow: var(--shadow-sm);
}
.sh-again-link { display: flex; flex-direction: column; flex: 1; min-width: 0; padding-bottom: 8px; color: var(--ink); text-decoration: none; }
.sh-again-img { display: block; height: 92px; overflow: hidden; background: var(--wash); }
.sh-again-img img { width: 100%; height: 100%; object-fit: cover; }
.sh-again-link b, .sh-again-link small { display: block; margin: 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-again-link b { margin-top: 6px; font-size: 16px; font-weight: 800; }
.sh-again-link small { font-size: 12px; color: var(--ink-2); }
.sh-again-price { margin: 2px 10px 0; font-size: 15px; font-weight: 800; color: var(--leaf-ink); white-space: nowrap; }
.sh-again-price small { display: inline; margin: 0; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.sh-again-add {
	display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 44px; margin: 0 8px 8px;
	border: 0; border-radius: 12px; background: var(--leaf); color: #fff; font-size: 15px; font-weight: 800; cursor: pointer;
}
.sh-again-add.done { background: var(--leaf-wash); color: var(--leaf-ink); }
.sh-again-add svg { width: 16px; height: 16px; }

/* ---------- search screen ---------- */
.sh-bar {
	position: sticky; top: calc(70px + var(--sat)); z-index: 10;
	display: grid; grid-template-columns: 44px 1fr auto; gap: 6px; align-items: center;
	margin: -14px -16px 4px; padding: 10px 16px 8px; background: var(--bg);
}
.sh-icon-btn {
	display: grid; place-items: center; width: 48px; height: 48px; padding: 0; border-radius: 14px; cursor: pointer;
	border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink);
}
.sh-icon-btn svg { width: 22px; height: 22px; }
a.sh-icon-btn { width: 44px; border: 0; background: none; }
.sh-mic { color: var(--leaf-ink); }
.sh-mic.on { background: var(--chili); border-color: var(--chili); color: #fff; animation: sh-pulse 1.2s ease-in-out infinite; }
@keyframes sh-pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--chili) 25%, transparent); } }
.sh-field { position: relative; display: block; margin: 0; min-width: 0; }
.sh-field svg { position: absolute; left: 13px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: var(--ink-2); pointer-events: none; }
.sh-field input { height: 48px; padding: 0 12px 0 42px; border-radius: 14px; font-size: 17px; -webkit-appearance: none; appearance: none; }

.sh-sec { margin: 18px 0 0; }
.sh-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 10px; }
.sh-sec-head h3 { margin: 0; font-size: 19px; }
.sh-sec-head h3 small { font-size: 15px; font-weight: 700; color: var(--ink-2); }
.sh-clear { min-height: 44px; padding: 4px 0 4px 8px; font-size: 15px; }

.sh-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sh-chip {
	display: inline-flex; align-items: center; gap: 6px; min-height: 44px; max-width: 100%; padding: 6px 14px 4px 10px;
	border-radius: 999px; border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink);
	font-family: inherit; font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.sh-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-chip img { width: 26px; height: 26px; object-fit: contain; }
.sh-chip svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--ink-2); }
.sh-chip.off { cursor: default; color: var(--ink-2); border-style: dashed; background: transparent; }
.sh-chip.off img { opacity: .55; }

.sh-cats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sh-cat {
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 112px; padding: 10px 4px 8px;
	border-radius: 16px; background: var(--paper); box-shadow: var(--shadow-sm); color: var(--ink); text-decoration: none; text-align: center;
}
.sh-cat img { width: 50px; height: 50px; object-fit: contain; margin-bottom: 2px; }
.sh-cat b { font-size: 16px; font-weight: 800; line-height: 1.2; }
.sh-cat small { font-size: 12px; color: var(--ink-2); line-height: 1.2; }

.sh-title { margin: 14px 0 12px; }
.sh-subcats { margin: -4px 0 14px; } /* sub-categories of the palika's tree under a category title */
.sh-list { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.sh-row {
	display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 10px 12px 10px 14px;
	color: var(--ink); text-decoration: none;
}
.sh-row + .sh-row { border-top: 1px solid var(--line); }
.sh-row:active { background: var(--bg); }
.sh-row > svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--ink-2); }
.sh-what { flex: 1; min-width: 0; line-height: 1.3; }
.sh-what b { display: block; font-size: 17px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-what small { display: block; font-size: 14px; color: var(--ink-2); }
.sh-from { color: var(--leaf-ink); font-weight: 800; }
.sh-ico { flex: 0 0 48px; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 12px; background: var(--wash); color: var(--leaf-ink); }
.sh-ico img { width: 40px; height: 40px; object-fit: contain; }
.sh-ico svg { width: 26px; height: 26px; }
.sh-thumb { flex: 0 0 52px; width: 52px; height: 52px; border-radius: 12px; overflow: hidden; background: var(--wash); }
.sh-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sh-price { flex: 0 0 auto; font-size: 17px; font-weight: 800; color: var(--leaf-ink); white-space: nowrap; }
.sh-price small { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.sh-avatar {
	flex: 0 0 48px; width: 48px; height: 48px; display: grid; place-items: center; overflow: hidden; border-radius: 50%;
	background: var(--leaf-wash); color: var(--leaf-ink); font-size: 20px; font-weight: 800; line-height: 1;
}
.sh-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sh-avatar.big { flex-basis: 84px; width: 84px; height: 84px; font-size: 34px; box-shadow: 0 0 0 4px var(--paper), var(--shadow-sm); }

.sh-skel { display: grid; gap: 10px; margin-top: 18px; }
.sh-skel i {
	display: block; height: 68px; border-radius: 14px;
	background: linear-gradient(100deg, var(--wash) 40%, var(--paper) 50%, var(--wash) 60%) 0 0/200% 100%; animation: rk-sh 1.2s linear infinite;
}
.sh-empty { padding-top: 36px; }
.sh-empty svg { width: 56px; height: 56px; margin: 0 auto 6px; display: block; color: var(--ink-2); }
.sh-empty p { margin: 4px 0; }
.sh-empty b { color: var(--ink); font-size: 19px; }

/* ---------- farmer page ---------- */
.sh-back { gap: 4px; margin: -12px 0 0; }
.sh-back svg { width: 20px; height: 20px; }
.sh-profile { position: relative; margin: 6px 0 0; padding: 20px 14px 16px; text-align: center; }
.sh-stamp { display: inline-block; margin: 4px 0 10px; font-size: 13px; }
.sh-stamp small { font-size: 10px; }
.sh-prof-top { display: flex; flex-direction: column; align-items: center; }
.sh-prof-who h1 { margin: 12px 0 4px; font-size: 27px; }
.sh-prof-who p { display: flex; align-items: center; justify-content: center; gap: 4px; margin: 2px 0; font-size: 15px; }
.sh-prof-who p svg { width: 17px; height: 17px; flex: 0 0 auto; color: var(--leaf-ink); }
.sh-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0 0; }
.sh-stats > div { padding: 10px 4px 8px; border-radius: 12px; background: var(--bg); }
.sh-stats b { display: block; font-size: 21px; font-weight: 800; font-stretch: 85%; line-height: 1.2; }
.sh-stats small { display: block; font-size: 12px; line-height: 1.25; color: var(--ink-2); }
.sh-answer {
	display: flex; align-items: center; justify-content: center; gap: 6px; margin: 10px 0 0; padding: 8px 12px 6px;
	border-radius: 12px; background: var(--leaf-wash); color: var(--leaf-ink); font-weight: 700;
}
.sh-answer svg { width: 18px; height: 18px; flex: 0 0 auto; }
.sh-farmer-feed { margin: 0; }
.sh-farmer-feed .rk-seller { display: none; }  /* it's this farmer's own page */
.sh-farmer-feed .rk-product-title { margin-bottom: 6px; }
.sh-none { margin: 0; padding: 4px 0; }
.sh-cert-go { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; color: var(--leaf-ink); font-size: 14px; font-weight: 700; white-space: nowrap; }
.sh-cert-go svg { width: 18px; height: 18px; }
.sh-reviews { margin-top: 18px; }
.sh-reviews h3 { margin-top: 0; }

/* ---------- floating basket pill (above the tab bar) ---------- */
.sh-pill {
	position: fixed; z-index: 19; left: 16px; right: 16px; bottom: calc(86px + var(--sab)); max-width: 528px; margin: 0 auto;
	display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 6px 18px 6px 8px; border-radius: 999px;
	background: var(--leaf); color: #fff; text-decoration: none; box-shadow: 0 6px 18px rgba(16, 24, 20, .28);
}
.sh-pill[hidden], body.rk-detail .sh-pill, body.rk-farmer-mode .sh-pill { display: none; }
.sh-pill-n { position: relative; flex: 0 0 40px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .18); }
.sh-pill-n svg { width: 22px; height: 22px; }
.sh-pill-n b {
	position: absolute; top: -4px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
	background: var(--mustard); color: var(--on-accent); font-size: 12px; font-weight: 800; line-height: 20px; text-align: center;
}
.sh-pill-label { flex: 1; min-width: 0; font-size: 17px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-pill-total { flex: 0 0 auto; font-size: 17px; font-weight: 800; white-space: nowrap; }
.sh-pill:active { transform: scale(.98); }
/* Keep the last card and the toast clear of the pill */
body.sh-pill-on:not(.rk-detail):not(.rk-farmer-mode) { padding-bottom: calc(156px + var(--sab)); }
body.sh-pill-on:not(.rk-detail):not(.rk-farmer-mode) #rk-toast { bottom: calc(152px + var(--sab)); }

@media (prefers-reduced-motion: reduce) {
	.sh-skel i, .sh-mic.on { animation: none; }
	.sh-pill:active { transform: none; }
}
