/* ============================================================
   NOORY LIFESTYLE — WooCommerce style bridge
   Product archive/single cards reuse the static site's own
   .product-card / .btn / .badge classes directly (see
   template-parts/product-card.php and woocommerce/*.php), so this
   file only needs to cover WooCommerce chrome that has no
   equivalent in the original static build: cart table, checkout
   form, My Account, notices, star ratings, quantity inputs.
   Uses the same CSS variables defined in tokens.css.
============================================================ */

/* billing_country is a registered but type="hidden" field (Bangladesh
   only — see the woocommerce_checkout_fields filter in
   inc/woocommerce.php) — kept registered (not unset entirely) so
   WooCommerce's own order-creation code still runs
   set_billing_country('BD') normally; this just removes the empty
   "Country / Region" row WooCommerce's core template still prints for
   a hidden field (label + wrapper, just no visible input) from view.
   The actual <input type="hidden" name="billing_country" value="BD">
   inside still submits normally — a parent's display:none doesn't stop
   a descendant form field from being submitted. */
#billing_country_field,
.noory-hidden-field {
	display: none;
}

/* ---------- Notices ---------- */
.woocommerce-message,
.woocommerce-info,
.woocommerce-error,
.woocommerce-noreviews {
	list-style: none;
	background: var(--ivory-200);
	border: 1px solid var(--line);
	border-left: 3px solid var(--forest-800);
	color: var(--ink);
	padding: 14px 18px;
	border-radius: var(--radius-md);
	font-size: 0.95rem;
	margin: 0 0 24px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
}
.woocommerce-error { border-left-color: var(--error); }
.woocommerce-message .button,
.woocommerce-info .button { order: 2; }
.woocommerce-notices-wrapper:empty { display: none; }
.woocommerce-notices-wrapper .woocommerce-error,
.woocommerce-notices-wrapper .woocommerce-message { margin-bottom: 28px; }

/* ---------- Buttons: map WC's .button to the site's .btn ---------- */
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce #respond input#submit {
	font-family: var(--font-body);
	font-weight: 600;
	font-size: 0.85rem;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	border-radius: var(--radius-sm);
	padding: 13px 26px;
	border: 1px solid var(--forest-900);
	background: var(--forest-900);
	color: var(--white);
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover {
	background: var(--forest-800);
	border-color: var(--forest-800);
	color: var(--white);
}
.woocommerce a.button.alt,
.woocommerce #payment #place_order,
.woocommerce button.checkout {
	background: var(--gold-500);
	border-color: var(--gold-500);
	color: var(--ink);
}
.woocommerce a.button.alt:hover,
.woocommerce #payment #place_order:hover,
.woocommerce button.checkout:hover {
	background: var(--gold-700);
	border-color: var(--gold-700);
	color: var(--white);
}
.woocommerce a.added_to_cart { display: inline-block; margin-top: 8px; font-size: 0.85rem; }

/* ---------- Star ratings ---------- */
.woocommerce .star-rating { color: var(--gold-500); }
.woocommerce .star-rating::before { color: var(--line); }

/* ---------- Quantity input ---------- */
.woocommerce .quantity .qty {
	width: 64px;
	padding: 12px;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	background: var(--white);
	font-family: var(--font-body);
	text-align: center;
}
/* Inside the static site's .qty-stepper control (PDP + cart rows), the
   stepper's own CSS already boxes the input — don't let the generic WC
   rule above fight it. */
.qty-stepper .qty,
.qty-stepper input.qty {
	width: 42px !important;
	height: 42px !important;
	padding: 0 !important;
	border: none !important;
	border-left: 1px solid var(--line) !important;
	border-right: 1px solid var(--line) !important;
	border-radius: 0 !important;
	background: transparent !important;
}

/* ---------- Product archive toolbar (ordering / result count) ---------- */
.woocommerce-result-count,
.woocommerce-ordering { font-size: 0.9rem; color: var(--ink-soft); }
.woocommerce-ordering select {
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	padding: 10px 14px;
	background: var(--white);
	font-family: var(--font-body);
}

/* ---------- Breadcrumb (reuses static .breadcrumb component) ---------- */
.woocommerce-breadcrumb { composes: breadcrumb; }

/* ---------- Single product ---------- */
.woocommerce div.product .woocommerce-product-gallery { max-width: 100%; }
.woocommerce div.product div.images img { border-radius: var(--radius-md); }
.woocommerce div.product .product_title { font-family: var(--font-display); }
.woocommerce div.product p.price,
.woocommerce div.product span.price {
	color: var(--forest-900);
	font-weight: 700;
	font-size: 1.4rem;
}
.woocommerce div.product p.price del { color: var(--ink-soft); opacity: 0.6; margin-right: 8px; }
.woocommerce div.product p.price ins { text-decoration: none; }

