/**
 * Estilos para Template de Capítulos - A Jornada de Salimo
 * 
 * @package IHAPARI
 * @since 1.0.0
 */

/* === Variáveis CSS === */
:root {
    --ihapari-primary: #1e3a8a;
    --ihapari-secondary: #7c3aed;
    --ihapari-accent: #ec4899;
    --ihapari-text: #1f2937;
    --ihapari-text-light: #6b7280;
    --ihapari-bg: #ffffff;
    --ihapari-bg-alt: #f9fafb;
    --ihapari-border: #e5e7eb;
    --ihapari-shadow: rgba(0, 0, 0, 0.1);
    --ihapari-transition: all 0.3s ease;
}

/* === Layout Principal === */
.chapter-main {
    background-color: var(--ihapari-bg-alt);
    min-height: 100vh;
}

.chapter-container {
    max-width: 100%;
    margin: 0 auto;
}

/* === Navegação Superior === */
.chapter-navigation-header {
    background-color: var(--ihapari-bg);
    border-bottom: 1px solid var(--ihapari-border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px var(--ihapari-shadow);
}

.chapter-nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.chapter-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.chapter-category {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--ihapari-secondary);
    letter-spacing: 0.05em;
}

.chapter-number {
    font-size: 0.875rem;
    color: var(--ihapari-text-light);
}

.toggle-sidebar-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background-color: var(--ihapari-primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--ihapari-transition);
}

.toggle-sidebar-btn:hover {
    background-color: #1e40af;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px var(--ihapari-shadow);
}

.toggle-sidebar-btn svg {
    width: 20px;
    height: 20px;
}

/* === Layout do Conteúdo === */
.chapter-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    position: relative;
}

/* === Conteúdo do Capítulo === */
.chapter-content {
    background-color: var(--ihapari-bg);
    padding: 0;
}

.chapter-featured-image {
    width: 100%;
    max-height: 600px;
    overflow: hidden;
    margin-bottom: 0;
}

.chapter-featured-image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.chapter-content-inner {
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.chapter-header {
    margin-bottom: 2.5rem;
    text-align: left;
}

.chapter-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--ihapari-primary);
    line-height: 1.2;
    margin-bottom: 1rem;
}

.chapter-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.875rem;
    color: var(--ihapari-text-light);
    flex-wrap: wrap;
}

.chapter-date,
.chapter-author {
    display: flex;
    align-items: center;
}

.chapter-text {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--ihapari-text);
}

.chapter-text p {
    margin-bottom: 1.5rem;
}

.chapter-text h2,
.chapter-text h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--ihapari-primary);
}

.chapter-text img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 2rem 0;
}

/* === Navegação entre Capítulos (Rodapé) === */
.chapter-navigation-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 2px solid var(--ihapari-border);
}

.nav-previous,
.nav-next {
    display: flex;
}

.nav-previous {
    justify-content: flex-start;
}

.nav-next {
    justify-content: flex-end;
}

.nav-chapter-link {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.5rem;
    background-color: var(--ihapari-bg-alt);
    border: 1px solid var(--ihapari-border);
    border-radius: 0.75rem;
    text-decoration: none;
    color: var(--ihapari-text);
    transition: var(--ihapari-transition);
    max-width: 100%;
}

.nav-chapter-link:hover {
    background-color: var(--ihapari-bg);
    border-color: var(--ihapari-primary);
    box-shadow: 0 4px 12px var(--ihapari-shadow);
    transform: translateY(-2px);
}

.nav-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ihapari-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.prev-chapter .nav-label {
    flex-direction: row;
}

.next-chapter .nav-label {
    flex-direction: row-reverse;
}

.nav-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--ihapari-text);
}

/* === Sidebar de Capítulos === */
.chapter-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background-color: var(--ihapari-bg);
    box-shadow: -4px 0 12px var(--ihapari-shadow);
    z-index: 1000;
    overflow-y: auto;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.chapter-sidebar.active {
    right: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--ihapari-border);
    position: sticky;
    top: 0;
    background-color: var(--ihapari-bg);
    z-index: 10;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    color: var(--ihapari-primary);
    margin: 0;
}

.close-sidebar-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--ihapari-text-light);
    transition: var(--ihapari-transition);
    border-radius: 0.375rem;
}

.close-sidebar-btn:hover {
    background-color: var(--ihapari-bg-alt);
    color: var(--ihapari-text);
}

