/* Estilos para o header personalizado */

/* Reset para evitar conflitos */
.custom-site-header *,
.custom-search-overlay * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Header principal */
.custom-site-header {
    position: relative;
    padding: 15px 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: transform 0.3s ease, background-color 0.3s ease;
    will-change: transform;
}

.custom-site-header.sticky-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: inherit; 
}

.custom-site-header.header-hidden {
    transform: translateY(-100%);
    transition: transform 0s ease !important;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

.custom-header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Logo e título do site */
.custom-site-branding {
    display: flex;
    align-items: center;
}

.custom-logo-link {
    display: block;
}

.custom-logo {
    max-height: 60px; 
    width: auto;
}

.custom-site-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

.custom-site-title a {
    text-decoration: none;
}

/* Seção direita (menu + pesquisa) */
.custom-right-section {
    display: flex;
    align-items: center;
    flex-wrap: nowrap; 
}

/* Navegação principal */
.custom-main-navigation {
    display: flex;
    align-items: center;
}

.custom-menu-container {
    display: flex;
}

.custom-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: nowrap; 
}

.custom-menu li {
    position: relative;
    margin: 0; /* Removido margin: 0 5px; para controle mais fino com padding nos links */
    white-space: nowrap; 
}

.custom-menu li a {
    display: block;
    padding: 10px 15px; /* Padding original */
    text-decoration: none;
    font-weight: 500;
    font-size: 16px;
    position: relative; /* Para o pseudo-elemento ::after */
    transition: color 0.3s ease, background-color 0.2s ease; /* Transição para cor e fundo */
    border-radius: 4px; /* Mantém o arredondamento */
    overflow: hidden; /* Para o efeito de sublinhado não sair do link */
}

/* Efeito de hover similar ao luxmobiles.com */
.custom-menu li a::after {
    content: '';
    position: absolute;
    bottom: 5px; /* Posição da linha um pouco acima da base */
    left: 50%; /* Começa no centro */
    transform: translateX(-50%); /* Centraliza a linha */
    width: 0; /* Começa com largura 0 */
    height: 2px; /* Altura da linha */
    background-color: var(--header-text-color, currentColor); /* Cor da linha (usa variável do customizer ou cor atual do texto) */
    transition: width 0.3s ease; /* Animação da largura */
}

.custom-menu li a:hover {
    background-color: rgba(0, 0, 0, 0.05); /* Fundo levemente escuro no hover, ajuste conforme necessário */
    /* color: inherit; A cor do texto já é herdada, pode ser ajustada se necessário para contraste */
}

.custom-menu li a:hover::after {
    width: calc(100% - 30px); /* Largura da linha no hover (100% menos o padding lateral total do link) */
}


/* Submenu */
.custom-menu .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #ffffff;
    min-width: 200px;
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    padding: 5px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 100;
    list-style: none;
}

.custom-menu li:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-menu .sub-menu li {
    margin: 0;
    width: 100%;
}

.custom-menu .sub-menu a {
    padding: 8px 15px;
    border-radius: 0;
}

.custom-menu .sub-menu a::after { /* Remove o efeito de sublinhado do submenu */
    display: none;
}

.custom-menu .sub-menu a:hover {
    background-color: rgba(0,0,0,0.05); /* Mantém um hover sutil no submenu */
}

/* Botão de busca */
.custom-search-container {
    margin-left: 15px;
    display: flex;
    align-items: center;
}

.custom-search-toggle {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

/* Botão de menu mobile */
.custom-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    padding: 10px;
    cursor: pointer;
    margin-right: 0;
}

.custom-menu-toggle-icon {
    display: block;
    position: relative;
    width: 24px;
    height: 18px;
}

.custom-bar {
    display: block;
    width: 24px;
    height: 2px;
    background-color: currentColor;
    position: absolute;
    left: 0;
    transition: all 0.3s ease;
}

.custom-bar:nth-child(1) {
    top: 0;
}

.custom-bar:nth-child(2) {
    top: 8px;
}

