/* Banh Mi House Event POS */

.bmhe-pos {
	--bmhe-red: #c41e3a;
	--bmhe-red-dark: #9a1730;
	--bmhe-gold: #d4a853;
	--bmhe-bg: #f5f3ef;
	--bmhe-surface: #ffffff;
	--bmhe-text: #1a1a1a;
	--bmhe-muted: #6b6b6b;
	--bmhe-border: #e0dcd4;
	--bmhe-radius: 12px;
	--bmhe-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
	--bmhe-mobile-bar-h: 56px;
	--bmhe-safe-bottom: env(safe-area-inset-bottom, 0px);
	--bmhe-safe-top: env(safe-area-inset-top, 0px);

	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
	color: var(--bmhe-text);
	line-height: 1.4;
	max-width: 1400px;
	margin: 0 auto;
	-webkit-text-size-adjust: 100%;
}

.bmhe-pos *,
.bmhe-pos *::before,
.bmhe-pos *::after {
	box-sizing: border-box;
}

/* Modal */
.bmhe-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	padding-top: calc(20px + var(--bmhe-safe-top));
	padding-bottom: calc(20px + var(--bmhe-safe-bottom));
}

.bmhe-modal[hidden],
.bmhe-modal[aria-hidden="true"] {
	display: none;
}

.bmhe-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
}

.bmhe-modal__dialog {
	position: relative;
	background: var(--bmhe-surface);
	border-radius: var(--bmhe-radius);
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
	width: 100%;
	max-width: 420px;
	max-height: calc(100vh - 40px - var(--bmhe-safe-top) - var(--bmhe-safe-bottom));
	overflow-y: auto;
	padding: 32px 24px;
	text-align: center;
	-webkit-overflow-scrolling: touch;
}

.bmhe-modal__header h2 {
	margin: 12px 0 4px;
	font-size: 1.5rem;
	color: var(--bmhe-red);
}

.bmhe-modal__header p {
	margin: 0 0 24px;
	color: var(--bmhe-muted);
}

.bmhe-modal__body {
	text-align: left;
	margin-bottom: 24px;
}

.bmhe-modal__body label {
	display: block;
	font-weight: 600;
	margin-bottom: 8px;
}

.bmhe-select {
	width: 100%;
	padding: 14px 16px;
	font-size: 16px;
	border: 2px solid var(--bmhe-border);
	border-radius: 8px;
	background: var(--bmhe-surface);
	appearance: auto;
}

.bmhe-select:focus {
	outline: none;
	border-color: var(--bmhe-red);
}

/* Buttons */
.bmhe-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 44px;
	padding: 12px 24px;
	font-size: 1rem;
	font-weight: 600;
	border: 2px solid transparent;
	border-radius: 8px;
	cursor: pointer;
	transition: background 0.15s, transform 0.1s;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
	user-select: none;
}

.bmhe-btn:active:not(:disabled) {
	transform: scale(0.98);
}

.bmhe-btn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.bmhe-btn--primary {
	background: var(--bmhe-red);
	color: #fff;
	border-color: var(--bmhe-red);
}

.bmhe-btn--primary:hover:not(:disabled) {
	background: var(--bmhe-red-dark);
	border-color: var(--bmhe-red-dark);
}

.bmhe-btn--ghost {
	background: transparent;
	color: var(--bmhe-muted);
	border-color: var(--bmhe-border);
}

.bmhe-btn--ghost:hover:not(:disabled) {
	background: var(--bmhe-bg);
	color: var(--bmhe-text);
}

.bmhe-btn--sm {
	min-height: 36px;
	padding: 8px 12px;
	font-size: 0.8125rem;
}

.bmhe-btn--lg {
	padding: 16px 32px;
	font-size: 1.125rem;
	width: 100%;
	min-height: 52px;
}

.bmhe-btn--qty {
	width: 48px;
	height: 48px;
	min-height: 48px;
	padding: 0;
	font-size: 1.375rem;
	border-radius: 50%;
	flex-shrink: 0;
}

/* Header */
.bmhe-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 8px 14px;
	padding-top: calc(8px + var(--bmhe-safe-top));
	background: var(--bmhe-red);
	color: #fff;
	border-radius: var(--bmhe-radius) var(--bmhe-radius) 0 0;
	min-height: 44px;
}

