/*****
	Selector universal
    Selecciona todos los elementos. Opcionalmente, puede estar restringido a un espacio de nombre específico o a todos los espacios de nombres.
    Sintaxis: * ns|* *|*
    Ejemplo: * se aplicará a todos los elementos del documento.
*****/


* {
	/* contenidor */
	box-sizing: border-box;
	margin: 0;
}

html,
body {
	height: auto;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	scroll-padding-top: 120px;
}

[id] {
	scroll-margin-top: 120px;
}


/*** Per DOM ***/


body {
	/* contenidor */
	display: flex;
	flex-direction: column;
	height: 100%;
	flex-grow: 1;
	background-color: #fff;

	/* contenidor - contingut */
	margin: 0;
	padding: 0;
	justify-content: center;

	/* contingut */
	font-family: 'OpenSansRegular', Helvetica, Arial, sans-serif;
	align-items: center;
	font-size: 1em;


	header {
		/* contenidor */
		position: sticky;
		flex-shrink: 0;
		display: flex;
		flex-direction: column;
		top: 0;
		left: 0;
		width: 100vw;
		z-index: 3000;
		margin: 0;
		padding: 0;
		color: #fff;

		#menu-hamburguesa {
			display: none;
		}

		/* Primera franja: nav */
		> :first-child {

			/* contenidor */
			display: flex;
			gap: 15px;
			position: relative;
			top: 0;
			left: 0;
			height: 45px;
			margin-bottom: auto;

			/* contenidor - contingut */
			background-color: #222;
			padding: 10px 40px;
			justify-content: center;
			align-items: center;

			/* contingut */
			color: #fff;

			transition: all 0.3s ease-in-out;

			a {
				text-decoration: none;
				color: #fff;
				transition: color 0.3s;
			}


			/* Logo i enllaç Gencat */
			> :first-child {
				/* contenidor - contingut */
				margin-left: 15%;

				#logo_gencat {
					/* contenidor */
					width: auto;
					height: 25px;
				}
			}

			/* Zona reservada per a mostrar el nom del departament */
			> :nth-child(2) {
				/* contenidor */
				opacity: 0;

				/* contenidor - contingut */
				/* contingut */
			}

			/* Menús contacte, idioma i cerca */
			> :nth-child(3) {
				/* contenidor */
				display: flex;
				gap: 15px;

				/* contenidor - contingut */
				background: transparent;
				align-items: center;
				margin-left: auto;
				margin-right: 10%;

				/* contingut */
				font-size: 14px;
				text-decoration: none;
				cursor: pointer;

				a {
					color: #fff;
					text-decoration: none;
					font-size: 14px;
					font-weight: 550;
				}

				ul {
					display: none;
				}

				/* ===== Selector de idioma (CSS Nesting nativo) ===== */
				@supports selector(&) {
					#idiomes-contenidor {
						/* contenedor */
						display: flex;
						border: none;
						gap: 5px;
						position: relative;
						z-index: 3000;

						/* contenedor - contingut */
						padding: 5px 10px;
						align-items: center;

						/* contingut */
						color: white;
						text-decoration: none;
						cursor: pointer;
						font-size: 14px;
						background: transparent;

						/* Botón del desplegable */
						#idiomes-desplegable {
							display: flex;
							gap: 5px;
							align-items: center;
							padding: 5px 10px;
							border-radius: 3px;
							transition: background-color 0.3s;
						}

						/* Icono flecha */
						#idioma-icon {
							width: 12px;
							height: 12px;
							transition: transform 0.3s;
							filter: invert(1) brightness(100%);
							color: white;
						}

						/* Lista oculta por defecto */
						ul {
							display: none;
							position: absolute;
							top: 100%;
							right: 0;
							background: white;
							border: 1px solid #ccc;
							border-radius: 4px;
							list-style: none;
							padding: 0;
							margin: 0;
							min-width: 120px;
							box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
							z-index: 1000;

							li {
								margin: 0;

								a {
									display: block;
									padding: 8px 12px;
									text-decoration: none;
									color: #333 !important;
									transition: background-color 0.3s;

									&:hover {
										background-color: #f5f5f5;
									}
								}
							}
						}

						/* Estado abierto: muestra la lista y rota el icono */
						&.active {
							ul {
								display: block;
							}

							#idioma-icon {
								transform: rotate(180deg);
							}
						}
					}
				}

				/* Logo cerca */
				#logo_cerca {
					/* contenidor */
					width: 16px;
					height: 16px;

					/* contingut */
					font-weight: bold;
					filter: invert(1);
				}
			}
		}

		/* Segona franja */
		> :nth-child(2) {
			/* contenidor */
			display: flex;
			position: relative;
			top: 0px;
			z-index: 1000 !important;
			width: 100%;
			height: 46px;

			/* contenidor - contingut */
			padding: 10px 40px;
			padding-top: 20px;
			background-color: #444;
			text-align: center;

			/* contingut */
			color: #fff;
			background-color: #444;
			font-size: 16px;
			font-weight: normal;
			line-height: 20px;
			text-align: center;
			overflow: visible !important;

			a {
				margin-left: 14%;
				text-decoration: none;
				text-align: center;
				color: #fff;
				font-size: 18px;
				transition: color 0.3s;
			}
		}

		/* Tercera franja */
		> :nth-child(3) {
			/* contenidor */
			display: flex;
			width: 100%;
			height: 65px;
			/* border-top: 2px solid #333; */
			border-bottom: 1px solid #d0cbcb;

			/* contenidor - contingut */
			align-items: center;
			justify-content: center;
			text-align: center;
			background-color: white;

			/* contingut */

			span {
				color: #dddddd;
			}

			ul {
				/* contenidor */
				display: flex;
				gap: 15px;
				padding: 0;
				margin: 0;
				height: 100%;
				/* contenidor - contingut */
				justify-content: center;
				align-items: center;
				/* contingut */
				list-style: none;

				.paginaActual a {
					position: relative;
					border-bottom: 4px solid rgba(180, 14, 14, 0.6);
				}

				li {
					/* contenidor */
					display: flex;
					height: 100%;
					padding: 0 20px;
					position: relative;
					/* contenidor - contingut */
					align-items: center;

					a {
						/* contenidor */
						position: relative;
						display: flex;
						height: 100%;
						padding: 0 20px;

						/* contenidor - contingut */
						align-items: center;

						/* contingut */
						text-decoration: none;
						color: #3a3a3a;
						font-weight: 550;

						&:hover {
							border-bottom: 3px solid #c00;
							width: 100%;
						}

						:hover::after {
							opacity: 1;
						}

						&::after {
							content: "";
							position: absolute;
							bottom: 0;
							left: 0;
							width: 100%;
							height: 4px;
							background-color: #c00;
							opacity: 0;
						}
					}
				}
			}
		}

	}

	&.scrolled {
		header {
			> :first-child {
				position: fixed;
				top: 0;
				left: 0;
				width: 100%;
				z-index: 9999;

				> :nth-child(2) {
					display: flex;
					opacity: 1;
					align-items: center;

					&::before {
						margin: 0 10px;
						content: "| ";
						color: #fff;
						font-weight: bold;
					}
				}
			}

			> :nth-child(2) {
				display: none;
			}

			> :nth-child(3) {
				margin-top: 45px;
			}
		}

		.ruta-navegacio-container {
			transform: translateY(-100%);
			opacity: 0;
			pointer-events: none;
		}
	}

	/* Contenidor de columnes/barres */

	#contenidor {
		/* contenidor */
		display: flex;
		flex: 1;
		/* flex-direction: column; */
		position: relative;
		flex-wrap: nowrap;
		width: 100%;

		.ocult {
			display: none !important;
		}

		#mostrarMenuEsquerra {
			position: absolute;
			top: 200px;
			left: 15px;
			z-index: 999;
			display: none;
			background-color: #c00;
			color: white;
			border: none;
			/* padding: 10px 15px; */
			border-radius: 5px;
			cursor: pointer;
			font-size: 20px;
			box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
		}

		/* Columna main */
		main {
			/* contenidor */
			/* max-width: 1200px; */
			display: flex;
			flex: 1 0 auto;
			overflow: visible;
			margin: 0 auto;
			background-color: white;


			/* contenidor - contingut */
			/* padding: 20px; */
			overflow: visible;

			/* contingut */
			line-height: 1.6;


			flex-direction: column;
			/* align-items: center; */
			justify-content: space-between;
			width: 100%;

			h2 {
				text-align: center;
			}

			summary {
				cursor: pointer;
				font-weight: bold;
				list-style: none;
				outline: none;
				text-align: left;
			}

			table {
				width: 100%;
				margin-top: 15px;
			}

			/* Saltos de página */
			h3,
			table,
			.question {
				page-break-inside: avoid;
				/* Evita cortes en medio de tablas */
			}

			thead {
				border-bottom: 2px solid black;
			}

			thead .colored-cell {
				background-color: #f0f0f0;
			}

			td,
			th {
				padding: 10px;
				text-align: left;
				border: 1px solid black;
			}
		}
	}

	/* Estils de la página principal Index.html i tutorial.html */

	/* Contenedor de ancho completo para el breadcrumb */
	.ruta-navegacio-container {
		position: sticky;
		top: 156px;
		z-index: 1000;
		background-color: rgba(245, 245, 245, 0.95);
		backdrop-filter: blur(4px);
		width: 100%;
		padding: 20px 0 10px 0;
		margin: 0;
		box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);

		/* Contenedor interno centrado */
		.ruta-navegacio {
			max-width: 1200px;
			margin: 0 auto;
			padding: 10px 40px;
			font-family: 'OpenSansRegular', Helvetica, Arial, sans-serif;
			font-size: 14px;
			color: #333;

			h1 {
				font-size: 24px;
				color: #333;
				margin-top: 20px;
				margin-bottom: 10px;
			}

			.llista-molles {
				display: flex;
				list-style: none;
				margin: 0;
				padding: 0;
				align-items: center;
			}

			.item-molles {
				display: flex;
				align-items: center;

				.enllac-molles {
					text-decoration: none;
					transition: color 0.3s, transform 0.3s, font-weight 0.3s;
					font-weight: 500;
					color: black;
					border-bottom: 1px solid black;

					&:hover {
						transform: scale(1.1);
						font-weight: 700;
					}
				}
			}

			.separador-molles {
				color: #999;
				margin: 0 8px;
				font-weight: normal;
			}
		}
	}

	#paginaPrincipal-inici {
		display: table-column;
		max-width: 1200px;
		padding: 10px 40px;
		line-height: 1.8;
		margin: 0 auto;
		margin-top: 10%;
		margin-bottom: 5%;
		color: #333;
		background-color: #fff;
		font-family: 'OpenSansRegular', Helvetica, Arial, sans-serif;

		/* Ajustes de márgenes y espaciado para los elementos */

		h2 {
			color: #333;
			font-size: 26px;
			margin-top: 40px;
			margin-bottom: 15px;
			font-weight: 600;
		}

		h3 {
			color: #444;
			font-size: 22px;
			margin-top: 30px;
			margin-bottom: 10px;
			font-weight: bold;
		}

		p {
			color: #666;
			margin-bottom: 20px;
			font-size: 16px;
			line-height: 1.6;
			text-align: justify;
		}

		ul {
			margin-bottom: 20px;
			padding-left: 20px;
			list-style-type: disc;
		}

		li {
			margin-bottom: 10px;
		}

		a {
			/* color: #c00;  */
			text-decoration: none;
			transition: color 0.3s ease;

			&:hover {
				color: #900;
			}
		}

		iframe {
			margin: 30px 0;
			width: 100%;
			max-width: 560px;
			height: 315px;
			border: 1px solid #ddd;
			box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
		}

		.seccio-contingut {
			margin: 30px 0;
			padding: 20px;
			background-color: #f8f8f8;
			border-left: 4px solid #c00;

			h2 {
				color: #333;
				font-size: 22px;
				margin-bottom: 15px;
			}

			p {
				margin-bottom: 15px;
				line-height: 1.6;
			}

			ul,
			ol {
				margin-bottom: 15px;
				padding-left: 20px;

				li {
					margin-bottom: 8px;
				}
			}

		}

		/* Mejorar la separación entre párrafos */
		p+p {
			margin-top: 25px;
		}

		details[open] summary img {
			transform: rotate(180deg);
		}

		details {
			margin-bottom: 20px;
			border-bottom: 1px solid #eee;
			padding-bottom: 15px;
		}

		/* Estilo para el globus de "Model del qualitat del CFCC" */
		.globus-model-qualitat {
			/* position: relative;
			overflow: hidden;  */
			right: 20px;
			top: 200px;
			width: 300px;
			display: flex;
			flex-direction: column;
			gap: 15px;
			margin-right: 250px;
			padding: 20px;
			z-index: 1000;
			background: #fff;
			transition: transform 0.3s ease, box-shadow 0.3s ease;

		}

		/* Estilo para el enlace dentro del globo */
		.enllac-model-qualitat {
			display: inline-flex;
			padding: 10px;
			justify-content: center;
			gap: 8px;
			/* border-radius: 5px; */
			box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
			transition: background-color 0.3s, color 0.3s, transform 0.3s, box-shadow 0.3s;
			/* Agregado para la transición del crecimiento y sombra */
			font-size: 18px;
			font-weight: bold;
			color: #333;
			text-decoration: none;
			background-color: #f5f5f5;

			align-items: center;
			text-align: center;

			.icona-enllac {
				width: 12px;
				height: 12px;
				vertical-align: middle;
			}
		}

		/* Estilo al pasar el ratón sobre el enlace */
		.enllac-model-qualitat:hover {
			text-decoration: underline;
			transform: scale(1.08);
			box-shadow:
				0px 10px 24px rgba(0, 0, 0, 0.3),
				0px 3px 10px rgba(0, 0, 0, 0.15),
				0px -2px 6px rgba(0, 0, 0, 0.08);
			color: #333;
		}
	}

	#paginaPrincipal {
		display: table-column;
		max-width: 1200px;
		padding: 10px 40px;
		line-height: 1.8;
		margin: 0 auto;
		/* margin-top: 10%; */
		/* margin-bottom: 5%; */
		color: #333;
		background-color: #fff;
		font-family: 'OpenSansRegular', Helvetica, Arial, sans-serif;

		/* Ajustes de márgenes y espaciado para los elementos */

		h2 {
			color: #333;
			font-size: 26px;
			margin-top: 40px;
			margin-bottom: 15px;
			font-weight: 600;
		}

		h3 {
			color: #444;
			font-size: 22px;
			margin-top: 30px;
			margin-bottom: 10px;
			font-weight: bold;
		}

		p {
			color: #666;
			margin-bottom: 20px;
			font-size: 16px;
			line-height: 1.6;
			text-align: justify;
		}

		ul {
			margin-bottom: 20px;
			padding-left: 20px;
			list-style-type: disc;
		}

		li {
			margin-bottom: 10px;
		}

		a {
			/* color: #c00;  */
			text-decoration: none;
			transition: color 0.3s ease;

			&:hover {
				color: #900;
			}
		}

		iframe {
			margin: 30px 0;
			width: 100%;
			max-width: 560px;
			height: 315px;
			border: 1px solid #ddd;
			box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
		}

		.seccio-contingut {
			margin: 30px 0;
			padding: 20px;
			background-color: #f8f8f8;
			border-left: 4px solid #c00;

			h2 {
				color: #333;
				font-size: 22px;
				margin-bottom: 15px;
			}

			p {
				margin-bottom: 15px;
				line-height: 1.6;
			}

			ul,
			ol {
				margin-bottom: 15px;
				padding-left: 20px;

				li {
					margin-bottom: 8px;
				}
			}

		}

		/* Mejorar la separación entre párrafos */
		p+p {
			margin-top: 25px;
		}

		details[open] summary img {
			transform: rotate(180deg);
		}

		details {
			margin-bottom: 20px;
			border-bottom: 1px solid #eee;
			padding-bottom: 15px;
		}

		/* Estilo para el globus de "Model del qualitat del CFCC" */
		.globus-model-qualitat {
			/* position: relative;
			overflow: hidden;  */
			right: 20px;
			top: 200px;
			width: 300px;
			display: flex;
			flex-direction: column;
			gap: 15px;
			margin-right: 250px;
			padding: 20px;
			z-index: 1000;
			background: #fff;
			transition: transform 0.3s ease, box-shadow 0.3s ease;

		}

		/* Estilo para el enlace dentro del globo */
		.enllac-model-qualitat {
			display: inline-flex;
			padding: 10px;
			justify-content: center;
			gap: 8px;
			/* border-radius: 5px; */
			box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
			transition: background-color 0.3s, color 0.3s, transform 0.3s, box-shadow 0.3s;
			/* Agregado para la transición del crecimiento y sombra */
			font-size: 18px;
			font-weight: bold;
			color: #333;
			text-decoration: none;
			background-color: #f5f5f5;

			align-items: center;
			text-align: center;

			.icona-enllac {
				width: 12px;
				height: 12px;
				vertical-align: middle;
			}
		}

		/* Estilo al pasar el ratón sobre el enlace */
		.enllac-model-qualitat:hover {
			text-decoration: underline;
			transform: scale(1.08);
			box-shadow:
				0px 10px 24px rgba(0, 0, 0, 0.3),
				0px 3px 10px rgba(0, 0, 0, 0.15),
				0px -2px 6px rgba(0, 0, 0, 0.08);
			color: #333;
		}
	}

	#btnScrollTop {
		position: fixed;
		bottom: 100px;
		right: 10%;
		z-index: 1000;
		background-color: #c00;
		color: white;
		border: none;
		padding: 10px 15px;
		border-radius: 50%;
		font-size: 20px;
		cursor: pointer;
		display: none;
		/* oculto por defecto */
		box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);

		&:hover {
			background-color: #b40e0e;
		}
	}

	/* Estils Peu */
	.footer-guia {
		width: 100%;
		;
		margin-top: auto;
		margin: 0;
		margin-top: 20px;
		padding: 0;
		position: absolute;
		left: 0px;
		bottom: 0px;
		z-index: 9999;
		font-family: Arial, sans-serif;


		/* nav:first-of-type {
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 10px 40px;
			background-color: #f9f9f9;
			font-size: 14px;
			color: #333;

			p {
				margin: 0;
				flex: 1;
				text-align: center;
			}

			#logos-XXSS {
				display: flex;
				margin-right: 25%;
				gap: 8px;

				a {
					display: inline-flex;
					justify-content: center;
					align-items: center;
					padding: 10px;
					border-radius: 50%;
					transition: background-color 0.3s;
					background-color: #eceaea;

					img {
						width: 12px;
						height: 12px;
						transition: filter 0.3s;
					}

					&:hover {
						background-color: #222;

						img {
							filter: brightness(0) invert(1);
						}
					}
				}
			}
		}

		nav:nth-of-type(2) {
			display: flex;
			justify-content: space-between;
			flex-wrap: wrap;
			padding: 5px 40px;
			align-items: center;
			background-color: #222;
			color: white;


			.logoPeuGeneral img {
				height: 30px;
				margin-left: 250px;
			}

			.enllacos-peu {
				display: flex;
				flex-wrap: wrap;
				margin-right: 150px;
				gap: 10px;
				font-size: 12px;
				align-items: center;

				a {
					color: white;
					text-decoration: none;
					display: flex;
					align-items: center;
				}

				.icona-enllac {
					width: 12px;
					height: 12px;
					margin-left: 5px;
					filter: invert(1) brightness(100%);
				}
			}
		} */
	}

	footer {
		width: 100%;
		;
		margin-top: auto;
		margin: 0;
		padding: 0;
		position: relative;
		left: 0px;
		bottom: 0px;
		z-index: 9999;
		font-family: Arial, sans-serif;


		nav:first-of-type {
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 10px 40px;
			background-color: #f9f9f9;
			font-size: 14px;
			color: #333;

			p {
				margin: 0;
				flex: 1;
				text-align: center;
			}

			#logos-XXSS {
				display: flex;
				margin-right: 25%;
				gap: 8px;

				a {
					display: inline-flex;
					justify-content: center;
					align-items: center;
					padding: 10px;
					border-radius: 50%;
					transition: background-color 0.3s;
					background-color: #eceaea;

					img {
						width: 12px;
						height: 12px;
						transition: filter 0.3s;
					}

					&:hover {
						background-color: #222;

						img {
							filter: brightness(0) invert(1);
						}
					}
				}
			}
		}

		nav:nth-of-type(2) {
			display: flex;
			justify-content: space-between;
			flex-wrap: wrap;
			padding: 5px 40px;
			align-items: center;
			background-color: #222;
			color: white;


			.logoPeuGeneral img {
				height: 30px;
				margin-left: 250px;
			}

			.enllacos-peu {
				display: flex;
				flex-wrap: wrap;
				margin-right: 150px;
				gap: 10px;
				font-size: 12px;
				align-items: center;

				a {
					color: white;
					text-decoration: none;
					display: flex;
					align-items: center;
				}

				.icona-enllac {
					width: 12px;
					height: 12px;
					margin-left: 5px;
					filter: invert(1) brightness(100%);
				}
			}
		}
	}

	/* Avis de càrrega */
	.aviso-carrega {
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		background-color: rgba(255, 255, 255, 0.95);
		display: flex;
		justify-content: center;
		align-items: center;
		z-index: 9999;
		font-family: Arial, sans-serif;
	}

	.aviso-contingut {
		text-align: center;
		background: white;
		padding: 2rem;
		border-radius: 10px;
		box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
		border: 1px solid #e0e0e0;
		max-width: 300px;
	}

	.aviso-spinner {
		width: 40px;
		height: 40px;
		border: 3px solid #f3f3f3;
		border-top: 3px solid #b40e0e;
		border-radius: 50%;
		/* Estado inicial: sin giro */
		transform: rotate(0deg);
		/* Transición para completar 1 vuelta en ~0.9s (como la barra) */
		transition: transform 0.9s linear;
		will-change: transform;
		margin: 0 auto 1rem;
	}


	.aviso-carrega p {
		margin: 0;
		color: #333;
		font-size: 16px;
		font-weight: bold;
	}

	.aviso-descripcio {
		font-size: 14px !important;
		font-weight: normal !important;
		color: #666 !important;
		margin-top: 0.5rem !important;
		margin-bottom: 1rem !important;
	}

}

