@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Poppins:wght@300;400;600&display=swap');

:root {
    --primary-color: #8B5A2B; /* A warm wood tone */
    --bg-color: #1c1511; /* Darker, elegant background */
    --paper-color: #fcf9f2; /* Creamy paper look */
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-color: #fdfdfd;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* REQUISITO 1 & 7: Sem scroll horizontal nem vertical */
}

/* Background com textura/gradiente rico */
.main-background {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    /* Ajustado para fundo muito escuro simulando o design em anexo */
    background: #0f0a07;
    z-index: -1;
}

.container {
    width: 100vw;
    height: 100vh;
    max-width: none; /* Remover o limite fixo, deixamos o ecrã mandar */
    margin: 0; 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

/* --- Loader Styling --- */
.loader-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: var(--primary-color);
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    transition: opacity 0.5s ease;
}

.loader-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(139, 90, 43, 0.3);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Controles Estilo Minimalista --- */
.controls {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
}

/* Botões com Ícones */
.icon-btn {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    width: 60px; /* Botão consideravelmente maior conforme o design */
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: white;
    transition: all 0.3s ease;
    padding: 0;
}

.icon-btn svg {
    width: 30px; /* Ícone interno maior */
    height: 30px;
    stroke-width: 1.5; /* Ícone mais fino e elegante */
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1); /* Efeito suave no hover vazio */
    border-color: white;
    transform: scale(1.05);
}

.icon-btn:active {
    transform: scale(0.95);
}

/* --- O Livro --- */
.book-shell {
    width: 95vw; /* Fica praticamente a tocar nas margens laterais como na imagem */
    height: 98vh; /* Toca quase no topo e no fundo */
    display: flex;
    justify-content: center;
    align-items: center; 
    perspective: 2500px;
    filter: drop-shadow(0 0 30px rgba(0,0,0,0.8)); /* Sombra mais densa e focada para contrastar com o fundo escuro */
}

/* Base de ligação da biblioteca (importante display: block) */
#flipbook {
    display: block;
}

.page {
    background-color: var(--paper-color);
    width: 100%; 
    height: 100%; 
    overflow: hidden;
    /* Removida a borda para ficar seamless com fundo escuro tal como no design */
}

/* Páginas pares (esquerda) e ímpares (direita) recebem gradientes simulando a sombra na lombada */
.page.--left .page-effect {
    box-shadow: inset -20px 0 30px -10px rgba(0,0,0,0.2) !important;
}

.page.--right .page-effect {
    box-shadow: inset 20px 0 30px -10px rgba(0,0,0,0.2) !important;
}

/* Embalagem da página */
.page-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background-color: var(--paper-color);
}

.page canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    mix-blend-mode: multiply; /* Para a tinta do PDF se mesclar no tom de papel da página */
}

/* Efeito overlay sombra (injetado via JS ou pseudo-elements) */
.page-effect {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 10;
}
