/*
Theme Name: tema REDE DDD BRASIL - Widgets 3 Colunas
Version: 3.5
*/

/* ==========================================================================
   1. Variáveis de Cores e Configurações Globais
   ========================================================================== */
:root {
    --cor-fundo: #FFFDD0; /* Amarelo Suave (CORRIGIDO) */
    --cor-texto: #333333;
    --cor-titulos: #1D3557; 
    --cor-links: #0073aa;
    --cor-links-hover: #E63946; 
    --cor-borda: #EAEAEA;
    --raio-borda: 8px;
    --sombra-caixa: 0 2px 8px rgba(0, 0, 0, 0.07);
}

/* ==========================================================================
   2. Reset Básico e Estilos do Body
   ========================================================================== */
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--cor-fundo); /* FUNDO AMARELO APLICADO AQUI */
    color: var(--cor-texto);
    line-height: 1.6;
}
.container { max-width: 1200px; margin: 0 auto; padding: 0 15px; box-sizing: border-box; }
a { color: var(--cor-links); text-decoration: none; transition: color 0.2s ease-in-out; }
a:hover { color: var(--cor-links-hover); }
h1, h2, h3, h4, h5, h6 { color: var(--cor-titulos); font-weight: 700; }

/* ==========================================================================
   3. Cabeçalho, Rodapé e Banners
   ========================================================================== */