/* Asegura que el contenedor principal nunca quede debajo de los menús fijos */
.contenidor-info,
#contenidor-info,
.contingut-dret {
	scroll-margin-top: 156px;
	/* misma altura de los menús */
}

/* suaviza el ajuste cuando se aplica padding-top dinámico */
.contingut-dret,
.globus-de-preguntes.sidebar-faq {
	transition: padding-top 0.12s ease;
}
body,
html {
  height: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: visible;
  overflow-x: hidden;

  .sidebar-section.mostrar-al-carregar .submenu-container {
    display: block;
  }

  /*#contenidor,*/
  main {
    position: relative;
    display: block;
    flex: 1 0 auto;
    padding-top: 150px;
    margin-top: 0;
    overflow: visible !important;
    height: auto !important;

  }

  input[list]:focus,
  select:focus {
    scroll-margin-top: 0 !important;
    outline: none;
  }

  .submenu-faq.actiu>a,
  .submenu-faq a.actiu {
    color: #c40000 !important;
    font-weight: 600;
  }

  .submenu-faq.actiu {
    background-color: transparent;
  }


  /* Sidebar FAQ */
  .globus-de-preguntes.sidebar-faq {
    max-width: 320px;
    width: 400px;
    margin-right: auto;
    margin-top: 5%;
    /*modificat*/
    margin-bottom: 5%;
    padding: 0;
    padding-top: 8px;
    display: block;
    flex-direction: column;
    gap: 20px;
    /* overflow-y: visible;  */
    overflow-y: auto;
    overflow-x: visible;
    flex-grow: 1;
    align-self: flex-start;
    position: sticky;

    height: 100vh;
    /* max-height: none; */
    max-height: calc(100vh - 80px);
    flex-shrink: 0;
    z-index: 998;
    background: transparent;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  }

  /* Para columna derecha */
  .globus-de-preguntes.sidebar-faq[data-posicio="dreta"] {
    bottom: 60px;
  }

  /* Ocultar con transiciÃ³n */
  .ocultar-scroll {
    transform: translateY(-100%);
    transition: transform 0.3s ease-in-out;
  }

  .sidebar-section {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    word-wrap: break-word;
    margin-bottom: 20px;
    margin-top: 5px;
    scroll-margin-top: 180px;
    border-radius: 5px;
    padding: 20px;
    border-top: 6px solid #c00;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    transform-origin: center;
    pointer-events: auto;
    background-color: #ffff;
    cursor: pointer;
    overflow: visible !important;
    position: relative !important;

    .mostrar-al-carregar .submenu-container {
      display: block;
    }

    &:hover {
      transform: scale(1.02);
      box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    }

    .titol-menu-faq {
      display: flex;
      justify-content: space-between;
      /* align-items: center; */
      position: relative;
      padding-right: 10px;
      margin-bottom: 12px;
      color: #333;
      font-weight: bold;
      font-size: 1.1rem;
      cursor: pointer;
      transition: text-decoration 0.3s;

      &:hover {
        text-decoration: underline;
      }
    }

    .submenu-container {
      margin-top: 10px;
      overflow: visible;
      max-height: none;
      height: auto;
      display: none;

      ul {
        list-style: none;
        padding: 0;
        margin: 0;
      }


      .submenu-faq {
        margin: 10px 0;
        padding-left: 10px;
        border-left: 2px solid #ddd;
        cursor: pointer;
        transition: border-color 0.2s, background-color 0.2s;
        position: relative;

        &:hover {
          border-left-color: #c00;
        }

        &.actiu {
          /* border-left-color: #c00; -- ELIMINAT PERQUÈ SIGUI GRIS */
          /* border-left: 4px solid #c00; -- ELIMINAT PERQUÈ SIGUI PRIM */

          /* Mantenim el color del text actiu o el deixem gris? 
         L'usuari diu "marquin el marge lateral esquerra en vermell només quan passes per sobre".
         Per tant, aquí no posem vermell, només mostrem el contingut. */

          >a,
          .submenu-toggle {
            /* color: #c00; -- ELIMINAT */
            font-weight: bold;
            /* Mantenim negreta per indicar obertura? O no? L'usuari no ho ha especificat, però millor deixar-ho per coherència */
          }

          .sub-submenu {
            display: block !important;
            opacity: 1;
            max-height: 1000px;
            /* Augmentat per si de cas */
            transition: all 0.3s ease;
          }
        }

        a {
          color: #333;
          text-decoration: none;
          display: block;

          &:hover {
            color: #c00;
            text-decoration: underline;
          }
        }

        .sub-submenu {
          display: none;
          opacity: 0;
          max-height: 0;
          overflow: hidden;
          margin-left: 15px;
          padding-left: 10px;
          border-left: 1px dashed #ddd;
          transition: all 0.3s ease;

          li {
            margin: 8px 0;
            padding-left: 5px;
            transition: all 0.2s;

            &:hover {
              border-left: 2px solid #c00;
              padding-left: 8px;
            }
          }

          a {
            color: #666;
            font-size: 14px;
            position: relative;

            &:hover {
              color: #c00;
              text-decoration: underline;
            }

            /* Estilo para opciÃ³n seleccionada */
            &.selected {
              color: #c00;
              font-weight: bold;
              background-color: #fff3f3;
              padding: 4px 6px;
              border-radius: 4px;

              &::after {
                content: "✓";
                margin-left: 5px;
                color: #c00;
              }
            }
          }
        }
      }

      select {
        padding: 8px;
        border: 1px solid #ddd;
        background: #fff;
        transition: border 0.2s;

        p {
          width: 100%;
          margin: 10px 0;
          font-size: 14px;
        }

        &:focus {
          border-color: #000;
          box-shadow: 0 0 0 2px rgba(191, 0, 0, 0.1);
          outline: none;
        }
      }

      .llista-formulari {
        list-style: none;
        padding: 0;
        margin: 0;

        li {
          margin-bottom: 15px;
          position: relative;

          label {
            display: block;
            margin-bottom: 5px;
            font-size: 0.9em;
            color: #555;
            scroll-margin-top: 0 !important;
          }

          select {
            width: 100%;
          }
        }

        .nivell-1 {
          margin-left: 0;
        }

        .nivell-2 {
          margin-left: 15px;

          &::before {
            content: "";
            position: absolute;
            left: -10px;
            top: 20px;
            height: 1px;
            width: 10px;
            background-color: #ddd;
          }
        }

        .nivell-3 {
          margin-left: 30px;

          &::before {
            content: "";
            position: absolute;
            left: -10px;
            top: 20px;
            height: 1px;
            width: 10px;
            background-color: #ddd;
          }

          &::after {
            content: "";
            position: absolute;
            left: -25px;
            top: -15px;
            height: calc(100% + 15px);
            width: 1px;
            background-color: #ddd;
          }
        }

        .nivell-4 {
          margin-left: 45px;

          &::before {
            content: "";
            position: absolute;
            left: -10px;
            top: 20px;
            height: 1px;
            width: 10px;
            background-color: #ddd;
          }

          &::after {
            content: "";
            position: absolute;
            left: -40px;
            top: -15px;
            height: calc(100% + 15px);
            width: 1px;
            background-color: #ddd;
          }
        }

        .nivell-5 {
          margin-left: 50px;

          &::before {
            content: "";
            position: absolute;
            left: -10px;
            top: 20px;
            height: 1px;
            width: 10px;
            background-color: #ddd;
          }

          &::after {
            content: "";
            position: absolute;
            left: -45px;
            top: -15px;
            height: calc(100% + 15px);
            width: 1px;
            background-color: #ddd;
          }
        }
      }
    }

    .submenu-container.visible {
      display: block;
    }

    .select-sin-movimiento {
      -webkit-tap-highlight-color: transparent;
      touch-action: manipulation;
      /* transform: translateZ(0);  */
    }

    .select-sin-movimiento:focus {
      -webkit-tap-highlight-color: transparent;
      touch-action: manipulation;
    }

    /* Prevenir saltos en iOS */
    @supports (-webkit-overflow-scrolling: touch) {
      .select-sin-movimiento {
        transform: translateZ(0);
      }
    }

  }

  select:focus {
    scroll-margin-top: 0px !important;
    scroll-behavior: auto !important;
    outline: none;
    /* nomÃ©s si visualment vols evitar el ressaltat */
  }

  /* Estilo uniforme para select e input list */
  select.select-sin-movimiento,
  input[list].select-sin-movimiento {
    width: 100%;
    font-size: 0.95rem;
    background-color: transparent;
    border: 1px solid #ccc;
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    appearance: none;
    -webkit-appearance: none;
    transition: border 0.2s ease, box-shadow 0.2s ease;
    border-radius: 10px;

    &:hover,
    :focus {
      border-color: #b40e0e;
      box-shadow: 0 0 0 2px rgba(191, 0, 0, 0.1);
      outline: none;
    }
  }

}

