/*
Theme Name: Western Watch BD
Theme URI: https://westernwatchbd.com/
Author: Khondoker Moin Hossain
Author URI: https://westernwatchbd.com/
Description: 100% custom-coded WooCommerce theme for Western Watch BD — a watch & accessories store. Raw PHP + Tailwind CSS + Alpine.js. No page builders.
Version: 2.0.0
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
WC requires at least: 8.0
WC tested up to: 10.6
Text Domain: western-watch-bd
Domain Path: /languages
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/

/*
 * NOTE: Real styling is handled by Tailwind (see functions.php).
 * This file only carries the WordPress theme header above — it is what
 * registers the theme with WP. Keep the header block intact.
 *
 * The rules below cover things Tailwind can't reach (Alpine x-cloak, native
 * WooCommerce gallery markup, AJAX-add-to-cart toast) or that must ship
 * without waiting on a `npm run build` (checkout coupon row layout).
 */

[x-cloak] { display: none !important; }

/* Hide the theme until Alpine + Tailwind have painted — avoids a FOUC flash. */
.wwbd-no-fouc { visibility: hidden; }
.wwbd-ready .wwbd-no-fouc { visibility: visible; }

/*
 * Accessibility: this theme strips ALL default WooCommerce CSS
 * (functions.php: woocommerce_enqueue_styles -> __return_empty_array), which
 * also removes WC's `.screen-reader-text` visually-hidden rule. Restore it so
 * WooCommerce's own field labels don't render as visible text.
 */
.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute !important;
	width: 1px;
	word-wrap: normal !important;
}

/* ==================================================================
 * CART QUANTITY STEPPER — guarantee the number input is visible and
 * centred regardless of a purged utility or a WC core markup change.
 * ================================================================== */
.woocommerce-cart-form .wwbd-qty .quantity { display: contents; }
.woocommerce-cart-form .wwbd-qty input.qty {
	width: 2.75rem;
	height: 2.25rem;
	padding: 0;
	border: 0;
	background: transparent;
	text-align: center;
	font-weight: 700;
	font-size: 0.875rem;
	color: #1A1A1A;
	-moz-appearance: textfield;
	appearance: textfield;
	opacity: 1;
	visibility: visible;
}
.woocommerce-cart-form .wwbd-qty input.qty::-webkit-outer-spin-button,
.woocommerce-cart-form .wwbd-qty input.qty::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* Single-product quantity stepper — same spinner-removal, different scope. */
.wwbd-cart input[name="quantity"] {
	-moz-appearance: textfield;
	appearance: textfield;
	min-width: 2.75rem;
	opacity: 1;
	visibility: visible;
}
.wwbd-cart input[name="quantity"]::-webkit-outer-spin-button,
.wwbd-cart input[name="quantity"]::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* ==================================================================
 * Cart line item — responsive layout.
 * Desktop (>=640px): one row [thumb][name grows][qty][price][remove].
 * Mobile: wraps to [name | price] then [qty | remove].
 * ================================================================== */
.wwbd-line { display: flex; gap: 1rem; padding: 1.25rem; }
.wwbd-line__body {
	min-width: 0; flex: 1; display: flex; flex-wrap: wrap;
	align-items: center; column-gap: 0.75rem; row-gap: 0.85rem;
}
.wwbd-line__info  { order: 1; flex: 1 1 55%; min-width: 0; }
.wwbd-line__price { order: 2; margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; text-align: right; }
.wwbd-line__qty    { order: 3; }
.wwbd-line__remove { order: 4; margin-left: auto; }
@media (min-width: 640px) {
	.wwbd-line__body { flex-wrap: nowrap; column-gap: 1.5rem; }
	.wwbd-line__info  { flex: 1 1 auto; }
	.wwbd-line__qty   { order: 2; }
	.wwbd-line__price { order: 3; margin-left: 0; width: 8.5rem; }
	.wwbd-line__remove{ order: 4; margin-left: 0; }
}

/* ==================================================================
 * ADD-TO-CART TOAST — replaces WooCommerce's full-page notice.
 * ================================================================== */
