/**
 * Salfa PDF Viewer — CSS v6.0
 * Google Drive & Gmail Material Design 3 UI
 * 100% aislado contra temas de WordPress y Elementor
 */

/* ============================================================
   1. Fuente Google y Contenedor Principal
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;600;700&display=swap');

.salfa-pdf-viewer-outer {
	display: block !important;
	width: 100% !important;
	box-sizing: border-box !important;
}

.salfa-pdf-viewer-wrapper {
	position: relative !important;
	width: 100% !important;
	max-width: 760px; /* Sin !important para permitir que Elementor controle el Ancho Máximo */
	margin-left: auto;
	margin-right: auto;
	font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
	-webkit-font-smoothing: antialiased !important;
	-moz-osx-font-smoothing: grayscale !important;
	box-sizing: border-box !important;
	color: #1f1f1f !important;
}

/* Alineaciones configurables desde Elementor */
.elementor-widget.salfa-pdf-align-left .salfa-pdf-viewer-wrapper,
.salfa-pdf-align-left .salfa-pdf-viewer-wrapper {
	margin-left: 0 !important;
	margin-right: auto !important;
}

.elementor-widget.salfa-pdf-align-center .salfa-pdf-viewer-wrapper,
.salfa-pdf-align-center .salfa-pdf-viewer-wrapper {
	margin-left: auto !important;
	margin-right: auto !important;
}

.elementor-widget.salfa-pdf-align-right .salfa-pdf-viewer-wrapper,
.salfa-pdf-align-right .salfa-pdf-viewer-wrapper {
	margin-left: auto !important;
	margin-right: 0 !important;
}

.salfa-pdf-viewer-wrapper *,
.salfa-pdf-viewer-wrapper *::before,
.salfa-pdf-viewer-wrapper *::after {
	box-sizing: border-box !important;
}

/* ============================================================
   2. Normalización Segura de Botones (Inmunidad Elementor/WP)
      SIN usar all:unset que rompía position:absolute
   ============================================================ */
.salfa-pdf-viewer-wrapper button,
.salfa-pdf-viewer-wrapper [role="button"] {
	margin: 0 !important;
	border: none !important;
	background: transparent !important;
	font-family: inherit !important;
	font-size: inherit !important;
	line-height: 1 !important;
	color: inherit !important;
	cursor: pointer !important;
	text-decoration: none !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	box-shadow: none !important;
	outline: none !important;
	-webkit-appearance: none !important;
	appearance: none !important;
	user-select: none !important;
	-webkit-user-select: none !important;
	-webkit-tap-highlight-color: transparent !important;
}

.salfa-pdf-viewer-wrapper button:focus,
.salfa-pdf-viewer-wrapper [role="button"]:focus,
.salfa-pdf-viewer-wrapper a:focus {
	outline: none !important;
}

/* ============================================================
   3. Barra de Herramientas Superior — Google Drive Floating Pill
   ============================================================ */
.salfa-pdf-viewer-wrapper .salfa-pdf-toolbar {
	display: flex !important;
	align-items: center !important;
	justify-content: space-between !important;
	flex-wrap: nowrap !important;
	gap: 10px !important;
	padding: 6px 12px !important;
	margin-bottom: 16px !important;
	background: #ffffff !important;
	border: 1px solid #dadce0 !important;
	border-radius: 9999px !important;
	min-height: 48px !important;
	box-shadow: 0 1px 3px rgba(60,64,67,0.12), 0 4px 8px rgba(60,64,67,0.06) !important;
	white-space: nowrap !important;
	transition: box-shadow 0.2s ease, border-color 0.2s ease !important;
}

.salfa-pdf-viewer-wrapper .salfa-pdf-toolbar:hover {
	border-color: #c4c7c5 !important;
	box-shadow: 0 2px 6px rgba(60,64,67,0.16), 0 6px 12px rgba(60,64,67,0.08) !important;
}

/* Sticky top si está activado */
.salfa-pdf-viewer-wrapper .salfa-pdf-toolbar.salfa-pdf-toolbar-sticky {
	position: sticky !important;
	top: 12px !important;
	z-index: 50 !important;
	background: rgba(255, 255, 255, 0.98) !important;
	backdrop-filter: blur(16px) !important;
	-webkit-backdrop-filter: blur(16px) !important;
	box-shadow: 0 4px 16px rgba(60,64,67,0.14) !important;
}

.salfa-pdf-viewer-wrapper .salfa-pdf-toolbar-left {
	display: inline-flex !important;
	align-items: center !important;
	gap: 8px !important;
	flex-shrink: 0 !important;
}