.woocommerce div.product form.cart { margin-top: 20px; }
.woocommerce div.product form.cart .variations { margin-bottom: 16px; width: 100%; }
.woocommerce div.product form.cart .variations td.label { padding: 8px 0; font-weight: 600; }
.woocommerce div.product form.cart .variations select {
	width: 100%;
	padding: 12px 14px;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	background: var(--white);
	font-family: var(--font-body);
}
.woocommerce div.product .stock { color: var(--success); font-size: 0.9rem; }
.woocommerce div.product .out-of-stock { color: var(--error); }

.woocommerce-tabs ul.tabs { list-style: none; display: flex; gap: 24px; border-bottom: 1px solid var(--line); padding: 0; margin: 40px 0 0; }
.woocommerce-tabs ul.tabs li { padding: 0 0 14px; }
.woocommerce-tabs ul.tabs li a { font-weight: 600; color: var(--ink-soft); }
.woocommerce-tabs ul.tabs li.active a { color: var(--forest-900); }
.woocommerce-tabs ul.tabs li.active { border-bottom: 2px solid var(--gold-500); margin-bottom: -1px; }
.woocommerce-tabs .panel { padding: 24px 0; max-width: 760px; }

.related.products,
.upsells.products { margin-top: 64px; }
.related.products > h2,
.upsells.products > h2 { font-family: var(--font-display); font-size: 1.6rem; margin-bottom: 24px; }

/* ---------- Cart page ---------- */
.woocommerce table.shop_table {
	width: 100%;
	border-collapse: collapse;
	border: 1px solid var(--card-line);
	background: var(--white);
}
.woocommerce table.shop_table th {
	text-align: left;
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--ink-soft);
	padding: 14px 16px;
	border-bottom: 1px solid var(--card-line);
}
.woocommerce table.shop_table td { padding: 16px; border-bottom: 1px solid var(--card-line); vertical-align: middle; }
.woocommerce table.shop_table img { border-radius: var(--radius-sm); width: 72px; }
.woocommerce td.product-remove a { color: var(--error); font-size: 1.2rem; }
.woocommerce-cart-form__cart-item .product-name a { font-weight: 600; color: var(--ink); }

.cart-collaterals { margin-top: 32px; }
.cart_totals { max-width: 420px; margin-left: auto; background: var(--ivory-200); padding: 24px; border-radius: var(--radius-md); }
.cart_totals h2 { font-family: var(--font-display); font-size: 1.2rem; margin-bottom: 16px; }
.cart_totals table { width: 100%; }
.cart_totals table th,
.cart_totals table td { padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart_totals .order-total .amount { font-weight: 700; font-size: 1.2rem; color: var(--forest-900); }
.wc-proceed-to-checkout { margin-top: 16px; }
.wc-proceed-to-checkout a.checkout-button { width: 100%; text-align: center; display: block; }

/* ---------- Checkout ---------- */
.woocommerce-checkout .col2-set { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
/* WooCommerce's own "Billing details" / "Billing & Shipping" heading is
   redundant — woocommerce/checkout/form-checkout.php already prints its
   own "Delivery Details" heading right above this block. */
.woocommerce-checkout .woocommerce-billing-fields > h3,
.woocommerce-checkout #order_review_heading { display: none; }
.woocommerce-checkout .woocommerce-billing-fields__field-wrapper .form-row { margin-bottom: 18px; }
.woocommerce-checkout .create-account { margin-top: 8px; }
.woocommerce-checkout .form-row { margin-bottom: 16px; }
.woocommerce-checkout label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; }
.woocommerce-checkout input.input-text,
.woocommerce-checkout select,
.woocommerce-checkout textarea {
	width: 100%;
	padding: 13px 14px;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	background: var(--white);
	font-family: var(--font-body);
}
/* BUG FIX: WooCommerce pairs fields with .form-row-first/.form-row-last
   classes using its own default CSS (float-based columns) — which this
   theme deliberately doesn't load (see woocommerce_enqueue_styles
   filter), so those two classes had no effect and every checkout field
   was stacking full-width instead of the static design's City+Email
   side-by-side pair. */
.woocommerce-billing-fields__field-wrapper { display: flex; flex-wrap: wrap; gap: 20px; }
.woocommerce-billing-fields__field-wrapper .form-row-wide { flex: 0 0 100%; }
.woocommerce-billing-fields__field-wrapper .form-row-first,
.woocommerce-billing-fields__field-wrapper .form-row-last { flex: 1 1 calc(50% - 10px); min-width: 200px; }
@media (max-width: 600px) {
	.woocommerce-billing-fields__field-wrapper .form-row-first,
	.woocommerce-billing-fields__field-wrapper .form-row-last { flex: 0 0 100%; }
}
.payment_methods { list-style: none; padding: 0; margin-top: 20px; }
.payment_methods li { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 8px; }
.payment_box { padding: 12px 0 0 26px; font-size: 0.9rem; color: var(--ink-soft); }

/* The "Thana / Area" <select> (billing_city) is the delivery-cost
   control — see inc/woocommerce.php's woocommerce_checkout_fields
   filter and the woocommerce_cart_calculate_fees action beneath it,
   which adds the actual charge as a plain fee computed from this
   field's value. No separate shipping-method markup exists to hide any
   more (an earlier version of this design used real WooCommerce
   shipping methods with hidden radio buttons here). */

/* woocommerce/checkout/review-order.php renders the payment method list,
   terms checkbox and #place_order button directly at the bottom of the
   "Delivery Details" form card (matching checkout.html's single button
   there) — style it as a natural continuation of that form. */
#payment {
	background: none;
	border: none;
	padding: 0;
	margin-top: 8px;
}
#payment ul.payment_methods { display: none; } /* Cash on Delivery is the only active gateway; no list needed. */
#payment .woocommerce-terms-and-conditions-wrapper { margin-bottom: 14px; font-size: 0.88rem; color: var(--ink-soft); }
#payment .place-order { padding: 0; border: none; }
#payment #place_order { width: 100%; }
/* "Place Order — Cash on Delivery" wraps awkwardly / feels oversized on
   a phone-width button. The button text is real text content (set via
   the woocommerce_order_button_text filter in inc/woocommerce.php), not
   something split into a separate mobile-only element — swapping it
   with plain CSS: shrink the real text to invisible (font-size:0, so it
   still exists for anything reading the DOM/value) and show a shorter
   replacement via a pseudo-element instead, only under the phone
   breakpoint. */
