/**
 * Pilar Vicente — Ficha de propiedad (rediseño 2026).
 *
 * Fuente de verdad: disenos/Ficha.dc.html + images/03-ficha.png.
 * Móvil: disenos/Movil.dc.html § Ficha + Paso 10 de GUIA-IMPLEMENTACION.md.
 * Depende de pv-ds.css (tokens, botones, tarjeta compacta, formularios, pines).
 *
 * @package PilarVicente\Core
 */

/* ═══════════════════════════════════════════════════════════════════════════
   0 · CONTENEDOR — la ficha usa 1200px, no los 1360px del resto
   ═══════════════════════════════════════════════════════════════════════════ */

.pv-ficha { background: var(--pv-marfil); }
.pv-ficha__wrap {
	max-width: 1200px;
	margin: 0 auto;
	padding-left: 32px;
	padding-right: 32px;
	width: 100%;
}

.pv-ficha__breadcrumb {
	font-size: 13px;
	color: var(--pv-txt-3);
	margin-bottom: 16px;
	padding-top: 20px;
}
.pv-ficha__breadcrumb span[aria-current] { color: var(--pv-txt); }

/* Acción de vuelta en móvil (en escritorio la cubre el breadcrumb). */
.pv-ficha__volver {
	display: none;
	font-size: 13px;
	font-weight: 600;
	color: var(--pv-marca);
	text-decoration: none;
	padding-top: 16px;
	margin-bottom: 12px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   1 · GALERÍA
   ═══════════════════════════════════════════════════════════════════════════ */

.pv-galeria {
	display: grid;
	grid-template-columns: 1fr 108px;
	gap: 14px;
	height: 480px;
}

.pv-galeria__principal {
	position: relative;
	border-radius: var(--pv-r-card);
	overflow: hidden;
	background: #eae3db;
	cursor: zoom-in;
	border: none;
	padding: 0;
	width: 100%;
}
/* Dos capas apiladas para el fundido entre fotos (pv-ficha.js `intercambiar`). */
.pv-galeria__capa {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: opacity .18s ease;
}
.pv-galeria__capa.is-atras { opacity: 0; }

/* Spinner del peor caso: solo si el decode de la nueva foto tarda (>~250 ms). */
.pv-galeria__cargando {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 34px;
	height: 34px;
	margin: -17px 0 0 -17px;
	border: 3px solid rgba(255, 255, 255, .35);
	border-top-color: #fff;
	border-radius: 50%;
	opacity: 0;
	pointer-events: none;
	transition: opacity .15s;
	z-index: 4;
}
.pv-galeria__principal.is-cargando .pv-galeria__cargando {
	opacity: 1;
	animation: pv-galeria-spin .7s linear infinite;
}
@keyframes pv-galeria-spin { to { transform: rotate(360deg); } }

/* La marca de agua de la principal va al 16% y al 55% de ancho (Ficha.dc.html) */
.pv-galeria__principal .pv-wm { inset: 0; z-index: 2; }
.pv-galeria__principal .pv-wm img { width: 55%; max-width: 408px; opacity: .16; height: auto; }

.pv-galeria__ampliar {
	position: absolute;
	bottom: 16px;
	right: 16px;
	z-index: 3;
	background: rgba(42, 21, 18, .78);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	padding: 8px 15px;
	border-radius: var(--pv-r-pill);
	display: flex;
	align-items: center;
	gap: 8px;
	pointer-events: none;
}

.pv-galeria__thumbs {
	display: flex;
	flex-direction: column;
	gap: 12px;
	overflow-y: auto;
	padding-right: 2px;
}
.pv-galeria__thumbs::-webkit-scrollbar { width: 6px; }
.pv-galeria__thumbs::-webkit-scrollbar-thumb { background: rgba(42, 21, 18, .28); border-radius: 4px; }

.pv-galeria__thumb {
	position: relative;
	height: 88px;
	flex-shrink: 0;
	border-radius: 12px;
	overflow: hidden;
	cursor: pointer;
	border: 2.5px solid transparent;
	padding: 0;
	background: none;
	width: 100%;
}
.pv-galeria__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pv-galeria__thumb.is-activa { border-color: var(--pv-marca); }
.pv-galeria__thumb.is-activa::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(143, 26, 30, .12);
}
/* ── Lightbox ────────────────────────────────────────────────────────────── */
.pv-lightbox {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 200;
	background: rgba(20, 10, 8, .92);
	align-items: center;
	justify-content: center;
	flex-direction: column;
}
.pv-lightbox.is-abierto { display: flex; }
.pv-lightbox__figura { position: relative; display: flex; }
.pv-lightbox__figura img {
	max-width: 80vw;
	max-height: 78vh;
	border-radius: 14px;
	object-fit: contain;
}
.pv-lightbox__figura .pv-wm { inset: 0; }
.pv-lightbox__figura .pv-wm img { width: 53%; max-width: 504px; opacity: .16; height: auto; }

