/**
 * NextWave sitewide app-bar — mobile-only bottom navigation.
 *
 * Brand accent comes from the --nwp-appbar-accent custom property (set inline
 * from the venue theme colour); no hardcoded brand values here. Surfaces that
 * carry TEXT on the accent use --nwp-appbar-accent-fill (the brand colour
 * nudged until --nwp-appbar-accent-ink reaches WCAG AA — NWP_Brand::fill_for_ink)
 * so the raw accent stays reserved for outlines and accent-coloured text. Desktop hides
 * the bar entirely — it is a phone affordance — unless an extension asked for every
 * width (.nwp-appbar--all-widths, filter nwp_app_bar_all_widths).
 *
 * Theme tokens (NWP-PUSH-034): every chrome colour reads a custom property a theme
 * can set on .nwp-appbar, falling back to the built-in value, so an unthemed site
 * renders exactly as before:
 *   --nwp-appbar-bg / -fg / -border / -shadow   the dock (light and dark scheme)
 *   --nwp-appbar-current                        the current tab (extension tabs)
 *   --nwp-appbar-focus                          focus rings
 *   --nwp-appbar-menu-bg / -menu-fg / -menu-line  a menu sheet
 *   --nwp-appbar-accent / -accent-fill / -accent-ink  (render_styles(); a theme may override)
 */

.nwp-appbar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 9998;
	display: none;
	box-sizing: border-box;
	background: var( --nwp-appbar-bg, #ffffff );
	border-top: 1px solid var( --nwp-appbar-border, rgba( 0, 0, 0, 0.08 ) );
	box-shadow: var( --nwp-appbar-shadow, 0 -2px 14px rgba( 0, 0, 0, 0.10 ) );
	padding-bottom: env( safe-area-inset-bottom, 0 );
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	/* Promote to its own layer so iOS keeps the fixed dock steady during
	   momentum scroll (a transform on the fixed element itself does NOT break
	   its viewport-relative positioning — only ancestor transforms do). */
	transform: translateZ( 0 );
	-webkit-transform: translateZ( 0 );
}

/* Mobile only: show when the JS un-hides it. */
@media ( max-width: 768px ) {
	.nwp-appbar:not( [hidden] ) {
		display: block;
	}
}

/* Never on desktop, even if un-hidden. */
@media ( min-width: 769px ) {
	.nwp-appbar {
		display: none !important;
	}
}

/* Class selectors below would otherwise beat the UA [hidden] rule, so any JS
   toggles are respected explicitly. */
.nwp-appbar [hidden] {
	display: none !important;
}

/* Tab row — always four tabs, never collapsed. */
.nwp-appbar__tabs {
	display: flex;
	margin: 0;
	padding: 0;
	list-style: none;
}

.nwp-appbar__tabs li {
	flex: 1 1 0;
	margin: 0;
	padding: 0;
}

