/* CSS específico para navegação de acordeão dos capítulos - VERSÃO FINAL */

/* VERSÃO 2025-01-27 ÀS 13:30 - FORÇAR TODAS AS MUDANÇAS */

/* ESCONDER QUALQUER TEXTO DE QUANTIDADE */
*[class*="quantidade"], 
*[class*="revelacao"],
*:contains("revelaçãoões"),
*:contains("revelação"),
*:contains("0 revelações"),
*:contains("5 revelações"),
p:contains("revelação") {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* FORÇAR CONTAINER ÚNICO - TODOS OS ARTICLES DEVEM SER COMBINADOS */
#posts-container article + article {
    border: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* FORÇAR ESTILOS PARA CONTAINER ÚNICO */
#posts-container > article:first-child {
    background: linear-gradient(135deg, #111827 0%, #1f2937 50%, #111827 100%) !important;
    border: 2px solid #374151 !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ESCONDER TODOS OS ARTICLES DEPOIS DO PRIMEIRO */
#posts-container > article:not(:first-child) {
    display: none !important;
}

/* Container principal */
.chapter-accordion {
    margin: 0 auto;
    max-width: 100%;
}

/* Item individual do acordeão dentro da caixa unificada */
.chapter-accordion-item {
    position: relative;
    margin: 0 !important;
}

/* Header do capítulo (clicável) */
.chapter-header {
    position: relative;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 1.5rem 2rem !important;
    cursor: pointer !important;
    transition: all 0.3s ease;
    border-radius: 0 !important;
    margin: 0 !important;
    background: transparent !important;
}

/* Forçar o div interno também ter justify-space-between */
.chapter-header .flex {
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

/* Garantir que o título não ocupe todo o espaço */
.chapter-header h3 {
    flex: 1 !important;
    margin-right: 1rem !important;
}

/* Garantir que a seta fique sempre no canto direito */
.chapter-toggle-icon {
    position: absolute !important;
    right: 2rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    flex-shrink: 0 !important;
    transition: transform 0.3s ease !important;
}

.chapter-header:hover {
    background-color: rgba(55, 65, 81, 0.4) !important;
}

.chapter-header.chapter-active {
    background-color: rgba(55, 65, 81, 0.6) !important;
}

/* Primeiro item com borda superior arredondada */
.chapter-accordion-item:first-child .chapter-header {
    border-radius: 12px 12px 0 0 !important;
}

/* Último item sem capítulo expandido */
.chapter-accordion-item:last-child .chapter-header {
    border-radius: 0 0 12px 12px !important;
}

/* Único item (caso especial) */
.chapter-accordion-item:first-child:last-child .chapter-header {
    border-radius: 12px !important;
}

/* Quando um capítulo está expandido, remover borda inferior arredondada */
.chapter-accordion-item:last-child .chapter-header.chapter-active {
    border-radius: 0 !important;
}

/* Ícone de toggle */
.chapter-toggle-icon {
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.chapter-toggle-icon svg {
    transition: transform 0.3s ease;
}

/* Conteúdo do capítulo */
.chapter-content {
    border-radius: 0 !important;
    transition: all 0.3s ease;
    background-color: rgba(31, 41, 55, 0.4) !important;
    border-top: 1px solid rgba(75, 85, 99, 0.8) !important;
}

/* Último item expandido com borda inferior arredondada */
.chapter-accordion-item:last-child .chapter-content {
    border-radius: 0 0 12px 12px !important;
}

.chapter-content.chapter-expanded {
    animation: fadeIn 0.3s ease-out;
}

/* Animação de fade in */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Estilo dos posts dentro do acordeão */
.chapter-content .post-item {
    border-radius: 6px;
    transition: all 0.2s ease;
}

.chapter-content .post-item:hover {
    background-color: rgba(55, 65, 81, 0.4) !important;
}

.chapter-content .post-link {
    display: block;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.chapter-content .post-link:hover {
    background-color: rgba(55, 65, 81, 0.6) !important;
    transform: translateX(4px);
}

/* Bordas entre capítulos - MAIS VISÍVEL */
.chapter-accordion-item + .chapter-accordion-item {
    border-top: 2px solid rgba(75, 85, 99, 0.8) !important;
}

/* Container principal */
.chapter-accordion {
    margin: 0 auto;
    max-width: 100%;
}

/* Item individual do acordeão dentro da caixa unificada */
.chapter-accordion-item {
    position: relative;
    margin: 0 !important;
}

/* Header do capítulo (clicável) */
.chapter-header {
    position: relative;
    transition: all 0.3s ease;
    border-radius: 0 !important;
    margin: 0 !important;
    background: transparent !important;
}

.chapter-header:hover {
    background-color: rgba(55, 65, 81, 0.4) !important;
}

.chapter-header.chapter-active {
    background-color: rgba(55, 65, 81, 0.6) !important;
}

/* Primeiro item com borda superior arredondada */
.chapter-accordion-item:first-child .chapter-header {
    border-radius: 12px 12px 0 0 !important;
}

/* Último item sem capítulo expandido */
.chapter-accordion-item:last-child .chapter-header {
    border-radius: 0 0 12px 12px !important;
}

/* Único item (caso especial) */
.chapter-accordion-item:first-child:last-child .chapter-header {
    border-radius: 12px !important;
}

/* Quando um capítulo está expandido, remover borda inferior arredondada */
.chapter-accordion-item:last-child .chapter-header.chapter-active {
    border-radius: 0 !important;
}

/* Ícone de toggle */
.chapter-toggle-icon {
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.chapter-toggle-icon svg {
    transition: transform 0.3s ease;
}

/* Conteúdo do capítulo */
.chapter-content {
    border-radius: 0 !important;
    transition: all 0.3s ease;
    background-color: rgba(31, 41, 55, 0.4) !important;
    border-top: 1px solid rgba(75, 85, 99, 0.8) !important;
}

/* Último item expandido com borda inferior arredondada */
.chapter-accordion-item:last-child .chapter-content {
    border-radius: 0 0 12px 12px !important;
}

.chapter-content.chapter-expanded {
    animation: fadeIn 0.3s ease-out;
}

/* Animação de fade in */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Estilo dos posts dentro do acordeão */
.chapter-content .post-item {
    border-radius: 6px;
    transition: all 0.2s ease;
}

.chapter-content .post-item:hover {
    background-color: rgba(55, 65, 81, 0.4) !important;
}

.chapter-content .post-link {
    display: block;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.chapter-content .post-link:hover {
    background-color: rgba(55, 65, 81, 0.6) !important;
    transform: translateX(4px);
}

/* Bordas entre capítulos - MAIS VISÍVEL */
.chapter-accordion-item + .chapter-accordion-item {
    border-top: 2px solid rgba(75, 85, 99, 0.8) !important;
}

/* Responsividade para tablets */
@media (max-width: 768px) {
    .chapter-header {
        padding: 1rem 1.5rem !important;
    }
    
    .chapter-content {
        padding: 1rem 1.5rem !important;
    }
    
    .chapter-header h3 {
        font-size: 1.25rem !important;
        line-height: 1.4;
    }
    
    .chapter-toggle-icon svg {
        width: 1.25rem !important;
        height: 1.25rem !important;
    }
}

/* Responsividade para celulares */
@media (max-width: 480px) {
    .chapter-header {
        padding: 0.875rem 1rem !important;
    }
    
    .chapter-content {
        padding: 0.875rem 1rem !important;
    }
    
    .chapter-header h3 {
        font-size: 1.125rem !important;
        line-height: 1.3;
    }
    
    .chapter-header .flex {
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .chapter-toggle-icon {
        margin-top: 0.125rem;
    }
    
    .chapter-toggle-icon svg {
        width: 1rem !important;
        height: 1rem !important;
    }
    
    .chapter-content .post-item {
        margin-bottom: 0.5rem;
    }
    
    .chapter-content .post-link {
        font-size: 1rem;
        padding: 0.5rem 0.75rem;
    }
}

/* Estados de foco para acessibilidade */
.chapter-header:focus {
    outline: 2px solid #f59e0b;
    outline-offset: 2px;
}

.chapter-header:focus-visible {
    outline: 2px solid #f59e0b;
    outline-offset: 2px;
}

/* Melhor contraste para texto */
.chapter-header h3 {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: none;
}

/* Animação suave para mudança de altura */
.chapter-content {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

/* Estados hover melhorados */
.chapter-header:hover .chapter-toggle-icon svg {
    color: #fbbf24 !important;
}

.chapter-header.chapter-active .chapter-toggle-icon svg {
    color: #f59e0b !important;
}

/* Indicador visual sutil para capítulos expandidos - MAIS VISÍVEL */
.chapter-header.chapter-active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, #fbbf24, #f59e0b);
    border-radius: 0 2px 2px 0;
    z-index: 10;
}

/* Animação de pulsação sutil para indicar interatividade */
.chapter-header {
    position: relative;
}

.chapter-header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    transition: background 0.3s ease;
    pointer-events: none;
}

.chapter-header:hover::after {
    background: rgba(251, 191, 36, 0.08) !important;
}

/* Container unificado com melhor estilo */
#posts-container {
    position: relative;
}

/* Efeito sutil no container principal - MAIS VISÍVEL */
#posts-container > article::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(251, 191, 36, 0.5), transparent);
    z-index: 1;
}

/* FORÇAR REMOÇÃO DE ESPAÇAMENTOS ANTIGOS */
.space-y-8 > :not([hidden]) ~ :not([hidden]) {
    margin-top: 0 !important;
}

.space-y-4 > :not([hidden]) ~ :not([hidden]) {
    margin-top: 1rem !important;
}

/* ===========================================
   CORREÇÃO FINAL - ALINHAMENTO SETAS À DIREITA
   =========================================== */
   
/* Sobrescrever todos os estilos anteriores do header */
.chapter-header {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 1.5rem 4rem 1.5rem 2rem !important; /* Padding extra à direita para a seta */
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    border-radius: 0 !important;
    margin: 0 !important;
    background: transparent !important;
}

/* Forçar div interno a ocupar só o espaço necessário */
.chapter-header .flex {
    width: 100% !important;
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    position: relative !important;
}

/* Título ocupa espaço necessário sem afetar a seta */
.chapter-header h3 {
    flex: none !important;
    margin-right: auto !important;
    max-width: calc(100% - 4rem) !important;
}

/* Seta SEMPRE no canto direito - posição absoluta */
.chapter-toggle-icon {
    position: absolute !important;
    right: 2rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    flex-shrink: 0 !important;
    transition: all 0.3s ease !important;
    z-index: 10 !important;
}

.chapter-toggle-icon svg {
    transition: transform 0.3s ease !important;
    width: 1.5rem !important;
    height: 1.5rem !important;
    color: #FFD700 !important;
}
