.busca-imoveis-bs4 {
    position: relative;
    min-height: 500px;
    margin-bottom: 30px;
    overflow: visible;
    width: 100%;
}

/* Wrapper do formulário */
.busca-formulario-wrapper {
    position: relative;
    z-index: 99999; /* Aumentado significativamente */
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-height: 500px;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Card do formulário */
.busca-formulario-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    position: relative; /* Adicionado */
    z-index: 99999; /* Adicionado */
}

/* Abas de transação */
.abas-transacao {
    display: flex;
    margin-bottom: 2rem;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.aba-transacao {
    flex: 1;
    padding: 12px 20px;
    background: white;
    border: 2px solid #2D587A;
    border-right: none;
    color: #2D587A;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.aba-transacao:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.aba-transacao:last-child {
    border-right: 2px solid #2D587A;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

.aba-transacao.ativa {
    background: #2D587A;
    color: white;
}

.aba-transacao:hover:not(.ativa) {
    background: #f8f9fa;
}

/* Campos de busca */
.campos-busca {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

/* Título do formulário */
.busca-titulo {
    margin-bottom: 2rem;
    text-align: center;
}

.busca-titulo h4 {
    color: #2D587A;
    font-size: 2rem;
    font-weight: 700;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    line-height: 1.3;
    text-transform: uppercase;
    text-align: center;
}

/* Alinhamento dos campos */
.busca-formulario-card .form-group {
    margin-bottom: 0;
    width: 100%;
}

.busca-formulario-card .row {
    align-items: end;
    width: 100%;
}

.busca-formulario-card form {
    flex: 1;
    display: block;
    width: 100%;
    max-width: 100%;
}

.busca-formulario-card .form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.busca-formulario-card .form-label i {
    font-size: 1rem;
    color: #2D587A;
    flex-shrink: 0;
}

/* Botão de busca */
.btn-buscar {
    width: 100%;
    padding: 12px 15px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #2D587A 0%, #1D2F45 100%);
    border: none;
    box-shadow: 0 2px 8px rgba(45,88,122,0.3);
    font-size: 14px;
    white-space: nowrap;
    height: auto;
    min-height: 48px;
    line-height: 1.5;
    box-sizing: border-box;
}

.btn-buscar:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(45,88,122,0.4);
    background: linear-gradient(135deg, #1D2F45 0%, #565658 100%);
}

.btn-buscar i {
    margin-right: 8px;
}

/* Estilos para o texto selecionado nos dropdowns */
.dropdown-toggle .selected-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* Dropdown Checkbox Styles */
.dropdown-checkbox {
    position: relative;
    display: inline-block;
    width: 100%;
}

.dropdown-toggle {
    width: 100%;
    padding: 12px 15px;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #495057;
    position: relative;
    transition: all 0.3s ease;
    height: auto;
    min-height: 48px;
    line-height: 1.5;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-toggle:hover {
    border-color: #2D587A;
    box-shadow: 0 0 0 0.2rem rgba(45,88,122,.15);
}

.dropdown-toggle.active {
    border-color: #2D587A;
    box-shadow: 0 0 0 0.2rem rgba(45,88,122,.25);
}

.dropdown-arrow {
    font-size: 12px;
    transition: transform 0.3s ease;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
}

.dropdown-toggle.active .dropdown-arrow {
    transform: translateY(-50%) rotate(180deg);
    color: #2D587A;
}

.dropdown-content {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #2D587A;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 999999; /* Z-index extremamente alto para garantir que fique acima de tudo */
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 12px 16px;
}

/* Dropdown mais compacto para tipo de imóvel e transação */
#categoriaDropdown,
#tipoDropdown {
    max-height: 250px;
    padding: 8px 16px;
    width: 100%;
    min-width: 100%;
    z-index: 999999; /* Z-index mais alto para o dropdown de categoria */
}

#categoriaDropdown .checkbox-item,
#tipoDropdown .checkbox-item {
    padding: 8px 12px;
    margin-bottom: 8px;
    min-height: 28px;
}

#categoriaDropdown .checkbox-item:last-child {
    margin-bottom: 0;
}

#categoriaDropdown .checkbox-item input[type="checkbox"],
#tipoDropdown .checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-right: 12px;
    outline: none !important;
}

#categoriaDropdown .checkbox-item input[type="checkbox"]:focus,
#tipoDropdown .checkbox-item input[type="checkbox"]:focus {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

#categoriaDropdown .checkbox-item input[type="checkbox"]:checked,
#tipoDropdown .checkbox-item input[type="checkbox"]:checked {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

#categoriaDropdown .checkbox-item input[type="checkbox"]:checked:focus,
#tipoDropdown .checkbox-item input[type="checkbox"]:checked:focus {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

#categoriaDropdown .checkbox-item label,
#tipoDropdown .checkbox-item label {
    font-size: 14px;
    margin-left: 6px;
    line-height: 1.3;
    color: #495057;
}

#categoriaDropdown .checkbox-item:hover {
    background: #f8f9fa;
}

/* Dropdown de bairros organizados por cidade */
#bairroDropdown {
    max-height: 250px;
    padding: 8px 16px;
    width: 100%;
    min-width: 100%;
    overflow-y: auto;
    z-index: 999998; /* Z-index alto para o dropdown de bairro */
}

.cidade-grupo {
    margin-bottom: 8px;
}

.cidade-grupo:last-child {
    margin-bottom: 0;
}