.nwp-appbar__tab {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	min-height: 56px;
	padding: 6px 4px;
	text-decoration: none;
	color: var( --nwp-appbar-fg, #333333 );
	font-size: 11px;
}

.nwp-appbar__tab:focus-visible {
	outline: 2px solid var( --nwp-appbar-focus, var( --nwp-appbar-accent, #0073aa ) );
	outline-offset: -2px;
}

.nwp-appbar__ico {
	font-size: 20px;
	line-height: 1;
}

/* Brand app-icon in the Membership/My Card tab (replaces the star glyph). */
.nwp-appbar__ico--brand {
	width: 22px;
	height: 22px;
	object-fit: contain;
	border-radius: 5px;
	vertical-align: middle;
}

.nwp-appbar__lbl {
	display: block;
}

/* Progressive action tab (Install / Enable alerts / Alerts) — highlighted with
   the brand accent while it is still encouraging install or push, then calms to
   a normal tab once the visitor is set up. */
.nwp-appbar[data-action="install"] .nwp-appbar__tab--action,
.nwp-appbar[data-action="push"] .nwp-appbar__tab--action {
	background: var( --nwp-appbar-accent-fill, var( --nwp-appbar-accent, #0073aa ) );
	/* Fill + ink are brand-computed (NWP_Brand::fill_for_ink / on_color) so the
	   label passes AA even on mid-tones where neither ink does (#8c52ff). */
	color: var( --nwp-appbar-accent-ink, #ffffff );
}

/* Anon/member label swap — anonymous by default; .is-member flips it. */
.nwp-appbar__lbl--member {
	display: none;
}

.nwp-appbar.is-member .nwp-appbar__lbl--anon {
	display: none;
}

.nwp-appbar.is-member .nwp-appbar__lbl--member {
	display: block;
}

/* Dark-scheme friendliness. */
@media ( prefers-color-scheme: dark ) {
	.nwp-appbar {
		background: var( --nwp-appbar-bg, #1c1c1e );
		border-top-color: var( --nwp-appbar-border, rgba( 255, 255, 255, 0.10 ) );
	}

	.nwp-appbar__tab {
		color: var( --nwp-appbar-fg, #e6e6e6 );
	}
}

/* Alerts inbox popup (app-bar 4th tab). */
.nwp-appbar__badge {
	position: absolute; top: 4px; right: 22%; min-width: 16px; height: 16px; padding: 0 4px;
	border-radius: 999px; background: #d63638; color: #fff; font-size: 10px; font-weight: 800;
	line-height: 16px; text-align: center;
}
.nwp-appbar-inbox {
	position: fixed; inset: 0; z-index: 2147483000; display: flex; align-items: flex-end;
	justify-content: center; background: rgba( 0, 0, 0, 0.35 );
}
.nwp-appbar-inbox[hidden] { display: none; }
.nwp-appbar-inbox__panel {
	width: 100%; max-width: 480px; max-height: 70vh; overflow: auto;
	background: #fff; color: #1d2327; border-radius: 16px 16px 0 0;
	margin-bottom: 64px; box-shadow: 0 -8px 30px rgba( 0, 0, 0, 0.3 );
}
.nwp-appbar-inbox__head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid #e2e4e7; position: sticky; top: 0; background: #fff; }
.nwp-appbar-inbox__close { border: 0; background: none; font-size: 24px; line-height: 1; cursor: pointer; color: #646970; }
.nwp-appbar-inbox__list { padding: 8px; }
.nwp-appbar-inbox__empty { text-align: center; color: #646970; padding: 24px; }
.nwp-appbar-inbox__item { display: block; text-decoration: none; color: inherit; padding: 12px 14px; border-radius: 10px; }
.nwp-appbar-inbox__item strong { display: block; }
.nwp-appbar-inbox__item span { display: block; color: #50575e; font-size: 14px; }
.nwp-appbar-inbox__item.is-unread { background: #f0f6fc; }
.nwp-appbar-inbox__item + .nwp-appbar-inbox__item { border-top: 1px solid #f0f0f1; }

/* ── Feature strip (cart + admin quick-jumps) along the top of the dock ── */
.nwp-appbar__strip {
	display: flex;
	gap: 8px;
	align-items: center;
	justify-content: center;
	padding: 8px 12px;
	border-bottom: 1px solid rgba( 0, 0, 0, 0.06 );
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}
.nwp-appbar__strip::-webkit-scrollbar { display: none; }
.nwp-appbar__strip:empty { display: none; }
.nwp-appbar__feature {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex: 0 0 auto;
	min-height: 36px;
	padding: 7px 14px;
	border-radius: 999px;
	text-decoration: none;
	font-size: 13px;
	font-weight: 700;
	line-height: 1;
	white-space: nowrap;
	color: var( --nwp-appbar-accent, #0073aa );
	background: rgba( 0, 0, 0, 0.05 );
}
.nwp-appbar__feature:active { transform: scale( 0.97 ); }
.nwp-appbar__feature:focus-visible { outline: 2px solid var( --nwp-appbar-accent, #0073aa ); outline-offset: 2px; }
.nwp-appbar__feature-ico { font-size: 15px; line-height: 1; }
/* Cart is the primary action — fill it with the brand accent. */
.nwp-appbar__feature--cart { background: var( --nwp-appbar-accent-fill, var( --nwp-appbar-accent, #0073aa ) ); color: var( --nwp-appbar-accent-ink, #fff ); }
.nwp-appbar__feature-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	border-radius: 999px;
	background: #fff;
	color: var( --nwp-appbar-accent, #0073aa );
	font-size: 11px;
	font-weight: 800;
}

/* ── Extension tabs (NWP-PUSH-034, filter nwp_app_bar_tabs) ──────────────
 * Only nav[data-tabs="custom"] carries these; the built-in dock never does. */

/* Every width, when an extension asked for it (specificity beats the desktop hide). */
@media ( min-width: 769px ) {
	.nwp-appbar.nwp-appbar--all-widths:not( [hidden] ) {
		display: block !important;
	}

	.nwp-appbar--all-widths .nwp-appbar__tabs {
		max-width: 720px;
		margin: 0 auto;
	}
}

.nwp-appbar[data-tabs="custom"] .nwp-appbar__tab {
	position: relative;
	box-sizing: border-box;
	width: 100%;
	min-height: 56px;
	margin: 0;
	border: 0;
	background: transparent;
	font-family: inherit;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	cursor: pointer;
}

.nwp-appbar[data-tabs="custom"] .nwp-appbar__tab.is-current,
.nwp-appbar[data-tabs="custom"] .nwp-appbar__tab[aria-expanded="true"] {
	color: var( --nwp-appbar-current, var( --nwp-appbar-accent, #0073aa ) );
	box-shadow: inset 0 3px 0 var( --nwp-appbar-current, var( --nwp-appbar-accent, #0073aa ) );
}

.nwp-appbar[data-tabs="custom"] .nwp-appbar__tab[aria-disabled="true"] {
	opacity: 0.75;
}

/* A short word beside a tab label ("Live"): a written, non-colour cue. */
.nwp-appbar__flag {
	display: inline-block;
	padding: 0 6px;
	border-radius: 999px;
	background: var( --nwp-appbar-accent-fill, var( --nwp-appbar-accent, #0073aa ) );
	color: var( --nwp-appbar-accent-ink, #ffffff );
	font-size: 12px; /* the 12 px text floor */
	font-weight: 800;
	line-height: 16px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

/* The progressive slot sits inside a menu: a dot on the menu tab while it still
   encourages install / push (decorative; the sheet itself says what it is). */
.nwp-appbar__dot {
	position: absolute;
	top: 8px;
	inset-inline-end: calc( 50% - 18px );
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var( --nwp-appbar-accent-fill, var( --nwp-appbar-accent, #0073aa ) );
	display: none;
}

.nwp-appbar[data-action="install"] .nwp-appbar__tab--has-action .nwp-appbar__dot,
.nwp-appbar[data-action="push"] .nwp-appbar__tab--has-action .nwp-appbar__dot {
	display: block;
}

/* A menu sheet: anchored to the top edge of the dock (the dock is its containing
   block), a modal dialog — the huge shadow dims the page behind it. */
.nwp-appbar__menu {
	position: absolute;
	inset-inline: 0;
	bottom: 100%;
	box-sizing: border-box;
	max-width: 480px;
	max-height: calc( 100vh - 96px );
	max-height: calc( 100dvh - 96px );
	margin: 0 auto;
	overflow: auto;
	padding: 8px 16px 12px;
	border-radius: 16px 16px 0 0;
	background: var( --nwp-appbar-menu-bg, var( --nwp-appbar-bg, #ffffff ) );
	color: var( --nwp-appbar-menu-fg, var( --nwp-appbar-fg, #1d2327 ) );
	box-shadow: 0 0 0 100vmax rgba( 0, 0, 0, 0.45 );
}

.nwp-appbar__menu-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 4px 0 8px;
}

.nwp-appbar__menu-title {
	margin: 0;
	font-size: 18px;
	line-height: 1.3;
	color: inherit;
}

.nwp-appbar__menu-title:focus {
	outline: none;
}

.nwp-appbar__menu-title:focus-visible {
	outline: 2px solid var( --nwp-appbar-focus, var( --nwp-appbar-accent, #0073aa ) );
	outline-offset: 2px;
}

.nwp-appbar__menu-close {
	min-width: 44px;
	min-height: 44px;
	padding: 8px 16px;
	border: 2px solid var( --nwp-appbar-menu-line, currentColor );
	border-radius: 999px;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
}

.nwp-appbar__menu-list {
	display: grid;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.nwp-appbar__item {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	box-sizing: border-box;
	width: 100%;
	min-height: 48px;
	padding: 10px 14px;
	border: 1px solid var( --nwp-appbar-menu-line, rgba( 0, 0, 0, 0.15 ) );
	border-radius: 14px;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 16px;
	font-weight: 600;
	text-align: start;
	text-decoration: none;
	cursor: pointer;
}

.nwp-appbar__item .nwp-appbar__ico {
	flex: 0 0 auto;
	width: 24px;
	text-align: center;
}

.nwp-appbar__item.is-current {
	border-color: var( --nwp-appbar-current, var( --nwp-appbar-accent, #0073aa ) );
}

.nwp-appbar__item .nwp-appbar__badge {
	position: static;
	margin-inline-start: auto;
}

.nwp-appbar__menu-close:focus-visible,
.nwp-appbar__item:focus-visible,
.nwp-appbar__slot :focus-visible {
	outline: 2px solid var( --nwp-appbar-focus, var( --nwp-appbar-accent, #0073aa ) );
	outline-offset: 2px;
}

@media ( prefers-reduced-motion: reduce ) {
	.nwp-appbar__menu,
	.nwp-appbar__item,
	.nwp-appbar__tab {
		transition: none !important;
		animation: none !important;
	}
}
