/* ==========================================================
   Autodiagnóstico Provivienda 3.0 — todo con ámbito .pv-autodiag
   Tipografía: hereda la del tema
   ========================================================== */

.pv-autodiag {
	--azul-900: hsl(210, 100%, 20%);
	--azul-700: hsl(210, 100%, 30%);
	--azul-600: hsl(210, 100%, 39%);
	--azul-500: hsl(210, 100%, 55%);
	--azul-300: hsl(210, 100%, 70%);
	--azul-100: hsl(210, 100%, 90%);
	--bg: hsl(210, 100%, 95%);
	--card: #FFFFFF;
	--text: #152535;
	--muted: #5E7286;
	--border: #DDE6EE;
	--track: #E3ECF3;
	--error: #B3261E;

	background: var(--bg);
	color: var(--text);
	font-family: inherit;
	display: flex;
	justify-content: center;
	padding: 24px 12px;
	line-height: normal;
}

.pv-autodiag,
.pv-autodiag *,
.pv-autodiag *::before,
.pv-autodiag *::after {
	box-sizing: border-box;
}

.pv-autodiag .phone {
	width: 100%;
	max-width: 460px;
	background: var(--card);
	border-radius: 20px;
	box-shadow: 0 10px 40px rgba(14, 42, 68, .14);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	min-height: min(780px, 92vh);
}

.pv-autodiag .topbar {
	background: var(--azul-900);
	padding: 16px 20px 14px;
	color: #fff;
}
.pv-autodiag .brandrow {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}
.pv-autodiag .logo b {
	font-family: inherit;
	font-weight: 700;
	font-size: 15px;
	letter-spacing: .01em;
}
.pv-autodiag .step {
	font-size: 11px;
	opacity: .75;
}
.pv-autodiag .progress {
	height: 5px;
	background: rgba(255, 255, 255, .22);
	border-radius: 6px;
	overflow: hidden;
}
.pv-autodiag .progress i {
	display: block;
	height: 100%;
	background: var(--azul-300);
	border-radius: 6px;
	transition: width .35s ease;
}

.pv-autodiag .screen {
	flex: 1;
	overflow-y: auto;
	padding: 26px 22px 20px;
}

.pv-autodiag .eyebrow {
	font-family: inherit;
	font-weight: 600;
	font-size: 12px;
	letter-spacing: .08em;
	color: var(--azul-600);
	text-transform: uppercase;
	margin: 0 0 8px;
}
.pv-autodiag h1 {
	font-size: 21px;
	line-height: 1.3;
	margin: 0 0 12px;
	color: var(--text);
}
.pv-autodiag h2 {
	font-size: 2rem;
	line-height: 1.35;
	margin: 0 0 10px;
	color: var(--text);
}
.pv-autodiag h3{
    font-size: 1.5rem;
  color: var(--muted);
  font-weight: 600;
}
.pv-autodiag p {
	line-height: 1.6;
	color: var(--muted);
	margin: 0 0 12px;
}
.pv-autodiag ul.list {
	margin: 0 0 14px;
	padding-left: 18px;
}
.pv-autodiag ul.list li {
	line-height: 1.6;
	color: var(--muted);
	margin-bottom: 4px;
}

.pv-autodiag .badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: var(--azul-100);
	color: var(--azul-700);
	font-weight: 600;
	font-size: 12.5px;
	padding: 6px 12px;
	border-radius: 3px;
	margin-bottom: 14px;
}

.pv-autodiag .card {
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 3px;
	padding: 14px 16px;
	margin-bottom: 12px;
}
.pv-autodiag .card.missing {
	border-color: var(--error);
}

