/* ============================================================
   Active Pharm self-serve shop — catalog, cart, checkout.
   Shares design tokens with customers.css (--sa-primary-color /
   --brand-color, warm-neutral palette, sharp corners — no
   border-radius, matching the rest of the customer portal shell).
   ============================================================ */

/* ---------- Layout ---------- */
.shop-page {
	max-width: 1320px;
	margin: 0 auto;
}
/* Fluid override: fills the full content area instead of capping at a
   fixed breakpoint, so customer pages no longer sit at inconsistent
   widths relative to one another. */
.ap-shell--fluid { max-width: none; }

/* ---------- Page title header ----------
   The base theme's .page-header-breadcrumb is a full-bleed navy banner
   built for wide admin pages: min-height 115px, padding-inline-start
   16.4rem (clearance for a layout where the sidebar sits outside this
   element), and a -24px bottom margin that a following .card's own
   padding normally absorbs invisibly. Inside .shop-page's centered,
   max-width container none of that lines up — the extra left padding and
   top offset push the title out of alignment with .shop-toolbar below it,
   and the negative margin pulls that toolbar up into the banner instead of
   sitting cleanly beneath it. Flipping it to a plain light title row here
   matches the rest of the shop's minimal, white/warm-neutral look — the
   same "adapt the generic banner to a lighter per-section title" pattern
   already used for entity 1000 in atlas-lo-system.css.
   Several properties are pinned elsewhere with !important (see
   atlasmps-custom.css's own .page-header-breadcrumb overrides) — matching
   that here is the only way this scoped rule reliably wins. */
.shop-page .page-header-breadcrumb {
	background: none !important;
	background-image: none !important;
	color: #212529 !important;
	border: 0 !important;
	min-height: 0 !important;
	top: 0 !important;
	margin: 0 0 1.25rem 0 !important;
	padding: 0 !important;
}
/* The base theme forces this white via a broad, !important rule
   ([data-theme-mode="light"] .page-header-breadcrumb h4 — meant for the
   navy banner treatment we just removed above). It ties our specificity
   exactly, so matching purely on !important would come down to CSS file
   load order; the extra .main-content ancestor here makes this rule win
   outright regardless of order. */
.main-content .shop-page .page-header-breadcrumb h4 {
	color: #212529 !important;
}
[data-theme-mode="dark"] .shop-page .page-header-breadcrumb,
[data-theme-mode="dark"] .shop-page .page-header-breadcrumb h4 {
	color: #fafafa !important;
}
.shop-toolbar {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	flex-wrap: wrap;
	margin-bottom: 1rem;
}
.shop-toolbar .shop-search {
	flex: 1 1 320px;
	position: relative;
}
.shop-toolbar .shop-search input {
	width: 100%;
	padding: 0.55rem 0.9rem 0.55rem 2.1rem;
	border: 1px solid #D8D0C3;
	border-radius: 0;
	font-size: 0.85rem;
	background: #fff;
}
.shop-toolbar .shop-search i {
	position: absolute;
	left: 0.75rem;
	top: 50%;
	transform: translateY(-50%);
	color: #847C70;
	font-size: 0.85rem;
}
.shop-toolbar select {
	border: 1px solid #D8D0C3;
	border-radius: 0;
	padding: 0.55rem 0.75rem;
	font-size: 0.82rem;
	background: #fff;
	color: #3D3833;
}
.shop-body {
	display: grid;
	grid-template-columns: 220px 1fr;
	gap: 1.5rem;
}
@media (max-width: 992px) {
	.shop-body { grid-template-columns: 1fr; }
}

