/**
 * MK PWA app chrome — only applied when html has .mk-pwa-app-chrome
 * (standalone install or preview-force).
 */

/* —— Hide website mega chrome —— */
html.mk-pwa-app-chrome .mk-header-ticker,
html.mk-pwa-app-chrome .mk-header-top-bar,
html.mk-pwa-app-chrome .mk-header-main,
html.mk-pwa-app-chrome .ph-ticker,
html.mk-pwa-app-chrome .ph-top-bar,
html.mk-pwa-app-chrome .ph-header,
html.mk-pwa-app-chrome .mk-studio-footer-root,
html.mk-pwa-app-chrome .mk-studio-section--footer,
html.mk-pwa-app-chrome [data-mk-section="header_ticker"],
html.mk-pwa-app-chrome [data-mk-section="header_top_bar"],
html.mk-pwa-app-chrome [data-mk-section="header_main"],
html.mk-pwa-app-chrome [data-mk-section="footer"] {
	display: none !important;
}

/* Room for fixed top + bottom bars */
html.mk-pwa-app-chrome body {
	padding-top: calc(56px + env(safe-area-inset-top, 0px));
	padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px));
}

/* —— Top bar (Amazon-style always-on search) —— */
.mk-pwa-topbar {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 100050;
	height: calc(56px + env(safe-area-inset-top, 0px));
	padding: env(safe-area-inset-top, 0px) 10px 0;
	box-sizing: border-box;
	background: var(--mk-pwa-bar-bg, #000000);
	color: var(--mk-pwa-bar-fg, #ffffff);
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

html.mk-pwa-app-chrome .mk-pwa-topbar {
	display: flex;
	align-items: center;
	justify-content: center;
}

.mk-pwa-topbar__inner {
	display: flex;
	align-items: center;
	width: 100%;
	max-width: 720px;
	height: 56px;
	gap: 10px;
}

.mk-pwa-topbar__brand {
	display: flex;
	align-items: center;
	flex: 0 0 auto;
	color: inherit;
	text-decoration: none;
	font-weight: 700;
	font-size: 14px;
	min-width: 0;
	max-width: 28%;
}

.mk-pwa-topbar__brand img {
	display: block;
	height: 26px;
	width: auto;
	max-width: 88px;
	object-fit: contain;
}

.mk-pwa-topbar__title {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Persistent search pill (opens focus mode) */
.mk-pwa-topbar__search-field {
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
	height: 40px;
	padding: 0 14px;
	border: 0;
	border-radius: 999px;
	background: #ffffff;
	color: #555;
	font: inherit;
	font-size: 15px;
	text-align: left;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.mk-pwa-topbar__search-field:focus-visible {
	outline: 2px solid #ec1c24;
	outline-offset: 2px;
}

.mk-pwa-topbar__search-field-icon {
	flex: 0 0 auto;
	display: flex;
	color: #333;
}

.mk-pwa-topbar__search-field-icon svg {
	width: 18px;
	height: 18px;
	display: block;
	stroke: currentColor;
	fill: none;
	stroke-width: 2;
}

.mk-pwa-topbar__search-field-text {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: #666;
}

/* Hide collection toolbar search in app (top search replaces it) */
html.mk-pwa-app-chrome .mk-collection-toolbar__search,
html.mk-pwa-app-chrome .mk-collection-toolbar__search--bar {
	display: none !important;
}

/* —— Bottom tab bar (taller hit targets for iPhone thumbs) —— */
.mk-pwa-tabbar {
	display: none;
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: 100050;
	padding: 4px 6px env(safe-area-inset-bottom, 0px);
	box-sizing: border-box;
	background: var(--mk-pwa-bar-bg, #000000);
	color: var(--mk-pwa-bar-fg, #ffffff);
	border-top: 1px solid rgba(255, 255, 255, 0.12);
}

html.mk-pwa-app-chrome .mk-pwa-tabbar {
	display: block;
}

.mk-pwa-tabbar__nav {
	display: flex;
	align-items: stretch;
	justify-content: space-around;
	max-width: 640px;
	margin: 0 auto;
	min-height: 96px; /* was 56 — ~2× for easier taps */
}

.mk-pwa-tabbar__item {
	flex: 1 1 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 96px;
	min-width: 48px;
	padding: 10px 4px 12px;
	color: inherit;
	text-decoration: none;
	opacity: 0.72;
	border: 0;
	background: transparent;
	cursor: pointer;
	font: inherit;
	-webkit-tap-highlight-color: transparent;
	position: relative;
	/* Full tab is the hit area — no tiny icon-only target */
	touch-action: manipulation;
}

.mk-pwa-tabbar__item:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: -4px;
	border-radius: 8px;
}

.mk-pwa-tabbar__item.is-active {
	opacity: 1;
}

.mk-pwa-tabbar__item.is-active .mk-pwa-tabbar__label {
	font-weight: 700;
}

.mk-pwa-tabbar__icon {
	position: relative;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.mk-pwa-tabbar__icon svg {
	width: 32px;
	height: 32px;
	display: block;
	stroke: currentColor;
	fill: none;
	stroke-width: 1.35; /* thinner outline — more refined than 1.75 */
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* Cart badge dots use fill — keep those solid */
.mk-pwa-tabbar__icon svg circle[fill] {
	fill: currentColor;
	stroke: none;
}

.mk-pwa-tabbar__label {
	font-size: 10px;
	line-height: 1.15;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	text-align: center;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	padding: 0 2px;
}

.mk-pwa-tabbar__badge {
	position: absolute;
	top: -8px;
	right: -12px;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 999px;
	background: #ec1c24;
	color: #ffffff;
	font-size: 11px;
	font-weight: 800;
	line-height: 20px;
	text-align: center;
	box-sizing: border-box;
}

.mk-pwa-tabbar__badge:empty,
.mk-pwa-tabbar__badge[data-count="0"] {
	display: none;
}

/* —— Full-screen white search focus mode —— */
.mk-pwa-search-sheet {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 100090;
	background: #ffffff;
	align-items: stretch;
	justify-content: flex-start;
	flex-direction: column;
	padding: 0;
	box-sizing: border-box;
}

html.mk-pwa-app-chrome .mk-pwa-search-sheet.is-open {
	display: flex;
}

.mk-pwa-search-sheet__panel {
	width: 100%;
	background: #fff;
	color: #111;
	padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 16px;
	box-sizing: border-box;
}

.mk-pwa-search-sheet__row {
	display: flex;
	gap: 8px;
	align-items: center;
	background: #f3f3f3;
	border-radius: 999px;
	padding: 0 6px 0 14px;
	min-height: 48px;
}

.mk-pwa-search-sheet__icon {
	flex: 0 0 auto;
	display: flex;
	color: #444;
}

.mk-pwa-search-sheet__icon svg {
	width: 20px;
	height: 20px;
	stroke: currentColor;
	fill: none;
	stroke-width: 2;
}

.mk-pwa-search-sheet__input {
	flex: 1;
	min-width: 0;
	height: 48px;
	border: 0;
	background: transparent;
	padding: 0 4px;
	font-size: 16px; /* avoid iOS zoom */
	color: #111;
	outline: none;
	-webkit-appearance: none;
}

.mk-pwa-search-sheet__close {
	flex: 0 0 auto;
	height: 40px;
	padding: 0 12px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: #111;
	font-weight: 600;
	font-size: 15px;
	cursor: pointer;
}

.mk-pwa-search-sheet__hint {
	margin: 16px 8px 0;
	font-size: 13px;
	color: #777;
	line-height: 1.4;
}

.mk-pwa-search-sheet__status {
	margin: 14px 8px 0;
	font-size: 14px;
	color: #666;
}

.mk-pwa-search-sheet__results {
	flex: 1 1 auto;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 8px 0 calc(16px + env(safe-area-inset-bottom, 0px));
	margin: 0 -12px;
}

.mk-pwa-search-hit {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 16px;
	text-decoration: none;
	color: #111;
	border-bottom: 1px solid #f0f0f0;
	-webkit-tap-highlight-color: transparent;
}

.mk-pwa-search-hit:active {
	background: #f6f6f6;
}

.mk-pwa-search-hit__img {
	width: 56px;
	height: 56px;
	object-fit: cover;
	border-radius: 8px;
	background: #f3f3f3;
	flex: 0 0 auto;
}

.mk-pwa-search-hit__meta {
	flex: 1 1 auto;
	min-width: 0;
}

.mk-pwa-search-hit__title {
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.mk-pwa-search-hit__price {
	margin-top: 4px;
	font-size: 13px;
	color: #444;
}

.mk-pwa-search-see-all {
	display: block;
	width: 100%;
	margin: 8px 0 0;
	padding: 14px 16px;
	border: 0;
	border-top: 1px solid #eee;
	background: #fff;
	color: #ec1c24;
	font: inherit;
	font-size: 15px;
	font-weight: 700;
	text-align: left;
	cursor: pointer;
}

html.mk-pwa-search-open .mk-pwa-tabbar,
html.mk-pwa-search-open .mk-pwa-topbar {
	visibility: hidden;
	pointer-events: none;
}

/* Panel grows so results list can scroll under the input */
.mk-pwa-search-sheet.is-open .mk-pwa-search-sheet__panel {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 0;
	height: 100%;
	box-sizing: border-box;
}

.mk-pwa-search-sheet__form {
	flex: 0 0 auto;
}

/*
 * Bottom tabs stay above mini-cart (ATC peek).
 */
html.mk-pwa-app-chrome .mk-pwa-topbar,
html.mk-pwa-app-chrome .mk-pwa-tabbar {
	z-index: 100080;
}

html.mk-pwa-app-chrome .mk-mini-cart {
	top: 0;
	right: 0;
	left: 0;
	bottom: calc(112px + env(safe-area-inset-bottom, 0px));
	z-index: 100060;
}

html.mk-pwa-app-chrome .mk-mini-cart__panel {
	bottom: 0;
	max-height: 100%;
}

/* In-app navigation progress (also inlined early in head for first paint) */
html.mk-pwa-navigating body {
	cursor: progress;
}

/* Account: stack login + register (PWA only — avoid cramped two-column) */
html.mk-pwa-app-chrome .woocommerce-account .u-columns.col2-set,
html.mk-pwa-app-chrome .woocommerce-account .col2-set {
	display: flex !important;
	flex-direction: column !important;
	width: 100% !important;
	float: none !important;
	gap: 2rem;
}
html.mk-pwa-app-chrome .woocommerce-account .u-column1,
html.mk-pwa-app-chrome .woocommerce-account .u-column2,
html.mk-pwa-app-chrome .woocommerce-account .col-1,
html.mk-pwa-app-chrome .woocommerce-account .col-2 {
	width: 100% !important;
	max-width: 100% !important;
	float: none !important;
	flex: none !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
}
