/* Property Search Styles */

.property-search-form {
    margin: 30px 0;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.property-search-fields {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
}

/* Layout Horizontal (default) */
.property-search-form[data-layout="horizontal"] .property-search-fields {
    flex-direction: row;
}

/* Layout Vertical */
.property-search-form[data-layout="vertical"] .property-search-fields {
    flex-direction: column;
    align-items: stretch;
}

.property-search-form[data-layout="vertical"] .search-field {
    width: 100%;
}

.property-search-form[data-layout="vertical"] .search-field-submit {
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
}

/* Campo de búsqueda */
.search-field {
    flex: 1;
    min-width: 150px;
    display: flex;
    flex-direction: column;
}

.search-field label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 5px;
    display: block;
}

/* Selectores */
.property-search-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
    background-color: #fff;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.property-search-select:hover {
    border-color: #999;
}

.property-search-select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

/* Inputs de precio */
.search-field-price {
    flex: 1.5;
    min-width: 200px;
}

.price-range-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.property-search-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
    transition: border-color 0.3s ease;
}

.property-search-input:hover {
    border-color: #999;
}

.property-search-input:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.price-separator {
    color: #999;
    font-weight: 600;
}

/* Botón de búsqueda */
.search-field-submit {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: center;
}

.property-search-button {
    padding: 12px 16px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 44px;
}

.property-search-button .search-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.property-search-button .button-text {
    display: none; /* Ocultar texto, solo mostrar ícono */
}

.property-search-button {
    padding: 12px;
    justify-content: center;
    min-width: 44px; /* Mínimo para touch */
}

.property-search-button:hover {
    background: #135e96;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(34, 113, 177, 0.3);
}

.property-search-button:active {
    transform: translateY(0);
}

/* Botón de limpiar filtros */
.property-search-reset {
    padding: 12px 16px;
    background: #dc3545;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 44px;
}

.property-search-reset .trash-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.property-search-reset:hover {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.property-search-reset:active {
    transform: translateY(0);
}

/* Ocultar texto del botón reset, solo mostrar ícono */
.property-search-reset .reset-text {
    display: none;
}

.property-search-reset {
    padding: 12px;
    justify-content: center;
    min-width: 44px; /* Mínimo para touch */
}

/* Tooltips para los botones */
.property-search-button,
.property-search-reset {
    position: relative;
}

.property-search-button::before,
.property-search-reset::before {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    font-size: 12px;
    white-space: nowrap;
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    margin-bottom: 8px;
    z-index: 1000;
}

.property-search-button::after,
.property-search-reset::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    margin-bottom: 3px;
}

.property-search-button:hover::before,
.property-search-button:hover::after,
.property-search-reset:hover::before,
.property-search-reset:hover::after {
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .property-search-fields {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-field,
    .search-field-price {
        width: 100%;
        min-width: 100%;
    }
    
    .search-field-submit {
        width: 100%;
        flex-direction: row;
        justify-content: center;
        gap: 10px;
    }
    
    .property-search-button,
    .property-search-reset {
        flex: 0 0 auto;
        padding: 12px 16px;
        justify-content: center;
        min-width: 44px;
    }
}

@media (max-width: 480px) {
    .property-search-form {
        padding: 15px;
    }
    
    .price-range-inputs {
        flex-direction: column;
        gap: 10px;
    }
    
    .price-separator {
        display: none;
    }
}

/* Estilo del tema Flatsome (opcional) */
.property-search-form.flatsome-style {
    background: #f7f7f7;
    border: 1px solid #e0e0e0;
}

.flatsome-style .property-search-button {
    background: var(--primary-color, #2271b1);
}

.flatsome-style .property-search-button:hover {
    background: var(--primary-color-hover, #135e96);
}

/* Loading state */
.property-search-form.loading {
    opacity: 0.6;
    pointer-events: none;
}

.property-search-form.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2271b1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===================================
   SELECT2 CUSTOM STYLES
   =================================== */

.select2-container--default .select2-selection--single {
    height: 44px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 44px;
    padding-left: 12px;
    color: #333;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 42px;
    right: 8px;
}

/* Dropdown con búsqueda */
.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

/* Resultados con jerarquía */
.select2-container--default .select2-results__option {
    padding: 8px 12px;
    font-size: 14px;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #2271b1;
    color: white;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: #e8f0fe;
    color: #333;
}

/* Estilos por tipo de ubicación */
.location-type-country {
    font-weight: 700;
    color: #1a1a1a;
}

.location-type-department {
    font-weight: 600;
    color: #333;
}

.location-type-municipality {
    font-weight: 500;
    color: #555;
}

.location-type-zone {
    font-weight: 400;
    color: #666;
}

/* Dropdown */
.select2-dropdown {
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Select2 con placeholder */
.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #999;
}

/* Responsive Select2 */
@media (max-width: 768px) {
    .select2-container--default .select2-selection--single {
        height: 46px;
    }
    
    .select2-container--default .select2-selection--single .select2-selection__rendered {
        line-height: 46px;
    }
}
