/* Estilos para el visor de EPUB */
.epub-viewer-container {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.epub-viewer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    flex-wrap: wrap;
    gap: 10px;
}

.epub-viewer-toolbar .epub-page-info {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
}

.epub-btn {
    background: #002559;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.epub-btn:hover {
    background: #005a87;
    transform: translateY(-1px);
}

.epub-btn:active {
    transform: translateY(0);
}

.epub-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.epub-viewer-content {
    position: relative;
    height: calc(100% - 60px);
    overflow: hidden;
}

.epub-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6c757d;
}

.epub-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: epub-spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes epub-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Panel de tabla de contenidos */
.epub-toc-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 300px;
    height: 100%;
    background: white;
    border-right: 1px solid #dee2e6;
    z-index: 1000;
    overflow-y: auto;
}

.epub-toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.epub-toc-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.epub-toc-content {
    padding: 15px;
}

.epub-toc-item {
    display: block;
    padding: 8px 12px;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    margin-bottom: 2px;
    transition: background-color 0.2s ease;
}

.epub-toc-item:hover {
    background: #f8f9fa;
    color: #007cba;
}

.epub-toc-item.active {
    background: #007cba;
    color: white;
}

/* Panel de configuración */
.epub-settings-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 250px;
    height: 100%;
    background: white;
    border-left: 1px solid #dee2e6;
    z-index: 1000;
    overflow-y: auto;
}

.epub-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.epub-settings-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.epub-settings-content {
    padding: 15px;
}

.epub-setting-group {
    margin-bottom: 20px;
}

.epub-setting-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.epub-setting-group input[type="range"] {
    width: 100%;
    margin-bottom: 5px;
}

.epub-setting-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

.epub-font-size-value {
    font-size: 12px;
    color: #6c757d;
}

/* Contenido del libro */
.epub-rendition {
    width: 100%;
    height: 100%;
}

.epub-rendition iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Tema nocturno */
.epub-viewer-container[data-theme="night"] {
    background: #1a1a1a;
    color: #e0e0e0;
}

.epub-viewer-container[data-theme="night"] .epub-viewer-toolbar {
    background: #2d2d2d;
    border-bottom-color: #404040;
}

.epub-viewer-container[data-theme="night"] .epub-toc-panel,
.epub-viewer-container[data-theme="night"] .epub-settings-panel {
    background: #1a1a1a;
    border-color: #404040;
}

.epub-viewer-container[data-theme="night"] .epub-toc-header,
.epub-viewer-container[data-theme="night"] .epub-settings-header {
    background: #2d2d2d;
    border-bottom-color: #404040;
}

/* Tema sepia */
.epub-viewer-container[data-theme="sepia"] {
    background: #f4f1ea;
    color: #5c4b37;
}

.epub-viewer-container[data-theme="sepia"] .epub-viewer-toolbar {
    background: #e8e0d0;
    border-bottom-color: #d4c4a8;
}

/* Modo pantalla completa: columna flex para que la toolbar quede abajo */
.epub-viewer-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    border: none;
    border-radius: 0;
    display: flex;
    flex-direction: column;
}

.epub-viewer-container.fullscreen .suga-epub-viewer-inner {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: stretch;   /* Que el wrapper del libro ocupe toda la altura */
    justify-content: center;
}

.epub-viewer-container.fullscreen .epub-viewer-toolbar {
    flex-shrink: 0;
}

.epub-viewer-container.fullscreen .epub-viewer-content-wrapper {
    flex: 1;
    min-height: 0;
    height: 100% !important; /* Ocupar toda la altura del inner */
}

.epub-viewer-container.fullscreen .epub-viewer-content {
    height: 100% !important;
    min-height: 0 !important;
}

/* En fullscreen el libro debe ocupar todo el espacio disponible */
.epub-viewer-container.fullscreen .epub-container {
    max-width: none !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0;
}

.epub-viewer-container.fullscreen .epub-viewer-content .epub-view {
    width: 50% !important; /* Dos páginas lado a lado = 100% */
    min-height: 100% !important;
    height: 100% !important;
}

.epub-viewer-container.fullscreen .epub-viewer-content .epub-view,
.epub-viewer-container.fullscreen .epub-viewer-content .epub-view > div,
.epub-viewer-container.fullscreen .epub-viewer-content .epub-view iframe {
    min-height: 100% !important;
    height: 100% !important;
}

/* Estilos para el contenido del libro */
.epub-rendition {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.epub-rendition iframe {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Asegurar que el contenido sea visible */
.epub-viewer-content {
    position: relative;
    height: calc(100% - 60px);
    overflow: hidden;
    background: #fff;
}

.epub-viewer-content .epub-rendition {
    background: #fff;
    min-height: 100%;
}

/* CORRECCIÓN CRÍTICA: Forzar altura del visor EPUB */
.epub-view {
    height: 100% !important;
    min-height: 600px !important;
}

.epub-view[style*="height: 0px"] {
    height: 100% !important;
    min-height: 500px !important;
}

/* Forzar altura en todos los elementos del visor */
.epub-viewer-content .epub-view,
.epub-viewer-content .epub-view > div,
.epub-viewer-content .epub-view iframe {
    height: 100% !important;
    min-height: 600px !important;
}

/* Estilos específicos para el iframe del contenido */
#epubjs-view-* {
    height: 100% !important;
    min-height: 600px !important;
}

/* Forzar altura en elementos con height: 0px */
[style*="height: 0px"] {
    height: 100% !important;
    min-height: 600px !important;
}

/* Responsive */
@media (max-width: 768px) {
    .epub-viewer-toolbar {
        padding: 8px 10px;
    }
    
    .epub-btn {
        padding: 6px 8px;
        font-size: 12px;
    }
    
    .epub-toc-panel,
    .epub-settings-panel {
        width: 100%;
    }
    
    .epub-page-info {
        font-size: 12px;
    }
}

/* Animaciones */
.epub-toc-panel,
.epub-settings-panel {
    transition: transform 0.3s ease;
}

.epub-toc-panel.hidden {
    transform: translateX(-100%);
}

.epub-settings-panel.hidden {
    transform: translateX(100%);
}

/* Mejoras de accesibilidad */
.epub-btn:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.epub-toc-item:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Indicador de carga de página */
.epub-page-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    z-index: 100;
}

/* Error de carga */
.epub-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #dc3545;
    text-align: center;
    padding: 20px;
}

.epub-error .dashicons {
    font-size: 48px;
    margin-bottom: 15px;
}

.epub-error h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
}

.epub-error p {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: #6c757d;
}

.epub-retry-btn {
    background: #007cba;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.epub-retry-btn:hover {
    background: #005a87;
}



/* Capa transparente para capturar eventos de drag sobre el EPUB */
.epub-drag-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10; /* Por encima del contenido del EPUB */
    cursor: grab;
    display: none; /* Oculta por defecto */
    pointer-events: auto;
}

.epub-drag-layer:active {
    cursor: grabbing;
}

/* Asegurar que las flechas laterales estén por encima */
.suga-epub-side-arrow {
    position: relative;
    z-index: 20 !important;
    pointer-events: auto !important;
}

/* Asegurar que el toolbar esté por encima */
.epub-viewer-toolbar {
    position: relative;
    z-index: 20 !important;
}








@media(max-width:778px){
	#QSIFeedbackButton-btn{
	display: none;
	}
}