/* Mobile Action Bar
   Colors come from CSS variables printed inline by the plugin. */

:root {
	--mab-btn-height: 54px;
	--mab-height: calc(54px + env(safe-area-inset-bottom, 0px));
}

/* Hidden by default; the inline media query switches it on below the breakpoint. */
.mab-wrap {
	display: none;
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 99990;
	pointer-events: none;
}

.mab-wrap * {
	box-sizing: border-box;
}

/* --- Bar ---------------------------------------------------------------- */

.mab-bar {
	display: flex;
	align-items: stretch;
	width: 100%;
	background: var(--mab-bg);
	padding-bottom: env(safe-area-inset-bottom, 0px);
	border-top-left-radius: var(--mab-radius, 14px);
	border-top-right-radius: var(--mab-radius, 14px);
	/* Keeps the pressed state and the divider inside the curve. */
	overflow: hidden;
	box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.18);
	pointer-events: auto;
}

.mab-btn {
	flex: 1 1 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	min-height: var(--mab-btn-height, 54px);
	padding: 6px;
	color: var(--mab-text);
	text-decoration: none;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: 0.01em;
	-webkit-tap-highlight-color: transparent;
	transition: background-color 0.15s ease;
}

/* Icon beside the label, for a shorter bar. */
.mab-bar.is-inline .mab-btn {
	flex-direction: row;
	gap: 8px;
	padding: 6px 10px;
}

.mab-bar.is-inline .mab-icon {
	width: 20px;
	height: 20px;
}

.mab-btn:hover,
.mab-btn:visited,
.mab-btn:focus {
	color: var(--mab-text);
	text-decoration: none;
}

.mab-btn:active {
	background: var(--mab-active);
}

.mab-btn:focus-visible {
	outline: 2px solid var(--mab-text);
	outline-offset: -4px;
}

.mab-btn + .mab-btn {
	border-left: 1px solid var(--mab-divider);
	/* Keep the divider subtle regardless of the chosen color. */
	border-left-color: color-mix(in srgb, var(--mab-divider) 35%, transparent);
}

.mab-icon {
	display: block;
	width: 22px;
	height: 22px;
	flex: none;
}

.mab-icon svg {
	display: block;
	width: 100%;
	height: 100%;
}

.mab-label {
	display: block;
}

/* --- Welcome bubble ----------------------------------------------------- */

.mab-bubble {
	position: relative;
	margin: 0 12px 12px;
	padding: 16px 44px 16px 18px;
	background: var(--mab-bubble-bg);
	color: var(--mab-bubble-text);
	border: 2px solid var(--mab-bubble-border);
	border-radius: 10px;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
	pointer-events: auto;
	opacity: 0;
	transform: translateY(8px);
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.mab-bubble.is-visible {
	opacity: 1;
	transform: translateY(0);
}

/* Pointer aiming at the bar */
.mab-bubble::after,
.mab-bubble::before {
	content: "";
	position: absolute;
	top: 100%;
	left: 50%;
	width: 0;
	height: 0;
	border-style: solid;
}

.mab-bubble::before {
	margin-left: -12px;
	border-width: 14px 12px 0 12px;
	border-color: var(--mab-bubble-border) transparent transparent transparent;
}

.mab-bubble::after {
	margin-left: -9px;
	border-width: 11px 9px 0 9px;
	border-color: var(--mab-bubble-bg) transparent transparent transparent;
}

.mab-bubble-title {
	margin: 0 0 4px;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.3;
	color: inherit;
}

.mab-bubble-text {
	margin: 0;
	font-size: 15px;
	line-height: 1.4;
	color: inherit;
	opacity: 0.85;
}

.mab-bubble-close {
	position: absolute;
	top: 8px;
	right: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	background: none;
	border: 0;
	border-radius: 4px;
	color: inherit;
	opacity: 0.6;
	cursor: pointer;
}

.mab-bubble-close:hover {
	opacity: 1;
}

.mab-bubble-close svg {
	width: 18px;
	height: 18px;
}

@media (prefers-reduced-motion: reduce) {
	.mab-bubble {
		transition: none;
	}
}