.custom-bar:nth-child(3) {
    top: 16px;
}

.custom-menu-toggle[aria-expanded="true"] .custom-bar:nth-child(1) {
    transform: rotate(45deg);
    top: 8px;
}

.custom-menu-toggle[aria-expanded="true"] .custom-bar:nth-child(2) {
    opacity: 0;
}

.custom-menu-toggle[aria-expanded="true"] .custom-bar:nth-child(3) {
    transform: rotate(-45deg);
    top: 8px;
}

/* Menu mobile CORRIGIDO */
.custom-mobile-menu {
    display: none; 
    width: 100%;
    background-color: #000000 !important; /* Fundo preto para o menu mobile */
    padding: 0; 
    position: absolute;
    top: 100%; 
    left: 0;
    right: 0;
    z-index: 999;
    box-shadow: 0 5px 5px rgba(0,0,0,0.25);
}

.custom-mobile-menu.active {
    display: block; 
}

.custom-mobile-menu-items {
    list-style: none;
    margin: 0;
    padding: 0; 
    display: flex;
    flex-direction: column; /* Garante empilhamento vertical */
    width: 100%;
}

.custom-mobile-menu-items li {
    border-bottom: 1px solid #333333; /* Linha divisória escura para fundo preto */
    width: 100%;
}

.custom-mobile-menu-items li:last-child {
    border-bottom: none;
}

.custom-mobile-menu-items a {
    display: block;
    padding: 15px 20px; 
    text-decoration: none;
    font-weight: 500;
    color: #ffffff !important; /* Texto branco para contraste com fundo preto */
    text-align: left; 
    transition: background-color 0.2s ease;
}

.custom-mobile-menu-items a:hover,
.custom-mobile-menu-items a:focus {
    background-color: #222222; /* Feedback visual mais escuro para fundo preto */
    color: #ffffff !important;
}


/* Overlay de pesquisa */
.custom-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.custom-search-overlay.active {
    opacity: 1;
    visibility: visible;
}

.custom-search-overlay-content {
    width: 80%;
    max-width: 600px;
    position: relative;
}

.custom-search-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
}

/* Formulário de pesquisa */
.custom-search-form {
    width: 100%;
    display: flex;
    border-radius: 4px;
    overflow: hidden;
}

.custom-search-field {
    flex: 1;
    padding: 15px 20px;
    border: none;
    font-size: 18px;
    outline: none;
    background-color: #ffffff;
}

.custom-search-submit {
    color: #ffffff;
    border: none;
    padding: 0 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.custom-search-submit:hover {
    opacity: 0.9;
}

/* Espaço para o header fixo */
.custom-header-spacer {
    display: none;
}

.has-sticky-header .custom-header-spacer {
    display: block;
}

/* Responsividade */
@media (max-width: 768px) {
    .custom-header-container {
        justify-content: space-between;
    }
    
    .custom-site-branding {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .custom-menu-toggle {
        display: flex; 
        align-items: center;
        order: -1; 
        margin-right: 0; 
    }
    
    .custom-right-section {
        justify-content: flex-end; 
    }
    
    .custom-main-navigation {
        display: none; /* Esconder menu desktop em telas menores */
    }
    
    .custom-search-overlay-content {
        width: 90%;
    }
}

@media (min-width: 769px) {
    .custom-mobile-menu,
    .custom-mobile-menu.active {
        display: none !important; 
    }
    
    .custom-menu-toggle {
        display: none !important; 
    }

    .custom-main-navigation {
        display: flex !important; /* Garantir que o menu desktop esteja visível */
    }
}

/* Acessibilidade */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

/* Ajustes para o WordPress Admin Bar */
body.admin-bar .custom-site-header.sticky-header {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar .custom-site-header.sticky-header {
        top: 46px;
    }
}

/* Cores dos ícones do header (pesquisa e hamburguer) - Herdarão da personalização do tema */
.custom-search-toggle,
.custom-menu-toggle {
    color: inherit; /* Para herdar a cor do texto do header definida no customizer */
}