.ocultar-moduls {
  display: none !important;
}

.asterisc-obligatori {
  color: #c0392b;
  /* rojo discreto */
  margin-left: 0.25rem;
  font-weight: bold;
}


/* scroll */
.globus-de-preguntes.sidebar-faq.fixat-despres-scroll {
  position: sticky;
  top: calc(60px + 10px);
  z-index: 999;
  max-height: calc(100vh - 80px);
  overflow-y: visible;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease-in-out;
}

.sidebar-scroll-inner {
  max-height: inherit;
  overflow-y: auto;
  overflow-x: visible;
  position: relative;
  z-index: 1;
}

/* Contingut dret entre les dues columnes */
.contingut-dret.fixat-despres-scroll {
  left: 400px;
  right: 400px;
  width: calc(100% - 800px);
  /* Deja margen fijo para sidebars */
}

.globus-de-preguntes.sidebar-faq.scrolled,
.contingut-dret.scrolled {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  /* background-color: #f9fafb; */
  z-index: 999;
}

.contenidor-info.contenidor-fixat {
  /* position: sticky; */
  position: relative;
  top: 50px;
  z-index: 900;
  background-color: #fff;
}

.tooltip-icon {
  cursor: pointer;
  font-size: 0.9em;
  margin-left: 6px;
  position: relative;
  display: inline-block;
}

