/* CODXPK Mobile Nav 1.2.0 — mobile only, max-width 1024px.
   Everything is scoped under .codxpk- so nothing leaks into the theme.
   No global resets, no body/html rules here. Open state lives on the
   drawer/overlay elements themselves (--open classes set by JS).
   1.1.0: bottom-nav labels wrap and shrink instead of truncating
   ("Categories" showed as "CATE…" at 320px in v1.0.0).
   1.2.0: defect 4 only — "CATEGORIES" still clipped to "CATEGORIE"
   at 320px/360px in v1.1.0. Root cause: the PHP label was already
   title-case "Categories", but WoodMart/theme CSS uppercases button
   text, so it rendered as wide "CATEGORIES", and v1.1.0 only shrank
   the button's inherited font-size, never the label's own size.
   Fix: force text-transform: none + letter-spacing: 0 on button and
   label (high-specificity override), give the label its own explicit
   font-size, and shrink much further (9px <=480px, 8px <=380px,
   7px <=340px) with a smaller icon and no icon/label gap. */

/* Hidden on desktop by default. */
.codxpk-bottomnav,
.codxpk-drawer,
.codxpk-drawer-overlay {
	display: none;
}

@media (max-width: 1024px) {
	/* Hide WoodMart's own sticky bottom toolbar on mobile only.
	   Deactivating this plugin restores it. */
	.woodmart-toolbar,
	.wd-toolbar,
	.wd-sticky-toolbar {
		display: none;
	}

	/* ---- Sticky bottom nav ---- */
	.codxpk-bottomnav {
		display: flex;
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 9998;
		min-height: 60px;
		background: #ffffff;
		border-top: 1px solid #e5e5e5;
		box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
	}

	.codxpk-bottomnav__btn {
		flex: 1 1 0;
		width: 0;
		min-width: 0;
		min-height: 60px;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 2px;
		padding: 6px 0;
		box-sizing: border-box;
		overflow: visible;
		background: none;
		border: 0;
		color: #232323;
		font-family: inherit;
		font-size: 11px;
		line-height: 1.2;
		letter-spacing: 0;
		text-transform: none;
		text-decoration: none;
		cursor: pointer;
		position: relative;
		touch-action: manipulation;
	}

	.codxpk-bottomnav__btn:active,
	.codxpk-bottomnav__btn:focus-visible {
		color: #c9a227;
		outline: 2px solid #c9a227;
		outline-offset: -2px;
	}

	.codxpk-bottomnav__icon {
		width: 22px;
		height: 22px;
		flex: 0 0 auto;
	}

	/* Labels must never truncate: 5 buttons at 320px = 64px each, and
	   "Categories" at the old 11px nowrap + ellipsis measured wider
	   than its button, so it rendered as "CATE…". Labels now wrap
	   (max 2 lines) and shrink on narrow screens, so all five labels
	   — Home, Categories, Search, Deals, Bag — show in full.
	   1.2.0: the label gets its OWN explicit font-size (v1.1.0 only
	   shrank the button's inherited size), title case is forced
	   (WoodMart uppercases button text, and uppercase "CATEGORIES"
	   is ~30% wider than "Categories"), letter-spacing is forced to
	   0, and long words may break rather than clip. */
	.codxpk-bottomnav__label {
		display: block;
		width: 100%;
		max-width: 100%;
		font-size: 11px;
		font-weight: 500;
		letter-spacing: 0;
		text-transform: none;
		white-space: normal;
		overflow: visible;
		overflow-wrap: break-word;
		word-break: break-word;
		text-overflow: clip;
		text-align: center;
		line-height: 1.1;
	}

	/* High-specificity override: WoodMart/theme rules that uppercase
	   button/link text must not reach this label. */
	.codxpk-bottomnav .codxpk-bottomnav__btn .codxpk-bottomnav__label {
		text-transform: none;
		letter-spacing: 0;
	}

	.codxpk-bottomnav__badge {
		position: absolute;
		top: 4px;
		right: calc(50% - 20px);
		min-width: 18px;
		height: 18px;
		padding: 0 4px;
		border-radius: 9px;
		background: #c9a227;
		color: #232323;
		font-size: 11px;
		font-weight: 700;
		line-height: 18px;
		text-align: center;
	}

	/* Keep page content clear of the fixed bottom bar. */
	.codxpk-bottomnav ~ .codxpk-drawer-overlay {
		bottom: 0;
	}

	/* ---- Drawer overlay ---- */
	.codxpk-drawer-overlay {
		display: block;
		position: fixed;
		inset: 0;
		z-index: 9998;
		background: rgba(0, 0, 0, 0.5);
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
		transition: opacity 0.25s ease, visibility 0.25s ease;
	}

	/* ---- Drawer ---- */
	.codxpk-drawer {
		display: block;
		position: fixed;
		top: 0;
		left: 0;
		z-index: 9999;
		width: min(360px, 88vw);
		height: 100vh;
		height: 100dvh;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		background: #ffffff;
		color: #232323;
		transform: translateX(-102%);
		transition: transform 0.28s ease;
		box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
	}

	.codxpk-drawer__head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 16px 20px 8px;
	}

	.codxpk-drawer__logo {
		font-size: 20px;
		font-weight: 800;
		letter-spacing: 1px;
		color: #232323;
	}

	.codxpk-drawer__close {
		width: 44px;
		height: 44px;
		padding: 0;
		background: none;
		border: 0;
		color: #232323;
		font-size: 32px;
		line-height: 1;
		cursor: pointer;
		touch-action: manipulation;
	}

	.codxpk-drawer__search {
		padding: 8px 20px 12px;
	}

	.codxpk-drawer__search-label {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
	}

	.codxpk-drawer__search-input {
		width: 100%;
		min-height: 44px;
		padding: 10px 16px;
		border: 1px solid #e0e0e0;
		border-radius: 24px;
		background: #f0f0f0;
		color: #232323;
		font-size: 15px;
	}

	.codxpk-drawer__pills {
		display: flex;
		flex-wrap: wrap;
		gap: 8px;
		padding: 4px 20px 12px;
	}

	.codxpk-drawer__pill {
		display: inline-block;
		min-height: 36px;
		padding: 8px 14px;
		border: 1px solid #d9d9d9;
		border-radius: 20px;
		background: #ffffff;
		color: #232323;
		font-size: 14px;
		line-height: 1.2;
		text-decoration: none;
	}

	.codxpk-drawer__pill--dark {
		background: #232323;
		border-color: #232323;
		color: #ffffff;
	}

	.codxpk-drawer__section {
		padding: 8px 20px 12px;
		border-top: 1px solid #f0f0f0;
	}

	.codxpk-drawer__heading {
		margin: 12px 0;
		font-size: 13px;
		font-weight: 700;
		letter-spacing: 1px;
		color: #232323;
	}

	.codxpk-drawer__row {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		min-height: 52px;
		padding: 8px 0;
		border-bottom: 1px solid #f5f5f5;
		color: #232323;
		text-decoration: none;
	}

	.codxpk-drawer__row-text {
		display: flex;
		flex-direction: column;
		gap: 2px;
		min-width: 0;
	}

	.codxpk-drawer__row-title {
		font-size: 16px;
		font-weight: 600;
		line-height: 1.3;
	}

	.codxpk-drawer__row-sub {
		font-size: 13px;
		line-height: 1.3;
		color: #777777;
	}

	.codxpk-drawer__row-arrow {
		font-size: 24px;
		line-height: 1;
		color: #c9a227;
		flex: 0 0 auto;
	}

	.codxpk-drawer__products {
		display: grid;
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 8px;
	}

	.codxpk-drawer__product {
		display: flex;
		align-items: center;
		justify-content: center;
		min-height: 44px;
		padding: 8px 6px;
		border: 1px solid #e0e0e0;
		border-radius: 8px;
		background: #ffffff;
		color: #232323;
		font-size: 13px;
		line-height: 1.25;
		text-align: center;
		text-decoration: none;
	}

	.codxpk-drawer__delivery {
		margin: 12px 20px;
		padding: 14px 16px;
		border-radius: 10px;
		background: #f7f1dd;
		color: #232323;
		font-size: 14px;
		line-height: 1.5;
	}

	.codxpk-drawer__delivery strong,
	.codxpk-drawer__delivery span {
		display: block;
	}

	.codxpk-drawer__actions {
		padding: 8px 20px 28px;
	}

	.codxpk-drawer__action {
		display: flex;
		align-items: center;
		justify-content: center;
		min-height: 48px;
		border: 1px solid #232323;
		border-radius: 8px;
		background: #ffffff;
		color: #232323;
		font-size: 16px;
		font-weight: 600;
		text-decoration: none;
	}

	/* ---- Open state (classes are on the drawer / overlay
	   themselves, set by JS; no body/html rules) ---- */
	.codxpk-drawer.codxpk-drawer--open {
		transform: translateX(0);
	}

	.codxpk-drawer-overlay.codxpk-drawer-overlay--open {
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
	}

	/* WoodMart's own mobile menu panel is hidden by JS (inline style,
	   restored on close) only while our drawer is open, so the two
	   panels never stack. No CSS for it here. */
}

