/* =============================================================
   Eternare – Filtros de busca estilo Click Galpões
   Escopo: .wdk-search (widget Elementor Wdk Search)
   ============================================================= */

/* --- Botão "Filtros avançados" → aparência de link de texto --- */
.wdk-search #wdk-search-additional {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    color: #555 !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    cursor: pointer;
    padding: 4px 0 !important;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    letter-spacing: 0;
    text-transform: none;
}

.wdk-search #wdk-search-additional:hover {
    color: #222 !important;
}

/* Ícone +/– inline com o texto */
.wdk-search #wdk-search-additional .wdk-toggle-icon {
    display: inline-block;
    font-style: normal;
    font-weight: 600;
    font-size: 15px;
    line-height: 1;
}

.wdk-search #wdk-search-additional .wdk-toggle-icon::before {
    content: "+";
}

.wdk-search.open-form #wdk-search-additional .wdk-toggle-icon::before,
.wdk-search #wdk-search-additional[aria-expanded="true"] .wdk-toggle-icon::before {
    content: "—";
}

/* --- Linha de botões: preenche 100% do container geral --- */
.wdk-search .wdk-col-btns {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    /* Cresce para preencher todo o espaço restante na linha */
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0;
}

/* Container interno dos botões também ocupa toda a largura do .wdk-col-btns */
.wdk-search .wdk-field.wdk-field-btn {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap;
    align-items: center;
    width: 100% !important;
    box-sizing: border-box;
    gap: 0;
}

/* Corrige margin negativa do WDK que extrapola o container */
.wdk-search .wdk-row .wdk-field-btn {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
}

.wdk-search .wdk-field-group-additional {
    order: 3;
    margin-left: auto;
    flex-shrink: 0;
}

.wdk-search .wdk-field-group-reset {
    order: 2;
    flex-shrink: 0;
}

.wdk-search .wdk-field-group-search {
    order: 1;
    flex-shrink: 0;
}

/* --- Segunda linha: filtros avançados --- */
/*
   O WDK usa slideDown/slideUp para controlar visibilidade.
   Garantimos que o bloco fique em nova linha (flex-basis 100%) e
   nunca sobreponha os demais campos.
*/
.wdk-search #wdk-form-additional {
    width: 100% !important;
    flex: 0 0 100% !important;
    border-top: 1px solid rgba(0,0,0,0.08);
    margin-top: 12px;
    padding-top: 12px;
    /* Resetar qualquer posicionamento absoluto/fixo do tema/WDK */
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    z-index: 1 !important;
    float: none !important;
    clear: both !important;
    box-sizing: border-box;
}

.wdk-search #wdk-form-additional .wdk-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Tamanhos consistentes para os campos do bloco avançado */
.wdk-search #wdk-form-additional .wdk-field {
    flex: 1 1 220px;
    min-width: 220px;
}

/* Garantir que o formulário e o wrapper principal "crescem" para baixo */
.wdk-search,
.wdk-search.wdk-search-form,
.wdk-search .wdk-search-form {
    height: auto !important;
    overflow: visible !important;
    position: relative;
}

.wdk-search.open-form {
    overflow: visible !important;
}

/* Linha principal da busca: flex-wrap para que o bloco avançado
   pule para a linha de baixo corretamente */
.wdk-search .wdk-search-form .wdk-row:first-child {
    flex-wrap: wrap !important;
}

/* Botões (Buscar/Limpar/Avançado) ficam no tamanho natural */
.wdk-search .wdk-col-btns .wdk-field-group-search,
.wdk-search .wdk-col-btns .wdk-field-group-reset,
.wdk-search .wdk-col-btns .wdk-field-group-additional {
    flex: 0 0 auto;
}

