/* ==========================================================================
   HEADER FLUTUANTE & NAV (Estilo Portal Fazenda)
   ========================================================================== */

#main-header {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1200px;
    background-color: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 24px;
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 0;
}

#main-header.scrolled {
    top: 10px;
    width: 95%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
    padding: 0 2rem;
    transition: height 0.3s ease;
}

/* Remover estilos antigos de header se houver conflito */
.site-header {
    display: none !important;
}

/* Logo Styles */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--primary-green);
    text-decoration: none;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.logo-title {
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.5px;
    color: var(--primary-green-dark);
}

.logo-subtitle {
    font-size: 0.7rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}

/* Desktop Nav */
.desktop-nav {
    display: none;
}

@media (min-width: 992px) {
    .desktop-nav {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        background-color: rgba(241, 245, 249, 0.5);
        padding: 0.4rem;
        border-radius: 50px;
        margin-left: auto;
        margin-right: 1rem;
    }

    .desktop-nav a {
        font-weight: 500;
        color: var(--text-dark);
        padding: 0.5rem 0.8rem;
        border-radius: 50px;
        font-size: 0.85rem;
        transition: all 0.3s ease;
        text-decoration: none;
        display: inline-block;
        white-space: nowrap;
    }

    .desktop-nav a.active {
        background-color: var(--primary-green);
        color: white;
        box-shadow: 0 4px 12px rgba(13, 68, 25, 0.3);
    }

    .desktop-nav a:hover:not(.active) {
        background-color: rgba(255, 255, 255, 0.8);
        color: var(--primary-green);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }

    /* Dropdown Styles */
    .nav-dropdown {
        position: relative;
        display: inline-block;
    }

    .dropdown-content {
        display: none;
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        background-color: white;
        min-width: 220px;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
        border-radius: 12px;
        z-index: 1001;
        padding: 0.5rem 0;
        margin-top: 0.5rem;
        opacity: 0;
        transition: all 0.3s ease;
        border: 1px solid rgba(0, 0, 0, 0.05);
    }

    .nav-dropdown:hover .dropdown-content {
        display: flex;
        flex-direction: column;
        opacity: 1;
        animation: fadeIn 0.3s ease forwards;
    }

    .dropdown-content a {
        color: var(--text-dark);
        padding: 0.8rem 1.2rem;
        text-decoration: none;
        display: block;
        transition: all 0.2s;
        border-radius: 0;
        font-size: 0.9rem;
        text-align: left;
        white-space: normal;
        /* Permitir quebra de linha se necessário */
    }

    .dropdown-content a:hover {
        background-color: #f8fafc;
        color: var(--primary-green);
        transform: translateX(5px);
        box-shadow: none;
    }

    /* Setinha no topo do dropdown */
    .dropdown-content::before {
        content: '';
        position: absolute;
        top: -6px;
        left: 50%;
        margin-left: -5px;
        border-width: 0 6px 6px 6px;
        border-style: solid;
        border-color: transparent transparent white transparent;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, 10px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Search Button (Igual Portal Fazenda) */
.search-btn {
    border: none;
    background: white;
    font-size: 1.1rem;
    color: var(--text-dark);
    cursor: pointer;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    margin-right: 0.5rem;
}

.search-btn:hover {
    background-color: var(--primary-green);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(13, 68, 25, 0.25);
}

/* Mobile Menu Btn */
.mobile-menu-btn {
    border: none;
    background: white;
    font-size: 1.1rem;
    color: var(--text-dark);
    cursor: pointer;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.mobile-menu-btn:hover {
    background-color: var(--primary-green);
    color: white;
    transform: translateY(-2px);
}

@media (min-width: 992px) {
    .mobile-menu-btn {
        display: none;
    }
}

/* Portal Button (Back to Main) */
.portal-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem;
    background: linear-gradient(135deg, var(--primary-green), var(--primary-green-dark));
    color: white !important;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(13, 68, 25, 0.2);
    height: fit-content;
    white-space: nowrap;
}

.portal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(13, 68, 25, 0.3);
    color: white !important;
}

.portal-btn i {
    font-size: 0.9rem;
}

.portal-btn-text {
    display: none;
}

/* Mídia Queries para Mobile (Ajustes finos) */
@media (max-width: 991px) {
    .header-content {
        padding: 0 1rem;
        /* Reduz padding lateral */
    }

    .logo-title {
        font-size: 1rem;
        /* Reduz tamanho da fonte */
    }

    .logo img {
        width: 35px !important;
        /* Reduz logo */
    }
}

@media (max-width: 480px) {
    #main-header {
        width: 95%;
        /* Header mais largo em telas pequenas */
        top: 10px;
    }

    .header-content {
        padding: 0 0.8rem;
    }

    .logo-text {
        max-width: 140px;
        /* Limita largura do texto do logo */
    }

    .logo-title {
        font-size: 0.85rem;
        line-height: 1.1;
    }

    .logo-subtitle {
        display: none;
        /* Esconde subtítulo em telas muito pequenas */
    }

    /* Esconder o botão 'Site Principal' em telas muito pequenas para dar espaço ao menu */
    .portal-btn {
        display: none;
    }

    /* Ou se preferir manter apenas o ícone, use:
    .portal-btn {
        padding: 0.4rem;
        width: 32px;
        height: 32px;
        justify-content: center;
    }
    .portal-btn i { margin: 0; }
    */

    /* Ajuste dos botões de ação */
    .search-btn,
    .mobile-menu-btn {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
}

@media (min-width: 992px) {
    .portal-btn-text {
        display: inline;
    }
}

/* ==========================================================================
   HEADER RESPONSIVO NOTEBOOK / LAPTOP (1024px - 1366px)
   ========================================================================== */
@media (min-width: 992px) and (max-width: 1366px) {
    .header-content {
        padding: 0 1rem;
        /* Reduz padding lateral container */
    }

    /* Logo Compacto */
    .logo img {
        width: 40px !important;
    }

    .logo-title {
        font-size: 1rem;
    }

    .logo-subtitle {
        font-size: 0.65rem;
    }

    /* Navegação Compacta */
    .desktop-nav {
        margin-right: 0.5rem;
        gap: 0.2rem;
        /* Menor espaço entre itens */
    }

    .desktop-nav a {
        padding: 0.4rem 0.6rem;
        /* Botões menores */
        font-size: 0.8rem;
    }

    /* Botões de Ação Compactos */
    .header-actions {
        gap: 0.3rem;
    }

    .portal-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }

    .search-btn {
        width: 38px;
        height: 38px;
    }
}

