/* ==========================================================================
   Pharmélia — design tokens (from the approved mockup)
   ========================================================================== */
:root:root {
	--ph-primary: #04289C;
	--ph-primary-dark: #021B6B;
	--ph-primary-soft: #C9D6F5;
	--ph-accent: #128B96;
	--ph-accent-dark: #0E6670;
	--ph-accent-soft: #E3F2F3;
	--ph-ink: #0B1A4A;
	--ph-text: #33405F;
	--ph-muted: #8A93A6;
	--ph-line: #D5E2EE;
	--ph-bg: #EEF3F8;
	--ph-surface: #FFFFFF;
	--ph-surface-2: #F6F9FC;
	--ph-ok: #1E7B4A;
	--ph-warn: #D9822B;
	--ph-warn-ink: #A1500A;
	--ph-danger: #B42318;
	--ph-radius: 14px;
	--ph-radius-lg: 20px;
	--ph-nav-h: 72px;
	--ph-font: 'Readex Pro', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;

	/* Blocksy palette mapping */
	--theme-palette-color-1: var(--ph-primary);
	--theme-palette-color-2: var(--ph-primary-dark);
	--theme-palette-color-3: var(--ph-text);
	--theme-palette-color-4: var(--ph-ink);
	--theme-palette-color-5: var(--ph-line);
	--theme-palette-color-6: var(--ph-bg);
	--theme-palette-color-7: var(--ph-surface-2);
	--theme-palette-color-8: var(--ph-surface);

	--theme-text-color: var(--ph-text);
	--theme-headings-color: var(--ph-ink);
	--theme-link-initial-color: var(--ph-primary);
	--theme-link-hover-color: var(--ph-primary-dark);
	--theme-border-color: var(--ph-line);
	--theme-button-background-initial-color: var(--ph-primary);
	--theme-button-background-hover-color: var(--ph-primary-dark);
	--theme-button-text-initial-color: #fff;
	--theme-button-text-hover-color: #fff;
	--theme-button-border-radius: var(--ph-radius);
	--theme-form-field-border-radius: var(--ph-radius);
	--theme-form-field-border-initial-color: var(--ph-line);
	--theme-form-field-border-focus-color: var(--ph-primary);
	--theme-form-field-background-initial-color: var(--ph-surface);
	--theme-form-field-background-focus-color: var(--ph-surface);
	--theme-form-field-height: 48px;
	--theme-font-family: var(--ph-font);
}

/* ==========================================================================
   Base
   ========================================================================== */
body.pharmelia {
	font-family: var(--ph-font);
	background-color: var(--ph-bg);
	color: var(--ph-text);
	-webkit-tap-highlight-color: transparent;
}
body.pharmelia h1, body.pharmelia h2, body.pharmelia h3,
body.pharmelia h4, body.pharmelia h5, body.pharmelia h6 {
	font-family: var(--ph-font);
	color: var(--ph-ink);
	font-weight: 600;
	letter-spacing: 0;
}
body.pharmelia .entry-header .page-title { font-size: clamp(22px, 5vw, 30px); }

/* Wordmark */
body.pharmelia .site-title,
body.pharmelia .site-title a {
	font-family: 'Quicksand', var(--ph-font);
	font-weight: 700;
	color: var(--ph-primary);
	direction: ltr;
	unicode-bidi: isolate;
}

/* Header: white surface, hairline */
body.pharmelia [data-row] { border-color: var(--ph-line); }
body.pharmelia .ct-header [data-row="middle"] { background: var(--ph-surface); }

/* ==========================================================================
   Forms & buttons
   ========================================================================== */
body.pharmelia input[type="text"],
body.pharmelia input[type="email"],
body.pharmelia input[type="tel"],
body.pharmelia input[type="password"],
body.pharmelia input[type="search"],
body.pharmelia input[type="number"],
body.pharmelia select,
body.pharmelia textarea,
body.pharmelia .select2-container .select2-selection--single {
	border-radius: var(--ph-radius);
	border: 1px solid var(--ph-line);
	background: var(--ph-surface);
	font-family: var(--ph-font);
	font-size: 15px;
	color: var(--ph-ink);
	min-height: 48px;
}
body.pharmelia .select2-container .select2-selection--single .select2-selection__rendered { line-height: 46px; }
body.pharmelia .select2-container .select2-selection--single .select2-selection__arrow { height: 46px; }
body.pharmelia input:focus,
body.pharmelia select:focus,
body.pharmelia textarea:focus {
	border-color: var(--ph-primary);
	box-shadow: 0 0 0 3px rgba(4, 40, 156, .12);
	outline: none;
}
body.pharmelia ::placeholder { color: var(--ph-muted); opacity: 1; }

body.pharmelia .woocommerce form .form-row label,
body.pharmelia .b2bking_custom_registration_container label {
	font-size: 14px;
	font-weight: 500;
	color: var(--ph-ink);
	margin-bottom: 6px;
}
body.pharmelia .required { color: var(--ph-danger); text-decoration: none; }

