/**
 * Estilos para el visor de PDF de Fundalibros (Versión 1.9.0 - Fullscreen Simulado para iOS)
 */

/* Contenedor principal */
.pdf-viewer-container {
    margin: 2em 0;
    width: 100%;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    overflow: hidden;
}

/* Wrapper interno */
.pdf-viewer-wrapper {
    width: 90%;
    max-width: 650px;
    height: 90vh;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    background-color: #f8f9fa;
}

/* --- Barra de Herramientas Moderna --- */
.pdf-viewer-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background-color: #ffffff;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
    user-select: none;
}

.toolbar-section { display: flex; align-items: center; gap: 15px; flex: 1; }
.toolbar-section.left { justify-content: flex-start; }
.toolbar-section.center { justify-content: center; }
.toolbar-section.right { justify-content: flex-end; }

/* Indicador de página */
.pdf-page-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    color: #495057;
}

/* Input de página */
.pdf-page-input {
    width: 60px;
    padding: 4px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    text-align: center;
    font-size: 1em;
    -moz-appearance: textfield;
}

.pdf-page-input::-webkit-outer-spin-button,
.pdf-page-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Estilo para el botón con icono SVG */
.pdf-tool-button {
    background: transparent;
    border: none;
    padding: 6px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    color: #6c757d;
}

.pdf-tool-button:hover {
    background-color: #e9ecef;
    color: #212529;
}

.pdf-tool-button svg {
    width: 20px;
    height: 20px;
}

/* --- Área del Visor (Scroll) --- */
.pdf-viewer-main {
    flex: 1;
    min-height: 0;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: #e9ecef;
    padding: 24px 8px;
    box-sizing: border-box;
}

/* --- Contenido del Visor --- */
.pdf-render-area { width: 100%; }
.pdf-page-container { width: 90%; margin: 0 auto 24px auto; }
.pdf-page-container canvas { width: 100% !important; height: auto !important; display: block; box-shadow: 0 5px 15px rgba(0,0,0,0.1); }

/* --- Estilos para Pantalla Completa NATIVA (Desktop, Android) --- */
.pdf-viewer-container:fullscreen {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: #000;
}

.pdf-viewer-container:fullscreen .pdf-viewer-wrapper {
    max-width: none;
    width: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
}


/* ======================================================== */
/* INICIO DEL CAMBIO: Estilos para Fullscreen Simulado (iOS)*/
/* ======================================================== */

/* 1. Evita que la página principal se desplace detrás del visor */
body.fundalibros-fullscreen-active {
    overflow: hidden;
}

/* 2. Expande el visor para que ocupe toda la pantalla */
.pdf-viewer-container.is-fullscreen-simulated {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2147483647; /* Un z-index muy alto para estar por encima de todo */
    margin: 0;
    border-radius: 0;
    background-color: #000; /* Fondo negro para imitar la experiencia nativa */
}

/* 3. Asegura que el wrapper interno también ocupe todo el espacio */
.pdf-viewer-container.is-fullscreen-simulated .pdf-viewer-wrapper {
    width: 100%;
    height: 100%;
    max-width: none;
    border-radius: 0;
    border: none;
}

/* 4. Contenedores para los iconos duales de fullscreen */
.fullscreen-icon-enter,
.fullscreen-icon-exit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}