/* Container principal */
.flipbook-wrapper {
    position: relative;
    padding: 0;
    background: #2c2c2c;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    max-width: 100%;
    margin: 0 auto;
}

/* Controles superiores */
.flipbook-top-controls {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px;
}

.flipbook-top-controls button {
    background: #444;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.flipbook-top-controls button:hover {
    background: #555;
    transform: translateY(-2px);
}

/* Container do flipbook */
.flipbook-container {
    position: relative;
    background: #1a1a1a;
    border-radius: 8px;
    padding: 40px 20px;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Flipbook */
.flipbook {
    margin: 0 auto;
    position: relative;
}

.flipbook .page {
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.flipbook .page img {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* EFEITO DE LIVRO ABERTO - Sombra entre páginas */
.flipbook .page::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    pointer-events: none;
    z-index: 10;
}

/* Sombra na página da ESQUERDA (lado direito) */
.flipbook .odd .page::after {
    right: 0;
    background: linear-gradient(to left, 
        rgba(0,0,0,0.4) 0%, 
        rgba(0,0,0,0.2) 30%,
        rgba(0,0,0,0.1) 60%,
        transparent 100%
    );
}

/* Sombra na página da DIREITA (lado esquerdo) */
.flipbook .even .page::after {
    left: 0;
    background: linear-gradient(to right, 
        rgba(0,0,0,0.4) 0%, 
        rgba(0,0,0,0.2) 30%,
        rgba(0,0,0,0.1) 60%,
        transparent 100%
    );
}

/* EFEITO DE LOMBADA - Centro do livro */
.flipbook .hard {
    background: linear-gradient(to right,
        #f5f5f5 0%,
        #e0e0e0 20%,
        #d5d5d5 40%,
        #c8c8c8 50%,
        #d5d5d5 60%,
        #e0e0e0 80%,
        #f5f5f5 100%
    ) !important;
    box-shadow: 
        inset 0 0 15px rgba(0,0,0,0.3),
        0 0 20px rgba(0,0,0,0.5) !important;
}

/* Sombras laterais das páginas */
.flipbook .even {
    box-shadow: 
        -3px 0 10px rgba(0,0,0,0.4),
        -6px 0 15px rgba(0,0,0,0.2);
}

.flipbook .odd {
    box-shadow: 
        3px 0 10px rgba(0,0,0,0.4),
        6px 0 15px rgba(0,0,0,0.2);
}

/* Sombra mais forte durante animação */
.flipbook .turn-page {
    box-shadow: 
        0 0 30px rgba(0,0,0,0.8),
        inset -5px 0 15px rgba(0,0,0,0.2);
}

/* Loading spinner */
.flipbook-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 30px 40px;
    border-radius: 10px;
    text-align: center;
    z-index: 1000;
}

.flipbook-loading.hidden {
    display: none;
}

.spinner {
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Controles inferiores */
.flipbook-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    gap: 15px;
}

.flipbook-controls button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.flipbook-controls button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.flipbook-controls button:disabled {
    background: #555;
    cursor: not-allowed;
    opacity: 0.5;
    box-shadow: none;
}

/* Info de página */
.flipbook-page-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-size: 16px;
    font-weight: 500;
}

.flipbook-page-input {
    width: 60px;
    padding: 8px;
    border: 2px solid #667eea;
    border-radius: 5px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    background: #333;
    color: white;
    -moz-appearance: textfield;
}

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

.flipbook-page-input:focus {
    outline: none;
    border-color: #764ba2;
}

.flipbook-total {
    color: #667eea;
    font-weight: 700;
}

/* Tela cheia */
.flipbook-wrapper.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    max-width: 100% !important;
    width: 100%;
    height: 100%;
    border-radius: 0;
    margin: 0;
    padding: 0;
    background: rgba(0,0,0,0.95);
}

.flipbook-wrapper.fullscreen .flipbook-container {
    height: calc(100vh - 160px);
    padding: 20px;
}

.flipbook-wrapper.fullscreen .flipbook {
    max-width: 95vw;
    max-height: 85vh;
}

/* Responsive */
@media (max-width: 768px) {
    .flipbook-wrapper {
        margin: 10px auto;
    }
    
    .flipbook-container {
        padding: 20px 10px;
        min-height: 400px;
    }
    
    .flipbook-controls {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }
    
    .flipbook-controls button {
        width: 100%;
    }
    
    .flipbook-page-info {
        order: -1;
        width: 100%;
        justify-content: center;
    }
    
    .flipbook-top-controls {
        gap: 5px;
        padding: 10px;
    }
}

/* Efeito de brilho sutil */
.flipbook .page:hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(255,255,255,0.05) 0%, 
        transparent 50%
    );
    pointer-events: none;
}

/* Prevenção de seleção */
.flipbook-wrapper * {
    user-select: none;
    -webkit-user-select: none;
}

.flipbook-page-input {
    user-select: auto;
    -webkit-user-select: auto;
}

/* Print */
@media print {
    .flipbook-controls,
    .flipbook-top-controls,
    .flipbook-loading {
        display: none !important;
    }
    
    .flipbook-wrapper {
        background: white;
        box-shadow: none;
    }
}