@media (max-width: 480px) {
	#payment #place_order { font-size: 0; }
	#payment #place_order::before {
		content: "Place Order (COD)";
		font-size: 0.95rem;
		font-weight: 600;
		letter-spacing: 0.02em;
	}
}

@media (max-width: 860px) {
	.woocommerce-checkout .col2-set { grid-template-columns: 1fr; }
}

/* ---------- My Account ---------- */
.woocommerce-account .woocommerce-MyAccount-navigation {
	background: var(--ivory-200);
	border-radius: var(--radius-md);
	padding: 12px 0;
}
.woocommerce-MyAccount-navigation ul { list-style: none; margin: 0; padding: 0; }
.woocommerce-MyAccount-navigation li a { display: block; padding: 12px 20px; color: var(--ink-soft); font-weight: 600; }
.woocommerce-MyAccount-navigation li.is-active a { color: var(--forest-900); background: var(--white); border-left: 3px solid var(--gold-500); }
.woocommerce-account .woocommerce-MyAccount-content {
	/* BUG FIX: this used to also set border/background/padding here,
	   which combined with each page's own ".account-card" wrapper
	   (present on every My Account page now — either directly in its
	   template, or via the woocommerce_before/after_edit_account_form
	   and woocommerce_before/after_edit_account_address_form hooks) to
	   produce two visibly nested borders/cards. .account-card alone now
	   supplies the card styling everywhere. */
	padding-top: 8px;
}
.woocommerce-MyAccount-content > p:first-child { margin-top: 0; }
.woocommerce-MyAccount-content a.button,
.woocommerce-MyAccount-content .woocommerce-Button { margin-top: 8px; }
.woocommerce-EditAccountForm .form-row,
.woocommerce-Address .form-row,
.woocommerce-ResetPassword .form-row { margin-bottom: 18px; }
.woocommerce-address-fields__field-wrapper .form-row:last-child { margin-bottom: 0; }
.addresses .address { border: 1px solid var(--line); padding: 22px; margin-bottom: 16px; }
.addresses .title h3 { font-family: var(--font-display); font-size: 1.05rem; margin-bottom: 4px; }
.addresses .title .edit { float: right; }
.woocommerce-MyAccount-content table.shop_table th,
.woocommerce-MyAccount-content table.shop_table td { padding: 14px 16px; }

/* ---------- Archive / shop grid ----------
   BUG FIX: this used to also set `grid-template-columns: repeat(auto-fill,
   minmax(240px, 1fr))` here. "ul.products" (element+class) is MORE
   specific than the static design's own ".product-grid" rule
   (components.css), so it was silently overriding the intended fixed
   3-column grid with an auto-fill layout — producing uneven card sizing
   depending on viewport width and how many items landed in the last row.
   This now only resets the <ul>'s default browser list styling; the
   actual column layout comes from .product-grid, exactly like the
   static design. (See woocommerce/archive-product.php: the <ul> carries
   both "product-grid" and "products" classes.) */