/* ==========================================================================
   SEARCH MODAL (Estilo Portal Fazenda - White Card)
   ========================================================================== */
.search-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    /* Overlay escuro */
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    /* Centralizar verticalmente */
    justify-content: center;
    /* Centralizar horizontalmente */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.search-modal.active {
    opacity: 1;
    display: flex;
}

.search-modal-content {
    width: 90%;
    max-width: 600px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: zoomIn 0.3s ease forwards;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.search-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 2rem 2rem 1rem 2rem;
    color: var(--text-dark);
}

.search-modal-header-text {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.search-modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--primary-green-dark);
    /* Verde escuro do tema */
}

.search-modal-header p {
    font-size: 0.95rem;
    color: #666;
    margin: 0;
}

.close-search-btn {
    background: none;
    border: none;
    color: #999;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
    padding: 0;
    margin-top: -5px;
}

.close-search-btn:hover {
    color: var(--primary-green);
    transform: none;
    /* Reset transform anterior */
}

.search-modal-body {
    padding: 0;
    display: flex;
    flex-direction: column;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
    padding: 1rem 2rem;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    background-color: #f8fafc;
    /* Fundo levemente cinza na area de busca */
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
}

.search-input-wrapper:focus-within {
    border-color: var(--primary-green);
    background-color: white;
}

.search-input-wrapper i {
    position: static;
    transform: none;
    color: var(--primary-green);
    font-size: 1.2rem;
}

#searchInput {
    width: 100%;
    padding: 0.5rem 0;
    border: none;
    border-radius: 0;
    font-size: 1.1rem;
    box-shadow: none;
    background: transparent;
    color: var(--text-dark);
    font-family: 'Inter', sans-serif;
}

#searchInput:focus {
    outline: none;
    box-shadow: none;
    transform: none;
}

#searchInput::placeholder {
    color: #aaa;
}

.search-results-container {
    max-height: 400px;
    overflow-y: auto;
    padding: 1.5rem;
    /* Mais espaçamento interno */
    background-color: white;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    /* Espaço entre os cards */
}

/* Scrollbar Style */
.search-results-container::-webkit-scrollbar {
    width: 6px;
}

.search-results-container::-webkit-scrollbar-track {
    background: transparent;
}

.search-results-container::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 3px;
}

/* Search Initial State & No Results */
.search-placeholder-msg,
.search-no-results {
    text-align: center;
    padding: 3rem 2rem;
    color: #64748b;
}

.search-no-results {
    background: transparent;
    /* Reset */
    border-radius: 0;
}

.search-placeholder-msg p,
.search-no-results p {
    font-size: 0.95rem;
    margin: 0;
}

.search-no-results i {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #cbd5e1;
}

/* Result Items */
/* Result Items */
.search-result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: white;
    border: 1px solid #e2e8f0;
    /* Borda sutil */
    text-decoration: none;
    transition: all 0.2s ease;
    border-radius: 12px;
    /* Cantos arredondados */
    margin-bottom: 0;
    position: relative;
    color: inherit;
    /* Evitar que herde cor de link global */
}

.search-result-item:last-child {
    border-bottom: 1px solid #e2e8f0;
    /* Manter borda no último item */
}

.search-result-item:hover {
    background-color: #f0fdf4;
    /* Verde bem claro */
    border-color: var(--primary-green);
    /* Borda verde ao passar o mouse */
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(13, 68, 25, 0.08);
    /* Sombra suave verde */
    z-index: 1;
}

/* Manter cores do texto fixas no hover */
.search-result-item:hover .result-content h4 {
    color: #000000;
}

.search-result-item:hover .result-content p {
    color: #333333;
}

/* Ícone do Resultado */
.result-icon {
    width: 45px;
    height: 45px;
    background-color: var(--primary-green);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(13, 68, 25, 0.2);
    transition: all 0.2s;
}

.search-result-item:hover .result-icon {
    background-color: #000;
    /* Fundo preto no hover */
    color: #fff;
}

.result-content {
    flex: 1;
}

.result-content h4 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 4px 0;
}

.result-content p {
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1.4;
    margin: 0;
}

.result-arrow {
    color: #ccc;
    font-size: 1rem;
    transition: all 0.2s;
}

.search-result-item:hover .result-arrow {
    color: #000;
    transform: translateX(5px);
}

.search-result-title strong {
    background-color: rgba(13, 68, 25, 0.1);
    color: var(--primary-green-dark);
    padding: 0 4px;
    border-radius: 4px;
}