/* Estilos para o Blog */

/* Estilos para o grid de blog na página principal */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    margin-top: 20px;
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 15px;
}

/* Card de blog na página principal */
.blog-card {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
    color: #333;
    max-width: 100%;
}

.blog-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* Estilos para imagens nos cards */
.blog-card .blog-card-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: transparent; /* Alterado para eliminar o fundo branco */
    padding: 0;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}

/* Container adicional para centralizar a imagem */
.blog-card .blog-image-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0; /* Removido o padding para eliminar espaço ao redor da imagem */
    box-sizing: border-box;
}

/* Link que contém a imagem */
.blog-card .image-link {
    display: flex;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.blog-card .blog-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Mudado para cover para preencher todo o espaço */
    object-position: center;
    transition: transform 0.3s ease;
    display: block;
    margin: 0;
    border: none;
    background-color: transparent;
}

.blog-card:hover .blog-card-image img {
    transform: scale(1.03); /* Reduzi o efeito de escala no hover para evitar cortes */
}

/* Conteúdo do card */
.blog-card .blog-card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    background-color: #fff;
    color: #333;
}

.blog-card .blog-card-title {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.4rem;
    font-weight: 600;
    color: #243746;
}

.blog-card .blog-card-title a {
    color: #243746;
    text-decoration: none;
}

.blog-card .blog-card-date {
    font-size: 0.9rem;
    color: #67828f;
    margin-bottom: 12px;
    display: block;
}

.blog-card .blog-card-excerpt p {
    margin-bottom: 20px;
    color: #555;
    line-height: 1.6;
    flex-grow: 1;
}

/* Botão "Ler mais" */
.blog-card .blog-card-read-more,
.blog-card .blog-link {
    display: inline-block;
    background-color: #4c8b7f;
    color: #fff;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 10px 20px;
    border-radius: 5px;
    transition: background-color 0.3s ease;
    margin-top: auto;
    text-align: center;
    font-weight: 500;
    align-self: flex-start;
}

.blog-card .blog-card-read-more:hover,
.blog-card .blog-link:hover {
    background-color: #3a6b61;
}

/* Estado vazio */
.blog-grid .no-posts {
    text-align: center;
    padding: 40px;
    color: #909090;
    font-style: italic;
    grid-column: 1 / -1;
}

/* Estilos para página individual de artigo */
.blog-full-article img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 20px auto;
    border-radius: 5px;
}

/* Regras adicionais para controle de imagens */
.blog-card a,
.blog-card a img,
.blog-article img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Tratar imagens que ultrapassariam os limites */
.blog-card .blog-card-image a {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Responsividade */
@media (max-width: 768px) {
    .blog-grid {
        grid-template-columns: 1fr;
        padding: 0 15px;
    }
    
    .blog-card {
        flex-direction: column;
        margin-bottom: 30px;
    }
    
    .blog-card .blog-card-image {
        height: 180px;
    }
    
    .blog-card .blog-card-content {
        padding: 15px;
    }
    
    .blog-card .blog-card-title {
        font-size: 1.25rem;
    }
    
    .blog-card .blog-card-read-more,
    .blog-card .blog-link {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .blog-card .blog-card-image {
        height: 160px;
    }
    
    .blog-card .blog-card-excerpt p {
        margin-bottom: 15px;
    }
}

/* Estilos para a modal do blog */
.blog-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s;
    backdrop-filter: blur(3px);
    padding: 20px;
    box-sizing: border-box;
}

.blog-modal-content {
    background-color: #222;
    margin: 30px auto;
    padding: 30px;
    width: 90%;
    max-width: 900px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: slideIn 0.4s;
    max-height: 90vh;
    overflow-y: auto;
    color: #f0f0f0;
}

.blog-modal-header {
    margin-bottom: 20px;
    border-bottom: 1px solid #444;
    padding-bottom: 15px;
}

.blog-modal-title {
    margin-top: 0;
    color: #fff;
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.blog-modal-date {
    color: #a0a0a0;
    font-size: 0.9rem;
    margin-bottom: 0;
}

.blog-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
}

.blog-modal-close:hover {
    color: #fff;
}

.blog-modal-body {
    color: #333;
    line-height: 1.7;
    font-size: 1.05rem;
    padding: 0 10px;
}

/* Estilos para artigos estruturados */
.blog-modal-body h1,
.blog-modal-body h2,
.blog-modal-body h3,
.blog-modal-body h4,
.blog-modal-body h5,
.blog-modal-body h6 {
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    color: #243746;
    font-weight: 600;
    line-height: 1.3;
}

.blog-modal-body h1 {
    font-size: 1.8rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.3em;
}

.blog-modal-body h2 {
    font-size: 1.6rem;
}

.blog-modal-body h3 {
    font-size: 1.4rem;
}

.blog-modal-body p {
    margin-bottom: 1em;
}

.blog-modal-body ul,
.blog-modal-body ol {
    margin-bottom: 1em;
    margin-left: 2em;
}

.blog-modal-body li {
    margin-bottom: 0.5em;
}

.blog-modal-body ul li {
    list-style: disc;
}

.blog-modal-body ol li {
    list-style: decimal;
}

.blog-modal-body strong {
    font-weight: 600;
}

.blog-modal-body em {
    font-style: italic;
}

.blog-modal-body blockquote {
    border-left: 4px solid #4c8b7f;
    padding: 0.5em 1em;
    background-color: #f8f9fa;
    margin: 1em 0;
    font-style: italic;
}

.blog-modal-body code {
    font-family: monospace;
    background-color: #f1f1f1;
    padding: 2px 4px;
    border-radius: 3px;
}

.blog-modal-body pre {
    background-color: #f6f8fa;
    border-radius: 5px;
    padding: 1em;
    overflow-x: auto;
    margin: 1em 0;
}

.blog-modal-body img {
    max-width: 100%;
    height: auto;
    margin: 1em 0;
    border-radius: 5px;
}

.blog-modal-body a {
    color: #4c8b7f;
    text-decoration: none;
}

.blog-modal-body a:hover {
    text-decoration: underline;
}

/* Estilo especial para artigo com fundo escuro, como no exemplo */
.blog-modal-body.dark-theme {
    background-color: #222;
    color: #f0f0f0;
    padding: 20px;
    border-radius: 5px;
}

.blog-modal-body.dark-theme h1,
.blog-modal-body.dark-theme h2,
.blog-modal-body.dark-theme h3,
.blog-modal-body.dark-theme h4 {
    color: #fff;
}

.blog-modal-body.dark-theme ul li {
    margin-bottom: 10px;
}

.blog-modal-body.dark-theme a {
    color: #7cc3b5;
}

.blog-modal-image {
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    max-height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.blog-modal-image img {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
}

@keyframes fadeIn {
    from {opacity: 0}
    to {opacity: 1}
}

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

/* Estilos para modal em dispositivos móveis */
@media (max-width: 768px) {
    .blog-modal-content {
        width: 95%;
        padding: 20px;
        margin: 20px auto;
    }
    
    .blog-modal-image {
        max-height: 300px;
    }
    
    .blog-modal-title {
        font-size: 1.5rem;
    }
    
    .blog-modal-body {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .blog-modal-content {
        padding: 15px;
        margin: 15px auto;
    }
    
    .blog-modal-image {
        max-height: 200px;
    }
}