/* ---------- Category rail ---------- */
.shop-categories {
	border: 1px solid #D8D0C3;
	background: #fff;
}
.shop-categories__header {
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #847C70;
	padding: 0.75rem 1rem;
	border-bottom: 1px solid #EFEBE5;
}
.shop-categories a {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.55rem 1rem;
	font-size: 0.82rem;
	color: #3D3833;
	text-decoration: none;
	border-bottom: 1px solid #F8F6F3;
}
.shop-categories a:hover { background: #F8F6F3; }
.shop-categories a.active {
	background: var(--brand-color-light, #EFEBE5);
	color: var(--sa-primary-color, #305e6d);
	font-weight: 600;
	border-left: 3px solid var(--sa-primary-color, #305e6d);
}
.shop-categories a .count { color: #A8A099; font-size: 0.72rem; }

/* ---------- Product grid ---------- */
.product-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 1rem;
}
.product-card {
	background: #fff;
	border: 1px solid #D8D0C3;
	display: flex;
	flex-direction: column;
	position: relative;
	transition: box-shadow 0.15s, border-color 0.15s;
}
.product-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.07); border-color: #B5AB9D; }
.product-card__media {
	aspect-ratio: 1 / 1;
	background: #F8F6F3;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	overflow: hidden;
}
.product-card__media img { width: 100%; height: 100%; object-fit: cover; }
.product-card__media .placeholder-icon {
	font-size: 2.2rem;
	color: #C7BFB2;
}
.product-card__badges {
	position: absolute;
	top: 0.5rem;
	left: 0.5rem;
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
}
/* Catalog cards have no product imagery for the foreseeable future, so
   there's no .product-card__media box to overlay badges/save on. Wrapping
   them in .product-card__header instead puts them in a normal in-flow row
   at the top of the body. products/index.php's related-products rail and
   saved-products/index.php still render the original image-overlay markup
   above — this only overrides layout, not color/spacing, for cards that
   opt into the header wrapper. */
.product-card__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.5rem;
	/* Distinct from the plain text rows below it (badges + an interactive
	   save button) — give it its own breathing room instead of the same
	   tight gap used between the text-only category/name/SKU lines. */
	margin-bottom: 0.5rem;
}
.product-card__header .product-card__badges {
	position: static;
	flex-direction: row;
	flex-wrap: wrap;
}
.product-card__header .product-card__save {
	position: static;
	flex-shrink: 0;
	background: #fff;
}
.product-badge {
	font-size: 0.62rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	padding: 0.15rem 0.45rem;
	color: #fff;
	background: #6E6660;
}
.product-badge--new { background: #2f9e44; }
.product-badge--featured { background: var(--sa-primary-color, #305e6d); }
.product-badge--rx { background: #b5541f; }
.product-card__save {
	position: absolute;
	top: 0.5rem;
	right: 0.5rem;
	width: 28px;
	height: 28px;
	background: rgba(255,255,255,0.92);
	border: 1px solid #D8D0C3;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: #847C70;
}
.product-card__save.saved { color: #c0392b; border-color: #c0392b; }
.product-card__body {
	padding: 0.85rem 0.9rem 0.9rem;
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	flex: 1;
}
.product-card__category {
	font-size: 0.65rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #A8A099;
}
.product-card__name {
	font-size: 0.88rem;
	font-weight: 600;
	color: #212529;
	line-height: 1.3;
	text-decoration: none;
}
.product-card__name:hover { color: var(--sa-primary-color, #305e6d); }
.product-card__meta {
	font-size: 0.72rem;
	color: #847C70;
}
.product-card__footer {
	margin-top: auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	padding-top: 0.5rem;
}
.product-card__price {
	font-size: 1rem;
	font-weight: 700;
	color: #212529;
}
.product-card__stock {
	font-size: 0.68rem;
	font-weight: 600;
}
.stock-in { color: #2f9e44; }
.stock-low { color: #b5541f; }
.stock-out { color: #c0392b; }

.qty-stepper {
	display: flex;
	align-items: center;
	border: 1px solid #D8D0C3;
}
.qty-stepper button {
	width: 26px;
	height: 30px;
	border: none;
	background: #fff;
	color: #3D3833;
	font-weight: 700;
	cursor: pointer;
}
.qty-stepper button:hover { background: #F8F6F3; }
.qty-stepper input {
	width: 32px;
	text-align: center;
	border: none;
	border-left: 1px solid #D8D0C3;
	border-right: 1px solid #D8D0C3;
	font-size: 0.8rem;
	padding: 0.3rem 0;
}

/* ---------- Empty / loading states ---------- */
.shop-empty-state {
	text-align: center;
	padding: 4rem 1rem;
	color: #847C70;
}
.shop-empty-state i { font-size: 2.4rem; color: #C7BFB2; display: block; margin-bottom: 0.75rem; }
.shop-skeleton {
	background: linear-gradient(90deg, #F0EDE7 25%, #F8F6F3 37%, #F0EDE7 63%);
	background-size: 400% 100%;
	animation: shopSkeleton 1.4s ease infinite;
}
@keyframes shopSkeleton { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Product detail page ---------- */
.pdp-grid {
	display: grid;
	grid-template-columns: 420px 1fr;
	gap: 2rem;
}
@media (max-width: 992px) { .pdp-grid { grid-template-columns: 1fr; } }
.pdp-media {
	aspect-ratio: 1 / 1;
	background: #F8F6F3;
	border: 1px solid #D8D0C3;
	display: flex;
	align-items: center;
	justify-content: center;
}
.pdp-media img { width: 100%; height: 100%; object-fit: cover; }
.pdp-media .placeholder-icon { font-size: 4rem; color: #C7BFB2; }
.pdp-title { font-size: 1.5rem; font-weight: 700; color: #212529; margin-bottom: 0.25rem; }
.pdp-sku { font-size: 0.78rem; color: #847C70; }
.pdp-price { font-size: 1.75rem; font-weight: 700; color: #212529; margin: 0.75rem 0; }
.pdp-tabs { border-top: 1px solid #EFEBE5; margin-top: 1.5rem; padding-top: 1rem; }
/* Save/favorite toggle — same red-when-saved convention as
   .product-card__save.saved on the catalog cards. */
#pdpSaveBtn.saved { color: #c0392b; border-color: #c0392b; }

/* ---------- Cart ---------- */
.cart-grid { display: grid; grid-template-columns: 1fr 340px; gap: 1.5rem; align-items: start; }
@media (max-width: 992px) { .cart-grid { grid-template-columns: 1fr; } }
.cart-line {
	display: flex;
	gap: 1rem;
	padding: 1rem 0;
	border-bottom: 1px solid #EFEBE5;
	align-items: center;
}
.cart-line__media {
	width: 72px; height: 72px; flex-shrink: 0;
	background: #F8F6F3; border: 1px solid #D8D0C3;
	display: flex; align-items: center; justify-content: center;
}
.cart-line__media img { width: 100%; height: 100%; object-fit: cover; }
.cart-line__info { flex: 1; min-width: 0; }
.cart-line__name { font-weight: 600; font-size: 0.88rem; color: #212529; }
.cart-line__meta { font-size: 0.72rem; color: #847C70; }
.cart-line__actions { display: flex; align-items: center; gap: 0.75rem; }
.cart-line__remove { color: #A8A099; cursor: pointer; font-size: 0.85rem; }
.cart-line__remove:hover { color: #c0392b; }
.cart-line__total { min-width: 80px; text-align: right; font-weight: 700; }

/* ---------- Cart: patient + prescription readiness ---------- */
.cart-patient-bar {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 1rem;
	border: 1px solid #D8D0C3;
	background: #F8F6F3;
	padding: 0.9rem 1.1rem;
	margin-bottom: 1.25rem;
}
.cart-patient-bar__select {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	min-width: 260px;
}
.cart-patient-bar__select label {
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #847C70;
}
.cart-patient-bar__select select {
	border: 1px solid #D8D0C3;
	border-radius: 0;
	padding: 0.5rem 0.75rem;
	font-size: 0.85rem;
	background: #fff;
	color: #3D3833;
}
.cart-patient-bar__select .form-text {
	font-size: 0.7rem;
	color: #A8A099;
}
.cart-readiness { font-size: 0.82rem; font-weight: 600; }
.cart-readiness__ready { color: #2f9e44; }
.cart-readiness__blocked { color: #b5541f; }
.cart-readiness__pending { color: #847C70; font-weight: 500; }
.cart-readiness i { margin-right: 0.35rem; }

.cart-rx-slot { margin-top: 0.35rem; }
.cart-rx-status {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	font-size: 0.7rem;
	font-weight: 600;
}
.cart-rx-status--ready { color: #2f9e44; }
.cart-rx-status--blocked { color: #b5541f; }
.cart-rx-status--pending { color: #A8A099; font-weight: 500; }
.cart-rx-resolve {
	display: inline-block;
	margin-left: 0.5rem;
	font-size: 0.7rem;
	font-weight: 600;
	color: var(--sa-primary-color, #305e6d);
	text-decoration: none;
}
.cart-rx-resolve:hover { text-decoration: underline; }

.order-summary {
	border: 1px solid #D8D0C3;
	background: #fff;
	padding: 1.25rem;
	position: sticky;
	top: 1rem;
}
.order-summary__row {
	display: flex; justify-content: space-between;
	font-size: 0.85rem; padding: 0.35rem 0; color: #3D3833;
}
.order-summary__row--total {
	font-size: 1.05rem; font-weight: 700;
	border-top: 1px solid #EFEBE5; margin-top: 0.5rem; padding-top: 0.75rem;
}

/* ---------- Checkout stepper ---------- */
.checkout-steps { display: flex; gap: 0; margin-bottom: 2rem; border: 1px solid #D8D0C3; }
.checkout-step {
	flex: 1; text-align: center; padding: 0.75rem 0.5rem;
	font-size: 0.75rem; font-weight: 600; color: #A8A099;
	background: #F8F6F3; border-right: 1px solid #D8D0C3;
	position: relative;
}
.checkout-step:last-child { border-right: none; }
.checkout-step.active { background: #fff; color: var(--sa-primary-color, #305e6d); }
.checkout-step.done { color: #2f9e44; }
.checkout-step .step-num {
	display: inline-flex; align-items: center; justify-content: center;
	width: 18px; height: 18px; border-radius: 50%; font-size: 0.65rem;
	background: #D8D0C3; color: #fff; margin-right: 0.4rem;
}
.checkout-step.active .step-num { background: var(--sa-primary-color, #305e6d); }
.checkout-step.done .step-num { background: #2f9e44; }

.rx-blocker {
	border: 1px solid #E8B4A0;
	background: #FBF0EB;
	padding: 0.9rem 1rem;
	font-size: 0.82rem;
	color: #7a3819;
	margin-bottom: 1rem;
}
.rx-blocker strong { display: block; margin-bottom: 0.2rem; }

.select-card {
	border: 1px solid #D8D0C3;
	padding: 0.85rem 1rem;
	cursor: pointer;
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 0.5rem;
}
.select-card.selected { border-color: var(--sa-primary-color, #305e6d); background: var(--brand-color-light, #F8F6F3); }
.select-card input[type="radio"] { margin-right: 0.6rem; }

/* ---------- Order confirmation ---------- */
.confirm-hero { text-align: center; padding: 2.5rem 1rem 1.5rem; }
.confirm-hero i { font-size: 3rem; color: #2f9e44; }
.confirm-hero h2 { margin: 0.75rem 0 0.25rem; }
