/**
 * book.css - Estilos do viewer de livros de poesia
 * Usado por todos os arquivos poetry/*.html
 */

/* ================================================
   SIDEBAR - Menu lateral com sumário
   ================================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1001;
    display: flex;
    align-items: stretch;
}

/* Linha vertical visível quando fechado */
.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 8px;
    height: 100%;
    background: linear-gradient(180deg,
        #5a0000 0%,
        #8B0000 15%,
        #a01010 50%,
        #8B0000 85%,
        #5a0000 100%);
    box-shadow: 2px 0 12px rgba(139, 0, 0, 0.6);
    transition: opacity 0.3s;
}

.sidebar.open::before {
    opacity: 0;
}

/* Botão toggle */
.sidebar-toggle {
    position: relative;
    width: 32px;
    height: 100vh;
    background: linear-gradient(90deg, rgba(139, 0, 0, 0.4) 0%, rgba(139, 0, 0, 0.1) 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.3s;
}

.sidebar-toggle:hover {
    background: linear-gradient(90deg, rgba(160, 16, 16, 0.5) 0%, rgba(139, 0, 0, 0.2) 100%);
}

.toggle-arrow {
    font-size: 1.6rem;
    color: #f0e6d3;
    font-weight: 400;
    transition: transform 0.3s;
    line-height: 1;
    text-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
}

.sidebar-toggle:hover .toggle-arrow {
    transform: scale(1.3);
    color: #fff;
}

/* Painel do sumário */
.sidebar-panel {
    width: 0;
    height: 100vh;
    background: var(--bg-primary);
    border-right: 1px solid var(--border);
    overflow: hidden;
    transition: width 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar.open .sidebar-panel {
    width: 260px;
}

.sidebar-header {
    padding: 80px 20px 15px;
    border-bottom: 1px solid var(--border);
}

.sidebar-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.3rem;
    color: var(--text-primary);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 15px 20px;
}

.sidebar-back-link {
    display: block;
    padding: 10px 0;
    margin-bottom: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    border-bottom: 1px solid var(--border);
}

.sidebar-back-link:hover {
    color: var(--accent-red);
    transform: translateX(-3px);
}

.sidebar-link {
    display: block;
    padding: 6px 0;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.sidebar-link:hover {
    color: var(--accent-red);
}

.sidebar-section {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.95rem;
    color: var(--accent-gold);
    margin: 18px 0 6px;
    font-weight: 500;
}

/* ================================================
   BOOK CONTAINER
   ================================================ */
.book-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 80px 20px 40px;
    min-height: 100vh;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* ================================================
   BOOK NAVIGATION (Anterior/Próximo)
   ================================================ */
.book-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 10px 20px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 4px;
}

.nav-btn:hover:not(:disabled) {
    border-color: var(--accent-red);
    color: var(--accent-red);
    background: rgba(139, 0, 0, 0.05);
}

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

.page-indicator {
    color: var(--text-light);
    font-size: 0.95rem;
    min-width: 80px;
    text-align: center;
    font-family: 'Cormorant Garamond', serif;
}

/* ================================================
   BOOK CONTENT
   ================================================ */
.book-content {
    animation: fadeIn 0.3s ease;
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

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

/* ================================================
   COVER PAGE
   ================================================ */
.page-cover {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
}

.cover-image {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

/* ================================================
   TABLE OF CONTENTS
   ================================================ */
.page-toc {
    padding: 20px 0;
    width: 100%;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.toc-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.2rem;
    text-align: center;
    margin-bottom: 40px;
    font-weight: 400;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.toc-content {
    max-width: 100%;
    margin: 0;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.toc-section-block {
    margin-bottom: 2rem;
}

.toc-section-name {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.2rem;
    color: var(--accent-gold);
    margin-bottom: 0.8rem;
    font-weight: 500;
}

.toc-section-block ul {
    list-style: none;
    padding-left: 1rem;
}

.toc-section-block li {
    margin-bottom: 0.4rem;
}

.toc-section-block a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.toc-section-block a:hover {
    color: var(--accent-red);
}

/* ================================================
   PREFACE
   ================================================ */
.page-preface {
    padding: 20px 0;
}

.preface-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.2rem;
    text-align: center;
    margin-bottom: 40px;
    font-weight: 400;
}

.preface-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem;
    line-height: 1.9;
    color: var(--text-secondary);
    text-align: justify;
}

.preface-text p {
    margin-bottom: 1.5rem;
}

/* ================================================
   SECTION DIVIDER
   ================================================ */
.page-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50vh;
}

.page-section .section-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2rem;
    color: var(--accent-gold);
    text-align: center;
    font-weight: 400;
    font-style: italic;
}

/* ================================================
   POEM PAGE
   ================================================ */
.page-poem {
    display: block;
    box-sizing: border-box;
    padding: 20px 0;
    width: 100% !important;
    min-width: 100%;
    max-width: 100%;
    margin: 0;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.poem-title {
    display: block;
    box-sizing: border-box;
    width: 100%;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.8rem;
    text-align: left;
    margin: 0 0 40px 0;
    font-weight: 400;
    padding: 0;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.poem-text {
    display: block;
    box-sizing: border-box;
    width: 100%;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.25rem;
    line-height: 1.85;
    color: var(--text-primary);
    text-align: left;
    margin: 0;
    padding: 0;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* ================================================
   POEM PLACEHOLDER (for untranslated content)
   ================================================ */
.poem-placeholder {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-top: 2rem;
}

.placeholder-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.8rem;
    color: var(--accent-gold);
    margin-bottom: 0.5rem;
}

.placeholder-text {
    font-size: 1rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* ================================================
   SWIPE INDICATOR (mobile)
   ================================================ */
.swipe-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 100;
}

.swipe-indicator.visible {
    opacity: 1;
}

/* ================================================
   TOOLTIPS DE DICA
   ================================================ */
.tooltip-hint {
    position: fixed;
    background: linear-gradient(135deg, #8B0000 0%, #a01010 100%);
    color: #fff;
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
    max-width: 260px;
    box-shadow: 0 4px 20px rgba(139, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: none;
}

.tooltip-hint.visible {
    opacity: 1;
    transform: translateX(0);
}

.tooltip-hint::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border: 8px solid transparent;
}

/* Seta apontando para a esquerda (tooltip da sidebar) */
.tooltip-hint.arrow-left::before {
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    border-right-color: #8B0000;
}

/* Seta apontando para cima (tooltip do compare) */
.tooltip-hint.arrow-up::before {
    top: -16px;
    left: 20px;
    border-bottom-color: #8B0000;
}

.tooltip-hint .close-tooltip {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
}

.tooltip-hint .close-tooltip:hover {
    color: #fff;
}

/* ================================================
   RESPONSIVE - TABLET
   ================================================ */
@media (max-width: 768px) {
    .sidebar.open .sidebar-panel {
        width: 220px;
    }

    .sidebar-header {
        padding: 70px 15px 12px;
    }
}

/* ================================================
   RESPONSIVE - MOBILE
   ================================================ */
@media (max-width: 600px) {
    .book-container {
        padding: 70px 15px 30px 45px;
    }

    .poem-title {
        font-size: 1.5rem;
    }

    .poem-text {
        font-size: 1.1rem;
    }

    .toc-title,
    .preface-title {
        font-size: 1.8rem;
    }

    .page-section .section-title {
        font-size: 1.6rem;
    }

    .book-nav {
        gap: 10px;
    }

    .nav-btn {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}

@media (max-width: 500px) {
    .book-container {
        padding: 130px 15px 30px 45px;
    }

    .sidebar.open .sidebar-panel {
        width: 200px;
    }
}

/* ================================================
   COMPARE BUTTONS - Comparação bilíngue
   ================================================ */
.compare-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 15px;
    border-bottom: 1px solid rgba(139, 0, 0, 0.3);
    margin-bottom: 10px;
}

.compare-label {
    font-size: 0.85rem;
    color: #999;
    margin-right: 4px;
}

.compare-btn {
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid rgba(139, 0, 0, 0.5);
    background: transparent;
    color: #ccc;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.compare-btn:hover {
    border-color: #8B0000;
    color: #fff;
    background: rgba(139, 0, 0, 0.2);
}

.compare-btn.active {
    background: #8B0000;
    border-color: #8B0000;
    color: #fff;
    box-shadow: 0 0 8px rgba(139, 0, 0, 0.5);
}

/* ================================================
   BILINGUAL POEM LAYOUT
   ================================================ */
.poem-bilingual {
    display: flex;
    gap: 40px;
    width: 100%;
}

.poem-column {
    flex: 1;
    min-width: 0;
}

.poem-lang-label {
    font-size: 0.85rem;
    color: #8B0000;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(139, 0, 0, 0.3);
}

/* ================================================
   BILINGUAL COVER LAYOUT
   ================================================ */
.cover-bilingual {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: flex-start;
}

.cover-column {
    flex: 1;
    max-width: 400px;
    text-align: center;
}

.cover-bilingual .cover-image {
    max-height: 60vh;
    width: auto;
}

/* ================================================
   BILINGUAL PREFACE/BIOGRAPHY LAYOUT
   ================================================ */
.preface-bilingual {
    display: flex;
    gap: 40px;
    max-width: 100%;
}

.preface-column {
    flex: 1;
    min-width: 0;
}

/* ================================================
   BILINGUAL SECTION LAYOUT
   ================================================ */
.section-bilingual {
    display: flex;
    gap: 60px;
    justify-content: center;
    align-items: center;
}

.section-column {
    text-align: center;
}

.section-lang-label {
    display: block;
    font-size: 0.75rem;
    color: #8B0000;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

/* ================================================
   BILINGUAL TERMINAL LAYOUT
   ================================================ */
.terminal-bilingual {
    display: flex;
    gap: 40px;
}

.terminal-column {
    flex: 1;
    min-width: 0;
}

/* ================================================
   BILINGUAL TOC LAYOUT
   ================================================ */
.toc-bilingual {
    display: flex;
    gap: 40px;
    text-align: left;
}

.toc-column {
    flex: 1;
    min-width: 0;
}

/* Focus styles inherited from globals.css */

/* ================================================
   RESPONSIVE: Stack columns on small screens
   ================================================ */
@media (max-width: 900px) {
    .poem-bilingual,
    .cover-bilingual,
    .preface-bilingual,
    .section-bilingual,
    .terminal-bilingual,
    .toc-bilingual {
        flex-direction: column;
        gap: 50px;
    }

    .poem-column,
    .preface-column,
    .terminal-column,
    .toc-column {
        padding-bottom: 30px;
        border-bottom: 1px solid rgba(139, 0, 0, 0.2);
    }

    .poem-column:last-child,
    .preface-column:last-child,
    .terminal-column:last-child,
    .toc-column:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

    .cover-column {
        max-width: 100%;
    }

    .cover-bilingual .cover-image {
        max-height: 50vh;
    }

    .section-bilingual {
        gap: 30px;
    }
}