.salfa-pdf-viewer-wrapper .salfa-pdf-toolbar-right {
	display: inline-flex !important;
	align-items: center !important;
	flex-shrink: 0 !important;
}

/* Indicador de documento y página — Chip Google Material 3 */
.salfa-pdf-viewer-wrapper .salfa-pdf-doc-info {
	display: inline-flex !important;
	align-items: center !important;
	gap: 7px !important;
	padding: 6px 13px !important;
	background: #f0f4f9 !important;
	border-radius: 9999px !important;
	font-size: 13px !important;
	font-weight: 500 !important;
	color: #444746 !important;
	letter-spacing: 0.1px !important;
}

.salfa-pdf-viewer-wrapper .salfa-pdf-icon-doc {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	color: #444746 !important;
}

.salfa-pdf-viewer-wrapper .salfa-pdf-icon-doc svg {
	width: 17px !important;
	height: 17px !important;
	fill: currentColor !important;
	display: block !important;
}

.salfa-pdf-viewer-wrapper .salfa-pdf-doc-info strong,
.salfa-pdf-viewer-wrapper .salfa-pdf-doc-info .salfa-pdf-active-page {
	color: #1f1f1f !important;
	font-weight: 600 !important;
}

/* ============================================================
   4. Controles de Zoom — Google Drive Segmented Pill
   ============================================================ */
.salfa-pdf-viewer-wrapper .salfa-pdf-zoom-controls {
	display: inline-flex !important;
	align-items: center !important;
	gap: 1px !important;
	padding: 2px !important;
	height: 34px !important;
	background: #f0f4f9 !important;
	border: 1px solid #e0e4eb !important;
	border-radius: 9999px !important;
}

/* Botones circulares [ − ] y [ + ] estilo Google Material */
.salfa-pdf-viewer-wrapper .salfa-pdf-btn-ctrl {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 28px !important;
	height: 28px !important;
	min-width: 28px !important;
	border-radius: 50% !important;
	background: transparent !important;
	color: #444746 !important;
	transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease !important;
	flex-shrink: 0 !important;
	padding: 0 !important;
}

.salfa-pdf-viewer-wrapper .salfa-pdf-btn-ctrl:hover:not(.is-disabled) {
	background: #dfe4ec !important;
	color: #1f1f1f !important;
}

.salfa-pdf-viewer-wrapper .salfa-pdf-btn-ctrl:active:not(.is-disabled) {
	background: #d3dbe5 !important;
	transform: scale(0.92) !important;
}

.salfa-pdf-viewer-wrapper .salfa-pdf-btn-ctrl.is-disabled {
	opacity: 0.3 !important;
	cursor: default !important;
	pointer-events: none !important;
}

.salfa-pdf-viewer-wrapper .salfa-pdf-btn-ctrl svg {
	width: 16px !important;
	height: 16px !important;
	fill: currentColor !important;
	display: block !important;
	pointer-events: none !important;
}

/* Etiqueta de Porcentaje Google ("100%") */
.salfa-pdf-viewer-wrapper .salfa-pdf-zoom-value-btn {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	padding: 0 10px !important;
	height: 28px !important;
	border-radius: 9999px !important;
	background: transparent !important;
	font-size: 12.5px !important;
	font-weight: 600 !important;
	color: #1f1f1f !important;
	white-space: nowrap !important;
	transition: background 0.15s ease !important;
	flex-shrink: 0 !important;
}

.salfa-pdf-viewer-wrapper .salfa-pdf-zoom-value-btn:hover {
	background: #dfe4ec !important;
	color: #1A3455 !important;
}

/* ============================================================
   5. Botón de Descarga — Primary Pill (#1A3455)
   ============================================================ */
.salfa-pdf-viewer-wrapper a.salfa-pdf-btn-download {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 7px !important;
	padding: 7px 18px !important;
	height: 34px !important;
	background: #1A3455 !important;
	color: #ffffff !important;
	border: none !important;
	border-radius: 9999px !important;
	font-size: 13px !important;
	font-weight: 500 !important;
	letter-spacing: 0.2px !important;
	text-decoration: none !important;
	white-space: nowrap !important;
	cursor: pointer !important;
	box-shadow: 0 1px 3px rgba(26, 52, 85, 0.28) !important;
	transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease !important;
}

.salfa-pdf-viewer-wrapper a.salfa-pdf-btn-download:hover {
	background: #12253d !important;
	box-shadow: 0 2px 6px rgba(26, 52, 85, 0.38) !important;
	transform: translateY(-1px) !important;
	color: #ffffff !important;
}