/* Narrow screens (1.2.0, aggressive): shrink the bottom-nav type
   and icons so every label fits. 5 buttons at 320px = 64px each;
   title-case "Categories" at 9px is ~45px, at 8px ~40px and at 7px
   ~36px, so it fits on one line with room to spare, and may still
   wrap to 2 lines rather than clip. The label gets its own explicit
   size at every step — v1.1.0 only shrank the button's inherited
   size, which is why 10px/9px did not fit. Kept as top-level queries
   (not nested) so older CSS parsers read them too. The nav itself
   only displays at max-width 1024px (see above). */
@media (max-width: 480px) {
	.codxpk-bottomnav__btn {
		font-size: 9px;
		line-height: 1.1;
		padding: 6px 0;
		gap: 2px;
	}

	.codxpk-bottomnav__label {
		font-size: 9px;
		line-height: 1.1;
	}

	.codxpk-bottomnav__icon {
		width: 20px;
		height: 20px;
	}
}

@media (max-width: 380px) {
	.codxpk-bottomnav__btn {
		font-size: 8px;
		line-height: 1.1;
		padding: 5px 0;
		gap: 0;
	}

	.codxpk-bottomnav__label {
		font-size: 8px;
		line-height: 1.1;
		margin: 0;
	}

	.codxpk-bottomnav__icon {
		width: 18px;
		height: 18px;
		margin: 0;
	}
}

@media (max-width: 340px) {
	.codxpk-bottomnav__btn {
		font-size: 7px;
		line-height: 1.1;
		padding: 4px 0;
		gap: 0;
	}

	.codxpk-bottomnav__label {
		font-size: 7px;
		line-height: 1.1;
		margin: 0;
	}

	.codxpk-bottomnav__icon {
		width: 16px;
		height: 16px;
		margin: 0;
	}
}