.cidade-header {
    background: #f8f9fa;
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    width: 100%;
    box-sizing: border-box;
    margin-left: 0;
    margin-right: 0;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.cidade-header:hover {
    background: #f0f4f8 !important;
}

.cidade-header strong {
    color: #2D587A;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.7rem;
    display: inline-block;
    width: 100%;
}

.cidade-header {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.cidade-header:hover {
    background: #f0f4f8 !important;
}

/* Dropdown de categorias organizadas por fim (tipo de uso) */
#categoriaDropdown {
    max-height: 250px;
    padding: 8px 16px;
    width: 100%;
    min-width: 100%;
    overflow-y: auto;
}

.fim-grupo {
    margin-bottom: 8px;
}

.fim-grupo:last-child {
    margin-bottom: 0;
}

.fim-header {
    background: #f8f9fa;
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    width: 100%;
    box-sizing: border-box;
    margin-left: 0;
    margin-right: 0;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.fim-header:hover {
    background: #f0f4f8 !important;
}

.fim-header strong {
    color: #2D587A;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.7rem;
    display: inline-block;
    width: 100%;
}

.fim-header {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.fim-header:hover {
    background: #f0f4f8 !important;
}

#bairroDropdown .checkbox-item {
    padding: 8px 12px;
    margin-bottom: 8px;
    min-height: 28px;
}

#bairroDropdown .checkbox-item:last-child {
    margin-bottom: 0;
}

#bairroDropdown .checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-right: 12px;
    outline: none !important;
}

#bairroDropdown .checkbox-item input[type="checkbox"]:focus {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

#bairroDropdown .checkbox-item input[type="checkbox"]:checked {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

#bairroDropdown .checkbox-item input[type="checkbox"]:checked:focus {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

#bairroDropdown .checkbox-item label {
    font-size: 14px;
    margin-left: 6px;
    line-height: 1.3;
    color: #495057;
}

#bairroDropdown .checkbox-item:hover {
    background: #f8f9fa;
}

.dropdown-content.show {
    display: block !important;
}

.checkbox-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
    min-height: 28px;
}

.checkbox-item:last-child {
    margin-bottom: 0;
}

.checkbox-item input[type="checkbox"] {
    margin-right: 16px;
    margin-top: 0;
    width: 20px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
    outline: none !important;
    border: none !important;
}

.checkbox-item input[type="checkbox"]:focus {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

.checkbox-item input[type="checkbox"]:checked {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

.checkbox-item input[type="checkbox"]:checked:focus {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

.checkbox-item label {
    margin-bottom: 0;
    cursor: pointer;
    font-size: 15px;
    color: #495057;
    flex: 1;
    user-select: none;
    line-height: 1.4;
    margin-left: 6px;
}

.checkbox-item:hover {
    background: #f8f9fa;
}

/* Autocomplete Styles */
.autocomplete-container {
    position: relative;
    width: 100%;
}

.autocomplete-container .form-control {
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    height: auto;
    min-height: 48px;
    line-height: 1.5;
    box-sizing: border-box;
}

.autocomplete-container .form-control:focus {
    border-color: #2D587A;
    box-shadow: 0 0 0 0.2rem rgba(45,88,122,.25);
    outline: none !important;
}

.autocomplete-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #2D587A;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 99997; /* Menor que os outros dropdowns */
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.autocomplete-dropdown.show {
    display: block;
}

.autocomplete-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
    font-size: 14px;
    color: #495057;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: #f8f9fa;
}

.autocomplete-item.selected {
    background: #2D587A;
    color: white;
}

.autocomplete-item.highlighted {
    background: #f0f4f8;
}

.card-imovel-fake-img {
    background: #2ecc40;
    height: 180px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    border-radius: 8px 8px 0 0;
    object-fit: cover;
    object-position: center;
    overflow: hidden;
    padding: 0;
}
.card-imovel-fake-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 8px 8px 0 0;
    display: block;
}
.card-imovel {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
}
.card-imovel .card-body {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: stretch;
    min-height: 120px;
    height: 100%;
    padding-bottom: 12px;
}
.mb-1.text-muted.d-flex.align-items-center.gap-1 {
    min-height: 40px;
    justify-content: flex-start;
    align-items: center;
    gap: 6px;
}

/* Responsividade */
@media (max-width: 768px) {
    .busca-imoveis-bs4 {
        min-height: 400px;
    }
    
    .busca-formulario-wrapper {
        min-height: 400px;
        padding: 1rem;
        justify-content: center;
    }
    
    .busca-formulario-card {
        max-width: 100%;
        padding: 1.5rem;
    }
    
    .busca-titulo {
        margin-bottom: 1.5rem;
    }
    
    .busca-titulo h4 {
        font-size: 1.5rem;
    }
    
    /* Abas de transação responsivas */
    .abas-transacao {
        flex-direction: column;
        margin-bottom: 1.5rem;
    }
    
    .aba-transacao {
        border-right: 2px solid #2D587A;
    }
    
    .aba-transacao:first-child {
        border-top-left-radius: 8px;
        border-top-right-radius: 8px;
        border-bottom-left-radius: 0;
    }
    
    .aba-transacao:last-child {
        border-bottom-left-radius: 8px;
        border-bottom-right-radius: 8px;
        border-top-right-radius: 0;
    }
    
    .campos-busca {
        gap: 1rem;
    }
}

/* Ajustes para telas médias */
@media (min-width: 769px) and (max-width: 991px) {
    .busca-formulario-card .form-label {
        font-size: 0.8rem;
    }
    
    .dropdown-toggle {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .btn-buscar {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .aba-transacao {
        padding: 10px 15px;
        font-size: 13px;
    }
    
    .busca-formulario-card {
        max-width: 450px;
    }
}

/* Correções para evitar que o dropdown seja cortado */
.busca-imoveis-bs4 {
    overflow: visible;
}

.busca-formulario-wrapper {
    overflow: visible;
}