.pv-autodiag .opt {
	display: flex;
	align-items: center;
	gap: 10px;
	border: 1.5px solid var(--border);
	border-radius: 3px;
	padding: 11px 14px;
	margin-bottom: 9px;
	cursor: pointer;
	font-size: 14px;
	text-indent: unset;
	opacity: 1;
	transition: .15s;
    height: auto;
}
.pv-autodiag .opt:hover {
	border-color: var(--azul-300);
}
.pv-autodiag .opt input[type="radio"],
.pv-autodiag .opt input[type="checkbox"] {
	accent-color: var(--azul-600);
	-webkit-appearance: auto;
	-moz-appearance: auto;
	appearance: auto;
	display: inline-block;
	position: static;
	opacity: 1;
	visibility: visible;
	clip: auto;
	transform: none;
	background-image: none;
	width: 16px;
	height: 16px;
	flex: none;
	margin: 0;
}
.pv-autodiag .opt input[type="radio"]::before,
.pv-autodiag .opt input[type="radio"]::after,
.pv-autodiag .opt input[type="checkbox"]::before,
.pv-autodiag .opt input[type="checkbox"]::after {
	content: none;
	display: none;
}
.pv-autodiag .opt.sel {
	border-color: var(--azul-500);
	background: var(--azul-100);
}

.pv-autodiag button.rankopt {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	text-align: left;
	background: transparent;
	color: var(--text);
	border: 1.5px solid var(--border);
	border-radius: 3px;
	padding: 11px 14px;
	margin: 0 0 9px;
	cursor: pointer;
	font-family: inherit;
	font-size: 14px;
	line-height: 1.4;
	text-transform: none;
	letter-spacing: 0;
	transition: .15s;
}
.pv-autodiag button.rankopt:hover {
	border-color: var(--azul-300);
	background: transparent;
	color: var(--text);
}
.pv-autodiag button.rankopt.sel {
	border-color: var(--azul-600);
	background: var(--azul-100);
}
.pv-autodiag .ranknum {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	border: 1.5px solid var(--border);
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: inherit;
	font-weight: 700;
	font-size: 12px;
	color: var(--muted);
}
.pv-autodiag .rankopt.sel .ranknum {
	background: var(--azul-600);
	border-color: var(--azul-600);
	color: #fff;
}

.pv-autodiag .qnum {
	font-family: inherit;
	font-weight: 600;
	color: var(--azul-600);
	margin-bottom: .75rem;
}
.pv-autodiag .qtext {
	font-size: 14.5px;
	line-height: 1.5;
	margin-bottom: 10px;
	color: var(--text);
}

.pv-autodiag .scale {
	display: flex;
	gap: 6px;
}
.pv-autodiag button.pill {
	flex: 1;
	min-width: 0;
	text-align: center;
	background: white;
	border: 1.5px solid var(--border);
	border-radius: 3px;
	padding: 9px 0 7px;
	margin: 0;
	cursor: pointer;
	font-family: inherit;
	font-weight: 600;
	font-size: 14px;
	line-height: 1.2;
	color: var(--muted);
	text-transform: none;
	letter-spacing: 0;
	transition: .15s;
}
.pv-autodiag button.pill small {
	display: block;
	font-family: inherit;
	font-size: .55rem;
	line-height: 1.1;
	margin-top: 2px;
	letter-spacing: 0;text-transform: uppercase;
}
.pv-autodiag button.pill:hover {
	border-color: var(--azul-300);
	background: transparent;
	color: var(--muted);
}
.pv-autodiag button.pill.sel,
.pv-autodiag button.pill.sel:hover {
	background: var(--azul-600);
	border-color: var(--azul-600);
	color: #fff;
}

.pv-autodiag .legend {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	padding: 10px 0;
	border-bottom: 1px solid var(--border);
}
.pv-autodiag .legend:last-child {
	border-bottom: none;
}
.pv-autodiag .legnum {
	font-family: inherit;
	font-weight: 700;
	color: #fff;
	background: var(--azul-600);
	width: 22px;
	height: 22px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	flex: none;
}
.pv-autodiag .legend b {
	font-family: inherit;
	font-size: 13.5px;
	color: var(--text);
	display: block;
}
.pv-autodiag .legend span {
	font-size: 12.5px;
	color: var(--muted);
}

.pv-autodiag textarea {
	display: block;
	width: 100%;
	border: 1.5px solid var(--border);
	border-radius: 3px;
	padding: 10px 12px;
	font-family: inherit;
	font-size: 14px;
	background: var(--card);
	color: var(--text);
	resize: vertical;
	min-height: 64px;
}

.pv-autodiag .warn {
	margin: 0;
	padding: 10px 22px 0;
	font-size: 13px;
	text-align: center;
	color: var(--error);
}
.pv-autodiag .warn[hidden] {
	display: none;
}

