/* G5 brand primary color overrides (front theme only) */

:root,
[data-bs-theme=light] {
	--bs-primary: #eab41e;
	--bs-primary-rgb: 234, 180, 30;
	--bs-light-primary: rgba(234, 180, 30, 0.1);
	--bs-primary-bg-subtle: rgba(234, 180, 30, 0.1);
}

:root .btn-primary,
[data-bs-theme=light] .btn-primary {
	--bs-btn-bg: #eab41e;
	--bs-btn-border-color: #eab41e;
	--bs-btn-hover-bg: #c99a19;
	--bs-btn-hover-border-color: #c99a19;
}

[data-bs-theme=dark] {
	--bs-primary: #eab41e;
	--bs-primary-rgb: 234, 180, 30;
	--bs-light-primary: rgba(234, 180, 30, 0.16);
	--bs-primary-bg-subtle: rgba(234, 180, 30, 0.16);
}

[data-bs-theme=dark] .btn-primary {
	--bs-btn-bg: #eab41e;
	--bs-btn-border-color: #eab41e;
	--bs-btn-color: #1c1c1c;
	--bs-btn-hover-bg: #c99a19;
	--bs-btn-hover-border-color: #c99a19;
	--bs-btn-hover-color: #1c1c1c;
}

.logo-g5 {
	height: 40px;
	width: auto;
	max-width: 100%;
	object-fit: contain;
}

.brand-logo .logo-g5 {
	height: 44px;
}

.topbar .logo-g5 {
	height: 36px;
}

.auth-card .logo-g5 {
	height: 56px;
}

/* Fond de page = couleur du thème + gouttière scrollbar réservée.
   -> jamais de flash blanc entre les pages (dark mode, pages courtes, transitions)
   -> le viewport ne change plus de largeur quand la scrollbar apparaît. */
html {
	scrollbar-gutter: stable;
	background-color: var(--bs-body-bg);
}

/* ===== Transition entre pages — crossfade natif (View Transitions API, 2026) =====
   Le navigateur capture l'ancienne page et fond vers la nouvelle à chaque navigation
   same-origin. Aucun logo, aucune attente JS : illusion d'un fondu instantané. */
@view-transition {
	navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
	animation-duration: 0.22s;
	animation-timing-function: ease;
}

/* ===== Révélation différée (page-transition.js) =====
   Masque le rendu progressif / montage des composants jusqu'à stabilité visuelle
   (DOM + polices + absence de layout shift). Voile = fond thème, sans logo. */
html.mm-page-hold {
	overflow: hidden;
}

html.mm-page-hold body {
	overflow: hidden;
}

html.mm-page-hold #main-wrapper {
	visibility: hidden;
}

.mm-page-veil {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100dvh;
	z-index: 99998;
	background-color: var(--bs-body-bg);
	opacity: 0;
	pointer-events: none;
	visibility: hidden;
	transition: none;
	contain: strict;
	isolation: isolate;
}

.mm-page-veil.mm-page-veil-hold {
	opacity: 1;
	pointer-events: auto;
	visibility: visible;
}

.mm-page-veil.mm-page-veil-fade {
	opacity: 0;
	pointer-events: none;
	visibility: visible;
	transition: opacity 0.12s ease-out;
	will-change: opacity;
}

@media (prefers-reduced-motion: reduce) {
	.mm-page-veil.mm-page-veil-fade {
		transition-duration: 0.06s;
	}
}

/* Préchargeur framework (theme.js) — inutilisé, le voile mm-page-veil le remplace. */
.preloader {
	display: none !important;
}

@media (prefers-reduced-motion: reduce) {
	::view-transition-group(*),
	::view-transition-old(*),
	::view-transition-new(*) {
		animation: none !important;
	}
}

/* Bootstrap mini-nav tooltips — fond opaque (pas de transparence Bootstrap par défaut) */
.tooltip.custom-tooltip {
	--bs-tooltip-opacity: 1;
	--bs-tooltip-bg: #f8fafc;
	--bs-tooltip-color: #0f172a;
	opacity: 1 !important;
	transition: none !important;
}

.tooltip.custom-tooltip .tooltip-inner {
	background-color: var(--bs-tooltip-bg);
	color: var(--bs-tooltip-color);
	opacity: 1;
	font-weight: 500;
	font-size: 13px;
	padding: 8px 14px;
	border-radius: 8px;
	border: 1px solid rgba(15, 23, 42, 0.08);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 6px 16px -4px rgba(15, 23, 42, 0.14);
}

html[data-bs-theme="dark"] .tooltip.custom-tooltip {
	--bs-tooltip-bg: #1e293b;
	--bs-tooltip-color: #f1f5f9;
}

html[data-bs-theme="dark"] .tooltip.custom-tooltip .tooltip-inner {
	border-color: rgba(255, 255, 255, 0.1);
	box-shadow:
		0 0 0 1px rgba(255, 255, 255, 0.04),
		0 2px 4px rgba(0, 0, 0, 0.2),
		0 10px 24px -8px rgba(0, 0, 0, 0.5);
}

/* ===================================================================
   Address-search SweetAlert (plugin goo_address_autocomplete)
   This project stacks frosted overlays (html.swal2-shown::before +
   .modal-backdrop backdrop-filter) that can wash out the mobile popup
   when the field is inside a Bootstrap modal. Scoped to the plugin's
   maestra-modal-popup-top class only.
   =================================================================== */
html.swal2-shown:has(.swal2-popup.maestra-modal-popup-top)::before {
	display: none !important;
}

.swal2-container:has(.maestra-modal-popup-top) {
	z-index: 2147483000 !important;
	background: rgba(10, 18, 30, .42) !important;
	-webkit-backdrop-filter: none !important;
	backdrop-filter: none !important;
	pointer-events: auto !important;
}

.swal2-popup.maestra-modal-popup-top {
	background: var(--mm-swal-bg, #fff) !important;
	-webkit-backdrop-filter: none !important;
	backdrop-filter: none !important;
}

/* Google Places dropdown is on <body>; plugin sets z-index 999999 but this
   project's Swal container is higher — suggestions end up behind the footer. */
html.swal2-shown:has(.maestra-modal-popup-top) .pac-container {
	z-index: 2147483001 !important;
	pointer-events: auto !important;
}
