/**
 * Barra compartir / imprimir — ficha de detalle.
 */

.apis-detail-share {
	margin: 14px 0 4px;
}

.apis-detail-share--align-left .apis-detail-share__list {
	justify-content: flex-start;
}

.apis-detail-share--align-center .apis-detail-share__list {
	justify-content: center;
}

.apis-detail-share--align-right .apis-detail-share__list {
	justify-content: flex-end;
}

.apis-detail-share--slot-sidebar {
	margin: 0 0 16px;
	padding: 10px 12px;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	background: #fff;
	line-height: 0;
}

.apis-detail-share--slot-sidebar .apis-detail-share__list {
	justify-content: flex-start;
	line-height: 1;
	margin: 0;
	padding: 0;
}

.apis-detail-share--slot-sidebar.apis-detail-share--align-center .apis-detail-share__list {
	justify-content: center;
}

.apis-detail-share--slot-sidebar.apis-detail-share--align-right .apis-detail-share__list {
	justify-content: flex-end;
}

.apis-detail-share--slot-sidebar .apis-detail-share__item {
	line-height: 0;
}

.apis-detail-share--slot-sidebar .apis-detail-share__btn {
	margin: 0;
	vertical-align: top;
}

.apis-detail-share--slot-sidebar .screen-reader-text {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

.apis-detail-share__list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.apis-detail-share__item {
	margin: 0;
	padding: 0;
}

.apis-detail-share__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	background: #fff;
	color: #334155;
	font-size: 1.05rem;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
	transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.apis-detail-share__btn:hover,
.apis-detail-share__btn:focus {
	transform: translateY(-1px);
	box-shadow: 0 4px 10px rgba(15, 23, 42, 0.1);
	outline: none;
	text-decoration: none;
}

.apis-detail-share__btn--whatsapp {
	color: #fff;
	background: #25d366;
	border-color: #25d366;
}

.apis-detail-share__btn--whatsapp:hover,
.apis-detail-share__btn--whatsapp:focus {
	background: #1ebe57;
	border-color: #1ebe57;
	color: #fff;
}

.apis-detail-share__btn--facebook {
	color: #fff;
	background: #1877f2;
	border-color: #1877f2;
}

.apis-detail-share__btn--facebook:hover,
.apis-detail-share__btn--facebook:focus {
	background: #0f66d8;
	border-color: #0f66d8;
	color: #fff;
}

.apis-detail-share__btn--x {
	color: #fff;
	background: #0f172a;
	border-color: #0f172a;
}

.apis-detail-share__btn--x:hover,
.apis-detail-share__btn--x:focus {
	background: #1e293b;
	border-color: #1e293b;
	color: #fff;
}

.apis-detail-share__btn--email,
.apis-detail-share__btn--copy,
.apis-detail-share__btn--print {
	color: #475569;
	background: #f8fafc;
}

.apis-detail-share__btn--email:hover,
.apis-detail-share__btn--copy:hover,
.apis-detail-share__btn--print:hover,
.apis-detail-share__btn--email:focus,
.apis-detail-share__btn--copy:focus,
.apis-detail-share__btn--print:focus {
	background: #eef2f7;
	border-color: #cbd5e1;
	color: #0f172a;
}

/*
 * Aviso flotante (enlace copiado, PDF): debajo de la barra para no quedar tapado por
 * bloques superiores (migas con z-index, sidebar sticky); aislado de los estilos del tema.
 */
.apis-detail-share {
	position: relative;
	z-index: 5;
}

.apis-detail-share__toast {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	z-index: 20;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	max-width: min(320px, 100%);
	margin: 0;
	padding: 9px 14px;
	border: 0;
	border-radius: 10px;
	background: #0f172a;
	color: #fff;
	font-family: inherit;
	font-size: 14px;
	font-weight: 500;
	font-style: normal;
	line-height: 1.35;
	letter-spacing: normal;
	text-transform: none;
	white-space: nowrap;
	box-shadow: 0 10px 24px rgba(15, 23, 42, 0.25);
	pointer-events: none;
	opacity: 0;
	transform: translateY(-4px);
	transition: opacity 0.18s ease, transform 0.18s ease;
}

.apis-detail-share__toast.is-visible {
	opacity: 1;
	transform: translateY(0);
}

.apis-detail-share__toast[hidden] {
	display: none !important;
}

.apis-detail-share__toast::after {
	content: "";
	position: absolute;
	bottom: 100%;
	left: 18px;
	border: 6px solid transparent;
	border-bottom-color: #0f172a;
}

.apis-detail-share__toast-icon {
	flex-shrink: 0;
	font-size: 16px;
	line-height: 1;
	color: #4ade80;
}

.apis-detail-share__toast-text {
	overflow: hidden;
	text-overflow: ellipsis;
}

.apis-detail-share__toast--error {
	background: #7f1d1d;
}

.apis-detail-share__toast--error::after {
	border-bottom-color: #7f1d1d;
}

.apis-detail-share__toast--error .apis-detail-share__toast-icon {
	color: #fca5a5;
}

.apis-detail-share__toast--info .apis-detail-share__toast-icon {
	color: #93c5fd;
}

.apis-detail-share--align-center .apis-detail-share__toast {
	left: 50%;
	transform: translate(-50%, -4px);
}

.apis-detail-share--align-center .apis-detail-share__toast.is-visible {
	transform: translate(-50%, 0);
}

.apis-detail-share--align-center .apis-detail-share__toast::after {
	left: 50%;
	margin-left: -6px;
}

.apis-detail-share--align-right .apis-detail-share__toast {
	left: auto;
	right: 0;
}

.apis-detail-share--align-right .apis-detail-share__toast::after {
	left: auto;
	right: 18px;
}

.apis-detail-share--slot-sidebar.apis-detail-share--align-left .apis-detail-share__toast {
	left: 12px;
}

.apis-detail-share--slot-sidebar.apis-detail-share--align-right .apis-detail-share__toast {
	left: auto;
	right: 12px;
}

/* Anclado bajo el botón pulsado (posición calculada en JS) */
.apis-detail-share .apis-detail-share__toast.is-anchored {
	left: var(--apis-toast-left, 0);
	right: auto;
	transform: translateY(-4px);
}

.apis-detail-share .apis-detail-share__toast.is-anchored.is-visible {
	transform: translateY(0);
}

.apis-detail-share .apis-detail-share__toast.is-anchored::after {
	left: var(--apis-toast-arrow, 18px);
	right: auto;
	margin-left: 0;
}

@media (prefers-reduced-motion: reduce) {
	.apis-detail-share__toast {
		transition: none;
	}
}

/* Showcase / Atelier: ligeramente más compacto bajo el hero */
.apis-detail-share--showcase,
.apis-detail-share--atelier {
	margin: 16px 0 0;
}

.apis-detail-share--atelier .apis-detail-share__btn {
	border-radius: 999px;
}

@media (max-width: 575px) {
	.apis-detail-share__btn {
		width: 36px;
		height: 36px;
		font-size: 1rem;
	}
}

/* ==========================================================================
   Impresión: solo la ficha, sin recortar bloques (legal, etc.)
   ========================================================================== */
@page {
	size: A4;
	margin: 12mm 14mm;
}

@media print {
	html.apis-print-property,
	html.apis-print-property body {
		background: #fff !important;
		color: #111 !important;
		height: auto !important;
		min-height: 0 !important;
		overflow: visible !important;
		position: static !important;
	}

	/* Chrome del sitio: ocultar sin ocupar espacio (la ficha se mueve a body vía JS) */
	html.apis-print-property body > *:not(.apis-property-detail):not(script):not(style):not(link) {
		display: none !important;
	}

	html.apis-print-property .apis-property-detail {
		display: block !important;
		position: static !important;
		left: auto !important;
		top: auto !important;
		float: none !important;
		width: 100% !important;
		max-width: 100% !important;
		margin: 0 !important;
		padding: 0 !important;
		background: #fff !important;
		color: #111 !important;
		overflow: visible !important;
		height: auto !important;
		min-height: 0 !important;
	}

	html.apis-print-property .apis-property-detail,
	html.apis-print-property .apis-property-detail * {
		visibility: visible !important;
		box-shadow: none !important;
		text-shadow: none !important;
		overflow: visible !important;
		max-height: none !important;
	}

	html.apis-print-property .apis-property-detail .container {
		max-width: 100% !important;
		width: 100% !important;
		padding: 0 !important;
		margin: 0 !important;
	}

	html.apis-print-property .apis-property-layout,
	html.apis-print-property .apis-showcase-layout,
	html.apis-print-property .apis-showcase-main-body {
		display: block !important;
		grid-template-columns: 1fr !important;
		gap: 0 !important;
		overflow: visible !important;
	}

	html.apis-print-property .apis-property-detail .main-content {
		width: 100% !important;
		max-width: 100% !important;
		float: none !important;
		overflow: visible !important;
	}

	/* Elementos de la ficha que no aportan en papel */
	html.apis-print-property .apis-detail-share,
	html.apis-print-property .apis-detail-contact-dock,
	html.apis-print-property .apis-detail-mortgage-dock,
	html.apis-print-property .apis-atelier-mortgage-fab,
	html.apis-print-property .apis-property-lightbox,
	html.apis-print-property .apis-detail-gallery-carousel__nav,
	html.apis-print-property .apis-detail-gallery-carousel__counter,
	html.apis-print-property .apis-detail-gallery-index,
	html.apis-print-property .apis-detail-gallery-carousel__thumbs,
	html.apis-print-property .apis-chatgpt-detail-cta,
	html.apis-print-property .apis-property-detail .sidebar,
	html.apis-print-property .apis-related-properties,
	html.apis-print-property .apis-property-related,
	html.apis-print-property .apis-related-fullwidth,
	html.apis-print-property .apis-premium-related-properties,
	html.apis-print-property .apis-property-modal,
	html.apis-print-property .apis-request-info-btn,
	html.apis-print-property .apis-mortgage-calculator,
	html.apis-print-property .apis-property-tour,
	html.apis-print-property .apis-property-videos,
	html.apis-print-property .apis-detail-visit-count,
	html.apis-print-property .apis-language-fallback-notice,
	html.apis-print-property .apis-breadcrumbs,
	html.apis-print-property .breadcrumb,
	html.apis-print-property .apis-print-hide,
	html.apis-print-property .no-print {
		display: none !important;
	}

	/* Cabecera limpia */
	html.apis-print-property .apis-showcase-hero-band,
	html.apis-print-property .apis-property-main-info {
		background: transparent !important;
		color: #111 !important;
		padding: 0 0 10px !important;
		margin: 0 0 12px !important;
		border: none !important;
		box-shadow: none !important;
		page-break-after: avoid;
		break-after: avoid-page;
	}

	html.apis-print-property .apis-showcase-hero-title,
	html.apis-print-property .apis-property-main-info h1 {
		color: #111 !important;
		font-size: 18pt !important;
		line-height: 1.3 !important;
		margin: 0 0 6px !important;
		page-break-after: avoid;
		break-after: avoid;
		white-space: normal !important;
		overflow: visible !important;
		text-overflow: clip !important;
		max-height: none !important;
		word-break: break-word !important;
		overflow-wrap: anywhere !important;
	}

	/* Mapa: iframe no imprime bien; se deja el bloque y se oculta el iframe */
	html.apis-print-property .apis-property-map {
		display: block !important;
		page-break-inside: avoid;
		break-inside: avoid;
		overflow: visible !important;
		max-height: none !important;
	}

	html.apis-print-property .apis-property-map iframe,
	html.apis-print-property .apis-property-map__area,
	html.apis-print-property .apis-property-map__tiles {
		display: none !important;
	}

	html.apis-print-property .apis-property-map::after {
		content: attr(data-print-map-note);
		display: block;
		font-size: 9pt;
		color: #555;
		margin-top: 4px;
	}

	html.apis-print-property .apis-property-ref,
	html.apis-print-property .apis-property-location,
	html.apis-print-property .apis-property-location strong {
		color: #333 !important;
		font-size: 10pt !important;
	}

	html.apis-print-property .apis-property-price,
	html.apis-print-property .apis-showcase-hero-price,
	html.apis-print-property .apis-price-value {
		color: #111 !important;
		background: transparent !important;
		font-size: 14pt !important;
		font-weight: 700 !important;
		padding: 0 !important;
	}

	html.apis-print-property .apis-showcase-stats-grid,
	html.apis-print-property .apis-property-features {
		display: flex !important;
		flex-wrap: wrap !important;
		gap: 8px 16px !important;
		margin: 8px 0 14px !important;
		padding: 8px 0 !important;
		border-top: 1px solid #ccc !important;
		border-bottom: 1px solid #ccc !important;
		background: transparent !important;
		page-break-inside: avoid;
		break-inside: avoid;
	}

	html.apis-print-property .apis-showcase-stat-card,
	html.apis-print-property .apis-property-feature-card {
		background: transparent !important;
		border: none !important;
		box-shadow: none !important;
		padding: 0 !important;
		color: #111 !important;
	}

	html.apis-print-property .apis-detail-gallery,
	html.apis-print-property .apis-detail-gallery-carousel,
	html.apis-print-property .apis-property-gallery,
	html.apis-print-property .apis-detail-gallery-grid {
		margin: 0 0 14px !important;
		padding: 0 !important;
		border: none !important;
		box-shadow: none !important;
		border-radius: 0 !important;
		page-break-inside: avoid;
		break-inside: avoid;
	}

	html.apis-print-property .apis-detail-gallery-carousel__stage,
	html.apis-print-property .apis-detail-gallery-carousel__viewport,
	html.apis-print-property .apis-detail-gallery-carousel__track {
		height: auto !important;
		min-height: 0 !important;
		max-height: none !important;
		overflow: visible !important;
		transform: none !important;
		display: block !important;
	}

	html.apis-print-property .apis-detail-gallery-carousel__slide:not(.apis-print-keep),
	html.apis-print-property .apis-detail-gallery-carousel__slide.apis-print-hide {
		display: none !important;
	}

	html.apis-print-property .apis-detail-gallery-carousel__slide.apis-print-keep,
	html.apis-print-property .apis-detail-gallery-carousel__slide:first-child {
		display: block !important;
		width: 100% !important;
		position: static !important;
	}

	html.apis-print-property .apis-property-detail img {
		max-width: 100% !important;
		height: auto !important;
		max-height: 80mm !important;
		object-fit: cover !important;
		page-break-inside: avoid;
		break-inside: avoid;
	}

	html.apis-print-property .apis-detail-gallery-grid__secondary img:nth-child(n+4),
	html.apis-print-property .apis-gallery-secondary > *:nth-child(n+4) {
		display: none !important;
	}

	/*
	 * Bloques largos: pueden pasar de página, pero no cortar títulos sueltos
	 * ni tarjetas legales a medias.
	 */
	html.apis-print-property .apis-property-description,
	html.apis-print-property .apis-property-characteristics,
	html.apis-print-property .apis-property-energy-certification,
	html.apis-print-property .apis-showcase-legal-panel,
	html.apis-print-property .apis-property-legal-chips,
	html.apis-print-property .apis-legal-chips {
		page-break-inside: auto;
		break-inside: auto;
		margin: 10px 0 14px !important;
		padding: 0 !important;
		background: transparent !important;
		box-shadow: none !important;
		border: none !important;
		overflow: visible !important;
	}

	html.apis-print-property .apis-property-description h2,
	html.apis-print-property .apis-property-characteristics h2,
	html.apis-print-property .apis-property-energy-certification h2,
	html.apis-print-property .apis-showcase-legal-panel__title,
	html.apis-print-property .apis-property-map h2 {
		color: #111 !important;
		font-size: 12pt !important;
		margin: 0 0 8px !important;
		padding-bottom: 4px !important;
		border-bottom: 1px solid #ccc !important;
		page-break-after: avoid;
		break-after: avoid;
		orphans: 3;
		widows: 3;
	}

	html.apis-print-property .apis-showcase-legal-grid {
		display: block !important;
		columns: 2 !important;
		column-gap: 12px !important;
		overflow: visible !important;
	}

	html.apis-print-property .apis-showcase-legal-card,
	html.apis-print-property .apis-property-legal-chip,
	html.apis-print-property .apis-legal-chip,
	html.apis-print-property .apis-property-characteristics li,
	html.apis-print-property .energy-legend__row,
	html.apis-print-property .apis-energy-card {
		page-break-inside: avoid !important;
		break-inside: avoid !important;
		-webkit-column-break-inside: avoid !important;
		background: transparent !important;
		box-shadow: none !important;
		border: 1px solid #ddd !important;
		border-radius: 4px !important;
		margin: 0 0 8px !important;
		padding: 6px 8px !important;
		color: #222 !important;
		overflow: visible !important;
	}

	html.apis-print-property .apis-property-description p,
	html.apis-print-property .apis-property-characteristics li,
	html.apis-print-property .apis-showcase-legal-card__label,
	html.apis-print-property .apis-showcase-legal-card__value {
		color: #222 !important;
		font-size: 10pt !important;
		line-height: 1.4 !important;
		orphans: 3;
		widows: 3;
	}

	html.apis-print-property .apis-property-description p {
		page-break-inside: avoid;
		break-inside: avoid;
		margin: 0 0 8px !important;
	}

	html.apis-print-property a {
		color: #111 !important;
		text-decoration: none !important;
	}

	html.apis-print-property a[href]::after {
		content: none !important;
	}
}
