/* =============================================================
   HEADER CUSTOM - Alterações isoladas para portabilidade
   Para aplicar em produção:
     1. Copiar este arquivo para assets/css/header-custom.css
     2. Adicionar em Cabecalho.php, após a linha do mainstyle.css:
        <link href="/dpmt/assets/css/header-custom.css" rel="stylesheet" type="text/css" />
   ============================================================= */


/* ------------------------------------------------------------------
   BACKGROUND: FOTO CAPA.webp cobrindo todo o #header
   Imagem: 1919x613px (proporção: 613/1919 ≈ 31.9vw de altura)
   ------------------------------------------------------------------ */

body {
    overflow-x: hidden;
}

#header {
    background-image: url('/dpmt/assets/NOVA%20HOME/FOTO%20CAPA.webp');
    background-size: auto;
    background-position: center -60px;
    background-repeat: no-repeat;
    height: 520px;
    overflow: visible;
}

/* Remove o fundo verde sólido inline do #itens_menu_desktop */
#itens_menu_desktop {
    background-color: transparent !important;
    height: auto !important;
    padding: 8px 0;
}

#header {
    padding-top: 18px;
}

/* Remove o background-image inline da .topo para o #header assumir */
.topo {
    background-image: none !important;
    background-color: transparent !important;
    background-attachment: unset !important;
    height: auto !important;
    min-height: 0 !important;
    height: calc(520px - 7rem) !important;
}

.topo-menu {
    height: auto !important;
    min-height: 0 !important;
}


/* ------------------------------------------------------------------
   BORDA INFERIOR: remove a curva
   ------------------------------------------------------------------ */

.parallax-overlay:after {
    display: none !important;
}


/* ------------------------------------------------------------------
   BARRA SUPERIOR: layout flexbox [redes sociais | links | busca]
   ------------------------------------------------------------------ */

#topbar-row {
    display: flex !important;
    align-items: center;
    flex-wrap: nowrap;
    margin: 0 !important;
    width: 100%;
    border-bottom: 1px solid white !important;
    padding-bottom: 20px;
}

/* Redes sociais — extrema esquerda */
.topbar-social {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
}

.topbar-social .social {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px;
    height: 28px;
    color: #fff !important;
    font-size: 15px;
    border-radius: 4px !important;
    text-decoration: none;
    line-height: 1 !important;
    padding: 0 !important;
}

.topbar-social .social:hover {
    color: #ccc !important;
}

/* Links utilitários — centro, ocupa o espaço disponível */
#topbar-row .col-md-7 {
    flex: 1 1 auto;
    width: auto !important;
    float: none !important;
}

#topbar-row .col-md-7 .menu-superior {
    margin: 0 !important;
    padding: 0;
}

/* Busca — extrema direita */
#topbar-row .col-md-5 {
    flex: 0 0 auto;
    width: auto !important;
    float: none !important;
    padding: 0 !important;
}

#topbar-row .col-md-5 .search {
    float: none !important;
    width: 340px !important;
    padding-top: 0 !important;
    display: flex;
    align-items: stretch;
    margin: 0;
    height: 32px;
}

#topbar-row .col-md-5 .search input {
    border-radius: 5px 0 0 5px !important;
    border: none;
    padding: 0 12px;
    font-size: 13px;
    flex: 1;
    height: 32px;
    box-sizing: border-box;
}

#topbar-row .col-md-5 .search .btn-busca {
    position: static !important;
    background-color: #fff;
    border: none;
    border-radius: 0 5px 5px 0 !important;
    padding: 0 14px;
    color: #27633f;
    font-size: 13px;
    cursor: pointer;
    top: unset !important;
    right: unset !important;
    height: 32px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}


/* ------------------------------------------------------------------
   BARRA DE NAVEGAÇÃO (nav row): SELOS à esquerda, menu à direita
   HTML alterado: img.logo-direita movida para dentro de .main-menu,
   antes do botão mobile (Menu.php)
   ------------------------------------------------------------------ */

/* Anula o position:absolute original do logo-direita */
.menu-principal-dpmt .logo-direita {
    position: static !important;
    top: unset !important;
    right: unset !important;
    width: auto !important;
    height: 60px !important;
    max-width: none !important;
    min-width: unset !important;
    display: inline-block;
    vertical-align: middle;
    margin-right: 20px;
    flex-shrink: 0;
    z-index: auto !important;
}

