/* ===== HEADER AVILLA - APRESENTAÇÃO MODERNA E IMPACTANTE ===== */
/* Identidade: dourado #b59855 | Visual robusto para o mercado imobiliário */

:root {
    --header-accent: #b59855;
    --header-accent-hover: #9a8047;
    --header-accent-light: rgba(181, 152, 85, 0.12);
    --header-text: #1a1a1a;
    --header-text-muted: #555;
    --header-bg: #ffffff;
    --header-top-bg: #1a1a1a;
    --header-top-height: 40px;
    --header-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    --header-shadow-scrolled: 0 4px 24px rgba(0, 0, 0, 0.12);
    --header-transition: 0.3s ease;
}

/* Evita margem/scroll horizontal no PC (100vw + barra de rolagem) */
html,
body {
    overflow-x: hidden;
    max-width: 100%;
}

/* ---- Top bar: de ponta a ponta, altura fixa para alinhar a navbar ---- */
.header-top {
    background: var(--header-top-bg);
    color: #e0e0e0;
    font-size: 0.8125rem;
    min-height: var(--header-top-height);
    padding: 0.5rem 0;
    position: relative;
    z-index: 1031;
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    border: none;
    box-sizing: border-box;
}

/* Conteúdo alinhado ao restante do site */
.header-top-container {
    max-width: 1320px;
    margin: 0 auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

.header-top-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.header-top-link {
    color: #e0e0e0;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: color var(--header-transition);
    font-weight: 500;
}

.header-top-link:hover {
    color: var(--header-accent);
}

.header-top-whatsapp:hover {
    color: #25d366;
}

.header-top-sep {
    color: rgba(255, 255, 255, 0.3);
    margin: 0 0.25rem;
    user-select: none;
}

.header-top-slogan {
    color: rgba(255, 255, 255, 0.75);
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* Celular: barra preta não é exibida (telefone/WhatsApp/slogan só em telas maiores) */
@media (max-width: 767.98px) {
    .header-top {
        display: none !important;
    }
}

/* ---- Navbar principal: inicia abaixo da barra preta; ao rolar, fixa no topo ---- */
#mainNavbar {
    background: var(--header-bg) !important;
    padding: 0.65rem 0;
    transition: top var(--header-transition), box-shadow var(--header-transition), padding var(--header-transition);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
    z-index: 1030;
    top: var(--header-top-height);
}

#mainNavbar.navbar-pinned {
    top: 0;
}

#mainNavbar.scrolled {
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
    padding: 0.5rem 0;
}

.header-brand {
    padding: 0;
    margin: 0;
}

.header-logo {
    height: 48px;
    width: auto;
    max-width: 172px;
    object-fit: contain;
    transition: opacity var(--header-transition);
}

.header-brand:hover .header-logo {
    opacity: 0.88;
}

/* ---- Links do menu: minimalistas ---- */
.header-nav-list .header-link {
    color: var(--header-text) !important;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 0.85rem !important;
    border-radius: 6px;
    position: relative;
    transition: color var(--header-transition);
    letter-spacing: 0.01em;
}

.header-link::after {
    content: '';
    position: absolute;
    bottom: 0.25rem;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 1.5px;
    background: var(--header-accent);
    transition: width var(--header-transition);
}

.header-link:hover {
    color: var(--header-accent) !important;
}

.header-link.active {
    color: var(--header-accent) !important;
    font-weight: 600;
}

.header-link:hover::after,
.header-link.active::after {
    width: 70%;
}

/* Sem fundo pill no hover/active: mais clean */
.header-nav-list .header-link:hover,
.header-nav-list .header-link.active {
    background-color: transparent !important;
}

/* ---- Botão Área do Cliente: discreto e profissional ---- */
.header-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--header-accent) !important;
    color: #fff !important;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.5rem 1.1rem !important;
    border-radius: 6px;
    border: none !important;
    box-shadow: none;
    transition: background var(--header-transition), opacity var(--header-transition);
    text-decoration: none !important;
}

.header-cta:hover {
    color: #fff !important;
    background: var(--header-accent-hover) !important;
    opacity: 1;
}

.header-cta:active {
    opacity: 0.95;
}

/* ---- Minha Conta (dropdown): discreto ---- */
.header-account-toggle {
    color: var(--header-text) !important;
    font-weight: 500;
    padding: 0.5rem 0.85rem !important;
    border-radius: 6px;
    background: transparent;
    border: none;
}

.header-account-toggle:hover {
    color: var(--header-accent) !important;
    background: var(--header-accent-light);
}

.header-account-icon {
    font-size: 1.1rem;
    color: var(--header-accent);
}

.header-dropdown {
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    padding: 0.4rem;
    min-width: 200px;
}

.header-dropdown-item {
    padding: 0.65rem 1rem;
    font-weight: 500;
    border-radius: 8px;
    transition: background var(--header-transition), color var(--header-transition);
}

.header-dropdown-item:hover {
    background: var(--header-accent-light);
    color: var(--header-accent);
}

.header-dropdown-sair:hover {
    background: rgba(220, 53, 69, 0.1) !important;
    color: #dc3545 !important;
}

/* ---- Hamburger (mobile) ---- */
.header-toggler {
    border: 2px solid var(--header-accent);
    border-radius: 10px;
    padding: 0.5rem 0.65rem;
    transition: background var(--header-transition), border-color var(--header-transition);
}

.header-toggler:hover {
    background: var(--header-accent-light);
    border-color: var(--header-accent-hover);
}

.header-toggler:focus {
    box-shadow: 0 0 0 3px var(--header-accent-light);
}

