
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;   
}

html {
    overflow-y: scroll;
}
 Estils existents --- */
h1 { margin-top: 50px; }
li { color: #666; } 
ul { margin-left: 25px; }
.section { margin-bottom: 45px; }

.highlight {
    background: #f0f0f1;
    padding: 12px 18px;
    margin: 20px 0;
}

.accordion {
    background: #f0f0f1;
    color: #333;
    cursor: pointer;
    padding: 18px;
    width: 100%;
    border: none;
    text-align: left;
    outline: none;
    font-size: 18px;
    transition: 0.3s;
    margin-top: 10px;
}
.accordion.active, .accordion:hover {
    background: #d9d9da;
}

.panel {
    /* padding: 18px; */
    background: white;
    display: none;
    overflow: hidden;
    margin-bottom: 15px;
}

/* --- VIDEO --- */
.video-container {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 20px auto;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    background: #000;
}
.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* =============================
        ACORDEONES ANIDADOS
   ============================= */

/* Acordeones principales */
.accordion-main, .accordion-introduccio {
    font-size: 20px;
    font-weight: 600;
    background: #d9d9da;
    margin-top: 50px;
}

.accordion-introduccio{
    margin-top: 35px;
}
/* Panel principal */
.panel-main {
    padding-left: 15px;
}

/* Subacordeones interiores */
.accordion-inner {
    background: #fafafa;
    margin-left: 30px;
    font-size: 16px;
    padding: 14px;
}

.diagram-guia {
    /* width: 100%; */
    max-width: 600px;  
    margin: 20px auto 10px auto;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 6px;
    overflow: hidden;
}

.diagram-guia img {
    /* width: 100%; */
    height: auto;
    display: block;
}

/* Todos los acordeones y paneles ocupan siempre el 100% del contenedor */
.accordion,
.panel {
    width: 100%;
    box-sizing: border-box;
}

/* Los subacordeones se ven “tabulados” pero sin cambiar el ancho exterior */
.accordion-inner {
    padding-left: 40px;   
    margin-left: 0;      
}

#paginaPrincipal {
    max-width: 1200px;  
    width: 100%;
    margin: 0 auto;
    padding: 0 16px;     
    box-sizing: border-box;
    overflow-x: hidden;
            margin-bottom: 5% !important;
}
    table td:first-child {
        vertical-align: top;
        width: 220px; 
        font-weight: bold; 
    }

     table.tutorial-table {
        width: 100%;
        border-collapse: collapse;
        font-family: Arial, sans-serif;
        font-size: 15px;
        margin-top: 15px;
    }

    /* Encabezado */
    .tutorial-table thead th {
        background-color: #333;
        color: #fff;
        padding: 12px;
        border: 1px solid #fff;
        text-align: left;
    }

    /* Primera columna */
    .tutorial-table td:first-child {
        background-color: #dcdcdc;
        border: 1px solid #fff;
        font-weight: bold;
        width: 220px;
    }

    /* Segunda columna */
    .tutorial-table td:nth-child(2) {
        background-color: #f5f5f5;
        border: 1px solid #fff;
    }

    /* Líneas finas blancas */
    .tutorial-table td {
        padding: 14px;
        vertical-align: top;
    }
    @media (max-width: 600px) {
    .diagram-guia {
        border-width: 1px;
        border-radius: 4px;
        max-width: 100%;
    }
    .diagram-guia img {
    width: 100%;
    height: auto;
    display: block;
}

.tutorial-table td:first-child {
    width: 10%;
}
}

/*****
	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;
}

/* === MÓVILES PEQUEÑOS (hasta 375px) === */
@media screen and (max-width: 375px) {
  body {
    header footer {
      width: 100dvw;
      max-width: 100%;
      box-sizing: border-box;
    }

    #paginaPrincipal,
    #paginaPrincipal-inici {
      width: 100dvw;
      padding-left: 20px;
      padding-right: 20px;
      padding-top: 20px;      /* corregido */
      padding-bottom: 20px;   /* corregido */
      box-sizing: border-box;
      font-size: 15px;

      h1,
      h3,
      p,
      li {
        word-wrap: break-word;
        word-break: break-word;
      }
    }

    #menuDesplegable {
      padding-top: 30px;
    }

    #logos-XXSS {
      margin-left: -4% !important;
    }

    footer nav p {
      margin: 0 !important;
      padding: 0 !important;
    }

    .enllacos-peu {
      margin-right: -25px !important;
      margin-left: 7px !important;
    }

    #pestanya_GuiaMetodologica {
      max-width: 80dvw !important;
    }

    #btnScrollTop {
      margin-bottom: 10dvh !important;
    }
  }
}