/* Faz .main-menu virar flexbox para alinhar selos + menu lado a lado, centralizado */
.menu-principal-dpmt .main-menu {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: center !important;
    background: transparent !important;
    padding: 8px 0 !important;
}

/* Logo da Defensoria: retirada do fluxo do nav e centralizada abaixo dele */
.topo {
    position: relative;
}

.menu-principal-dpmt a.logo {
    display: block !important;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 60px;
    z-index: 10;
    margin: 0 !important;
    float: none !important;
    min-height: unset !important;
}

.menu-principal-dpmt a.logo img {
    max-width: 300px !important;
    margin: 0 !important;
    margin-top: 30px !important;
}

/* Navbar collapse ocupa o espaço restante */
.menu-principal-dpmt .nav-main-collapse {
    flex: 1 1 auto;
}


/* ------------------------------------------------------------------
   ALINHAMENTO DO MENU AO TOPO DOS SELOS
   Sobrescreve margin-top do inline style do Menu.php:
     .menu-principal-dpmt { margin-top: 30px }
     .menu-cascata         { margin-top: 70px }
   ------------------------------------------------------------------ */

.menu-principal-dpmt {    
    margin-top: 0 !important;
}

.menu-cascata {
    margin-top: 10px !important;
}

#topMain > li > a {
    padding-top: 0 !important;
}

.icone-menu-principal {
    width: 26px;
    height: 26px;
    vertical-align: middle;
    margin-top: -3px;
    margin-left: 0px;
    border-radius: 0 !important;
}

/* Dropdowns acima dos demais componentes */
#topNav {
    position: relative;
    z-index: 100;
}

#topMain .dropdown-menu {
    z-index: 9999 !important;
    margin-top: 0 !important;
}

/* Fecha o gap entre o item e o dropdown */
#topMain > li > a {
    padding-bottom: 14px !important;
}

#topMain > li {
    position: relative;
}


/* ------------------------------------------------------------------
   BOTÕES DO HEADER
   ------------------------------------------------------------------ */

/* Wrapper do botão PRECISO DE ATENDIMENTO — fluxo normal, centralizado */
.header-buttons {
    text-align: center;
    padding-top: 30px;
    position: relative;
    z-index: 20;
}

.btn-atendimento {
    display: inline-block;
    text-decoration: none;
    margin-top: 80px;
}

.btn-atendimento img {    
    width: 300px;
    border-radius: 0 !important;
    display: block;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.btn-atendimento:hover img {
    transform: scale(1.05);
    filter: brightness(1.15);
}

/* Botão "Mulher" — absoluto à direita relativo ao .topo */
.btn-mulher {
    position: absolute;
    right: 60px;
    top: 130px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
}

.btn-mulher img {
    width: 80px;
    height: auto;
    border-radius: 0 !important;
    display: block;
}

.btn-mulher p {
    color: #fff;
    font-weight: bold;
    font-size: 13px;
    text-align: center;
    margin: 4px 0 0 0;
    line-height: 1.3;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}


/* ------------------------------------------------------------------
   CARDS DE SERVIÇOS
   ------------------------------------------------------------------ */

.header-cards {
    background: transparent;
    padding: 0;
    margin-top: -100px;
    position: relative;
    z-index: 30;
}

.header-cards-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    justify-content: center;
    padding: 0 0 20px 0;
}

.header-card {
    
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    border-radius: 10px;
    padding: 20px 0px 20px;
    text-decoration: none;
    color: #fff;
    flex: 1 1 0;
    min-width: 0;
    max-width: 145px;
    text-align: center;
    transition: filter 0.2s;    
}

.header-card:hover {
    filter: brightness(1.1);
    color: #fff;
    text-decoration: none;
}