/* === Pesquisa === */
.chapter-search {
    padding: 1rem 1.5rem;
    position: relative;
}

.chapter-search-input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 1px solid var(--ihapari-border);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: var(--ihapari-transition);
}

.chapter-search-input:focus {
    outline: none;
    border-color: var(--ihapari-primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.search-icon {
    position: absolute;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ihapari-text-light);
    pointer-events: none;
}

/* === Filtros === */
.chapter-filters {
    padding: 0 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ihapari-text);
}

.chapter-sort-select {
    padding: 0.625rem;
    border: 1px solid var(--ihapari-border);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    background-color: var(--ihapari-bg);
    cursor: pointer;
    transition: var(--ihapari-transition);
}

.chapter-sort-select:focus {
    outline: none;
    border-color: var(--ihapari-primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

/* === Lista de Capítulos === */
.chapters-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 0 1.5rem;
}

.chapters-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.chapter-item {
    margin-bottom: 0.75rem;
}

.chapter-link {
    display: block;
    padding: 1rem;
    background-color: var(--ihapari-bg-alt);
    border: 1px solid var(--ihapari-border);
    border-radius: 0.5rem;
    text-decoration: none;
    color: var(--ihapari-text);
    transition: var(--ihapari-transition);
}

.chapter-link:hover {
    background-color: var(--ihapari-bg);
    border-color: var(--ihapari-primary);
    box-shadow: 0 2px 8px var(--ihapari-shadow);
}

.chapter-item.current-chapter .chapter-link {
    background-color: #ede9fe;
    border-color: var(--ihapari-secondary);
}

.chapter-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.chapter-item-number {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--ihapari-secondary);
    text-transform: uppercase;
}

.current-badge {
    font-size: 0.625rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    background-color: var(--ihapari-secondary);
    color: white;
    border-radius: 0.25rem;
    text-transform: uppercase;
}

.chapter-item-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--ihapari-text);
    margin: 0 0 0.5rem 0;
    line-height: 1.4;
}

.chapter-item-date {
    font-size: 0.75rem;
    color: var(--ihapari-text-light);
}

.no-chapters-found {
    padding: 2rem;
    text-align: center;
    color: var(--ihapari-text-light);
}

/* === Contador === */
.chapters-count {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--ihapari-border);
    font-size: 0.875rem;
    color: var(--ihapari-text-light);
    text-align: center;
    background-color: var(--ihapari-bg);
}

/* === Overlay === */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* === Responsividade === */

/* Tablets e dispositivos médios */
@media (max-width: 1024px) {
    .chapter-content-inner {
        max-width: 100%;
        padding: 2.5rem 2rem;
    }
    
    .chapter-sidebar {
        width: 380px;
    }
}

/* Mobile - Dispositivos pequenos */
@media (max-width: 768px) {
    /* Navegação Superior - Compacta */
    .chapter-navigation-header {
        padding: 0.5rem 0;
        position: static; /* Remove sticky em mobile */
    }
    
    .chapter-nav-content {
        flex-wrap: nowrap;
        gap: 0.5rem;
        align-items: center;
    }
    
    .chapter-info {
        flex: 1;
        min-width: 0;
    }
    
    .chapter-category {
        font-size: 0.625rem;
        line-height: 1.2;
    }
    
    .chapter-number {
        font-size: 0.6875rem;
        line-height: 1.2;
    }
    
    .chapter-search-toggle {
        flex-shrink: 0;
    }
    
    /* Botão de toggle - Compacto */
    .toggle-sidebar-btn {
        padding: 0.5rem 0.75rem;
        justify-content: center;
        font-size: 0.75rem;
        border-radius: 0.375rem;
        min-width: auto;
    }
    
    .toggle-sidebar-btn span {
        display: inline; /* Mantém o texto em tablets */
    }
    
    .toggle-sidebar-btn svg {
        width: 16px;
        height: 16px;
    }
    
    /* Imagem destacada */
    .chapter-featured-image {
        max-height: 400px;
    }
    
    /* Conteúdo */
    .chapter-content-inner {
        padding: 1.5rem 1rem;
    }
    
    .chapter-header {
        margin-bottom: 2rem;
    }
    
    .chapter-title {
        font-size: 1.75rem;
        line-height: 1.3;
    }
    
    .chapter-meta {
        flex-direction: row;
        gap: 1rem;
        font-size: 0.8125rem;
    }
    
    .chapter-text {
        font-size: 1rem;
        line-height: 1.7;
    }
    
    .chapter-text p {
        margin-bottom: 1.25rem;
    }
    
    /* Navegação entre capítulos */
    .chapter-navigation-footer {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-top: 3rem;
        padding-top: 1.5rem;
    }
    
    .nav-next {
        justify-content: flex-start;
    }
    
    .nav-chapter-link {
        padding: 1.25rem;
    }
    
    .nav-label {
        font-size: 0.8125rem;
    }
    
    .nav-title {
        font-size: 0.9375rem;
    }
    
    /* Sidebar */
    .chapter-sidebar {
        width: 100%;
        right: -100%;
        max-width: 100%;
    }
    
    .sidebar-header {
        padding: 1.25rem;
    }
    
    .sidebar-header h2 {
        font-size: 1.125rem;
    }
    
    .chapter-search {
        padding: 0.875rem 1.25rem;
    }
    
    .chapter-filters {
        padding: 0 1.25rem 0.875rem;
    }
    
    .chapters-list-container {
        padding: 0 1.25rem;
    }
}