/* === TELÉFONOS GRANDES (hasta 450px) === */
@media screen and (max-width: 450px) {
  body {
    header footer {
      width: 100dvw;
      max-width: 100%;
      box-sizing: border-box;
    }

    #paginaPrincipal,
    #paginaPrincipal-inici {
      width: 100dvw;
      padding-left: 20px;
      padding-right: 20px;
      padding-top: 20px;     /* corregido */
      padding-bottom: 20px;  /* corregido */
      box-sizing: border-box;
      font-size: 15px;

      h1,
      h3,
      p,
      li {
        word-wrap: break-word;
        word-break: break-word;
      }
    }

    #menuDesplegable {
      padding-top: 30px;
    }

    #logos-XXSS {
      margin-left: -4% !important;
    }

    footer nav p {
      margin: 0 !important;
      padding: 0 !important;
    }

    .enllacos-peu {
      margin-right: -25px !important;
      margin-left: 7px !important;
    }

    #pestanya_GuiaMetodologica {
      max-width: 80dvw !important;
    }

    #btnScrollTop {
      margin-bottom: 10dvh !important;
    }
  }
}

/* === TABLETS Y PANTALLAS MEDIANAS (hasta 768px) === */
@media screen and (max-width: 768px) {
  body {
    flex-direction: column;

    #contenidor {
      flex-direction: column;

      #mostrarMenuEsquerra {
        position: absolute;
        left: 50px;
      }
    }

    .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;
      }
    }

    /* Páginas principales */
    #paginaPrincipal,
    #paginaPrincipal-inici {
      width: 100%;
      padding: 0 20px;
      margin: 0;
      padding-top: 20px;     /* igual para ambos */
      padding-bottom: 20px;
      font-size: 16px;

      iframe {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
        max-width: 100%;
      }

      h1, p {
        margin: 0;
        padding: 0;
        word-break: break-word;
      }
    }

    /* === 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;
        margin: 0 auto !important;
      }

      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;
        }
      }
    }
  }
}


/* === Ajuste general para pantallas menores a 800px === */
@media screen and (max-width: 800px) {
  body {
    scroll-padding-top: 120px; /* deja espacio para el header fijo */
  }

  #paginaPrincipal-inici {
    margin-top: 0;
    padding-top: 20px;
  }
}


@media screen and (max-width: 940px) {
    body {
      /* &.menu-obert {
        position: fixed; 

      } */
      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);
              }
            }
          }
          .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;
            }
  
            #logo_cerca {
              display: block !important;
              width: 20px;
              height: 20px;
              filter: invert(1);
            }
          }
        }
  
        /* 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;
          }
        }
      }
  
      & #contenidor {
        #mostrarMenuEsquerra {
          position: absolute;
          top: 150px;
          left: 80px;
        }
      }
      .ruta-navegacio-container {
        top: 80px !important; 
      }

      #paginaPrincipal,
      #paginaPrincipal-inici{
        margin: 0 10% 0 10%;
        padding-top: 0;
      }
  
      &.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;
        }
      }

      /* #paginaPrincipal-inici{
        margin: 0 10% 0 10%;
        padding-top: 20% !important;;
      } */
    }
}



  @media screen and (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;
            }
          }
      }
      #contenidor {
        #menuEsquerra {
          width: 100%;
          padding: 20px 20px 20px 40px;
        }
        .contenidor-info {
          flex-direction: column;

          .globus-de-preguntes.sidebar-faq {
            position: relative;
            z-index: 20;
            display: flex;
            flex-wrap: wrap;
            flex-direction: row;
            justify-content: flex-start;
            align-items: stretch;
            gap: 20px;
            width: 100%;
            max-width: 100%;
            margin-bottom: 20px;
            margin-top: 500px;

            .sidebar-section {
              flex: 1 1 calc(50% - 20px);
              max-width: calc(50% - 20px);
              min-width: 280px;
            }

            .globus-conversa.resposta {
              scroll-margin-top: 180px;
            }
          }

  
        .scroll-wrapper {
          width: 100%;
          max-width: 100%;
          overflow-x: hidden;
          overflow-y: visible; 
          padding: 0;

          .contingut-dret {
            width: 100%;
            margin: 0;
            padding: 0 10px;
            max-height: unset; 
          }
        }
        }
        
      #paginaPrincipal-inici{
        margin: 0 10% 0 10%;
        padding-top: 20% !important;;
      }
      }
      .ruta-navegacio-container {
        position: sticky;
        top: 150px;
        z-index: 999;
        padding: 10px 20px;
        box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    }


      footer {
        nav:first-of-type {
          p {
            /* margin-left: 10%; */
            margin: 0 auto !important;
            }
          #logos-XXSS {
            /* margin-left: 5%;   */
            margin: 0 auto;
          }
        }
        nav:nth-of-type(2) {
          .logoPeuGeneral img {
          margin-left: 0;
          }
          .enllacos-peu {
          margin-right: 0;  
          }
        }
        }
    }
  }

  @media screen and (max-width: 1800px) {
    .contenidor-info {
        margin-left: 40px;
        margin-right: 40px;
        gap: 30px;
      }

      .contingut-dret {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        padding: 0 10px;
      }

      .globus-de-preguntes.sidebar-faq {
        min-width: 280px;
        max-width: 300px;
      }
    }

  /* --Maquetació per a pantalles de 15"-- */

  @media (max-width: 1370px) {

  /* Pàgina principal*/
  #paginaPrincipal-inici {
    margin-top: 140px !important;
  }

  /*Scroll aside esquerra Guia metodològica*/
  .sidebar-faq {
    padding-right: 15px !important;
  }

  }

  /* --Maquetació Telèfons-- */

  @media (max-width: 450px) {
    
  }