.salfa-pdf-viewer-wrapper a.salfa-pdf-btn-download:active {
	background: #0c192a !important;
	transform: translateY(0) !important;
	box-shadow: 0 1px 2px rgba(26, 52, 85, 0.25) !important;
}

.salfa-pdf-viewer-wrapper a.salfa-pdf-btn-download svg,
body .salfa-pdf-viewer-wrapper a.salfa-pdf-btn-download svg {
	width: 16px !important;
	height: 16px !important;
	fill: #ffffff !important;
	stroke: none !important;
	flex-shrink: 0 !important;
	display: block !important;
}

body .salfa-pdf-viewer-wrapper a.salfa-pdf-btn-download {
	background: #1A3455 !important;
	color: #ffffff !important;
}
body .salfa-pdf-viewer-wrapper a.salfa-pdf-btn-download:hover {
	background: #12253d !important;
	color: #ffffff !important;
}

/* ============================================================
   6. Contenedor de Páginas y Stage
   ============================================================ */
.salfa-pdf-viewer-wrapper .salfa-pdf-pages-container {
	position: relative !important;
	width: 100% !important;
	display: flex !important;
	flex-direction: column !important;
	align-items: center !important;
}

/* Stage del Slider: contenedor relativo que sostiene el canvas-box y las flechas */
.salfa-pdf-viewer-wrapper .salfa-pdf-slider-stage {
	position: relative !important;
	width: 100% !important;
	user-select: none !important;
	-webkit-user-select: none !important;
}

/* Canvas Box — Tarjeta Material Design */
.salfa-pdf-viewer-wrapper .salfa-pdf-slider-canvas-box {
	position: relative !important;
	width: 100% !important;
	max-height: 82vh !important;
	overflow: hidden !important;
	border-radius: 12px !important;
	background: #ffffff !important;
	border: 1px solid #e0e2ec !important;
	box-shadow: 0 1px 3px rgba(60,64,67,0.12), 0 4px 12px rgba(60,64,67,0.08) !important;
	touch-action: none !important;
	display: flex !important;
	justify-content: center !important;
	align-items: flex-start !important;
}

/* Con zoom activo: scroll suave nativo */
.salfa-pdf-viewer-wrapper .salfa-pdf-slider-canvas-box.is-zoomed {
	overflow: auto !important;
	-webkit-overflow-scrolling: touch !important;
	cursor: grab !important;
}

.salfa-pdf-viewer-wrapper .salfa-pdf-slider-canvas-box.is-zoomed:active {
	cursor: grabbing !important;
}

/* ============================================================
   7. Flechas Laterales Flotantes — Google Drive Circle Buttons
   ============================================================ */
.salfa-pdf-viewer-wrapper .salfa-pdf-side-arrow {
	position: absolute !important;
	top: 50% !important;
	transform: translateY(-50%) !important;
	z-index: 25 !important;
	width: 44px !important;
	height: 44px !important;
	min-width: 44px !important;
	min-height: 44px !important;
	border-radius: 50% !important;
	background: #ffffff !important;
	color: #3c4043 !important;
	border: 1px solid #dadce0 !important;
	box-shadow: 0 1px 3px rgba(60,64,67,0.2), 0 4px 8px rgba(60,64,67,0.1) !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	cursor: pointer !important;
	padding: 0 !important;
	flex-shrink: 0 !important;
	transition: background 0.18s ease, color 0.18s ease, transform 0.18s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.18s ease, opacity 0.18s ease !important;
}

.salfa-pdf-viewer-wrapper .salfa-pdf-side-arrow:hover:not(.is-disabled) {
	background: #f8fafd !important;
	color: #1A3455 !important;
	transform: translateY(-50%) scale(1.08) !important;
	box-shadow: 0 2px 6px rgba(60,64,67,0.25), 0 8px 16px rgba(60,64,67,0.15) !important;
}

.salfa-pdf-viewer-wrapper .salfa-pdf-side-arrow:active:not(.is-disabled) {
	background: #e9eef6 !important;
	transform: translateY(-50%) scale(0.96) !important;
}

/* En Google Drive, cuando no hay página anterior/siguiente, la flecha se oculta limpiamente */
.salfa-pdf-viewer-wrapper .salfa-pdf-side-arrow.is-disabled {
	opacity: 0 !important;
	visibility: hidden !important;
	pointer-events: none !important;
}

