/* =========================================================================
 * PÁGINA REDE DE PESQUISADORES
 * ========================================================================= */

:root {
    --rede-roxo: #5F54D8;
    --rede-roxo-escuro: #4A3FC0;
    --rede-azul: #2F6FE0;
}

.rede-topo {
    background: linear-gradient(90deg, var(--rede-roxo-escuro), var(--rede-azul));
    height: 14px;
    width: 100%;
}

/* ---------- HERO ---------- */
.rede-hero {
    padding: 48px 0 24px;
}

.rede-hero__inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 40px;
    flex-wrap: wrap;
}

.rede-hero__texto {
    flex: 1 1 520px;
    max-width: 700px;
}

.rede-hero__texto h1 {
    font-family: 'Viga', sans-serif;
    color: var(--rede-roxo);
    font-size: 2.5rem;
    margin-bottom: 4px;
}

.rede-hero__subtitulo {
    color: var(--rede-roxo);
    font-weight: 700;
    font-size: 1.15rem;
    margin-bottom: 18px;
}

.rede-hero__descricao {
    color: #444;
    line-height: 1.6;
    margin-bottom: 22px;
}

.rede-hero__fonte {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.9rem;
    color: #555;
}

.rede-hero__linha {
    width: 220px;
    height: 3px;
    background: var(--rede-roxo);
    margin-top: 8px;
}

.rede-hero__ilustracao {
    flex: 0 1 460px;
    max-width: 460px;
    align-self: center;
}

.rede-hero__ilustracao img {
    width: 100%;
    height: auto;
    display: block;
}

.rede-stat-numero {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 28px;
}

.rede-stat-numero strong {
    font-family: 'Viga', sans-serif;
    color: var(--rede-roxo);
    font-size: 6rem;
    line-height: 1;
}

.rede-stat-numero__legenda {
    display: flex;
    flex-direction: column;
}

.rede-stat-numero span {
    display: block;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.03em;
}

.rede-stat-numero small {
    display: block;
    color: #777;
    margin-top: 4px;
}

/* ---------- TEMAS POR POPULARIDADE ---------- */
.rede-temas__box {
    background: linear-gradient(120deg, var(--rede-roxo-escuro), var(--rede-roxo));
    border-radius: 8px;
    padding: 24px 28px;
    max-width: 700px;
    margin-top: 32px;
}

.rede-temas__box h2 {
    color: #fff;
    font-family: 'Viga', sans-serif;
    font-size: 1.15rem;
    letter-spacing: 0.03em;
    margin-bottom: 16px;
}

.rede-temas__box ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rede-temas__box li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    padding: 8px 12px;
}

.rede-temas__numero {
    font-weight: 700;
    color: #FFD166;
}

/* ---------- FOTO BANNER (decorativa, sem texto) ---------- */
.rede-foto-banner {
    width: 100%;
    line-height: 0;
    margin: 8px 0 0;
}

.rede-foto-banner img {
    width: 100%;
    height: 260px;
    object-fit: cover;
    display: block;
}

/* ---------- BARRA DE BUSCA / CABEÇALHO DE SEÇÃO ---------- */
.rede-busca-tabela,
.rede-resultados {
    padding: 24px 0 48px;
}

.rede-busca__cabecalho {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.rede-busca__contagem {
    display: flex;
    flex-direction: column;
    font-size: 0.9rem;
    color: #555;
}

.rede-busca__contagem span:first-child {
    font-weight: 700;
    color: #222;
    font-size: 1.05rem;
}

.rede-busca__controles {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.rede-busca__input {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.rede-busca__input input {
    border: none;
    outline: none;
    padding: 12px 14px;
    min-width: 220px;
    font-size: 0.95rem;
}

.rede-busca__input--somente-leitura input {
    background: #f5f5f5;
    color: #777;
}

.rede-busca__input button {
    background: var(--rede-roxo);
    border: none;
    color: #fff;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.rede-botao-secundario {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px 18px;
    font-weight: 700;
    color: #333;
    cursor: pointer;
}

.rede-botao-primario {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--rede-roxo);
    border: none;
    border-radius: 8px;
    padding: 12px 18px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
}

.rede-botao-primario:hover {
    background: var(--rede-roxo-escuro);
}

.rede-busca__filtro-wrap {
    position: relative;
}

.rede-filtros-painel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 16px;
    min-width: 260px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
    z-index: 20;
}

.rede-filtros-painel p {
    font-weight: 700;
    margin-bottom: 10px;
}

.rede-filtro-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 0.9rem;
    cursor: pointer;
}

.rede-filtros-painel .rede-botao-primario {
    margin-top: 12px;
    width: 100%;
    justify-content: center;
}

/* ---------- TABELA ---------- */
.rede-tabela-wrap {
    overflow-x: auto;
    border: 1px solid #eee;
    border-radius: 8px;
}

.rede-tabela {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

.rede-tabela thead th {
    background: var(--rede-roxo);
    color: #fff;
    text-align: left;
    padding: 14px 16px;
    font-size: 0.9rem;
    white-space: nowrap;
}

.rede-tabela tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
    vertical-align: top;
}

