.eim-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 999999;
    margin: 0;
    padding: 0;
    border: none;
    box-sizing: border-box;
    /* Permitir scroll mas escurecer o fundo */
    overflow-y: auto;
}

.eim-modal {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: eim-scaleIn 0.3s ease-out;
    z-index: 1000000;
    /* Reset de possíveis heranças */
    float: none !important;
    clear: both !important;
    display: block !important;
    margin: 0 !important;
    /* Garantir que o modal não cause scroll */
    max-height: 90vh;
    overflow: hidden;
}

.eim-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
    z-index: 1;
}

.eim-close:hover {
    background: #f5f5f5;
}

.eim-header {
    padding: 25px 25px 15px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
}

.eim-title {
    margin: 0;
    color: #333;
    font-size: 1.4em;
    font-weight: 700; /* Negrito */
}

.eim-title:after {
    content:"";
    display:block;
    width:65px;
    height:3px;
    background:var(--td_theme_color);
    margin:10px auto 0;
}

.eim-content {
    padding: 25px;
    /* Garantir que o conteúdo não cause scroll no modal */
    max-height: calc(90vh - 160px);
    overflow: hidden;
}

.eim-posts {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
}

.eim-post {
    flex: 1;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease; /* Transição para borda também */
    display: flex;
    flex-direction: column;
    position: relative; /* Para o link cobrir toda a área */
}

/* Borda colorida no hover - mesma cor do underline */
.eim-post:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-color: #2271b1; /* Cor do underline */
}

.eim-post-thumbnail {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
}

.eim-post-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    position: relative;
    /* Z-index menor para o conteúdo ficar ATRÁS do link */
    z-index: 1;
}

.eim-post-category {
    display: inline-block;
    background: #000000; /* Preto */
    color: white;
    padding:0px 10px;
    border-radius:12px;
    font-size: 0.7em; /* Menor */
    text-transform:uppercase;
    font-weight: 600;
    margin-bottom: 8px;
    align-self: flex-start;
    /* Garantir que a categoria fique clicável */
    position: relative;
    z-index: 2;
}

.eim-post-title {
    margin: 0;
    font-size: 1em;
    line-height: 1.4;
    flex-grow: 1;
    /* Garantir que o título fique clicável */
    position: relative;
    z-index: 2;
}

.eim-post-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s;
    position: relative; /* Para o underline */
    font-weight: 600; /* Negrito */
}

.eim-post-title a:hover {
    color: #2271b1;
}

/* Efeito underline no hover */
.eim-post:hover .eim-post-title a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #2271b1;
    animation: underlineSlide 0.3s ease-out;
}

/* Link cobrindo TODO o card - incluindo área da categoria */
.eim-post-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2; /* Acima do conteúdo mas abaixo da categoria/título */
    text-decoration: none;
    cursor: pointer;
    /* Garantir que o link seja clicável em toda área */
    background: transparent;
}

.eim-footer {
    padding: 15px 25px 25px;
    text-align: center;
    border-top: 1px solid #f0f0f0;
}

.eim-button {
    display: inline-block;
    padding: 12px 30px;
    background: #2271b1;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.3s;
    font-weight: 600;
}

.eim-button:hover {
    background: #135e96;
    color: white;
}

/* RESPONSIVO - MOBILE - AGORA A 601px */
@media (max-width: 601px) {
    .eim-modal {
        width: 95%;
        margin: 20px !important;
        max-height: 85vh;
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        margin: 20px auto !important;
    }
    
    .eim-content {
        padding: 20px;
        max-height: calc(85vh - 160px);
        overflow-y: auto;
    }
    
    .eim-title {
        font-size: 1.2em;
    }
    
    .eim-posts {
        flex-direction: column;
        gap: 15px;
    }
    
    .eim-post {
        flex-direction: row;
        align-items: center;
        min-height: 80px;
    }
    
    .eim-post-thumbnail {
        width: 80px;
        height: 80px;
        flex-shrink: 0;
    }
    
    .eim-post-content {
        padding: 12px;
        flex-grow: 1;
        min-height: 80px;
        justify-content: center;
        z-index: 1; /* Manter atrás do link em mobile também */
    }
    
    .eim-post-category {
        font-size: 0.65em;
        margin-bottom: 5px;
        z-index: 2; /* Acima do link */
    }
    
    .eim-post-title {
        font-size: 0.9em;
        line-height: 1.3;
        z-index: 2; /* Acima do link */
    }
    
    .eim-header,
    .eim-footer {
        padding: 20px;
    }
    
    /* Ajuste do link em mobile para cobrir card horizontal */
    .eim-post-link {
        z-index: 2; /* Acima do conteúdo em mobile */
    }
}

/* Animações */
@keyframes eim-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes eim-scaleIn {
    from { 
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to { 
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes underlineSlide {
    from { 
        width: 0;
        left: 50%;
    }
    to { 
        width: 100%;
        left: 0;
    }
}

/* Manter a barra de scroll visível mas desabilitar scroll do body */
body.eim-modal-open {
    overflow: hidden;
    position: relative;
    height: 100%;
}

/* Garantir que o overlay permita scroll se necessário */
.eim-overlay {
    overflow-y: auto;
}

/* Garantir que o modal apareça instantaneamente */
.eim-overlay {
    display: none;
}

/* Remover qualquer transição que possa causar delay */
.eim-modal {
    animation: none;
}

/* Se quiser manter a animação mas mais rápida */
.eim-scaleIn {
    animation: eim-scaleIn 0.1s ease-out;
}

/* Otimização para mobile - garantir que não haja delays de touch */
@media (max-width: 601px) {
    .eim-modal {
        animation: none;
    }
}