/* Mobile pequeno - Smartphones */
@media (max-width: 480px) {
    /* Navegação Superior - Ultra Compacta */
    .chapter-navigation-header {
        padding: 0.375rem 0;
    }
    
    .chapter-nav-content {
        gap: 0.375rem;
    }
    
    .chapter-category {
        font-size: 0.5625rem;
        margin-bottom: 0.125rem;
    }
    
    .chapter-number {
        font-size: 0.625rem;
    }
    
    /* Botão de toggle - Apenas ícone circular */
    .toggle-sidebar-btn {
        padding: 0.5rem;
        font-size: 0;
        border-radius: 50%;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .toggle-sidebar-btn span {
        display: none;
    }
    
    .toggle-sidebar-btn svg {
        width: 20px;
        height: 20px;
        margin: 0;
    }
    
    /* Imagem destacada */
    .chapter-featured-image {
        max-height: 300px;
    }
    
    /* Conteúdo */
    .chapter-content-inner {
        padding: 1.25rem 0.875rem;
    }
    
    .chapter-header {
        margin-bottom: 1.5rem;
    }
    
    .chapter-title {
        font-size: 1.375rem;
        line-height: 1.35;
        margin-bottom: 0.75rem;
    }
    
    .chapter-meta {
        flex-direction: column;
        gap: 0.375rem;
        font-size: 0.75rem;
    }
    
    .chapter-text {
        font-size: 0.9375rem;
        line-height: 1.65;
    }
    
    .chapter-text p {
        margin-bottom: 1rem;
    }
    
    .chapter-text h2 {
        font-size: 1.25rem;
        margin-top: 1.5rem;
    }
    
    .chapter-text h3 {
        font-size: 1.125rem;
        margin-top: 1.25rem;
    }
    
    /* Navegação entre capítulos */
    .chapter-navigation-footer {
        gap: 0.75rem;
        margin-top: 2.5rem;
        padding-top: 1.25rem;
    }
    
    .nav-chapter-link {
        padding: 1rem;
    }
    
    .nav-label {
        font-size: 0.75rem;
        gap: 0.375rem;
    }
    
    .nav-label svg {
        width: 16px;
        height: 16px;
    }
    
    .nav-title {
        font-size: 0.875rem;
        line-height: 1.4;
    }
    
    /* Sidebar */
    .sidebar-header {
        padding: 1rem;
    }
    
    .sidebar-header h2 {
        font-size: 1rem;
    }
    
    .close-sidebar-btn {
        padding: 0.375rem;
    }
    
    .close-sidebar-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .chapter-search {
        padding: 0.75rem 1rem;
    }
    
    .chapter-search-input {
        padding: 0.625rem 2.25rem 0.625rem 0.875rem;
        font-size: 0.8125rem;
    }
    
    .search-icon {
        width: 18px;
        height: 18px;
        right: 1.5rem;
    }
    
    .chapter-filters {
        padding: 0 1rem 0.75rem;
    }
    
    .filter-label {
        font-size: 0.8125rem;
    }
    
    .chapter-sort-select {
        padding: 0.5rem;
        font-size: 0.8125rem;
    }
    
    .chapters-list-container {
        padding: 0 1rem;
    }
    
    .chapter-item {
        margin-bottom: 0.625rem;
    }
    
    .chapter-link {
        padding: 0.875rem;
    }
    
    .chapter-item-number {
        font-size: 0.6875rem;
    }
    
    .current-badge {
        font-size: 0.5625rem;
        padding: 0.1875rem 0.375rem;
    }
    
    .chapter-item-title {
        font-size: 0.875rem;
        margin-bottom: 0.375rem;
    }
    
    .chapter-item-date {
        font-size: 0.6875rem;
    }
    
    .chapters-count {
        padding: 0.875rem 1rem;
        font-size: 0.8125rem;
    }
}

/* Mobile extra pequeno */
@media (max-width: 360px) {
    /* Navegação Superior - Mínimo */
    .chapter-navigation-header {
        padding: 0.25rem 0;
    }
    
    .chapter-category {
        font-size: 0.5rem;
    }
    
    .chapter-number {
        font-size: 0.5625rem;
    }
    
    .toggle-sidebar-btn {
        width: 32px;
        height: 32px;
        padding: 0.375rem;
    }
    
    .toggle-sidebar-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .chapter-title {
        font-size: 1.25rem;
    }
    
    .chapter-content-inner {
        padding: 1rem 0.75rem;
    }
    
    .chapter-text {
        font-size: 0.875rem;
    }
    
    .nav-chapter-link {
        padding: 0.875rem;
    }
    
    .nav-title {
        font-size: 0.8125rem;
    }
}

/* === Animações === */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.chapter-item {
    animation: fadeIn 0.3s ease;
}

/* === Estados de carregamento === */
.loading .chapters-list {
    opacity: 0.5;
    pointer-events: none;
}

/* === Seção de Conteúdo da Página Inicial === */
.home-content-section {
    margin-top: 6rem;
    padding: 5rem 0;
    background-color: var(--ihapari-bg-alt);
    border-top: 3px solid var(--ihapari-primary);
    position: relative;
}

.home-content-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        to right,
        transparent,
        var(--ihapari-secondary),
        var(--ihapari-accent),
        transparent
    );
}

