/* Mobile Bottom Bar — Front-End Styles */

/* =========================================================================
   CSS Custom Properties (defaults — overridden by inline vars from PHP)
   ========================================================================= */
:root {
	--mbb-bar-bg: #ffffff;
	--mbb-bar-height: 64px;
	--mbb-border-color: #f1f5f9;
	--mbb-border-width: 1px;
	--mbb-icon-color: #94a3b8;
	--mbb-icon-active: #111827;
	--mbb-label-color: #94a3b8;
	--mbb-active-highlight: #111827;
	--mbb-icon-radius: 8px;
	--mbb-label-size: 11px;
	--mbb-bar-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
	--mbb-panel-bg: #ffffff;
	--mbb-submit-bg: #111827;
	--mbb-submit-text: #ffffff;
	--mbb-max-width: 767px;
}

/* =========================================================================
   Bottom Bar — hidden entirely above max-width (media query + JS guard)
   ========================================================================= */

#mbb-bar {
	display: none; /* Off by default; enabled below breakpoint */
}

@media (max-width: 767px) {
	#mbb-bar {
		display: flex;
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		z-index: 9999;
		height: var(--mbb-bar-height);
		background: var(--mbb-bar-bg);
		border-top: var(--mbb-border-width) solid var(--mbb-border-color);
		box-shadow: var(--mbb-bar-shadow);
		align-items: center;
		justify-content: space-evenly;
		-webkit-overflow-scrolling: touch;
	}

	/* Body padding so content isn't obscured */
	body {
		padding-bottom: var(--mbb-bar-height) !important;
	}

	/* When form panel is open, lock body scroll */
	body.mbb-scroll-locked {
		overflow: hidden;
	}
}

/* The JS-driven max-width guard class applied at runtime */
#mbb-bar.mbb-bar--hidden {
	display: none !important;
}

/* =========================================================================
   Bar buttons
   ========================================================================= */

.mbb-bar__btn {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	flex: 1;
	height: 100%;
	padding: 8px 4px 6px;
	text-decoration: none;
	color: var(--mbb-label-color);
	background: none;
	border: none;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	outline: none;
	/* Minimum 44×44 tappable area */
	min-width: 44px;
	min-height: 44px;
	position: relative;
	transition: opacity 0.15s;
}

.mbb-bar__btn:active {
	opacity: 0.6;
	transition: opacity 0.05s;
}

.mbb-bar__btn:focus-visible {
	outline: 2px solid var(--mbb-icon-active);
	outline-offset: -2px;
	border-radius: 6px;
}

.mbb-bar__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	flex-shrink: 0;
	border-radius: var(--mbb-icon-radius);
	transition: color 0.15s;
}

.mbb-bar__icon svg {
	width: 22px;
	height: 22px;
	color: var(--mbb-icon-color);
	fill: currentColor;
	display: block;
	transition: color 0.15s;
}

.mbb-bar__label {
	font-size: var(--mbb-label-size);
	line-height: 1;
	text-align: center;
	color: var(--mbb-label-color);
	white-space: nowrap;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-weight: 500;
	letter-spacing: 0.01em;
	transition: color 0.15s;
}

/* =========================================================================
   Overlay (behind form panel)
   ========================================================================= */

.mbb-overlay {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 9998;
	background: rgba(0, 0, 0, 0.45);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.mbb-overlay--visible {
	display: block;
}

.mbb-overlay--active {
	opacity: 1;
}

/* =========================================================================
   Contact Form Panel
   ========================================================================= */

.mbb-form-panel {
	position: fixed;
	bottom: var(--mbb-bar-height);
	left: 50%;
	z-index: 9999;
	background: var(--mbb-panel-bg);
	border-radius: 24px 24px 0 0;
	border: 1px solid #e5e7eb;
	box-shadow: 0 -10px 40px rgba(2, 6, 23, 0.22);
	width: min(92vw, 760px);
	max-height: 82vh;
	overflow: hidden;
	flex-direction: column;
	/* Starts off-screen; animated in via JS class */
	transform: translate(-50%, 110%);
	transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	will-change: transform;
}

/* Completely remove from accessibility tree when not in use */
.mbb-form-panel[hidden] {
	display: none !important;
}

/* Rendered (flex) once [hidden] is removed, before animation starts */
.mbb-form-panel:not([hidden]) {
	display: flex;
}

/* Slides into view */
.mbb-form-panel--open {
	transform: translate(-50%, 0);
}

/* Header */
.mbb-form-panel__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 26px 34px 18px;
	flex-shrink: 0;
	border-bottom: 1px solid #e5e7eb;
}

.mbb-form-panel__heading {
	font-size: 22px;
	font-weight: 800;
	margin: 0;
	color: #0f172a;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	letter-spacing: -0.03em;
	line-height: 1.05;
}