body.pharmelia .button,
body.pharmelia button[type="submit"],
body.pharmelia .wp-element-button,
body.pharmelia .woocommerce a.button,
body.pharmelia .woocommerce button.button {
	min-height: 48px;
	border-radius: var(--ph-radius);
	font-family: var(--ph-font);
	font-weight: 600;
	font-size: 15px;
	background: var(--ph-primary);
	color: #fff;
	border: 0;
	transition: background-color .15s ease, transform .1s ease;
}
body.pharmelia .button:hover,
body.pharmelia button[type="submit"]:hover { background: var(--ph-primary-dark); color: #fff; }
body.pharmelia .button:active,
body.pharmelia button[type="submit"]:active { transform: scale(.98); }

/* ==========================================================================
   Account: login / register cards
   ========================================================================== */
body.pharmelia .woocommerce form.login,
body.pharmelia .woocommerce form.register {
	background: var(--ph-surface);
	border: 1px solid var(--ph-line);
	border-radius: var(--ph-radius-lg);
	padding: 20px;
	margin: 0 0 24px;
}
body.pharmelia .woocommerce form.register button[name="register"],
body.pharmelia .woocommerce form.login button[name="login"] { width: 100%; }
body.pharmelia .woocommerce-privacy-policy-text { font-size: 13px; color: var(--ph-muted); }

/* Notices */
body.pharmelia .woocommerce-message,
body.pharmelia .woocommerce-info,
body.pharmelia .woocommerce-error {
	border-radius: var(--ph-radius);
	border: 1px solid var(--ph-line);
	background: var(--ph-surface);
	color: var(--ph-ink);
}
body.pharmelia .woocommerce-message { border-inline-start: 4px solid var(--ph-ok); }
body.pharmelia .woocommerce-info { border-inline-start: 4px solid var(--ph-primary); }
body.pharmelia .woocommerce-error { border-inline-start: 4px solid var(--ph-danger); }

/* ==========================================================================
   Bottom app navigation
   ========================================================================== */
.ph-nav { display: none; }

@media (max-width: 999.98px) {
	body.pharmelia { padding-bottom: calc(var(--ph-nav-h) + env(safe-area-inset-bottom, 0px)); }

	.ph-nav {
		position: fixed;
		inset-inline: 0;
		bottom: 0;
		z-index: 999;
		display: grid;
		grid-template-columns: repeat(5, minmax(0, 1fr));
		align-items: end;
		height: calc(var(--ph-nav-h) + env(safe-area-inset-bottom, 0px));
		padding: 0 4px env(safe-area-inset-bottom, 0px);
		background: var(--ph-surface);
		border-top: 1px solid var(--ph-line);
		box-shadow: 0 -4px 16px rgba(11, 26, 74, .05);
		font-family: var(--ph-font);
	}
	.ph-nav__item {
		position: relative;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 4px;
		height: var(--ph-nav-h);
		color: var(--ph-text);
		font-size: 11px;
		font-weight: 500;
		text-decoration: none;
	}
	.ph-nav__item:hover, .ph-nav__item:focus-visible { color: var(--ph-primary); }
	.ph-nav__item.is-active { color: var(--ph-primary); font-weight: 600; }
	.ph-nav__item.is-active svg { stroke-width: 2.1; }

	.ph-nav__item--scan { justify-content: flex-end; padding-bottom: 10px; color: var(--ph-primary); font-weight: 600; }
	.ph-nav__fab {
		width: 58px;
		height: 58px;
		margin-top: -26px;
		border-radius: 50%;
		background: var(--ph-accent);
		color: #fff;
		display: flex;
		align-items: center;
		justify-content: center;
		border: 4px solid var(--ph-surface);
		box-shadow: 0 6px 14px rgba(18, 139, 150, .28);
	}
	.ph-nav__fab svg { width: 26px; height: 26px; stroke-width: 2; }

	.ph-nav__badge {
		position: absolute;
		top: 10px;
		inset-inline-end: calc(50% - 22px);
		min-width: 18px;
		height: 18px;
		padding: 0 4px;
		border-radius: 9px;
		background: var(--ph-primary);
		color: #fff;
		font-size: 10px;
		font-weight: 600;
		line-height: 18px;
		text-align: center;
	}
	.ph-nav__badge.is-empty { display: none; }

	/* Keep Blocksy's back-to-top above the nav */
	body.pharmelia .ct-back-to-top { bottom: calc(var(--ph-nav-h) + 16px) !important; }
}

@media (prefers-reduced-motion: reduce) {
	body.pharmelia * { transition: none !important; }
}

/* Register page: the form carries its own heading */
body.pharmelia.page-id-34 .hero-section,
body.pharmelia.page-id-34 .entry-header { display: none; }

/* My account (logged out): login only; registration lives on /register/ */
body.pharmelia.woocommerce-account:not(.logged-in) #customer_login .u-column2,
body.pharmelia.woocommerce-account:not(.logged-in) #customer_login .col-2 { display: none; }
body.pharmelia.woocommerce-account:not(.logged-in) #customer_login .u-column1,
body.pharmelia.woocommerce-account:not(.logged-in) #customer_login .col-1 { width: 100%; float: none; max-width: 520px; margin-inline: auto; }
body.pharmelia .ph-register-cta { margin: 16px 0 0; text-align: center; font-size: 14px; color: var(--ph-text); }
body.pharmelia .ph-register-cta a { font-weight: 600; color: var(--ph-primary); }

/* ==========================================================================
   Stock status badges
   ========================================================================== */
.ph-stock {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	font-weight: 500;
	line-height: 1.4;
	padding: 3px 10px;
	border-radius: 999px;
	width: fit-content;
}
.ph-stock__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.ph-stock--ok    { color: var(--ph-ok);        background: #E8F4ED; }
.ph-stock--low   { color: var(--ph-warn-ink);  background: #FCF0E3; }
.ph-stock--order { color: var(--ph-primary);   background: #E7EEF9; }
.ph-stock--out   { color: var(--ph-danger);    background: #FCEBEA; }
.ph-stock-wrap { margin: 8px 0 12px; }

/* ==========================================================================
   Archive toolbar
   ========================================================================== */
.ph-toolbar { display: flex; flex-direction: column; gap: 10px; margin: 0 0 14px; width: 100%; }
.ph-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.ph-chips::-webkit-scrollbar { display: none; }
.ph-chip {
	flex: none;
	display: inline-flex;
	align-items: center;
	height: 38px;
	padding: 0 16px;
	border-radius: 19px;
	border: 1px solid var(--ph-line);
	background: var(--ph-surface);
	color: var(--ph-ink);
	font-size: 13px;
	font-weight: 500;
	text-decoration: none;
	white-space: nowrap;
}
.ph-chip.is-on { background: var(--ph-primary); border-color: var(--ph-primary); color: #fff; }
.ph-chip--select { padding: 0; }
body.pharmelia .ph-chip--select select {
	min-height: 36px; height: 36px; border: 0; background: transparent; box-shadow: none;
	padding: 0 14px 0 30px; font-size: 13px; font-weight: 500; border-radius: 19px;
}
.ph-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.ph-legend .ph-stock { font-size: 11px; padding: 2px 8px; }

body.pharmelia .woocommerce-result-count { font-size: 13px; color: var(--ph-muted); }
body.pharmelia .woocommerce-ordering select { min-height: 38px; height: 38px; border-radius: 19px; font-size: 13px; }

/* ==========================================================================
   Product list cards
   ========================================================================== */
body.pharmelia ul.products {
	display: grid !important;
	grid-template-columns: 1fr;
	gap: 10px;
	margin: 0;
	padding: 0;
}
@media (min-width: 690px) { body.pharmelia ul.products { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { body.pharmelia ul.products { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
body.pharmelia ul.products::before, body.pharmelia ul.products::after { display: none !important; }

body.pharmelia ul.products li.ph-card {
	display: flex;
	gap: 12px;
	align-items: stretch;
	width: auto !important;
	margin: 0 !important;
	padding: 12px;
	background: var(--ph-surface);
	border: 1px solid var(--ph-line);
	border-radius: 16px;
	text-align: start;
	list-style: none;
}
.ph-card__media { flex: none; width: 92px; align-self: flex-start; }
.ph-card__media img {
	width: 92px !important; height: 92px !important; object-fit: cover;
	border-radius: 12px; background: var(--ph-surface-2); margin: 0 !important;
}
.ph-card__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ph-card__brand { font-size: 12px; font-weight: 600; color: var(--ph-accent-dark); text-transform: none; }
.ph-card__title {
	font-size: 14px; font-weight: 500; color: var(--ph-ink); line-height: 1.45; text-decoration: none;
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ph-card__size { font-size: 12px; color: var(--ph-muted); }
.ph-card__foot {
	margin-top: auto; padding-top: 6px;
	display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
}
.ph-card__price { font-size: 15px; font-weight: 600; color: var(--ph-ink); }
.ph-card__price .amount { color: var(--ph-ink); }
.ph-card__price:empty { display: none; }

/* Buttons inside cards */
.ph-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	height: 38px; padding: 0 14px; border-radius: 12px; border: 0;
	font-family: var(--ph-font); font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer;
	white-space: nowrap;
}
body.pharmelia .ph-btn--add { min-height: 38px; height: 38px; font-size: 13px; background: var(--ph-primary); color: #fff; border-radius: 12px; padding: 0 16px; }
.ph-btn--ghost { background: var(--ph-surface); color: var(--ph-primary); border: 1px solid var(--ph-line); }
.ph-btn--notify { background: var(--ph-accent-soft); color: var(--ph-accent-dark); }

.ph-buy .ph-qty { display: none; }
.ph-buy.is-in-cart .ph-btn--add { display: none; }
.ph-buy.is-in-cart .ph-qty { display: inline-flex; }
.ph-buy.is-busy { opacity: .6; pointer-events: none; }

.ph-qty {
	align-items: center; height: 38px; border-radius: 12px;
	background: var(--ph-bg); border: 1px solid var(--ph-line); overflow: hidden;
}
body.pharmelia .ph-qty__btn {
	min-height: 36px; height: 36px; width: 36px; padding: 0; border: 0; border-radius: 0;
	background: transparent; color: var(--ph-primary); font-size: 18px; font-weight: 600; line-height: 1;
}
body.pharmelia .ph-qty__btn:hover { background: var(--ph-line); color: var(--ph-primary-dark); }
body.pharmelia .ph-qty__input {
	width: 44px; min-height: 36px; height: 36px; padding: 0; border: 0; border-radius: 0; background: transparent;
	text-align: center; font-weight: 600; font-size: 15px; box-shadow: none; -moz-appearance: textfield;
}
.ph-qty__input::-webkit-outer-spin-button, .ph-qty__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ph-inline-error { display: block; width: 100%; font-size: 12px; color: var(--ph-danger); }

/* Guest price notice from B2BKing */
body.pharmelia .ph-card__price .b2bking_hidden_price,
body.pharmelia .ph-card__price span:not(.amount):not(.woocommerce-Price-amount):not(.woocommerce-Price-currencySymbol) { font-size: 12px; font-weight: 500; color: var(--ph-muted); }

/* ==========================================================================
   Single product
   ========================================================================== */
body.pharmelia.single-product div.product .product_title { font-size: clamp(20px, 5vw, 26px); line-height: 1.4; }
body.pharmelia.single-product div.product .price { color: var(--ph-ink); font-weight: 600; }
body.pharmelia.single-product .woocommerce-product-gallery img { border-radius: var(--ph-radius-lg); background: var(--ph-surface-2); }
body.pharmelia.single-product form.cart { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
body.pharmelia.single-product form.cart .quantity input.qty { width: 84px; text-align: center; font-weight: 600; }
body.pharmelia.single-product form.cart .single_add_to_cart_button { flex: 1; }
body.pharmelia.single-product .product_meta { font-size: 13px; color: var(--ph-muted); }

/* Fixes after first render */
body.pharmelia ul.products li.ph-card { flex-direction: row !important; }
body.pharmelia .hero-section[data-type="type-2"] {
	min-height: 0 !important;
	--min-height: 0 !important;
	padding: 18px 0 6px !important;
	background: transparent !important;
}
body.pharmelia .hero-section[data-type="type-2"] .entry-header { text-align: start; padding: 0 !important; }
body.pharmelia .hero-section .page-title { font-size: 22px !important; margin: 0; }
body.pharmelia .woocommerce-products-header,
body.pharmelia .ct-container > .woocommerce-notices-wrapper:empty { display: none; }
@media (max-width: 999.98px) {
	body.pharmelia .site-main > .ct-container,
	body.pharmelia [data-vertical-spacing] { padding-top: 12px; }
}
body.pharmelia .woo-listing-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.ph-card__brand, .ph-card__title, .ph-card__size { align-self: flex-start; text-align: start; }

/* Single product: compact gallery on phones */
@media (max-width: 689.98px) {
	body.pharmelia.single-product .woocommerce-product-gallery { max-width: 300px; margin-inline: auto; }
}
body.pharmelia .ct-breadcrumbs, body.pharmelia .woocommerce-breadcrumb { font-size: 12px; text-transform: none; }
body.pharmelia .ct-breadcrumbs span:last-child { text-transform: none; }

/* Back-in-stock form */
body.pharmelia .cwginstock-subscribe-form .panel { border: 1px solid var(--ph-line) !important; border-radius: var(--ph-radius-lg); overflow: hidden; box-shadow: none; }
body.pharmelia .cwginstock-subscribe-form .panel-heading { background: var(--ph-accent-soft) !important; border: 0 !important; padding: 12px 16px !important; }
body.pharmelia .cwginstock-subscribe-form .panel-heading h4 { color: var(--ph-accent-dark) !important; font-size: 16px !important; margin: 0; }
body.pharmelia .cwginstock-subscribe-form .panel-body { background: var(--ph-surface); padding: 14px 16px !important; }
body.pharmelia .cwginstock-subscribe-form input[type="submit"],
body.pharmelia .cwginstock-subscribe-form .cwgstock_button { width: 100%; background: var(--ph-accent) !important; border-radius: var(--ph-radius) !important; min-height: 46px; font-family: var(--ph-font); }
body.logged-in.pharmelia .cwginstock-subscribe-form .cwgstock_email { display: none !important; }

/* B2BKing purchase list button in cart */
body.pharmelia .b2bking_add_cart_to_purchase_list_button,
body.pharmelia [class*="purchase_list_button"] { max-width: 100%; width: 100%; background: var(--ph-surface) !important; color: var(--ph-primary) !important; border: 1px solid var(--ph-line) !important; }

/* ==========================================================================
   Minimum order progress
   ========================================================================== */
.ph-min { font-family: var(--ph-font); color: var(--ph-ink); }
.ph-min[hidden] { display: none !important; }
.ph-min__row { display: flex; align-items: center; gap: 10px; justify-content: space-between; font-size: 13px; line-height: 1.5; }
.ph-min__msg { flex: 1; }
.ph-min__msg strong { font-weight: 600; }
.ph-min__total { font-weight: 600; white-space: nowrap; }
.ph-min__track { height: 6px; border-radius: 3px; background: var(--ph-line); overflow: hidden; margin-top: 8px; }
.ph-min__track span { display: block; height: 100%; background: var(--ph-warn); border-radius: 3px; transition: width .3s ease; }
.ph-min.is-ok .ph-min__track span { background: var(--ph-ok); }
.ph-min.is-ok .ph-min__msg { color: var(--ph-ok); }
.ph-min__go {
	flex: none; height: 32px; padding: 0 14px; border-radius: 10px; display: inline-flex; align-items: center;
	background: var(--ph-primary); color: #fff !important; font-weight: 600; font-size: 13px; text-decoration: none;
}
.ph-min--card {
	background: var(--ph-surface); border: 1px solid var(--ph-line); border-radius: var(--ph-radius-lg);
	padding: 14px 16px; margin: 0 0 16px;
}
.ph-min--bar {
	position: fixed; inset-inline: 10px; z-index: 998;
	bottom: calc(var(--ph-nav-h) + env(safe-area-inset-bottom, 0px) + 8px);
	background: var(--ph-surface); border: 1px solid var(--ph-line); border-radius: 16px;
	padding: 10px 12px; box-shadow: 0 8px 24px rgba(11, 26, 74, .12);
}
.ph-min--bar .ph-min__msg { font-size: 12px; color: var(--ph-text); }
@media (max-width: 999.98px) {
	body.pharmelia.woocommerce-shop, body.pharmelia.tax-product_cat, body.pharmelia.tax-product_brand, body.pharmelia.single-product {
		padding-bottom: calc(var(--ph-nav-h) + 96px + env(safe-area-inset-bottom, 0px));
	}
}
@media (min-width: 1000px) {
	.ph-min--bar { bottom: 20px; inset-inline: auto 20px; width: 380px; }
}

/* Amounts: keep "2 100 د.ج" in one visual run inside Arabic text */
body.pharmelia .woocommerce-Price-amount,
body.pharmelia .wc-block-formatted-money-amount,
.ph-num { direction: ltr; unicode-bidi: isolate; white-space: nowrap; }

/* ==========================================================================
   App home
   ========================================================================== */
.ph-app { max-width: 1180px; margin: 0 auto; padding: 0 0 24px; font-family: var(--ph-font); }
.ph-app__body { padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 22px; }

@media (max-width: 999.98px) {
	body.ph-home #header, body.ph-home header#header, body.ph-home .ct-header { display: none !important; }
}
@media (min-width: 1000px) {
	.ph-apphead__bar { display: none !important; }
	.ph-apphead { border-radius: 0 0 20px 20px; }
}

.ph-apphead {
	background: var(--ph-surface);
	border-bottom: 1px solid var(--ph-line);
	padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 16px;
	display: flex; flex-direction: column; gap: 12px;
	position: relative; z-index: 5;
}
.ph-apphead__bar { display: flex; align-items: center; justify-content: space-between; }
.ph-logo { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.ph-logo img { width: 34px; height: 30px; object-fit: contain; }
.ph-logo span { font-family: 'Quicksand', var(--ph-font); font-weight: 700; font-size: 22px; color: var(--ph-primary); }
.ph-apphead__actions { display: flex; align-items: center; gap: 8px; }
.ph-pill {
	height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid var(--ph-line);
	display: inline-flex; align-items: center; font-size: 13px; font-weight: 600; color: var(--ph-primary); text-decoration: none;
}
.ph-iconbtn {
	width: 40px; height: 40px; border-radius: 20px; border: 1px solid var(--ph-line);
	display: inline-flex; align-items: center; justify-content: center; color: var(--ph-ink);
}
.ph-hello { margin: 0; font-size: 15px; color: var(--ph-text); }
.ph-hello strong { color: var(--ph-ink); font-weight: 600; }

.ph-search { display: flex; gap: 8px; align-items: stretch; }
.ph-search__box { flex: 1; min-width: 0; }
.ph-search__scan {
	flex: none; width: 48px; height: 48px; border-radius: 14px; background: var(--ph-primary); color: #fff;
	display: inline-flex; align-items: center; justify-content: center;
}
/* FiboSearch inside the app header */
body.pharmelia .ph-search .dgwt-wcas-search-wrapp { max-width: none !important; min-width: 0 !important; }
body.pharmelia .ph-search .dgwt-wcas-sf-wrapp { background: transparent !important; padding: 0 !important; }
body.pharmelia .ph-search input.dgwt-wcas-search-input {
	height: 48px !important; border-radius: 14px !important; background: var(--ph-bg) !important;
	border: 1px solid transparent !important; font-family: var(--ph-font) !important; font-size: 14px !important;
	padding-inline: 44px 14px !important; color: var(--ph-ink) !important;
}
body.pharmelia .ph-search input.dgwt-wcas-search-input:focus { border-color: var(--ph-primary) !important; background: #fff !important; }
body.pharmelia .ph-search .dgwt-wcas-search-submit,
body.pharmelia .ph-search .dgwt-wcas-ico-magnifier { inset-inline-start: 12px !important; inset-inline-end: auto !important; }
body.pharmelia .ph-search button.dgwt-wcas-search-submit { background: transparent !important; min-height: 0 !important; height: 48px; width: 32px; padding: 0 !important; }
body.pharmelia .ph-search button.dgwt-wcas-search-submit svg path { fill: var(--ph-text) !important; }
body.pharmelia .ph-search button.dgwt-wcas-search-submit::before { display: none !important; }

/* Welcome (guests) */
.ph-welcome {
	background: var(--ph-surface); border: 1px solid var(--ph-line); border-radius: 22px; padding: 22px 18px;
	display: flex; flex-direction: column; gap: 12px;
}
.ph-welcome__kicker { font-size: 12px; font-weight: 600; color: var(--ph-accent-dark); }
.ph-welcome__title { font-size: clamp(24px, 7vw, 34px); line-height: 1.35; margin: 0; color: var(--ph-ink); }
.ph-welcome__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.ph-welcome__list li::before { content: '✓'; color: var(--ph-accent); font-weight: 700; margin-inline-end: 8px; }
.ph-welcome__cta { display: flex; flex-direction: column; gap: 8px; }
.ph-welcome__note { margin: 0; font-size: 12px; color: var(--ph-muted); }
.ph-btn--lg { height: 50px; font-size: 15px; border-radius: 14px; }
.ph-btn--primary { background: var(--ph-primary); color: #fff !important; }
@media (min-width: 690px) { .ph-welcome__cta { flex-direction: row; } .ph-welcome__cta .ph-btn { flex: 1; } }

/* Banners */
.ph-banners { margin: 0 -16px; }
.ph-banners__track {
	display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 16px;
	padding: 0 16px; scrollbar-width: none;
}
.ph-banners__track::-webkit-scrollbar { display: none; }
.ph-banner {
	flex: 0 0 calc(100% - 32px); max-width: 560px; scroll-snap-align: start;
	min-height: 168px; border-radius: 20px; padding: 18px; position: relative; overflow: hidden;
	display: flex; align-items: stretch; text-decoration: none; color: #fff;
}
.ph-banner--blue { background: var(--ph-primary); }
.ph-banner--teal { background: var(--ph-accent-dark); }
.ph-banner--ink { background: var(--ph-ink); }
.ph-banner__txt { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 6px; max-width: 64%; }
.ph-banner__kicker { font-size: 12px; font-weight: 600; color: rgba(255,255,255,.78); }
.ph-banner__title { font-size: 18px; font-weight: 600; line-height: 1.45; }
.ph-banner__text { font-size: 12px; color: rgba(255,255,255,.8); }
.ph-banner__cta {
	margin-top: auto; align-self: flex-start; background: #fff; color: var(--ph-ink); font-size: 13px; font-weight: 600;
	padding: 8px 14px; border-radius: 12px;
}
.ph-banner__img {
	position: absolute; inset-inline-end: -18px; bottom: -18px; width: 46%; max-width: 210px; aspect-ratio: 1;
	object-fit: cover; border-radius: 50%; border: 4px solid rgba(255,255,255,.18);
}
.ph-banners__dots { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.ph-banners__dots span { width: 6px; height: 6px; border-radius: 3px; background: var(--ph-line); transition: width .2s; }
.ph-banners__dots span.is-on { width: 18px; background: var(--ph-primary); }

/* Last order */
.ph-last { background: var(--ph-primary); color: #fff; border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.ph-last__top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.ph-last__top > div { display: flex; flex-direction: column; gap: 4px; }
.ph-last__label { font-size: 13px; color: var(--ph-primary-soft); }
.ph-last__sum { font-size: 17px; font-weight: 600; }
.ph-last__sum .amount, .ph-last__sum .woocommerce-Price-amount { color: #fff; }
.ph-last__status { font-size: 12px; background: rgba(255,255,255,.14); padding: 5px 10px; border-radius: 12px; white-space: nowrap; }
.ph-last__bottom { display: flex; justify-content: space-between; align-items: center; }
.ph-last__thumbs { display: flex; }
.ph-last__thumbs img { width: 38px; height: 38px; border-radius: 19px; background: #fff; object-fit: cover; border: 2px solid var(--ph-primary); }
.ph-last__thumbs img + img { margin-inline-start: -10px; }
.ph-last__again {
	height: 44px; padding: 0 18px; border-radius: 22px; background: #fff; color: var(--ph-primary) !important;
	font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
}
.ph-first {
	background: var(--ph-accent-soft); color: var(--ph-accent-dark); border-radius: 16px; padding: 14px 16px;
	display: flex; flex-direction: column; gap: 4px; font-size: 13px;
}
.ph-first strong { font-size: 15px; }
.ph-first .amount { color: inherit; font-weight: 600; }

/* Sections */
.ph-sec { display: flex; flex-direction: column; gap: 12px; }
.ph-sec__head { display: flex; justify-content: space-between; align-items: baseline; }
.ph-sec__title { margin: 0; font-size: 17px !important; font-weight: 600; color: var(--ph-ink); }
.ph-sec__more { font-size: 13px; font-weight: 500; color: var(--ph-primary); text-decoration: none; }

/* Categories grid */
.ph-cats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 690px) { .ph-cats { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
.ph-cats--page { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 22px; }
@media (min-width: 690px) { .ph-cats--page { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ph-cat { display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; text-align: center; }
.ph-cat__img {
	width: 100%; aspect-ratio: 1; border-radius: 18px; overflow: hidden; background: var(--ph-surface);
	border: 1px solid var(--ph-line); display: flex; align-items: center; justify-content: center;
}
.ph-cat__img img { width: 100%; height: 100%; object-fit: cover; margin: 0 !important; }
.ph-cat__ph { font-size: 22px; font-weight: 700; color: var(--ph-primary); }
.ph-cat__name { font-size: 12px; font-weight: 500; color: var(--ph-ink); line-height: 1.35; }

/* Product rails */
.ph-rail {
	display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity; margin: 0 -16px; padding: 2px 16px 4px;
	scrollbar-width: none;
}
.ph-rail::-webkit-scrollbar { display: none; }
.ph-rail__item { flex: 0 0 158px; scroll-snap-align: start; display: flex; }
.ph-tile {
	width: 100%; background: var(--ph-surface); border: 1px solid var(--ph-line); border-radius: 16px; padding: 10px;
	display: flex; flex-direction: column; gap: 4px;
}
.ph-tile__media { position: relative; display: block; border-radius: 12px; overflow: hidden; background: var(--ph-surface-2); }
.ph-tile__media img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; margin: 0 !important; }
.ph-tile__flag {
	position: absolute; top: 6px; inset-inline-start: 6px; background: var(--ph-danger); color: #fff;
	font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 8px;
}
.ph-tile__brand { font-size: 11px; font-weight: 600; color: var(--ph-accent-dark); margin-top: 4px; align-self: flex-start; }
.ph-tile__title {
	font-size: 13px; font-weight: 500; color: var(--ph-ink); line-height: 1.4; text-decoration: none; min-height: 2.8em;
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ph-tile__state { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; background: none !important; padding: 0; }
.ph-tile__price { font-size: 14px; font-weight: 600; color: var(--ph-ink); min-height: 1.4em; }
.ph-tile__price del { font-size: 11px; color: var(--ph-muted); font-weight: 400; }
.ph-tile__price ins { text-decoration: none; }
.ph-tile__buy { margin-top: auto; padding-top: 4px; }
.ph-tile__buy .ph-btn, .ph-tile__buy .ph-btn--add { width: 100%; }
.ph-tile__buy .ph-qty { width: 100%; justify-content: space-between; }
.ph-tile__buy .ph-btn--ghost { font-size: 12px; padding: 0 8px; }

/* Brands */
.ph-brands { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 690px) { .ph-brands { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.ph-brand {
	height: 56px; border-radius: 14px; background: var(--ph-surface); border: 1px solid var(--ph-line);
	display: flex; align-items: center; justify-content: center; padding: 8px 10px; text-decoration: none;
	color: var(--ph-ink); font-size: 13px; font-weight: 600;
}
.ph-brand img { max-height: 26px; width: auto; max-width: 100%; object-fit: contain; margin: 0 !important; }

/* Help */
.ph-help {
	background: var(--ph-surface); border: 1px solid var(--ph-line); border-radius: 18px; padding: 14px 16px;
	display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.ph-help > div { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.ph-help strong { font-size: 14px; color: var(--ph-ink); }
.ph-btn--wa { background: #1DA851; color: #fff !important; }
body.pharmelia .ph-search .dgwt-wcas-sf-wrapp { position: relative !important; }
body.pharmelia .ph-search button.dgwt-wcas-search-submit {
	position: absolute !important; top: 0 !important; inset-inline-start: 6px !important; inset-inline-end: auto !important;
	right: auto; left: auto;
}
html[dir="rtl"] body.pharmelia .ph-search button.dgwt-wcas-search-submit { right: 6px !important; left: auto !important; }
html[dir="ltr"] body.pharmelia .ph-search button.dgwt-wcas-search-submit { left: 6px !important; right: auto !important; }
body.pharmelia .ph-search .dgwt-wcas-preloader { display: none; }

/* ==========================================================================
   Checkout (block)
   ========================================================================== */
body.ph-checkout-member .wp-block-woocommerce-checkout-contact-information-block { display: none !important; }
body.pharmelia .wc-block-checkout__form .wc-block-components-checkout-step__title { font-family: var(--ph-font); font-size: 17px; }
body.pharmelia .wc-block-components-text-input input,
body.pharmelia .wc-block-components-combobox .wc-block-components-combobox-control input,
body.pharmelia .wc-blocks-components-select select,
body.pharmelia .wc-block-components-textarea { border-radius: var(--ph-radius) !important; border-color: var(--ph-line) !important; font-family: var(--ph-font) !important; }
body.pharmelia .wc-block-components-button.wc-block-components-checkout-place-order-button,
body.pharmelia .wc-block-cart__submit-button { border-radius: var(--ph-radius) !important; min-height: 52px; font-family: var(--ph-font); font-weight: 600; background: var(--ph-primary) !important; }
body.pharmelia .wc-block-components-radio-control__option { border-radius: var(--ph-radius) !important; }
.ph-checkout-note {
	display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 12px; padding: 12px 14px; border-radius: var(--ph-radius);
	background: var(--ph-accent-soft); color: var(--ph-accent-dark); font-size: 13px; font-weight: 500;
}
body.pharmelia .wc-block-components-address-card { border-radius: var(--ph-radius); }
/* Only Algeria is served: hide the country picker in checkout */
body.pharmelia .wc-block-components-address-form__country,
body.pharmelia #billing_country_field { display: none !important; }
.ph-search--archive { margin-bottom: 2px; }
.ph-chips--cats .ph-chip { height: 34px; font-size: 12px; padding: 0 12px; }
.ph-empty {
	background: var(--ph-surface); border: 1px solid var(--ph-line); border-radius: 18px; padding: 24px 18px; text-align: center;
	display: flex; flex-direction: column; gap: 8px; align-items: center; color: var(--ph-text);
}
.ph-empty strong { color: var(--ph-ink); font-size: 16px; }

/* ==========================================================================
   My account
   ========================================================================== */
@media (max-width: 999.98px) {
	body.pharmelia.woocommerce-account.logged-in .woocommerce-MyAccount-navigation { display: none; }
	body.pharmelia.woocommerce-account .woocommerce-MyAccount-content { width: 100% !important; float: none !important; }
}
body.pharmelia .woocommerce-MyAccount-navigation ul { list-style: none; padding: 0; margin: 0; background: var(--ph-surface); border: 1px solid var(--ph-line); border-radius: 18px; overflow: hidden; }
body.pharmelia .woocommerce-MyAccount-navigation li a { display: block; padding: 12px 16px; color: var(--ph-ink); text-decoration: none; border-bottom: 1px solid var(--ph-line); }
body.pharmelia .woocommerce-MyAccount-navigation li.is-active a { color: var(--ph-primary); font-weight: 600; background: var(--ph-bg); }
.ph-acc { display: flex; flex-direction: column; gap: 14px; }
.ph-acc__head {
	display: flex; align-items: center; gap: 12px; background: var(--ph-primary); color: #fff; border-radius: 20px; padding: 16px;
}
.ph-acc__head > div { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.ph-acc__head strong { font-size: 17px; }
.ph-acc__head span[dir] { font-size: 13px; color: var(--ph-primary-soft); }
.ph-acc__avatar { width: 46px; height: 46px; border-radius: 23px; background: rgba(255,255,255,.16); display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 600; }
.ph-acc__count { font-size: 12px; background: rgba(255,255,255,.14); padding: 5px 10px; border-radius: 12px; white-space: nowrap; }
.ph-acc__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 690px) { .ph-acc__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.ph-acc__tile {
	background: var(--ph-surface); border: 1px solid var(--ph-line); border-radius: 18px; padding: 16px 14px; min-height: 96px;
	display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--ph-ink); font-weight: 600; font-size: 14px;
}
.ph-acc__tile svg { color: var(--ph-primary); }
.ph-acc__tile small { font-size: 12px; font-weight: 400; color: var(--ph-muted); margin-top: -4px; }
.ph-acc__tile--reorder { background: var(--ph-accent-soft); border-color: transparent; }
.ph-acc__tile--reorder svg { color: var(--ph-accent-dark); }
.ph-acc__tile--whatsapp svg { color: #1DA851; }
.ph-acc__logout { align-self: center; display: inline-flex; align-items: center; gap: 6px; color: var(--ph-danger); font-size: 14px; text-decoration: none; padding: 8px; }
.ph-acc__logout svg { width: 18px; height: 18px; }
/* Orders table → cards on phones */
@media (max-width: 689.98px) {
	body.pharmelia .woocommerce-orders-table thead { display: none; }
	body.pharmelia .woocommerce-orders-table tr { display: block; background: var(--ph-surface); border: 1px solid var(--ph-line); border-radius: 16px; margin-bottom: 10px; padding: 10px 12px; }
	body.pharmelia .woocommerce-orders-table td, body.pharmelia .woocommerce-orders-table th { display: flex; justify-content: space-between; border: 0 !important; padding: 4px 0 !important; text-align: start !important; }
	body.pharmelia .woocommerce-orders-table td::before { content: attr(data-title); color: var(--ph-muted); font-weight: 400; }
	body.pharmelia .woocommerce-orders-table .woocommerce-button { min-height: 36px; height: 36px; font-size: 13px; padding: 0 12px; margin-inline-start: 6px; }
}
.ph-acc__back { display: inline-flex; margin-bottom: 12px; font-size: 14px; font-weight: 600; color: var(--ph-primary); text-decoration: none; }
@media (min-width: 1000px) { .ph-acc__back { display: none; } }

/* ==========================================================================
   Barcode scanner overlay
   ========================================================================== */
html.ph-scan-open, html.ph-scan-open body { overflow: hidden; }
.ph-scan {
	position: fixed; inset: 0; z-index: 100000; display: none; flex-direction: column;
	background: #0B1A4A; color: #fff; font-family: var(--ph-font); padding-bottom: env(safe-area-inset-bottom, 0px);
}
.ph-scan.is-open { display: flex; }
.ph-scan__top {
	display: flex; align-items: center; justify-content: space-between; gap: 8px;
	padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 12px;
}
.ph-scan__top strong { font-size: 16px; }
body.pharmelia .ph-scan__close {
	width: 40px; height: 40px; min-height: 40px; border-radius: 20px; padding: 0; background: rgba(255,255,255,.12); color: #fff; font-size: 18px;
}
.ph-scan__cart { color: #fff !important; text-decoration: none; font-size: 14px; font-weight: 600; background: var(--ph-accent); padding: 8px 14px; border-radius: 12px; }
.ph-scan__cam { position: relative; margin: 0 14px; border-radius: 20px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; max-height: 42vh; flex: none; }
.ph-scan__cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-scan__frame { position: absolute; inset: 18% 10%; border: 3px solid rgba(255,255,255,.85); border-radius: 16px; box-shadow: 0 0 0 999px rgba(0,0,0,.28); }
.ph-scan__frame span { position: absolute; inset-inline: 8px; top: 50%; height: 2px; background: #FF4D4F; box-shadow: 0 0 8px #FF4D4F; animation: phScanLine 1.6s ease-in-out infinite alternate; }
@keyframes phScanLine { from { transform: translateY(-34px); } to { transform: translateY(34px); } }
@media (prefers-reduced-motion: reduce) { .ph-scan__frame span { animation: none; } }
.ph-scan__status { margin: 10px 14px 0; font-size: 14px; min-height: 1.6em; text-align: center; color: rgba(255,255,255,.85); }
.ph-scan__status.is-ok { color: #7EE2A8; }
.ph-scan__status.is-warn { color: #FFC98A; }
.ph-scan__status.is-err { color: #FF9A94; }
.ph-scan__manual { display: flex; gap: 8px; margin: 10px 14px; }
body.pharmelia .ph-scan__manual input { flex: 1; min-height: 46px; background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #fff; }
body.pharmelia .ph-scan__manual input::placeholder { color: rgba(255,255,255,.6); }
body.pharmelia .ph-scan__manual .ph-btn { height: 46px; min-height: 46px; background: var(--ph-accent); }
.ph-scan__list {
	list-style: none; margin: 0; padding: 12px 14px 16px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px;
	background: var(--ph-bg); border-radius: 20px 20px 0 0; color: var(--ph-ink);
}
.ph-scan__list:empty::before { content: 'المنتجات اللي تمسحها تظهر هنا وتنضاف للسلة مباشرة.'; color: var(--ph-muted); font-size: 13px; text-align: center; padding: 18px 8px; }
.ph-scan__item { display: flex; align-items: center; gap: 10px; background: var(--ph-surface); border: 1px solid var(--ph-line); border-radius: 14px; padding: 8px; }
.ph-scan__item.is-zero { opacity: .55; }
.ph-scan__item img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex: none; }
.ph-scan__info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ph-scan__brand { font-size: 11px; font-weight: 600; color: var(--ph-accent-dark); align-self: flex-start; }
.ph-scan__name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-scan__info .ph-stock { font-size: 11px; padding: 1px 8px; }
.ph-scan__q { min-width: 32px; text-align: center; font-weight: 600; }
/* Logo mark before the wordmark in Blocksy's header */
body.pharmelia .site-title a { display: inline-flex; align-items: center; gap: 8px; }
body.pharmelia .site-title a::before {
	content: ''; width: 32px; height: 28px; flex: none;
	background: url('../../../uploads/pharmelia-assets/mark-drop.webp') center / contain no-repeat;
}