.tooltip-icon::after {
  content: attr(aria-label);
  position: absolute;
  bottom: 100%;
  right: 0;
  top: -25px;
  transform: translateY(-10px);
  background-color: #f0f0f0;
  color: #333;
  padding: 6px 8px;
  border-radius: 4px;
  white-space: pre-line;
  font-size: 0.75em;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  width: 260px;
  text-align: left;
  z-index: 5000;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}


.tooltip-icon:hover::after {
  opacity: 1;
}

.tooltip-icon::after {
  z-index: 9999 !important;
}

/* scroll FI*/
.menuEntorn {
  position: relative;
  top: 0;
  z-index: 4000;
  background-color: #fff;
}

/* Contenedor principal */
.contenidor-info {
  margin-bottom: 20px;
  position: relative !important;
  top: 40px;
  display: flex;
  z-index: 900;
  flex: 1 0 auto;
  flex-direction: row;
  margin: 0 auto;
  max-width: 1500px;
  justify-content: center;
  align-items: flex-start;
  align-content: flex-start;
  /* padding: 140px 40px 40px; */
  gap: 20px;

  /* overflow: visible !important;
  max-height: none !important; */
  .globus-de-preguntes.globus-central {
    top: 20px;
    width: 320px;
    min-width: 260px;
    max-width: 320px;
    padding: 20px;
    margin-left: 50px;
    background-color: #f5f5f5;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    font-size: 14px;
    color: #333;
    height: fit-content;
    align-self: flex-start;
    overflow-y: auto;
    max-height: calc(100vh - 60px);
  }

  /* Contenido derecho */
  .contingut-dret {
    position: sticky;
    height: auto;
    max-height: 70vh;
    min-height: 400px;
    width: 50vw;
    max-width: 1500px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow-y: auto;
    overflow-x: auto;
    top: 70px;
    right: 0;
    bottom: 0;
    z-index: 999;
    scroll-behavior: auto !important;
    contain: none;
    overscroll-behavior: none;
    display: flex;
    flex-direction: column;
    margin-top: 20px;
    box-sizing: border-box;
    gap: 10px;
    padding: 20px;
    background-color: #f9fafb;
    overflow-anchor: none;
    margin-bottom: 60px;

    .globus-conversa.resposta.activa {
      display: block !important;
      visibility: visible !important;
      opacity: 1 !important;
      max-height: unset !important;
    }

    /* scroll-behavior: smooth; */
    .globus-conversa.resposta {
      scroll-margin-top: 200px;
      display: none;
      padding: 40px;

      /* margin-bottom: 180px !important; */
      .bloc-resultats,
      details {
        display: flex;
        flex-direction: column;
        gap: 5px;
        padding: 10px;

        h3 {
          margin-top: 15px;
          font-size: 1rem;
          font-weight: 600;
          color: #222;
          line-height: 2;
        }

        p {
          margin: 0;
          padding-left: 10px;
          line-height: 1.55;
          text-align: justify;
        }
      }
    }

    .detall-variants-instruments summary {
      cursor: pointer;
      font-weight: 600;
      display: block;
      margin-top: 0.5rem;
      margin-bottom: 0.25rem;
      margin-left: 12px;
    }

    .llista-variants-instruments {
      margin: 0.5rem 0 0 1rem;
      padding-left: 1rem;
    }

    .xat-missatge {
      /* display: flex; */
      /* flex-direction: column; */
      gap: 1rem;
      display: block;

    }

    .estat-buit {
      text-align: center;
      color: #666;
      padding: 2rem;
      font-style: italic;
    }


    .xat-missatge.ocult {
      display: none !important;
    }


    .contingut-dret .globus-conversa.pregunta[style*="display: block"],
    .contingut-dret .globus-conversa.resposta[style*="display: block"] {
      display: block !important;
    }


    /* InformaciÃ³n de curso y mÃ³dulo */
    .globus-conversa.resposta#curso-info,
    .globus-conversa.resposta#modulo-info {
      display: flex;
      flex-direction: column;
      gap: 5px;
      padding: 15px;

      h3 {
        font-size: 1rem;
        font-weight: 600;
        color: #222;
        line-height: 1.4;

        &:first-child {
          margin-top: 0;
        }
      }

      p {
        margin: 0;
        line-height: 1.55;
        text-align: justify;
      }

      p+h3 {
        margin-top: 1rem;
      }

      a {
        color: #b20e0e;
        text-decoration: underline;

        &:hover {
          text-decoration: none;
        }
      }
    }

    .bloc-seccio-avaluacio {
      margin-bottom: 1.5rem;
      padding: 1rem;
      background: #fff;
      border-left: 1px solid #c00;

      h2 {
        margin-bottom: 0.75rem;
        font-size: 1.2rem;
        color: #c00;
      }

      h3 {
        font-size: 1.1rem;
        font-weight: 600;
        margin-top: 1.2em;
        margin-bottom: 0.5em;
        color: #333;
        padding-left: 0;
      }

      p {
        margin-left: 1rem;
        text-indent: 1rem;
      }

      ol {
        padding-left: 1.5rem;
        margin-top: 0.5rem;
      }

      li {
        margin-bottom: 0.75rem;
        line-height: 1.5;
      }

    }
  }

  /* Selects */
  #moduls,
  #moduls2,
  #nom-curs,
  #nom-curs2,
  #area-professional2,
  #area-professional,
  #familia-professional2,
  #familia-professional,
  #programa2,
  #select-avaluacio,
  #select-fonaments,
  #modalitat,
  .select-avaluacio,
  .select-fonaments,
  .programa2,
  .familia-professional2,
  .area-professional2 {
    width: 250px;
    padding: 10px 30px 10px 10px;
    font-size: 0.95rem;
    cursor: pointer;
    position: relative;
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
  }

  /* Globus conversaciÃ³n */
  .globus-conversa {
    max-width: 90%;
    padding: 16px 20px;
    margin-bottom: 16px;
    border-radius: 12px;
    position: relative;
    font-size: 1rem;
    line-height: 1.6;
    word-break: break-word;
    word-wrap: break-word;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: none;
    position: relative;
    background-color: #fff;
    color: #212529;


    &.pregunta {
      position: relative;
      margin-left: auto;
      background-color: #f7efef;
      border-radius: 8px 0 8px 8px;
      border: 1px solid #ccc;
      margin-top: 10px;
    }

    &.resposta {
      position: relative;
      margin-right: auto;
      background: #fff;
      border-radius: 0 8px 8px 8px;
      border: 1px solid #ccc;

      &::before {
        content: "";
        position: absolute;
        top: 12px;
        left: -11px;
        border-width: 10px 10px 10px 0;
        border-style: solid;
        border-color: transparent #ccc transparent transparent;
        z-index: 1;
      }

      &::after {
        content: "";
        position: absolute;
        top: 13px;
        left: -9px;
        border-width: 9px 9px 9px 0;
        border-style: solid;
        border-color: transparent #fff transparent transparent;
        z-index: 2;
      }
    }
  }

  /* TÃ­tulos de subapartados */
  .titol-subapartat {
    font-size: 1.5em;
    margin-top: 20px;
    margin-bottom: 10px;
    color: #c00;
    border-bottom: 2px solid #c00;
    padding-bottom: 5px;
  }

  .bloc-subapartat {
    margin-bottom: 20px;
  }

  /* Nuevo estilo para el botÃ³n (combinando funcionalidad con el estilo deseado) --- Modificat, afegit left per amagra-lo a la dreta de la pantalla---*/
  .boto-exportar-pdf {
    background: #c00;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    width: 65%;
    max-width: 260px;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 20px;
    font-size: 12px;
    color: blanchedalmond;
    text-align: center;
    position: relative;
    left: 48%;
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s ease, transform 0.2s ease;
    clip-path: polygon(20px 0, 100% 0, 100% 100%, 20px 100%, 0 50%);

    a {
      text-decoration: none;
      color: blanchedalmond;
    }

    &:hover {
      background-color: #a00 !important;
      transform: translateY(-15%) translateX(-70%);
      /* Modificat -- afegit translateX, per que aparegui des de la dreta de l a pantalla en passar per sobre*/
      color: blanchedalmond !important;
    }

    /*&:active {
          transform: translateY(-5%) scale(0.98);
      }*/
  }

  /* --- Modificat, afegit left per amagra-lo a la dreta de la pantalla---*/
  .neteja-xat,
  .imprimir,
  .descarregar {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    width: 65%;
    max-width: 260px;
    justify-content: space-between;
    font-size: 12px;
    /* font-weight: bold; */
    background-color: #c00;
    color: blanchedalmond;
    align-items: center;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    text-align: center;
    position: relative;
    left: 48%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s ease, transform 0.2s ease;
    clip-path: polygon(20px 0, 100% 0, 100% 100%, 20px 100%, 0 50%);

    .visible {
      display: inline-block;
    }

    &:hover {
      background-color: #a00;
      transform: translateY(-15%) translateX(-70%);
      /* Modificat -- afegit translateX, per que aparegui des de la dreta de l a pantalla en passar per sobre*/
    }

    /*&:active {
      transform: translateY(-50%) scale(0.98);
    }*/
    .estatic {
      position: static;
      transform: none;
      top: auto;
      right: auto;
      clip-path: none;
      margin: 5px 10px;
    }

    .ocultar {
      display: none !important;
    }
  }

  .boto-exportar-pdf .text,
  .neteja-xat .text,
  .imprimir .text,
  .descarregar .text {
    flex: 1;
    text-align: center;
  }

  .neteja-xat .icon,
  .imprimir .icon,
  .descarregar .icon,
  .boto-exportar-pdf .icon {
    width: 18px;
    height: 18px;
    filter: invert(1);
    flex-shrink: 0;
  }


  .botons-xat {
    position: fixed;
    bottom: 50px;
    right: 10px;
    margin-bottom: 100px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: left;
    gap: 12px;
    z-index: 9999;
    pointer-events: auto;

    .ocultar {
      display: none !important;
    }

  }

  /* Autocompletat amb ombra visual */
  .envoltori-autocompletar {
    position: relative;
    width: 100%;

    /* margin-bottom: 20px; */
    label {
      display: block;
      margin-bottom: 6px;
      font-weight: 500;
    }

    .camp-autocompletar {
      position: relative;
      width: 100%;
    }

    .input-usuari {
      position: relative;
      background: transparent;
      z-index: 2;
      will-change: contents;
    }

    .missatge-no-resultats {
      position: absolute;
      bottom: 50px;
      right: 12px;
      color: #c00;
      display: none;
      pointer-events: none;
      z-index: 3;
      font-size: 12px;
      transition: opacity 0.2s ease;
    }

    input[list]::-webkit-calendar-picker-indicator {
      display: none !important;
    }

    input[list] {
      position: relative;
      z-index: 1;
    }
  }
}

