/**
 * Blog Automático - Estilos do Front-end para Artigos do Blog
 * Proporciona layout moderno, Sumário (TOC), Caixas de Destaque (Callouts), FAQ e Conclusão.
 */

/* Rolagem suave para navegação no sumário */
html {
    scroll-behavior: smooth;
}

/* Espaçamento para âncoras (evita cabeçalho fixo sobrepor o título) */
.ba-section-heading,
#conclusao,
#perguntas-frequentes {
    scroll-margin-top: 80px;
}

/* ==========================================================================
   1. SUMÁRIO INTERATIVO AUTOMÁTICO (TABLE OF CONTENTS - TOC)
   ========================================================================== */
.ba-toc-wrapper {
    margin: 32px 0 40px 0;
    clear: both;
}

.ba-toc-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ba-toc-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.ba-toc-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 22px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    user-select: none;
    list-style: none;
    outline: none;
}

.ba-toc-summary::-webkit-details-marker {
    display: none;
}

.ba-toc-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
}

.ba-toc-title svg {
    color: #2563eb;
    flex-shrink: 0;
}

.ba-toc-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #475569;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.ba-toc-card[open] .ba-toc-toggle-icon {
    transform: rotate(180deg);
}

.ba-toc-card:not([open]) .ba-toc-summary {
    border-bottom: none;
}

.ba-toc-nav {
    padding: 18px 24px;
    background: #ffffff;
}

.ba-toc-list {
    margin: 0 !important;
    padding: 0 0 0 20px !important;
    list-style-type: decimal !important;
}

.ba-toc-list li {
    margin-bottom: 10px !important;
    font-size: 0.96rem;
    line-height: 1.5;
    color: #64748b;
}

.ba-toc-list li:last-child {
    margin-bottom: 0 !important;
}

.ba-toc-list li a {
    color: #2563eb !important;
    text-decoration: none !important;
    font-weight: 500;
    transition: color 0.15s ease, text-decoration 0.15s ease;
}

.ba-toc-list li a:hover {
    color: #1d4ed8 !important;
    text-decoration: underline !important;
}

/* ==========================================================================
   2. CAIXAS DE DESTAQUE / DICAS (CALLOUT BOXES)
   ========================================================================== */
.ba-callout {
    margin: 28px 0;
    padding: 20px 24px;
    border-radius: 12px;
    border: 1px solid;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    clear: both;
}

.ba-callout-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.ba-callout-icon {
    font-size: 1.25rem;
    line-height: 1;
    flex-shrink: 0;
}

.ba-callout-title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.ba-callout-body p {
    margin: 0 0 8px 0 !important;
    font-size: 0.98rem !important;
    line-height: 1.65 !important;
}

.ba-callout-body p:last-child {
    margin-bottom: 0 !important;
}

/* Dica de Especialista (Verde Esmeralda) */
.ba-callout-tip {
    background: #f0fdf4;
    border-color: #bbf7d0;
    border-left: 5px solid #10b981;
}

.ba-callout-tip .ba-callout-title {
    color: #15803d;
}

.ba-callout-tip .ba-callout-body {
    color: #166534;
}

/* Ponto de Atenção / Pegadinha (Âmbar / Laranja) */
.ba-callout-warning {
    background: #fffbeb;
    border-color: #fde68a;
    border-left: 5px solid #f59e0b;
}

.ba-callout-warning .ba-callout-title {
    color: #b45309;
}

.ba-callout-warning .ba-callout-body {
    color: #92400e;
}

/* Conceito Fundamental / Info (Azul) */
.ba-callout-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    border-left: 5px solid #3b82f6;
}

.ba-callout-info .ba-callout-title {
    color: #1d4ed8;
}

.ba-callout-info .ba-callout-body {
    color: #1e40af;
}

/* ==========================================================================
   3. CONCLUSÃO DESTACADA
   ========================================================================== */
.ba-conclusion,
.ba-conclusion-box {
    margin: 42px 0 35px 0;
    padding: 28px 32px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-left: 5px solid #059669;
    border-radius: 0 16px 16px 0;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.03);
    clear: both;
}

.ba-conclusion h2,
.ba-conclusion-box h2 {
    margin-top: 0 !important;
    margin-bottom: 14px !important;
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    letter-spacing: -0.01em;
}

