/* Phone bottom tab bar, account sheet and slide-out menu shortcuts.
 *
 * Shown below 1200px, where Electro swaps to its phone header. Everything is
 * scoped to .smc-tabbar / .smc-sheet / .smc-menu-shortcut. Electro styles bare
 * `button` elements heavily, so the Account tab's button is reset with
 * !important where the theme would otherwise win.
 */

:root {
	--smc-tab-h: 60px;
	--smc-tab-accent: #0787ea;
	--smc-tab-ink: #333e48;
	--smc-tab-muted: #6b7680;
}

.smc-tabbar,
.smc-sheet {
	display: none;
}

@media (max-width: 1199.98px) {

	/* Room at the bottom of every page so the bar never covers the footer. */
	body.smc-has-tabbar {
		padding-bottom: calc(var(--smc-tab-h) + env(safe-area-inset-bottom, 0px));
	}

	.smc-tabbar {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 9990;
		display: flex;
		align-items: stretch;
		height: calc(var(--smc-tab-h) + env(safe-area-inset-bottom, 0px));
		padding-bottom: env(safe-area-inset-bottom, 0px);
		background: #fff;
		border-top: 1px solid #e6ebf0;
		box-shadow: 0 -2px 12px rgba(0, 0, 0, .06);
	}

	.smc-tabbar .smc-tab {
		flex: 1 1 0;
		min-width: 0;
		display: flex !important;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 3px;
		margin: 0 !important;
		padding: 6px 2px !important;
		border: 0 !important;
		border-radius: 0 !important;
		background: transparent !important;
		box-shadow: none !important;
		color: var(--smc-tab-muted) !important;
		font: inherit;
		font-size: 11px !important;
		font-weight: 500;
		line-height: 1.1 !important;
		text-decoration: none !important;
		text-transform: none !important;
		letter-spacing: 0;
		cursor: pointer;
		-webkit-tap-highlight-color: transparent;
	}

	.smc-tabbar .smc-tab.is-current,
	.smc-tabbar .smc-tab:hover,
	.smc-tabbar .smc-tab:focus-visible {
		color: var(--smc-tab-accent) !important;
	}

	.smc-tabbar .smc-tab.is-current .smc-tab__label {
		font-weight: 700;
	}

	.smc-tabbar .smc-tab:focus-visible {
		outline: 2px solid var(--smc-tab-accent);
		outline-offset: -4px;
	}

	.smc-tab__icon {
		flex: 0 0 auto;
		width: 24px;
		height: 24px;
	}

	.smc-tab__label {
		max-width: 100%;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	/* Electro's "back to top" button and similar fixed corners sit above
	   the bar rather than under it. */
	body.smc-has-tabbar #scrollUp,
	body.smc-has-tabbar .back-to-top,
	body.smc-has-tabbar .electro-sticky-add-to-cart {
		bottom: calc(var(--smc-tab-h) + 12px + env(safe-area-inset-bottom, 0px)) !important;
	}

	/* Electro's "back to top" circle is sticky inside an absolute wrapper,
	   so `bottom` does not move it; lift it clear of the bar instead. */
	body.smc-has-tabbar .back-to-top-link {
		transform: translateY(calc(-1 * (var(--smc-tab-h) + env(safe-area-inset-bottom, 0px))));
	}

	/* --- the account sheet --- */

	.smc-sheet:not([hidden]) {
		display: block;
		position: fixed;
		inset: 0;
		z-index: 9995;
	}

	.smc-sheet__backdrop {
		position: absolute;
		inset: 0;
		background: rgba(0, 0, 0, .4);
	}

	.smc-sheet__panel {
		position: absolute;
		left: 0;
		right: 0;
		bottom: 0;
		max-height: 80vh;
		overflow-y: auto;
		padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0px));
		background: #fff;
		border-radius: 16px 16px 0 0;
		box-shadow: 0 -6px 24px rgba(0, 0, 0, .15);
		animation: smc-sheet-up .18s ease-out;
	}

	@keyframes smc-sheet-up {
		from { transform: translateY(24px); opacity: 0; }
		to   { transform: none; opacity: 1; }
	}

	.smc-sheet__head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 8px 0 10px;
		border-bottom: 1px solid #e6ebf0;
	}

	.smc-sheet__title {
		font-size: 16px;
		font-weight: 700;
		color: var(--smc-tab-ink);
	}

	.smc-sheet .smc-sheet__close {
		width: 40px !important;
		height: 40px !important;
		margin: 0 -8px 0 0 !important;
		padding: 0 !important;
		border: 0 !important;
		border-radius: 50% !important;
		background: transparent !important;
		color: var(--smc-tab-muted) !important;
		font-size: 28px !important;
		line-height: 1 !important;
		box-shadow: none !important;
	}

	.smc-sheet__list {
		list-style: none;
		margin: 0;
		padding: 0;
	}

	.smc-sheet__list li + li {
		border-top: 1px solid #f0f2f4;
	}

	.smc-sheet__list a {
		display: flex;
		align-items: center;
		justify-content: space-between;
		min-height: 52px;
		padding: 0 4px;
		color: var(--smc-tab-ink) !important;
		font-size: 15px;
		text-decoration: none !important;
	}

	.smc-sheet__list a span {
		color: #b0b8bf;
		font-size: 22px;
	}

	.smc-sheet__list .smc-sheet__logout {
		color: #c0392b !important;
	}

	/* --- slide-out menu shortcuts ---
	   Styled exactly like the theme's own items (same colour, weight and
	   icon size), so the shortcuts read as part of one menu. Every icon in
	   the menu gets the same box width, because Font Awesome glyphs differ
	   in width and otherwise each label starts at a different place. */

	.off-canvas-navigation .menu-item > a > i:first-child {
		display: inline-block;
		width: 18px;
		margin-right: 10px;
		text-align: center;
	}
}

@media print {
	.smc-tabbar,
	.smc-sheet {
		display: none !important;
	}
}
