/* ==========================================================================
   Legacy bridge — TEMPORARY (Phase 1).

   The current pages are still drawn by Code Snippets #14–#25. This file only
   recolours them to the new tokens; it changes no layout, spacing or markup.

   1) Old variables (--hh-*) now point at the new tokens.
   2) Colours the snippets hard-code (greens, olive, khaki) are overridden,
      colour properties only. Selectors mirror the snippet's own selector
      with a higher-specificity prefix (html body.hat7). !important appears
      only where the snippet itself uses !important.

   Excluded on purpose: Hazem widget (#12) — Hazem UI is out of Phase 1 scope.
   Remove each block when its snippet is migrated (see docs/design-system.md).
   ========================================================================== */

/* ---------- 1. Variables ----------
   Declared on body (not :root): snippet #14 prints its own :root values
   later in <head>, and a body-level value always wins for page content. */
html body.hat7 {
	--hh-ink: var(--text);
	--hh-ink2: var(--text);
	--hh-mute: var(--text-secondary);
	--hh-line: var(--border);
	--hh-line2: var(--border-strong);
	--hh-bg: var(--background);
	--hh-surface: var(--surface);
	--hh-soft: var(--primary-tint);
	--hh-soft2: var(--cream);
	--hh-pri: var(--primary-dark);   /* buttons, chips, active states */
	--hh-pri2: var(--primary-deep);  /* their hover */
	--hh-pri-l: var(--primary);
	--hh-acc: var(--accent);
	--hh-danger: var(--danger);
	--hh-f: var(--font-body);
	--hh-green: var(--primary-dark); /* used by #23 */
}