.salfa-pdf-viewer-wrapper .salfa-pdf-side-arrow svg,
body .salfa-pdf-viewer-wrapper .salfa-pdf-side-arrow svg {
	width: 24px !important;
	height: 24px !important;
	fill: currentColor !important;
	stroke: none !important;
	display: block !important;
	pointer-events: none !important;
}

body .salfa-pdf-viewer-wrapper .salfa-pdf-side-arrow {
	background: #ffffff !important;
	color: #3c4043 !important;
	border: 1px solid #dadce0 !important;
}

body .salfa-pdf-viewer-wrapper .salfa-pdf-side-arrow:hover:not(.is-disabled) {
	background: #f8fafd !important;
	color: #1A3455 !important;
}

.salfa-pdf-viewer-wrapper .salfa-pdf-side-prev { left: 14px !important; }
.salfa-pdf-viewer-wrapper .salfa-pdf-side-next { right: 14px !important; }

/* ============================================================
   8. Barra de Navegación Inferior — Google M3 Floating Pill
   ============================================================ */
.salfa-pdf-viewer-wrapper .salfa-pdf-slider-bottom-nav {
	display: flex !important;
	align-items: center !important;
	justify-content: space-between !important;
	gap: 8px !important;
	width: 100% !important;
	max-width: 360px !important;
	margin-top: 14px !important;
	padding: 4px 6px !important;
	background: #ffffff !important;
	border: 1px solid #dadce0 !important;
	border-radius: 9999px !important;
	box-shadow: 0 1px 3px rgba(60,64,67,0.12), 0 2px 6px rgba(60,64,67,0.06) !important;
}

.salfa-pdf-viewer-wrapper .salfa-pdf-btn-bottom-nav {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 6px !important;
	padding: 7px 16px !important;
	min-height: 36px !important;
	background: transparent !important;
	color: #444746 !important;
	border-radius: 9999px !important;
	font-family: inherit !important;
	font-size: 13px !important;
	font-weight: 500 !important;
	letter-spacing: 0.1px !important;
	transition: background 0.15s ease, color 0.15s ease !important;
	white-space: nowrap !important;
}

.salfa-pdf-viewer-wrapper .salfa-pdf-btn-bottom-nav:hover:not(.is-disabled) {
	background: #f0f4f9 !important;
	color: #1A3455 !important;
}

.salfa-pdf-viewer-wrapper .salfa-pdf-btn-bottom-nav:active:not(.is-disabled) {
	background: #e0e6f0 !important;
}

.salfa-pdf-viewer-wrapper .salfa-pdf-btn-bottom-nav.is-disabled {
	opacity: 0.3 !important;
	cursor: default !important;
	pointer-events: none !important;
}

.salfa-pdf-viewer-wrapper .salfa-pdf-btn-bottom-nav svg {
	width: 18px !important;
	height: 18px !important;
	fill: currentColor !important;
	flex-shrink: 0 !important;
}

.salfa-pdf-viewer-wrapper .salfa-pdf-bottom-page-display {
	font-size: 13px !important;
	font-weight: 500 !important;
	color: #444746 !important;
	font-family: inherit !important;
	padding: 0 6px !important;
	white-space: nowrap !important;
	flex-shrink: 0 !important;
}

/* ============================================================
   9. Controles de Modo Paginado (en Toolbar)
   ============================================================ */
.salfa-pdf-viewer-wrapper .salfa-pdf-pagination-controls {
	display: inline-flex !important;
	align-items: center !important;
	gap: 4px !important;
	background: #f0f4f9 !important;
	border-radius: 9999px !important;
	padding: 2px 6px !important;
	height: 34px !important;
}

.salfa-pdf-viewer-wrapper .salfa-pdf-btn {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 28px !important;
	height: 28px !important;
	border-radius: 50% !important;
	color: #444746 !important;
	transition: background 0.15s ease, color 0.15s ease !important;
}

.salfa-pdf-viewer-wrapper .salfa-pdf-btn:hover:not(.is-disabled) {
	background: #dfe4ec !important;
	color: #1f1f1f !important;
}

.salfa-pdf-viewer-wrapper .salfa-pdf-btn.is-disabled {
	opacity: 0.3 !important;
	pointer-events: none !important;
}

.salfa-pdf-viewer-wrapper .salfa-pdf-page-display {
	font-size: 13px !important;
	font-weight: 500 !important;
	color: #1f1f1f !important;
	padding: 0 6px !important;
}

/* ============================================================
   10. Canvas y Wrapper de Página (Máxima Nitidez)
   ============================================================ */