/* --- ICONA FILTRE MODULS --- */
.camp-autocompletar--moduls-filtrats {
  position: relative;

  .input-usuari {
    padding-right: 2.5rem;
  }

  .icona-filtre-moduls {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    z-index: 3;

    svg {
      width: 100%;
      height: 100%;
      fill: currentColor;
    }
  }
}

.missatge-sense-moduls {
  font-size: 0.85rem;
  margin-top: 4px;
  color: #b3261e;
}

.globus-conversa.resposta.collapsada .contingut-colapsable {
  max-height: 350px;
  overflow: hidden;
  position: relative;
}


/* Gradiente al final del texto */
.globus-conversa.resposta.collapsada .contingut-colapsable::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  height: 40px;
  width: 100%;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff);
  pointer-events: none;
}

/* BotÃ³n debajo del contenido colapsado */
.globus-conversa.resposta .mostrar-mes-btn {
  display: block;
  margin-top: 8px;
  text-align: center;
  margin: 0 auto;
  background: none;
  border: none;
  color: #c00;
  font-weight: bold;
  cursor: pointer;
  font-size: 0.9rem;
  z-index: 2;
  background-color: #fff;
  padding: 2px 6px;
  align-self: center;
}

.boto-toggle-sidebar {
  display: none;
  position: fixed;
  top: 280px;
  left: 20px;
  z-index: 10000;
  background-color: #c00;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 14px;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}




/* =======================
   RESPONSIVE DESIGN
   ======================= */

/* ========== 1. Muy pequeÃ±as pantallas: hasta 425px (mÃ³vil pequeÃ±o) ========== */
@media screen and (max-width: 580px) {

  body {


    .botons-xat {
      position: fixed;
      bottom: 50px;
      right: 10px;
      margin-bottom: 150px !important;
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 12px;
      z-index: 9999;
      pointer-events: auto;
    }

  }
}


@media screen and (max-width: 450px) {

  body {
    max-width: 100dvw !important: overflow: hidden !important;
  }

  .globus-de-preguntes.sidebar-faq[data-posicio="esquerra"],
  .globus-de-preguntes.sidebar-faq[data-posicio="dreta"] {
    grid-template-columns: 1fr !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto 20px auto !important;
    padding: 0 10px !important;
    position: relative !important;
    top: auto !important;
    z-index: 1 !important;
  }

  .contenidor-info {
    position: absolute !important;
    top: 0 !important;
  }

  .globus-de-preguntes.sidebar-faq .sidebar-section {
    width: 100% !important;
    padding: 15px !important;
  }

  .submenu-faq a,
  .sub-submenu a {
    font-size: 0.85rem;
  }

  .contingut-dret {
    position: absolute !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 10px !important;
    max-height: none !important;
    overflow-y: auto !important;
    margin-bottom: 120px;
  }

  #xat-missatge {
    margin-bottom: 10dvh !important;
  }

  #pregunta-finalitat {
    margin-bottom: 20px !important;
  }

  .globus-conversa {
    font-size: 0.9rem !important;
    /* padding: 16px !important; */
    margin-bottom: 30dvh !important;
    margin-top: 5dvh !important;
  }

  .pregunta {
    margin-bottom: 8dvh !important;
  }

  .resposta {
    margin-top: -5dvh !important;
    margin-bottom: 5dvh !important;
    padding-left: 50px !important;
  }

  .globus-conversa.resposta::before,
  .globus-conversa.resposta::after {
    display: none !important;
  }

  .boto-exportar-pdf {
    width: 50% !important;
    padding: 12px !important;
    font-size: 12px;
    justify-content: center;
    left: 4% !important;
  }


  .botons-xat {
    position: fixed;
    /* bottom: 100px !important; */
    right: 10px;
    margin-bottom: 100px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    z-index: 9999;
    pointer-events: auto;
    width: 80px;
  }

  .neteja-xat,
  .imprimir,
  .descarregar {
    width: 44px !important;
    height: 44px !important;
    padding: 0 0 0 15px !important;
    left: 2% !important;
    bottom: 20% !important;
    font-size: 0 !important;
    /* Oculta el texto */
    border-radius: 6px !important;
    /* Forma rectangular con bordes suaves */
    /*clip-path: none !important;       Elimina forma de flecha */
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    position: relative;
    overflow: hidden !important;
    clip-path: polygon(20px 0, 100% 0, 100% 100%, 20px 100%, 0 50%) !important;
  }

  .neteja-xat .icon,
  .imprimir .icon,
  .descarregar .icon {
    width: 20px;
    height: 20px;
    filter: invert(1);
    display: block;
    margin-left: 5px;
  }

  /* Tooltip estilitzat */
  .neteja-xat::after,
  .imprimir::after,
  .descarregar::after {
    content: attr(title);
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 10000;
  }

  .neteja-xat:hover::after,
  .imprimir:hover::after,
  .descarregar:hover::after {
    opacity: 1;
  }

  input,
  select {
    width: 100% !important;
    font-size: 1rem !important;
    padding: 10px !important;
  }

  .envoltori-autocompletar {
    width: 100% !important;
  }

  .camp-autocompletar {
    padding: 0 !important;
  }

  /* MenÃº hamburguesa */
  #menu-hamburguesa {
    width: 32px;
    height: 32px;
    top: 10px;
    left: 10px;
  }

  .menu-desplegable {
    top: 50px !important;
    width: 100vw;
    font-size: 14px;
  }

  .estat-buit {
    font-size: 0.95rem;
    padding: 1.5rem;
  }

  footer {

    position: fixed !important;
    width: 100dvw !important;

    nav:first-of-type {
      flex-direction: column;
      text-align: center;
      padding: 10px;
    }

    #logos-XXSS {
      justify-content: center;
      gap: 10px;
      flex-wrap: wrap;
      max-width: 300px;
      margin: 0 auto !important;
      /* margin: 0 0 0 30px !important; */
    }

    nav:nth-of-type(2) {
      .logoPeuGeneral img {
        width: 90px;
        margin: 10px auto;
      }

      .enllacos-peu a {
        font-size: 10px;
      }

      .icona-enllac {
        width: 10px;
        height: 10px;
      }
    }
  }

  /* Estils Peu */
  .footer-guia {
    width: 100%;
    ;
    margin-top: auto;
    margin: 0;
    padding: 0;
    position: absolute;
    left: 0px;
    bottom: 0px;
    z-index: 9999;
    font-family: Arial, sans-serif;

  }

  body:not(.scrolled) .contenidor-info,
  body:not(.scrolled) #contenidor,
  body:not(.scrolled) .contingut-dret,
  body:not(.scrolled) .globus-de-preguntes.sidebar-faq {
    /* margin-top: 80px !important; */
    transition: margin-top 0.25s ease-in-out;
  }
}

