/* =========================================================================
 * wdz-checkout — Browse module (Phase 3)
 * Overlay card UI for IO inventory. Colors via CSS vars set by the template:
 *   --wdz-b-primary, --wdz-b-accent
 * ========================================================================= */

.wdz-browse[hidden] { display: none !important; }

.wdz-browse {
	--wdz-b-primary: #0F3460;
	--wdz-b-accent:  #C9A227;
	font-family: inherit;
	margin: 0 0 32px;
	box-sizing: border-box;
	padding: 0 20px; /* side gap so cards aren't flush to the page edge */
}

/* ---------- Search ---------- */
.wdz-browse__search { position: relative; max-width: 560px; margin: 0 auto 20px; }
.wdz-browse__search-input {
	width: 100%;
	box-sizing: border-box;
	padding: 13px 16px;
	font-size: 16px;
	border: 2px solid #d7dbe0;
	border-radius: 999px;
	background: #fff;
}
.wdz-browse__search-input:focus {
	outline: none;
	border-color: var(--wdz-b-primary);
	box-shadow: 0 0 0 3px rgba(15,52,96,0.12);
}
.wdz-browse__search-results[hidden] { display: none; }
.wdz-browse__search-results {
	list-style: none;
	margin: 6px 0 0;
	padding: 6px;
	position: absolute;
	left: 0; right: 0;
	z-index: 50;
	background: #fff;
	border: 1px solid #e3e6ea;
	border-radius: 12px;
	box-shadow: 0 12px 32px rgba(0,0,0,0.14);
	max-height: 60vh;
	overflow-y: auto;
}
.wdz-browse__search-result {
	display: flex;
	gap: 10px;
	align-items: center;
	padding: 8px 10px;
	border-radius: 8px;
	cursor: pointer;
}
.wdz-browse__search-result:hover { background: #f3f5f7; }
.wdz-browse__search-result img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; flex: none; }
.wdz-browse__search-result-name { font-weight: 600; color: #1f2733; font-size: 14px; }
.wdz-browse__search-result-meta { font-size: 12px; color: #8b94a0; }
.wdz-browse__search-empty { padding: 12px; color: #8b94a0; font-size: 14px; text-align: center; }

/* ---------- Tabs ---------- */
.wdz-browse__tabs {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	scroll-snap-type: x proximity;
	padding: 4px 2px 10px;
	-webkit-overflow-scrolling: touch;
}
.wdz-browse__tab {
	flex: none;
	scroll-snap-align: start;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	border-radius: 999px;
	border: 2px solid #e3e6ea;
	background: #fff;
	color: #4a5562;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	white-space: nowrap;
}
.wdz-browse__tab:hover { border-color: var(--wdz-b-accent); }
.wdz-browse__tab.is-active { background: var(--wdz-b-primary); border-color: var(--wdz-b-primary); color: #fff; }
.wdz-browse__tab-count {
	font-size: 12px;
	background: rgba(0,0,0,0.08);
	border-radius: 999px;
	padding: 1px 7px;
}
.wdz-browse__tab.is-active .wdz-browse__tab-count { background: rgba(255,255,255,0.22); }

/* ---------- Category section + carousel ---------- */
.wdz-browse__cat { margin: 18px 0 26px; }
.wdz-browse__cat-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 12px; }
/* Few-item categories: center the heading over the centered card(s). */
.wdz-browse__cat--few .wdz-browse__cat-head { justify-content: center; }
.wdz-browse__cat--few .wdz-browse__cat-title { text-align: center; }
/* White so it reads cleanly on the page's colorful gradient hero (matches the
   page H1). A subtle shadow keeps it legible across the gradient. */
.wdz-browse__cat-title { font-size: 19px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.35); margin: 0; }
.wdz-browse__cat-nav { display: flex; gap: 6px; }
.wdz-browse__arrow {
	width: 34px; height: 34px;
	border-radius: 999px;
	border: 1px solid #d7dbe0;
	background: #fff;
	cursor: pointer;
	font-size: 16px;
	line-height: 1;
	color: var(--wdz-b-primary);
}
.wdz-browse__arrow:hover { background: #f1f3f5; }
.wdz-browse__arrow:disabled { opacity: 0.35; cursor: default; }

.wdz-browse__row {
	display: grid;
	grid-auto-flow: column;
	/* Fixed card width so a single item doesn't stretch full-width (was the
	   "giant image" bug). Cards stay card-sized; many items scroll horizontally. */
	grid-auto-columns: minmax(280px, 320px);
	justify-content: start;
	gap: 16px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	-webkit-overflow-scrolling: touch;
	padding: 4px 2px 12px;
	scrollbar-width: thin;
}
/* Grid (non-carousel) mode — wrapping rows of fixed-width cards */
.wdz-browse__cats[data-mode="grid"] .wdz-browse__row {
	display: grid;
	grid-auto-flow: row;
	grid-template-columns: repeat(auto-fill, minmax(280px, 320px));
	justify-content: start;
	overflow: visible;
}
/* 1-2 cards: center them so a lone card isn't stuck to the left edge. Safe to
   center here because with so few cards the row never overflows/scrolls. */
.wdz-browse__row--few { justify-content: center; }
.wdz-browse__cats[data-mode="grid"] .wdz-browse__row--few { justify-content: center; }

/* ---------- Card ---------- */
.wdz-browse__card {
	scroll-snap-align: start;
	display: flex;
	flex-direction: column;
	border: 1px solid #e7eaee;
	border-radius: 12px;
	overflow: hidden;
	background: #fff;
	transition: box-shadow 0.15s, transform 0.05s;
}
.wdz-browse__card:hover { box-shadow: 0 10px 28px rgba(0,0,0,0.10); }
.wdz-browse__card-img {
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	background: #f1f3f5;
	display: block;
}
.wdz-browse__card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.wdz-browse__card-name { font-size: 15px; font-weight: 600; color: #1f2733; margin: 0; line-height: 1.3; }
.wdz-browse__card-name a { color: inherit; text-decoration: none; }
.wdz-browse__card-price { font-size: 14px; color: var(--wdz-b-primary); font-weight: 700; }
.wdz-browse__card-actions { margin-top: auto; display: flex; gap: 8px; align-items: center; }

.wdz-browse__qty { display: inline-flex; align-items: center; border: 1px solid #d7dbe0; border-radius: 8px; overflow: hidden; }
.wdz-browse__qty button { width: 30px; height: 34px; border: 0; background: #f5f6f8; font-size: 16px; cursor: pointer; color: #1f2733; }
.wdz-browse__qty input { width: 38px; height: 34px; border: 0; text-align: center; font-size: 14px; -moz-appearance: textfield; }
.wdz-browse__qty input::-webkit-outer-spin-button,
.wdz-browse__qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.wdz-browse__add {
	flex: 1;
	border: 0;
	background: var(--wdz-b-accent);
	color: #1a1a1a;
	font-weight: 700;
	font-size: 14px;
	padding: 9px 12px;
	border-radius: 8px;
	cursor: pointer;
}
.wdz-browse__add:hover { filter: brightness(0.96); }
.wdz-browse__card.is-unavailable { opacity: 0.6; }
.wdz-browse__card.is-unavailable .wdz-browse__add { background: #e3e6ea; color: #8b94a0; cursor: default; }
.wdz-browse__badge { font-size: 11px; color: #c8102e; font-weight: 700; }

/* image-left layout */
.wdz-browse[data-card-layout="image-left"] .wdz-browse__card { flex-direction: row; }
.wdz-browse[data-card-layout="image-left"] .wdz-browse__card-img { width: 110px; aspect-ratio: 1; flex: none; }

/* ---------- Mobile FAB ---------- */
.wdz-browse-fab {
	--wdz-b-primary: #0F3460;
	--wdz-b-accent:  #C9A227;
	position: fixed;
	right: 18px;
	bottom: 18px;
	z-index: 9500;
	display: none; /* shown <=768px */
	flex-direction: column;
	align-items: flex-end;
	gap: 10px;
}
.wdz-browse-fab__actions[hidden] { display: none; }
.wdz-browse-fab__actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.wdz-browse-fab__action {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 9px 14px;
	background: #fff;
	color: #1f2733;
	border: 1px solid #e3e6ea;
	border-radius: 999px;
	box-shadow: 0 6px 18px rgba(0,0,0,0.18);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
}
.wdz-browse-fab__badge {
	background: var(--wdz-b-accent);
	color: #1a1a1a;
	border-radius: 999px;
	font-size: 11px;
	padding: 1px 7px;
	font-weight: 700;
}
.wdz-browse-fab__badge[hidden] { display: none; }
.wdz-browse-fab__toggle {
	width: 56px; height: 56px;
	border-radius: 50%;
	border: 0;
	background: var(--wdz-b-primary);
	color: #fff;
	font-size: 28px;
	line-height: 1;
	box-shadow: 0 8px 22px rgba(0,0,0,0.28);
	cursor: pointer;
	align-self: flex-end;
}
.wdz-browse-fab__toggle-icon { display: inline-block; transition: transform 0.2s; }
.wdz-browse-fab.is-open .wdz-browse-fab__toggle-icon { transform: rotate(45deg); }

/* Coupons modal */
.wdz-browse-coupons[hidden] { display: none; }
.wdz-browse-coupons { position: fixed; inset: 0; z-index: 9600; display: flex; align-items: center; justify-content: center; }
.wdz-browse-coupons__overlay { position: absolute; inset: 0; background: rgba(10,18,35,0.6); }
.wdz-browse-coupons__box { position: relative; z-index: 1; background: #fff; border-radius: 12px; padding: 24px; width: 360px; max-width: calc(100vw - 32px); }
.wdz-browse-coupons__close { position: absolute; top: 8px; right: 12px; border: 0; background: none; font-size: 26px; cursor: pointer; color: #9aa3ad; }
.wdz-browse-coupons__list { list-style: none; margin: 12px 0 0; padding: 0; }
.wdz-browse-coupons__list li { padding: 10px 12px; border: 1px dashed #c9a227; border-radius: 8px; margin-bottom: 8px; font-weight: 700; color: var(--wdz-b-primary); }

@media (max-width: 768px) {
	.wdz-browse-fab { display: flex; }
	.wdz-browse__row { grid-auto-columns: 78%; }
	.wdz-browse__cat-nav { display: none; }
	.wdz-browse__tab, .wdz-browse__add, .wdz-browse__qty button, .wdz-browse-fab__action { min-height: 44px; }
}

/* a11y (Phase 5) — visible focus */
.wdz-browse :focus-visible, .wdz-browse-fab :focus-visible, .wdz-browse-coupons :focus-visible { outline: 3px solid var(--wdz-b-accent); outline-offset: 2px; border-radius: 6px; }