.bmhe-header__venue-name {
	flex: 1;
	min-width: 0;
	font-size: 1rem;
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.bmhe-header__change {
	flex-shrink: 0;
	padding: 0;
	margin: 0;
	border: none;
	background: none;
	color: #fff;
	font-size: 0.8125rem;
	font-weight: 500;
	font-family: inherit;
	line-height: 1.2;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 2px;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
	white-space: nowrap;
	appearance: none;
	-webkit-appearance: none;
	min-height: 0;
	box-shadow: none;
}

.bmhe-header__change:hover,
.bmhe-header__change:focus {
	color: #fff;
	opacity: 0.85;
	outline: none;
	background: none;
}

.bmhe-header__change:active {
	opacity: 0.7;
}

/* Category nav — sticky only */
.bmhe-category-nav {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	padding: 8px 14px;
	background: var(--bmhe-surface);
	border-bottom: 1px solid var(--bmhe-border);
	position: sticky;
	top: 0;
	z-index: 30;
}

.bmhe-category-nav::-webkit-scrollbar {
	display: none;
}

.bmhe-category-nav__tab {
	flex-shrink: 0;
	padding: 7px 12px;
	font-size: 0.8125rem;
	font-weight: 600;
	border: 1px solid var(--bmhe-border);
	border-radius: 999px;
	background: var(--bmhe-bg);
	color: var(--bmhe-text);
	cursor: pointer;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
	white-space: nowrap;
}

.bmhe-category-nav__tab--active {
	background: var(--bmhe-red);
	border-color: var(--bmhe-red);
	color: #fff;
}

/* Layout */
.bmhe-pos-app {
	background: var(--bmhe-bg);
	border-radius: var(--bmhe-radius);
	box-shadow: var(--bmhe-shadow);
	overflow: visible;
}

.bmhe-layout {
	display: grid;
	grid-template-columns: 1fr min(320px, 34vw);
	grid-template-rows: minmax(0, 1fr);
	align-items: start;
	min-height: 70vh;
}

.bmhe-menu {
	grid-column: 1;
	grid-row: 1;
	padding: 16px;
	overflow-y: auto;
	max-height: calc(100vh - 120px);
	-webkit-overflow-scrolling: touch;
}

.bmhe-cart {
	grid-column: 2;
	grid-row: 1;
}

.bmhe-category {
	margin-bottom: 20px;
	scroll-margin-top: 52px;
}

.bmhe-category__title {
	font-size: 0.8125rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--bmhe-red);
	margin: 0 0 12px;
	padding-bottom: 8px;
	border-bottom: 2px solid var(--bmhe-red);
}