.rede-tabela tbody tr:nth-child(even) {
    background: #fafafa;
}

.rede-tabela td.rede-td-descricao {
    max-width: 320px;
}

.rede-descricao__texto {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rede-descricao__texto--expandido {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
}

.rede-descricao__toggle {
    display: inline-block;
    margin-top: 4px;
    background: none;
    border: none;
    padding: 0;
    color: var(--rede-roxo);
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
}

.rede-descricao__toggle:hover {
    text-decoration: underline;
}

.rede-tabela td a {
    color: var(--rede-roxo);
    text-decoration: underline;
    word-break: break-all;
}

.rede-tabela-vazia {
    text-align: center;
    color: #888;
    padding: 30px !important;
}

/* ---------- PAGINAÇÃO ---------- */
.rede-paginacao {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.rede-paginacao button {
    min-width: 36px;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #333;
    font-weight: 600;
    cursor: pointer;
    padding: 0 8px;
}

.rede-paginacao button.is-active {
    background: var(--rede-roxo);
    border-color: var(--rede-roxo);
    color: #fff;
}

.rede-paginacao button:disabled {
    opacity: 0.35;
    cursor: default;
}

.rede-paginacao span.rede-paginacao-reticencias {
    padding: 0 4px;
    color: #999;
}

/* ---------- CHIPS DE FILTRO ---------- */
.rede-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.rede-chips:empty {
    display: none;
}

.rede-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #eee7fc;
    color: var(--rede-roxo-escuro);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 600;
}

.rede-chip button {
    background: none;
    border: none;
    color: var(--rede-roxo-escuro);
    font-weight: 900;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

/* ---------- CARDS DE RESULTADO ---------- */
.rede-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.rede-card {
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: 18px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 20px;
}

.rede-card__seta {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--rede-roxo);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-decoration: none;
}

.rede-card__corpo h3 {
    font-size: 1.05rem;
    margin-bottom: 4px;
}

.rede-card__area {
    color: var(--rede-roxo);
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 10px;
    display: block;
}

.rede-card__linha {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 10px;
}

.rede-card__linha strong {
    display: block;
    color: #222;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 2px;
}

.rede-card__descricao {
    font-size: 0.9rem;
    color: #444;
    line-height: 1.6;
}

.rede-sem-resultado {
    color: #777;
    padding: 30px 0;
    text-align: center;
}

/* ---------- RESPONSIVO ---------- */
@media (max-width: 900px) {
    .rede-hero__inner {
        flex-direction: column;
    }

    .rede-card {
        grid-template-columns: 1fr;
    }

    .rede-card__seta {
        display: none;
    }
}

@media (max-width: 600px) {
    .rede-busca__controles {
        width: 100%;
    }

    .rede-busca__input input {
        min-width: 0;
        width: 100%;
    }
}

/* ---------- MODAL DE DESCRIÇÃO COMPLETA ---------- */
.rede-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.rede-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 15, 50, 0.55);
}

.rede-modal__card {
    position: relative;
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    max-width: 560px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.rede-modal__fechar {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: #888;
    cursor: pointer;
}

.rede-modal__fechar:hover {
    color: #333;
}

.rede-modal__card h3 {
    font-family: 'Viga', sans-serif;
    color: var(--rede-roxo);
    font-size: 1.2rem;
    margin-bottom: 8px;
    padding-right: 24px;
}

.rede-modal__area {
    display: inline-block;
    color: var(--rede-roxo);
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 14px;
}

.rede-modal__lideres {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 14px;
}

.rede-modal__lideres strong {
    display: block;
    color: #222;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 2px;
}

.rede-modal__card p {
    color: #444;
    line-height: 1.6;
    margin-bottom: 20px;
}

body.rede-modal-aberto {
    overflow: hidden;
}

/* Garante que o atributo hidden realmente esconda o modal,
   mesmo com a regra .rede-modal { display: flex } definida acima */
.rede-modal[hidden] {
    display: none !important;
}

/* Ajustes finos: modal por cima do menu, menor e centralizado */
.rede-modal {
    z-index: 9999 !important;
    padding: 40px 16px !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
}

.rede-modal__card {
    max-width: 480px !important;
    width: 100% !important;
    max-height: 75vh !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
}

/* Fundo real do banner (imagem enviada pelo design) */
.rede-banner {
    background: none !important;
    background-image: url("../img/rede-banner-fundo.jpg") !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}


/* ---------- SECAO iAraucaria + BANNER MESCLADO ---------- */
.rede-iaraucaria {
    padding: 48px 0;
}

.rede-iaraucaria__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
}

.rede-iaraucaria__texto {
    max-width: 620px;
}

.rede-iaraucaria__texto h2 {
    font-family: 'Viga', sans-serif;
    color: var(--rede-roxo);
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.rede-iaraucaria__texto p {
    color: #444;
    line-height: 1.6;
    margin-bottom: 16px;
}

.rede-iaraucaria__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--rede-roxo);
    color: #fff;
}