.site-header { background-color: #ffffff; padding: 20px 0; border-bottom: 1px solid var(--cor-borda); }
.site-branding a { font-size: 1.8em; font-weight: bold; color: var(--cor-titulos); }
.top-banner-widget-area, .footer-banner-widget-area { display: grid; grid-template-columns: repeat(6, 1fr); gap: 15px; padding: 25px 0; }
.widget-banner { border-radius: var(--raio-borda); overflow: hidden; }
.widget-banner img { display: block; width: 100%; height: auto; }
.site-footer { background: var(--cor-titulos); color: #f0f0f0; padding: 30px 0; margin-top: 30px; text-align: center; }

@media (max-width: 1024px) { 
    .top-banner-widget-area, .footer-banner-widget-area { grid-template-columns: repeat(4, 1fr); } 
}
@media (max-width: 767px) { 
    /* AJUSTE PARA 3 COLUNAS NO CELULAR */
    .top-banner-widget-area, .footer-banner-widget-area { grid-template-columns: repeat(3, 1fr); } 
}

/* ==========================================================================
   5. Layout da PÁGINA PRINCIPAL (Grid de Cards)
   ========================================================================== */
.main-content {
    display: grid;
    gap: 15px; 
    padding: 20px 0;
}

.post-item {
    background-color: #fff;
    border: 1px solid var(--cor-borda);
    border-radius: var(--raio-borda);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex; 
    flex-direction: column;
}

.post-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.post-link-wrapper {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.post-item .post-thumbnail {
    width: 100%;
    padding-top: 100%; 
    position: relative;
    background-color: #f5f5f5;
    flex-shrink: 0;
}

.post-item .post-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    padding: 0;
    box-sizing: border-box;
}

.post-item .post-text-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
    text-align: center;
}

.post-item .post-title {
    font-size: 1em;
    margin: 0;
    line-height: 1.3;
    color: var(--cor-texto);
    min-height: 2.6em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.post-item .post-excerpt,
.post-item .post-category-tag {
    display: none; 
}


/* ==========================================================================
   6. Layout da Página de Post (single.php) e Sidebars
   ========================================================================== */
.single-post-grid-container { display: grid; grid-template-columns: 250px 1fr 250px; gap: 30px; padding: 30px 0; }
.main-content-single { background: #fff; padding: 20px 30px; border-radius: var(--raio-borda); box-shadow: var(--sombra-caixa); }
.sidebar .widget { background: #fff; padding: 20px; margin-bottom: 25px; border-radius: var(--raio-borda); box-shadow: var(--sombra-caixa); }
.sidebar .widget-title { margin-top: 0; padding-bottom: 10px; border-bottom: 2px solid #f0f0f0; font-size: 1.2em; }
.post-full-image { margin: 25px 0; text-align: center; }
.post-full-image img { max-width: 100%; height: auto; border-radius: var(--raio-borda); display: inline-block; }
@media (max-width: 1024px) {
    .single-post-grid-container { grid-template-columns: 1fr; }
    #sidebar-left, #sidebar-right { margin-top: 30px; }
}

/* ==========================================================================
   7. Estilos Diversos (Abas, Sliders, etc.)
   ========================================================================== */
.category-tabs-nav { border-bottom: 2px solid var(--cor-borda); margin-bottom: 30px; padding: 0 15px; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.category-tabs-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.category-tabs-nav li a { display: block; padding: 12px 22px; text-decoration: none; color: var(--cor-titulos); font-weight: 600; font-size: 0.9em; border-radius: 5px 5px 0 0; margin-bottom: -2px; border-bottom: 3px solid transparent; transition: all 0.2s ease-in-out; }
.category-tabs-nav li a:hover { color: var(--cor-links-hover); border-bottom-color: var(--cor-links-hover); }

/* ==========================================================================
   8. Estilos do Modal
   ========================================================================== */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.7); z-index: 9998; display: flex; align-items: center; justify-content: center; padding: 20px; box-sizing: border-box; }
.modal-content { background-color: #ffffff; padding: 30px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); position: relative; width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto; }
.modal-close-btn { position: absolute; top: 15px; right: 20px; font-size: 2.5em; font-weight: bold; color: #888; cursor: pointer; line-height: 1; }
.modal-close-btn:hover { color: #000; }

/* ==========================================================================
   9. Ajustes de Largura Total e Responsividade
   ========================================================================== */
body.home .container,
body.blog .container {
    max-width: 100%;
}
body.home .main-content,
body.blog .main-content {
    padding-left: 5px;
    padding-right: 5px;
    box-sizing: border-box;
}

/* ==========================================================================
   10. Estilos da Busca Personalizada
   ========================================================================== */
.guia-busca-container {
    padding: 20px 15px;
    background-color: #fff;
    margin-bottom: 20px;
}
.search-form {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
}
.search-form::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    z-index: 2;
}
.search-field {
    width: 100%;
    padding: 15px 20px 15px 50px;
    font-size: 1.1em;
    border: 1px solid #ccc;
    border-radius: 50px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-field:focus {
    border-color: var(--cor-links);
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
    outline: none;
}
#search-results-container {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 5px 10px rgba(0,0,0,0.1);
    z-index: 1001;
    max-height: 300px;
    overflow-y: auto;
}
#search-results-container ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
#search-results-container li a {
    display: block;
    padding: 12px 20px;
    color: var(--cor-texto);
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}
#search-results-container li:last-child a {
    border-bottom: none;
}
#search-results-container li a:hover {
    background-color: #f5f5f5;
    color: var(--cor-links-hover);
}
#search-results-container .no-results {
    padding: 15px 20px;
    color: #777;
    text-align: center;
}

/* ==========================================================================
   11. Estilos dos Botões de Ação no Post
   ========================================================================== */
.post-full-image {
    position: relative;
}
.post-actions-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}
.post-action-btn {
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 5px 8px;
    transition: background-color 0.2s, border-color 0.2s;
    color: #555;
}
.post-action-btn:hover { background-color: #e7e7e7; border-color: #ccc; }
.post-action-btn:disabled { cursor: not-allowed; opacity: 0.7; }
.post-action-btn .btn-icon { display: inline-block; margin-right: 5px; }
.post-action-btn svg { width: 16px; height: 16px; vertical-align: middle; }
.post-action-btn.like-button .like-count { font-size: 0.9em; font-weight: bold; margin-left: 3px; }
.post-action-btn.like-button.liked { background-color: #FEE2E2; border-color: #FCA5A5; color: #EF4444; }
.post-action-btn.like-button.liked svg { fill: #EF4444; }

/* 11.2 Estilos dos Meta Dados do Post */
.post-full-meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
    margin: 20px 0; font-size: 0.9em;
}
.post-full-meta .meta-category a {
    background-color: #0073aa; color: #ffffff; padding: 6px 12px;
    border-radius: 5px; text-decoration: none; font-weight: 500;
    font-size: 0.95em; transition: background-color 0.2s ease;
}
.post-full-meta .meta-category a:hover { background-color: #005177; }
.post-full-meta .meta-date, .post-full-meta .meta-comments { display: flex; align-items: center; }
.post-full-meta .meta-comments a:hover { color: var(--cor-links-hover); }
.post-full-meta svg { width: 16px; height: 16px; margin-right: 8px; fill: currentColor; }


/* ==========================================================================
   12. ESTILOS DA BUSCA POR CATEGORIA
   ========================================================================== */
.category-search-container { max-width: 600px; margin: 0 auto 25px auto; padding: 0 15px; }
.category-search-form { position: relative; }
.category-search-field {
    width: 100%; padding: 12px 20px 12px 20px; font-size: 1em;
    border: 1px solid #ccc; border-radius: 25px; box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.category-search-field:focus {
    border-color: var(--cor-links);
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2); outline: none;
}
.category-posts-grid-wrapper { transition: opacity 0.3s ease-in-out; }
.no-results-message { text-align: center; padding: 40px 15px; color: #777; font-style: italic; grid-column: 1 / -1; }


/* ==========================================================================
   13. Banners Superiores (Layout e Estilos)
   ========================================================================== */
.superior-banners-section { padding-top: 20px; padding-bottom: 10px; }
.superior-banners-grid { display: grid; }
.superior-banner-item a { display: block; }
.superior-banner-item img {
    width: 100%; height: auto; display: block; border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); transition: transform 0.2s ease-in-out;
}
.superior-banner-item img:hover { transform: scale(1.03); }

/* ==========================================================================
   14. BOTÃO DE AÇÃO FLUTUANTE (CTA)
   ========================================================================== */
.floating-action-btn {
    position: fixed;
    z-index: 1000;
    background-color: #E63946;
    color: #ffffff;
    padding: 12px 25px;
    border-radius: 50px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    font-size: 1em;
    font-weight: bold;
    text-align: center;
    text-decoration: none;
    transition: transform 0.2s ease-in-out, background-color 0.2s ease;
    white-space: nowrap; /* Impede que o texto quebre a linha */
    border: none;
    cursor: pointer;
}

.floating-action-btn:hover {
    transform: translateY(-3px) scale(1.02);
    background-color: #c5303c;
    color: #ffffff;
}

/* Posições */
.floating-action-btn.bottom-right { bottom: 25px; right: 25px; }
.floating-action-btn.bottom-left { bottom: 25px; left: 25px; }
.floating-action-btn.bottom-center {
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
}

/* ==========================================================================
   15. Ajustes Responsivos e Correções Finais
   ========================================================================== */

/* Remove fundo amarelo em celulares */
@media (max-width: 767px) {
    body {
        background-color: #ffffff;
    }
    .single-post-grid-container,
    .main-content-wrapper,
    .guia-busca-container,
    .page-container {
        padding-left: 0;
        padding-right: 0;
    }
    body.single .single-post-grid-container {
        padding-left: 0;
        padding-right: 0;
    }

    /* --- INÍCIO DA CORREÇÃO: Botão Flutuante no Celular --- */
    .floating-action-btn {
        /* Remove a largura fixa para deixar o botão flexível */
        width: auto; 
        max-width: 90%; /* Limita para não ficar gigante com textos muito longos */
        
        padding: 14px 22px; /* Ajusta o padding para um bom visual */
        font-size: 1em;
    }
    
    .floating-action-btn.bottom-right {
        right: 15px; /* Adiciona um respiro da borda */
    }
    .floating-action-btn.bottom-left {
        left: 15px; /* Adiciona um respiro da borda */
    }
    /* --- FIM DA CORREÇÃO --- */
}

/* Largura total na página de cadastro em celulares */
@media (max-width: 767px) {
    body.page .page-container.container {
        max-width: 100%;
        padding-left: 0;
        padding-right: 0;
    }
    .cadastrar-empresa-wrapper,
    .cartao-visita-wrapper {
        padding-left: 0;
        padding-right: 0;
    }
    #cadastrar-empresa-form-container,
    #cartao-visita-form-container {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

/* Ícone Home no Cabeçalho */
.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.header-home-icon {
    font-size: 26px;
    color: var(--cor-titulos);
    transition: color 0.2s ease, transform 0.2s ease;
}
.header-home-icon:hover {
    color: var(--cor-links-hover);
    transform: scale(1.1);
}
@media (max-width: 767px) {
    .header-home-icon {
        font-size: 24px;
    }
}


/* ==========================================================================
   16. ESTILOS DA GALERIA DE IMAGENS (SINGLE POST)
   ========================================================================== */
.rddd-gallery {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--cor-borda);
}
.rddd-gallery h4 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.4em;
    color: var(--cor-titulos);
}
.gallery-items {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 colunas no PC */
    gap: 15px;
}
.rddd-gallery-item {
    display: block;
    border-radius: var(--raio-borda);
    overflow: hidden;
    box-shadow: var(--sombra-caixa);
}
.rddd-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Garante que a imagem preencha o espaço sem distorcer */
    display: block;
    transition: transform 0.3s ease-in-out;
}
.rddd-gallery-item:hover img {
    transform: scale(1.05); /* Efeito de zoom no hover */
}

/* Responsivo para celular: 2 colunas */
@media (max-width: 767px) {
    .gallery-items {
        grid-template-columns: repeat(2, 1fr); /* 2 colunas no celular */
        gap: 10px;
    }
}
/* ==========================================================================
   18. AJUSTE: Centralização dos Títulos de Categoria na Home
   ========================================================================== */

.guia-category-title {
    text-align: center; /* Centraliza o texto do título */
    width: 100%;       /* Garante que o título ocupe todo o espaço disponível */
    margin-bottom: 25px; /* Adiciona um espaço abaixo do título, antes da busca */
    font-size: 2.2em;  /* Opcional: Aumenta um pouco o tamanho do título para dar mais destaque */
    color: #333;      /* Opcional: Escurece um pouco a cor para melhorar a leitura */
}
/* ==========================================================================
   19. Formulário de Sugestão de Empresa
   ========================================================================== */

.suggestion-container {
    max-width: 700px;
    margin: 20px auto;
    padding: 0 15px;
    text-align: center;
}

#toggle-suggestion-form-btn {
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 25px;
    padding: 10px 20px;
    font-size: 0.95em;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#toggle-suggestion-form-btn:hover {
    background-color: #e7e7e7;
    border-color: #ccc;
    color: #333;
}