.pv-lightbox__btn {
	position: absolute;
	background: rgba(255, 255, 255, .14);
	color: #fff;
	border: none;
	border-radius: var(--pv-r-pill);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	line-height: 1;
}
.pv-lightbox__cerrar { top: 24px; right: 32px; width: 46px; height: 46px; font-size: 22px; }
.pv-lightbox__prev,
.pv-lightbox__next { top: 50%; transform: translateY(-50%); width: 52px; height: 52px; font-size: 26px; }
.pv-lightbox__prev { left: 32px; }
.pv-lightbox__next { right: 32px; }
.pv-lightbox__contador { color: #fff; font-size: 15px; font-weight: 600; margin-top: 20px; }

/* ═══════════════════════════════════════════════════════════════════════════
   2 · CUERPO
   ═══════════════════════════════════════════════════════════════════════════ */

.pv-ficha__cuerpo {
	display: grid;
	grid-template-columns: 1fr 380px;
	gap: 40px;
	align-items: start;
	padding: 32px 0;
}

.pv-ficha__tags { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.pv-tag {
	background: var(--pv-arena);
	color: var(--pv-marca);
	font-size: 12px;
	font-weight: 700;
	padding: 6px 14px;
	border-radius: var(--pv-r-pill);
	line-height: 1.2;
}
.pv-tag--oferta { background: var(--pv-marca); color: #fff; }
/* Arriendo en verde para diferenciarlo de venta (rojo), útil en propiedades dual. */
.pv-tag--oferta.pv-tag--arriendo { background: var(--pv-verde); }

.pv-ficha__titulo {
	font-family: var(--pv-display);
	font-weight: 800;
	font-size: 40px;
	letter-spacing: -.02em;
	margin: 0;
	color: var(--pv-txt);
	text-wrap: balance;
}
.pv-ficha__dir { font-size: 16px; color: var(--pv-txt-3); margin-top: 8px; }

/* ── Specs (4 tiles) ─────────────────────────────────────────────────────── */
.pv-specs {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 14px;
	margin-top: 28px;
}
.pv-spec {
	background: #fff;
	border-radius: 14px;
	padding: 20px;
	text-align: center;
	box-shadow: 0 6px 16px rgba(60, 20, 20, .05);
}
.pv-spec__valor {
	font-family: var(--pv-display);
	font-size: 26px;
	font-weight: 800;
	color: var(--pv-txt);
	line-height: 1.1;
}
.pv-spec__label { font-size: 13px; color: var(--pv-txt-3); margin-top: 3px; }

/* ── Secciones ───────────────────────────────────────────────────────────── */
.pv-ficha__seccion { margin-top: 36px; }
.pv-ficha__h2 {
	font-family: var(--pv-display);
	font-weight: 700;
	font-size: 24px;
	margin: 0 0 14px;
	color: var(--pv-txt);
}
.pv-ficha__texto { font-size: 16px; line-height: 1.7; color: var(--pv-txt-2); }
.pv-ficha__texto p + p { margin-top: 14px; }

.pv-caracts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pv-caract {
	display: flex;
	align-items: center;
	gap: 10px;
	background: #fff;
	border-radius: var(--pv-r-input);
	padding: 14px 16px;
	font-size: 14px;
	font-weight: 500;
	color: var(--pv-txt);
}
.pv-caract__check { color: var(--pv-marca); font-weight: 800; }

.pv-ficha__mapa { height: 300px; border-radius: 16px; overflow: hidden; background: var(--pv-arena); }
.pv-ficha__mapa-nota { margin: 0.6rem 0 0; font-size: 0.85rem; color: var(--pv-tinta-60, #6b5750); }
.pv-ficha__video { position: relative; padding-top: 56.25%; border-radius: 16px; overflow: hidden; }
.pv-ficha__video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ═══════════════════════════════════════════════════════════════════════════
   3 · SIDEBAR STICKY
   ═══════════════════════════════════════════════════════════════════════════ */

.pv-side { position: sticky; top: 24px; }
.pv-side__caja {
	background: #fff;
	border-radius: var(--pv-r-card);
	padding: 28px;
	box-shadow: 0 16px 40px rgba(60, 20, 20, .1);
}
.pv-side__label {
	font-size: 13px;
	color: var(--pv-txt-3);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .06em;
}
.pv-side__precio {
	font-family: var(--pv-display);
	font-size: 38px;
	font-weight: 800;
	color: var(--pv-marca);
	margin-top: 4px;
	line-height: 1.1;
}
.pv-side__precio--dual { font-size: 30px; }
.pv-side__precio-sufijo { font-size: .55em; font-weight: 700; }
.pv-side__equiv { font-size: 14px; color: var(--pv-txt-3); margin-top: 2px; }
.pv-side__precio-fila + .pv-side__precio-fila { margin-top: 10px; }

.pv-side__acciones { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }
.pv-side__acciones .pv-btn { width: 100%; padding: 15px; border-radius: var(--pv-r-input); font-size: 15px; }

.pv-side__bloque {
	margin-top: 24px;
	padding-top: 24px;
	border-top: 1px solid rgba(42, 21, 18, .1);
}
.pv-side__h3 {
	font-family: var(--pv-display);
	font-size: 17px;
	font-weight: 700;
	margin: 0 0 14px;
	color: var(--pv-txt);
}

/* ── Calculadora de dividendo ────────────────────────────────────────────── */
.pv-calc__label { display: block; font-size: 13px; font-weight: 600; color: var(--pv-txt-3); margin-bottom: 6px; }
.pv-calc__label + .pv-calc__label { margin-top: 12px; }
.pv-calc__campo {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 15px;
	font-weight: 600;
	padding: 11px 14px;
	border: 1px solid var(--pv-borde);
	border-radius: 10px;
	background: #fff;
	width: 100%;
	appearance: none;
	-webkit-appearance: none;
	color: var(--pv-txt);
	font-family: var(--pv-texto);
}
select.pv-calc__campo {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 10 7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238f1a1e' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
	padding-right: 32px;
	cursor: pointer;
}
.pv-calc__resultado {
	background: var(--pv-arena);
	border-radius: var(--pv-r-input);
	padding: 16px;
	margin-top: 16px;
	text-align: center;
}
.pv-calc__resultado-label { font-size: 13px; color: var(--pv-txt-3); font-weight: 600; }
.pv-calc__resultado-valor {
	font-family: var(--pv-display);
	font-size: 26px;
	font-weight: 800;
	color: var(--pv-marca);
	margin-top: 2px;
	line-height: 1.1;
}
.pv-calc__nota { font-size: 11px; color: var(--pv-txt-3); margin-top: 10px; line-height: 1.5; text-align: center; }

/* ── Agente ──────────────────────────────────────────────────────────────── */
.pv-agente { display: flex; align-items: center; gap: 14px; }
.pv-agente__avatar {
	width: 52px;
	height: 52px;
	flex-shrink: 0;
	border-radius: var(--pv-r-pill);
	background: var(--pv-marca);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: var(--pv-display);
	font-weight: 800;
	font-size: 20px;
}
.pv-agente__nombre { font-weight: 700; font-size: 15px; }
.pv-agente__rol { font-size: 13px; color: var(--pv-txt-3); }

/* ── Comparar / Guardar ──────────────────────────────────────────────────── */
.pv-side__secundarias { display: flex; gap: 10px; margin-top: 14px; }
.pv-side__secundarias > * {
	flex: 1;
	text-align: center;
	background: #fff;
	border: 1px solid rgba(42, 21, 18, .12);
	font-size: 14px;
	font-weight: 600;
	padding: 12px;
	border-radius: var(--pv-r-input);
	cursor: pointer;
	color: var(--pv-txt);
	font-family: var(--pv-texto);
}
.pv-side__secundarias > *:hover { border-color: var(--pv-marca); color: var(--pv-marca); }
.pv-side__secundarias [aria-pressed="true"] { border-color: var(--pv-marca); color: var(--pv-marca); }

/* Paneles que se despliegan (agendar visita, enviar mensaje) */
.pv-side__panel { display: none; margin-top: 16px; }
.pv-side__panel.is-abierto { display: block; }

/* ═══════════════════════════════════════════════════════════════════════════
   4 · SIMILARES + PIE COMPACTO
   ═══════════════════════════════════════════════════════════════════════════ */

.pv-similares { padding: 24px 0 80px; }
.pv-similares__titulo {
	font-family: var(--pv-display);
	font-weight: 800;
	font-size: 30px;
	letter-spacing: -.02em;
	margin: 0 0 24px;
	color: var(--pv-txt);
}
.pv-similares__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }

/* Pie compacto del prototipo: una línea con marca + datos de contacto */
.pv-pie-min { background: var(--pv-tinta); color: var(--pv-footer-txt); }
.pv-pie-min__inner {
	max-width: 1200px;
	margin: 0 auto;
	padding: 40px 32px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 16px;
}
.pv-pie-min__marca {
	font-family: var(--pv-display);
	font-weight: 800;
	font-size: 22px;
	color: #fff;
}
.pv-pie-min__datos { font-size: 14px; }

/* Barra de acción fija — solo móvil */
.pv-barra-fija { display: none; }

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1100px) {
	.pv-ficha__cuerpo { grid-template-columns: 1fr; gap: 32px; }
	.pv-side { position: static; }
	.pv-galeria { height: 420px; }
}

@media (max-width: 900px) {
	.pv-caracts { grid-template-columns: repeat(2, 1fr); }
	.pv-similares__grid { grid-template-columns: repeat(2, 1fr); }
	.pv-ficha__titulo { font-size: 32px; }
}

/* ── ≤640px: Movil.dc.html § Ficha ───────────────────────────────────────── */
@media (max-width: 640px) {
	.pv-ficha__wrap { padding-left: 20px; padding-right: 20px; }
	.pv-ficha__breadcrumb { display: none; }
	/* En móvil, en vez del breadcrumb completo, una sola acción de vuelta. */
	.pv-ficha__volver { display: inline-block; }

	/* Galería a pantalla completa con contador "1 / 18" */
	.pv-galeria {
		display: block;
		height: 300px;
		margin: 0 -20px;
	}
	.pv-galeria__principal { border-radius: 0; height: 100%; }
	.pv-galeria__thumbs { display: none; }
	.pv-galeria__ampliar {
		bottom: 14px;
		right: 16px;
		background: rgba(42, 21, 18, .75);
		font-size: 12px;
		padding: 5px 12px;
	}

	/* El contenido sube sobre la foto como una hoja */
	.pv-ficha__cuerpo {
		border-radius: 24px 24px 0 0;
		margin-top: -24px;
		position: relative;
		background: var(--pv-marfil);
		padding: 24px 0 0;
		gap: 24px;
	}
	.pv-ficha__titulo { font-size: 28px; }
	.pv-ficha__dir { font-size: 14px; margin-top: 4px; }
	.pv-tag { font-size: 11px; padding: 5px 12px; }

	/* Specs en fila de 4 (Paso 10) */
	.pv-specs { grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 20px; }
	.pv-spec { padding: 14px 6px; border-radius: 12px; }
	.pv-spec__valor { font-size: 20px; }
	.pv-spec__label { font-size: 10px; }

	.pv-ficha__seccion { margin-top: 24px; }
	.pv-ficha__h2 { font-size: 19px; margin-bottom: 10px; }
	.pv-ficha__texto { font-size: 14px; line-height: 1.65; }
	.pv-caracts { grid-template-columns: 1fr; gap: 8px; }
	.pv-ficha__mapa { height: 220px; }

	.pv-side__caja { padding: 22px; border-radius: 18px; }
	.pv-side__precio { font-size: 32px; }

	.pv-similares { padding: 8px 0 24px; }
	.pv-similares__titulo { font-size: 22px; margin-bottom: 16px; }
	.pv-similares__grid { grid-template-columns: 1fr; gap: 14px; }

	.pv-lightbox__prev { left: 12px; }
	.pv-lightbox__next { right: 12px; }
	.pv-lightbox__cerrar { top: 14px; right: 16px; }

	/* Barra de acción fija abajo (WhatsApp + Agendar visita) */
	.pv-barra-fija {
		display: flex;
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 90;
		background: #fff;
		border-top: 1px solid var(--pv-sep);
		padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
		gap: 10px;
	}
	.pv-barra-fija .pv-btn {
		flex: 1;
		font-size: 15px;
		font-weight: 700;
		padding: 14px;
		border-radius: var(--pv-r-input);
	}
	/* Hueco para que la barra no tape el final de la página */
	.pv-pie-min { padding-bottom: 84px; }
	/* El WhatsApp flotante estorbaría junto a la barra fija */
	.pv-wsp-flotante { display: none; }
}

/* Equivalencia en pesos del dividendo, bajo el valor en UF */
.pv-calc__resultado-equiv { font-size: 13px; color: var(--pv-txt-2); font-weight: 600; margin-top: 2px; }