.salfa-pdf-viewer-wrapper .salfa-pdf-page-canvas-wrapper {
	display: flex !important;
	justify-content: center !important;
	align-items: flex-start !important;
	width: 100% !important;
	background: #ffffff !important;
}

/* Separación entre páginas en modo cascada */
.salfa-pdf-viewer-wrapper .salfa-pdf-pages-container > .salfa-pdf-page-canvas-wrapper {
	margin-bottom: 20px !important;
	border-radius: 12px !important;
	overflow: hidden !important;
	border: 1px solid #e0e2ec !important;
	box-shadow: 0 2px 8px rgba(60,64,67,0.1) !important;
}

/* Canvas — renderizado nítido natural sin artefactos */
.salfa-pdf-viewer-wrapper .salfa-pdf-page-canvas {
	display: block !important;
	margin: 0 auto !important;
	max-width: none !important;
	background: #ffffff !important;
	vertical-align: top !important;
}

/* Transiciones de cambio de página */
.salfa-pdf-viewer-wrapper .salfa-pdf-anim-next {
	animation: salfaSlideNext 0.28s cubic-bezier(0.16, 1, 0.3, 1) both !important;
}
.salfa-pdf-viewer-wrapper .salfa-pdf-anim-prev {
	animation: salfaSlidePrev 0.28s cubic-bezier(0.16, 1, 0.3, 1) both !important;
}
.salfa-pdf-viewer-wrapper .salfa-pdf-anim-fade {
	animation: salfaFade 0.2s ease both !important;
}

@keyframes salfaSlideNext {
	from { opacity: 0.2; transform: translateX(24px); }
	to   { opacity: 1;   transform: translateX(0);    }
}
@keyframes salfaSlidePrev {
	from { opacity: 0.2; transform: translateX(-24px); }
	to   { opacity: 1;   transform: translateX(0);     }
}
@keyframes salfaFade {
	from { opacity: 0.3; }
	to   { opacity: 1;   }
}

/* ============================================================
   11. Spinner y Estado de Carga (Google Style)
   ============================================================ */
.salfa-pdf-viewer-wrapper .salfa-pdf-loading-state {
	display: flex !important;
	flex-direction: column !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 14px !important;
	padding: 60px 20px !important;
}

.salfa-pdf-viewer-wrapper .salfa-pdf-spinner {
	width: 36px !important;
	height: 36px !important;
	border: 3px solid #e0e4eb !important;
	border-top-color: #1A3455 !important;
	border-radius: 50% !important;
	animation: salfaSpin 0.75s linear infinite !important;
}

@keyframes salfaSpin { to { transform: rotate(360deg); } }

.salfa-pdf-viewer-wrapper .salfa-pdf-loading-text {
	margin: 0 !important;
	font-size: 13.5px !important;
	color: #444746 !important;
	font-weight: 500 !important;
}

/* ============================================================
   12. Responsive Móvil (Estilo App Nativa)
   ============================================================ */
@media (max-width: 520px) {
	.salfa-pdf-viewer-wrapper .salfa-pdf-toolbar {
		padding: 5px 8px !important;
		min-height: 44px !important;
		gap: 6px !important;
	}

	.salfa-pdf-viewer-wrapper .salfa-pdf-doc-info {
		padding: 5px 9px !important;
		font-size: 12px !important;
		gap: 4px !important;
	}

	.salfa-pdf-viewer-wrapper a.salfa-pdf-btn-download {
		padding: 6px 12px !important;
		height: 32px !important;
		font-size: 12px !important;
	}

	.salfa-pdf-viewer-wrapper .salfa-pdf-side-arrow {
		width: 38px !important;
		height: 38px !important;
		min-width: 38px !important;
		min-height: 38px !important;
	}
	.salfa-pdf-viewer-wrapper .salfa-pdf-side-prev { left: 8px !important; }
	.salfa-pdf-viewer-wrapper .salfa-pdf-side-next { right: 8px !important; }

	.salfa-pdf-viewer-wrapper .salfa-pdf-slider-bottom-nav {
		max-width: 100% !important;
		padding: 4px 6px !important;
	}

	.salfa-pdf-viewer-wrapper .salfa-pdf-btn-bottom-nav {
		padding: 8px 14px !important;
		min-height: 38px !important;
	}
}

@media (max-width: 380px) {
	.salfa-pdf-viewer-wrapper a.salfa-pdf-btn-download span {
		display: none !important;
	}
	.salfa-pdf-viewer-wrapper a.salfa-pdf-btn-download {
		padding: 6px 9px !important;
	}
}