/* ========== 2. MÃ³viles medianos-grandes: hasta 768px ========== */
@media screen and (max-width: 768px) {

  body {
    flex-direction: column;

    .enllacos-superiors {
      >*:not(:last-child) {
        opacity: 0;
        visibility: hidden;
        height: 0;
        overflow: hidden;
        transition: opacity 0.4s, height 0.4s, visibility 0.4s;
      }

      > :last-child {
        opacity: 1;
        visibility: visible;
        height: 16px;
      }

      .cerca-icon {
        width: 22px;
        height: 22px;
      }
    }

    /* === CONTENEDOR PRINCIPAL === */
    .contenidor-info {
      position: absolute !important;
      top: 0 !important;
    }

    /* === ASIDE ESQUERRA === */
    .globus-de-preguntes.sidebar-faq[data-posicio="esquerra"] {
      display: grid !important;
      grid-template-columns: repeat(2, 1fr) !important;
      gap: 20px !important;
      /*margin-top: 0 !important;*/
      margin-bottom: 10px !important;
      position: relative !important;
      top: auto !important;
      z-index: 1 !important;
    }

    /* === ASIDE DRETA === */
    .globus-de-preguntes.sidebar-faq[data-posicio="dreta"] {
      display: grid !important;
      grid-template-columns: 1fr !important;
      gap: 20px !important;
      margin-top: 10px !important;
      margin-bottom: 20px !important;
      position: relative !important;
      top: auto !important;
      z-index: 1 !important;
    }

    .globus-de-preguntes.sidebar-faq .sidebar-section {
      width: 100% !important;
    }

    /* === CONTINGUT PRINCIPAL CON SCROLL === */
    .contingut-dret {
      /* position: relative !important; */
      position: sticky;
      /* top: auto !important; */
      width: 100% !important;
      max-width: 800px !important;
      margin: 0 auto !important;
      padding: 20px !important;
      overflow-y: auto !important;
      max-height: 65vh !important;
      z-index: 1 !important;
    }

    /* .globus-de-preguntes.sidebar-faq.fixat-despres-scroll,
    .contingut-dret.fixat-despres-scroll {
      position: relative !important;
      top: auto !important;
      max-height: none !important;
      overflow: visible !important;
    } */
    .botons-xat {
      position: fixed;
      bottom: 24px;
      right: 10px;
      margin-bottom: 100px;
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 12px;
      z-index: 9999;
      pointer-events: auto;
    }

    /* === FOOTER (PEU DE PÃ€GINA) === */

    footer {
      nav:first-of-type {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 10px;
        padding: 10px;
      }

      #logos-XXSS {
        display: flex;
        justify-content: center;
        align-items: center;
        flex-wrap: wrap;
        gap: 10px;
        margin: 0 auto;
        width: 100%;
        max-width: 300px;
      }

      nav:nth-of-type(2) {
        .logoPeuGeneral img {
          width: 100px;
          margin-top: 10px;
        }

        .enllacos-peu {
          margin: 0 auto;
          margin-top: 5px;

          a {
            font-size: 10px;
          }

          .icona-enllac {
            width: 10px;
            height: 10px;
          }
        }
      }

      .logoPeuGeneral {
        order: 1;
        margin: 0 auto;

        img {
          margin-top: 0;
        }
      }
    }

    /* === BARRA SUPERIOR - ENLLAÃ‡OS === */
    .enllacos-superiors {

      .cerca-icon {
        width: 22px;
        height: 22px;
      }

      >*:not(:last-child) {
        opacity: 0;
        visibility: hidden;
        height: 0;
        overflow: hidden;
        transition:
          opacity 0.4s ease-in-out,
          height 0.4s ease-in-out,
          visibility 0.4s ease-in-out;
      }

      > :last-child {
        opacity: 1;
        visibility: visible;
        height: 16px;
        overflow: visible;
      }
    }
  }
}

/* ========== 3. MÃ³viles medianos-grandes: hasta 948px ========== */
@media screen and (max-width: 940px) {
  body {
    header {
      flex-direction: column;

      .menuEntorn {
        position: relative;

        #menu-hamburguesa {
          display: flex;
          flex-direction: column;
          justify-content: center;
          gap: 5px;
          width: 35px;
          height: 35px;
          position: absolute;
          top: 8px;
          left: 10px;
          z-index: 1100;
          background: transparent;
          border: none;
          cursor: pointer;

          span {
            width: 100%;
            height: 2px;
            background: white;
            border-radius: 2px;
            transition: transform 0.3s ease, opacity 0.3s ease;
          }

          &.open {
            span:nth-child(1) {
              transform: translateY(7.5px) rotate(45deg);
            }

            span:nth-child(2) {
              opacity: 0;
            }

            span:nth-child(3) {
              transform: translateY(-7.5px) rotate(-45deg);
            }
          }
        }

        #logo_cerca {
          position: absolute;
          top: -40px;
          right: 10px;
          width: 25px;
          height: 25px;
          filter: invert(1);
          z-index: 1100;
          cursor: pointer;
        }

        .menu-desplegable {
          position: absolute;
          top: 70px;
          right: 0;
          background: white;
          width: 100%;
          padding: 10px 20px;
          z-index: 3000 !important;
          line-height: 1.6;


          ul {
            list-style: none;
            margin: 0;
            padding: 0;

            li {
              margin: 10px 0;
              position: relative;

              &.paginaActual::after {
                content: "";
                position: absolute;
                top: 0;
                left: 0;
                height: 80%;
                width: 4px;
                background-color: rgba(180, 14, 14, 0.6);
              }

              a {
                margin-left: 18px;
                color: #222;
                text-decoration: none;
                font-size: 16px;
              }
            }
          }

          &.active {
            display: flex;
          }
        }
      }

      > :first-child {
        position: sticky;
        flex-direction: column;
        top: 0;
        z-index: 1000;
        justify-content: center;
        align-items: center;
        gap: 10px;
        padding: 10px 20px;
        height: 45px;

        > :first-child {
          margin-left: 0;
          display: flex;
          justify-content: center;
          width: 100%;
          margin-top: 35px;

          #logo_gencat {
            height: 25px;
          }
        }

        > :nth-child(2) {
          display: none;
        }

        > :nth-child(3) {
          margin-left: 0;
          margin-right: 0;
          justify-content: flex-end;
          width: 100%;
          padding: 0 10px;
          display: flex !important;

          /* Ocultar tot excepte la cerca */
          a:not(:has(#logo_cerca)),
          span,
          #idiomes-contenidor {
            display: none !important;
          }

          a:has(#logo_cerca) {
            display: flex !important;
            align-items: center;
            justify-content: center;
            padding: 5px;
          }
        }
      }

      /* Segona franja centrada */
      > :nth-child(2) {
        position: sticky;
        top: 45px;
        z-index: 999;
        justify-content: center;
        align-items: center;
        padding: 15px 20px;
        height: 35px;
        text-align: center;

        a {
          margin-left: 0;
          font-size: 14px;
          text-align: center;
          color: white;
          text-decoration: none;
          line-height: 1.4;
        }

        #titol-sitio {
          display: inline-block;
          text-align: center;
        }
      }

      > :nth-child(3) {
        background-color: #222;
        color: #222;
        height: 20px;

        ul,
        li,
        a {
          display: none;
        }
      }
    }

    .ruta-navegacio-container {
      top: 80px !important;
      z-index: 2000;
    }

    &.scrolled {
      #titol-sitio {
        display: none !important;
      }

      header> :first-child> :nth-child(2) {
        display: none !important;
      }

      header> :first-child> :nth-child(2)::before {
        content: none !important;
      }
    }

    /* ASIDE ESQUERRA EN FLUJO */
    .globus-de-preguntes.sidebar-faq[data-posicio="esquerra"] {
      position: relative !important;
      top: auto !important;
      z-index: 1 !important;
      /*margin-top: 0 !important;*/
      grid-template-columns: repeat(2, 1fr) !important;
      gap: 20px !important;
    }

    /* ASIDE DRETA TAMBIÃ‰N EN FLUJO */
    .globus-de-preguntes.sidebar-faq[data-posicio="dreta"] {
      position: relative !important;
      top: auto !important;
      grid-template-columns: 1fr !important;
      margin-top: 30px !important;
      margin-bottom: 50px !important;
      gap: 20px !important;
    }

    /* CONTINGUT-DRET CON SCROLL INTERNO */
    .contingut-dret {
      /* position: relative !important; */
      position: sticky;
      top: auto !important;
      width: 100% !important;
      max-width: 800px !important;
      margin: 0 auto !important;
      padding: 20px !important;
      overflow-y: auto !important;
      max-height: 65vh !important;
      z-index: 1 !important;
      margin-bottom: 20px;
    }

    /* .contenidor-info {
      margin-top: 0 !important;
      padding: 0 15px !important;
      gap: 20px !important;
    } */
    .contenidor-info {
      position: absolute !important;
      top: 0 !important;
    }

    .globus-de-preguntes.sidebar-faq.fixat-despres-scroll,
    .contingut-dret.fixat-despres-scroll {
      /* position: relative !important; */
      top: auto !important;
      max-height: none !important;
      overflow: visible !important;
    }
  }
}

