@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;500;600&family=Patrick+Hand&display=swap');

/* === RESET BÁSICO === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* === BASE === */
body {
    font-family: 'Quicksand', sans-serif;
    background: #f0f0f0; /* Cor de fundo mais neutra para o corpo */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #6d6d6d;
    overflow-x: hidden;
}

/* === CONTAINER PRINCIPAL === */
.flipbook-container {
    background: transparent;
    padding: 20px;
    width: 100%;
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* === CABEÇALHO === */
.flipbook-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap;
    gap: 15px;
}

.flipbook-header h1 {
    color: #a2b78a;
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 1px;
    font-family: 'Patrick Hand', cursive;
}

.controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* === BOTÕES === */
.nav-btn, .flip-btn, .go-btn, .zoom-btn {
    background: #ffffff;
    border: 1.5px solid #d4d4d4;
    color: #a2b78a;
    padding: 8px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    font-family: 'Quicksand', sans-serif;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    white-space: nowrap;
}

.nav-btn:hover, .flip-btn:hover, .go-btn:hover, .zoom-btn:hover {
    background: #a2b78a;
    color: #ffffff;
    border-color: #a2b78a;
    transform: translateY(-1px);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

/* === INFORMAÇÕES DE PÁGINA === */
.page-info {
    font-weight: 500;
    color: #a2b78a;
    min-width: 100px;
    text-align: center;
    font-size: 0.9rem;
}

/* === ÁREA DO FLIPBOOK === */
.flipbook-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 85vh; /* Manter a altura para o container */
    min-height: 500px;
    position: relative;
    overflow: hidden; /* Evita que o zoom estoure o container */
}

#book {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* CONTAINER PRINCIPAL DO FLIPBOOK - ESTILOS MAIS SUAVES */
.stf__wrapper {
    margin: 0 auto !important;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    border-radius: 10px;
    background: white;
    overflow: visible !important; /* Voltar para visible para não cortar o flipbook se o zoom for aplicado ao #book */
}

/* PÁGINAS - ESTILOS MAIS SIMPLES */
.page {
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0; /* Removido para que a imagem ocupe toda a página */
}

.page img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Voltar para 'contain' para não cortar o código */
    background: white;
    display: block;
    margin: 0;
    padding: 0;
}

/* === RODAPÉ === */
.flipbook-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    flex-wrap: wrap;
    gap: 15px;
}

.zoom-controls, .page-navigation, .flip-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* === INPUT DE NAVEGAÇÃO === */
#pageInput {
    padding: 7px 12px;
    border: 1.5px solid #d4d4d4;
    background: #ffffff;
    color: #6d6d6d;
    border-radius: 18px;
    width: 130px;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s ease;
    font-family: 'Quicksand', sans-serif;
    text-align: center;
}

#pageInput:focus {
    border-color: #a2b78a;
    color: #a2b78a;
}

/* === CARREGAMENTO === */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(252, 252, 252, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 35px;
    height: 35px;
    border: 2px solid rgba(162, 183, 138, 0.2);
    border-top: 2px solid #a2b78a;
    border-radius: 50%;
    animation: rotation 1s linear infinite;
    margin-bottom: 15px;
}

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

.loading-overlay p {
    font-size: 1rem;
    color: #a2b78a;
    font-weight: 500;
    font-family: 'Patrick Hand', cursive;
}

/* === FOCUS E ESTADOS === */
button:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(162, 183, 138, 0.2);
}

/* === RESPONSIVIDADE === */
@media (max-width: 1024px) {
    .flipbook-wrapper {
        height: 80vh; /* Aumentar um pouco para telas de tablet */
    }
}

@media (max-width: 768px) {
    .flipbook-container {
        padding: 15px;
    }
    .flipbook-header {
        flex-direction: column;
        gap: 10px; /* Reduzido */
        text-align: center;
        padding-bottom: 10px; /* Reduzido */
    }
    .flipbook-wrapper {
        height: 75vh; /* Aumentado para priorizar o flipbook */
    }
    .flipbook-footer {
        flex-direction: column;
        gap: 10px; /* Reduzido */
        padding-top: 10px; /* Reduzido */
    }
}

@media (max-width: 480px) {
    .flipbook-wrapper {
        height: 65vh; /* Aumentado para priorizar o flipbook */
    }
    .nav-btn, .flip-btn {
        padding: 6px 14px;
        font-size: 0.8rem;
    }
    .page-info {
        font-size: 0.8rem;
        min-width: 80px;
    }
    #pageInput {
        width: 100px;
        font-size: 0.8rem;
    }
    .flipbook-footer {
        gap: 10px;
    }
}