.header-card:nth-child(1) { background-color: #8fae90; }
.header-card:nth-child(2) { background-color: #6d9870; }
.header-card:nth-child(3) { background-color: #4e8558; }
.header-card:nth-child(4) { background-color: #3d7a52; }
.header-card:nth-child(5) { background-color: #2e6e47; }
.header-card:nth-child(6) { background-color: #1f5e3a; }

.header-card img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    margin-bottom: 10px;
    border-radius: 0 !important;
    display: block;
}

.header-card:nth-child(3) img,
.header-card:nth-child(4) img,
.header-card:nth-child(5) img,
.header-card:nth-child(6) img {
    width: 72px;
    height: 72px;
    margin-bottom: 0px;
    margin-top: -10px;

}

.header-card span {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    color: #fff;
}


/* ------------------------------------------------------------------
   RESPONSIVIDADE
   ------------------------------------------------------------------ */

/* --- Tablet (≤ 991px) --- */
@media (max-width: 991px) {

    #header {
        min-height: 50vw;
        background-position: center top;
    }

    .topo {
        min-height: calc(50vw - 5rem) !important;
    }

    .topo-menu {
        min-height: calc(50vw - 5rem) !important;
    }

    .menu-principal-dpmt .logo-direita {
        height: 44px !important;
        margin-right: 10px;
    }

    .menu-principal-dpmt a.logo img {
        max-width: 220px !important;
    }

    #topbar-row .col-md-5 .search {
        width: 220px !important;
    }

    .btn-atendimento img {
        width: 220px;
    }

    .btn-mulher {
        right: 20px;
        top: 90px;
    }

    .btn-mulher img {
        width: 60px;
    }

    .header-cards {
        margin-top: -220px;
    }

    .header-cards-row {
        flex-wrap: wrap;
        justify-content: center;
    }

    .header-card {
        flex: 0 0 calc(33.333% - 10px);
        max-width: calc(33.333% - 10px);
    }
}

/* --- Menu mobile: suspenso sobre o conteúdo, largura total --- */
@media (max-width: 1024px) {

    /* Contexto de posicionamento para o menu flutuar */
    .menu-principal-dpmt .main-menu {
        flex-wrap: nowrap !important;
        align-items: center !important;        
        position: relative !important;
    }

    /* Aberto: suspenso sobre o conteúdo, largura total */
    .nav-main-collapse.in,
    .nav-main-collapse.collapsing {
        position: absolute !important;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        width: 100vw;
        z-index: 9000;
        background-color: #27633f;
        padding: 10px 0;
        box-shadow: 0 4px 8px rgba(0,0,0,0.3);
        height: auto !important;
        overflow: visible !important;
    }

    .nav-main-collapse #topMain {
        display: block !important;
        margin: 0;
        padding: 0;
    }

    .nav-main-collapse #topMain > li {
        display: block;
        float: none;
        border-bottom: 1px solid rgba(255,255,255,0.15);
    }

    .nav-main-collapse #topMain > li > a {
        display: block;
        padding: 12px 20px !important;
        color: #fff !important;
    }

    .nav-main-collapse .dropdown-menu {
        position: static !important;
        float: none;
        background-color: rgba(0,0,0,0.2);
        border: none;
        box-shadow: none;
        padding: 0;
        width: 100%;
    }

    .nav-main-collapse .dropdown-menu li a {
        color: #fff !important;
        padding: 8px 30px;
    }
}

/* --- Mobile (≤ 768px) --- */
@media (max-width: 768px) {

    #header {
        min-height: 0;
        background-position: center top;
        padding-top: 8px;
    }

    .topo {
        min-height: 45vw !important;
        height: auto !important;
    }


    .topo-menu {
        min-height: 45vw !important;
        height: auto !important;        
    }

    /* Selos: ocultar no mobile */
    .menu-principal-dpmt .logo-direita {
        display: none !important;
    }

    /* Navbar mobile: hamburger absoluto à direita */
    .menu-principal-dpmt .main-menu {
        justify-content: flex-end !important;
        min-height: 50px;        
    }

    /* Logo: centralizada no .topo igual ao desktop */
    .menu-principal-dpmt a.logo {
        position: absolute !important;
        top: 50%;
        left: 50%;  
        transform: translate(-50%, -50%) !important;
        display: block !important;
        margin-top: 80px !important;
        z-index: 5;
    }

    .menu-principal-dpmt a.logo img {
        max-width: 240px !important;                
        margin-top: 0 !important;
        display: block;
    }

    /* Hamburger: canto direito */
    .btn.btn-mobile {
        position: relative;
        z-index: 6;
        padding: 4px 8px;
        font-size: 16px;
        line-height: 1;
    }

    .btn.btn-mobile i.fa-bars {
        font-size: 28px !important;
    }

    /* Ocultar botão Mulher no mobile */
    .btn-mulher {
        display: block !important; 
        top: 230px;
        right: 50%;
        left: 45%;
        width: fit-content;
        
    }

    .header-buttons {
        padding-top: 20px;
    }

    .btn-atendimento img {
        margin-top: 0px !important;
        width: 250px;
    }

    /* Cards: 2 por linha */
   .header-cards {
        margin-top: -260px;
    }

    .header-cards-row {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 8px;
    }

    .header-card {
        flex: 0 0 calc(50% - 8px);
        max-width: calc(50% - 8px);
    }
}