ul.products { list-style: none; padding: 0; margin: 0; }
ul.products li.product { list-style: none; }

/* BUG FIX: related products, upsells, and any [products] shortcode use
   WooCommerce's own <ul class="products columns-N"> with none of this
   theme's grid classes on it (that ".product-grid"/".grid" combo only
   exists on the shop page's own <ul>, written directly into
   archive-product.php) — and since this theme's CSS entirely replaces
   WooCommerce's own stylesheet (see woocommerce_enqueue_styles filter),
   nothing was giving these lists a grid at all: every item stacked as a
   full-width block, one per row. ":not(.product-grid)" deliberately
   excludes the shop page's own <ul> so this never fights the rule above
   it despite "ul.products" being the more specific selector. */
ul.products:not(.product-grid) {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 28px 32px;
}
@media (max-width: 1100px) {
	ul.products:not(.product-grid) { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
	ul.products:not(.product-grid) { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
	ul.products:not(.product-grid) { grid-template-columns: 1fr; }
}
.woocommerce-pagination { margin-top: 40px; text-align: center; }
.woocommerce-pagination .page-numbers { list-style: none; display: inline-flex; gap: 8px; padding: 0; }
.woocommerce-pagination a,
.woocommerce-pagination span { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); }
.woocommerce-pagination .current { background: var(--forest-900); color: var(--white); border-color: var(--forest-900); }

/* ============================================================
   Shop grid — never wider than the screen (mobile fix)
   ------------------------------------------------------------
   Root cause: grid columns written as `1fr` are really
   `minmax(auto, 1fr)`, so a column can never shrink below its
   content's minimum width. A long product title or the
   "CHOOSE OPTIONS" / "ADD TO CART" button (uppercase, letter-
   spaced, no-wrap) pushed the card past the viewport edge.
   `minmax(0, 1fr)` + `min-width: 0` lets the columns and cards
   shrink to fit, and the text/buttons wrap inside them.
============================================================ */
.product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) {
	.product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.shop-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 901px) {
	.shop-layout { grid-template-columns: 240px minmax(0, 1fr); }
}
@media (max-width: 339px) {
	.product-grid { grid-template-columns: minmax(0, 1fr); }
}
.shop-layout > * { min-width: 0; }
.product-grid > *,
.product-card,
.product-media,
.product-body { min-width: 0; max-width: 100%; }
.product-name,
.product-name a { overflow-wrap: anywhere; }
.product-card .btn { max-width: 100%; white-space: normal; text-align: center; }
.product-card .btn-block { width: 100%; }

/* Related products / upsells use the same never-overflow columns. */
ul.products:not(.product-grid) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { ul.products:not(.product-grid) { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px)  { ul.products:not(.product-grid) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 339px)  { ul.products:not(.product-grid) { grid-template-columns: minmax(0, 1fr); } }

@media (max-width: 500px) {
	.product-grid { column-gap: 10px; row-gap: 24px; }
	.product-body { padding: 12px 12px 14px; }
	.product-card .btn,
	.product-card .btn-sm {
		width: 100%;
		padding: 11px 8px;
		font-size: 0.72rem;
		letter-spacing: 0.04em;
		line-height: 1.25;
	}
	.product-card .product-cat { letter-spacing: 0.06em; }
	.product-card .badge { font-size: 0.62rem; padding: 3px 7px; }
}

/* ============================================================
   Cart interactions — snappy, no accidental zoom/selection
============================================================ */
.qty-stepper button,
.cart-drawer-item .remove-mini,
.cart-item-remove,
.product-card .btn {
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
}
.qty-stepper button { user-select: none; -webkit-user-select: none; }

/* WooCommerce injects a "View cart" link after an AJAX add; the drawer
   already shows the cart, so keep it out of the card. */
.product-card .added_to_cart { display: none !important; }
a.ajax_add_to_cart.is-adding { opacity: 0.65; pointer-events: none; }

/* Thin progress bar in the drawer header while an add-to-cart request
   is in flight (the drawer itself opens instantly on click). */
.cart-drawer-head { position: relative; overflow: hidden; }
.cart-drawer.is-loading .cart-drawer-head::after {
	content: "";
	position: absolute;
	left: -40%;
	bottom: 0;
	height: 2px;
	width: 40%;
	background: var(--gold-500);
	animation: noory-cart-loading 0.9s ease-in-out infinite;
}
@keyframes noory-cart-loading { to { left: 100%; } }