/* ---------- 2a. Snippet #14 — global, header, footer, cards ---------- */
/* Small text links: the mid petrol is 4.3:1 on cream, so links use the dark petrol. */
html body.hat7 a { color: var(--primary-dark); }
html body.hat7 a:hover { color: var(--primary-deep); }
html body.hat7 .hh-fcol h4 { color: #fff; } /* footer column titles sat in dark ink on the dark footer */
html body.hat7.hh-ui { background: var(--background); }
html body.hat7 .hh-btn-soft:hover { background: var(--primary-soft) !important; }
html body.hat7.hh-ui input:focus,
html body.hat7.hh-ui select:focus,
html body.hat7.hh-ui textarea:focus { box-shadow: var(--ring-primary); }
html body.hat7 .hh-search:focus-within { box-shadow: var(--ring-primary); }
html body.hat7 .hh-cart-count { color: var(--text); }
html body.hat7 .hh-sell { background: var(--accent-soft); color: var(--text) !important; }
html body.hat7 .hh-sell:hover { background: var(--cream-deep); }
html body.hat7.hh-ui .site-footer { background: var(--primary-deep); color: rgba(255, 255, 255, .82); }
html body.hat7 .hh-foot a { color: rgba(255, 255, 255, .82) !important; }
html body.hat7 .hh-foot a:hover { color: #fff !important; }
html body.hat7 .hh-fbrand p { color: rgba(255, 255, 255, .74); }
html body.hat7 .hh-logo-foot .hh-logo-img { background: var(--primary-tint); }
html body.hat7 .hh-logo-foot .hh-logo-txt small,
html body.hat7 .hh-credit small { color: rgba(255, 255, 255, .66); }
html body.hat7 .hh-pay span,
html body.hat7 .hh-foot-bot b,
html body.hat7 .hh-credit b { color: rgba(255, 255, 255, .9); }
html body.hat7 .hh-fcontact .hh-wa { color: var(--accent) !important; }
html body.hat7 .hh-foot-bot { color: rgba(255, 255, 255, .66); }
html body.hat7.hh-ui ul.products li.product { box-shadow: var(--shadow-1); }
html body.hat7.hh-ui ul.products li.product img { background: var(--cream); }
html body.hat7.hh-ui .onsale { color: var(--text) !important; }

/* Main purchase buttons (add to cart, checkout, place order): the snippets
   paint them in ink; the brand asks for dark petrol with white text. */
html body.hat7.hh-ui .button.alt,
html body.hat7.hh-ui .single_add_to_cart_button,
html body.hat7.hh-ui .checkout-button,
html body.hat7.hh-ui .wc-block-cart__submit-button,
html body.hat7.hh-ui .wc-block-components-checkout-place-order-button { background: var(--primary-dark) !important; color: #fff !important; }
html body.hat7.hh-ui .button.alt:hover,
html body.hat7.hh-ui .single_add_to_cart_button:hover,
html body.hat7.hh-ui .checkout-button:hover,
html body.hat7.hh-ui .wc-block-cart__submit-button:hover,
html body.hat7.hh-ui .wc-block-components-checkout-place-order-button:hover { background: var(--primary-deep) !important; }

/* Product-card "add to cart" is a purchase button too. */
html body.hat7.hh-ui ul.products li.product .button { background: var(--primary-dark) !important; color: #fff !important; }
html body.hat7.hh-ui ul.products li.product .button:hover { background: var(--primary-deep) !important; }
/* WCFM extras that ship their own colours. */
html body.hat7 a.wcfm_catalog_enquiry { background: var(--primary-soft) !important; color: var(--primary-dark) !important; }
html body.hat7 .wcfm_product_popup_button { background: var(--primary-dark) !important; }
/* WCFM's own generated colours (from its colour settings, kept as they are in the
   database) still carry the old olive/teal; recolour just these, colour only. */
html body.hat7.hh-ui #wcfm-main-contentainer table thead th,
html body.hat7.hh-ui #wcfm-main-contentainer table thead td,
html body.hat7.hh-ui #wcfm-main-contentainer table tfoot th,
html body.hat7.hh-ui #wcfm-main-contentainer table tfoot td { color: var(--text-secondary) !important; }
html body.hat7.hh-ui .wcfm-page-headig .wcfm-page-heading-text,
html body.hat7.hh-ui #wcfm-main-contentainer div.wcfm-collapse-content h2 { color: var(--primary-dark) !important; }
html body.hat7.hh-ui #wcfm-main-contentainer .page_collapsible::before { background-color: var(--primary-dark) !important; }

/* ---------- 2b. Snippet #15 — homepage ---------- */
html body.hat7 .hh-eyebrow { border-color: var(--primary-soft); }
html body.hat7 .hh-hero h1 span { color: var(--primary); } /* brand petrol on the large hero word */
html body.hat7 .hh-hero h1 span::after { background: rgba(197, 164, 109, .35); }
html body.hat7 .hh-hero-search:focus-within { box-shadow: var(--ring-primary), var(--shadow-1); }
html body.hat7 .hh-art-blob { background: linear-gradient(145deg, var(--primary-soft), var(--cream)); box-shadow: inset 0 0 0 1px rgba(83, 123, 123, .1); }
html body.hat7 .hh-cat-kitchen .hh-cat-ico { background: var(--accent-soft); color: var(--accent-ink); }
html body.hat7 .hh-cat-skate .hh-cat-ico { background: var(--primary-tint); color: var(--primary-dark); }
html body.hat7 .hh-cat-sport .hh-cat-ico { background: var(--primary-soft); color: var(--primary-dark); }
html body.hat7 .hh-prod-cta { background: linear-gradient(160deg, #fff, var(--cream)); border-color: var(--cream-deep); }
html body.hat7 .hh-prod-cta .hh-cat-ico { background: var(--accent-soft); color: var(--accent-ink); }
html body.hat7 .hh-why-sec { background: linear-gradient(180deg, transparent, var(--primary-tint) 18%, var(--primary-tint) 82%, transparent); }
html body.hat7 .hh-seller { background: linear-gradient(150deg, var(--primary-dark), var(--primary-deep)); color: rgba(255, 255, 255, .9); }
html body.hat7 .hh-seller::after { background: radial-gradient(circle, rgba(197, 164, 109, .22), transparent 70%); }
html body.hat7 .hh-offer { background: rgba(197, 164, 109, .18); border-color: rgba(197, 164, 109, .45); color: var(--accent-soft); }
html body.hat7 .hh-offer .hh-ico { color: var(--accent); }
html body.hat7 .hh-seller-p { color: rgba(255, 255, 255, .82); }
html body.hat7 .hh-seller li .hh-ico { color: var(--accent); background: rgba(197, 164, 109, .14); }
html body.hat7 .hh-eyebrow-d { color: rgba(255, 255, 255, .9); }
html body.hat7 .hh-btn-light { color: var(--primary-deep) !important; }
html body.hat7 .hh-btn-light:hover { background: var(--primary-tint) !important; color: var(--primary-deep) !important; }
html body.hat7 .hh-hazem { background: linear-gradient(150deg, var(--primary-tint), #fff 60%, var(--cream)); border-color: var(--primary-soft); }

/* ---------- 2c. Snippet #16 — shop, product, cart, account ---------- */
html body.hat7 .hh-catbanner,
html body.hat7 .hh-acc-hi { background: linear-gradient(135deg, #fff, var(--primary-tint)); }
html body.hat7.hh-ui.single-product div.product .woocommerce-product-gallery__image img { background: var(--cream); }
html body.hat7.hh-ui .wc-block-components-sale-badge { color: var(--accent-ink) !important; }
html body.hat7 ::selection { background: rgba(83, 123, 123, .22); }
html body.hat7 .hh-si-ok,
html body.hat7 .hh-badge-ok { background: var(--success-soft); color: var(--success); }
html body.hat7 .hh-si-warn,
html body.hat7 .hh-badge-warn { background: var(--warning-soft); color: var(--warning); }
html body.hat7 .hh-si-acc { background: var(--accent-soft); color: var(--accent-ink); }
html body.hat7 .hh-si-info,
html body.hat7 .hh-badge-info { background: var(--primary-tint); color: var(--primary-dark); }
html body.hat7 .hh-badge-mute { background: var(--background); color: var(--text-secondary); }

/* ---------- 2d. Snippet #17 — WCFM + work dashboard ---------- */
/* Side menus: light sage (#E5ECE8) with petrol text; the active item is the dark petrol. */
html body.hat7.hh-ui #wcfm_menu { background: var(--primary-soft) !important; border-inline-end: 1px solid var(--border); }
html body.hat7.hh-ui #wcfm_menu .wcfm_menu_items a.wcfm_menu_item { color: var(--text) !important; }
html body.hat7.hh-ui #wcfm_menu .wcfm_menu_items a.wcfm_menu_item .wcfmfa { color: var(--primary) !important; }
html body.hat7.hh-ui #wcfm_menu .wcfm_menu_items a.wcfm_menu_item:hover { background: rgba(255, 255, 255, .7) !important; color: var(--primary-dark) !important; }
html body.hat7.hh-ui #wcfm_menu .wcfm_menu_items a.active { background: var(--primary-dark) !important; color: #fff !important; }
html body.hat7.hh-ui #wcfm_menu .wcfm_menu_items a.active .wcfmfa { color: #fff !important; }
html body.hat7.hh-ui .wcfm_welcomebox_header { background: linear-gradient(135deg, #fff, var(--primary-tint)) !important; }
html body.hat7.hh-ui .wcfm_dashboard_stats_block:nth-child(2) .wcfmfa { background: var(--accent-soft) !important; color: var(--accent-ink) !important; }
html body.hat7.hh-ui .wcfm_dashboard_stats_block:nth-child(3) .wcfmfa { background: var(--primary-tint) !important; color: var(--primary-dark) !important; }
html body.hat7.hh-ui .wcfm_dashboard_stats_block:nth-child(4) .wcfmfa { background: var(--warning-soft) !important; color: var(--warning) !important; }
html body.hat7 .hh-td-side { background: var(--primary-soft); color: var(--text); border-inline-end: 1px solid var(--border); }
html body.hat7 .hh-td-me small { color: var(--text-secondary); }
html body.hat7 .hh-td-side nav a { color: var(--text) !important; }
html body.hat7 .hh-td-side nav a .hh-ico { color: var(--primary); }
html body.hat7 .hh-td-side nav a:hover { background: rgba(255, 255, 255, .7); color: var(--primary-dark) !important; }
html body.hat7 .hh-td-side nav a.on,
html body.hat7 .hh-td-side nav a[aria-current="page"] { background: var(--primary-dark); color: #fff !important; }
html body.hat7 .hh-td-side nav a.on .hh-ico,
html body.hat7 .hh-td-side nav a[aria-current="page"] .hh-ico { color: #fff; }
html body.hat7 .hh-td-hi { background: linear-gradient(135deg, #fff, var(--primary-tint)); }
html body.hat7 .hh-pill-ok { background: var(--success-soft); color: var(--success); }
html body.hat7 .hh-pill-warn { background: var(--warning-soft); color: var(--warning); }
html body.hat7 .hh-pill-info { background: var(--primary-tint); color: var(--primary-dark); }
html body.hat7 .hh-pill-mute { background: var(--background); color: var(--text-secondary); }
html body.hat7 .hh-pill-acc { background: var(--accent-soft); color: var(--accent-ink); }
html body.hat7 .hh-tbl tr:hover td { background: var(--background); }

/* ---------- 2e. Snippets #18 / #22 / #23 / #25 ---------- */
html body.hat7 .hh-ab-hazem,
html body.hat7 .hh-sw { background: linear-gradient(150deg, var(--primary-tint), #fff 60%, var(--cream)); border-color: var(--primary-soft); }
html body.hat7 .hh-ab-vision { background: linear-gradient(150deg, var(--primary-dark), var(--primary-deep)); color: rgba(255, 255, 255, .9); }
html body.hat7 .hh-guide-hero { background: linear-gradient(135deg, #fff, var(--primary-tint)); }
html body.hat7 .hh-by-card a,
html body.hat7 .hh-by-single a { color: var(--primary-dark) !important; }
html body.hat7 .hh-file-picked { color: var(--success); }
html body.hat7 .hh-ob,
html body.hat7 .hh-gx-s,
html body.hat7 .hh-gx-shots figure { border-color: var(--border); }
html body.hat7 .hh-ob-head b,
html body.hat7 .hh-ob-steps b,
html body.hat7 .hh-gx-s h2 { color: var(--text); }
html body.hat7 .hh-ob-head span,
html body.hat7 .hh-gx-flow i,
html body.hat7 .hh-gx-c b { color: var(--primary-dark); }
html body.hat7 .hh-ob-bar,
html body.hat7 .hh-gx-flow span,
html body.hat7 .hh-gx-dl { background: var(--primary-tint); }
html body.hat7 .hh-ob-bar i,
html body.hat7 .hh-gx-road span { background: var(--primary); }
html body.hat7 .hh-ob-steps li.ok .dot { background: var(--success); border-color: var(--success); }
html body.hat7 .hh-ob-steps small,
html body.hat7 .hh-gx-tip { color: var(--text-secondary); }
html body.hat7 .hh-gx-t th { background: var(--primary-dark); }

/* ---------- 3. Balance trial (0.2.8) — white / petrol / cream ----------
   Icons and large headings in the calm petrol (#537B7B); secondary sections
   and menus in sage (#E5ECE8); cards and the buy box white. Colour only. */
html body.hat7 .h7-header .h7-act:not(.h7-act--cart) .h7-ico,
html body.hat7 .h7-header .h7-hdr__sell .h7-ico,
html body.hat7 .hh-hero .hh-eyebrow .hh-ico,
html body.hat7 ul.hh-hero-trust li .hh-ico,
html body.hat7 .hh-art-chip .hh-ico,
html body.hat7 .hh-more .hh-fwd,
html body.hat7 .hh-cat-go,
html body.hat7 .hh-why-ico,
html body.hat7 .hh-hazem .hh-eyebrow .hh-ico { color: var(--primary); }
html body.hat7 .hh-cat-skate .hh-cat-ico,
html body.hat7 .hh-cat-sport .hh-cat-ico,
html body.hat7 .hh-cat-grid .hh-cat-ico { color: var(--primary); }
html body.hat7 .h7-header .h7-act:hover .h7-ico { color: var(--primary-dark); }

/* Large headings (≥ 24px → 3:1 is enough; #537B7B is 4.3:1 on cream, 4.7:1 on white). */
html body.hat7 .hh-sec-head h2,
html body.hat7 .hh-hazem h2,
html body.hat7.hh-ui h1.page-title,
html body.hat7.hh-ui .woocommerce-products-header__title,
html body.hat7.hh-ui .entry-header h1.entry-title { color: var(--primary); }

/* Secondary sections and menus in sage. */
html body.hat7 .hh-why-sec { background: var(--primary-soft); }
html body.hat7.hh-ui .woocommerce-MyAccount-navigation { background: var(--primary-soft); border-radius: var(--radius-md, 12px); }
html body.hat7.hh-ui .woocommerce-MyAccount-navigation ul li.is-active a { background: var(--primary-dark); color: #fff !important; }

/* Buy box in a soft, eye-friendly mauve so it stands out from the page (0.3.6). */
html body.hat7 .h7-bb {
	--bb-bg: #EDE3EC;
	--bb-line: #D3BFD0;
	--bb-muted: #4B5755;
	--bb-star: #7A5C26;
	box-shadow: 0 2px 10px rgba(91, 58, 85, .10);
	font-size: 1rem;
}
html body.hat7.single-product .h7-bb__stock { color: #256149; font-size: 1.15rem; font-weight: 800; }
html body.hat7.single-product .h7-bb__stock--out { color: #9F360B; }
html body.hat7.single-product .h7-bb__better { background: #fff; border: 1px solid #D3BFD0; }
html body.hat7.single-product .h7-bb__table tr td,
html body.hat7.single-product .h7-bb__table tr th { background: transparent !important; padding: 5px 0; }
html body.hat7.single-product .h7-bb__table th { color: var(--text); font-weight: 700; font-size: 1rem; }
html body.hat7.single-product .h7-bb__table td,
html body.hat7.single-product .h7-bb__table td a { font-weight: 700; font-size: 1rem; }
html body.hat7.single-product .h7-bb__save th,
html body.hat7.single-product .h7-bb__save td strong { color: #256149; font-size: 1.08rem; font-weight: 800; }

/* Cart / checkout: make the "you save" line visible. */
html body.hat7.hh-ui .wc-block-components-sale-badge,
html body.hat7.hh-ui .wc-block-components-product-badge.wc-block-components-sale-badge {
	color: #256149 !important;
	background: #E4F1EA !important;
	border: 1px solid #B9D8C7 !important;
	font-size: 13px !important;
	font-weight: 800 !important;
	padding: 3px 8px !important;
	border-radius: 8px !important;
	text-transform: none !important;
}

/* Contrast fixes found in the trial scan (colour only). */
html body.hat7.hh-ui #wcfm_menu .wcfm_menu_logo,
html body.hat7.hh-ui #wcfm_menu .wcfm_menu_logo h4,
html body.hat7.hh-ui #wcfm_menu .wcfm_menu_logo a { color: var(--primary-dark) !important; }
html body.hat7 .hh-why-sec .hh-sec-head p { color: var(--text); }
html body.hat7 .h7-bb__new,
html body.hat7 .h7hub-pill--ok { color: var(--text); }

/* ---------- 4. Checkout — payment options (visual only, 0.3.0) ----------
   The intro line is static text under the heading (not a gateway); each
   gateway is drawn as its own white card; the chosen one gets a petrol frame.
   Gateways, titles and settings are untouched. */
html body.hat7 .wc-block-checkout__payment-method .wc-block-components-checkout-step__heading-container::after {
	content: "هات حاجتك وحوّلها بسهولة";
	display: block;
	margin-top: 4px;
	font-size: var(--fs-sm, 14px);
	color: var(--text-secondary);
}
html[lang^="en"] body.hat7 .wc-block-checkout__payment-method .wc-block-components-checkout-step__heading-container::after { content: "Get what you need, and pay with ease"; }
html body.hat7 .wc-block-checkout__payment-method .wc-block-components-radio-control { border: 0 !important; box-shadow: none !important; }
html body.hat7 .wc-block-checkout__payment-method .wc-block-components-radio-control::after,
html body.hat7 .wc-block-checkout__payment-method .wc-block-components-radio-control-accordion-option::after,
html body.hat7 .wc-block-checkout__payment-method .wc-block-components-radio-control-accordion-option::before { content: none !important; display: none !important; }
html body.hat7 .wc-block-checkout__payment-method .wc-block-components-radio-control-accordion-option {
	background: #fff !important;
	border: 1px solid var(--border) !important;
	border-radius: 12px !important;
	margin: 0 0 10px !important;
	box-shadow: none !important;
	transition: border-color var(--dur, .15s) var(--ease, ease), background-color var(--dur, .15s) var(--ease, ease) !important;
}
html body.hat7 .wc-block-checkout__payment-method .wc-block-components-radio-control-accordion-option:hover { border-color: var(--primary) !important; }
html body.hat7 .wc-block-checkout__payment-method .wc-block-components-radio-control-accordion-option--checked-option-highlighted,
html body.hat7 .wc-block-checkout__payment-method .wc-block-components-radio-control-accordion-option:has(input:checked) {
	border-color: var(--primary-dark) !important;
	box-shadow: 0 0 0 1px var(--primary-dark) !important;
	background: var(--primary-tint) !important;
}
html body.hat7 .wc-block-checkout__payment-method .wc-block-components-radio-control__input { border-color: var(--border-strong) !important; }
html body.hat7 .wc-block-checkout__payment-method .wc-block-components-radio-control__input:checked { border-color: var(--primary-dark) !important; }
html body.hat7 .wc-block-checkout__payment-method .wc-block-components-radio-control__input:checked::before { background: var(--primary-dark) !important; }
html body.hat7 .wc-block-checkout__payment-method .wc-block-components-radio-control__label { color: var(--text); font-weight: 600; }
html body.hat7 .wc-block-checkout__payment-method .wc-block-components-radio-control-accordion-content { color: var(--text-secondary); }

/* ---------- 5. Brand logo (0.3.2) ----------
   The wide logo already carries the name, so the repeated text next to it
   (hero card, footer) is hidden visually — the markup stays. */
html body.hat7 .hh-art-main > b,
html body.hat7 .hh-art-main > small,
html body.hat7 .hh-logo-foot .hh-logo-txt { display: none !important; }
html body.hat7 .hh-art-main .hh-art-logo { width: 86% !important; height: auto !important; max-width: 210px !important; }
html body.hat7 .hh-logo-foot .hh-logo-img { width: auto !important; height: 60px !important; max-width: 100% !important; object-fit: contain !important; padding: 6px 10px !important; border-radius: 12px !important; }

/* ---------- 6. Payment groups (0.3.3) ----------
   Label above the electronic options; cash on delivery set apart below. */
html body.hat7 .wc-block-checkout__payment-method .wc-block-components-radio-control::before {
	content: "الدفع الإلكتروني";
	display: block;
	margin: 4px 4px 8px;
	font-weight: 700;
	font-size: var(--fs-sm, 14px);
	color: var(--primary-dark);
}
html[lang^="en"] body.hat7 .wc-block-checkout__payment-method .wc-block-components-radio-control::before { content: "Online payment"; }
html body.hat7 .wc-block-checkout__payment-method .wc-block-components-radio-control-accordion-option:has(input[value="cod"]) { margin-top: 18px !important; }

/* ---------- 7. Transfer-proof box (snippet #11, inline styles) in the new palette (0.3.6) ---------- */
html body.hat7 #hh-proof { border: 2px dashed var(--primary) !important; background: var(--primary-tint) !important; }
html body.hat7 #hh-proof h3 { color: var(--primary-dark) !important; }
html body.hat7 #hh-proof .button,
html body.hat7 #hh-proof button[type="submit"] { background: var(--primary-dark) !important; color: #fff !important; }
html body.hat7 #hh-proof .button:hover,
html body.hat7 #hh-proof button[type="submit"]:hover { background: var(--primary-deep) !important; }
html body.hat7 #hh-proof textarea { border-color: var(--border-strong) !important; background: #fff !important; }
