/*
Theme Name: Jaky Bazar
Theme URI: https://bazar.myjaky.com
Author: My Jaky
Description: Storefront for Jaky Bazar — Amazon-style on desktop, app-style on phones, Arabic / English / Urdu with right-to-left support.
Version: 0.1.1
Requires at least: 6.4
Requires PHP: 8.1
Text Domain: jaky-bazar
WC requires at least: 8.0
*/

:root {
  --ink: #131C35;
  --navy: #1B2A4A;
  --navy2: #22345C;
  --sun: #FF8A00;
  --ember: #F05A00;
  --amber: #FFB347;
  --bg: #F2F4F8;
  --card: #FFFFFF;
  --line: #E1E6EF;
  --text: #131C35;
  --slate: #5B6B88;
  --price: #E4560A;
  --good: #13834F;
  --bad: #C0362C;
  --r: 12px;
  --f-head: "Poppins", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --tabbar: 0px;
}
html[lang^="ar"] { --f-head: "IBM Plex Sans Arabic", system-ui, sans-serif; --f-body: "IBM Plex Sans Arabic", system-ui, sans-serif; }
html[lang^="ur"] { --f-head: "Noto Nastaliq Urdu", "IBM Plex Sans Arabic", serif; --f-body: "Noto Nastaliq Urdu", "IBM Plex Sans Arabic", serif; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 15px/1.55 var(--f-body); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; padding-bottom: var(--tabbar); }
html[lang^="ur"] body { line-height: 2.05; }
h1, h2, h3, h4 { font-family: var(--f-head); line-height: 1.25; margin: 0 0 .5em; }
html[lang^="ur"] :is(h1, h2, h3, h4) { line-height: 1.9; }
a { color: inherit; }
img { max-width: 100%; height: auto; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 4px; }
.sr, .screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: 8px; top: -60px; background: var(--sun); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { top: 8px; }
.wrap { width: min(1440px, 100% - 32px); margin-inline: auto; }
.ico { flex: none; }

/* ---------------- buttons ---------------- */
.btn, .button, button.button, input.button, .woocommerce a.button, .woocommerce button.button, .woocommerce input.button, .wc-block-components-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px;
  border: 0; border-radius: 999px; background: var(--navy); color: #fff; font: 600 15px/1 var(--f-head);
  text-decoration: none; cursor: pointer; transition: background-color .15s ease, transform .1s ease;
}
html[lang^="ur"] :is(.btn, .button) { line-height: 1.8; }
.btn:active, .button:active { transform: translateY(1px); }
.btn-sun, .woocommerce .button.alt, .woocommerce button.button.alt, .woocommerce a.button.alt, .single_add_to_cart_button, .checkout-button, #place_order {
  background: linear-gradient(180deg, var(--sun), var(--ember)) !important; color: #fff !important;
  box-shadow: 0 8px 18px -10px rgba(240, 90, 0, .9);
}
.button:hover, .btn:hover { background: var(--navy2); }
.btn-sun:hover, .single_add_to_cart_button:hover, #place_order:hover { background: var(--ember) !important; }
.button:disabled, .button.disabled { opacity: .5; cursor: not-allowed; }

