/* ========================================
   BLOG REFACTOR - CSS PROFISSIONAL
   ========================================
   
   Refatoração completa das seções:
   1. Posts Recentes (Grid Responsivo)
   2. Sidebar Links Importantes (Lista Editorial)
   
   SEM !important, SEM estilos inline, SEM JavaScript
   Apenas CSS puro, semântico e responsivo
   
   ======================================== */

/* ========================================
   VARIÁVEIS CSS
   ======================================== */
:root {
    --preto: #000000;
    --branco: #ffffff;
    --cinza: #666666;
    --cinza-claro: #e0e0e0;
    --cinza-medio: #d0d0d0;
    --papel: #f5f5f5;
    --destaque: #cc0000;
    --transicao-suave: all 0.3s ease;
    --transicao-rapida: all 0.2s ease;
    --sombra-leve: 0 2px 8px rgba(0, 0, 0, 0.05);
    --sombra-media: 0 4px 12px rgba(0, 0, 0, 0.1);
    --sombra-forte: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* ========================================
   1. POSTS RECENTES - SEÇÃO
   ======================================== */

.recent-posts-section {
    width: 100%;
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 24px;
    box-sizing: border-box;
}

/* Título da seção */
.recent-posts-title {
    font-size: 1.8em;
    font-weight: 700;
    margin: 0 0 30px 0;
    color: var(--preto);
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1.2;
}

/* ========================================
   GRID RESPONSIVO
   
   DESKTOP (>= 1024px): 2x2 (2 colunas)
   TABLET (768-1023px): 2 colunas
   MOBILE (< 768px): 1 coluna
   ======================================== */

.recent-posts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
}

/* ========================================
   CARD DE POST RECENTE
   
   Layout horizontal:
   [IMAGEM] [BADGE + TÍTULO + LINK]
   ======================================== */

.recent-post-card {
    background: var(--branco);
    border: 1px solid var(--cinza-medio);
    transition: var(--transicao-suave);
    height: 100%; /* Todos os cards com mesma altura */
    display: flex;
    box-sizing: border-box;
    overflow: hidden;
}

/* Hover: elevar card */
.recent-post-card:hover {
    box-shadow: var(--sombra-media);
    transform: translateY(-2px);
    border-color: var(--preto);
}

/* Link do card (ocupa 100% do espaço) */
.recent-post-link {
    display: flex;
    flex-direction: row; /* Horizontal */
    gap: 12px;
    padding: 12px;
    text-decoration: none;
    color: inherit;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

/* ========================================
   IMAGEM DO POST
   ======================================== */

.recent-post-image {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    min-width: 120px;
    min-height: 120px;
    overflow: hidden;
    background: var(--papel);
    border: 1px solid var(--cinza-claro);
    box-sizing: border-box;
    position: relative;
}

.recent-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Mantém aspect ratio, corta se necessário */
    object-position: center;
    filter: grayscale(100%);
    transition: filter 0.3s ease, transform 0.3s ease;
    display: block;
}

/* Hover: colorir e ampliar imagem */
.recent-post-card:hover .recent-post-image img {
    filter: grayscale(0%);
    transform: scale(1.05);
}

/* Placeholder para imagens ausentes */
.recent-post-image:empty::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        linear-gradient(135deg, 
            var(--cinza-claro) 25%, 
            var(--papel) 25%, 
            var(--papel) 50%, 
            var(--cinza-claro) 50%, 
            var(--cinza-claro) 75%, 
            var(--papel) 75%, 
            var(--papel)
        );
    background-size: 20px 20px;
    opacity: 0.5;
}

/* ========================================
   CONTEÚDO DO CARD
   ======================================== */

.recent-post-content {
    flex: 1;
    min-width: 0; /* Permite truncamento de texto */
    display: flex;
    flex-direction: column;
    gap: 6px;
    justify-content: center;
    box-sizing: border-box;
}

/* Badge de categoria */
.recent-post-badge {
    display: inline-block;
    align-self: flex-start;
    background: #1a1a1a;
    color: var(--branco);
    padding: 4px 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-radius: 3px;
    line-height: 1;
}

/* Título do post */
.recent-post-title {
    font-size: 1em;
    font-weight: 600;
    color: var(--preto);
    line-height: 1.3;
    margin: 0;
    
    /* Truncar em 2 linhas */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Link "Ver matéria" */
.recent-post-readmore {
    font-size: 0.9em;
    color: var(--cinza);
    font-style: italic;
    transition: color 0.3s ease;
}

.recent-post-card:hover .recent-post-readmore {
    color: var(--destaque);
    text-decoration: underline;
}

/* ========================================
   RESPONSIVIDADE - POSTS RECENTES
   ======================================== */

/* Tablet: 2 colunas */
@media (min-width: 768px) and (max-width: 1023px) {
    .recent-posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .recent-post-image {
        width: 100px;
        height: 100px;
        min-width: 100px;
        min-height: 100px;
    }
    
    .recent-post-title {
        font-size: 0.95em;
    }
    
    .recent-post-badge {
        font-size: 9px;
        padding: 3px 8px;
    }
}

/* Mobile: 1 coluna */
@media (max-width: 767px) {
    .recent-posts-section {
        padding: 0 16px;
        margin: 30px auto;
    }
    
    .recent-posts-title {
        font-size: 1.5em;
        margin-bottom: 20px;
    }
    
    .recent-posts-grid {
        grid-template-columns: 1fr; /* 1 coluna */
        gap: 16px;
    }
    
    .recent-post-image {
        width: 100px;
        height: 100px;
        min-width: 100px;
        min-height: 100px;
    }
    
    .recent-post-title {
        font-size: 0.95em;
    }
    
    .recent-post-badge {
        font-size: 9px;
        padding: 3px 8px;
    }
    
    .recent-post-readmore {
        font-size: 0.85em;
    }
}

/* ========================================
   2. SIDEBAR LINKS IMPORTANTES
   
   Design editorial limpo e minimalista
   SEM caixas pretas, SEM botões, SEM cards
   APENAS lista simples com bullets
   ======================================== */

.sidebar-links {
    background: var(--branco);
    padding: 20px;
    border-left: 3px solid var(--preto);
    margin-bottom: 30px;
    box-sizing: border-box;
}

/* Título da sidebar */
.sidebar-title {
    font-size: 1.2em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--preto);
    margin: 0 0 20px 0;
    line-height: 1.4;
}

