/* ==========================================================================
   1. CORREÇÕES GLOBAIS E ESTRUTURA (STICKY FIX)
   ========================================================================== */
html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: clip !important; /* Permite que o position: sticky funcione */
    position: relative;
}

.fade-in-up.visible {
    opacity: 1;
    transform: none !important; /* Remove conflito do transform 3D com o sticky */
}

/* Sidebar fixada com scroll */
.sidebar-sticky {
    position: -webkit-sticky;
    position: sticky;
    top: 110px;
    z-index: 10;
    height: fit-content;
}

/* ==========================================================================
   2. CABEÇALHO DO ARTIGO E METADADOS
   ========================================================================== */
.article-page { margin-top: 120px; }

.breadcrumb-item a { color: #94a3b8; font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.breadcrumb-item a:hover { color: var(--color-primary); }
.breadcrumb-item.active { color: #cbd5e1; font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.breadcrumb-item+.breadcrumb-item::before { color: #64748b; }

.post-title { font-size: clamp(2rem, 4vw, 3.2rem); font-weight: 800; color: #f8fafc; line-height: 1.15; letter-spacing: -1px; margin-bottom: 1rem; }
.post-subtitle { font-size: 1.25rem; font-weight: 400; color: #94a3b8; line-height: 1.6; margin-bottom: 2rem; }

.author-box { display: flex; align-items: center; gap: 15px; }
.author-img { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(59, 130, 246, 0.5); }
.author-info h6 { margin: 0; color: #f8fafc; font-weight: 700; font-size: 1rem; }
.author-info span { color: #64748b; font-size: 0.85rem; display: block; }

.post-meta { display: flex; align-items: center; gap: 20px; color: #94a3b8; font-size: 0.85rem; font-weight: 500; }

/* Botões de Compartilhamento */
.share-buttons { display: flex; gap: 10px; }
.btn-share { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.05); color: #e2e8f0; border: 1px solid var(--glass-border); transition: 0.3s; font-size: 1.1rem; }
.btn-share:hover { transform: translateY(-3px); }
.btn-share.linkedin:hover { background: #0a66c2; color: #fff; border-color: #0a66c2; }
.btn-share.twitter:hover { background: #1da1f2; color: #fff; border-color: #1da1f2; }
.btn-share.whatsapp:hover { background: #25d366; color: #fff; border-color: #25d366; }
.btn-share.copy:hover { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

.post-hero-img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 16px; margin-bottom: 10px; }
.post-img-caption { font-size: 0.8rem; color: #64748b; text-align: center; margin-bottom: 2rem; font-style: italic; }

/* Sidebar Tags e Itens */
.tag-pill { background: rgba(255,255,255,0.05); color: #cbd5e1; border: 1px solid rgba(255,255,255,0.1); padding: 6px 15px; border-radius: 50px; font-size: 0.85rem; font-weight: 600; text-decoration: none; transition: 0.3s; }
.tag-pill:hover { background: rgba(59, 130, 246, 0.15); border-color: var(--color-primary); color: #fff; }

.side-news-item { display: flex; flex-direction: column; gap: 5px; padding-bottom: 15px; margin-bottom: 15px; border-bottom: 1px dashed rgba(255,255,255,0.1); text-decoration: none; }
.side-news-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.side-news-item .tag { font-size: 0.7rem; font-weight: 800; color: var(--color-primary); text-transform: uppercase; }
.side-news-item .title { font-size: 1rem; font-weight: 700; color: #f8fafc; line-height: 1.3; transition: 0.3s; }
.side-news-item:hover .title { color: var(--color-secondary); }

/* ==========================================================================
   3. CORPO DO TEXTO (LEITURA)
   ========================================================================== */
.article-content { font-size: 1.125rem; line-height: 1.8; color: #cbd5e1; font-weight: 400; }
.article-content p { margin-bottom: 1.5rem; text-align: left !important; }
.article-content ul, .article-content ol { margin-bottom: 1.5rem; padding-left: 1.5rem; }
.article-content li { margin-bottom: 0.5rem; }

.article-content blockquote {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.08), transparent);
    border-left: 4px solid var(--color-primary);
    padding: 20px 25px;
    margin: 2.5rem 0;
    border-radius: 0 12px 12px 0;
    font-size: 1.25rem;
    font-style: italic;
    color: #f8fafc;
    font-weight: 500;
    line-height: 1.6;
}

/* ==========================================================================
   4. MATADOR DE CORES: RESET AGRESSIVO PARA O EDITOR ANTIGO
   ========================================================================== */
.article-content * { max-width: 100%; }

/* Anula TODAS as cores "hardcoded" do editor antigo e herda a cor correta */
.article-content span,
.article-content p,
.article-content div,
.article-content em,
.article-content b,
.article-content strong,
.article-content font,
.article-content [style*="color"] {
    color: inherit !important;
    background-color: transparent !important;
}

/* Força títulos a serem BRANCOS (mesmo se o editor os colocou em preto) */
.article-content h1, .article-content h1 span, .article-content h1 font,
.article-content h2, .article-content h2 span, .article-content h2 font,
.article-content h3, .article-content h3 span, .article-content h3 font,
.article-content h4, .article-content h4 span, .article-content h4 font,
.article-content h5, .article-content h5 span, .article-content h5 font {
    color: #f8fafc !important;
    font-weight: 800 !important;
    margin-top: 2.5rem !important;
    margin-bottom: 1.2rem !important;
    line-height: 1.3 !important;
    background: transparent !important;
    padding: 0 !important;
    text-align: left !important;
}
.article-content h2 { font-size: 1.8rem; letter-spacing: -0.5px; }
.article-content h3 { font-size: 1.4rem; }

/* Links estilo sublinhado elegante (Azul Premium) */
.article-content a,
.article-content a span,
.article-content a font {
    color: var(--color-primary) !important;
    text-decoration: underline !important;
    text-decoration-thickness: 1px !important;
    text-underline-offset: 3px !important;
    font-weight: 500;
    transition: all 0.3s ease;
}
.article-content a:hover,
.article-content a:hover span {
    color: var(--color-secondary) !important;
    text-decoration-color: var(--color-secondary) !important;
}

/* ==========================================================================
   5. CORREÇÃO DE CLASSES BOOTSTRAP (ALINHAMENTO DE CAIXAS)
   ========================================================================== */
/* Transforma o bg-primary e alert-info antigos em "Glass" Premium */
.article-content .alert,
.article-content .alert-info,
.article-content .bg-primary,
.article-content .bg-success {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.1), transparent) !important;
    border: none !important;
    border-left: 4px solid var(--color-primary) !important;
    color: #f8fafc !important;
    padding: 1rem 1.5rem !important;
    border-radius: 0 12px 12px 0 !important;
    margin: 0.5rem 0 !important; /* Margem minúscula para grudar as caixas (Ex: Brasil + Mercado em Expansão) */
    font-size: 1.1rem !important;
    font-weight: 500 !important;
    text-align: left !important;
}

/* O Segredo do Alinhamento: Remove os espaços inúteis das linhas antigas */
.article-content .row:has(.bg-primary),
.article-content .row:has(.alert-info),
.article-content .row:has(.bg-success),
.article-content .row:has(.alert) {
    margin: 0 !important;
    padding: 0 !important;
}

/* Remove os 15px de padding nativo do col-md-12 antigo */
.article-content .row:has(.bg-primary) > [class*="col-"],
.article-content .row:has(.alert-info) > [class*="col-"],
.article-content .row:has(.bg-success) > [class*="col-"],
.article-content .row:has(.alert) > [class*="col-"] {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Converte caixas cinzas genéricas (ex: "Saiba Mais" do fim do texto) em glass */
.article-content div[style*="background:#eeeeee"],
.article-content div[style*="background: #eeeeee"] {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #e2e8f0 !important;
    border-radius: 12px !important;
    padding: 15px !important;
    margin: 2rem 0;
}

/* Botões Antigos (Ex: Biogás no Brasil) viram Pílulas Elegantes */
.article-content .btn,
.article-content .btn-success {
    background: var(--color-primary) !important;
    border: 1px solid var(--color-primary) !important;
    color: #ffffff !important;
    border-radius: 50px !important;
    padding: 12px 30px !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    text-decoration: none !important;
    display: inline-block !important;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3) !important;
    margin-top: 1rem !important;
}
.article-content .btn:hover,
.article-content .btn-success:hover {
    background: var(--color-secondary) !important;
    border-color: var(--color-secondary) !important;
    transform: translateY(-4px) !important;
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.5) !important;
}

/* ==========================================================================
   6. MÍDIA, IMAGENS E TABELAS
   ========================================================================== */
.article-content img {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 12px !important;
    margin: 2rem auto !important;
    display: block;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.article-content iframe {
    max-width: 100% !important;
    border-radius: 12px !important;
    margin: 2rem 0 !important;
}

.article-content table {
    width: 100% !important;
    margin: 2rem 0;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    overflow: hidden;
}
.article-content th,
.article-content td {
    padding: 12px 15px !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    color: #cbd5e1 !important;
}
.article-content th {
    background: rgba(59, 130, 246, 0.1) !important;
    color: #fff !important;
    font-weight: 700 !important;
}