/* ---------------- header ---------------- */
.hdr { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 40; }
.hdr-top { display: flex; align-items: center; gap: 18px; min-height: 68px; }
.logo { display: flex; align-items: center; flex: none; }
.logo img { height: 40px; width: auto; display: block; }
.deliver, .hbtn { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; padding: 6px 8px; border-radius: 8px; border: 1px solid transparent; flex: none; }
.deliver:hover, .hbtn:hover { border-color: rgba(255, 255, 255, .5); }
.deliver small, .hbtn small { display: block; font-size: 12px; color: #B7C2D8; line-height: 1.2; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deliver b, .hbtn b { display: block; font: 600 14px/1.3 var(--f-head); }
.search { flex: 1; display: flex; min-width: 0; height: 44px; border-radius: 10px; overflow: hidden; background: #fff; box-shadow: 0 0 0 0 var(--sun); transition: box-shadow .15s; }
.search:focus-within { box-shadow: 0 0 0 3px var(--sun); }
.search input { flex: 1; min-width: 0; border: 0; padding: 0 16px; font: 400 15px var(--f-body); color: var(--text); background: transparent; outline: none; }
.search button { width: 56px; border: 0; background: var(--sun); color: #fff; cursor: pointer; display: grid; place-items: center; }
.search button:hover { background: var(--ember); }
.langs { display: flex; gap: 2px; background: rgba(255, 255, 255, .08); border-radius: 8px; padding: 3px; flex: none; }
.langs a { color: #C9D2E3; text-decoration: none; font-size: 13px; padding: 4px 9px; border-radius: 6px; line-height: 1.6; }
.langs a[aria-current] { background: #fff; color: var(--ink); font-weight: 600; }
.cartbtn { gap: 6px; }
.cart-ico { position: relative; display: inline-flex; }
.jbt-count { position: absolute; top: -8px; inset-inline-end: -10px; min-width: 20px; height: 20px; border-radius: 999px; background: var(--sun); color: #fff; font: 700 12px/20px var(--f-head); text-align: center; padding: 0 5px; }
.jbt-count.is-empty { display: none; }

.hdr-nav { background: var(--navy); }
.hdr-nav-in { display: flex; align-items: center; gap: 4px; overflow-x: auto; scrollbar-width: none; min-height: 42px; }
.hdr-nav-in::-webkit-scrollbar { display: none; }
.hdr-nav a, .hdr-nav .menu a { color: #E5EAF3; text-decoration: none; font-size: 14px; padding: 6px 10px; border-radius: 6px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; }
.hdr-nav a:hover { border-color: rgba(255, 255, 255, .45); }
.hdr-nav .allcats { font-weight: 600; color: #fff; }
.hdr-nav .deal-link { color: var(--amber); font-weight: 600; }
.hdr-nav .menu { display: contents; list-style: none; margin: 0; padding: 0; }
.hdr-nav .menu li { display: contents; }

/* ---------------- home ---------------- */
.home { padding: 18px 0 32px; display: grid; gap: 18px; }
.hero { position: relative; overflow: hidden; border-radius: 16px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 24px;
  padding: 30px 40px; min-height: 190px; color: #fff;
  background: radial-gradient(600px 260px at 85% 20%, rgba(255, 179, 71, .45), transparent 60%), linear-gradient(115deg, var(--navy) 0%, #2C437A 55%, var(--ember) 140%); }
.hero h1 { font-size: clamp(24px, 3vw, 36px); font-weight: 700; margin-bottom: 8px; }
.hero p { margin: 0 0 18px; color: #DCE3F0; font-size: 16px; }
.hero-art img { width: 170px; height: auto; filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .35)); transform: rotate(-6deg); }
html[dir="rtl"] .hero-art img { transform: rotate(6deg); }
.hero-img { display: block; padding: 0; min-height: 0; background: none; }
.hero-img img { display: block; width: 100%; height: auto; border-radius: 16px; }

.cats { background: var(--card); border-radius: 16px; padding: 16px 12px; }
.cat-row { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 96px; gap: 6px; overflow-x: auto; scrollbar-width: thin; }
.cat-row a { display: grid; justify-items: center; gap: 8px; text-decoration: none; padding: 6px 4px; border-radius: 12px; }
.cat-row a:hover { background: var(--bg); }
.cat-img { width: 72px; height: 72px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; color: var(--ember);
  background: linear-gradient(145deg, #FFF3E2, #FFE1BF); box-shadow: inset 0 0 0 1px rgba(240, 90, 0, .15); }
.cat-img img { width: 100%; height: 100%; object-fit: cover; }
.cat-name { font-size: 13px; text-align: center; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.shelf { background: var(--card); border-radius: 16px; padding: 16px 16px 6px; }
.shelf-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.shelf-head h2 { font-size: 20px; margin: 0; }
.see-all { margin-inline-start: auto; color: var(--ember); font-weight: 600; text-decoration: none; font-size: 14px; }
.timer { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.timer small { color: var(--slate); margin-inline-end: 4px; }
.timer b { background: var(--ink); color: #fff; border-radius: 6px; padding: 2px 6px; font: 700 14px/1.4 var(--f-head); min-width: 30px; text-align: center; }
.empty-store { background: var(--card); border-radius: 16px; padding: 40px 20px; text-align: center; color: var(--slate); }

/* ---------------- product grid (all WooCommerce lists) ---------------- */
.woocommerce ul.products, ul.products { list-style: none; margin: 0 0 16px; padding: 0; display: grid !important; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); }
.woocommerce ul.products::before, .woocommerce ul.products::after { display: none !important; }
.shelf ul.products { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: minmax(170px, 1fr); overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x proximity; }
.shelf ul.products li.product { scroll-snap-align: start; }
.woocommerce ul.products li.product, ul.products li.product {
  width: auto !important; margin: 0 !important; float: none !important; position: relative; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; transition: box-shadow .15s, border-color .15s; }
ul.products li.product:hover { border-color: #C9D2E3; box-shadow: 0 10px 24px -16px rgba(19, 28, 53, .45); }
ul.products li.product a img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; margin: 0 0 10px !important; background: var(--bg); }
ul.products li.product .woocommerce-loop-product__link { text-decoration: none; display: flex; flex-direction: column; flex: 1; }
ul.products li.product .woocommerce-loop-product__title { font: 500 14px/1.4 var(--f-body) !important; padding: 0 !important; margin: 0 0 6px !important;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.8em; }
html[lang^="ur"] ul.products li.product .woocommerce-loop-product__title { line-height: 2; min-height: 4em; }
ul.products li.product .price { color: var(--price) !important; font: 700 17px/1.3 var(--f-head) !important; margin: auto 0 8px !important; display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; }
ul.products li.product .price del { color: var(--slate); font-weight: 400; font-size: 13px; opacity: 1; }
ul.products li.product .price ins { text-decoration: none; }
ul.products li.product .star-rating { font-size: 12px; margin: 0 0 6px !important; }
ul.products li.product .button { width: 100%; min-height: 38px; font-size: 14px; margin-top: 0 !important; background: #FFF1E0; color: var(--ember); }
ul.products li.product .button:hover { background: var(--sun); color: #fff; }
ul.products li.product .added_to_cart { display: block; text-align: center; font-size: 13px; padding-top: 6px; color: var(--good); font-weight: 600; text-decoration: none; }
.woocommerce span.onsale, span.onsale { position: absolute; top: 16px; inset-inline-start: 16px; inset-inline-end: auto; z-index: 2; min-width: 0; min-height: 0;
  margin: 0 !important; padding: 3px 8px; border-radius: 6px; background: var(--bad); color: #fff; font: 700 12px/1.4 var(--f-head); }

/* ---------------- shop page ---------------- */
.wc-wrap, .page-wrap { padding: 20px 0 40px; }
.woocommerce-breadcrumb { font-size: 13px; color: var(--slate); margin-bottom: 10px !important; }
.woocommerce-breadcrumb a { color: var(--slate); }
.woocommerce-products-header__title { font-size: 24px; }
.woocommerce-result-count { color: var(--slate); font-size: 14px; margin: 6px 0 12px !important; }
.woocommerce-ordering { margin: 0 0 12px !important; }
select, input[type=text], input[type=email], input[type=tel], input[type=number], input[type=password], input[type=search], textarea,
.woocommerce form .form-row .input-text, .woocommerce form .form-row select, .select2-container .select2-selection--single {
  font: 400 15px/1.4 var(--f-body); color: var(--text); background: #fff; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; width: 100%; }
.select2-container .select2-selection--single { padding: 6px 8px; }
.select2-container--default .select2-selection--single .select2-selection__arrow { top: 8px; }
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--sun) !important; box-shadow: 0 0 0 3px rgba(255, 138, 0, .2); }
.woocommerce-ordering select { width: auto; }
.woocommerce nav.woocommerce-pagination ul { border: 0 !important; display: flex; gap: 6px; justify-content: center; }
.woocommerce nav.woocommerce-pagination ul li { border: 0 !important; }
.woocommerce nav.woocommerce-pagination ul li a, .woocommerce nav.woocommerce-pagination ul li span { min-width: 38px; height: 38px; display: grid !important; place-items: center; border-radius: 8px; background: #fff; border: 1px solid var(--line); }
.woocommerce nav.woocommerce-pagination ul li span.current { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------------- single product ---------------- */
.single-product div.product { background: var(--card); border-radius: 16px; padding: 22px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; position: relative; }
.single-product div.product .woocommerce-product-gallery, .single-product div.product .summary { width: auto !important; float: none !important; margin: 0 !important; }
.single-product div.product .woocommerce-tabs, .single-product div.product .related, .single-product div.product .upsells { grid-column: 1 / -1; }
.woocommerce-product-gallery__image img { border-radius: 12px; }
.flex-control-thumbs { display: flex !important; gap: 8px; margin-top: 10px !important; }
.flex-control-thumbs li { width: 70px !important; }
.flex-control-thumbs img { border-radius: 8px; opacity: .6; }
.flex-control-thumbs img.flex-active { opacity: 1; outline: 2px solid var(--sun); }
.product_title { font-size: 24px; font-weight: 600; }
.summary .price { color: var(--price) !important; font: 700 28px/1.2 var(--f-head) !important; margin: 10px 0 !important; display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.summary .price del { color: var(--slate); font-size: 17px; font-weight: 400; }
.summary .price ins { text-decoration: none; }
.woocommerce-product-details__short-description { color: #3B4865; }
.summary form.cart { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 18px 0 !important; padding: 14px; background: var(--bg); border-radius: 12px; }
.summary form.cart .quantity input { width: 80px; text-align: center; }
.summary .single_add_to_cart_button { flex: 1; min-height: 50px; font-size: 16px; }
.summary .stock { font-weight: 600; }
.summary .stock.in-stock { color: var(--good); }
.summary .stock.out-of-stock { color: var(--bad); }
.product_meta { font-size: 13px; color: var(--slate); display: grid; gap: 4px; }
.jbt-perks { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 8px; }
.jbt-perks li { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.jbt-perks .ico { color: var(--ember); flex: none; }
.jbt-perks b { display: block; font-weight: 600; }
.jbt-perks small { color: var(--slate); font-size: 12.5px; }
.woocommerce-tabs ul.tabs { padding: 0 !important; margin: 0 0 14px !important; display: flex; gap: 6px; border-bottom: 1.5px solid var(--line); }
.woocommerce-tabs ul.tabs::before { display: none !important; }
.woocommerce-tabs ul.tabs li { background: none !important; border: 0 !important; margin: 0 !important; padding: 0 !important; border-radius: 0 !important; }
.woocommerce-tabs ul.tabs li::before, .woocommerce-tabs ul.tabs li::after { display: none !important; }
.woocommerce-tabs ul.tabs li a { padding: 10px 14px !important; font-weight: 600 !important; color: var(--slate) !important; display: block; border-bottom: 2.5px solid transparent; margin-bottom: -1.5px; }
.woocommerce-tabs ul.tabs li.active a { color: var(--ink) !important; border-color: var(--sun); }
.related > h2, .upsells > h2 { font-size: 20px; margin-top: 10px; }

/* ---------------- cart, checkout, account ---------------- */
.woocommerce-cart .wc-wrap, .woocommerce-checkout .wc-wrap, .woocommerce-account .wc-wrap { max-width: 1180px; }
.entry { background: var(--card); border-radius: 16px; padding: 24px; }
.entry-title { font-size: 24px; }
table.shop_table { background: var(--card); border: 1px solid var(--line) !important; border-radius: 14px !important; border-collapse: separate !important; overflow: hidden; }
table.shop_table th { font-weight: 600; color: var(--slate); }
table.shop_table td, table.shop_table th { border-color: var(--line) !important; padding: 12px !important; }
.woocommerce-cart-form .product-thumbnail img { width: 72px !important; border-radius: 10px; }
.woocommerce-cart-form a.remove { color: var(--bad) !important; font-size: 22px; width: 32px; height: 32px; line-height: 30px; border-radius: 50%; }
.woocommerce-cart-form a.remove:hover { background: var(--bad) !important; color: #fff !important; }
.cart-collaterals .cart_totals { background: var(--card); border-radius: 14px; padding: 18px; border: 1px solid var(--line); }
.cart-collaterals .cart_totals h2 { font-size: 18px; }
.order-total .amount { color: var(--price); font-size: 20px; }
.woocommerce-checkout #customer_details, .woocommerce-checkout #order_review { background: var(--card); border-radius: 14px; padding: 18px; }
.woocommerce-checkout #order_review_heading { margin-top: 18px; }
#payment { background: var(--bg) !important; border-radius: 12px !important; }
#place_order { width: 100%; min-height: 52px; font-size: 17px; }
.woocommerce-info, .woocommerce-message, .woocommerce-error, .woocommerce-notice {
  border: 0 !important; border-radius: 12px; padding: 14px 18px !important; background: #fff !important; box-shadow: inset 4px 0 0 var(--sun); list-style: none; }
html[dir="rtl"] :is(.woocommerce-info, .woocommerce-message, .woocommerce-error) { box-shadow: inset -4px 0 0 var(--sun); }
.woocommerce-message { box-shadow: inset 4px 0 0 var(--good); }
.woocommerce-error { box-shadow: inset 4px 0 0 var(--bad); }
.woocommerce-info::before, .woocommerce-message::before, .woocommerce-error::before { display: none !important; }
.woocommerce-MyAccount-navigation ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.woocommerce-MyAccount-navigation a { display: block; padding: 10px 14px; border-radius: 10px; text-decoration: none; background: var(--card); }
.woocommerce-MyAccount-navigation .is-active a { background: var(--ink); color: #fff; }
.woocommerce-MyAccount-content { background: var(--card); border-radius: 14px; padding: 18px; }

/* swipe-to-remove on phones */
.woocommerce-cart-form .cart_item { touch-action: pan-y; will-change: transform; }
.woocommerce-cart-form .cart_item.swipe-armed { background: #FDECEA !important; }

/* ---------------- trust strip + footer ---------------- */
.trust { background: var(--card); border-top: 1px solid var(--line); margin-top: 24px; }
.trust-in { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; padding: 22px 0; }
.trust-in div { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; }
.trust-in .ico { grid-row: span 2; color: var(--ember); }
.trust-in b { font: 600 15px/1.3 var(--f-head); }
.trust-in small { color: var(--slate); font-size: 13px; }
.ftr { background: var(--ink); color: #9AA8C4; padding: 26px 0; font-size: 14px; }
.ftr-in { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between; }
.ftr-in img { height: 34px; width: auto; }
.ftr-menu { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 16px; }
.ftr a { color: #C9D2E3; text-decoration: none; }
.ftr a:hover { color: #fff; }
.ftr p { margin: 0; }
.wa-float { position: fixed; inset-inline-end: 18px; bottom: calc(18px + var(--tabbar)); width: 56px; height: 56px; border-radius: 50%; background: #1FA855; color: #fff; display: grid; place-items: center; box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .45); z-index: 45; }

/* ---------------- phone: app-style bottom bar ---------------- */
.tabbar { display: none; }
@media (max-width: 900px) {
  :root { --tabbar: calc(62px + env(safe-area-inset-bottom)); }
  .hdr-top { flex-wrap: wrap; gap: 8px 10px; padding: 8px 0 10px; min-height: 0; }
  .logo img { height: 32px; }
  .deliver { order: 5; width: 100%; padding: 2px 0; border: 0; }
  .deliver span { display: flex; gap: 6px; align-items: baseline; }
  .deliver small { max-width: none; }
  .search { order: 4; flex-basis: 100%; height: 42px; }
  .hbtn.account, .hdr-nav .allcats { display: none; }
  .langs { margin-inline-start: auto; }
  .cartbtn { padding: 4px; }
  .cartbtn b { display: none; }
  .hdr-nav-in { min-height: 38px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset: auto 0 0 0; z-index: 50; background: #fff;
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 24px -18px rgba(19, 28, 53, .5); }
  .tabbar a { display: grid; justify-items: center; gap: 2px; color: var(--slate); text-decoration: none; font-size: 11px; padding: 4px 0; }
  .tabbar a[aria-current] { color: var(--ember); }
  .tabbar .jbt-count { top: -6px; }
  .hero { grid-template-columns: 1fr; padding: 22px; min-height: 0; }
  .hero-art { display: none; }
  .home { gap: 12px; padding-top: 12px; }
  .shelf, .cats { border-radius: 12px; padding: 12px; }
  .shelf ul.products { grid-auto-columns: 46%; }
  .woocommerce ul.products, ul.products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .single-product div.product { grid-template-columns: 1fr; padding: 14px; gap: 16px; }
  .summary form.cart { position: sticky; bottom: var(--tabbar); z-index: 30; margin: 12px -14px !important; border-radius: 0; box-shadow: 0 -8px 18px -14px rgba(0, 0, 0, .4); background: #fff; }
  .trust-in { grid-template-columns: 1fr 1fr; }
  .wrap { width: calc(100% - 20px); }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
