/* 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;
    animation: slideDown 0.3s ease;
}

.custom-site-header.header-hidden {
    transform: translateY(-100%);
}

@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; /* Impede que os itens quebrem para a próxima linha */
}

/* 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; /* Impede que os itens do menu quebrem para a próxima linha */
}

.custom-menu li {
    position: relative;
    margin: 0 5px;
    white-space: nowrap; /* Impede que o texto do menu quebre */
}

.custom-menu a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    font-weight: 500;
    font-size: 16px;
    transition: color 0.3s ease;
    border-radius: 4px;
}

/* 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;
}

/* 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 */
.custom-mobile-menu {
    display: none;
    width: 100%;
    background-color: #f8f8f8;
    padding: 10px 0;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 99;
    box-shadow: 0 5px 5px rgba(0, 0, 0, 0.1);
}

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

.custom-mobile-menu-items {
    list-style: none;
    margin: 0;
    padding: 0 20px;
}

.custom-mobile-menu-items li {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

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

.custom-mobile-menu-items a {
    display: block;
    padding: 12px 0;
    text-decoration: none;
    font-weight: 500;
    text-align: center;
}

/* 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-menu-container {
        display: none;
    }
    
    .custom-search-overlay-content {
        width: 90%;
    }
    
    .custom-mobile-menu-items a {
        text-align: center;
    }
}

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

/* 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;
    }
}