/* Lista de links */
.sidebar-list {
    list-style: disc;
    list-style-position: outside;
    padding-left: 20px;
    margin: 0;
}

.sidebar-list li {
    margin-bottom: 12px;
    line-height: 1.5;
}

.sidebar-list li:last-child {
    margin-bottom: 0;
}

/* Links */
.sidebar-list a {
    color: var(--preto);
    text-decoration: none;
    font-size: 1em;
    transition: color 0.3s ease;
    line-height: 1.5;
}

.sidebar-list a:hover {
    color: var(--destaque);
    text-decoration: underline;
}

/* ========================================
   RESPONSIVIDADE - SIDEBAR
   ======================================== */

@media (max-width: 768px) {
    .sidebar-links {
        padding: 15px;
        margin-bottom: 20px;
        border-left-width: 2px;
    }
    
    .sidebar-title {
        font-size: 1em;
        margin-bottom: 15px;
    }
    
    .sidebar-list {
        padding-left: 18px;
    }
    
    .sidebar-list li {
        margin-bottom: 10px;
    }
    
    .sidebar-list a {
        font-size: 0.95em;
    }
}

/* ========================================
   3. SKELETON LOADING (OPCIONAL)
   
   Animação de carregamento antes do conteúdo
   ======================================== */

.recent-posts-skeleton {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.skeleton-post-card {
    height: 144px;
    background: var(--papel);
    border: 1px solid var(--cinza-claro);
    padding: 12px;
    display: flex;
    gap: 12px;
    box-sizing: border-box;
}

.skeleton-image {
    width: 120px;
    height: 120px;
    min-width: 120px;
    background: linear-gradient(90deg, var(--cinza-claro) 25%, var(--papel) 50%, var(--cinza-claro) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

.skeleton-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
}

.skeleton-title {
    height: 16px;
    width: 100%;
    background: linear-gradient(90deg, var(--cinza-claro) 25%, var(--papel) 50%, var(--cinza-claro) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

.skeleton-link {
    height: 12px;
    width: 80px;
    background: linear-gradient(90deg, var(--cinza-claro) 25%, var(--papel) 50%, var(--cinza-claro) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Classe utilitária */
.hidden {
    display: none;
}

/* Responsividade do skeleton */
@media (max-width: 767px) {
    .recent-posts-skeleton {
        grid-template-columns: 1fr;
    }
    
    .skeleton-image {
        width: 100px;
        height: 100px;
        min-width: 100px;
    }
}

/* ========================================
   4. ESTADOS VAZIOS E ERROS
   ======================================== */

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--cinza);
    font-style: italic;
}

.error-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--destaque);
}

.no-content {
    text-align: center;
    padding: 30px 20px;
    color: var(--cinza);
    font-style: italic;
}

/* ========================================
   5. COMPATIBILIDADE COM LAYOUT EXISTENTE
   
   Garante que o grid da página funcione corretamente
   ======================================== */

/* Grid principal da homepage (featured posts + sidebar) */
.tema,
.tema1 {
    display: grid;
    grid-template-columns: 2.5fr 1fr;
    gap: 32px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px;
    box-sizing: border-box;
}

/* Permitir que o grid controle a largura dos elementos */
.conteudoTemaY {
    /* width removido - deixar o grid controlar */
    box-sizing: border-box;
}

.linksConteudoTemaX,
.linksConteudoTema1 {
    box-sizing: border-box;
}

/* Responsividade do grid principal */
@media (max-width: 768px) {
    .tema,
    .tema1 {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 24px 16px;
    }
    
    /* Esconder sidebar em mobile */
    .linksConteudoTemaX,
    .linksConteudoTema1,
    #featured-sidebar {
        display: none;
    }
    
    .conteudoTemaY {
        width: 100%;
        max-width: 100%;
    }
}

/* ========================================
   6. SEPARADORES (HR)
   ======================================== */

hr {
    border: none;
    border-top: 1px solid var(--cinza-claro);
    margin: 0;
}

@media (max-width: 768px) {
    hr {
        margin: 0;
    }
}

/* ========================================
   FIM DO ARQUIVO
   ======================================== */