.wwbd-toast-wrap {
	position: fixed; z-index: 9999; top: 1rem; right: 0.75rem; left: auto; bottom: auto;
	display: flex; flex-direction: column; gap: 0.5rem; width: min(88vw, 380px);
	pointer-events: none;
}
@media (min-width: 640px) { .wwbd-toast-wrap { right: 1.25rem; top: 1.25rem; } }
.wwbd-toast {
	pointer-events: auto;
	display: flex; align-items: center; gap: 0.75rem;
	background: #ffffff; color: #1A1A1A;
	border: 1px solid #E6E6E6; border-left: 3px solid #1D385F;
	border-radius: 2px;
	padding: 0.8rem 1rem;
	box-shadow: 0 14px 34px -10px rgba(11, 11, 13, 0.28);
	transform: translateX(115%); opacity: 0; filter: blur(0);
	will-change: transform, opacity, filter;
	transition: transform 0.55s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s ease-out;
}
.wwbd-toast.is-in { transform: translateX(0); opacity: 1; }
.wwbd-toast.is-out {
	transform: translateY(-8px) scale(1.02);
	opacity: 0; filter: blur(7px);
	transition: opacity 0.6s ease, filter 0.6s ease, transform 0.6s ease;
}
.wwbd-toast.is-error { border-left-color: #7A2331; }
.wwbd-toast.is-error .wwbd-toast__icon { background: #7A2331; }
.wwbd-toast__icon {
	flex: none; width: 2.1rem; height: 2.1rem; border-radius: 2px;
	display: flex; align-items: center; justify-content: center;
	font-size: 1.05rem; font-weight: 700; color: #ffffff; background: #101F34;
}
.wwbd-toast__body { min-width: 0; flex: 1; }
.wwbd-toast__title {
	display: block; font-size: 0.8rem; font-weight: 700; line-height: 1.2;
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wwbd-toast__sub { display: block; margin-top: 0.1rem; font-size: 0.72rem; color: #7d7a70; }
.wwbd-toast__cta {
	flex: none; appearance: none; background: none; border: 0; padding: 0; margin: 0;
	font-family: inherit; font-size: 0.72rem; font-weight: 700; line-height: inherit;
	color: #1D385F; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.wwbd-toast__cta:hover { text-decoration: underline; }
.wwbd-toast__cta:focus-visible { outline: 2px solid #1D385F; outline-offset: 2px; }

/* ==================================================================
 * SINGLE PRODUCT GALLERY — WooCommerce native (zoom + slider + lightbox)
 * Layout CSS normally shipped in woocommerce-general.css is stripped by
 * this theme, so it is supplied here. PhotoSwipe's own CSS survives
 * (enqueued separately by WooCommerce).
 * ================================================================== */
.woocommerce-product-gallery {
	display: flex;
	flex-direction: row-reverse; /* thumbs left, stage right */
	align-items: flex-start;
	gap: 1rem;
	position: relative;
	animation: wwbd-gallery-reveal 0s linear 2s forwards;
}
@keyframes wwbd-gallery-reveal { to { opacity: 1; } }

.woocommerce-product-gallery .flex-viewport,
.woocommerce-product-gallery > .woocommerce-product-gallery__wrapper {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	background: #fff;
	border: 1px solid #E6E6E6;
}
.woocommerce-product-gallery__wrapper:not(.flexslider) > *:not(:first-child) { display: none; }
.woocommerce-product-gallery__image img { display: block; width: 100%; height: auto; }

.woocommerce-product-gallery .flex-control-thumbs {
	flex: 0 0 5.25rem;
	display: flex; flex-direction: column; gap: 0.6rem;
	margin: 0; padding: 0; list-style: none;
}
.woocommerce-product-gallery .flex-control-thumbs li { margin: 0; width: 100%; }
.woocommerce-product-gallery .flex-control-thumbs img {
	display: block; width: 100%; height: auto; cursor: pointer;
	border: 1px solid #E6E6E6; background: #fff;
	opacity: 0.65; transition: opacity 0.15s ease, border-color 0.15s ease;
}
.woocommerce-product-gallery .flex-control-thumbs img:hover,
.woocommerce-product-gallery .flex-control-thumbs img.flex-active { opacity: 1; border-color: #1D385F; }

.woocommerce-product-gallery__image { position: relative; }
.woocommerce-product-gallery__image .zoomImg {
	background-color: #fff; position: absolute; top: 0; left: 0; opacity: 0;
	border: none !important; max-width: none !important; max-height: none !important;
}
.woocommerce-product-gallery__trigger {
	position: absolute; top: 0.75rem; right: 0.75rem; z-index: 20;
	display: flex; align-items: center; justify-content: center;
	width: 2.25rem; height: 2.25rem; border-radius: 9999px;
	background: #fff; box-shadow: 0 2px 8px rgba(11, 11, 13, 0.14);
	font-size: 0; text-decoration: none;
}
.woocommerce-product-gallery__trigger::after { content: ""; width: 15px; height: 15px; border: 2px solid #1A1A1A; border-radius: 50%; }
.woocommerce-product-gallery__trigger::before {
	content: ""; position: absolute; right: 0.55rem; bottom: 0.6rem;
	width: 2px; height: 8px; background: #1A1A1A; transform: rotate(-45deg); transform-origin: bottom;
}
@media (max-width: 1023px) {
	.woocommerce-product-gallery { flex-direction: column; }
	.woocommerce-product-gallery .flex-control-thumbs { flex: 0 0 auto; flex-direction: row; overflow-x: auto; scrollbar-width: none; }
	.woocommerce-product-gallery .flex-control-thumbs::-webkit-scrollbar { display: none; }
	.woocommerce-product-gallery .flex-control-thumbs li { width: 4.75rem; flex: 0 0 auto; }
}

/* "Save X%" badge — clears the thumbnail rail from lg up. */
.wwbd-save-badge { position: absolute; top: 0.9rem; left: 0.9rem; z-index: 30; }
@media (min-width: 1024px) {
	.wwbd-gallery.has-rail .wwbd-save-badge { left: calc(5.25rem + 1rem + 0.9rem); }
}

/* ==================================================================
 * PRICE ROW — WooCommerce's <del>/<ins> normalised
 * ================================================================== */
.wwbd-price-row del { text-decoration: line-through; color: #a3a3a3; font-size: 0.9rem; font-weight: 400; order: 2; }
.wwbd-price-row del .woocommerce-Price-amount,
.wwbd-price-row del bdi { font-size: inherit; font-weight: inherit; }
.wwbd-price-row ins {
	text-decoration: none; background: transparent;
	font-size: 1.65rem; font-weight: 700; color: #1A1A1A;
	font-family: "Poppins", sans-serif; order: 1;
}
.wwbd-price-row ins .woocommerce-Price-amount,
.wwbd-price-row ins bdi { font-size: inherit; font-weight: inherit; }
@media (min-width: 768px) and (max-width: 1023px) { .wwbd-price-row ins { font-size: 1.4rem; } }
.wwbd-price-row .wwbd-price { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem; font-family: "Poppins", sans-serif; }

/* ==================================================================
 * WISHLIST HEART (product card) — outline by default, solid navy once
 * saved. wishlist.js toggles `.is-active`; the fill swap uses
 * `fill: currentColor` on the existing SVG rather than swapping markup, so
 * there is one icon in the DOM and no flash while toggling.
 * ================================================================== */
.wwbd-wishlist-btn.is-active { color: #1D385F; }
.wwbd-wishlist-btn.is-active svg { fill: currentColor; }
.wwbd-wishlist-btn svg { transition: fill 0.15s ease, transform 0.15s ease; }
.wwbd-wishlist-btn:active svg { transform: scale(0.88); }
@media (prefers-reduced-motion: reduce) {
	.wwbd-wishlist-btn svg { transition: none; }
	.wwbd-wishlist-btn:active svg { transform: none; }
}

/* ==================================================================
 * PRODUCT ATTRIBUTES / SPEC TABLE — split grid, stacks on mobile
 * ================================================================== */
.wwbd-attr-table { table-layout: fixed; width: 100%; border-collapse: collapse; }
.wwbd-attr-table .wwbd-attr-label { width: 32%; }
.wwbd-attr-table tr:last-child th,
.wwbd-attr-table tr:last-child td { border-bottom: 0; }
@media (max-width: 639px) {
	.wwbd-attr-table, .wwbd-attr-table tbody, .wwbd-attr-row { display: block; width: 100%; }
	.wwbd-attr-row { border-bottom: 1px solid #E6E6E6; }
	.wwbd-attr-table tr:last-child { border-bottom: 0; }
	.wwbd-attr-table .wwbd-attr-label,
	.wwbd-attr-table .wwbd-attr-value { display: block; width: 100%; min-width: 0; border-bottom: 0; }
	.wwbd-attr-table .wwbd-attr-label { padding-bottom: 0.25rem; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }
	.wwbd-attr-table .wwbd-attr-value { padding-top: 0.25rem; }
}

/*
 * CHECKOUT COUPON ROW — forced inline, scoped to #wwbd-coupon-form.
 * WooCommerce's checkout.js runs $('form.checkout_coupon').hide(), setting an
 * inline style that only `!important` can beat — see the note beside the
 * markup in woocommerce/checkout/form-checkout.php.
 */
#wwbd-coupon-form { display: flex !important; flex-direction: row !important; flex-wrap: nowrap !important; align-items: stretch !important; width: 100% !important; gap: .5rem !important; margin: 0 !important; padding: 0 !important; }
#wwbd-coupon-form > .wwbd-coupon-field { flex: 1 1 auto !important; min-width: 0 !important; margin: 0 !important; padding: 0 !important; border: 0 !important; }
#wwbd-coupon-form > .wwbd-coupon-action { flex: 0 0 auto !important; margin: 0 !important; padding: 0 !important; border: 0 !important; }
#wwbd-coupon-form .wwbd-coupon-input { display: block !important; width: 100% !important; margin: 0 !important; }
#wwbd-coupon-form .wwbd-coupon-btn { display: inline-flex !important; align-items: center !important; width: auto !important; margin: 0 !important; white-space: nowrap !important; }
#wwbd-coupon-form > p.form-row { margin: 0 !important; padding: 0 !important; width: auto !important; flex: 1 1 auto !important; min-width: 0 !important; }
#wwbd-coupon-form > p.form-row-last { flex: 0 0 auto !important; }