.bmhe-items {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.bmhe-item {
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 10px 12px;
	background: var(--bmhe-surface);
	border: 1px solid var(--bmhe-border);
	border-radius: 8px;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.bmhe-item--active {
	border-color: var(--bmhe-red);
	box-shadow: 0 0 0 1px var(--bmhe-red);
}

.bmhe-item__info {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.bmhe-item__name {
	display: block;
	font-size: 0.875rem;
	font-weight: 500;
	line-height: 1.25;
}

.bmhe-item__price {
	display: block;
	font-size: 0.8125rem;
	color: var(--bmhe-red);
	font-weight: 700;
	margin-top: 0;
	line-height: 1.2;
}

.bmhe-item__controls {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 4px;
	flex-shrink: 0;
	margin-left: auto;
	height: 36px;
}

.bmhe-item__qty {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 28px;
	height: 36px;
	text-align: center;
	font-weight: 700;
	font-size: 0.9375rem;
	line-height: 1;
}

.bmhe-item__controls .bmhe-btn.bmhe-btn--qty {
	width: 36px;
	height: 36px;
	min-width: 36px;
	min-height: 36px;
	max-width: 36px;
	max-height: 36px;
	padding: 0;
	margin: 0;
	font-size: 1.125rem;
	line-height: 1;
	border-width: 2px;
	box-sizing: border-box;
	border-color: var(--bmhe-border);
	background: var(--bmhe-bg);
	color: var(--bmhe-text);
}

.bmhe-item__controls .bmhe-btn.bmhe-btn--qty.bmhe-btn--add {
	background: var(--bmhe-red);
	border-color: var(--bmhe-red);
	color: #fff;
}

/* Cart backdrop (mobile drawer) */
.bmhe-cart-backdrop {
	display: none;
}

/* Cart */
.bmhe-cart {
	background: var(--bmhe-surface);
	border-left: 1px solid var(--bmhe-border);
	display: flex;
	flex-direction: column;
	padding: 20px;
	min-height: 0;
}

.bmhe-cart__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 16px;
}

.bmhe-cart__title {
	margin: 0;
	font-size: 1.125rem;
}

.bmhe-cart__close {
	display: none;
}

.bmhe-cart__lines {
	list-style: none;
	margin: 0;
	padding: 0;
	flex: 1;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	min-height: 0;
}

.bmhe-cart__footer {
	flex-shrink: 0;
	margin-top: auto;
}

.bmhe-cart__empty {
	color: var(--bmhe-muted);
	font-style: italic;
	padding: 20px 0;
	text-align: center;
}

.bmhe-cart-line {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 8px;
	padding: 12px 0;
	border-bottom: 1px solid var(--bmhe-border);
	font-size: 0.875rem;
}

.bmhe-cart-line__name {
	flex: 1;
}

.bmhe-cart-line__meta {
	color: var(--bmhe-muted);
	font-size: 0.8125rem;
	margin-top: 2px;
}

.bmhe-cart-line__total {
	font-weight: 700;
	white-space: nowrap;
	font-size: 0.9375rem;
}

.bmhe-cart__totals {
	margin-top: 16px;
	padding-top: 16px;
	border-top: 2px solid var(--bmhe-border);
}

.bmhe-total-row {
	display: flex;
	justify-content: space-between;
	padding: 6px 0;
	font-size: 0.9375rem;
}

.bmhe-total-row--grand {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--bmhe-red);
	padding-top: 12px;
	margin-top: 4px;
	border-top: 1px solid var(--bmhe-border);
}

.bmhe-cart__actions {
	margin-top: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

/* Fixed bottom bar (mobile) */
.bmhe-fixed-bar {
	display: none;
}

/* Success modal */
.bmhe-modal__dialog--success {
	max-width: 380px;
}

.bmhe-success-icon {
	width: 64px;
	height: 64px;
	margin: 0 auto 16px;
	background: #22c55e;
	color: #fff;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 2rem;
	font-weight: 700;
}

.bmhe-success-totals {
	background: var(--bmhe-bg);
	border-radius: 8px;
	padding: 16px;
	margin: 20px 0;
	text-align: left;
}

.bmhe-success-note {
	color: var(--bmhe-muted);
	font-size: 0.875rem;
	margin-bottom: 20px;
}

.bmhe-modal__footer .bmhe-btn {
	width: 100%;
}

@media (max-width: 599px) {
	.bmhe-layout {
		grid-template-columns: 1fr;
	}

	.bmhe-menu {
		grid-column: 1;
		max-height: none;
		padding: 12px 12px calc(var(--bmhe-mobile-bar-h) + var(--bmhe-safe-bottom) + 12px);
	}

	.bmhe-cart {
		grid-column: 1;
	}

	/* Cart drawer */
	.bmhe-cart-backdrop {
		display: block;
		position: fixed;
		inset: 0;
		background: rgba(0, 0, 0, 0.45);
		z-index: 100;
		opacity: 0;
		pointer-events: none;
		transition: opacity 0.25s ease;
	}

	.bmhe-cart-backdrop--visible {
		opacity: 1;
		pointer-events: auto;
	}

	.bmhe-cart {
		position: fixed;
		left: 0;
		right: 0;
		bottom: calc(var(--bmhe-mobile-bar-h) + var(--bmhe-safe-bottom));
		z-index: 101;
		max-height: calc(85dvh - var(--bmhe-mobile-bar-h) - var(--bmhe-safe-bottom));
		border-left: none;
		border-radius: 16px 16px 0 0;
		box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
		padding: 0;
		transform: translateY(calc(100% + var(--bmhe-mobile-bar-h)));
		transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
	}

	.bmhe-cart--open {
		transform: translateY(0);
	}

	.bmhe-cart__header {
		padding: 16px 16px 0;
		margin-bottom: 0;
		position: relative;
	}

	.bmhe-cart__header::before {
		content: "";
		display: block;
		width: 40px;
		height: 4px;
		background: var(--bmhe-border);
		border-radius: 2px;
		margin: 0 auto 12px;
	}

	.bmhe-cart__close {
		display: inline-flex;
	}

	.bmhe-cart__lines {
		padding: 0 16px;
		max-height: 40vh;
		max-height: 40dvh;
	}

	.bmhe-cart__footer {
		padding: 0 16px 16px;
		background: var(--bmhe-surface);
		border-top: 1px solid var(--bmhe-border);
	}

	.bmhe-checkout-btn--sidebar {
		display: none;
	}

	/* Fixed bottom bar — single row: Total | Checkout */
	.bmhe-fixed-bar {
		display: flex;
		flex-direction: row;
		flex-wrap: nowrap;
		align-items: center;
		gap: 8px;
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 102;
		padding: 6px 10px;
		padding-bottom: calc(6px + var(--bmhe-safe-bottom));
		background: var(--bmhe-surface);
		border-top: 1px solid var(--bmhe-border);
		box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
	}

	.bmhe-fixed-bar__total {
		flex: 1 1 auto;
		display: flex;
		flex-direction: row;
		flex-wrap: nowrap;
		align-items: center;
		gap: 6px;
		min-width: 0;
		height: 44px;
		padding: 0 12px;
		margin: 0;
		background: var(--bmhe-bg);
		border: 1px solid var(--bmhe-border);
		border-radius: 8px;
		cursor: pointer;
		text-align: left;
		font-family: inherit;
		box-sizing: border-box;
		touch-action: manipulation;
		-webkit-tap-highlight-color: transparent;
		white-space: nowrap;
		overflow: hidden;
	}

	.bmhe-fixed-bar__total:disabled {
		cursor: default;
		opacity: 1;
	}

	.bmhe-fixed-bar__total:not(:disabled):active {
		background: #ebe7e0;
	}

	.bmhe-fixed-bar__label {
		font-size: 0.75rem;
		font-weight: 600;
		text-transform: uppercase;
		letter-spacing: 0.04em;
		color: var(--bmhe-muted);
		flex-shrink: 0;
		line-height: 1;
	}

	.bmhe-fixed-bar__amount {
		font-size: 1.125rem;
		font-weight: 700;
		color: var(--bmhe-red);
		line-height: 1;
		flex-shrink: 0;
	}

	.bmhe-fixed-bar__meta {
		font-size: 0.6875rem;
		color: var(--bmhe-muted);
		line-height: 1;
		flex: 1 1 auto;
		min-width: 0;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.bmhe-fixed-bar__checkout {
		flex: 0 0 auto;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-width: 96px;
		height: 44px;
		padding: 0 16px;
		margin: 0;
		border: none;
		border-radius: 8px;
		background: var(--bmhe-red);
		color: #fff;
		font-family: inherit;
		font-size: 0.875rem;
		font-weight: 600;
		line-height: 1;
		white-space: nowrap;
		cursor: pointer;
		box-sizing: border-box;
		touch-action: manipulation;
		-webkit-tap-highlight-color: transparent;
	}

	.bmhe-fixed-bar__checkout:disabled {
		opacity: 0.45;
		cursor: not-allowed;
	}

	.bmhe-fixed-bar__checkout:not(:disabled):active {
		background: var(--bmhe-red-dark);
	}

	/* Modals as bottom sheets on mobile */
	.bmhe-modal {
		align-items: flex-end;
		padding: 0;
	}

	.bmhe-modal__dialog--sheet {
		max-width: none;
		border-radius: 16px 16px 0 0;
		padding: 24px 20px calc(24px + var(--bmhe-safe-bottom));
		max-height: 90vh;
		max-height: 90dvh;
	}

	.bmhe-header {
		border-radius: 0;
	}

	.bmhe-pos-app {
		border-radius: 0;
		min-height: 100dvh;
	}

	.bmhe-pos {
		max-width: none;
		margin: 0;
	}
}

/* Full-width POS page — phones only */
@media (max-width: 599px) {
	body.bmhe-pos-page .entry-content,
	body.bmhe-pos-page .site-content,
	body.bmhe-pos-page .content-area,
	body.bmhe-pos-page article {
		padding-left: 0 !important;
		padding-right: 0 !important;
		margin-left: 0 !important;
		margin-right: 0 !important;
		max-width: none !important;
	}

	body.bmhe-pos-page .entry-header {
		display: none;
	}
}

/* Small phones */
@media (max-width: 380px) {
	.bmhe-header__venue-name {
		font-size: 0.9375rem;
	}

	.bmhe-header__change {
		font-size: 0.75rem;
	}

	.bmhe-category-nav__tab {
		padding: 7px 12px;
		font-size: 0.75rem;
	}
}

/* Body lock when cart open */
.bmhe-pos--cart-open {
	overflow: hidden;
}

@media (min-width: 600px) {
	.bmhe-fixed-bar,
	.bmhe-checkout-btn--fixed {
		display: none !important;
	}

	.bmhe-cart-backdrop {
		display: none !important;
	}

	.bmhe-layout {
		grid-template-columns: 1fr min(300px, 36vw);
	}

	.bmhe-menu {
		grid-column: 1;
		max-height: calc(100dvh - 100px);
		padding-bottom: 16px;
	}

	.bmhe-cart {
		grid-column: 2;
		position: sticky;
		top: 0;
		align-self: start;
		max-height: 100dvh;
		left: auto;
		right: auto;
		bottom: auto;
		width: auto;
		border-left: 1px solid var(--bmhe-border);
		padding: 16px;
		transform: none !important;
		border-radius: 0;
		box-shadow: none;
		z-index: 1;
	}

	.bmhe-cart--open {
		transform: none !important;
	}

	.bmhe-cart__close {
		display: none !important;
	}

	.bmhe-cart__header::before {
		display: none;
	}

	.bmhe-cart__header {
		padding: 0;
		margin-bottom: 12px;
	}

	.bmhe-cart__lines {
		padding: 0;
		max-height: none;
	}

	.bmhe-cart__footer {
		padding: 0;
	}

	.bmhe-checkout-btn--sidebar {
		display: inline-flex;
	}

	.bmhe-header {
		padding-top: calc(8px + var(--bmhe-safe-top));
		border-radius: var(--bmhe-radius) var(--bmhe-radius) 0 0;
	}

	.bmhe-header__venue-name {
		font-size: 1.0625rem;
	}
}