.pv-autodiag .navbar {
	display: flex;
	gap: 10px;
	padding: 16px 22px 20px;
	border-top: 1px solid var(--border);
}
.pv-autodiag button.btn {
	font-family: inherit;
	font-weight: 600;
	font-size: 14px;
	line-height: 1.3;
	border: none;
	border-radius: 3px;
	padding: 13px 18px;
	margin: 0;
	cursor: pointer;
	flex: 1;
	text-transform: none;
	letter-spacing: 0;
	transition: .15s;
}
.pv-autodiag .btn.primary {
	background: var(--azul-600);
	color: #fff;
}
.pv-autodiag .btn.primary:hover {
	background: var(--azul-700);
	color: #fff;
}
.pv-autodiag .btn.ghost {
	background: transparent;
	color: var(--azul-600);
	border: 1.5px solid var(--border);
	flex: 0 0 46px;
	padding-left: 0;
	padding-right: 0;
}
.pv-autodiag .btn.ghost:hover {
	background: transparent;
	color: var(--azul-700);
	border-color: var(--azul-300);
}

.pv-autodiag button:focus-visible,
.pv-autodiag textarea:focus-visible,
.pv-autodiag .opt:focus-within {
	outline: 2px solid var(--azul-500);
	outline-offset: 2px;
}

.pv-autodiag .dimhead {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 14px;
}
.pv-autodiag .dimchip {
	font-family: inherit;
	font-weight: 700;
	color: #fff;
	background: var(--azul-700);
	border-radius: 3px;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	flex: none;
}

.pv-autodiag .resultscore {
	text-align: center;
	padding: 6px 0 18px;
}
.pv-autodiag .resultscore .num {
	font-family: inherit;
	font-weight: 700;
	font-size: 42px;
	color: var(--azul-700);
}
.pv-autodiag .resultscore .lvl {
	font-family: inherit;
	font-weight: 600;
	font-size: 13px;
	letter-spacing: .05em;
	color: var(--azul-500);
	text-transform: uppercase;
}

.pv-autodiag svg text {
	font-family: inherit;
}

.pv-autodiag .sectionlab {
	font-family: inherit;
	font-weight: 700;
	font-size: 1.25rem;
    margin: 3rem 0 1rem;
	color: var(--text);
	display: flex;
	align-items: center;
	gap: 6px;
}

.pv-autodiag .barrow {
	margin-bottom: 12px;
}
.pv-autodiag .barrow .lbl {
	display: flex;
	justify-content: space-between;
	font-size: 13px;
	margin-bottom: 5px;
}
.pv-autodiag .barrow .lbl b {
	font-weight: 600;
	color: var(--text);
}
.pv-autodiag .barrow .lbl span {
	color: var(--muted);
}
.pv-autodiag .bartrack {
	background: var(--track);
	height: 8px;
	border-radius: 6px;
	overflow: hidden;
}
.pv-autodiag .barfill {
	height: 100%;
	border-radius: 6px;
	background: var(--azul-600);
}
.pv-autodiag .barfill.light {
	background: var(--azul-300);
}
.pv-autodiag .desc {
	font-size: 12.5px;
	color: var(--muted);
	margin-top: 4px;
}

.pv-autodiag .profilebox {
	background: var(--azul-700) !important;
    color: white;
	border-radius: 3px;
	padding: 18px;
	margin-top: 6px;
    text-align: center;
}
.pv-autodiag .profilebox h2,
.pv-autodiag .profilebox h3 {
	color: #fff;
}
.pv-autodiag .profilebox p {
	color: rgba(255, 255, 255, .85);
	margin-bottom: 0;
}

.pv-autodiag .note {
	font-size: .75rem;
  color: var(--muted);
  text-align: left;
  margin-top: 10px;
}

@media (prefers-reduced-motion: reduce) {
	.pv-autodiag .progress i,
	.pv-autodiag .opt,
	.pv-autodiag button {
		transition: none;
	}
}

/* ==========================================================
   Modo popup: botón lanzador + <dialog>
   ========================================================== */