/* ========== 4. Tablets en vertical / pantallas medias: hasta 1024px ========== */
@media screen and (max-width: 1024px) {
  /* .contenidor-info {
    margin-top: 0 !important;
    gap: 25px;
  } */

  .contenidor-info {
    position: absolute !important;
    top: 0 !important;
  }

  /* .globus-de-preguntes.sidebar-faq[data-posicio="esquerra"] {
    grid-template-columns: repeat(2, 1fr) !important;
    position: relative !important;
    top: auto !important;
    z-index: 1 !important;
    margin-top: 600px !important;
    margin-top: 0 !important;
  } */
  .globus-de-preguntes.sidebar-faq.fixat-despres-scroll {
    position: relative !important;
    top: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  /* .globus-de-preguntes.sidebar-faq[data-posicio="dreta"] {
    grid-template-columns: repeat(2, 1fr) !important;
  } */

  .globus-de-preguntes.sidebar-faq[data-posicio="esquerra"],
  .globus-de-preguntes.sidebar-faq[data-posicio="dreta"] {
    grid-template-columns: repeat(2, minmax(120px, 1fr)) !important;
    width: 90% !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }


  .contingut-dret {
    max-height: 70vh !important;
    overflow-y: auto !important;
  }
}

/* ========== 5. Escritorio pequeÃ±o o tablet horizontal: hasta 1300px ========== */
@media (max-width: 1300px) {
  body {
    header {
      > :first-child {
        > :first-child {
          margin-left: 0;
        }

        > :nth-child(3) {
          margin-right: 0;
        }
      }

      > :nth-child(2) {
        a {
          margin-left: 0;
        }
      }

      .menuEntorn {
        position: sticky;
        z-index: 1001;
      }

      .globus-de-preguntes.sidebar-faq {
        z-index: 10;
      }

      .contingut-dret {
        z-index: 5;
        /* position: relative !important; */
        margin-bottom: 100px !important;
      }

      .enllacos-superiors {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        padding-right: 40px;
        gap: 12px;
        position: relative;
        z-index: 999;
      }
    }

    .ruta-navegacio-container {
      position: sticky;
      top: 150px;
      z-index: 2000;
    }

    .contenidor-info {
      display: grid !important;
      grid-template-columns: 1fr;
      grid-template-areas:
        "aside"
        "boton"
        "contingut";
      gap: 20px;
      /*margin-top: 140px !important;
      position: relative !important;*/
      z-index: 1;
      width: 90% !important;
      max-width: 100% !important;
      position: absolute !important;
      top: 0 !important;
      margin-left: 20px;
      margin-right: 10px;
    }

    .globus-de-preguntes.sidebar-faq {
      all: unset;
      display: grid !important;
      width: 100% !important;
      gap: 20px !important;
      position: relative !important;
      /*margin-top: 400px;*/
      top: auto !important;
    }

    .globus-de-preguntes.sidebar-faq[data-posicio="esquerra"] {
      display: grid !important;
      grid-area: aside !important;
      grid-template-columns: repeat(2, 1fr) !important;
      margin-right: 20px !important;
      /*margin-top: 400px !important;*/
      scroll-behavior: auto !important;
      overflow: visible !important;
      position: relative !important;
      top: auto !important;
      max-height: none !important;
      z-index: 1 !important;
      width: 90% !important;
      margin: 700px auto 50px auto !important;
      gap: 20px !important;
    }

    .globus-de-preguntes.sidebar-faq[data-posicio="dreta"] {
      display: grid !important;
      grid-template-columns: repeat(2, 1fr) !important;
      margin-right: 20px !important;
      margin-top: 80px !important;
      /* margin-bottom: 20px !important; */
      width: 90% !important;
      margin: 0 auto !important;
      gap: 20px !important;
    }

    .globus-de-preguntes.sidebar-faq .sidebar-section {
      width: 100% !important;
      scroll-margin-top: 0 !important;
      scroll-padding-top: 0 !important;
    }

    .contingut-dret {
      grid-area: contingut !important;
      /* position: relative !important; */
      /* top: auto !important; */
      right: auto !important;
      bottom: auto !important;
      z-index: 1 !important;
      width: 100% !important;
      max-width: 800px !important;
      margin: 0 auto !important;
      padding: 20px !important;
      overflow-y: auto !important;
      max-height: 60vh !important;
      height: 10% !important;
    }

    .contingut-dret.fixat-despres-scroll,
    .globus-de-preguntes.sidebar-faq.fixat-despres-scroll {
      /* position: relative !important; */
      top: auto !important;
      max-height: none !important;
      overflow: visible !important;
    }

    .globus-de-preguntes.sidebar-faq[data-posicio="esquerra"],
    .sidebar-section,
    .submenu-container,
    .sub-submenu {
      scroll-margin-top: 0 !important;
      scroll-padding-top: 0 !important;
      scroll-behavior: auto !important;
      overscroll-behavior: contain !important;
      contain: layout !important;
      /* transform: translateZ(0); */
    }

    .globus-de-preguntes.sidebar-faq .sidebar-section,
    .globus-de-preguntes.sidebar-faq .submenu-container,
    .globus-de-preguntes.sidebar-faq .sub-submenu {
      scroll-margin-top: 180px;
      scroll-padding-top: 180px;
    }

    .globus-de-preguntes.sidebar-faq,
    .globus-de-preguntes.sidebar-faq[data-posicio="esquerra"],
    .globus-de-preguntes.sidebar-faq[data-posicio="dreta"],
    .globus-de-preguntes.sidebar-faq.fixat-despres-scroll {
      position: relative !important;
      top: auto !important;
      margin-top: 40px !important;
      margin-bottom: 40px !important;
      overflow: visible !important;
      max-height: none !important;
      z-index: auto !important;
      /* width: 100vw !important; */
    }

    .contenidor-info {
      overflow: visible !important;
    }

    .sidebar-section,
    .submenu-container,
    .sub-submenu {
      scroll-margin-top: 200px !important;
      scroll-padding-top: 200px !important;
    }

    .globus-de-preguntes.sidebar-faq {
      z-index: 20 !important;
    }

    .botons-xat {
      position: fixed;
      bottom: 24px;
      right: 10px;
      margin-bottom: 100px;
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 12px;
      z-index: 9999;
      pointer-events: auto;
    }

    #botons-xat button:hover {
      background-color: #a00;
    }


    footer {
      nav:first-of-type {
        p {
          /* margin-left: 10%; */
        }

        #logos-XXSS {
          /* margin-left: 5%; */
          margin: 0 auto !important;
        }
      }

      nav:nth-of-type(2) {
        .logoPeuGeneral img {
          margin-left: 0;
        }

        .enllacos-peu {
          margin-right: 0;

        }
      }
    }
  }
}

/* === FIX FINAL guiametodologica: alineación y comportamiento scroll === */

/* 1 Contenedor de información general: sin offsets fijos */
#contenidor-info,
.contenidor-info {
  /* margin-top: 0 !important; */
  padding-top: 0 !important;
  position: relative;
  top: 0 !important;
  /* elimina el desplazamiento visual extra */
}

/* 2 Contenedor derecho y área principal: sin margenes adicionales */
.contingut-dret {
  /* margin-top: 0 !important; */
  padding-top: 0 !important;
  overflow-y: auto;
}

/* 3 Los globus laterales: sin scroll inicial */
.globus-de-preguntes.sidebar-faq {
  overflow: hidden !important;
  /* no mostrar scroll al cargar */
  max-height: none !important;
  padding-top: 0 !important;
}

/* Cuando se despliegan (con clase expandit o <details open>), permitir scroll */
.globus-de-preguntes.sidebar-faq.expandit,
.globus-de-preguntes.sidebar-faq:has(details[open]) {
  overflow-y: auto !important;
  max-height: 80vh;
  /* límite razonable si el bloque crece */
}

/* 4 Alinea correctamente las columnas */
.contenidor-principal,
.contenidor-flex,
#contenidor {
  align-items: flex-start !important;
}

