/* ==========================================
   RESET E ESTILOS BASE
   ========================================== */

   * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    transition: background-color var(--transition-speed), color var(--transition-speed);
    line-height: 1.6;
}

/* ==========================================
   LAYOUT PRINCIPAL
   ========================================== */

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    display: flex;
    flex-wrap: wrap;
    position: relative;
    padding-bottom: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

main {
    flex: 1;
    background-color: var(--container-bg);
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--shadow-color);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    min-height: 500px; /* Altura mínima para evitar que fique muito pequeno */
}

footer {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.7;
}

/* ==========================================
   TIPOGRAFIA
   ========================================== */

h1 {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--primary-color);
}

h2 {
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    font-weight: 500;
    color: var(--primary-color);
}

/* ==========================================
   BARRA DE PROGRESSO
   ========================================== */

.progress-container {
    width: 100%;
    height: 6px;
    background-color: var(--border-color);
    border-radius: 3px;
    margin-bottom: 2rem;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 3px;
    width: 20%;
    transition: width 0.5s ease;
}

/* ==========================================
   CONTÊINERES DE PERGUNTAS
   ========================================== */

   .form-container {
    position: relative;
    min-height: 300px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.question-container {
    display: none;
    position: relative; /* Alterado de absolute para relative */
    width: 100%;
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.question-container.active {
    display: block;
    opacity: 1;
    transform: translateX(0);
    z-index: 1;
}

/* ==========================================
   BOTÕES E INPUTS
   ========================================== */

.options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.option-btn {
    padding: 1rem;
    background-color: var(--highlight-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    color: var(--text-color);
}

.option-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.option-btn.selected {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.input-container {
    display: flex;
    gap: 1rem;
}

input[type="text"] {
    flex-grow: 1;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--background-color);
    color: var(--text-color);
}

.submit-btn {
    padding: 1rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.submit-btn:hover {
    background-color: var(--secondary-color);
}

.navigation-btns {
    margin-top: 1.5rem;
    display: flex;
    justify-content: space-between;
}

.nav-btn {
    padding: 0.6rem 1.2rem;
    background-color: var(--highlight-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-btn:hover:not(:disabled) {
    background-color: var(--border-color);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-btn.next-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
}

.nav-btn.next-btn:hover {
    background-color: var(--secondary-color);
}

.other-option {
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.other-option input[type="text"] {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--background-color);
    color: var(--text-color);
}

/* ==========================================
   CARREGAMENTO
   ========================================== */

.loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 3rem 0;
    text-align: center;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--container-bg);
    z-index: 10;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--highlight-color);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ==========================================
   RESULTADOS E LIVROS
   ========================================== */

.results {
    display: none;
    animation: fadeIn 0.5s ease;
    position: relative;
    z-index: 5;
    width: 100%;
}

.books-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.book-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--background-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px var(--shadow-color);
}

.book-cover {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
    border-bottom: 1px solid var(--border-color);
}

.book-info {
    padding: 1rem;
}

.book-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.book-author {
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
    color: var(--text-color);
    opacity: 0.8;
}

.book-description {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    color: var(--text-color);
    opacity: 0.9;
    display: -webkit-box;
    -webkit-line-clamp: 10;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-link {
    display: block;
    text-align: center;
    padding: 0.8rem;
    background-color: var(--primary-color);
    color: white;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.book-link:hover {
    background-color: var(--secondary-color);
}

/* ==========================================
   ADIÇÃO DE LIVROS LIDOS
   ========================================== */

.livros-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.livro-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.livro-input .book-read {
    flex-grow: 1;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--background-color);
    color: var(--text-color);
}

.add-book {
    margin-bottom: 1.5rem;
}

.action-btn {
    background-color: var(--highlight-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.6rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s ease;
}

.action-btn:hover {
    background-color: var(--border-color);
}

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--container-bg);
    color: var(--text-color);
    padding: 1rem 1.5rem;
    border-radius: 4px;
    box-shadow: 0 4px 12px var(--shadow-color);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.toast.show {
    opacity: 1;
}

/* ==========================================
   ANIMAÇÕES
   ========================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* ==========================================
   ESTILO PARA CARACTERÍSTICAS DOS LIVROS
   ========================================== */

/* Explicação da pergunta */
.question-explanation {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
    text-align: center;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: -0.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
    font-style: italic;
}

/* Container de características */
.book-characteristics-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    width: 100%;
}

/* Item individual de característica */
.book-characteristic-item {
    background-color: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.book-characteristic-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Título do livro */
.book-characteristic-title {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
}

.book-characteristic-title::before {
    content: '📚';
    margin-right: 0.5rem;
    font-size: 1.2rem;
}

/* Entrada de característica */
.book-characteristic-input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--background-color);
    color: var(--text-color);
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.book-characteristic-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(124, 77, 255, 0.2);
}

/* Exemplos de características */
.characteristic-examples {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.8rem;
}

.characteristic-example {
    background-color: var(--highlight-color);
    color: var(--text-color);
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
    border-radius: 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border: 1px solid var(--border-color);
}

.characteristic-example:hover {
    background-color: var(--primary-color);
    color: white;
}