button.pv-autodiag-open {
	display: inline-block;
	background: #1D5580;
	color: #fff;
	border: 0;
	border-radius: 3px;
	padding: 14px 24px;
	margin: 0;
	font-family: inherit;
	font-weight: 600;
	font-size: 15px;
	line-height: 1.3;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
	transition: background .15s;
}
button.pv-autodiag-open:hover,
button.pv-autodiag-open:focus {
	background: #15466E;
	color: #fff;
}
button.pv-autodiag-open:focus-visible {
	outline: 2px solid #2E76A6;
	outline-offset: 2px;
}

dialog.pv-autodiag-modal {
	width: calc(100% - 24px);
	max-width: 800px;
	max-height: none;
	padding: 0;
	border: 0;
	border-radius: 3px;
	background: transparent;
	color: inherit;
	overflow: hidden;
}

@media screen and (max-width:900px) {
    dialog.pv-autodiag-modal{
        max-width: 95vw;
        max-height: 95vh;
        margin: 2.5vh 2.5vw !important;
    }
}

dialog.pv-autodiag-modal::backdrop {
	background: rgba(14, 42, 68, .55);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	animation: pv-autodiag-fade .2s ease-out;
}

.pv-autodiag-modal .pv-autodiag {
	display: block;
	padding: 0;
	background: transparent;
}
.pv-autodiag-modal .pv-autodiag .phone {
	max-width: none;
	box-shadow: none;
	border-radius: 0;
	min-height: 0;
	height: min(780px, calc(100vh - 24px));
	height: min(780px, calc(100dvh - 24px));
}
.pv-autodiag-modal .pv-autodiag .screen {
	min-height: 0;
	overscroll-behavior: contain;
}
.pv-autodiag-modal .pv-autodiag .brandrow {
	padding-right: 38px;
}

button.pv-autodiag-close {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .16);
	color: #fff;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	transition: background .15s;
}
button.pv-autodiag-close:hover,
button.pv-autodiag-close:focus {
	background: rgba(255, 255, 255, .32);
	color: #fff;
}
button.pv-autodiag-close:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

/* Si el navegador no soporta desenfoque, la capa se hace más opaca */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
	dialog.pv-autodiag-modal::backdrop {
		background: rgba(14, 42, 68, .85);
	}
}

@keyframes pv-autodiag-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
	dialog.pv-autodiag-modal::backdrop {
		animation: none;
	}
}

/* Evita que la página de fondo se desplace con el popup abierto */
html.pv-autodiag-lock {
	overflow: hidden;
}

/* Botón de descarga del PDF en la pantalla de resultados */
.pv-autodiag button.btn.pdfbtn {
	display: block;
	width: 100%;
	flex: none;
	margin-top: 4px;
}
.pv-autodiag button.btn.pdfbtn:disabled {
	opacity: .7;
	cursor: wait;
}

/* Formulario */
span.wpcf7-acceptance label {
  display: inline-block;
  opacity: 1;
  text-indent: inherit;
  height: auto;
}

/* ==========================================================
   Aviso flotante tras finalizar (fuera del popup, en <body>)
   ========================================================== */
.pv-autodiag-toast {
	position: fixed;
	right: 16px;
	bottom: 16px;
	z-index: 9999;
	width: 340px;
	max-width: calc(100vw - 32px);
	padding: 16px 40px 16px 16px;
	background: #FFFFFF;
	color: #152535;
	border: 1px solid #DDE6EE;
	border-left: 5px solid hsl(210, 100%, 39%);
	border-radius: 10px;
	box-shadow: 0 8px 28px rgba(14, 42, 68, .25);
	font-family: inherit;
	font-size: 15px;
	line-height: 1.4;
	box-sizing: border-box;
	animation: pv-autodiag-toast-in .3s ease-out;
}
.pv-autodiag-toast *,
.pv-autodiag-toast *::before,
.pv-autodiag-toast *::after {
	box-sizing: border-box;
}
.pv-autodiag-toast p {
	margin: 0 0 6px;
	padding: 0;
}
.pv-autodiag-toast .pv-autodiag-toast__title {
	font-weight: 700;
	color: hsl(210, 100%, 20%);
}
.pv-autodiag-toast .pv-autodiag-toast__text {
	margin-bottom: 12px;
}
.pv-autodiag-toast button {
	font-family: inherit;
	cursor: pointer;
}
.pv-autodiag-toast button.pv-autodiag-toast__open {
	display: inline-block;
	padding: 9px 16px;
	background: hsl(210, 100%, 39%);
	color: #FFFFFF;
	border: 0;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	text-transform: none;
	letter-spacing: 0;
}
.pv-autodiag-toast button.pv-autodiag-toast__open:hover,
.pv-autodiag-toast button.pv-autodiag-toast__open:focus-visible {
	background: hsl(210, 100%, 30%);
}
.pv-autodiag-toast button.pv-autodiag-toast__close {
	position: absolute;
	top: 6px;
	right: 8px;
	width: 28px;
	height: 28px;
	padding: 0;
	background: transparent;
	color: #5E7286;
	border: 0;
	font-size: 22px;
	line-height: 1;
}
.pv-autodiag-toast button.pv-autodiag-toast__close:hover,
.pv-autodiag-toast button.pv-autodiag-toast__close:focus-visible {
	color: #152535;
}

