/* CSS Document */
body{
	background-color: #282828;
	margin: 0;
	padding: 0;
	font-family: 'Segoe UI', Arial, sans-serif;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: space-between;
	min-height: 100vh;
	color: #f5f5f7;
	overflow: hidden; 
}

/* MODIFICADO: Ahora es una barra flex que distribuye el título y el botón */
.header-area{
	width:51%;
	max-width: 1400px; /* Alineado con el ancho máximo del libro */
	box-sizing: border-box;
	padding: 15px 30px 0 30px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-shrink: 0;
}
.tit{
	grid-column: 2; /* Fuerza al título a estar en la columna central */
	color: #ffd666;
	width:100%;
	margin: 0;
	font-size:20px; /* Tamaño de fuente solicitado */
	font-weight: bold; /* En negrita solicitado */
	text-align: center; /* Centrado solicitado */
	letter-spacing: 1px;
}

/* CONTENEDOR ELÁSTICO RESPONSIVO */
#canvas-container{
	width: 95vw;
	height: 75vh;
	max-width: 1400px; 
	max-height: 850px;
	margin: auto;
	position: relative;
	display: flex;
	justify-content: center;
	align-items: center;
	background-color: #282828;
}

#canvas-container:fullscreen{
	width: 100vw;
	height: 100vh;
	max-width: none;
	max-height: none;
	background-color: #282828;
	padding: 20px 0;
	box-sizing: border-box;
}

.flipbook{
	width: 100%;
	height: 100%;
	background-color: #282828;
	display: flex;
	justify-content: center;
	align-items: center;
}

.page{
	background-color: #ffffff;
	overflow: hidden;
}

.page-content{
	width: 100%;
	height: 100%;
	background-size: 100% 100%;
	background-repeat: no-repeat;
	background-position: center;
}

/* BARRA DE BOTONES */
.controls{
	padding-bottom: 20px;
	display: flex;
	gap: 12px;
	align-items: center;
	flex-shrink: 0;
	z-index: 2000;
}
.btn{
	background-color: #e5c158;
	color: #111115;
	border: none;
	padding: 10px 22px;
	font-weight: bold;
	cursor: pointer;
	border-radius: 4px;
	font-size: 0.95rem;
	transition: background 0.2s;
}
.btn:hover{
	background-color:#F2E0AA;
}

.btn-nav-extreme{
	background-color: #111;
	color: #e5c158;
	border: 1px solid #e5c158;
}
.btn-nav-extreme:hover{
	background-color: #ffd666;
	color: #000;
}

.btn-fullscreen{
	grid-column: 3;
	justify-self: end;
	background-color: #4a4a5a;
	color: #ffffff;
	padding: 8px 16px;
}
.btn-fullscreen:hover{
	background-color: #626275;
	color: #000;
}
#page-indicator{
	font-weight: bold; 
	background: #111; 
	padding: 5px 15px; 
	border-radius: 4px;
}

/* DISEÑO PARA LA BÚSQUEDA DE PÁGINA */
.search-container{
	display: flex;
	align-items: center;
	gap: 5px;
	background: #111;
	padding: 2px 7px;
	border-radius: 4px;
	border: 1px solid #282828;
}
.search-container label{
	font-size: 0.85rem;
	color: #a0a0aa;
}
.input-page{
	width: 45px;
	background: #111;
	border: 1px solid #e5c158;
	color: #fff;
	text-align: center;
	padding: 4px;
	border-radius: 3px;
	font-weight: bold;
	outline: none;
}
.input-page::-webkit-outer-spin-button,
.input-page::-webkit-inner-spin-button{
	-webkit-appearance: none;
	margin: 0;
}
.input-page{
	-moz-appearance: textfield;
	color:#FFF;
}

#loading{
	font-size: 1.2rem;
	color: #e5c158;
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	font-weight: bold;
	z-index: 1000;
}
.contenedor-superior-izquierda{
    position: fixed;
    top:10px;
    left:15px;
    z-index: 9999; 
}

.contenedor-inferior-derecha{
  position: fixed;
  bottom:10px;
  right:30px;
  z-index: 9999; /* Asegura que el div quede por encima de otros elementos */
}
/* ==========================================================================
   NUEVO: AJUSTES ESPECÍFICOS PARA DISPOSITIVOS MÓVILES (PANTALLAS <= 768px)
========================================================================== */
@media screen and (max-width: 768px) {
	.header-area {
		padding: 10px 15px 0 15px;
	}
	
	.tit {
		font-size: 18px; /* Reduce el tamaño del título para que no empuje elementos */
		text-align: left;
		max-width: 75%;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis; /* Corta el texto con puntos suspensivos si es muy largo */
	}

	#canvas-container {
		width: 98vw;
		height: 68vh; /* Reduce ligeramente el alto para dar espacio a la botonera en móviles */
	}

	.controls {
		padding-bottom: 15px;
		gap: 6px; /* Reduce el espacio entre botones para evitar desbordamiento horizontal */
		flex-wrap: wrap; /* Si la pantalla es críticamente angosta, distribuye en dos filas automáticamente */
		justify-content: center;
		width: 100%;
		box-sizing: border-box;
		padding-inline: 10px;
	}

	.btn {
		padding: 8px 12px; /* Reduce el tamaño del botón para pantallas táctiles */
		font-size: 0.85rem;
	}

	/* Oculta los botones de "Inicio" y "Fin" en móviles para priorizar el espacio */
	.btn-nav-extreme{ display:none !important; }
	#first-page-btn{ display:none !important; }
	#prev-btn{ display:none !important; }
	#next-btn{ display:none !important; }
	#last-page-btn{ display:none !important; }

	#page-indicator {
		font-size: 0.85rem;
		padding: 5px 10px;
	}

	.search-container {
		padding: 1px 4px;
	}
}