/* 5 Transiciones suaves cuando cambian los menús */
body:not(.scrolled) .contingut-dret,
body:not(.scrolled) .globus-de-preguntes.sidebar-faq {
  transition: padding-top 0.25s ease-in-out;
}

/* transición suave cuando se ajusta el margin-top / padding-top */
.contenidor-info,
#contenidor,
.contingut-dret,
.globus-de-preguntes.sidebar-faq {
  transition: margin-top 0.18s ease, padding-top 0.18s ease;
  box-sizing: border-box;
}

/* === Offset visual cuando los menús están visibles === */
body:not(.scrolled) .contenidor-info,
body:not(.scrolled) #contenidor,
body:not(.scrolled) .contingut-dret,
body:not(.scrolled) .globus-de-preguntes.sidebar-faq {
  /* Ajusta este valor según la altura real de tus menús */
  margin-top: 80px !important;
  transition: margin-top 0.25s ease-in-out;
}

/* Cuando se hace scroll (menús ocultos), eliminamos ese espacio */
body.scrolled .contenidor-info,
body.scrolled #contenidor,
body.scrolled .contingut-dret,
body.scrolled .globus-de-preguntes.sidebar-faq {
  margin-top: 10px !important;
}

/* === Scroll solo en el globo izquierdo (FAQ izquierda) === */

/* 1 Estado normal: sin scroll y debajo de los menús */
.globus-de-preguntes.sidebar-faq[data-posicio="esquerra"] {
  overflow: visible !important;
  max-height: none !important;
  margin-top: var(--menus-offset, 120px);
  transition: max-height 0.3s ease, overflow 0.3s ease, margin-top 0.3s ease;
}

/* 2 Cuando se expanden secciones (submenu abierto, details open, etc.) */
.globus-de-preguntes.sidebar-faq[data-posicio="esquerra"]:has(details[open]),
.globus-de-preguntes.sidebar-faq[data-posicio="esquerra"]:has(.submenu-container.visible),
.globus-de-preguntes.sidebar-faq[data-posicio="esquerra"]:has(.submenu-container.expanded),
.globus-de-preguntes.sidebar-faq[data-posicio="esquerra"]:has(.has-submenu.open) {
  overflow-y: auto !important;
  /* max-height: 80vh !important;  */
  scrollbar-color: rgba(0, 0, 0, 0.3) transparent;
}

/* Scrollbar visual (WebKit) */
.globus-de-preguntes.sidebar-faq[data-posicio="esquerra"]::-webkit-scrollbar {
  width: 8px;
}

.globus-de-preguntes.sidebar-faq[data-posicio="esquerra"]::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
}

.globus-de-preguntes.sidebar-faq[data-posicio="esquerra"]::-webkit-scrollbar-track {
  background-color: transparent;
}

/* 3 Evita que quede tapado por los menús al estar arriba */
/* body:not(.scrolled) .globus-de-preguntes.sidebar-faq[data-posicio="esquerra"] {
  margin-top: var(--menus-offset, 160px) !important;
} */
body.scrolled .globus-de-preguntes.sidebar-faq[data-posicio="esquerra"] {
  margin-top: 0 !important;
}

/* === FIX responsive: elimina offset excesivo en móvil/tablet === */

/* 1) Solo en escritorio mantenemos los offsets de cabecera */
@media (min-width: 1025px) {

  /* Si usas la regla del offset visual cuando no hay .scrolled */
  body:not(.scrolled) .contenidor-info,
  body:not(.scrolled) #contenidor,
  body:not(.scrolled) .contingut-dret,
  body:not(.scrolled) .globus-de-preguntes.sidebar-faq {
    margin-top: 75px !important;
    /* solo desktop */
    transition: margin-top .25s ease-in-out;
  }

  /* Mantén el padding-top amplio del main solo en desktop */
  main {
    padding-top: 150px !important;
    /* definido arriba en tu CSS global */
  }

  /* Mantén el margen superior del panel derecho solo en desktop */
  .contingut-dret {
    margin-top: 70px !important;
  }
}

/* 2) En tablets y móviles eliminamos offsets acumulados */
@media (max-width: 1024px) {

  /* Sin desplazamiento extra por menú en móvil/tablet */
  body:not(.scrolled) .contenidor-info,
  body:not(.scrolled) #contenidor,
  body:not(.scrolled) .contingut-dret,
  body:not(.scrolled) .globus-de-preguntes.sidebar-faq {
    margin-top: 10px !important;
  }

  /* Quitamos el padding-top global del main que empuja todo hacia abajo */
  main {
    padding-top: 0 !important;
    /* antes era 150px */
  }

  /* Quitamos también el margen fijo del contenido derecho */
  .contingut-dret {
    margin-top: 0 !important;
    /* antes era 70px */
    top: auto !important;
    /* evita sumar con position:sticky/top */
  }

  /* Si lo necesitas totalmente plano en móvil: */
  .contenidor-info {
    top: 0 !important;
    /* neutraliza el top:40px de desktop */
    margin-top: 0 !important;
  }
}

/* === Móviles y tablets: permitir que el contenedor crezca === */
@media (max-width: 1024px) {
  .contenidor-info {
    position: static !important;
    /* libera del layout absoluto */
    top: auto !important;
    min-height: 110vh !important;
    /* ahora sí tendrá efecto */
    margin-top: 0 !important;
    padding-top: 1rem;
    /* opcional: aire arriba */
  }

  /* Deja respirar el panel derecho */
  .contingut-dret {
    position: relative !important;
    /* evita stickiness rara en móviles */
    max-height: none !important;
    /* elimina el tope de 65–70vh */
    min-height: 80vh !important;
    /* muestra más contenido */
  }
}

/* Móviles pequeños: aún más alto */
@media (max-width: 480px) {
  .contenidor-info {
    min-height: 120vh !important;
  }

  .contingut-dret {
    min-height: 100vh !important;
  }
}

/* MÓVIL/TABLET ≤1024px: mantener el margen grande */
@media (max-width: 1024px) {
  .contingut-dret .globus-conversa.resposta {
    margin-bottom: 180px !important;
  }
}

/* ESCRITORIO ≥1025px: quitar ese margen extra */
@media (min-width: 1025px) {
  .contingut-dret .globus-conversa.resposta {
    margin-bottom: 20px !important;
    /* ajusta el valor que quieras en desktop */
  }
}

/* Fallback de datalist para móviles/tablets */
.camp-autocompletar {
  position: relative;
}

.auto-menu {
  position: absolute;
  inset: auto 0 auto 0;
  top: calc(100% + 4px);
  max-height: 240px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
  z-index: 10000;
  display: none;
}

.auto-menu.visible {
  display: block;
}

.auto-menu li {
  list-style: none;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f2f2f2;
  font-size: 0.95rem;
}

.auto-menu li:last-child {
  border-bottom: none;
}

.auto-menu li:hover {
  background: #f7f7f7;
}

.auto-menu li.buit {
  color: #999;
  cursor: default;
}

/* Separación robusta (no depende de margin de <p>) */
.contingut-dret .wrap-instruments-destacats {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

/* Opcional: neutraliza reglas generales que te indenten/peguen estas líneas */
.contingut-dret .wrap-instruments-destacats .linia-instruments-destacats {
  margin: 0 !important;
  text-indent: 0 !important;
  padding-left: 10px;
}

/* Párrafos de evaluación con aire visual */
.contingut-dret .paragraf-avaluacio {
  margin: 0 0 0.9rem 0 !important;
  text-indent: 0 !important;
  line-height: 1.6;
}

/* Modalitat: párrafos con aire aunque haya p { margin:0 } en otros sitios */
.contingut-dret .paragraf-modalitat {
  margin: 0 0 0.9rem 0 !important;
  text-indent: 0 !important;
  line-height: 1.6;
}

/* =========================================
   LAPTOPS BAJAS: scroll interno + sticky OK
   ========================================= */
@media (min-width: 1025px) and (max-height: 900px) {

  /* IMPORTANTE: el layout NO debe ser absolute en laptop */
  .contenidor-info {
    position: relative !important;
    top: 20px;
    /* mantienes tu ajuste de arriba */
  }

  /* Panel derecho: scroll interno con altura real (no se corta) */
  .contenidor-info .contingut-dret {
    position: sticky !important;
    top: 50px !important;
    /* tu top actual */

    height: calc(100dvh - 70px - 40px) !important;
    /* viewport - top - margen */
    max-height: none !important;

    overflow-y: auto !important;
    overflow-x: auto !important;
  }

  /* Sidebars: también sticky y con su propio alto */
  .globus-de-preguntes.sidebar-faq {
    position: sticky !important;
    top: 50px !important;

    height: calc(100dvh - 70px - 40px) !important;
    max-height: none !important;

    overflow-y: auto !important;
    overflow-x: visible !important;
  }
}

/* =========================================
   LAPTOPS BAJAS: sidebar IZQUIERDO con scroll propio
   (evita que se tape el último item)
   ========================================= */
@media (min-width: 1025px) and (max-height: 900px) {

  /* SOLO el sidebar de la izquierda */
  .globus-de-preguntes.sidebar-faq[data-posicio="esquerra"] {
    position: sticky !important;
    top: 70px !important;

    height: calc(100dvh - 70px - 40px) !important;
    max-height: none !important;

    overflow-y: auto !important;
    overflow-x: visible !important;

    /* aire abajo para que el último item no quede pegado/tapado */
    padding-bottom: 24px !important;
  }

  /* Si tienes un wrapper interno que hace scroll, úsalo también */
  .globus-de-preguntes.sidebar-faq[data-posicio="esquerra"] .sidebar-scroll-inner {
    max-height: 100% !important;
    overflow-y: auto !important;
    overflow-x: visible !important;
    padding-bottom: 24px !important;
  }
}