:root {
	--cdl-pwa-nav-height: 64px;
	--cdl-pwa-theme: #990033;
}

/* Bottom navigation (sempre visible: mòbil, desktop i app) -------- */

.cdl-pwa-bottom-nav {
	display: block;
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 99990;
	background: #fff;
	border-top: 1px solid #dcdcde;
	box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
	padding-bottom: env(safe-area-inset-bottom, 0);
}

body.cdl-pwa-has-bottom-nav {
	padding-bottom: calc(var(--cdl-pwa-nav-height) + env(safe-area-inset-bottom, 0));
}

body.cdl-pwa-has-bottom-nav .cdl-pwa-install-banner,
body.cdl-pwa-has-bottom-nav .cdl-pwa-install-modal__panel,
body.cdl-pwa-has-bottom-nav #cdl-pwa-update-banner {
	bottom: calc(var(--cdl-pwa-nav-height) + env(safe-area-inset-bottom, 0) + 8px);
}

.cdl-pwa-bottom-nav__list {
	display: flex;
	align-items: stretch;
	justify-content: space-around;
	gap: 4px;
	margin: 0;
	padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0));
	list-style: none;
}

.cdl-pwa-bottom-nav__item {
	flex: 1 1 0;
	min-width: 0;
}

.cdl-pwa-bottom-nav__link {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 3px;
	min-height: 44px;
	padding: 6px 2px;
	border-radius: 10px;
	color: #50575e !important;
	text-decoration: none !important;
	font-size: 0.68rem;
	font-weight: 600;
	line-height: 1.1;
	background: transparent;
}

.cdl-pwa-bottom-nav__link:hover,
.cdl-pwa-bottom-nav__link:focus-visible {
	color: var(--cdl-pwa-theme) !important;
	background: rgba(153, 0, 51, 0.06);
}

.cdl-pwa-bottom-nav__link.is-active {
	color: var(--cdl-pwa-theme) !important;
	background: rgba(153, 0, 51, 0.08);
}

.cdl-pwa-bottom-nav__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
}

.cdl-pwa-bottom-nav__label {
	display: block;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

@media (min-width: 783px) {
	.cdl-pwa-bottom-nav__list {
		max-width: 960px;
		margin-inline: auto;
	}

	.cdl-pwa-bottom-nav__label {
		font-size: 0.62rem;
	}
}

/* Standalone / app feel ------------------------------------------------ */

body.cdl-pwa-standalone {
	-webkit-tap-highlight-color: transparent;
}

body.cdl-pwa-standalone .site-header a,
body.cdl-pwa-standalone .main-navigation a {
	min-height: 44px;
}

/* Touch targets ------------------------------------------------------- */

@media (max-width: 782px), (display-mode: standalone) {
	.cdl-button,
	.cdl-pwa-install-trigger,
	.cdl-login-register .cdl-button,
	.cdl-user-actions .cdl-button,
	.cdl-push-preferences button,
	.cdl-push-preferences input[type="checkbox"],
	.cdl-push-preferences select,
	.cdl-export-ical-btn,
	.cdl-calendar-subscribe-btn {
		min-height: 0;
	}

	.cdl-login-register .cdl-button,
	.cdl-user-actions .cdl-button,
	.cdl-pwa-install-trigger,
	.cdl-push-preferences button,
	.cdl-export-ical-btn {
		min-width: 44px;
	}

	.cdl-push-preferences input,
	.cdl-push-preferences select,
	.cdl-push-preferences textarea,
	.cdl-areapersonal-usuario input,
	.cdl-areapersonal-usuario select,
	.cdl-areapersonal-usuario textarea {
		font-size: 16px;
	}

	.cdl-calendar-filters {
		gap: 10px;
	}

	.cdl-calendar-filter {
		align-items: center;
		padding: 6px 0;
	}
}

/* Tables on mobile ---------------------------------------------------- */

@media (max-width: 782px) {
	body.cdl-pwa-mobile-ready .cdl-map {
		height: 320px;
	}

	/* FullCalendar daygrid is built with <table> — never override display */
	body.cdl-pwa-mobile-ready #cdl-calendar table {
		display: table;
		width: 100%;
	}
}

/* Safe areas for fixed UI --------------------------------------------- */

@supports (padding: max(0px)) {
	body.cdl-pwa-has-bottom-nav {
		padding-left: max(0px, env(safe-area-inset-left));
		padding-right: max(0px, env(safe-area-inset-right));
	}
}