@keyframes pv-autodiag-toast-in {
	from { opacity: 0; transform: translateY(16px); }
	to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
	.pv-autodiag-toast {
		left: 12px;
		right: 12px;
		bottom: 12px;
		width: auto;
		max-width: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.pv-autodiag-toast {
		animation: none;
	}
}

/* ==========================================================
   Responsive del popup
   (el ancho ya se adapta con calc(100% - 24px); max-width: 800px
   solo limita el tamaño en pantallas grandes)
   ========================================================== */
 
/* Móvil y tablet pequeña: el popup ocupa toda la pantalla */
@media (max-width: 600px) {
	dialog.pv-autodiag-modal {
		width: 100%;
		height: 100%;
		margin: 0;
		border-radius: 0;
	}
    dialog.pv-autodiag-modal .pv-autodiag{
        width: 95vw;
        max-height: 95vh;
    }
	.pv-autodiag-modal .pv-autodiag .phone {
		/* height: 98vh;
		height: 98dvh; */
	}
	.pv-autodiag .topbar {
		padding: 12px 16px 10px;
	}
	.pv-autodiag .brandrow {
		margin-bottom: 8px;
	}
	.pv-autodiag .screen {
		padding: 18px 16px 14px;
	}
	.pv-autodiag h2 {
		font-size: 1.5rem;
	}
	.pv-autodiag h3 {
		font-size: 1.15rem;
	}
	.pv-autodiag .sectionlab {
		font-size: 1.25rem;
		margin: 1.5rem 0 .5rem;
	}
	.pv-autodiag .card {
		padding: 12px;
	}
	.pv-autodiag .navbar {
		padding: 12px 16px 14px;
		padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
	}
}
 
/* Móvil estrecho: la escala 1–5 no cabe con sus etiquetas.
   Se muestran solo los números (las etiquetas siguen para lectores de pantalla)
   y una leyenda de los extremos bajo cada escala. */
@media (max-width: 480px) {
	.pv-autodiag .scale {
		flex-wrap: wrap;
		row-gap: 8px;
	}
	.pv-autodiag button.pill {
		position: relative;
		padding: 12px 0;
		font-size: 16px;
	}
	.pv-autodiag button.pill small {
		position: absolute;
		width: 1px;
		height: 1px;
		margin: 0;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}
	.pv-autodiag .scale::after {
		content: '1 = Nunca · 5 = Siempre';
		flex: 0 0 100%;
		text-align: center;
		font-size: 11px;
		color: var(--muted);
	}
}
 
/* Móvil en horizontal (poca altura): cabecera y barra inferior compactas */
@media (max-height: 520px) and (orientation: landscape) {
	.pv-autodiag-modal .pv-autodiag .phone {
		height: calc(100vh - 12px);
		height: calc(100dvh - 12px);
	}
	.pv-autodiag .topbar {
		padding: 8px 16px;
	}
	.pv-autodiag .brandrow {
		margin-bottom: 6px;
	}
	.pv-autodiag .screen {
		padding: 14px 18px;
	}
	.pv-autodiag h2 {
		font-size: 1.4rem;
	}
	.pv-autodiag h3 {
		font-size: 1.1rem;
	}
	.pv-autodiag .navbar {
		padding: 8px 16px;
	}
	.pv-autodiag button.btn {
		padding: 9px 14px;
	}
}
