/* Estilos específicos para el visualizador de flipbook */

.pdf-info {
    text-align: center;
    margin-bottom: 20px;
    background-color: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Contenedor del flipbook */
.flipbook-container {
    position: relative;
    width: 100%;
    height: 75vh;
    margin: 0 auto;
    background-color: #f0f0f0;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    border-radius: 6px;
    perspective: 1000px;
}

.btn-download {
    background-color: #28a745;
    color: white;
    margin-left: 10px;
}

.btn-download:hover {
    background-color: #218838;
}

/* Estilos del flipbook */
#flipbook {
    margin: 0 auto;
    width: 100%;
    height: 100%;
    display: none; /* Se mostrará cuando esté listo */
    transform-style: preserve-3d;
    transition: transform 0.5s, opacity 0.5s;
    z-index: 5;
    position: relative;
    opacity: 0; /* Comenzar invisible y usar transición para mostrarlo */
}

/* Páginas del flipbook */
.page {
    background-color: white;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.page canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Efecto de esquina para pasar página */
.page-corner {
    position: absolute;
    width: 40px;
    height: 40px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.page-corner::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
    transition: all 0.3s ease;
}

/* Esquina inferior derecha */
.corner-bottom-right {
    bottom: 0;
    right: 0;
}

.corner-bottom-right::before {
    bottom: 0;
    right: 0;
    border-width: 0 0 40px 40px;
    border-color: transparent transparent #e74c3c transparent;
}

.corner-bottom-right:hover::before {
    border-width: 0 0 50px 50px;
}

/* Esquina superior derecha */
.corner-top-right {
    top: 0;
    right: 0;
}

.corner-top-right::before {
    top: 0;
    right: 0;
    border-width: 40px 0 0 40px;
    border-color: transparent transparent transparent #e74c3c;
}

.corner-top-right:hover::before {
    border-width: 50px 0 0 50px;
}

/* Esquina inferior izquierda */
.corner-bottom-left {
    bottom: 0;
    left: 0;
}

.corner-bottom-left::before {
    bottom: 0;
    left: 0;
    border-width: 0 40px 40px 0;
    border-color: transparent transparent #e74c3c transparent;
}

.corner-bottom-left:hover::before {
    border-width: 0 50px 50px 0;
}

/* Esquina superior izquierda */
.corner-top-left {
    top: 0;
    left: 0;
}

.corner-top-left::before {
    top: 0;
    left: 0;
    border-width: 0 40px 40px 0;
    border-color: #e74c3c transparent transparent transparent;
}

.corner-top-left:hover::before {
    border-width: 0 50px 50px 0;
}

/* Animación para pasar página */
.page.turning {
    animation: turn-page 1.5s forwards;
    transform-origin: left center;
}

@keyframes turn-page {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(-180deg); }
}

/* Estilo para página siendo arrastrada */
.page-dragging {
    transition: transform 0.1s;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.2);
    z-index: 20 !important;
}

/* Efecto visual para el arrastre */
.page-corner.dragging {
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
}

/* Controles de navegación y zoom */
.flipbook-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    background-color: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#page-num {
    font-size: 1rem;
    font-weight: 600;
    padding: 0 10px;
    color: #34495e;
    background-color: #f8f9fa;
    border-radius: 4px;
    padding: 5px 15px;
}

.zoom-controls {
    display: flex;
    align-items: center;
    margin-left: 15px;
    background-color: #f8f9fa;
    border-radius: 4px;
    padding: 5px;
}

#zoom-level {
    width: 60px;
    text-align: center;
    font-weight: 600;
    color: #34495e;
}

/* Indicador de carga */
#loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.9);
    font-size: 1.2rem;
    font-weight: 600;
    color: #3498db;
    z-index: 1000;
}

#loading .loader {
    margin-bottom: 20px;
    width: 50px;
    height: 50px;
    border-width: 5px;
}

#loading-progress {
    margin-top: 10px;
    width: 60%;
    height: 10px;
    background-color: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
}

#loading-bar {
    width: 0%;
    height: 100%;
    background-color: #3498db;
    transition: width 0.3s ease;
}

/* Personalización de turn.js */
.turn-page {
    background-color: white;
}

.turn-page-wrapper {
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

/* Sombras para efecto realista */
.hard {
    background-color: #f8f8f8 !important;
    color: #333;
}

.hard.odd {
    background-image: linear-gradient(to right, #fff 95%, #ddd 100%) !important;
}

.hard.even {
    background-image: linear-gradient(to left, #fff 95%, #ddd 100%) !important;
}

/* Indicador de arrastre */
.grab-cursor {
    cursor: grab;
}

.grabbing-cursor {
    cursor: grabbing;
}

/* Tooltips */
.tooltip {
    position: absolute;
    background-color: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 0.8rem;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.tooltip.show {
    opacity: 0.9;
}

/* Instrucciones para el usuario */
.page-turn-hint {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background-color: rgba(52, 152, 219, 0.8);
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 0.9rem;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    animation: pulse 2s infinite;
    z-index: 50;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Responsivo */
@media (max-width: 768px) {
    .flipbook-container {
        height: 50vh;
    }
    
    .flipbook-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    #page-num {
        order: -1;
        margin-bottom: 10px;
    }
    
    .zoom-controls {
        margin-left: 0;
        margin-top: 10px;
    }
    
    .page-turn-hint {
        bottom: 10px;
        right: 10px;
        font-size: 0.8rem;
    }
}