/* --- Correção de cores: override do laranja do Elementor/tema --- */
/* Inputs de texto e número */
.wdk-search input[type="text"],
.wdk-search input[type="number"],
.wdk-search input[type="search"],
.wdk-search textarea,
.wdk-search .wdk-field input {
    color: #333 !important;
}
/* Placeholders */
.wdk-search input[type="text"]::placeholder,
.wdk-search input[type="number"]::placeholder,
.wdk-search input[type="search"]::placeholder,
.wdk-search .wdk-field input::placeholder,
.wdk-search input[name="field_search"]::placeholder {
    color: #999 !important;
    font-weight: 400;
}
/* Selects */
.wdk-search select,
.wdk-search .wdk-field select {
    color: #333 !important;
    background-color: #fff !important;
}
/* Opção vazia/placeholder do select */
.wdk-search select option[value=""] {
    color: #999 !important;
}
/* Botões dropdown (treefield/bootstrap) */
.wdk-search .btn,
.wdk-search .dropdown-toggle,
.wdk-search .wdk_dropdown_tree button,
.wdk-search .wdk_dropdown_tree .btn-group button {
    color: #333 !important;
}
/* Override Elementor inline color para campos WDK */
.wdk-search .wdk-field input[type="text"],
.wdk-search .wdk-field input[type="number"] {
    color: #333 !important;
}
.wdk-search .wdk-field input[type="text"]::placeholder,
.wdk-search .wdk-field input[type="number"]::placeholder {
    color: #999 !important;
}
/* Select do campo Tamanho (categorias) */
.wdk-search .wdk-field.CATEGORY .select2-selection,
.wdk-search .wdk-field.CATEGORY .select2-selection__rendered {
    color: #333 !important;
}

/* --- Dropdown de Área total (categorias): placeholder ----- */
.wdk-search .wdk-field.CATEGORY select,
.wdk-search .wdk-field.DROPDOWN select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
    color: #333 !important;
    background-color: #fff !important;
}

/* Select do campo Docas e campos avançados: fundo branco */
.wdk-search select[name="field_63_min"],
.wdk-search select.egm-docas-select,
.wdk-search select.egm-aluguel-select,
.wdk-search #wdk-form-additional select {
    background-color: #fff !important;
    color: #333 !important;
}

.wdk-field.wdk-col.wdk_search_field_2.DROPDOWN.wdk_field_id_2 select {
  background: #fff!important;
  color: #333 !important;
}

html .wdk-search-form .wdk-row:first-child .wdk-field.wdk_search_field_search,
html .wdk-search-form .wdk-row:first-child .wdk_search_field_search,
html .wdk-search-form .wdk-row:first-child .wdk-col.wdk_search_field_search {
  width: 30% !important;
  flex: 0 0 30% !important;
  max-width: 30% !important;
}

button#wdk-search-additional.wdk-search-additional-btn {
  color: #fff!important;
}

/* --- Campo customizado de aluguel e docas --- */
.wdk-search .egm-custom-field {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff !important;
    color: #333 !important;
    font-size: 14px;
    box-sizing: border-box;
}
.wdk-search .egm-custom-field option[value=""] {
    color: #999;
}

/* --- Mobile: empilhar colunas --- */
@media (max-width: 767px) {
    .wdk-search .wdk-col-btns {
        flex-wrap: wrap;
    }
    .wdk-search .wdk-field-group-additional {
        order: 3;
        margin-left: 0;
        width: 100%;
        text-align: right;
    }
    .wdk-search #wdk-form-additional {
        margin-top: 8px;
        padding-top: 8px;
    }

    .wdk-search #wdk-form-additional .wdk-field {
        flex: 1 1 100%;
        min-width: 0;
    }
}

/* --- Modal desambiguação de localização --- */
.egm-location-picker {
    position: fixed;
    inset: 0;
    z-index: 100000;
}
.egm-location-picker-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}
.egm-location-picker-panel {
    position: relative;
    max-width: 420px;
    margin: 10vh auto 0;
    background: #fff;
    border-radius: 8px;
    padding: 20px 22px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}
.egm-location-picker-panel h3 {
    margin: 0 0 8px;
    font-size: 1.1rem;
}
.egm-location-picker-hint {
    margin: 0 0 14px;
    font-size: 0.9rem;
    color: #555;
}
.egm-location-picker-list {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
    max-height: 50vh;
    overflow-y: auto;
}
.egm-location-picker-list li {
    margin: 0 0 8px;
}
.egm-location-picker-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fafafa;
    cursor: pointer;
    font-size: 14px;
}
.egm-location-picker-item:hover {
    border-color: #999;
    background: #f0f0f0;
}
.egm-location-picker-item strong {
    display: block;
}
.egm-location-picker-item .egm-loc-sub {
    display: block;
    font-size: 12px;
    color: #666;
    font-weight: normal;
    margin-top: 4px;
}
.egm-location-picker-close {
    display: inline-block;
    padding: 8px 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
}