.ba-conclusion p,
.ba-conclusion-box p {
    color: #334155 !important;
    font-size: 1.05rem !important;
    line-height: 1.75 !important;
    margin-bottom: 12px !important;
}

.ba-conclusion p:last-child,
.ba-conclusion-box p:last-child {
    margin-bottom: 0 !important;
}

/* ==========================================================================
   4. PERGUNTAS FREQUENTES (FAQ ACCORDION)
   ========================================================================== */
.ba-faq,
.ba-faq-wrapper {
    margin: 45px 0 35px 0;
    padding: 30px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
    clear: both;
}

.ba-faq h2,
.ba-faq-header h2,
.ba-faq-heading {
    margin-top: 0 !important;
    margin-bottom: 8px !important;
    font-size: 1.6rem !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    letter-spacing: -0.02em;
}

.ba-faq-subtitle,
.ba-faq-lead {
    margin: 0 0 22px 0 !important;
    font-size: 0.98rem !important;
    color: #64748b !important;
    line-height: 1.5 !important;
}

.ba-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 50px;
    background: #e2e8f0;
    color: #334155;
    margin-bottom: 12px;
}

.ba-faq-badge {
    background: #e0f2fe;
    color: #0369a1;
}

/* Cards de FAQ */
.ba-faq-item,
.ba-faq-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 14px;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.ba-faq-item:last-child,
.ba-faq-card:last-child {
    margin-bottom: 0;
}

.ba-faq-item:hover,
.ba-faq-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

/* FAQ Clássico (div.ba-faq-item) */
.ba-faq-item {
    padding: 20px 24px;
}

.ba-faq-item h3 {
    margin: 0 0 10px 0 !important;
    font-size: 1.15rem !important;
    font-weight: 600 !important;
    color: #1e293b !important;
    line-height: 1.4 !important;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.ba-faq-item h3::before {
    content: "❓";
    font-size: 1rem;
    flex-shrink: 0;
}

.ba-faq-item p {
    margin: 0 !important;
    font-size: 0.98rem !important;
    color: #475569 !important;
    line-height: 1.65 !important;
}

/* FAQ Moderno (<details> e <summary>) */
.ba-faq-card summary,
.ba-faq-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 22px;
    cursor: pointer;
    user-select: none;
    background: #ffffff;
    list-style: none;
    outline: none;
    transition: background-color 0.2s ease;
}

.ba-faq-card summary::-webkit-details-marker,
.ba-faq-summary::-webkit-details-marker {
    display: none;
}

.ba-faq-card[open] summary,
.ba-faq-card[open] .ba-faq-summary {
    border-bottom: 1px solid #f1f5f9;
    background: #fafafa;
}

.ba-faq-q-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: #f1f5f9;
    color: #475569;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.ba-faq-question-title {
    margin: 0 !important;
    font-size: 1.08rem !important;
    font-weight: 600 !important;
    color: #0f172a !important;
    flex-grow: 1;
    line-height: 1.4 !important;
}

.ba-faq-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f8fafc;
    color: #64748b;
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s ease;
}

.ba-faq-card[open] .ba-faq-chevron {
    transform: rotate(180deg);
    background: #e2e8f0;
    color: #0f172a;
}

.ba-faq-answer {
    padding: 18px 22px;
    background: #ffffff;
    font-size: 0.98rem;
    color: #475569;
    line-height: 1.7;
    animation: baFaqFadeIn 0.25s ease-out;
}

.ba-faq-answer p:first-child {
    margin-top: 0 !important;
}

.ba-faq-answer p:last-child {
    margin-bottom: 0 !important;
}

@keyframes baFaqFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   5. IMAGENS INTERNAS E RESPONSIVIDADE
   ========================================================================== */
.ba-internal-image {
    margin: 32px 0;
    text-align: center;
}

.ba-internal-image img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

@media (max-width: 768px) {
    .ba-faq,
    .ba-faq-wrapper,
    .ba-conclusion,
    .ba-conclusion-box,
    .ba-toc-card,
    .ba-callout {
        padding: 18px 16px;
        margin: 26px 0;
    }

    .ba-faq-card summary,
    .ba-faq-summary,
    .ba-faq-answer,
    .ba-faq-item {
        padding: 14px 16px;
    }

    .ba-faq-question-title {
        font-size: 1rem !important;
    }
}