.mbb-form-panel__close {
	width: 54px;
	height: 54px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f3f4f6;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	color: #9ca3af;
	padding: 0;
	flex-shrink: 0;
	-webkit-tap-highlight-color: transparent;
	transition: background 0.15s, color 0.15s;
}

.mbb-form-panel__close:hover,
.mbb-form-panel__close:focus {
	background: #e5e7eb;
	color: #0f172a;
}

.mbb-form-panel__close svg {
	width: 22px;
	height: 22px;
}

/* Body */
.mbb-form-panel__body {
	padding: 24px 34px 34px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	flex: 1;
}

/* =========================================================================
   Contact Form Fields
   ========================================================================= */

.mbb-contact-form {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.mbb-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.mbb-field__label {
	font-size: 14px;
	font-weight: 700;
	color: #0f172a;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	letter-spacing: 0.005em;
}

.mbb-required {
	color: #f43f5e;
	margin-left: 2px;
}

.mbb-field__input,
.mbb-field__textarea {
	width: 100%;
	padding: 4px 12px;
	font-size: 17px;
	border: 2px solid #d8dde6;
	border-radius: 5px;
	background: #f3f4f8;
	color: #0f172a;
	transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
	-webkit-appearance: none;
	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.mbb-field__input:focus,
.mbb-field__textarea:focus {
	outline: none;
	background: #ffffff;
	border-color: var(--mbb-active-highlight, #111827);
	box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08);
}

.mbb-field__input.mbb-input--error,
.mbb-field__textarea.mbb-input--error {
	border-color: #f43f5e;
	background: #fff5f5;
}

.mbb-field__input::placeholder,
.mbb-field__textarea::placeholder {
	color: #cbd5e1;
}

.mbb-field__textarea {
	resize: vertical;
	min-height: 130px;
	line-height: 1.5;
}

.mbb-field__error {
	font-size: 12px;
	color: #f43f5e;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	min-height: 16px;
}

/* Checkbox field */
.mbb-field--checkbox .mbb-field__checkbox-label {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-size: 13px;
	color: #64748b;
	cursor: pointer;
	line-height: 1.5;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.mbb-field--checkbox input[type="checkbox"] {
	flex-shrink: 0;
	margin-top: 2px;
	width: 16px;
	height: 16px;
	accent-color: var(--mbb-submit-bg, #111827);
}

/* Submit button */
.mbb-submit {
	width: 100%;
	padding: 18px;
	font-size: 18px;
	font-weight: 700;
	color: var(--mbb-submit-text);
	background: var(--mbb-submit-bg);
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: opacity 0.2s, transform 0.1s;
	-webkit-appearance: none;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	margin-top: 10px;
	letter-spacing: 0.01em;
	text-align: center;
}

@media (max-width: 520px) {
	.mbb-form-panel {
		width: 100vw;
		border-radius: 18px 18px 0 0;
		border-left: none;
		border-right: none;
	}

	.mbb-form-panel__header {
		padding: 18px 18px 14px;
	}

	.mbb-form-panel__heading {
		font-size: 22px;
	}

	.mbb-form-panel__close {
		width: 46px;
		height: 46px;
	}

	.mbb-form-panel__body {
		padding: 16px 18px 24px;
	}

	.mbb-field__label {
		font-size: 14px;
	}

	.mbb-field__input,
	.mbb-field__textarea {
		padding: 4px 12px;
		font-size: 15px;
		border-radius: 5px;
	}

	.mbb-field__textarea {
		min-height: 110px;
	}

	.mbb-submit {
		font-size: 17px;
		border-radius: 8px;
		text-align: center;
	}
}

.mbb-submit:hover {
	opacity: 0.88;
}

.mbb-submit:active {
	transform: scale(0.98);
	opacity: 0.8;
}

.mbb-submit:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none;
}

/* Form messages */
.mbb-form-success {
	padding: 14px 16px;
	background: #f0fdf4;
	border: 1.5px solid #bbf7d0;
	border-radius: 10px;
	color: #15803d;
	font-size: 15px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	line-height: 1.5;
	margin-bottom: 12px;
}

.mbb-form-error {
	padding: 12px 16px;
	background: #fff1f2;
	border: 1.5px solid #fecdd3;
	border-radius: 10px;
	color: #be123c;
	font-size: 14px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	line-height: 1.5;
	margin-bottom: 12px;
}

/* =========================================================================
   Tablet and above — bar genuinely not displayed (belt-and-braces)
   ========================================================================= */

@media (min-width: 768px) {
	#mbb-bar,
	.mbb-overlay,
	.mbb-form-panel {
		display: none !important;
	}
}