.header-toggler-icon {
    display: block;
    width: 22px;
    height: 18px;
    position: relative;
}

.header-toggler-icon::before,
.header-toggler-icon::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--header-accent);
    border-radius: 2px;
    transition: transform var(--header-transition), opacity var(--header-transition);
}

.header-toggler-icon::before {
    top: 0;
}

.header-toggler-icon::after {
    bottom: 0;
}

.navbar-toggler .header-toggler-icon {
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23b59855' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") center/1.5em no-repeat;
}

/* ---- Desktop: divisor sutil antes de Área do Cliente / Minha Conta ---- */
.header-nav-divider {
    width: 1px;
    height: 1.5rem;
    background: rgba(0, 0, 0, 0.12);
    margin: 0 0.25rem 0 0.5rem;
    padding: 0 !important;
    list-style: none;
}

/* ---- Menu mobile: apresentação em painel full-screen ---- */
.header-collapse {
    margin-top: 0;
    padding: 0;
    background: var(--header-bg);
    border-radius: 0;
    box-shadow: none;
    border: none;
}

@media (max-width: 991.98px) {
    /* Painel fixo: top/maxHeight corrigidos via JS ao abrir (colado na navbar, sem gap) */
    .navbar-collapse.header-collapse {
        position: fixed;
        left: 0;
        right: 0;
        width: 100%;
        margin: 0;
        padding: 0 1rem 2rem;
        background: #fff;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
        z-index: 1028;
        -webkit-overflow-scrolling: touch;
        border-top: 1px solid rgba(0, 0, 0, 0.06);
        /* fallback até o JS definir pela borda real da navbar */
        top: 86px;
        max-height: calc(100vh - 86px);
    }

    .navbar-collapse.header-collapse.collapsing {
        transition: opacity 0.2s ease, transform 0.2s ease;
    }

    .navbar-collapse.header-collapse.show {
        display: flex !important;
        flex-direction: column;
    }

    /* Lista do menu em coluna, full width */
    .header-nav-list {
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100%;
        margin: 0;
        padding: 0;
        gap: 0 !important;
    }

    .header-nav-list .nav-item {
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
        margin: 0 !important;
        width: 100%;
    }

    .header-nav-list .nav-item:last-child {
        border-bottom: none;
    }

    /* Esconder divisor no mobile */
    .header-nav-list .header-nav-divider {
        display: none !important;
    }

    /* Cada link do menu: área de toque grande (mín. 48px), legível */
    .header-nav-list .header-link {
        display: flex !important;
        align-items: center !important;
        min-height: 48px;
        padding: 1rem 1.25rem !important;
        font-size: 1.0625rem !important;
        font-weight: 500;
        border-radius: 0;
        width: 100%;
        box-sizing: border-box;
    }

    .header-link::after {
        display: none;
    }

    .header-nav-list .header-link:hover,
    .header-nav-list .header-link.active {
        background: var(--header-accent-light) !important;
        color: var(--header-accent) !important;
    }

    /* CTA Área do Cliente no mobile: destaque em bloco */
    .header-item-cta {
        margin-top: 0.75rem !important;
        padding: 0 0 0.75rem !important;
        border-bottom: none !important;
    }

    .header-item-cta .header-cta {
        width: 100%;
        margin: 0;
        padding: 1rem 1.25rem !important;
        font-size: 1.0625rem !important;
        min-height: 52px;
        justify-content: center;
        border-radius: 10px;
    }

    /* Minha Conta no mobile: full width */
    .header-item-account {
        margin-top: 0.5rem !important;
    }

    .header-item-account .header-account-toggle {
        width: 100%;
        justify-content: center;
        min-height: 48px;
        padding: 1rem 1.25rem !important;
    }

    .navbar .dropdown-menu {
        position: static !important;
        float: none;
        width: 100%;
        margin: 0.5rem 0 0 0 !important;
        box-shadow: none;
        border: 1px solid rgba(0, 0, 0, 0.08);
        border-radius: 10px;
        padding: 0.35rem;
    }

    .header-dropdown-item {
        min-height: 44px;
        display: flex;
        align-items: center;
        padding: 0.75rem 1rem !important;
    }
}

/* ---- Espaçador (conteúdo abaixo do fixed nav) ---- */
.header-spacer {
    height: 0;
    transition: height var(--header-transition);
}

/* Altura total: top bar + navbar. Conteúdo inicia logo abaixo. */
body .header-spacer {
    height: 100px; /* top bar ~36px + nav ~64px */
}

@media (max-width: 991.98px) {
    body .header-spacer {
        height: 98px; /* top bar + navbar com toggle */
    }
}

/* Celular: sem barra preta; navbar no topo; espaçador e painel do menu ajustados */
@media (max-width: 767.98px) {
    :root {
        --header-top-height: 0;
    }
    #mainNavbar {
        top: 0 !important;
    }
    body .header-spacer {
        height: 56px;
    }
    .navbar-collapse.header-collapse {
        top: 56px;
        max-height: calc(100vh - 56px);
    }
}

/* Conteúdo principal: margem logo abaixo do header */
.main-content-row {
    margin-top: 1rem;
}

/* ---- Desktop: espaçamento e apresentação dos itens do menu ---- */
@media (min-width: 992px) {
    .header-nav-list {
        gap: 0.125rem;
    }
    .header-nav-list .nav-item {
        margin-left: 0;
    }
    .header-nav-list .nav-item:last-child {
        margin-left: 0;
    }
    .nav-link-text {
        position: relative;
    }
}