/* === AJUSTE DEFINITIVO #paginaPrincipal-inici === */

/* Establecemos una variable con la altura media del header */
:root {
  --altura-header: 70px; /* ajusta si tu header mide más o menos */
}

/* Normalizamos el flujo del documento */
html, body {
  height: auto !important;
  min-height: 100% !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

/* Asegurar que el header sea sticky, pero no tape el main */
header {
  position: sticky !important;
  top: 0 !important;
  z-index: 1000;
}

/* Corregir el posicionamiento del main */
#paginaPrincipal-inici {
  position: relative !important;
  box-sizing: border-box !important;
  max-width: 1200px !important;
  line-height: 1.8 !important;
 
  margin: 0 auto !important;
  /* Espacio justo para quedar debajo del header */
  margin-top: calc(var(--altura-header) + 10px) !important;
  padding: 10px 40px !important;
  padding-top: 0 !important;
  padding-bottom: 40px !important;
  min-height: auto !important; /* quita el límite de scroll */
  height: auto !important;
  overflow: visible !important;
}

/* Textos internos legibles */
#paginaPrincipal-inici h1,
#paginaPrincipal-inici h2,
#paginaPrincipal-inici h3,
#paginaPrincipal-inici p,
#paginaPrincipal-inici li {
  margin: 0 0 16px 0 !important;
  line-height: 1.5 !important;
  word-break: break-word !important;
}

/* --- Ajustes para pantallas pequeñas --- */
@media screen and (max-width: 768px) {
  :root { --altura-header: 85px; }

  #paginaPrincipal-inici {
    margin-top: calc(var(--altura-header) + 6px) !important;
    padding: 16px !important;
    padding-top: 0 !important;
    padding-bottom: 60px !important; /* más espacio para el final */
  }
}

/* --- Ajustes para móviles muy pequeños --- */
@media screen and (max-width: 450px) {
  :root { --altura-header: 95px; }

  #paginaPrincipal-inici {
    margin-top: calc(var(--altura-header) + 4px) !important;
    padding: 14px !important;
    padding-bottom: 80px !important;
    height: auto !important;
    min-height: auto !important;
  }
}

  /* === AJUSTE FINAL #paginaPrincipal-inici PARA IGUALAR A #paginaPrincipal === */

:root {
  --altura-header: 70px; /* ajusta si tu header es más alto o bajo */
  --margen-lateral: 10%; /* mismo margen que usa #paginaPrincipal */
}

/* Estilo base idéntico al de #paginaPrincipal */
#paginaPrincipal-inici {
  position: relative !important;
  box-sizing: border-box !important;
  /* width: 100% !important; */
  max-width: 1200px !important;
  /* iguales márgenes laterales que el tutorial */
  margin-left: var(--margen-lateral) !important;
  margin-right: var(--margen-lateral) !important;
  /* margin-bottom: 10% !important; */
  /* margen superior justo para que no tape el nav */
  margin-top: 2% !important;
  padding: 0 20px 70px 20px !important;
  font-size: 16px !important;
  line-height: 1.6 !important;
  min-height: auto !important;
  height: auto !important;
  overflow: visible !important;
}

/* Ajustes para tablets */
@media screen and (max-width: 940px) {
  :root {
    --altura-header: 85px;
    --margen-lateral: 8%;
  }

  #paginaPrincipal-inici {
    margin-top: 30px !important;
    margin-left: var(--margen-lateral) !important;
    margin-right: var(--margen-lateral) !important;
    padding: 0 16px 30px 16px !important;
  }
}

/* Ajustes para móviles */
@media screen and (max-width: 480px) {
  :root {
    --altura-header: 95px;
    --margen-lateral: 6%;
  }

  #paginaPrincipal-inici {
    margin-top: 30px !important;
    margin-left: var(--margen-lateral) !important;
    margin-right: var(--margen-lateral) !important;
    padding: 0 14px 180px 14px !important;
  }
}