.rede-iaraucaria__link:hover {
    background: var(--rede-roxo-escuro);
}

.rede-iaraucaria__ilustracao {
    flex-shrink: 0;
}

.rede-iaraucaria__ilustracao img {
    max-width: 240px;
    width: 100%;
    height: auto;
}

.rede-banner {
    padding: 40px 0;
}

.rede-banner__inner {
    display: flex;
    align-items: center;
    gap: 32px;
}

.rede-banner__numero {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.rede-banner__numero strong {
    font-family: 'Viga', sans-serif;
    color: #fff;
    font-size: 3rem;
    line-height: 1;
}

.rede-banner__numero-legenda span {
    display: block;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    line-height: 1.3;
}

.rede-banner__numero-legenda small {
    display: block;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.75rem;
    margin-top: 4px;
}

.rede-banner__divisor {
    width: 1px;
    align-self: stretch;
    background: rgba(255, 255, 255, 0.35);
}

.rede-banner__areas h2 {
    color: #fff;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 10px;
}

.rede-banner__areas ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rede-banner__areas li {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 0.85rem;
}

.rede-banner__area-numero {
    color: #ffd166;
    font-weight: 700;
}

@media (max-width: 768px) {
    .rede-iaraucaria__inner {
        flex-direction: column;
        text-align: center;
    }

    .rede-banner__inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .rede-banner__divisor {
        width: 100%;
        height: 1px;
    }
}


/* Ajuste: banner nao deve estourar a largura do container */
.rede-banner {
    background: none !important;
    padding: 32px 0 !important;
}

.rede-banner__inner {
    background-image: url("../img/rede-banner-fundo.jpg") !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    border-radius: 16px !important;
    padding: 32px 40px !important;
    box-sizing: border-box !important;
}


/* Ajuste: tamanho da nova flor exportada do Figma */
.rede-iaraucaria__ilustracao img {
    max-width: 320px !important;
}


/* Ajuste: texto da iaraucaria ocupa mais largura (sem ilustracao do lado) */
.rede-iaraucaria__texto {
    max-width: 760px !important;
}


/* Ajuste: flor nao deve empurrar o resto da pagina pra baixo */
.rede-hero {
    overflow: visible !important;
    padding-bottom: 32px !important;
}

.rede-hero__inner {
    position: relative !important;
}

.rede-hero__texto {
    max-width: 600px !important;
}

.rede-hero__ilustracao {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
}


/* Ajuste: traco mais grosso + quadradinho do lado do titulo */
.rede-hero__linha {
    height: 4px !important;
}

.rede-iaraucaria__cabecalho {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.rede-iaraucaria__texto h2 {
    margin-bottom: 0 !important;
}


/* Ajuste: menos espaco antes da iaraucaria, texto estreito + botao maior do lado */
.rede-hero {
    padding-bottom: 8px !important;
}

.rede-iaraucaria {
    padding-top: 16px !important;
}

.rede-iaraucaria__texto h2 {
    margin-bottom: 16px !important;
}

.rede-iaraucaria__corpo {
    display: flex;
    align-items: center;
    gap: 24px;
}

.rede-iaraucaria__corpo p {
    max-width: 520px;
    margin: 0;
}

.rede-iaraucaria__link {
    width: 56px !important;
    height: 56px !important;
    flex-shrink: 0;
}


/* Ajuste: titulo da iaraucaria tambem vira link */
.rede-iaraucaria__texto h2 a {
    color: inherit;
    text-decoration: none;
}

.rede-iaraucaria__texto h2 a:hover {
    text-decoration: underline;
}


/* Ajuste: a flor (.rede-hero__ilustracao) tinha sido presa com position:absolute
   top:0/right:0 sem estar dentro de media query, entao ficava flutuando por
   cima do texto no mobile. Aqui devolvemos ela ao fluxo normal, centralizada
   abaixo do texto, so na faixa mobile. */
@media (max-width: 900px) {
    .rede-hero__ilustracao {
        position: static !important;
        margin-top: 24px !important;
        display: flex !important;
        justify-content: center !important;
    }
    .rede-hero__ilustracao img {
        max-width: 260px !important;
        width: 100% !important;
        height: auto !important;
    }
    .rede-hero__texto {
        max-width: 100% !important;
    }
}


/* Ajuste: flor vira um icone pequeno ao lado do titulo no mobile (substitui
   o ajuste anterior que empilhava a flor grande embaixo do texto) */
@media (max-width: 900px) {
    .rede-hero__inner {
        flex-direction: row !important;
        align-items: flex-start !important;
        gap: 16px !important;
    }
    .rede-hero__texto {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }
    .rede-hero__ilustracao {
        position: static !important;
        margin-top: 4px !important;
        flex: none !important;
        width: 64px !important;
        display: block !important;
    }
    .rede-hero__ilustracao img {
        max-width: 64px !important;
        width: 100% !important;
        height: auto !important;
    }
}