#suggestion-form-wrapper {
    margin-top: 20px;
    padding: 25px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

#suggestion-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.suggestion-form-field {
    text-align: left;
}

.suggestion-form-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #444;
}

.suggestion-form-field input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1em;
}

#submit-suggestion-btn {
    background-color: var(--cor-links);
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#submit-suggestion-btn:hover {
    background-color: var(--cor-links-hover);
}

#submit-suggestion-btn .spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    width: 20px;
    height: 20px;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin { 
    to { transform: rotate(360deg); } 
}

#suggestion-response {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
    font-weight: 500;
}

#suggestion-response.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#suggestion-response.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
/* ==========================================================================
   20. CORREÇÕES FINAIS PARA CELULAR E TABLET
   ========================================================================== */

/* --- 1. Correção para o conteúdo não ultrapassar as margens do post --- */

/* * Força todas as imagens, iframes e vídeos dentro do conteúdo do post
 * a nunca serem mais largos que a área de conteúdo.
 * O 'height: auto' garante que a proporção seja mantida.
*/
.main-content-single .post-full-content img,
.main-content-single .post-full-content iframe,
.main-content-single .post-full-content video {
    max-width: 100%;
    height: auto;
    box-sizing: border-box; /* Garante que padding e bordas não causem overflow */
}

/* Garante que os botões (como o de 'Atualizar') também se ajustem */
.single-post-update-button-container,
.rddd-info-box {
    box-sizing: border-box;
    width: 100%;
}


/* --- 2. Melhoria no botão de "Sugerir Empresa" para celular e tablet --- */

/* * Transforma o botão em um elemento de largura total,
 * com mais destaque e mais fácil de tocar.
*/
#toggle-suggestion-form-btn {
    width: 100%; /* Ocupa a largura total do contêiner */
    box-sizing: border-box;
    padding: 14px 20px; /* Deixa o botão mais alto */
    font-size: 1em;     /* Aumenta a fonte */
    font-weight: 700;   /* Deixa a fonte em negrito */
    background-color: #ffffff; /* Fundo branco para contrastar com o amarelo */
    border: 2px solid #e0e0e0; /* Borda mais definida */
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08); /* Sombra suave */
    justify-content: center; /* Centraliza o ícone e o texto */
}

/* Opcional: Efeito hover um pouco mais sutil no celular */
#toggle-suggestion-form-btn:hover {
    background-color: #f7f7f7;
    border-color: #d0d0d0;
}