.home-content-wrapper {
    width: 100%;
}

/* Conteúdo da home construído com Elementor */
.home-content-section .elementor {
    background-color: transparent;
}

.home-content-section .elementor-section {
    margin-top: 0;
}

/* Conteúdo da home sem Elementor */
.home-page-content {
    padding: 2rem;
    background-color: var(--ihapari-bg);
    border-radius: 1rem;
    box-shadow: 0 4px 12px var(--ihapari-shadow);
}

.home-featured-image {
    margin-bottom: 2rem;
    border-radius: 0.75rem;
    overflow: hidden;
}

.home-featured-image img {
    width: 100%;
    height: auto;
    display: block;
}

.home-content {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--ihapari-text);
}

.home-content h1,
.home-content h2,
.home-content h3 {
    color: var(--ihapari-primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.home-content h1 {
    font-size: 2rem;
}

.home-content h2 {
    font-size: 1.5rem;
}

.home-content h3 {
    font-size: 1.25rem;
}

.home-content p {
    margin-bottom: 1.25rem;
}

.home-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 1.5rem 0;
}

.home-content ul,
.home-content ol {
    margin-left: 2rem;
    margin-bottom: 1.25rem;
}

.home-content a {
    color: var(--ihapari-secondary);
    text-decoration: underline;
    transition: var(--ihapari-transition);
}

.home-content a:hover {
    color: var(--ihapari-accent);
}

/* Responsividade da seção home */
@media (max-width: 768px) {
    .home-content-section {
        margin-top: 4rem;
        padding: 3.5rem 0;
    }
    
    .home-page-content {
        padding: 1.5rem;
        border-radius: 0.75rem;
    }
    
    .home-content h1 {
        font-size: 1.75rem;
    }
    
    .home-content h2 {
        font-size: 1.375rem;
    }
    
    .home-content h3 {
        font-size: 1.125rem;
    }
}

@media (max-width: 480px) {
    .home-content-section {
        margin-top: 3rem;
        padding: 2.5rem 0;
    }
    
    .home-page-content {
        padding: 1rem;
        border-radius: 0.5rem;
    }
    
    .home-content h1 {
        font-size: 1.5rem;
    }
    
    .home-content h2 {
        font-size: 1.25rem;
    }
    
    .home-content h3 {
        font-size: 1.125rem;
    }
    
    .home-content {
        font-size: 0.9375rem;
    }
}

