/*
 * PME phone shop (theme 2.17.21, owner 21 Nov 2026) — see inc/shop-mobile.php.
 * Every screen size since 2.17.25: title tags, sticky level bar, search chip, sort tabs, "Muat lagi", floating bottom menu
 * and search panel. Phones only (below 576 px): 2-column staggered grid, filter bottom sheet, small listing top.
 * Header search box hidden below 768 px (the bottom menu's Cari is the search there).
 * Colours: PME Blue for chrome, red only for price / buy, Cozy 18 px cards.
 */

/* Group stock line only on phone cards. */
.pme-stock--group { display: none; }
.pme-mtop[hidden] { display: none !important; }

/* ==== Every screen size (2.17.25, owner 21 Nov 2026: the phone shop pieces run storewide) ==== */
/* ---- Tags in front of the title (one colour per type); the cover pills step aside ---- */
ul.products li.product .pme-tb { display: inline; }
ul.products li.product:has(.pme-tb) .pme-cover > .pme-pill { display: none !important; }
.pme-tb .pme-pill {
	position: static !important; display: inline-block; vertical-align: 1px; margin: 0 4px 0 0; padding: 0 5px;
	border: 1px solid transparent; border-radius: 4px; font-size: 9.5px; line-height: 14px; font-weight: 700; letter-spacing: .03em; box-shadow: none;
	background: #0B3D91; color: #fff;
}
.pme-tb .pme-pill img.emoji { width: 9px !important; height: 9px !important; vertical-align: -1px; }
.pme-tb .pme-pill--collection { background: #0B3D91; color: #fff; }   /* 10.6:1 */
.pme-tb .pme-pill--hot { background: #F5A623; color: #1A1F2B; }       /* ~9:1 */
.pme-tb .pme-pill--set { background: #0F766E; color: #fff; }          /* 5.5:1 */
.pme-tb .pme-pill--volumes { background: #6D28D9; color: #fff; }      /* 7.1:1 */
.pme-tb .pme-pill--pack { background: #475569; color: #fff; }         /* 7.6:1 */
.pme-tb .pme-pill--sale { background: #fff; color: #C8102E; border-color: #C8102E; } /* 6.2:1 */

.pme-qchip {
	display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; max-width: 45%; min-height: 40px; padding: 0 12px;
	border-radius: 999px; background: #EEF3FC; color: var(--pme-blue) !important; font-size: 13px; font-weight: 600; text-decoration: none !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pme-qchip__x { font-size: 17px; line-height: 1; }
.pme-qchip[hidden] { display: none !important; }

/* Sticky bar: level chips + Tapis (shop-mobile.js moves them here so the bar lasts the whole list). */
.pme-mtop {
	display: block; position: sticky; top: 0; z-index: 30; margin: 6px -16px 0; padding: 8px 16px;
	background: rgba(247, 249, 254, .96); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); box-shadow: 0 6px 12px -10px rgba(11, 61, 145, .35);
}
body.admin-bar .pme-mtop { top: var(--wp-admin--admin-bar--height, 46px); }
.pme-mtop__row { display: flex; gap: 8px; align-items: center; }
.pme-mtop .pme-chiprow--levels { flex: 1 1 auto; min-width: 0; margin: 0 !important; padding: 0 !important; }
.pme-mtop .pme-chiprow__label { display: none !important; }
.pme-mtop .pme-chip2 { min-height: 40px !important; padding-top: 6px !important; padding-bottom: 6px !important; font-size: 13.5px !important; }
.pme-mtop .pme-ftoggle { flex: 0 0 auto; height: 44px; min-width: 44px; padding: 0 14px !important; margin: 0 0 0 auto !important; display: inline-flex; align-items: center; gap: 6px; border-radius: 999px !important; font-size: 14px !important; }
.pme-mtop .pme-ftoggle::before {
	content: ""; width: 16px; height: 16px; background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M3 5h18l-7 8v6l-4 2v-8z'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M3 5h18l-7 8v6l-4 2v-8z'/%3E%3C/svg%3E") center / contain no-repeat;
}
body.pme-mtop-on .pme-resultbar { display: none !important; }

/* ---- Sort tabs replace the sort menu ---- */
.pme-listing .kadence-shop-top-row .woocommerce-ordering, .pme-listing .kadence-shop-top-row .kadence-product-toggle-container { display: none !important; }
.pme-sorttabs { display: flex; align-items: stretch; margin: 8px -16px 10px; padding: 0 16px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid #E3E9F3; background: #fff; }
.pme-sorttabs::-webkit-scrollbar { display: none; }
.pme-sorttab { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 12px; font-size: 13.5px; font-weight: 600; color: var(--pme-ink) !important; text-decoration: none !important; border-bottom: 2px solid transparent; white-space: nowrap; }
.pme-sorttab.is-on { color: var(--pme-blue) !important; border-bottom-color: var(--pme-blue); }
.pme-sorttab__arrows { font-size: 11px; color: var(--pme-muted); }
.pme-sorttab.is-on .pme-sorttab__arrows { color: var(--pme-blue); }

/* ---- "Muat lagi" instead of page numbers (pme-filter.js; the page links stay in the HTML for Google) ---- */
body.pme-more-on .woocommerce-pagination, body.pme-more-on .pme-pagejump { display: none !important; }
.pme-more { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 16px 0 8px; }
.pme-more__btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none !important; min-height: 44px; padding: 0 28px; border-radius: 999px !important; border: 1.5px solid var(--pme-blue) !important; background: #fff !important; color: var(--pme-blue) !important; font-weight: 700; font-size: 14px; box-shadow: none !important; }
.pme-more__btn[disabled] { opacity: .6; }
.pme-more small { font-size: 12px; color: var(--pme-muted); }
/* 2.17.34 (owner preview 22 Nov 2026): "48 daripada 368 buku", a thin progress bar, then the outline button; no auto-load. */
.pme-more { gap: 8px; margin: 20px 0 12px; }
.pme-more small { font-size: 13px; color: var(--pme-ink); }
.pme-more__bar { display: block; width: 180px; max-width: 60%; height: 4px; border-radius: 999px; background: #E3E8F0; overflow: hidden; margin: 0 0 6px; }
.pme-more__bar i { display: block; height: 100%; border-radius: inherit; background: var(--pme-blue, #0B3D91); }
.pme-more .pme-more__btn { min-width: 220px; min-height: 48px; }

/* ---- Loading placeholders (2.17.34): grey shimmer cards in the card's shape while the next books load ---- */
ul.products > li.pme-skel { list-style: none; display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 10px; background: #fff; border-radius: var(--pmc-r, 18px); box-sizing: border-box; pointer-events: none; }
.pme-skel__cover, .pme-skel__line, .pme-skel__price {
	display: block; background: linear-gradient(90deg, #EDF0F5 25%, #F7F8FB 45%, #EDF0F5 65%); background-size: 300% 100%; animation: pmeskel 1.3s ease-in-out infinite;
}
.pme-skel__cover { aspect-ratio: 3 / 4; border-radius: 12px; margin-bottom: 4px; }
.pme-skel__line { height: 11px; border-radius: 6px; }
.pme-skel__line--short { width: 62%; }
.pme-skel__price { height: 13px; width: 40%; border-radius: 6px; margin-top: 4px; }
/* Staggered columns like the marketplace apps (2.17.23 phones; every width and every product grid since 2.17.45): each card
   is as tall as its own content and the next card sits right under it. shop-mobile.js (listings) / storewide.js 1c (other
   grids) / storewide.js 2 (home feed) give each card grid-row-end: span N on a 4 px row grid (page order kept). Outside any
   media query and in this file (loaded with the store skin on or off) so the spans never land on a normal grid. */
ul.products.pme-masonry { grid-auto-rows: 4px; row-gap: 0 !important; align-items: start; }
ul.products.pme-masonry > li { align-self: start; }
/* A single row of cards (a sideways rail, or no more cards than columns; 2.17.46, owner 28 Nov 2026 option A): every card as
   tall as the tallest, name / price / stock kept together at the bottom, the photo area takes the spare height with the
   product centred in it (no blank gap under a short name). shop-mobile.js 3 (listings) / storewide.js 1c (other grids). */
ul.products.pme-onerow { align-items: stretch !important; }
ul.products.pme-onerow > li.product { display: flex !important; flex-direction: column !important; align-self: stretch !important; }
ul.products.pme-onerow > li.product > a.woocommerce-loop-image-link { flex: 1 1 auto; display: flex !important; flex-direction: column; justify-content: center; }
ul.products.pme-onerow > li.product > a.woocommerce-loop-image-link > .pme-cover { width: 100%; }
ul.products.pme-onerow > li.product > .product-details { flex: 0 0 auto; }
/* Phones: the cover tile is flush with the card top elsewhere; centred here, so round all its corners. */
@media (max-width: 575px) {
	ul.products.pme-onerow > li.product .pme-cover { border-radius: 14px !important; }
}
/* Staggered columns stopped mid-load (row limit reached): drop the masonry span pme-filter.js set. */
ul.products:not(.pme-masonry) > li.pme-skel { grid-row-end: auto !important; }
@keyframes pmeskel { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .pme-skel__cover, .pme-skel__line, .pme-skel__price { animation: none; } }

/* ---- Bottom menu: floating icon-only pill (2.17.25, owner 21 Nov 2026: parents know the app icons; labels stay for screen readers) ---- */
.pme-bnav {
	display: flex; justify-content: space-around; align-items: center; position: fixed; z-index: 9500;
	left: 16px; right: 16px; bottom: calc(12px + env(safe-area-inset-bottom)); height: 58px; padding: 0 6px; margin: 0 auto; max-width: 400px;
	border-radius: 999px; background: rgba(255, 255, 255, .88); -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4);
	box-shadow: 0 8px 28px -8px rgba(15, 30, 70, .35), 0 0 0 1px rgba(15, 30, 70, .06);
}
.pme-bnav__item {
	position: relative; flex: 0 0 48px; display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; padding: 0 !important;
	background: none !important; border: 0 !important; box-shadow: none !important; border-radius: 50% !important;
	color: #5B6478 !important; text-decoration: none !important; cursor: pointer;
}
.pme-bnav__item.is-on { background: #EEF1F6 !important; color: var(--pme-blue, #0B3D91) !important; }
.pme-bnav__item:hover { color: var(--pme-blue, #0B3D91) !important; }
.pme-bnav__item:focus-visible { outline: 2px solid var(--pme-blue); outline-offset: 0; }
.pme-bnav__label { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.pme-bnav__icon { position: relative; display: block; line-height: 0; }
.pme-bnav__icon .pme-ico { width: 24px; height: 24px; stroke-width: 1.9; }
.pme-bnav__item.is-on .pme-ico { stroke-width: 2.3; }
/* Same counter as the header cart (.pme-cart-count): undo its header placement, sit on the icon's corner. */
.pme-bnav .pme-bnav__count {
	position: absolute; z-index: 2; top: -8px; left: 13px; right: auto; bottom: auto; transform: none; box-sizing: border-box;
	min-width: 20px; height: 20px; padding: 0 5px; border: 2px solid #fff; border-radius: 999px;
	background: var(--pme-red, #C8102E); color: #fff; font-size: 11px; line-height: 16px; font-weight: 700; text-align: center;
}
.pme-bnav .pme-bnav__count[hidden] { display: none; }
body.pme-has-bnav { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
body.pme-has-bnav .pme-totop { bottom: calc(84px + env(safe-area-inset-bottom)); }
/* Book page on phones: the buy bar takes the menu's place once it shows (like the marketplace apps). */
body.pme-has-bnav.pme-buybar-on { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
body.pme-has-bnav.pme-buybar-on .pme-totop { bottom: calc(84px + env(safe-area-inset-bottom)); }

/* ---- Search panel ---- */
.pme-sheet { position: fixed; inset: 0; z-index: 10050; background: rgba(16, 24, 40, .45); }
.pme-sheet[hidden] { display: none; }
.pme-sheet__panel { background: #F7F9FE; padding: 12px 16px 16px; border-radius: 0 0 18px 18px; box-shadow: 0 10px 30px rgba(11, 61, 145, .2); max-width: 720px; margin: 0 auto; }
body.admin-bar .pme-sheet__panel { padding-top: calc(12px + var(--wp-admin--admin-bar--height, 46px)); }
.pme-sheet__head { display: flex; align-items: center; gap: 8px; }
.pme-sheet__close { flex: 0 0 auto; display: grid; place-items: center; width: 44px; height: 44px; padding: 0 !important; border: 0 !important; background: none !important; color: var(--pme-ink) !important; box-shadow: none !important; }
.pme-sheet__close .pme-ico { width: 24px; height: 24px; }
.pme-sheet form.pme-search { display: flex !important; flex: 1 1 auto; min-width: 0; margin: 0 !important; }
.pme-sheet .pme-search__results { max-height: calc(100vh - 160px); }
.pme-sheet__scope { display: flex; gap: 8px; margin: 10px 0 0 52px; overflow-x: auto; scrollbar-width: none; }
.pme-sheet__scope button {
	flex: 0 0 auto; white-space: nowrap; min-height: 36px; padding: 0 14px; border-radius: 999px !important; border: 1.5px solid #CBD5E6 !important;
	background: #fff !important; color: var(--pme-ink) !important; font-size: 13px !important; font-weight: 600; box-shadow: none !important;
}
.pme-sheet__scope button.is-on { border-color: var(--pme-blue) !important; color: var(--pme-blue) !important; background: #EEF3FC !important; }
body.pme-sheet-open { overflow: hidden; }

@media (max-width: 575px) {
	/* ---- Card grid (every product list since 2.17.25: listings, home feed, related rows): 2 columns, tap anywhere on the card ---- */
	ul.products { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px 8px !important; }
	ul.products li.product,
	ul.products li.product:hover { position: relative; padding: 0 !important; border-radius: var(--pmc-r, 18px) !important; }
	ul.products li.product .pme-cover { margin: 0; border-radius: var(--pmc-r, 18px) var(--pmc-r, 18px) 0 0; padding: 6px; }
	ul.products li.product .product-details {
		padding: 8px 10px 14px !important; gap: 0; align-content: start;   /* 14 px under the last line (owner, 21 Nov 2026); !important beats style.css's 0 2px !important */
		grid-template-areas: "title" "price" "pub" "stock" "rating" "pl" "btn" !important; grid-template-rows: none !important; grid-auto-rows: auto;
	}
	ul.products li.product .woocommerce-loop-product__title {
		font-size: 13.5px !important; line-height: 1.4 !important; font-weight: 600; margin: 0 0 4px !important; min-height: 0;
		display: -webkit-box !important; -webkit-line-clamp: 2 !important; -webkit-box-orient: vertical !important; overflow: hidden !important;
	}
	ul.products li.product .woocommerce-loop-product__title:has(.pme-tb) { -webkit-line-clamp: 3 !important; }
	ul.products li.product .woocommerce-loop-product__title a { display: inline !important; font-size: inherit !important; line-height: inherit !important; }
	ul.products li.product .woocommerce-loop-product__title a::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: var(--pmc-r, 18px); }
	ul.products li.product .price { font-size: 16px !important; font-weight: 700; margin: 0 0 4px !important; line-height: 1.25; }
	ul.products li.product .price .amount { white-space: nowrap; }
	ul.products li.product .pme-pub { font-size: 11px; letter-spacing: .02em; color: var(--pme-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
	ul.products li.product .pme-stock { font-size: 11.5px; margin: 2px 0 0; }
	ul.products li.product .pme-stock--group { display: block; }
	ul.products li.product .product-action-wrap,
	ul.products li.product > .button,
	ul.products li.product .pme-paylater { display: none !important; }
	ul.products li.product.outofstock .pme-cover img { opacity: .55; }

	/* ---- Top of a listing: small title, no breadcrumbs / note / search box (Cari in the bottom menu) ---- */
	.pme-listing .product-archive-hero-section .entry-hero-container-inner { padding: 0 !important; min-height: 0 !important; }
	.pme-listing .product-archive-hero-section .site-container { padding-top: 6px !important; padding-bottom: 0 !important; }
	.pme-listing .product-archive-hero-section .entry-header { background: none !important; box-shadow: none !important; padding: 0 !important; margin: 0 !important; min-height: 0 !important; }
	.pme-listing h1.archive-title { font-size: 20px !important; line-height: 1.25 !important; margin: 0 !important; }
	.pme-listing .pme-crumbs, .pme-listing .pme-collapsed-note { display: none !important; }
	.pme-listing.pme-has-bnav .pme-incat { display: none !important; }
	.pme-listing .woocommerce-products-header, .pme-listing .pme-cat { margin-top: 0 !important; padding-top: 0 !important; }



	/* ---- Tapis = bottom sheet; "Ada stok sahaja" as a switch at the top ---- */
	.pme-listing .pme-filters {
		top: auto !important; left: 0 !important; right: 0 !important; bottom: 0 !important; width: 100% !important; max-width: none !important;
		height: auto !important; max-height: 85vh !important; border-radius: 18px 18px 0 0 !important; padding: 8px 16px 0 !important; overflow-y: auto;
		transform: translateY(105%) !important; z-index: 10060 !important;
		visibility: hidden; transition: transform .25s ease, visibility 0s linear .25s !important;   /* closed: off screen and out of the Tab order */
	}
	body.pme-filters-open.pme-listing .pme-filters { transform: none !important; visibility: visible; transition: transform .25s ease, visibility 0s !important; }
	.pme-listing .pme-filters::before { content: ""; display: block; width: 40px; height: 4px; margin: 0 auto 8px; border-radius: 4px; background: #CBD5E6; }
	.pme-listing .pme-filters .pme-fdone { position: sticky; bottom: 0; width: calc(100% + 32px); margin: 8px -16px 0; min-height: 52px; border-radius: 0 !important; font-size: 15px !important; }
	.pme-listing .pme-filters__form { display: flex; flex-direction: column; }
	.pme-listing .pme-fgroup--stock { order: -1; padding: 0; border-top: 1px solid var(--pme-line); }
	.pme-listing .pme-fgroup--stock > summary { display: none; }
	.pme-listing .pme-fgroup--stock .pme-fopt { display: flex; align-items: center; gap: 10px; min-height: 52px; font-weight: 700; font-size: 14px; color: var(--pme-ink); }
	.pme-listing .pme-fgroup--stock .pme-fopt span { order: 1; flex: 1 1 auto; }
	.pme-listing .pme-fgroup--stock .pme-fopt em { order: 2; }
	.pme-listing .pme-fgroup--stock .pme-fopt input {
		order: 3; -webkit-appearance: none; appearance: none; flex: 0 0 auto; position: relative; width: 46px; height: 28px; margin: 0;
		border: 0; border-radius: 999px; background: #CBD5E6; cursor: pointer; transition: background .15s;
	}
	.pme-listing .pme-fgroup--stock .pme-fopt input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
	.pme-listing .pme-fgroup--stock .pme-fopt input:checked { background: var(--pme-blue); }
	.pme-listing .pme-fgroup--stock .pme-fopt input:checked::after { transform: translateX(18px); }
	.pme-listing .pme-fgroup--stock .pme-fopt input:focus-visible { outline: 2px solid var(--pme-blue); outline-offset: 2px; }

}

/* The buy bar replaces the menu on phones. Exception: 720–767 px single books show the side card and no buy bar
   (style.css 2.17.14), so the menu stays there. */
@media (max-width: 767px) {
	body.pme-buybar-on .pme-bnav { display: none; }
}
@media (min-width: 720px) and (max-width: 767px) {
	body.pme-has-side.pme-buybar-on .pme-bnav { display: flex; }
	body.pme-has-side.pme-buybar-on.pme-has-bnav { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
	body.pme-has-side.pme-buybar-on.pme-has-bnav .pme-totop { bottom: calc(84px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
	.pme-listing .pme-filters { transition: none !important; }
}
